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 8EC6343270 for ; Thu, 2 Nov 2023 17:08:52 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8812040E36; Thu, 2 Nov 2023 17:08:52 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2070.outbound.protection.outlook.com [40.107.243.70]) by mails.dpdk.org (Postfix) with ESMTP id 141DC40144 for ; Thu, 2 Nov 2023 17:08:51 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=krHCqoxFh8lfGvNg26uoyUQu/OU3CWo2I6GgvjHeRKedM+zoKKvgDRIDtu9QiM3Hae1Jsf/5IiOBO8kZlQiMPTEbfcR+iKolAalaeA6xGvArmpfFax43jN7xR0kw4ADQ85Qrcem83jp+RxUk9C7r8mPy1of8CFfa09FGMUDT+z+vl0YePXxZEhVFCh9LWXkjaUZVQpaTnEbql5zGEBO/O9stkUUBpmQvGqOjMSZ/13sXxw9LQXrOHM6ztsjsXmFFONvU+oZLG/EIafhXLriG96OcrLUq2c8/6h5l8o35VLIHCg4FJZwM/W5P53wmQWoAV7JcYcKUtT1Zg/ha8KtULw== 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=WkM6e/W+Wn8y8A+Jae8GUJvULR4KCd+MfxUpiyhiZ7c=; b=OEKh7+IVNIFzLEoe1i37C35Y+4JGYD0FUMP9mQc0iqF7uYqHB6vdh3ApTLNjeyEvhFy04dqRFsYGhYrnTezK6zQRQm489ZOg4Z0XiuOzyoEMuN+wqp14r4PigOZWE8unzxBpMXGCOJV+DdDQXcCvjUhoqGuGjYF5tZD/AHC3+fujGqHIPCV8S7dO5JyoG3/mT+2kLpHNQcsE+HUUrEaD4ts3k24Mz9mwiTNIxTTDMjDAmSepejLxQlBUDSrg2Tu1Bb0BeYRwTEnEyAAuK1/Lzh1d3vmh1iqT73OPz+4GZwveREP3WBnl+3JcOkOyCNonatdwSDqL+RchEqSD4qVhUA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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 (0) 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=WkM6e/W+Wn8y8A+Jae8GUJvULR4KCd+MfxUpiyhiZ7c=; b=DQRILzlkR39sEG4vnG6BWFw4/C7L1PUgSi+3cwtWexnfTHW+LgdXlobzwV8KF+fzEet+JwLT2w0/lthtiyAFpbhghC9dHzTdlR3S4N5mBG18ondywmSxBYmXJJV2iB0b8rltovw7DSmWq3+67hP0B3wrIZupGbVsX5gvCliJYzq2kPff3QdwTEVKzcVUoxA8YWK/h4/PTu2nN1WQwjpRARfkxASKbY2aoccM4I/+2H/bwCXgeQQYfoSkRTjG07OQQtWcqrQDL6fNJYcgWOHO7jhtraRMVWKlgFPmEjt1GqAIltkvWPsg5hRQYIwi0KUY9Qia+/gYZ0JDWtR/7kZtlg== Received: from CY8PR22CA0020.namprd22.prod.outlook.com (2603:10b6:930:45::17) by BY5PR12MB4034.namprd12.prod.outlook.com (2603:10b6:a03:205::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.21; Thu, 2 Nov 2023 16:08:48 +0000 Received: from CY4PEPF0000E9D1.namprd03.prod.outlook.com (2603:10b6:930:45:cafe::f5) by CY8PR22CA0020.outlook.office365.com (2603:10b6:930:45::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.21 via Frontend Transport; Thu, 2 Nov 2023 16:08:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CY4PEPF0000E9D1.mail.protection.outlook.com (10.167.241.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.19 via Frontend Transport; Thu, 2 Nov 2023 16:08:47 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Thu, 2 Nov 2023 09:08:29 -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.41; Thu, 2 Nov 2023 09:08:28 -0700 From: Alexander Kozyrev To: CC: Subject: [PATCH 21.11] net/mlx5: fix MPRQ stride size to accommodate the headroom Date: Thu, 2 Nov 2023 18:08:14 +0200 Message-ID: <20231102160814.2513733-1-akozyrev@nvidia.com> X-Mailer: git-send-email 2.18.2 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: CY4PEPF0000E9D1:EE_|BY5PR12MB4034:EE_ X-MS-Office365-Filtering-Correlation-Id: e2c9bbb5-e345-4f8e-7a86-08dbdbbdfef4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mmspm0Nn+pyjMoTZ/tjGfbhndq/InURUk0IFZuzjwEJuEfzZeQd/dY4RG/z70NBhEl9EJxJw4OUI2cg+s7VtMMfkEPFm7w9nkL63ZTUXXQ2z/4NveMoZ2MU802dBra7xafPzucE3OrUeGO4qTd2kEuCuHrjaalCYLWN+4uiTefLA82P6k5mVqndMzwwyUAwu8hmdN5yAD0M8jR2YC8NeIoBHUADP1Jj0cwAhFNYcOTkiz5R1jMbGM0H+NM6JYi8saI3ccnRzkRsjtUFKNgtDe6Mm+2c94SXliJYJCbhLGjOXiRDfQjVgMuwWWn8ywVK8ALPvHQiOYkLl5dgrLYFtdaNKxQ4/QOD/KJL9GiaZsmYdQPnAI1rgsDffH+iMSo3bP7JfVRiOv5kzVB5ILz2XfgwlHKO9WC6HRUGbystLeBen9IO47BImxT9l6uKiUvOphuah1B7kryBEVK8InvzJipbwUe5FwfVZY85ikaRtQzrdpGDOGgK2P5MoVG/PLYA7At8dTJOvADjDCzkNSMr9IOGjSJ+aW0FZbX4FZRD+LgYz4Gfgj7xr39/K1UGdzH2zUK+ZWYwPYWMfpPEFbM/ZPGjuHUbDCNh7YJtBrMfUDpm3kL2SHPOD4RtHntOxoVHLdWSqn5FyfIcnnQouV2sgKEXRKOXf7/Haa6Znccoy5a4M5d03DT6yoD0FakAuOlBqvIuTxkoZDvzKJxClQQpv4vIBM+6IPfV4HA0bwEyEzXQ1OouKCccA6ULnkkMtjN6908z1kPfEZEf6EqCvHESJT//XRFRLp5U0EG9kbiJekHo= X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230031)(4636009)(346002)(136003)(376002)(39860400002)(396003)(230922051799003)(230273577357003)(230173577357003)(82310400011)(186009)(64100799003)(1800799009)(451199024)(36840700001)(46966006)(40470700004)(36756003)(86362001)(82740400003)(40480700001)(40460700003)(2616005)(478600001)(2906002)(316002)(41300700001)(8936002)(6916009)(8676002)(4326008)(6666004)(83380400001)(336012)(1076003)(16526019)(47076005)(26005)(70206006)(36860700001)(5660300002)(70586007)(7636003)(356005)(426003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Nov 2023 16:08:47.4231 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e2c9bbb5-e345-4f8e-7a86-08dbdbbdfef4 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.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9D1.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4034 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 e6479f009fbd9c8e873807cc928dcf91a151aba9 ] 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: 34776af600 ("net/mlx5: fix MPRQ stride devargs adjustment") Signed-off-by: Alexander Kozyrev Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/linux/mlx5_os.c | 2 ++ drivers/net/mlx5/mlx5_rxq.c | 26 ++++++++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 45f96e0eff..85eda47f7d 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1326,6 +1326,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, config->mps == MLX5_MPW_ENHANCED ? "enhanced " : config->mps == MLX5_MPW ? "legacy " : "", config->mps != MLX5_MPW_DISABLED ? "enabled" : "disabled"); + if (sh->devx) { config->hca_attr = sh->cdev->config.hca_attr; sh->steering_format_version = @@ -2065,6 +2066,7 @@ mlx5_os_config_default(struct mlx5_dev_config *config, cconf->hca_attr.log_min_stride_wqe_sz : MLX5_MPRQ_LOG_MIN_STRIDE_WQE_SIZE; config->mprq.log_stride_num = MLX5_MPRQ_DEFAULT_LOG_STRIDE_NUM; + config->mprq.log_stride_size = MLX5_ARG_UNSET; config->dv_esw_en = 1; config->dv_flow_en = 1; config->decap_en = 1; diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 12cde2af9c..e4d0291b9d 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -1599,8 +1599,8 @@ 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. */ + /* Checks if chosen size of stride is in supported range. */ + if (config->mprq.log_stride_size != (uint32_t)MLX5_ARG_UNSET) { 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; @@ -1612,10 +1612,26 @@ mlx5_mprq_prepare(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, *actual_log_stride_size = config->mprq.log_stride_size; } } else { - if (min_mbuf_size <= RTE_BIT32(log_max_stride_size)) + /* Make the stride fit the mbuf size by default. */ + 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 adjusted to match the mbuf size (%u)", + dev->data->port_id, idx, min_mbuf_size); *actual_log_stride_size = log2above(min_mbuf_size); - else + } else { goto unsupport; + } + } + /* 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. */ @@ -1654,6 +1670,8 @@ mlx5_mprq_prepare(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, " min_stride_sz = %u, max_stride_sz = %u).\n" "Rx segment is %senable.", dev->data->port_id, min_mbuf_size, desc, priv->rxqs_n, + config->mprq.log_stride_size == (uint32_t)MLX5_ARG_UNSET ? + RTE_BIT32(MLX5_MPRQ_DEFAULT_LOG_STRIDE_SIZE) : RTE_BIT32(config->mprq.log_stride_size), RTE_BIT32(config->mprq.log_stride_num), config->mprq.min_rxqs_num, -- 2.18.2