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 CA1E5A0530; Wed, 12 Feb 2020 03:33:31 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BAEB22A5D; Wed, 12 Feb 2020 03:33:30 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 8855529CB for ; Wed, 12 Feb 2020 03:33:28 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Feb 2020 18:33:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,428,1574150400"; d="scan'208";a="256675398" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga004.fm.intel.com with ESMTP; 11 Feb 2020 18:33:26 -0800 Received: from fmsmsx161.amr.corp.intel.com (10.18.125.9) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 11 Feb 2020 18:33:26 -0800 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by FMSMSX161.amr.corp.intel.com (10.18.125.9) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 11 Feb 2020 18:33:26 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.222]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.46]) with mapi id 14.03.0439.000; Wed, 12 Feb 2020 10:33:24 +0800 From: "Xing, Beilei" To: "Richardson, Bruce" CC: "dev@dpdk.org" , "Zhang, Qi Z" Thread-Topic: [dpdk-dev] [PATCH] net/i40e: fix unchecked return value Thread-Index: AQHV4MOB1hAhyItoUESWYQVEwrmMAagVWP6AgAF+f8A= Date: Wed, 12 Feb 2020 02:33:24 +0000 Message-ID: <94479800C636CB44BD422CB454846E013CEE5D8E@SHSMSX101.ccr.corp.intel.com> References: <1581447720-29099-1-git-send-email-beilei.xing@intel.com> <20200211114219.GD823@bricha3-MOBL.ger.corp.intel.com> In-Reply-To: <20200211114219.GD823@bricha3-MOBL.ger.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzM3N2RlZTgtNDAxMS00ZmE1LThlMTItYTgzMzQyMWVlNGFmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoieGtXTXMzZjRBMWpvakx3clFuT1dROEdjaVdvdjVvbTVCc0FtRm8xQXZDT0JqcElpZzU0bDkyS2RsWjBROTZUTyJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] net/i40e: fix unchecked return value 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: Bruce Richardson > Sent: Tuesday, February 11, 2020 7:42 PM > To: Xing, Beilei > Cc: dev@dpdk.org; Zhang, Qi Z > Subject: Re: [dpdk-dev] [PATCH] net/i40e: fix unchecked return value >=20 > On Wed, Feb 12, 2020 at 03:02:00AM +0800, Beilei Xing wrote: > > Check the return value of the i40e_xmit_cleanup function. > > > > Coverity issue: 353617 > > Fixes: 4861cde46116 ("i40e: new poll mode driver") > > > > Signed-off-by: Beilei Xing > > --- > > drivers/net/i40e/i40e_rxtx.c | 5 +++-- > > 1 file changed, 3 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/net/i40e/i40e_rxtx.c > > b/drivers/net/i40e/i40e_rxtx.c index fd1ae80..f43fc0f 100644 > > --- a/drivers/net/i40e/i40e_rxtx.c > > +++ b/drivers/net/i40e/i40e_rxtx.c > > @@ -1038,8 +1038,9 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf > **tx_pkts, uint16_t nb_pkts) > > txe =3D &sw_ring[tx_id]; > > > > /* Check if the descriptor ring needs to be cleaned. */ > > - if (txq->nb_tx_free < txq->tx_free_thresh) > > - i40e_xmit_cleanup(txq); > > + if ((txq->nb_tx_free < txq->tx_free_thresh) && > > + (i40e_xmit_cleanup(txq) !=3D 0)) > > + return 0; > > >=20 > I don't think this should be fixed, and the original code is correct. >=20 > This cleanup is opportunistic and may not cause problems if it fails. For > example, if tx_free_thresh is 32, and nb_tx_free is 24, there is no reaso= n to > return zero here if the total packets to be sent it 16 - since all packet= s can > feasibly fit. Even if we had 32 to transmit, we still should not quit her= e, since > any packets that can be transmitted should be sent, and there is a > subsequent cleanup call at line 1084 to handle failed cleanup when it doe= s > become a problem. Yes, agree. Will abandon the patch. Thanks. >=20 > Regards, > /Bruce