app/testpmd: conserve offload flags of mbuf
authorYongseok Koh <yskoh@mellanox.com>
Fri, 27 Apr 2018 17:22:52 +0000 (10:22 -0700)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 27 Apr 2018 18:11:33 +0000 (20:11 +0200)
This patch is to accommodate an experimental feature of mbuf - external
buffer attachment. If mbuf is attached to an external buffer, its ol_flags
will have EXT_ATTACHED_MBUF set. Without enabling/using the feature,
everything remains same.

If PMD delivers Rx packets with non-direct mbuf, ol_flags should not be
overwritten. For mlx5 PMD, if Multi-Packet RQ is enabled, Rx packets could
be carried with externally attached mbufs.

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
app/test-pmd/csumonly.c
app/test-pmd/macfwd.c
app/test-pmd/macswap.c

index 53b9841..0bb88cf 100644 (file)
@@ -737,7 +737,8 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
                m = pkts_burst[i];
                info.is_tunnel = 0;
                info.pkt_len = rte_pktmbuf_pkt_len(m);
-               tx_ol_flags = 0;
+               tx_ol_flags = m->ol_flags &
+                             (IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF);
                rx_ol_flags = m->ol_flags;
 
                /* Update the L3/L4 checksum error packet statistics */
index 2adce70..7cac757 100644 (file)
@@ -96,7 +96,8 @@ pkt_burst_mac_forward(struct fwd_stream *fs)
                                &eth_hdr->d_addr);
                ether_addr_copy(&ports[fs->tx_port].eth_addr,
                                &eth_hdr->s_addr);
-               mb->ol_flags = ol_flags;
+               mb->ol_flags &= IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF;
+               mb->ol_flags |= ol_flags;
                mb->l2_len = sizeof(struct ether_hdr);
                mb->l3_len = sizeof(struct ipv4_hdr);
                mb->vlan_tci = txp->tx_vlan_id;
index e2cc481..a8384d5 100644 (file)
@@ -127,7 +127,8 @@ pkt_burst_mac_swap(struct fwd_stream *fs)
                ether_addr_copy(&eth_hdr->s_addr, &eth_hdr->d_addr);
                ether_addr_copy(&addr, &eth_hdr->s_addr);
 
-               mb->ol_flags = ol_flags;
+               mb->ol_flags &= IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF;
+               mb->ol_flags |= ol_flags;
                mb->l2_len = sizeof(struct ether_hdr);
                mb->l3_len = sizeof(struct ipv4_hdr);
                mb->vlan_tci = txp->tx_vlan_id;