From 23520b3a5c8d7538eb3f62993c8012573fcb289d Mon Sep 17 00:00:00 2001 From: Yongseok Koh Date: Fri, 27 Apr 2018 10:22:52 -0700 Subject: [PATCH] app/testpmd: conserve offload flags of mbuf 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 Acked-by: Andrew Rybchenko --- app/test-pmd/csumonly.c | 3 ++- app/test-pmd/macfwd.c | 3 ++- app/test-pmd/macswap.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index 53b98412a1..0bb88cf7dc 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -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 */ diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c index 2adce70190..7cac757a00 100644 --- a/app/test-pmd/macfwd.c +++ b/app/test-pmd/macfwd.c @@ -96,7 +96,8 @@ pkt_burst_mac_forward(struct fwd_stream *fs) ð_hdr->d_addr); ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_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; diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c index e2cc4812c4..a8384d5b81 100644 --- a/app/test-pmd/macswap.c +++ b/app/test-pmd/macswap.c @@ -127,7 +127,8 @@ pkt_burst_mac_swap(struct fwd_stream *fs) ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); ether_addr_copy(&addr, ð_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; -- 2.20.1