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 9FDE442B3A; Thu, 18 May 2023 12:33:39 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 92EEA42D17; Thu, 18 May 2023 12:33:39 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by mails.dpdk.org (Postfix) with ESMTP id 2FC5E42B71; Thu, 18 May 2023 12:33:38 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D072MNYDj1G5Cw5cTsX1FlkmS56sgn21luO/txh13FBtcfyIIlfFCk8O53zzi41UcG4JB0azIcfMYGS3KGHgZGKWHkzxkkFW5+042USTZyvy/VBvc/62VppqD/nbhtVQMCR2P04SuM2ELhhdKJ+gutvRrrQ+qf2nIJlyAOYYBINZie76rn7fvJQ/AAPiqfU/OJbPmnOk3VmMIIWEKtk5emhf9FKphCn04OzTGB3x/QgRa75XCOEdzaNrxxC46ecFM4FG74nGsmV5zo9EtzMDciVr1wBAI9b8l/L6+PvpzDtExxDiqHCLb2gnx0Svq8PHMo3q2uK9Tvt0+BvhUTJvXg== 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=V8fM6Rmeqx2wbbjOvpHXq9ZGt90po8JkRZyPpykkR9g=; b=R39NWhpvWuVxdhXNI2gel/VYg84fTMkJlZum6+iCSJegMFabHPMMezkyV+tpl2yfdjPObk45A1tRhMPHw92wkt9rL731BQsfM+qR3V/1Fpu4pnOpqm4bzT81BNIT9pKBoGWhBaTuMt0Dvtk/tTHOIWhKFVgErA6hzMOPcKzg2BWyMtLqFQ3Vfrldo0aw/1zpzue+ZxUPeOUp+tylhu/byyGF1sUggk4Aa+tiaABjZe4Qn6NoxGiF9D3bAOKf9uiYKruBG86YMvFa81hVL6MqwT53EUOqAfucb7/cE0tpwLzhlee7WqsD0CFD8kr8NLrymkt/aTUC5GxPIChdkUPDxQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=V8fM6Rmeqx2wbbjOvpHXq9ZGt90po8JkRZyPpykkR9g=; b=DG95y9yY4NWjGsirxpaDNXcdfmTkFk+wG59Gfsr6rgM0pMo4UoxKIcK3axyLdl8c5R4UIMYCnHf9rL5P6Hx1qIl7BAIX7r6pFgJ8Cvv2O9L9H8IAs4GRzTJqFtlSiekpCjdWe+AEiJULtI9g83UoveNmPWoZ8tvJ+wDr0Phe/GI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by BY5PR12MB4161.namprd12.prod.outlook.com (2603:10b6:a03:209::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.17; Thu, 18 May 2023 10:33:36 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::7957:641d:6aba:3f9a]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::7957:641d:6aba:3f9a%4]) with mapi id 15.20.6411.019; Thu, 18 May 2023 10:33:35 +0000 Message-ID: Date: Thu, 18 May 2023 11:33:29 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH] net/nfp: fix the Tx descriptor free logic of nfd3 Content-Language: en-US To: Chaoyong He , dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, stable@dpdk.org References: <20230512020712.616206-1-chaoyong.he@corigine.com> From: Ferruh Yigit In-Reply-To: <20230512020712.616206-1-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO4P123CA0089.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:190::22) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|BY5PR12MB4161:EE_ X-MS-Office365-Filtering-Correlation-Id: c535fb46-de00-4015-c07c-08db578b55a4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: E4r4Yh8SpZoE39jPMI+uUFumcPajTI/vi/MheORaM5s96sk+5jyQ/L21GEb40Uw/MPvsTf6DkJMeI0otwQlY1LKsr9e62ezFFapius/P888VMoHPd66KsPXs9rW/swqx3WeEXbmsIIap7wh1Uq9xaIJNYcVOXgWWtW2tGyoW0Gd9d3nOSL18ELwj4nahPRyYgZN3tvF5QkWED7Hy2snnkeQXb+btfSz0P9gHXJcpWrA01nQYBxh/vPgXfR6Z2l/x9h010zgWEL72ux5QMazb6VusEsPAQWR5O9XHuTpphR3/aOa8Fh66KOGgX+SDUfn5kLqT3NPD/z8pdGYln5931aPn6yfe1Q2cd/M7l3/6yfhwAq8sSlYuVg8XPUo91t23KrjVyUr1n6vGsfPEQR48Yex3ryIm8JI1VwyySc6jWSwQ4VCqKLh3yvc62n9yskOqSLNOhynHXFtro4XGrY7uinAVw2w1gHA5bk8qdm/uuhSQnzgvB5ab9C7gfDDZGlY82yM7V4dUwBhTmVwMwuAMKdXkLcR64DNzL8Ahd+mFDk8ZGsANK52UM5++6avz0hje6hZsY8HReDDG5DY/fl2z0dACNNvs4RARWIEYy3th6EFkM1ztjDvO/b0lyuTs/1yyDhaoCon0VqO8wx2575jE5A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(396003)(376002)(366004)(346002)(136003)(39860400002)(451199021)(31686004)(316002)(478600001)(66556008)(66946007)(66476007)(4326008)(86362001)(31696002)(36756003)(186003)(6506007)(6512007)(53546011)(26005)(38100700002)(2616005)(83380400001)(8676002)(6666004)(6486002)(5660300002)(8936002)(41300700001)(2906002)(44832011)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Vmt1TXNBV1poams5ZUpOck41YzZjZVRCWWY0M3lZZEt1clRvK0VSNERsUzJS?= =?utf-8?B?VE5jQmJFOVVvMkZJZHlnQXB2bCt1a3lIOVdkbkViUlBBYWlvNW41MnRLcDAv?= =?utf-8?B?alZ5TXk5UXcwVUxvaDFDNHFSM2NHMm1VS1dDSk5BTndha2JpV3ZaVjQza0RM?= =?utf-8?B?WWhtL3lQTmJmbVBkRXhyeHluNEhyRjArempOQmdURUptUiszTzBrd3RvRHd3?= =?utf-8?B?SkVkdkN4SXNkUkRjbFY3Wmh2R2daandJdFVZRVZoZDR1ZFAwbC9YYW1aR0tP?= =?utf-8?B?aEUwbk1tbnp6Vjcwb2Jlc2I1bS84ZzlPRldBeFRTRVFlRm5STTBPa1FyODJL?= =?utf-8?B?TFNSdDZudzZha0ZSWVErbDlja2xoc0hGZ1JjRTQwZXNpUXpGWTFNZ2lRcjZX?= =?utf-8?B?VXhiVGZPSklyMmkxZTF4Z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ZFZEVHJhRnhzdENzTkdsbWgxY0lDckpoZlJpRFF2ak1BMWVm?= =?utf-8?B?bXg1YnJKUXBpWnUwU3p4V3RWOFVkQ3Y2bzY5V2ZnamZLaGRuS2VrTFIwSGdF?= =?utf-8?B?V2tQVEYrc0QrRHk5L0g2dXNLSnpURGM4d3FBU3FHbm1EVXc2YXR5a3hZRnNk?= =?utf-8?B?b2ZkNm83THUxdDJVUzBjYWQ2RTRPdXh6ZE1rRGhyUXg0ZHJwT0RXcnkvYmFI?= =?utf-8?B?V0RTZHpXUTNwTkhLTnhTRng1ODF2UG1LbVhqelJrQnVXNVJHSlkzTW1MKys2?= =?utf-8?B?QzZUOU5vOEZXT2Mvd2ZBSmk1eU1hMEpsMS83UUw1SFprbW1xdVh6N05acm1u?= =?utf-8?B?M044SHEvbGYveVp1MEtXVThZMFRlZXpJR1pGSU15V214dmpOQ0xneXNRSjdi?= =?utf-8?B?dDFxM0NySHJwZmR6QWtHLzVEd3V0VEwwUzVySGczUFcrc0RxeHpjSmFtV3lz?= =?utf-8?B?a0l3Q3FuYW9VRFRkSVV6UjFubDQrUzJwWEpUaXB4YzJaMlVLMThNZmpMU1BO?= =?utf-8?B?T3FIRFErUHZOSWdrTGpxR2J0azlDZVlIbTAxanIwT1BiRHNUTHk0MjBCMzdj?= =?utf-8?B?R0hOcnVBb0t5ZnN1ZGpZaGI1OEtBWmsxNGtmbkl5MFZYV1B3ei9OSElnYklB?= =?utf-8?B?U2R5NFhCcUd3TFR5eGI1aTBXZ1dJSVZ0c3dtRWxkMVJpM2hmQVIyWUQxMXFC?= =?utf-8?B?QmhrUzZnaXRGS2cvQ2JWZytadGgyYmcva1FYME53SG11bHl4eEdnME5iTzJm?= =?utf-8?Q?z6Vwa40l38uzERECdyGlwkmpt?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: c535fb46-de00-4015-c07c-08db578b55a4 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2023 10:33:35.4044 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: CNWUxKjeJRVTqCQPwaEYaWgd0GvYkE3b3WKXa33jvF+EEx4IDX0yUHdhbEF2DLiP X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4161 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 On 5/12/2023 3:07 AM, Chaoyong He wrote: > 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 > Reviewed-by: Niklas Söderlund > --- > drivers/net/nfp/nfp_rxtx.h | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h > index 5e651518ed..e642bc970a 100644 > --- a/drivers/net/nfp/nfp_rxtx.h > +++ b/drivers/net/nfp/nfp_rxtx.h > @@ -401,10 +401,14 @@ nfp_net_mbuf_alloc_failed(struct nfp_net_rxq *rxq) > static inline uint32_t > nfp_net_nfd3_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; > } > > /* Can you please rebase this patch on top of latest next-net? 'nfp_net_nfd3_free_tx_desc()' moved to 'drivers/net/nfp/nfd3/nfp_nfd3.h' in commit '2344d6272fe9 ("net/nfp: move NFD3 logic to own source file")'