From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jiayu Hu Subject: Re: [PATCH 2/5] gso/lib: add TCP/IPv4 GSO support Date: Wed, 30 Aug 2017 17:03:13 +0800 Message-ID: <20170830090313.GB79910@dpdk15.sh.intel.com> References: <1503584144-63181-1-git-send-email-jiayu.hu@intel.com> <1503584144-63181-3-git-send-email-jiayu.hu@intel.com> <2601191342CEEE43887BDE71AB9772584F23E097@IRSMSX103.ger.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "dev@dpdk.org" , "Kavanagh, Mark B" , "Tan, Jianfeng" To: "Ananyev, Konstantin" Return-path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 4D51F29D6 for ; Wed, 30 Aug 2017 11:00:37 +0200 (CEST) Content-Disposition: inline In-Reply-To: <2601191342CEEE43887BDE71AB9772584F23E097@IRSMSX103.ger.corp.intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Konstantin, On Wed, Aug 30, 2017 at 09:38:33AM +0800, Ananyev, Konstantin wrote: > > > > -----Original Message----- > > From: Hu, Jiayu > > Sent: Thursday, August 24, 2017 3:16 PM > > To: dev@dpdk.org > > Cc: Kavanagh, Mark B ; Ananyev, Konstantin ; Tan, Jianfeng > > ; Hu, Jiayu > > Subject: [PATCH 2/5] gso/lib: add TCP/IPv4 GSO support > > > > This patch adds GSO support for TCP/IPv4 packets. Supported packets > > may include a single VLAN tag. TCP/IPv4 GSO assumes that all input > > packets have correct checksums, and doesn't update checksums for output > > packets (the responsibility for this lies with the application). > > Additionally, TCP/IPv4 GSO doesn't process IP fragmented packets. > > > > TCP/IPv4 GSO uses two chained MBUFs, one direct MBUF and one indrect > > MBUF, to organize an output packet. Note that we refer to these two > > chained MBUFs as a two-segment MBUF. The direct MBUF stores the packet > > header, while the indirect mbuf simply points to a location within the > > original packet's payload. Consequently, use of the GSO library requires > > multi-segment MBUF support in the TX functions of the NIC driver. > > > > If a packet is GSOed, TCP/IPv4 GSO reduces its MBUF refcnt by 1. As a > > result, when all of its GSOed segments are freed, the packet is freed > > automatically. > > > > Signed-off-by: Jiayu Hu > > Signed-off-by: Mark Kavanagh > > --- > > int > > rte_gso_segment(struct rte_mbuf *pkt, > > struct rte_gso_ctx gso_ctx, > > struct rte_mbuf **pkts_out, > > - uint16_t nb_pkts_out __rte_unused) > > + uint16_t nb_pkts_out) > > { > > + struct rte_mempool *direct_pool, *indirect_pool; > > + struct rte_mbuf *pkt_seg; > > + uint16_t nb_segments, gso_size; > > + > > if (pkt == NULL || pkts_out == NULL || gso_ctx.direct_pool == > > NULL || gso_ctx.indirect_pool == NULL) > > return -EINVAL; > > Probably we don't need to check gso_ctx values for each incoming packet. > If you feel it is necessary - create new function rte_gso_ctx_check() that > could be performed just once per ctx. > > > > > - return 1; > > + if ((gso_ctx.gso_types & RTE_GSO_TCP_IPV4) == 0 || > > + gso_ctx.gso_size >= pkt->pkt_len || > > + gso_ctx.gso_size == 0) > > > First and third condition seems redundant. Yes, we don't need the first and the third check here. Please ingore the redundant reply in the previous mail. Thanks, Jiayu