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 33515A0C46; Tue, 28 Sep 2021 10:12:43 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1B94240E64; Tue, 28 Sep 2021 10:12:43 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130105.outbound.protection.outlook.com [40.107.13.105]) by mails.dpdk.org (Postfix) with ESMTP id A7B1E40E3C; Tue, 28 Sep 2021 10:12:41 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B47htu2GWvrjmBhRUlzqLc/ZfLtVtDzxSE0unee85fTb41005XvMmPESJeQOBz/6VIw1BJVaDJSVVUDZTFtvLkIdbHpr33D1ZQ1rTjbD71PYLWfIUIghcn4BGJwOGJzlzglTMqsjdUNfUldrlAuE2QsiWz1o163jWBNHdmlDpyFLtmUoP8xC7W/5GANyNF0nPJLGo+SbeK+/HehRAJNA7JPyygpgVYUi1thXpIxP+KjitJfruNc5TkZXGFWHctV4tKqRsCA84FDoiVcG2gWd0xgGq1ioVkr30lC3nlaO1BOPqWckochTd9I50lrxrsO2rEdYp1205HYsZSSCf3le4A== 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=ZcaF8+3iolRg0wgPKGEcZIYQnuF0M22yutL+GIjhCLE=; b=n+f7+fvvOWM6hLp+ixfEYR137Sa2QSWiK8z2Dc1VXzHz3l3Hbb0wunF2RXRuhb7reyvZniVBQLLDcgCoSVegjFE2Jjb7UJD8jIQM6+IAAo4h6krEsNnv2GKqVqYi4ORYZNiM3/vMgXWdqMSO6kSU4VQNeDXFc34rxSF0CTjB7EkrnZfzt1sWcOAU6mRV83iEb+MTlTYcT6F/C2Er9AQkwb51D6+o34Ryi84wDEP1OM1AyCbpAnb9H6XcDqQjvHbxML8s1ekKPuQH+DIy2U2ZChA2OvrwQRyQqe4nXsMIoAdhXTTymm14FYnCYi84vUnDyesFcot3WWejhc5WF7KlWw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nokia.com; dmarc=pass action=none header.from=nokia.com; dkim=pass header.d=nokia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.onmicrosoft.com; s=selector1-nokia-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZcaF8+3iolRg0wgPKGEcZIYQnuF0M22yutL+GIjhCLE=; b=joUrYduT8HqTaJOt0fvSRIHo1mnCDJygV+0NaxF0mPHhMfCskAQYZrAnt3FP9m6554Mer8jIkqCGbBl/VJbCMbp5QHncGKTWz+WYIBFBsap+g74Z6pzXj3npoaycW/uFVl7lUqiBsaR4EcS7p5eD63JoYH11B78/Ne1hGqDd38c= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=nokia.com; Received: from PA4PR07MB7600.eurprd07.prod.outlook.com (2603:10a6:102:c5::12) by PA4PR07MB7535.eurprd07.prod.outlook.com (2603:10a6:102:cd::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.10; Tue, 28 Sep 2021 08:12:40 +0000 Received: from PA4PR07MB7600.eurprd07.prod.outlook.com ([fe80::2dc9:3fc1:3047:aa1d]) by PA4PR07MB7600.eurprd07.prod.outlook.com ([fe80::2dc9:3fc1:3047:aa1d%5]) with mapi id 15.20.4566.013; Tue, 28 Sep 2021 08:12:40 +0000 From: Julien Meunier To: dev@dpdk.org Cc: stable@dpdk.org, bruce.richardson@intel.com, Haiyue Wang Date: Tue, 28 Sep 2021 10:12:38 +0200 Message-Id: <20210928081238.16782-1-julien.meunier@nokia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210927171815.16216-1-julien.meunier@nokia.com> References: <20210927171815.16216-1-julien.meunier@nokia.com> Content-Type: text/plain X-ClientProxiedBy: HE1P189CA0026.EURP189.PROD.OUTLOOK.COM (2603:10a6:7:53::39) To PA4PR07MB7600.eurprd07.prod.outlook.com (2603:10a6:102:c5::12) MIME-Version: 1.0 Received: from localhost (86.242.117.254) by HE1P189CA0026.EURP189.PROD.OUTLOOK.COM (2603:10a6:7:53::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Tue, 28 Sep 2021 08:12:40 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 54bc389d-8051-42b1-cad5-08d98257bd96 X-MS-TrafficTypeDiagnostic: PA4PR07MB7535: 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: Q28a/vWQgwM8K5I0GYcEimgQNvNF0zcg/CrSeNS1svy65aidmDPzfyCAq9LoBkNHN3LWdPYrWYsaFEGz0c7MrNbK6gRBFUgarxLh4ydiUT97dpF9nrSf227lE+i6JzRAnXq2g/YGGCicbCkKnjJwJ/skVbCnQGwNQRcjiE1nbRrGzsqX5/eMREM9GqJCtMSoS4CyvzemCFBX5e2eS2NNgNiMWrBRMpLv5is5yUcW0p7ddzBLLT4tC4JWaz5AFCIniJM255WVXsyRPDLc29RN24x0c38dIg/XxImHqTwPTLVw1jZ0Dbqar63SnsPOu8IDnuNvICqZ3AgNQGB0J7fwRLt2JbboT+2RaUlfsW204THV1H+AN/t+1PQe2dpfkSX8N4viwIdm1kSNq4h6mVfNa6+qOup05YJBXW3iYgESRy+niB55qhrPSiMYqQNXNK/nV7uJ+8KRL4xUvuSkEzVf03dDdyDVvrzMhxOSt37LAAoFi9wIofGLbNGcP32Og95hWw2LW+x2inyJ6Zz5Lpkl1FNCQSWhrX/1IEk7SR7X92wjaj4bkMhqqaKAgh7Ke4E8a8X5qAOKm0Mpmi8+uKmRjnVY3zRPwlrCxCBlI+G2+ak38XtDETCtjhLBZ1p2pcmI2k7dJp9uFgia5381j/GZig== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PA4PR07MB7600.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(956004)(508600001)(86362001)(6916009)(6486002)(8676002)(5660300002)(2616005)(6496006)(316002)(186003)(66946007)(66476007)(1076003)(2906002)(4326008)(36756003)(38100700002)(26005)(44832011)(8936002)(66556008)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?6JprI1fxlI0tR9bmRhl4u/T9QUBqaV+Y2cP9ndA5MiqoS9JdDgDoqWDW842Y?= =?us-ascii?Q?+FJD8Yg1dr84rGUDnf72jk+oFSUSVPqGimvymWavEqjJJZ35dXjYTl10xA0d?= =?us-ascii?Q?IfNCTo3rp7vkjrldl27EjXXdif/O6UrGpWn9y79UYD4kRZuSBtoERIv3jehr?= =?us-ascii?Q?pTVf6G+ia7EAEsTYe5xImyDDhbA56dwNVkf4L5MFbz/HtyJTlZ9uGM8OIoTB?= =?us-ascii?Q?d4I2ib+AfmqqE1R3PapQOxJ2B7TUow39k0ah1JdzK+9JxwiMfyFc5FE+6rcU?= =?us-ascii?Q?meWDj0GdTd4x1txcR7NdRyPb8TDropP3mdiVpFDLSbTgt2SbqyUuSq/JJC+h?= =?us-ascii?Q?4u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NukhD2kRG3P3XfTggQ6XcTJptb?= =?us-ascii?Q?pXbWs9BlRmFBLOELipvuvRNJahWCOmWfbZ9+7cgG+WpY38x9y6kekV15f630?= =?us-ascii?Q?Er8RFJuUA9ZB95KQVf1XgYNT?= X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 54bc389d-8051-42b1-cad5-08d98257bd96 X-MS-Exchange-CrossTenant-AuthSource: PA4PR07MB7600.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2021 08:12:40.6238 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: E/2PX/AgA3psxsIu35oM/zDQ6cIMW8d4Jt3RjID/5THypDMZ/VrwSrbh3OWaY7XzNkvml7/W3rE88NuvP3u6LOHobeaR29WPYxNnQSeSVkw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR07MB7535 Subject: [dpdk-dev] [PATCH v2] 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" 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. 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. 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. 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. Fixes: c95584dc2b18 ("ixgbe: new vectorized functions for Rx/Tx") Cc: bruce.richardson@intel.com Cc: stable@dpdk.org Signed-off-by: Julien Meunier --- drivers/net/ixgbe/ixgbe_rxtx_vec_common.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h b/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h index adba855ca3..005e60668a 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h +++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h @@ -152,7 +152,7 @@ _ixgbe_tx_queue_release_mbufs_vec(struct ixgbe_tx_queue *txq) /* release the used mbufs in sw_ring */ for (i = txq->tx_next_dd - (txq->tx_rs_thresh - 1); i != txq->tx_tail; - i = (i + 1) & max_desc) { + i = (i + 1) % txq->nb_tx_desc) { txe = &txq->sw_ring_v[i]; rte_pktmbuf_free_seg(txe->mbuf); } @@ -168,7 +168,6 @@ _ixgbe_tx_queue_release_mbufs_vec(struct ixgbe_tx_queue *txq) static inline void _ixgbe_rx_queue_release_mbufs_vec(struct ixgbe_rx_queue *rxq) { - const unsigned int mask = rxq->nb_rx_desc - 1; unsigned int i; if (rxq->sw_ring == NULL || rxq->rxrearm_nb >= rxq->nb_rx_desc) @@ -183,7 +182,7 @@ _ixgbe_rx_queue_release_mbufs_vec(struct ixgbe_rx_queue *rxq) } else { for (i = rxq->rx_tail; i != rxq->rxrearm_start; - i = (i + 1) & mask) { + i = (i + 1) % rxq->nb_rx_desc) { if (rxq->sw_ring[i].mbuf != NULL) rte_pktmbuf_free_seg(rxq->sw_ring[i].mbuf); } -- 2.17.1