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 DB84842F41 for ; Tue, 25 Jul 2023 08:52:15 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5272D43248; Tue, 25 Jul 2023 08:52:15 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2126.outbound.protection.outlook.com [40.107.237.126]) by mails.dpdk.org (Postfix) with ESMTP id 1A5A840A7F for ; Tue, 25 Jul 2023 08:52:14 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IvzYH+J+lrmsn4T9pCTRapmJ5kVwt/0S2KJFdYat3JwrpsfK22YNRNtam82nVIki/a8SsyfMOUd/JwgD++caBepvifuTU/cjylt79VbLDGBecgrGotTrCkG5m+t1oFV2nrdgYkOBtLKBn4aPZ3GMb1OTzCrYEIsoyCZCQ+CnfRU+y4N8+Z1QrVlmSjotAuInNiWf6qvLIbFXucJwv1PWCJjspVgcwiqXwsYvFVbNYQLMBtqZnN8AYkGUH2tFdCS/5hGmYfVaVRZZCqXO3KmiPU3c1E+xVvdD/cviaVj078PDb+iPaI30dr0CJ3D+KUnLEoVkJ11siNcgM99WaGg1DQ== 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=BpUINzYxz/eEAp7/tHtLELS5WfIZpDa0ZhGVlxnKiG0=; b=mi6vrRMQfDWGsgSfiuNbxdQKceCD7xZzE5EYBMSNFD+bfVejPBZQmQ0HU9WHdA18rrUAMkDu5Ro8BYsmnuOD0MBNPOq6TB+K2DFdBu5Uqi2wHNY9LMbINPaPm7xtegSX7v110JDZhFx60peJvWZKzsexn43EnmETKnDaVk9VIumPy8NujC9WO0XgprCVi/50BPHIVA723Zi8YYeGB4NxoYcztscmZPZX1Yzm8WRrIKKMXDDeinYtOPE5Yn6fziognaityNqOsSx7TbRZcLDQF2jU7oYGeT4LIZF6vCAQm6J6+Zgui4QlY5ZX5wEGFKBfDhmAPalWIxz9OuC6RfkHQQ== 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=BpUINzYxz/eEAp7/tHtLELS5WfIZpDa0ZhGVlxnKiG0=; b=iCRBXLpvgfoD5lgvjd/DbiW0idVUTn9a1t5VgE+14r0jBDTs+gcmQmtyS9jWGH0uJ3aZHorxt3J+gT5VYqUHQkrNPE7v2ubGxL0jo2kZVrAppmb9gi94JIXJzdNBVksCHrNyxDUaw9dN5+hGzFbmVXfrwiY+jJdmIwGjz5zAldE= 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 DM6PR13MB3723.namprd13.prod.outlook.com (2603:10b6:5:246::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.32; Tue, 25 Jul 2023 06:52:12 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::cb32:34c9:7242:7748]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::cb32:34c9:7242:7748%4]) with mapi id 15.20.6609.031; Tue, 25 Jul 2023 06:52:12 +0000 From: Chaoyong He To: stable@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH 21.11] net/nfp: fix Tx descriptor free logic of NFD3 Date: Tue, 25 Jul 2023 14:51:43 +0800 Message-Id: <20230725065143.425037-2-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230725065143.425037-1-chaoyong.he@corigine.com> References: <20230725065143.425037-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR02CA0125.apcprd02.prod.outlook.com (2603:1096:4:188::13) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|DM6PR13MB3723:EE_ X-MS-Office365-Filtering-Correlation-Id: db8449e7-c340-488a-0893-08db8cdbac42 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nuHt0NADdcjgPKgiQyGYQVwD35YpFFdWseFdcpGKOD6S5ZacA53yvWG2Zum/egil1Zk+smZRjySy8SV8nMNr+KlZNZYFUcIUqiocwZiQdXPaahRpE6f+4NnH1rn51dHsYkbxajrD6hWTqrrwVSXLAhmtwoBKOmmFybcCCZQl4PWHV1mUZGxlyYlbKvkb8w+kO/h2njt+Eew2A+UNaE7jmYbxoW8e4yGw6bPK1CxhLGwm8TIJhmN4SuzE3JxNkK5JeG97d7hxO5JFdl7Q99BtKm+BaZ6CqyZAcspFtDO7yv64hFE3CaBTiWiZi3TIQLC203sXu+SgDiS0QnuIPinMKjQ41VgtLBH3/nbI+hlZ05zsSFog7yAekzDqEPMHbqvuoM9fX5fxii81WoVuEf6QbaK/xKComwWJEChB6pgdiixDkxICS9IVYED1+C0mmoJXVi+NjTBYeskN6lSdyjlMgV9MW2O7lZ1BN+2x8Q5lwhfFWpdP1t+le/D0VRbHrPl8inMarrCVNnaSF++WD/955/frmM3qAgqeZYWLuxnAtp9bnFXuC9LSugZyJfusVVHaJtfB2JeBntGUF/i8S5sn8ZBOdD1XOfwurzbMaRU2WCzYMNBYnwlh+MLrnhhHHzCnMPh4sl4Ayh4vw0fhdn/VOFCmFNDmYU0YIV3oS7N3JGY= 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:(13230028)(4636009)(396003)(366004)(136003)(376002)(39840400004)(346002)(451199021)(52116002)(6666004)(6486002)(6512007)(478600001)(1076003)(2616005)(186003)(107886003)(36756003)(6506007)(26005)(44832011)(2906002)(41300700001)(66946007)(6916009)(8936002)(4326008)(5660300002)(38350700002)(316002)(8676002)(66556008)(66476007)(38100700002)(86362001)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?JDOdgyNJRbB0D0YA7tZENzUHEJqgVvnHR6LNoPKSwBjI/4FczM3AQqn+JXZV?= =?us-ascii?Q?IH2Kyg7M2+XWOd1fX6zkyN/Y2cfBsm/saTIjhkN0XLjXSWbxgxZomYbPLpqC?= =?us-ascii?Q?/p5XuW/20D/w1ia4f/IdPvt749iRbAu8OXSrX/Tc4Fp+sWo+6OUT6iM5v7nl?= =?us-ascii?Q?JdfkmN5vwVeUfsJKWXvqxXNqh+nADzKCHlb73/NBglMp6wdiNw/21/iIygr7?= =?us-ascii?Q?12TmtkhjEQWrYdnU7qDFsg1m/mtLlfGBsKIi5yizfLaDpcgSKcc61Y9szuuD?= =?us-ascii?Q?35r4MmqA1lIv24DRab23FmaQnnThxap4JJ++lQyFOgzT3VHWHf4z3s9UZTJO?= =?us-ascii?Q?PCm3/Dy2DRXk4SKVd0j9ddfGR+UVEshbmUejUeWT5MTd9/6CtfJBjVE6Pj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ZSsrNypMTZ/H5JA82OWRr/z7erMe1NlHNg9?= =?us-ascii?Q?6K+m+YD1zTYWBEI5FEcnX/ViYa3THlpDX4XJTSJqBNoRhqAkwnTtZGskbaBu?= =?us-ascii?Q?xnUX86uX8QjD/qXMlLWZK9kZANG7a7FJISbA5t1gLKxAUFhGx5FsYyaq9RwN?= =?us-ascii?Q?Ob8o26WNNYsQuelNOSwdEGBKi1zxJ3Ey7oaQwSGB6+yB5U9HUfz0KtaodJnd?= =?us-ascii?Q?8WwJEgpUYkdcm/OGw1MKTVeC+2jWA1guspkz7NZCrR4ZsI7IzdKX1FvEwUdt?= =?us-ascii?Q?knACXBuV4Ib9PGh2C1tv3fFbHUnCKCzUsqBtksYbie6oU6Xo7KaDjfoe+cEA?= =?us-ascii?Q?UQ=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: db8449e7-c340-488a-0893-08db8cdbac42 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2023 06:52:12.2582 (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: PIsqH+nG1M7RsK4sJ4Qptyk/0/FXMhelcXCt2RlFG0rmOw82qMrGXBhqVnLQTDoIHlErt9X0LqP8JglC8kX46OOzNt9GxX+FTy+S7WkQBTo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR13MB3723 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") Cc: stable@dpdk.org 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..3a20e33217 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; + + return (free_desc > 8) ? (free_desc - 8) : 0; } /* -- 2.39.1