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 A2AAA42BF8; Wed, 31 May 2023 21:01:01 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 22F7540A89; Wed, 31 May 2023 21:01:01 +0200 (CEST) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2044.outbound.protection.outlook.com [40.107.96.44]) by mails.dpdk.org (Postfix) with ESMTP id 22FA440A82; Wed, 31 May 2023 21:01:00 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UilgNloXSMnNyafQ2OWmqHRnP/YMlTUaEuvJQ+epP+EvA0yTbenePWGK5rWIReaw7yv8OpN1+8RJ7rLYmSk71vx0Ce1n0e959vZohyuqZeprvgRUd36DOZwo6hopJHwPaV607M+WFjf1zRntwnGNmzM+uXEfrAueiLxY4Lr/6MOdjawwEsnsnKIaCY3QPHzIV9xEZh4cXv9GSNvlATHELvrQdfKnBAeL9leLfQPDhFfCrHBtEb3/aBCcELMPyJzIZd0zuImcvqfyHceTuGuQQmsD8DD10HYP7FhclyT6uiP4N9oP7BRpOzmDfEt2HeEdoo15gVwhCLYak+ukJtENTg== 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=AV1VP+n7kupekSQykNRqaupVEIh5aY6kv2io0rd6AJE=; b=ZyzFLLOTHQwFDkAt1M/SLEJvrAeTrd/H2MpVYOgC97mHNmzuO4qn1JjZiPa3zPtZddS3o9cvQxvH70FZRadndGfPS5+68YZEbd2vNbjuHWvfAq0U+A99DhcVpX9b7Kr9K5hLzao0LH+FaLkDL0USO3ULQSWtQJOrkAI+N1sQ6Sx+G9nwa6LrV3tzsKWPTSpMOcB5ye0QGpXvDu/pUrXxUOJv6H8DrgC9RcewlZ+/SDDyRQrwPbYEObGYP2Im/t3uAoixqkeYJFvl2BMigT8tFJelVVLdSShUwgVFTBETD03HihzQUEjw/KStfFrWXb2SOBwmq+2TkX/b4jPBkvDfmQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AV1VP+n7kupekSQykNRqaupVEIh5aY6kv2io0rd6AJE=; b=DE/gfpQrA+scq+51YRFlEkU90JxxZHAzOFaiszbqmnzTB7bNgNRy9zDQyEd4Ugx14b8c7JOkej4J5v1l1Xa+xH1KtUXBMbKDbjV/jdW8KpOmNsEH6Ovd9BdOg2i1UWigmb7ruZMCQ4ZQVgzNs+rQ5DXPGajMdswNHEimWCG/+yP+X+m1srs8FJ9V3XcFBIquQzdiJrshxBTD3cbLVNIJDGafD2SbqEg5kCTtnSLNX99jQuFS1XPEQPLYmOxdPuo8AxZG76sxUkkZIHotZSHcRvMaPbPZ5YmI1927nGcIbm/swmZhEphWoOd+8uZeoTBf3J6fOEQGk8IaYE5SH5ELcA== Received: from MW4P222CA0023.NAMP222.PROD.OUTLOOK.COM (2603:10b6:303:114::28) by IA0PR12MB7674.namprd12.prod.outlook.com (2603:10b6:208:434::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.22; Wed, 31 May 2023 19:00:56 +0000 Received: from CO1NAM11FT026.eop-nam11.prod.protection.outlook.com (2603:10b6:303:114:cafe::82) by MW4P222CA0023.outlook.office365.com (2603:10b6:303:114::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.24 via Frontend Transport; Wed, 31 May 2023 19:00:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1NAM11FT026.mail.protection.outlook.com (10.13.175.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23 via Frontend Transport; Wed, 31 May 2023 19:00:55 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Wed, 31 May 2023 12:00:37 -0700 Received: from pegasus01.mtr.labs.mlnx (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Wed, 31 May 2023 12:00:35 -0700 From: Alexander Kozyrev To: CC: , , , , Subject: [PATCH v2] net/mlx5: fix MPRQ stride size to accommodate the headroom Date: Wed, 31 May 2023 22:00:18 +0300 Message-ID: <20230531190018.948436-1-akozyrev@nvidia.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20230531184303.946971-1-akozyrev@nvidia.com> References: <20230531184303.946971-1-akozyrev@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT026:EE_|IA0PR12MB7674:EE_ X-MS-Office365-Filtering-Correlation-Id: 3bbfeeef-289a-4b39-cabc-08db62095d10 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: im3lG11Ag4ZjPYCO5Unx9L025IDxKL2l5Qrex2WyA88wXHDYerdryHcXx+gyyp+zajFgznToSY0yosckthWhzGg2kpaChI9ttWTeNYy8Syyrvtn5SEgodoWSkS1TuIpJp4NGcDzJZABKwKd0lRpDQp0hWMEEx30L39LT6hL2jNngzXqipnyUz/EZ8UaUxqTWCmHX32wrNiUYBzP6KA1EAfTGcg/mGKt/MgyYn3fORK7sF2PReY4wMqIURtyFkoE6wICr3C3NjbC3LoJGXil26y6ofrUpzr918FDWuawKW3D0tKpiPLHY0CKYOJjHhTIEAcOKPSKtDshJvIWadv7ynUBQTTcJ2o3Z1jJqTL5ZK0hwkEnN4ebVeZnXWPvsM1iBUULNc4bBleI0Yg53cdLerriJwptFjmD5XWr/ZLU8f57Z4cdbJfwxgzHjePo5wQrTjuFTlJEp3T2cj01k3ZAsUkeXaThw1yfIk+hQCHFQY9g2VkROGY25o6FS4vh0jvzNO3I7gBEnyb2J1dgHfSbIJCoboBpQGi411e+7gDf0KS2PQEcthM5oqap9nb5ap0WhE0z4B+XaHkNuiSeIdpRT/0ZLQULb0Ft55PBUa/6JDWxxKGnH4PnNXwwBcIo7I3vtoZgZ8U4bg2t3BAWBKXuE+aZdaWQj8Zu++82P4Ja3RBYHbDc6CJODCF/LkTRqQc7OD4+WiYMvMxEW8TO2jXN8T8Z8Qm4/7O55Js2dIABzdQl/urhUc4OGSlQwgUHP3OpA X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(396003)(376002)(136003)(346002)(39860400002)(451199021)(40470700004)(36840700001)(46966006)(86362001)(4326008)(6916009)(8936002)(8676002)(41300700001)(316002)(450100002)(70206006)(70586007)(2906002)(5660300002)(54906003)(478600001)(7636003)(82310400005)(6666004)(16526019)(356005)(82740400003)(40460700003)(83380400001)(107886003)(47076005)(40480700001)(186003)(26005)(36756003)(1076003)(2616005)(36860700001)(336012)(426003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 May 2023 19:00:55.7729 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3bbfeeef-289a-4b39-cabc-08db62095d10 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT026.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7674 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 The space for the headroom is reserved at the end of every MPRQ stride for the next packet. The Rx burst logic is to copy any overlapping packet data if there is an overlap with this reserved headroom space. But it is not possible if the headroom size is bigger than the whole stride. Adjust the stride size to make sure the stride size is greater than the headroom size. Fixes: 34776af600df ("net/mlx5: fix MPRQ stride devargs adjustment") Signed-off-by: Alexander Kozyrev --- drivers/net/mlx5/mlx5.c | 1 + drivers/net/mlx5/mlx5_rxq.c | 41 +++++++++++++++++++++++++------------ 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index a75fa1b7f0..592e4053c5 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -2597,6 +2597,7 @@ mlx5_port_args_config(struct mlx5_priv *priv, struct mlx5_kvargs_ctrl *mkvlist, config->mprq.max_memcpy_len = MLX5_MPRQ_MEMCPY_DEFAULT_LEN; config->mprq.min_rxqs_num = MLX5_MPRQ_MIN_RXQS; config->mprq.log_stride_num = MLX5_MPRQ_DEFAULT_LOG_STRIDE_NUM; + config->mprq.log_stride_size = MLX5_MPRQ_DEFAULT_LOG_STRIDE_SIZE; config->log_hp_size = MLX5_ARG_UNSET; config->std_delay_drop = 0; config->hp_delay_drop = 0; diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index ad8fd13cbe..20e03146a5 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -1604,23 +1604,38 @@ mlx5_mprq_prepare(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, } else { *actual_log_stride_num = config->mprq.log_stride_num; } - if (config->mprq.log_stride_size) { - /* Checks if chosen size of stride is in supported range. */ - if (config->mprq.log_stride_size > log_max_stride_size || - config->mprq.log_stride_size < log_min_stride_size) { - *actual_log_stride_size = log_def_stride_size; + /* Checks if chosen size of stride is in supported range. */ + if (config->mprq.log_stride_size > log_max_stride_size || + config->mprq.log_stride_size < log_min_stride_size) { + *actual_log_stride_size = log_def_stride_size; + DRV_LOG(WARNING, + "Port %u Rx queue %u size of a stride for Multi-Packet RQ is out of range, setting default value (%u)", + dev->data->port_id, idx, + RTE_BIT32(log_def_stride_size)); + } else { + *actual_log_stride_size = config->mprq.log_stride_size; + } + /* Make the stride fit the mbuf size by default. */ + if (*actual_log_stride_size == MLX5_MPRQ_DEFAULT_LOG_STRIDE_SIZE) { + if (min_mbuf_size <= RTE_BIT32(log_max_stride_size)) { DRV_LOG(WARNING, - "Port %u Rx queue %u size of a stride for Multi-Packet RQ is out of range, setting default value (%u)", - dev->data->port_id, idx, - RTE_BIT32(log_def_stride_size)); + "Port %u Rx queue %u size of a stride for Multi-Packet RQ is adjusted to match the mbuf size (%u)", + dev->data->port_id, idx, min_mbuf_size); + *actual_log_stride_size = log2above(min_mbuf_size); } else { - *actual_log_stride_size = config->mprq.log_stride_size; + goto unsupport; } - } else { - if (min_mbuf_size <= RTE_BIT32(log_max_stride_size)) - *actual_log_stride_size = log2above(min_mbuf_size); - else + } + /* Make sure the stride size is greater than the headroom. */ + if (RTE_BIT32(*actual_log_stride_size) < RTE_PKTMBUF_HEADROOM) { + if (RTE_BIT32(log_max_stride_size) > RTE_PKTMBUF_HEADROOM) { + DRV_LOG(WARNING, + "Port %u Rx queue %u size of a stride for Multi-Packet RQ is adjusted to accommodate the headroom (%u)", + dev->data->port_id, idx, RTE_PKTMBUF_HEADROOM); + *actual_log_stride_size = log2above(RTE_PKTMBUF_HEADROOM); + } else { goto unsupport; + } } log_stride_wqe_size = *actual_log_stride_num + *actual_log_stride_size; /* Check if WQE buffer size is supported by hardware. */ -- 2.18.2