From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 99771A0540 for ; Thu, 10 Nov 2022 11:37:24 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 912BE40A87; Thu, 10 Nov 2022 11:37:24 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 8ADF0400EF; Thu, 10 Nov 2022 11:37:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668076641; x=1699612641; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=30V+yEtzE+0/XGUrhlWc1wIJSQsxDtzoYAHk0dfoP/g=; b=nV+BqvUZjuokzAUv0BFe0eqsaG7nZQBFYnuW1Y4HU41O5jao1Sabes+W agIH8LF1qoBVn3NQP5J0KSfihmpu1ZHva0JK4eo7Rc/RQkTf7tZYkIFNA FworkQm5g5wbcyTpAQCEQBTq+vDZT9C7c6Cs8e5Lo2ROUzAzp+vDjvl3Z dKXyIMldkz49u8SnNx1jdEzzUBPTwoIy1WI/+sbQEJT/AFmX7fm3+r6dE jiJh1nIpFfKVlXlrBbEPdwFLM4GjybNZgsJth5BVhy4BLH8m4DgBcrQat 2KQ+rig7qpT4QRIArNI1lBE/B92kk7E1JInkiTARICoVKJsr1a/konpYj w==; X-IronPort-AV: E=McAfee;i="6500,9779,10526"; a="309991457" X-IronPort-AV: E=Sophos;i="5.96,153,1665471600"; d="scan'208";a="309991457" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Nov 2022 02:37:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10526"; a="588130940" X-IronPort-AV: E=Sophos;i="5.96,153,1665471600"; d="scan'208";a="588130940" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga003.jf.intel.com with ESMTP; 10 Nov 2022 02:37:19 -0800 Received: from orsmsx603.amr.corp.intel.com (10.22.229.16) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 10 Nov 2022 02:37:19 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Thu, 10 Nov 2022 02:37:19 -0800 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.105) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Thu, 10 Nov 2022 02:37:18 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O4FFoNw/yStAiHaJVqCKfhEYVQok2NfifAkAAyxr1PdlT2uKEsrX0uEpGO8HrCAGTCy3UtakmbBMmqzOahXp8pP9wbP2AEJv+jOFKbPU+igsDgbkPT9/Uj/fZdtShlLKfUVkiNbHwHeGLBo0X4WepaMQh+LKzl59ghrdqK1mkH5y91BwRVgmMoq5F2IOdBmUSkcsifpPBgF4YHwSDEMKD3G7YFq7ZJXnfp/jcpwKHJIiyBcHfn+OE6jgSN2CyFcr8tT8y1P/ZUPi0MOvZ+amyVmuXKBnVTU2NELKe6FVcq6pvD7Tgwybfv964sjzi+UGTxOEKdj+I6HYK9AQ/ylqKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+W0b7tc82SE0drQ2Tz3nR+5/yzSKUOrNc4v09sFj6Os=; b=nxAYS63cl0XMeO7y+lQ5aChlX4QVP4u/h4nL0d2TrrTorEj8HIPmULPhizuAbZyjYdi/JwuFlg7IzUAsjc4qCAjS06v+2nRHEIqLBquJtxIj/A6R/aCyFWaifz0lI1Cxo/uUzMuRtnZMS+4d/Q1hI8gar1HCbpgHtvKIZB8QEyy99lwozKqmHNT3H2SSllE3wqa+DG2iMVQpDUjSysTVb/lU6GIomb/Ty3UK5ucodW11bsr3t5BKPO91FegYv2RUrTHF2YYwSdojAjzWyOrFuop++TuML/08ykbbtxqPYeoQDi4Q2pjzs8aysXUyBACCK1N29NZqloiy/fWRg6oqkw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from DM4PR11MB5994.namprd11.prod.outlook.com (2603:10b6:8:5d::20) by BL1PR11MB5382.namprd11.prod.outlook.com (2603:10b6:208:31c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.12; Thu, 10 Nov 2022 10:37:16 +0000 Received: from DM4PR11MB5994.namprd11.prod.outlook.com ([fe80::e2ac:cde3:4d74:3fa7]) by DM4PR11MB5994.namprd11.prod.outlook.com ([fe80::e2ac:cde3:4d74:3fa7%3]) with mapi id 15.20.5791.025; Thu, 10 Nov 2022 10:37:16 +0000 From: "Zhang, Qi Z" To: "Ye, MingjinX" , "dev@dpdk.org" CC: "Yang, Qiming" , "stable@dpdk.org" , "Zhou, YidingX" , "Lu, Wenzhuo" , "Wu, Jingjing" , "Li, Xiaoyun" , Ferruh Yigit Subject: RE: [PATCH v2] net/ice: fix scalar Rx and Tx path segment Thread-Topic: [PATCH v2] net/ice: fix scalar Rx and Tx path segment Thread-Index: AQHY8/luUvl1UzZNok26yPdyXJ7wbK438Mfw Date: Thu, 10 Nov 2022 10:37:16 +0000 Message-ID: References: <20221103172040.388518-1-mingjinx.ye@intel.com> <20221109125609.724612-1-mingjinx.ye@intel.com> In-Reply-To: <20221109125609.724612-1-mingjinx.ye@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.6.500.17 dlp-product: dlpe-windows authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM4PR11MB5994:EE_|BL1PR11MB5382:EE_ x-ms-office365-filtering-correlation-id: 2edd4cd8-8f7a-454a-6df6-08dac307899d x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: xgt28RhnEqxR+mk8I/fn8MQ2vqaxv/sc94zGaIP9BtlX+AuoT4l8F01YwH0HgEKIv9TjnMo+mxYyCxiKgssqpc+TnlI6GyYJlb3sFq9lLQGAnwmDkzjyMITofiBCvXwryrXn4ATsZP1znoSyvldkEx374hM94SspuTO/uBTTkqKAH7P22Phu6q1fd31Ph38/C6HAYnX0vasBeElrVVvBITPbD1fURGgqGunmmGeN/qDcGyNOKyx7yMKHCooD3IhVGfF5VwzKcrs1kVvEP1bDS3edCSippe0soj43sYflaNqrRoRr1dN11HXe+nLN1kM8WCq+vdSU+oS/32itk9LPkVtayEzYA1tzC4rj8sWnQ2hoXEBfl9ugqMjqUimJv5OFkXZwtPWnu0/az7JGqHdLbtvscWC32pmQOecT4XwnoBA/Q4SiH0oPnIM25GUJVJ8IG8vRzluUBCGvBcz4emLnw0FdQBLgLOQidtD8Uxm37/2PF3hxsDqFuFqMBj8KUqza3iVb6Yd7zW265ROjdIyZTVuLBf3Bkb1/N5tujHpe4JatqPwiSqeQDvRUDNlUxSQiYVjBd/dWHx+6rBaQ6mQGnwQYPbm/qeeYYx1aW/nkEeDWK4Fn1a7y8YMu2rpH7OcUFNK2yZXBZrvD740HDp8w3T/Bl26cFYrxNq/CkSQdwOytclUHFxU9dFihiz3AP4XFlYb4I11+XWttydvNzf5cHJx2yuuXe3Vpls006NPwJob/5zN2dH3q9PDORZFqTVCuFqwhRF04FBpHm2MKkztWdAp3X5Pna9FBSKPkXtBLeWg= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5994.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(366004)(136003)(396003)(376002)(39860400002)(346002)(451199015)(2906002)(71200400001)(110136005)(54906003)(83380400001)(450100002)(66476007)(66946007)(478600001)(4326008)(8676002)(66556008)(66446008)(52536014)(107886003)(64756008)(316002)(76116006)(33656002)(41300700001)(5660300002)(8936002)(55016003)(186003)(86362001)(9686003)(6506007)(7696005)(38100700002)(38070700005)(122000001)(53546011)(82960400001)(26005)(461764006); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?WID591WR7yiK+gfm/fSVGvb0UUJkTdfYFGp876olgiJ8WmDcu9bCv3hY3H52?= =?us-ascii?Q?y02wzFKnRUWOO8Dsi7tCGzwL9XNokF7sS4n08TWLVlfX4ST9dLUE+8ypI2Dn?= =?us-ascii?Q?CM38EefOMgoOYQ2+4amTmj/3oHBkTYEei4rfDj+i2GIdMkAwhuxWUncMDz9X?= =?us-ascii?Q?opaXD1UXD7gYdfsAJU9TizUv5aK0QYSewgflr3wnOosrsxq6zbXzuwbX6Tyz?= =?us-ascii?Q?VjgmI4En9FbWTB6WNm5ENOXnS949M8c6Zmx0Tg/WBivT39U4UYFy6kM567pF?= =?us-ascii?Q?ltWBJ89Ocn1FMEElSIFmol3UwNDK2vWxn+DnaIlDE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CwKEhiftoxXMr0otzDgrp3kyvVoynLOsRf7Tgk442nhJ1pR7XoyAdG5?= =?us-ascii?Q?ME/sMk0w5Le0EfKPaWqmlUi/Yjd+aOwq6y5M1AHe7OkVBbJk8lsQBgnEJTCD?= =?us-ascii?Q?zjHNykl7rALEcumriqnASmErBUu+kyTFR089IQgi1QvJ4xucoDbUxYaC9FGA?= =?us-ascii?Q?Rmkt0eVwvqceHfVUGuEMKpR7IYEb972jWH3qAy63O7TtuG7RcMUx7PsFoiUD?= =?us-ascii?Q?FFwlL3BqD2DM9glHgpEe0e0l4pT3o7ouv8MNUG+4cUvYzxXaZ6zu3/xNkhAH?= =?us-ascii?Q?Euvx4q1eTfLpFBlTtPgHg+dPb5eK6pkOcRmZLiEE5Xje1RaandvbJeUS+tRK?= =?us-ascii?Q?1hOrIrfOwCXnTzJ5vLAcUOjRKlIbW/DugJSHBm2k?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5994.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2edd4cd8-8f7a-454a-6df6-08dac307899d X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Nov 2022 10:37:16.6861 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Rw0+YhyF/uzLXxT958OIByj5WSa1MdMjxf4mys7If3Uftk7oP5/becLNXGp0PmZCMDv1KLsS5lvqIq/aYchimw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR11MB5382 X-OriginatorOrg: intel.com X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org > -----Original Message----- > From: Ye, MingjinX > Sent: Wednesday, November 9, 2022 8:56 PM > To: dev@dpdk.org > Cc: Yang, Qiming ; stable@dpdk.org; Zhou, YidingX > ; Ye, MingjinX ; Zhang, Qi > Z ; Lu, Wenzhuo ; Wu, > Jingjing ; Li, Xiaoyun ; Fer= ruh > Yigit > Subject: [PATCH v2] net/ice: fix scalar Rx and Tx path segment >=20 > CRC is stripped by the hardware in the scattered Rx path. If the last buf= fer > packet length is '0', the scalar Tx path would send empty buffer that cau= ses > the Tx queue to overflow. Please separate this patch into two, one for Rx and one for Tx, they are in= dependent. For the Tx implementation, I think we can move them into tx_prepare where i= s place to check Tx violation. =20 >=20 > This patch adds a judgment for the last buffer length to fix this issue, = so that > it would free the mbuf associated to the last one if the last buffer is e= mpty. >=20 > Fixes: 6eac0b7fde95 ("net/ice: support advance Rx/Tx") > Cc: stable@dpdk.org >=20 > Signed-off-by: Mingjin Ye >=20 > v2: > * Fix log level in ice_rxtx.c source file. > --- > drivers/net/ice/ice_rxtx.c | 53 ++++++++++++++++++++++++++++++++++++-- > 1 file changed, 51 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c inde= x > 0a2b0376ac..b181f66aad 100644 > --- a/drivers/net/ice/ice_rxtx.c > +++ b/drivers/net/ice/ice_rxtx.c > @@ -2111,6 +2111,10 @@ ice_recv_scattered_pkts(void *rx_queue, > } else > rxm->data_len =3D (uint16_t)(rx_packet_len - >=20 > RTE_ETHER_CRC_LEN); > + } else if (rx_packet_len =3D=3D 0) { > + rte_pktmbuf_free_seg(rxm); > + first_seg->nb_segs--; > + last_seg->next =3D NULL; > } >=20 > first_seg->port =3D rxq->port_id; > @@ -2903,6 +2907,35 @@ ice_calc_pkt_desc(struct rte_mbuf *tx_pkt) > return count; > } >=20 > +/*Check the number of valid mbufs and free the invalid mbufs*/ static > +inline uint16_t ice_check_mbuf(struct rte_mbuf *tx_pkt) { > + struct rte_mbuf *txd =3D tx_pkt; > + struct rte_mbuf *txd_removal =3D NULL; > + struct rte_mbuf *txd_pre =3D NULL; > + uint16_t count =3D 0; > + uint16_t removal =3D 0; > + > + while (txd !=3D NULL) { > + if (removal =3D=3D 1 || txd->data_len =3D=3D 0) { > + txd_removal =3D txd; > + txd =3D txd->next; > + if (removal =3D=3D 0) { > + removal =3D 1; > + txd_pre->next =3D NULL; > + } > + rte_pktmbuf_free_seg(txd_removal); > + } else { > + ++count; > + txd_pre =3D txd; > + txd =3D txd->next; > + } > + } > + > + return count; > +} > + > uint16_t > ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkt= s) > { @@ -2960,11 +2993,27 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf > **tx_pkts, uint16_t nb_pkts) > * the mbuf data size exceeds max data size that hw allows > * per tx desc. > */ > - if (ol_flags & RTE_MBUF_F_TX_TCP_SEG) > + if (ol_flags & RTE_MBUF_F_TX_TCP_SEG) { > nb_used =3D (uint16_t)(ice_calc_pkt_desc(tx_pkt) + > nb_ctx); > - else > + } else { > + nb_used =3D ice_check_mbuf(tx_pkt); > + if (nb_used =3D=3D 0) { > + PMD_TX_LOG(ERR, > + "Check packets is empty " > + "(port=3D%d queue=3D%d)\n", > + txq->port_id, txq->queue_id); > + continue; > + } else if (nb_used < tx_pkt->nb_segs) { > + PMD_TX_LOG(DEBUG, > + "Check packets valid num =3D" > + "%4u total num =3D %4u (port=3D%d > queue=3D%d)\n", > + nb_used, tx_pkt->nb_segs, txq->port_id, txq- > >queue_id); > + tx_pkt->nb_segs =3D nb_used; > + } > nb_used =3D (uint16_t)(tx_pkt->nb_segs + nb_ctx); > + } > + > tx_last =3D (uint16_t)(tx_id + nb_used - 1); >=20 > /* Circular ring */ > -- > 2.34.1