[PATCH v3] app/testpmd: support runt and ultra-small frames in txonly

yangxingui yangxingui at huawei.com
Thu Jul 23 06:00:40 CEST 2026



On 2026/7/23 6:22, Stephen Hemminger wrote:
> On Mon, 6 Jul 2026 21:20:50 +0800
> Xingui Yang <yangxingui at huawei.com> wrote:
> 
>> Allow set txpkts to accept packet lengths as small as one byte,
>> enabling generation of runt frames and ultra-small packets for
>> testing NIC padding logic and undersized frame handling.
>>
>> The txonly engine handles three ranges: normal (>= 42 bytes) with
>> full Ethernet/IPv4/UDP headers, runt (14-41 bytes) with truncated
>> headers, and ultra-small (< 14 bytes) filled with a repeating
>> pattern. Checksum offloads are disabled when headers are incomplete.
>>
>> Minimum length validation in set_tx_pkt_segments() is relaxed from
>> 42 to 1 byte. Random split and multi-flow still require the full
>> header stack in the first segment, as enforced by tx_only_begin().
>>
>> Signed-off-by: Xingui Yang <yangxingui at huawei.com>
>> Suggested-by: Stephen Hemminger <stephen at networkplumber.org>
>> ---
>   
> I would suggest that if NIC ever gets a packet < ethernet header it is
> an application bug, and driver should drop it as an transmit error.
> Or crash with an assert failed. There is no guarantee that this
> will ever work.
> 
> Therefore can not see why testpmd needs to do this.
> 
> For packets with Ethernet header plus a few more bytes, it makes
> sense to allow. There are always control level protocols that are
> very short.

Haha, I think you're right. We have an internal test case for 
ultra-short packets to verify hardware capabilities, and this test case 
has been around for many years. We have maintained this private patch 
separately for many years. It's possible that other network cards might 
not have such a requirement.

Thanks.
Xingui


More information about the dev mailing list