From: Pavan Nikhilesh Date: Tue, 2 Apr 2019 09:53:25 +0000 (+0000) Subject: app/testpmd: move header generation outside txonly loop X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=e54ac3b1d95be4a019af05f3c351d4520a2807f0;p=dpdk.git app/testpmd: move header generation outside txonly loop Testpmd txonly copies the src/dst mac address of the port being processed to ethernet header structure on the stack for every packet. Move it outside the loop and reuse it. Signed-off-by: Pavan Nikhilesh Reviewed-by: Ferruh Yigit --- diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index def52a0487..0d411dbf45 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -190,6 +190,14 @@ pkt_burst_transmit(struct fwd_stream *fs) ol_flags |= PKT_TX_QINQ_PKT; if (tx_offloads & DEV_TX_OFFLOAD_MACSEC_INSERT) ol_flags |= PKT_TX_MACSEC; + + /* + * Initialize Ethernet header. + */ + ether_addr_copy(&peer_eth_addrs[fs->peer_addr], ð_hdr.d_addr); + ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_hdr.s_addr); + eth_hdr.ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + for (nb_pkt = 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) { pkt = rte_mbuf_raw_alloc(mbp); if (pkt == NULL) { @@ -226,13 +234,6 @@ pkt_burst_transmit(struct fwd_stream *fs) } pkt_seg->next = NULL; /* Last segment of packet. */ - /* - * Initialize Ethernet header. - */ - ether_addr_copy(&peer_eth_addrs[fs->peer_addr],ð_hdr.d_addr); - ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_hdr.s_addr); - eth_hdr.ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); - /* * Copy headers in first packet segment(s). */