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 860ABA0C46; Tue, 28 Sep 2021 05:06:21 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0BDDB40E3C; Tue, 28 Sep 2021 05:06:21 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 356C540DF6; Tue, 28 Sep 2021 05:06:18 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10120"; a="204758483" X-IronPort-AV: E=Sophos;i="5.85,328,1624345200"; d="scan'208";a="204758483" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2021 20:06:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,328,1624345200"; d="scan'208";a="707597483" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by fmsmga005.fm.intel.com with ESMTP; 27 Sep 2021 20:06:17 -0700 Received: from orsmsx606.amr.corp.intel.com (10.22.229.19) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Mon, 27 Sep 2021 20:06:16 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Mon, 27 Sep 2021 20:06:16 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.108) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Mon, 27 Sep 2021 20:06:16 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SIwidK1KT+A0oRFfellowUw4DdEQ9HiGz+24DE6abqaBOhbPFwkFncimU0fJaDt/+VKHD2LIV9jGb986vE/Zsh6PzBmjG69fyauOo01xqMssOqd6skD4VxnW8+IcBHWntNDgOcBk9Zhjyaq5d+ry1F3RcmAOK0owVZKafSmoR8AQ0yqp6pCelAcw1AUsMu69A2U2appkgp4oCOkiWKNsOB4RRBPHoiyUpLXCUX9iV1QH5D0lOkmxo/cMTOn+qE4FPqDxyRW9hVQMlBhBt9+E2kY/Jr55Nux0GBPJEV5DGZLszLeSAi9iZuKy3ofOGrq6YMAWEYrjTZb7QMvLH7TEdg== 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; bh=VRmYakuybonhrNFK1+RKunYOjjxJbelVbYcXYYZv1z0=; b=eR8QgqeiogECM4fjbcraxpY3OqCoh/XuESHlSQiAC1gmmcEBW9DVduFY2pbAkEo6avO6gwgHtRhTWIElk4TB8XIBHYahHyAeMOSmWJoEvE52bFrMg5DO4/aFnKfi7mc87saHK525D484CuQePczTvtrae+63MM8XsHs6Xy9QdnLxwKg4kg4Tkq3+FiFAfC01B9+EmGyrB0fhSvKRVR/q7UQtwTanlf2IGIyvwFrlXs0JeI27QUnCuKog3xS2Rz0EVKmpuJiNMZRJ91W+lFuzOnQh4gHlSu/rCKx0HVXO3qctXI/v/qO4efKAM8JqGh9eH5pVD7dCW9XAxd5WA2N6TQ== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VRmYakuybonhrNFK1+RKunYOjjxJbelVbYcXYYZv1z0=; b=xjjTnCdyL4zGapsL3KZqCYj3lx06Jg4yq4eNwU4NgkMdjCOe+bqDVvj/bqxwtruAvfq10UhjYDTqNTj8uBAJ/XXfIlu2/vA8AyiJGbvL67UjhzkpWYmbWpm5b1GzyQLcpzlVV+5ted05LHnQWYCAzTEYpZODKlPecHKJsxxQorQ= Received: from DM4PR11MB5518.namprd11.prod.outlook.com (2603:10b6:5:39f::18) by DM4PR11MB5504.namprd11.prod.outlook.com (2603:10b6:5:39d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13; Tue, 28 Sep 2021 03:06:12 +0000 Received: from DM4PR11MB5518.namprd11.prod.outlook.com ([fe80::a1a3:f5ec:2121:415c]) by DM4PR11MB5518.namprd11.prod.outlook.com ([fe80::a1a3:f5ec:2121:415c%7]) with mapi id 15.20.4544.022; Tue, 28 Sep 2021 03:06:12 +0000 From: "Wang, Haiyue" To: "Meunier, Julien" , "dev@dpdk.org" CC: "stable@dpdk.org" , "Richardson, Bruce" Thread-Topic: [PATCH] net/ixgbe: fix RxQ/TxQ release Thread-Index: AQHXs8QhKg/BZN6wqEW4lPO55PPWGau4w6Qw Date: Tue, 28 Sep 2021 03:06:12 +0000 Message-ID: References: <20210927171815.16216-1-julien.meunier@nokia.com> In-Reply-To: <20210927171815.16216-1-julien.meunier@nokia.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.200.16 authentication-results: nokia.com; dkim=none (message not signed) header.d=none;nokia.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ed1fc1e0-a4d8-4a4d-10b3-08d9822cedb3 x-ms-traffictypediagnostic: DM4PR11MB5504: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: PnUSe44sosLtMJ/Xnd+0iL9Cba21vkcG0ui6buEoPepMhBcAGwjqXw/Vderir5wDN79xpJdUUADwaZF9tVWBjjC+rta4oxTjap4+qhzUGqgZdErkh3X7zNFYr4Cefx9Y7Fr6Af4wEjeSG+ck9MHPQVufOdIGMgpkipKIFCXh6tEHx0FbxmKwLpvElPt8uVXxUW4NEsKFitL5q8QTWnr0z9NlyFtWeg1OzuTlfNoNm4QhHnJeyZwONs1Rf05CHp9ULRrvfBWo0rAbbzwF/Aj32Gby6gQeJTrMR4LUipOz2udkCGhSes1UrHKC9n3WzViX6S/84ig/Le0BzZWI0DTSPPgiaaiTD4G+V7QynJL511Nq4qWOUaAZV9BGbmj+gJwtJdO4SX24KDGAUI0Edtg2k3kKiwVSbIjJTdPqZZeDAb6Q32ju2FGA5z1tPb0JETXqiX8gffywhHo9p6ZDKQL0fZi5eNNnwg73s6WaIbmmtlik0rIFsxCrb2sca3aPofdLWM0cyOE1YN/J0GfJmsdjGuonb3bVWaLugiNJhLVQNCkG0SJgeswfFkvrar8OXF/NWvaJhCQg/fSt/6fO/iOzmLSjb6zCBd+XHL+Jg5+3v/E6gy7DrLd/SaX7B2WdC68EJNseQakhm2JfpL/WZTxA5L28liHtx6a52mNcyi9KVS/vCUF6JpOHRAhjpGFxcYkepwalx6NSJdE9+9Lmu207SA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5518.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(38070700005)(6506007)(110136005)(54906003)(107886003)(76116006)(53546011)(4326008)(83380400001)(71200400001)(2906002)(8936002)(9686003)(5660300002)(52536014)(86362001)(55016002)(7696005)(508600001)(122000001)(8676002)(316002)(66476007)(66556008)(66946007)(64756008)(26005)(296002)(33656002)(38100700002)(186003)(66446008); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?TeoKQtr3crNJCdogbATAzVPGc+K8118zNwNf+VKt/gAFTj25lPArdN8Vk7Zw?= =?us-ascii?Q?6JHo70OvJcD4G93M+uYGUFD/TI6sDOmER2Bmf8F4kkO6cwwwSbQhRkVNOijO?= =?us-ascii?Q?QG6La2feRQTeCHrrivxBHqL/E62qm8e0YDg3KIWVsNpK1GdGiWPP4VKXpMdI?= =?us-ascii?Q?dtj1k3c2QT9Vw1/gHSGw9FxkMJfwBnW067yDowNglqu6e7YK59lgmrWV4ieT?= =?us-ascii?Q?MhNw4Ys4bWS49CpgA3DdX7y25yfHfRcGQ847Rd3jNOIaZGn4lwTZKAf904aC?= =?us-ascii?Q?n1p1J+HmF5Fb2wgc/tOkixvOxsniKDHNyFjWb0MncKzk3SSZU5+lrwWAvUhl?= =?us-ascii?Q?ikBi+pZGtY0SFrNYm2UTfU74lWf9d0pv/EkRpk/EDgq7hiecdYM8lr7hJ7Kj?= =?us-ascii?Q?LT/gXm1GTqBmwrIxqvIS8FEWcQkbUhNPiG3KV5UxXWr81BugpCmUM1mSXdhk?= =?us-ascii?Q?Nw6wsUPrNFnHLNQDI21gfW2ddpzLyGgsRWfTHcxDeUDkOc7TKn0h5F68Csec?= =?us-ascii?Q?ie2v2Jz6AcioIUyXvCc58/U2o3BZujO+VzvD8IivOKqTq4gC7wc2OpBYlqwH?= =?us-ascii?Q?WBFStYfkM/Jr4ogenofjNmJE9IYn/MfdfU5XLRtTDEr+lSKQD8B1dUtOXq4F?= =?us-ascii?Q?i7SWfPV4MjePxG6hQTOyylybM/qNl8hZ1goBgUZEUrXMbY6iYy8bcwfebl18?= =?us-ascii?Q?Wx7bqWKz3E14eBUz/aMO9v6VQSDmXZdZ7rB6H21xKbO0haGahURU7SyBPD8A?= =?us-ascii?Q?1B07QTierAV9DYuXjuwdo6tMgQJdEx9xV8CkgbsC5/fBRVbpqh6y7dm62vYb?= =?us-ascii?Q?u/oNamqahpYX65sKXrK2PA0Vs6acnfnVeMdMBE1uYSqhS/G+bF9zBkwjHlmw?= =?us-ascii?Q?9tS2gZbVcc/cf0qo7CM7EZNvqo6V2qsrKa0X6M8GXYgNC554w+WUp6bzBMqW?= =?us-ascii?Q?BKxJsJUmS+hIIF9Dpf8WQSpvCPdQ4bHSjEMmW9z+/ZsT4EBKP77UG+LlLdyq?= =?us-ascii?Q?VHJQPTlrfTqpP4MwfuUOLAJX0OdWhU+VuBSatIwBh+Pz+D52w0AMS7ov6YCM?= =?us-ascii?Q?/4D615T2sZLtC7HtYyY1xJhKFfDKtoN5dfFxioZotO59zYJ8sxwXwsbmSZHM?= =?us-ascii?Q?54lRMnr1FPuXrVBRGxPjBd6JjsQ8lrJ0NjiuUFL5WKStgOgll1rKOaNNmgx+?= =?us-ascii?Q?3ko6UX7JqOsbUmI8rELXxoI7mNboG2OgDif+fvOnhmsgmeayTSidKbtUfgKS?= =?us-ascii?Q?zcVeLG7w153OwOlh9KtzY1kIsZPYi/fz5cJbB1KuNg/+/m1VMxDP1ufmxZrj?= =?us-ascii?Q?xkQ=3D?= 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: DM4PR11MB5518.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ed1fc1e0-a4d8-4a4d-10b3-08d9822cedb3 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Sep 2021 03:06:12.6777 (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: lodZau0ul4NcOcNxdI5Z8vh5Gl1PaQ4BMXv8JSTspSG0say/nRZRKFdLDmXuThscqvE350Ei+EGMYr1qCoejpg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB5504 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH] net/ixgbe: fix RxQ/TxQ release X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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: Julien Meunier > Sent: Tuesday, September 28, 2021 01:18 > To: dev@dpdk.org > Cc: stable@dpdk.org; Richardson, Bruce ; Wang= , Haiyue > > Subject: [PATCH] net/ixgbe: fix RxQ/TxQ release >=20 > On the vector implementation, during the tear-down, the mbufs not > drained in the RxQ and TxQ are freed based on an algorithm which > supposed that the number of descriptors is a power of 2 (max_desc). > Based on this hypothesis, this algorithm uses a bitmask in order to > detect an index overflow during the iteration, and to restart the loop > from 0. >=20 > However, there is no such power of 2 requirement in the ixgbe for the > number of descriptors in the RxQ / TxQ. The only requirement is to have > a number correctly aligned. >=20 > If a user requested to configure a number of descriptors which is not a > power of 2, as a consequence, during the tear-down, it was possible to > be in an infinite loop, and to never reach the exit loop condition. >=20 Are you able to setup not a power of 2 successfully ? int rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id, uint16_t nb_tx_desc, unsigned int socket_id, const struct rte_eth_txconf *tx_conf) { ... if (nb_tx_desc > dev_info.tx_desc_lim.nb_max || nb_tx_desc < dev_info.tx_desc_lim.nb_min || nb_tx_desc % dev_info.tx_desc_lim.nb_align !=3D 0) { RTE_ETHDEV_LOG(ERR, "Invalid value for nb_tx_desc(=3D%hu), should be: <=3D %hu, >=3D %hu, an= d a product of %hu\n", nb_tx_desc, dev_info.tx_desc_lim.nb_max, dev_info.tx_desc_lim.nb_min, dev_info.tx_desc_lim.nb_align); return -EINVAL; } ... } > By removing the bitmask and changing the loop method, we can avoid this > issue, and allow the user to configure a RxQ / TxQ which is not a power > of 2. >=20 > Fixes: c95584dc2b18 ("ixgbe: new vectorized functions for Rx/Tx") > Cc: bruce.richardson@intel.com > Cc: stable@dpdk.org >=20 > Signed-off-by: Julien Meunier > --- > drivers/net/ixgbe/ixgbe_rxtx_vec_common.h | 20 +++++++++++++------- > 1 file changed, 13 insertions(+), 7 deletions(-) >=20 > diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h b/drivers/net/ixgb= e/ixgbe_rxtx_vec_common.h > index adba855ca3..8912558918 100644 > --- a/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h > +++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h > @@ -150,11 +150,14 @@ _ixgbe_tx_queue_release_mbufs_vec(struct ixgbe_tx_q= ueue *txq) > return; >=20 > /* release the used mbufs in sw_ring */ > - for (i =3D txq->tx_next_dd - (txq->tx_rs_thresh - 1); > - i !=3D txq->tx_tail; > - i =3D (i + 1) & max_desc) { > + i =3D txq->tx_next_dd - (txq->tx_rs_thresh - 1); > + while (i !=3D txq->tx_tail) { > txe =3D &txq->sw_ring_v[i]; > rte_pktmbuf_free_seg(txe->mbuf); > + > + i =3D i + 1; > + if (i > max_desc) > + i =3D 0; > } > txq->nb_tx_free =3D max_desc; >=20 > @@ -168,7 +171,7 @@ _ixgbe_tx_queue_release_mbufs_vec(struct ixgbe_tx_que= ue *txq) > static inline void > _ixgbe_rx_queue_release_mbufs_vec(struct ixgbe_rx_queue *rxq) > { > - const unsigned int mask =3D rxq->nb_rx_desc - 1; > + const unsigned int max_desc =3D rxq->nb_rx_desc - 1; > unsigned int i; >=20 > if (rxq->sw_ring =3D=3D NULL || rxq->rxrearm_nb >=3D rxq->nb_rx_desc) > @@ -181,11 +184,14 @@ _ixgbe_rx_queue_release_mbufs_vec(struct ixgbe_rx_q= ueue *rxq) > rte_pktmbuf_free_seg(rxq->sw_ring[i].mbuf); > } > } else { > - for (i =3D rxq->rx_tail; > - i !=3D rxq->rxrearm_start; > - i =3D (i + 1) & mask) { > + i =3D rxq->rx_tail; > + while (i !=3D rxq->rxrearm_start) { > if (rxq->sw_ring[i].mbuf !=3D NULL) > rte_pktmbuf_free_seg(rxq->sw_ring[i].mbuf); > + > + i =3D i + 1; > + if (i > max_desc) > + i =3D 0; > } > } >=20 > -- > 2.17.1