From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Rybchenko Subject: Re: [PATCH v7 2/2] app/testpmd: conserve offload flags of mbuf Date: Fri, 27 Apr 2018 11:00:04 +0300 Message-ID: <06928405-1e0b-65d4-539b-49b117ff59e3@solarflare.com> References: <20180310012532.15809-1-yskoh@mellanox.com> <20180427000123.31888-1-yskoh@mellanox.com> <20180427000123.31888-2-yskoh@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Cc: , , , , , To: Yongseok Koh , , , Return-path: Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id 4069F7CA3 for ; Fri, 27 Apr 2018 10:00:18 +0200 (CEST) In-Reply-To: <20180427000123.31888-2-yskoh@mellanox.com> Content-Language: en-GB List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 04/27/2018 03:01 AM, Yongseok Koh wrote: > 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 > --- > app/test-pmd/csumonly.c | 3 +++ > app/test-pmd/macfwd.c | 3 +++ > app/test-pmd/macswap.c | 3 +++ > 3 files changed, 9 insertions(+) > > diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c > index 53b98412a..4a82bbc92 100644 > --- a/app/test-pmd/csumonly.c > +++ b/app/test-pmd/csumonly.c > @@ -851,6 +851,9 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) > m->l4_len = info.l4_len; > m->tso_segsz = info.tso_segsz; > } > + if (!RTE_MBUF_DIRECT(m)) > + tx_ol_flags |= m->ol_flags & > + (IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF); 1. I see no point to check !RTE_MBUF_DIRECT(m). Just inherit flags. 2. Consider to do it when tx_ol_flags are initialized above as 0, i.e.    tx_ol_flags = m->ol_flags & (IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF); > m->ol_flags = tx_ol_flags; > > /* Do split & copy for the packet. */ > diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c > index 2adce7019..ba0021194 100644 > --- a/app/test-pmd/macfwd.c > +++ b/app/test-pmd/macfwd.c > @@ -96,6 +96,9 @@ pkt_burst_mac_forward(struct fwd_stream *fs) > ð_hdr->d_addr); > ether_addr_copy(&ports[fs->tx_port].eth_addr, > ð_hdr->s_addr); > + if (!RTE_MBUF_DIRECT(mb)) > + ol_flags |= mb->ol_flags & > + (IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF); 1. Do not update ol_flags which is global and applied for all mbufs in the burst. 2. There is no point to check for  (!RTE_MBUF_DIRECT(mb). Just inherit these flags. > mb->ol_flags = ol_flags; > mb->l2_len = sizeof(struct ether_hdr); > mb->l3_len = sizeof(struct ipv4_hdr); > diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c > index e2cc4812c..b8d15f6ba 100644 > --- a/app/test-pmd/macswap.c > +++ b/app/test-pmd/macswap.c > @@ -127,6 +127,9 @@ pkt_burst_mac_swap(struct fwd_stream *fs) > ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); > ether_addr_copy(&addr, ð_hdr->s_addr); > > + if (!RTE_MBUF_DIRECT(mb)) > + ol_flags |= mb->ol_flags & > + (IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF); Same as above.k > mb->ol_flags = ol_flags; > mb->l2_len = sizeof(struct ether_hdr); > mb->l3_len = sizeof(struct ipv4_hdr); With above fixed: Acked-by: Andrew Rybchenko