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 05956A0597; Wed, 8 Apr 2020 03:10:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 46C151BF0B; Wed, 8 Apr 2020 03:10:52 +0200 (CEST) Received: from huawei.com (szxga01-in.huawei.com [45.249.212.187]) by dpdk.org (Postfix) with ESMTP id 1DE871BEE6; Wed, 8 Apr 2020 03:10:51 +0200 (CEST) Received: from DGGEMM401-HUB.china.huawei.com (unknown [172.30.72.56]) by Forcepoint Email with ESMTP id A5F09E0CB96A402D2622; Wed, 8 Apr 2020 09:10:49 +0800 (CST) Received: from DGGEMM533-MBX.china.huawei.com ([169.254.5.250]) by DGGEMM401-HUB.china.huawei.com ([10.3.20.209]) with mapi id 14.03.0487.000; Wed, 8 Apr 2020 09:10:40 +0800 From: wangyunjian To: Stephen Hemminger , Ferruh Yigit CC: "dev@dpdk.org" , "keith.wiles@intel.com" , "Lilijun (Jerry)" , xudingke , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [dpdk-stable] [PATCH v3 3/5] net/tap: fix check for mbuf's nb_segs failure Thread-Index: AQHWDPK4V6vLnVufSU+seNlwJOOPUqhtR0KAgAAGLYCAARoIYA== Date: Wed, 8 Apr 2020 01:10:39 +0000 Message-ID: <34EFBCA9F01B0748BEB6B629CE643AE60CF5C574@DGGEMM533-MBX.china.huawei.com> References: <1586233383-1084-1-git-send-email-wangyunjian@huawei.com> <7da1388e-c4c6-27d5-f038-0526a39d9a8c@intel.com> <20200407083846.674ca9e4@hermes.lan> <20200407090805.6941a61b@hermes.lan> In-Reply-To: <20200407090805.6941a61b@hermes.lan> Accept-Language: en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.173.251.152] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-CFilter-Loop: Reflected Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH v3 3/5] net/tap: fix check for mbuf's nb_segs failure 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" > -----Original Message----- > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > Sent: Wednesday, April 8, 2020 12:08 AM > To: Ferruh Yigit > Cc: wangyunjian ; dev@dpdk.org; > keith.wiles@intel.com; Lilijun (Jerry) ; xuding= ke > ; stable@dpdk.org > Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH v3 3/5] net/tap: fix check f= or > mbuf's nb_segs failure >=20 > On Tue, 7 Apr 2020 16:45:59 +0100 > Ferruh Yigit wrote: >=20 > > On 4/7/2020 4:38 PM, Stephen Hemminger wrote: > > > On Tue, 7 Apr 2020 16:15:16 +0100 > > > Ferruh Yigit wrote: > > > > > >>> +static void > > >>> +tap_rxq_pool_free(struct rte_mbuf *pool) { > > >>> + struct rte_mbuf *mbuf =3D pool; > > >>> + uint16_t nb_segs =3D 1; > > >>> + > > >>> + if (mbuf =3D=3D NULL) > > >>> + return; > > >>> + > > >>> + while (mbuf->next) { > > >>> + mbuf =3D mbuf->next; > > >>> + nb_segs++; > > >>> + } > > >>> + pool->nb_segs =3D nb_segs; > > >>> + rte_pktmbuf_free(pool); > > >>> +} > > > > > > Since mbuf is going to be free, why bother with nb_segs. > > > Since rte_pktmbuf_free takes NULL as an argument, and frees the > > > m->next chain I don't see why not just > > > rte_pktmbuf_free(pool) > > > > > > > Chain is not constructed properly, 'nb_segs' is wrong, only > 'rte_pktmbuf_free()' > > call won't free all the chain but first mbuf. > > > > This implementation is fixing 'nb_segs' sot that 'rte_pktmbuf_free()' > > can work as you suggested. > > > > Or I suggest iterate the list and fix all mbufs, instead of fixing > > 'nb_segs', this may be one iteration less. >=20 > If you look at implementation of rte_pktmbuf_free() in current DPDK versi= on it > does not care what nb_segs is set to. I found this problem with mbuf debug enabled. Thanks Yunjian