From mboxrd@z Thu Jan 1 00:00:00 1970 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) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1-us4.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id B0238B4005B; Fri, 27 Apr 2018 08:00:16 +0000 (UTC) Received: from [192.168.38.17] (84.52.114.114) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Fri, 27 Apr 2018 09:00:09 +0100 To: Yongseok Koh , , , CC: , , , , , References: <20180310012532.15809-1-yskoh@mellanox.com> <20180427000123.31888-1-yskoh@mellanox.com> <20180427000123.31888-2-yskoh@mellanox.com> From: Andrew Rybchenko Message-ID: <06928405-1e0b-65d4-539b-49b117ff59e3@solarflare.com> Date: Fri, 27 Apr 2018 11:00:04 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180427000123.31888-2-yskoh@mellanox.com> Content-Language: en-GB X-Originating-IP: [84.52.114.114] X-ClientProxiedBy: ocex03.SolarFlarecom.com (10.20.40.36) To ukex01.SolarFlarecom.com (10.17.10.4) X-TM-AS-Product-Ver: SMEX-11.0.0.1191-8.100.1062-23808.003 X-TM-AS-Result: No--17.748800-0.000000-31 X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-MDID: 1524816017-tdV-rydXBwOi Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v7 2/2] app/testpmd: conserve offload flags of mbuf X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Apr 2018 08:00:19 -0000 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