From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 57DBCA04B5; Thu, 29 Oct 2020 22:39:29 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B7F0BCA18; Thu, 29 Oct 2020 22:39:26 +0100 (CET) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id 7ABDEC84E; Thu, 29 Oct 2020 22:39:24 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 235605C0105; Thu, 29 Oct 2020 17:39:23 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Thu, 29 Oct 2020 17:39:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=fm2; bh= HGuMjceg4Uvp5WWAoQtUakTM20WKUUz1nJh4Z0yWHfw=; b=QMPbwRk2SDZLkhep njaeFiIpIdC5p49wp/AduMGg50op83RTXoAt/G4pYVP6ItbF3xQLpt0ZeU57zvUJ Wd7J/loe7xBxzzH67jKj/6WNd2XlsS/sLVXT9A8ggEqbVlpscO9wshqWAZd+nGPN FmYyWrfkEyPiD38LIX5veduk1xGc5cFmuMdYUymSxtZmlCfIBWkB86ko4yPfORBE YEFUb/pmLwdKsP+I+w6Ox/6uUjPE6/F0UTMoO135pPXUSzThDgKnT9VebetSh+c5 mYKYnF+uY8rdLJ7sQmKTuqwfWmLzstdAIZfi78p8QeGjOTNVoqoxXQCNATKXfWVA SKgYcA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=HGuMjceg4Uvp5WWAoQtUakTM20WKUUz1nJh4Z0yWH fw=; b=L/Ji0ano0/lEOqLx81CVd5QPwiZruea3+WfHxIDAXQR4ygckHo2U23t8A vQ+hq7uNnFn+mQdvG72tk7x16knoHPaGL1hkkwFbuj1xy/+B9Y+b3MvvDJaQxOd9 Lz9eZHOoaievqAMA+6repLcGhAV6W5PKeA3D/AbrIOMoXAlCPU7NS2hGxmdFbTEg 3Y40qK+2PgDzqFdsRI9yz51/rgMbu0Eza7AV4Yicu0Zc9+7YJboyKcU+GslqGVLT 2OtLi1t5mlT8aQKgpET9p1luU9Mk7bEDdDTVVeGZaSSor6f4lhHGmTXg/kpqrm68 qIQUCoGnhm0GlLqY2euknTPkmCZuQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleefgdduhedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepudeggfdvfeduffdtfeeglefghfeukefgfffhueejtdetuedtjeeu ieeivdffgeehnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl ohhnrdhnvght X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 31C363280065; Thu, 29 Oct 2020 17:39:21 -0400 (EDT) From: Thomas Monjalon To: "techboard@dpdk.org" , "Ananyev, Konstantin" Cc: "yang_y_yi@163.com" , "dev@dpdk.org" , "Hu, Jiayu" , "yangyi01@inspur.com" , olivier.matz@6wind.com Date: Thu, 29 Oct 2020 22:39:20 +0100 Message-ID: <1680723.gEWeqp86JR@thomas> In-Reply-To: References: <20201026064713.33316-1-yang_y_yi@163.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v3] gso: fix free issue of mbuf gso segments attach to 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" I don't have a clear opinion on this patch. Techboard members, ping for feedbacks. If no objection, I will merge it soon, but I would prefer having more acks. 27/10/2020 20:55, Ananyev, Konstantin: > From: yang_y_yi@163.com > > From: Yi Yang > > > > rte_gso_segment decreased refcnt of pkt by one, but > > it is wrong if pkt is external mbuf, pkt won't be > > freed because of incorrect refcnt, the result is > > application can't allocate mbuf from mempool because > > mbufs in mempool are run out of. > > > > One correct way is application should call > > rte_pktmbuf_free after calling rte_gso_segment to free > > pkt explicitly. rte_gso_segment mustn't handle it, this > > should be responsibility of application. > > > > This commit changed rte_gso_segment in functional behavior > > and return value, so the application must take appropriate > > actions according to return values, "ret < 0" means it > > should free and drop 'pkt', "ret == 0" means 'pkt' isn't > > GSOed but 'pkt' can be transimmitted as a normal packet, > > "ret > 0" means 'pkt' has been GSOed into two or multiple > > segments, it should use "pkts_out" to transmit these > > segments. The application must free 'pkt' after call > > rte_gso_segment when return value isn't equal to 0. > > Tech-board members: this is not a formal API breakage, > but it is a functional change (i.e. all code that uses that API will need to be changed). > There was no deprecation note in advance. > So please provide your input: are you ok with such change or not. > > I am ok with the proposed changes. > Acked-by: Konstantin Ananyev [...] > > packets in software. Note however, that GSO is implemented as a standalone > > library, and not via a 'fallback' mechanism (i.e. for when TSO is unsupported > > in the underlying hardware); that is, applications must explicitly invoke the > > -GSO library to segment packets. The size of GSO segments ``(segsz)`` is > > -configurable by the application. > > +GSO library to segment packets, they also must call ``rte_pktmbuf_free()`` to > > +free mbuf GSO segments attach to after calling ``rte_gso_segment()``. The size > > +of GSO segments ``(segsz)`` is configurable by the application. [...] > > #. Invoke the GSO segmentation API, ``rte_gso_segment()``. > > > > +#. Call ``rte_pktmbuf_free()`` to free mbuf ``rte_gso_segment()`` segments. [...] > > --- a/doc/guides/rel_notes/release_20_11.rst > > +++ b/doc/guides/rel_notes/release_20_11.rst > > @@ -543,6 +543,13 @@ API Changes > > +* **Changed ``rte_gso_segment`` in functional behavior and return value.** > > + > > + * Don't save pkt to pkts_out[0] if it isn't GSOed in case of ret == 1. > > + * Return 0 instead of 1 for the above case. > > + * ``rte_gso_segment`` won't free pkt no matter whether it is GSOed, the > > + application has responsibility to free it after call ``rte_gso_segment``. [...] > > --- a/lib/librte_gso/rte_gso.h > > +++ b/lib/librte_gso/rte_gso.h > > - * If the input packet is GSO'd, its mbuf refcnt reduces by 1. Therefore, > > - * when all GSO segments are freed, the input packet is freed automatically. > > + * If the input packet is GSO'd, all the indirect segments are attached to the > > + * input packet. > > + * > > + * rte_gso_segment() will not free the input packet no matter whether it is > > + * GSO'd or not, the application should free it after call rte_gso_segment(). > > * > > * If the memory space in pkts_out or MBUF pools is insufficient, this > > * function fails, and it returns (-1) * errno. Otherwise, GSO succeeds, > > @@ -109,6 +112,7 @@ struct rte_gso_ctx { > > * > > * @return > > * - The number of GSO segments filled in pkts_out on success. > > + * - Return 0 if it needn't GSOed. > > * - Return -ENOMEM if run out of memory in MBUF pools. > > * - Return -EINVAL for invalid parameters. > > */