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 70BD6432CD for ; Wed, 8 Nov 2023 03:19:40 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6AD72402DA; Wed, 8 Nov 2023 03:19:40 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2124.outbound.protection.outlook.com [40.107.94.124]) by mails.dpdk.org (Postfix) with ESMTP id 6ADF540041 for ; Wed, 8 Nov 2023 03:19:38 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PJRXrLR0WtYfuwvN14Y6HhIefBW3o1d7I1LLylT6JTAhp/KxJAyupJDeqt7E9Pe6rwpjfH7Lc3qU35wYqsTHJmc5ssHFTtFQWKZ9eMATLvTGfbEw/p2q+uPrqs2jRD1O4k0/UyuBMIWjarAJJKUg9RPelkOR3cbtnNMhl/2AlZGiL90Yx1oM99ASCJBUH1J9s+86Km27bQqi981/cBNIkMkpjhSvpHqY9mrMBW8c38821yxRrychUZeBD4N4lyMf5ZBzxnbmopZnrOmu7H5QSnkaXjORc5OxoskIzeQKujKhXuz6/pYCnYzoR57jbKaexV3Ml++bdsspuNjqTsTKQg== 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=BhbFqxNYPxFVj6dqPz8OATJXwpw6ELIcL7GurtNxWro=; b=SZKrNdfRj4kBVPTUdcnFikqXfpWaprdDpwKTo5w9ZcXvediwJ23Tfq14S5CyIwgnvj9jfKApHLw62bSvI1WPljWBRcsVda4+3/w5nJgtiWSbord8oOOw5GjJ4UURfAIK3TpwVRwabAh95qQSP5dvSEhSbBjYU1lprZsd2t30MqEl6n0Oc0UJjTmTKqXj5ispZgfrzHrZrwAMyOSK8fs7BgSz+LO6S4gyUR3JhWOCNP5g7YbELHWNGu5amULSDhjh6tHCkZEMyDnWG28XsqOMgW3tRW92//phGMY4/OWH7Ojvx86AXhXRAm1i4U3seqd3hRqhZlIn+8yDOjC3cA9DIA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BhbFqxNYPxFVj6dqPz8OATJXwpw6ELIcL7GurtNxWro=; b=X3uEUgTli48pyyJuAvln8XO2DUfIsgfbFy1JZ5mGT+ZLu58VDLxkDSMdhmEvAH4Ym46EaIFsGyJFgGHiQBA9Ds02+/asrdPQryJhwrX8I7iMCQpvcelrBt1o0sqH4IHRIcANxJXiCnpRhMTPM7bBvoa6vZbZ436nSinYXSd5Q7E= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by SA1PR13MB4861.namprd13.prod.outlook.com (2603:10b6:806:1a5::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.28; Wed, 8 Nov 2023 02:19:34 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::45b3:d83c:cff2:4a1b]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::45b3:d83c:cff2:4a1b%6]) with mapi id 15.20.6954.025; Wed, 8 Nov 2023 02:19:34 +0000 From: Chaoyong He To: stable@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He Subject: [PATCH 21.11] net/nfp: fix Tx descriptor free logic of NFD3 Date: Wed, 8 Nov 2023 10:19:14 +0800 Message-Id: <20231108021914.2966142-1-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ2PR07CA0001.namprd07.prod.outlook.com (2603:10b6:a03:505::11) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|SA1PR13MB4861:EE_ X-MS-Office365-Filtering-Correlation-Id: a27a8443-39db-4d0b-458b-08dbe0012605 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8fo05A0yr5dlyS472bmd4kAQzSXF+ygYNtrlrPPE57+HQ/rrw8/Ap7dIQyvlfvQCPe/WDJKJoJvJaxIEYwt+dWhMn3+4qJoc1XQw6hBbgufb237X/yTpcqc4g8JyXn5ynmHrvqRH7m9x/UdpAIY3xRicOVXWoS14B3J2czMzsanMBwC0pHC7Cvyc1r3vmJY9+T+Ty0KMgx0+wMm0Knee9uxzr1NEhtCzHwDajr0KCf7iLg5jQYx28dVm28PJzurgYVb+srsv9LExVKB5pTa9NQa5j6/tMPtsokeQD4da948ZbnKjjzF3JO/UUl8rwJYsWW9WwCOwqes2yCygKsmuKJ6y4htLyu/WWfMZ5WDsvf+ETy6XFH3zmoWkoBRbSpUJd86cXz4laZ8YcpY0++kBYMDoHHLqJsgyS3kEbNPhQk39iD4B5wMbMqkDidvzzuVRqt/jS2N7bTU6LoQlkemsQGxGZv/QjfG9Vy8Yj5zswwYEEWBm9qNPt+2wd5y8Ilxpvyqt8nFVI599mfnOaLz/uatcnDNWXCpMPV3zw0ENj7j0iFDs0TPjU0WrUR11Q/ubXZgQ7rXyDmJbzDXmLFDwvWbwGcHiXva0cxrxLiz8CV2dIYbdsaZ5LYdL2UKFZpWXndEwKQcFi+cJ1nmbug5WuEDMERU5N9bHsyAMKOag5Mw= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(346002)(366004)(39830400003)(396003)(136003)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(38350700005)(1076003)(2616005)(107886003)(83380400001)(66946007)(26005)(6506007)(478600001)(6666004)(52116002)(66556008)(6486002)(6512007)(2906002)(4326008)(41300700001)(36756003)(8936002)(38100700002)(6916009)(5660300002)(86362001)(44832011)(8676002)(316002)(66476007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?/ngCGvOQB3QZgpc4XLFvI9+mwUSMHci2OjkVUVbsIdoy0smQRWGaKAAf06GW?= =?us-ascii?Q?zFF15scoBrWA5MbFvS5DpI01mJYRxR0hQonOE4yz5cJmvngYneExRgCtREYx?= =?us-ascii?Q?dMDq0I81rxqewcmqJ8FjWka2K18DbcYi7gLozmwFISI8mz298MD3Pxb5vAZA?= =?us-ascii?Q?4K/Kel8mznjeQxtaiFXUyzu9vYOgJ4huqq4cCXOn1T5r1q3GlPxgamAJoFvb?= =?us-ascii?Q?JKwmKLw+EUIHDhfXcU4vUMHN3V1e1Nrb9OYKtZDAr286s38xg5ciQJ3/bOCn?= =?us-ascii?Q?INq3ZCTlimzIdMWGpqemE5XXnZrmtzXr89VArfailh2F/sI1FBeu3v71C9pJ?= =?us-ascii?Q?vC2EhNomcRg6kUXOO8aNoV9D/pIHaf7vF02/WnUp/pl1v+nGmXjNYpTroos6?= =?us-ascii?Q?3O/C/eb68vHrIf42S2gKNWQFyndmK9O1zaJnXaIW68BeXP6EOlI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JChrAODCY4kU7Si3ukknqkv6WBfEkb1eZ?= =?us-ascii?Q?BlyTw2+V38DhrtcmkQiStn/TrerCsNp/u3RUtweT8fvUG2JQyOhp+Ti+LXdI?= =?us-ascii?Q?FLU5Oy3QqM7Fhdzi365yKyn4RxbZOUuJdngZWE5XY6vdNd84ehFpS90yeyDx?= =?us-ascii?Q?yK11jhp/G1cCMFC7TBl4tLjanVB3E/qytMmhVMgCqwHXn3I+2+0R5kXX7I6n?= =?us-ascii?Q?OcXLzGk2jHXjwqQ+0yDyf24ekPn7LAdaa9nQd572FA4bmDMizg0g6n1xYTv1?= =?us-ascii?Q?4Q=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: a27a8443-39db-4d0b-458b-08dbe0012605 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Nov 2023 02:19:34.3469 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bmU1araULywSGP8sdkftAtEiikR7XFWCn3Lt4/Ib8uc8AYDzTbhoETLYwl0LfIMj577yPZs/QfXxSB/C+dzTAhnPJkPhcFvDumHHaew65hs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR13MB4861 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 [ upstream commit e97738919c2315e07c2e98b6a9cc3912c335364a ] In the Tx descriptor free logic of nfd3, the former logic might force cast a negative number into a very big unsigned number, and which will cause potential problem in the xmit loop. The xmit loop will continue in the place where it should break, and will overwrite the Tx descriptor which is not free to use by the PMD. Fixes: 74a640dac864 ("net/nfp: avoid modulo operations for handling ring wrapping") Signed-off-by: Chaoyong He --- drivers/net/nfp/nfp_rxtx.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c index 639c1c925b..4fa608d417 100644 --- a/drivers/net/nfp/nfp_rxtx.c +++ b/drivers/net/nfp/nfp_rxtx.c @@ -796,10 +796,14 @@ nfp_net_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, static inline uint32_t nfp_free_tx_desc(struct nfp_net_txq *txq) { + uint32_t free_desc; + if (txq->wr_p >= txq->rd_p) - return txq->tx_count - (txq->wr_p - txq->rd_p) - 8; + free_desc = txq->tx_count - (txq->wr_p - txq->rd_p); else - return txq->rd_p - txq->wr_p - 8; + free_desc = txq->rd_p - txq->wr_p - 8; + + return (free_desc > 8) ? (free_desc - 8) : 0; } /* -- 2.39.1