app/testpmd: fix packet header in txonly mode
In txonly forward mode, the packet header is fixed by the initial
setting, including the packet length and checksum. So when the packets
varies, this may cause a packet header error. Currently, there are two
methods in txonly mode to randomly change the packets.
1. Set txsplit random and txpkts (x[,y]*), the number of segments
each packets will be a random value between 1 and total number of
segments determined by txpkts settings.
The step as follows:
a) ./testpmd -w xxx -l xx -n 4 -- -i --disable-device-start
b) port config 0 tx_offload multi_segs on
c) set fwd txonly
d) set txsplit rand
e) set txpkts 2048,2048,2048,2048
f) start
The nb_segs of the packets sent by testpmd will be 1~4. The real packet
length will be 2048, 4096, 6144 and 8192. But in fact the packet length
in ip header and udp header will be fixed by 8178 and 8158.
2. Set txonly-multi-flow. the ip address will be varied to generate
multiple flow.
The step as follows:
a) ./testpmd -w xxx -l xx -n 4 -- -i --txonly-multi-flow
b) set fwd txonly
c) start
The ip address of each pkts will change randomly, but since the header
is fixed, the checksum may be a error value.
Therefore, this patch adds a function to update the packet length and
check sum in the pkts header when the txsplit mode is set to rand or
multi-flow is set.
Fixes:
82010ef55e7c ("app/testpmd: make txonly mode generate multiple flows")
Fixes:
79bec05b32b7 ("app/testpmd: add ability to split outgoing packets")
Cc: stable@dpdk.org
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>