test: fix TCP header initialization
authorLance Richardson <lance.richardson@broadcom.com>
Tue, 30 Mar 2021 13:23:28 +0000 (09:23 -0400)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 9 Apr 2021 10:43:25 +0000 (12:43 +0200)
Initialize TCP data offset field with TCP header length, this
field is used to derive L4 header length and by hardware to
validate a TCP header.

Fixes: 41f72ec94074 ("test: add packet burst generator functions")
Cc: stable@dpdk.org
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
app/test/packet_burst_generator.c

index f203f9d..c05ea7a 100644 (file)
@@ -117,6 +117,7 @@ initialize_tcp_header(struct rte_tcp_hdr *tcp_hdr, uint16_t src_port,
        memset(tcp_hdr, 0, sizeof(struct rte_tcp_hdr));
        tcp_hdr->src_port = rte_cpu_to_be_16(src_port);
        tcp_hdr->dst_port = rte_cpu_to_be_16(dst_port);
+       tcp_hdr->data_off = (sizeof(struct rte_tcp_hdr) << 2) & 0xF0;
 
        return pkt_len;
 }