[dpdk-dev] How to update the sequence number in TCP packets using DPDK-pktgen?

Stephen Hemminger stephen at networkplumber.org
Wed Oct 11 01:00:00 CEST 2017


On Mon, 9 Oct 2017 19:12:49 +0530
Shailja Pandey <csz168117 at iitd.ac.in> wrote:

> pktgen_tcp_hdr_ctor(pkt_seq_t *pkt, tcpip_t *tip, int type __rte_unused)
> {
>          uint16_t tlen;
> 
>          /* Zero out the header space */
>          memset((char *)tip, 0, sizeof(tcpip_t));
> 
>          /* Create the TCP header */
>          tip->ip.src         = htonl(pkt->

FYI memset is a performance hit. Gcc generates a rep string instruction
which slows down CPU.. Better to do either set all fields individually
or fill in the pad values by doing structure assignment.

	*tip = (tcpi_ip_t) {
		.ip.src = htonl(pkt->ip_src_addr.addr.ipv4_saddr),
	...
	};



More information about the dev mailing list