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 4962CA00BE for ; Sun, 10 Apr 2022 10:52:31 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 425C4406B4; Sun, 10 Apr 2022 10:52:31 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2044.outbound.protection.outlook.com [40.107.92.44]) by mails.dpdk.org (Postfix) with ESMTP id 3670C406B4 for ; Sun, 10 Apr 2022 10:52:30 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G55KrfvpcHv+yjBlmI8JDe9A8jZOM82P+tc3PtXK7Sfhxb9NooieKlK0N/n4a+OVRL6R+cCPuXkpuDLUkJN/O600WqwbUSSGd28LM+dTwvFNZElBLXkViyNgIaM3v8mP6zsM47+70JbiQgi9dy/7GyL9JvsaUpgDopEEOWVZQrwKljeCjOpKoyKm1+7BmUK7qfSKdnwj/duTj+j0vAedmbypNu9AMaU5ALQgZfNk8EVZI8EPjSIoKamtfgf1JYrrn4engvwZus3d/9YayY7VgkULHHZHQmlzvztkPevkvfwzrtYw1fj4ibEYgPFHN5xDX1oRrU6GQAlmPlM82qBzUA== 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=ZfgihlrH3PovCVQbdlE4FVlQykgcZ7Lmq6uWOLQNc4w=; b=l8hVQF7JljJVjLpFlkRRKllSKXCyVlpEbnCcNX1cZKLNAh+f9U5GcDV+RwXsWZ1OQvaHPV7VuVD8P4CjFCov/yfsCnrrZ4VOkaqHzgQOKhrDogcycT9PcoT7hw5wK5NHjmJ/iKEIp2v+AbocwjnGs2LWuH4Ay/45hCnhI+q1b4CASOhVadF3UnrQCzTeTOTH1UE72ZDhN+N5EswUBMfi8sADg5133hCDg2HJPNnG12fAtMXnYPIpZUPMO9OZtqqzwuICJhBhhGWN0MXuuJCwkZg7hkz7yQiyvzzUNJUSGNyaC5HfCmfmjUN/RLq27PZFYCpYYvK2hhbK9UJjhfyEgg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) smtp.rcpttodomain=canonical.com 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=ZfgihlrH3PovCVQbdlE4FVlQykgcZ7Lmq6uWOLQNc4w=; b=KBANJnboaYkRS9UdW7f276A7a74L+T1Ica+m0Vo6dMjuu77KHvPUETRNoFEFZwfyvWT24iCrb299d0Y3FXfkgVx44X6prQacGdqUR+QDLtGFDhZgT8Q2ZiiG1EFpeEQHbQhRQfi1UAa22UIaj226CAJT5D24KzkPia4uDm9oe5S1re2dE5joEZ+JbXLzUsUlJIoGLUU6JNnd8DM6NIRbmOmBNlUfN0dRzIazVTlGDytrSXCyNx1VzeDbhCeDbCGKhG3tP171HadMvLdJYmUFz9noG+09DTU2t4CPuophpcMgVoo1B+RAyAAwEmRzYZlieY9PwKD9IWw5lbazOZqNUQ== Received: from MW4PR04CA0080.namprd04.prod.outlook.com (2603:10b6:303:6b::25) by BN7PR12MB2657.namprd12.prod.outlook.com (2603:10b6:408:32::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.28; Sun, 10 Apr 2022 08:52:28 +0000 Received: from CO1NAM11FT049.eop-nam11.prod.protection.outlook.com (2603:10b6:303:6b:cafe::37) by MW4PR04CA0080.outlook.office365.com (2603:10b6:303:6b::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.28 via Frontend Transport; Sun, 10 Apr 2022 08:52:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.238) 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 12.22.5.238 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.238; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.238) by CO1NAM11FT049.mail.protection.outlook.com (10.13.175.50) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5144.20 via Frontend Transport; Sun, 10 Apr 2022 08:52:27 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Sun, 10 Apr 2022 08:52:27 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Sun, 10 Apr 2022 01:52:26 -0700 Received: from nvidia.com (10.127.8.13) by mail.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.22 via Frontend Transport; Sun, 10 Apr 2022 01:52:25 -0700 From: Michael Baum To: CC: Matan Azrad , Viacheslav Ovsiienko , Christian Ehrhardt Subject: [PATCH 19.11 2/3] net/mlx5: improve stride parameter names Date: Sun, 10 Apr 2022 11:52:16 +0300 Message-ID: <20220410085217.922084-3-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220410085217.922084-1-michaelba@nvidia.com> References: <20220410085217.922084-1-michaelba@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e4b55eab-d8a9-4423-470c-08da1acf70df X-MS-TrafficTypeDiagnostic: BN7PR12MB2657:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iHIgdtKz8wBC0a6sQib23+JnYgRJLYTS65ZRNRzDueDXL3VbMMgI6Xy4hjfcb/N2gExQ+zKioZfishARZIOcidQmfF5K+RsL2lolwOC5xz8GYn4R77K8QrHotRhzMjEcZMgikaVy5M/Ad+NvYc642xDzeyjBRT9z/xmomFP07AxSfWZMMzEudVABMXv26/llDLi2w7TOPLujPt7/nSOZYVWmKeDnVLrp+hjx4azGmaNrHca3hC9Obd6E87R7sexdGwY7aUWCmWN4lNVLB4BHCLuY5ufhFuUa1pXs6h9urWrdqPNJT6EWJRfo+bORskJ2C5LfE0lBCguGbwYAMxBdG504Y7pj0LMoM69ZOQnelRluEeupksQ/JgAhWAWO8nzX+jo4vFCPRrwrYAOrvG1Kbdvq7mgaJcujB/++mNhZgLD9SKEQlhKaFz0E+WXg2dr7fE5n1ar8C8WpSivwEAKM8VUskxYMbU3P/F4l68BDPN54XyiVAFbAL7RtSoUaJ62w8n7cG718W+T0fDwvrUOwrjQBsY/Sdus46wn6AzWLVX0OL/fwi2ChqGrVWl33KlV60i+ESMWNctapX4QXXYtMrGutkUPlRzQI9p2gvT8LHP3h1OJJ0+UaPL2L81NFNRHdbnF9ATxbu7mHYaq8lifN734+NEWyV76dGQOMowXxNHa42oPD65z/LDr7B1uaGGUUAYgyfpKugo3lgJOlSyyJVFFdBSCNTTQHab+6P5Kmh+5OCG398wqlMcEgGdW0eEMd X-Forefront-Antispam-Report: CIP:12.22.5.238; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(26005)(356005)(81166007)(86362001)(2906002)(8936002)(40460700003)(36860700001)(30864003)(5660300002)(55016003)(6286002)(6916009)(7696005)(1076003)(82310400005)(6666004)(2616005)(54906003)(316002)(83380400001)(70206006)(70586007)(8676002)(4326008)(186003)(47076005)(336012)(426003)(36756003)(508600001)(36900700001)(309714004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2022 08:52:27.9173 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e4b55eab-d8a9-4423-470c-08da1acf70df X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.238]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT049.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR12MB2657 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 0947ed380febad9d6f794b6f4e9aa9137860a06e ] In the striding RQ management there are two important parameters, the size of the single stride in bytes and the number of strides. Both the data-path structure and config structure keep the log of the above parameters. However, in their names there is no mention that the value is a log which may be misleading as if the fields represent the values themselves. This patch updates their names describing the values more accurately. Fixes: 7d6bf6b866b8 ("net/mlx5: add Multi-Packet Rx support") Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5.c | 44 +++++++------- drivers/net/mlx5/mlx5.h | 8 +-- drivers/net/mlx5/mlx5_defs.h | 4 +- drivers/net/mlx5/mlx5_rxq.c | 110 ++++++++++++++++++----------------- drivers/net/mlx5/mlx5_rxtx.c | 14 ++--- drivers/net/mlx5/mlx5_rxtx.h | 4 +- 6 files changed, 94 insertions(+), 90 deletions(-) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 12c87175b9..8a6abe0827 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1625,9 +1625,9 @@ mlx5_args_check(const char *key, const char *val, void *opaque) } else if (strcmp(MLX5_RX_MPRQ_EN, key) == 0) { config->mprq.enabled = !!tmp; } else if (strcmp(MLX5_RX_MPRQ_LOG_STRIDE_NUM, key) == 0) { - config->mprq.stride_num_n = tmp; + config->mprq.log_stride_num = tmp; } else if (strcmp(MLX5_RX_MPRQ_LOG_STRIDE_SIZE, key) == 0) { - config->mprq.stride_size_n = tmp; + config->mprq.log_stride_size = tmp; } else if (strcmp(MLX5_RX_MPRQ_MAX_MEMCPY_LEN, key) == 0) { config->mprq.max_memcpy_len = tmp; } else if (strcmp(MLX5_RXQS_MIN_MPRQ, key) == 0) { @@ -2706,34 +2706,34 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, #endif } if (config.mprq.enabled && mprq) { - if (config.mprq.stride_num_n && - (config.mprq.stride_num_n > mprq_max_stride_num_n || - config.mprq.stride_num_n < mprq_min_stride_num_n)) { - config.mprq.stride_num_n = - RTE_MIN(RTE_MAX(MLX5_MPRQ_STRIDE_NUM_N, - mprq_min_stride_num_n), - mprq_max_stride_num_n); + if (config.mprq.log_stride_num && + (config.mprq.log_stride_num > mprq_max_stride_num_n || + config.mprq.log_stride_num < mprq_min_stride_num_n)) { + config.mprq.log_stride_num = + RTE_MIN(RTE_MAX(MLX5_MPRQ_DEFAULT_LOG_STRIDE_NUM, + mprq_min_stride_num_n), + mprq_max_stride_num_n); DRV_LOG(WARNING, "the number of strides" " for Multi-Packet RQ is out of range," " setting default value (%u)", - 1 << config.mprq.stride_num_n); + 1 << config.mprq.log_stride_num); } - if (config.mprq.stride_size_n && - (config.mprq.stride_size_n > mprq_max_stride_size_n || - config.mprq.stride_size_n < mprq_min_stride_size_n)) { - config.mprq.stride_size_n = - RTE_MIN(RTE_MAX(MLX5_MPRQ_STRIDE_SIZE_N, - mprq_min_stride_size_n), - mprq_max_stride_size_n); + if (config.mprq.log_stride_size && + (config.mprq.log_stride_size > mprq_max_stride_size_n || + config.mprq.log_stride_size < mprq_min_stride_size_n)) { + config.mprq.log_stride_size = + RTE_MIN(RTE_MAX(MLX5_MPRQ_DEFAULT_LOG_STRIDE_SIZE, + mprq_min_stride_size_n), + mprq_max_stride_size_n); DRV_LOG(WARNING, "the size of a stride" " for Multi-Packet RQ is out of range," " setting default value (%u)", - 1 << config.mprq.stride_size_n); + 1 << config.mprq.log_stride_size); } - config.mprq.min_stride_size_n = mprq_min_stride_size_n; - config.mprq.max_stride_size_n = mprq_max_stride_size_n; + config.mprq.log_min_stride_size = mprq_min_stride_size_n; + config.mprq.log_max_stride_size = mprq_max_stride_size_n; } else if (config.mprq.enabled && !mprq) { DRV_LOG(WARNING, "Multi-Packet RQ isn't supported"); config.mprq.enabled = 0; @@ -3458,8 +3458,8 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, .mr_ext_memseg_en = 1, .mprq = { .enabled = 0, /* Disabled by default. */ - .stride_num_n = 0, - .stride_size_n = 0, + .log_stride_num = 0, + .log_stride_size = 0, .max_memcpy_len = MLX5_MPRQ_MEMCPY_DEFAULT_LEN, .min_rxqs_num = MLX5_MPRQ_MIN_RXQS, }, diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 1edc28255e..aaa69d3229 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -268,10 +268,10 @@ struct mlx5_dev_config { unsigned int dest_tir:1; /* Whether advanced DR API is available. */ struct { unsigned int enabled:1; /* Whether MPRQ is enabled. */ - unsigned int stride_num_n; /* Number of strides. */ - unsigned int stride_size_n; /* Size of a stride. */ - unsigned int min_stride_size_n; /* Min size of a stride. */ - unsigned int max_stride_size_n; /* Max size of a stride. */ + unsigned int log_stride_num; /* Log number of strides. */ + unsigned int log_stride_size; /* Log size of a stride. */ + unsigned int log_min_stride_size; /* Log min size of a stride.*/ + unsigned int log_max_stride_size; /* Log max size of a stride.*/ unsigned int max_memcpy_len; /* Maximum packet size to memcpy Rx packets. */ unsigned int min_rxqs_num; diff --git a/drivers/net/mlx5/mlx5_defs.h b/drivers/net/mlx5/mlx5_defs.h index b1c72714bf..52fb62f93c 100644 --- a/drivers/net/mlx5/mlx5_defs.h +++ b/drivers/net/mlx5/mlx5_defs.h @@ -144,10 +144,10 @@ #endif /* Log 2 of the default number of strides per WQE for Multi-Packet RQ. */ -#define MLX5_MPRQ_STRIDE_NUM_N 6U +#define MLX5_MPRQ_DEFAULT_LOG_STRIDE_NUM 6U /* Log 2 of the default size of a stride per WQE for Multi-Packet RQ. */ -#define MLX5_MPRQ_STRIDE_SIZE_N 11U +#define MLX5_MPRQ_DEFAULT_LOG_STRIDE_SIZE 11U /* Two-byte shift is disabled for Multi-Packet RQ. */ #define MLX5_MPRQ_TWO_BYTE_SHIFT 0 diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index a3673a0619..ca60121a22 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -89,7 +89,7 @@ mlx5_check_mprq_support(struct rte_eth_dev *dev) inline int mlx5_rxq_mprq_enabled(struct mlx5_rxq_data *rxq) { - return rxq->strd_num_n > 0; + return rxq->log_strd_num > 0; } /** @@ -1087,8 +1087,8 @@ mlx5_ibv_wq_new(struct rte_eth_dev *dev, struct mlx5_priv *priv, wq_attr.mlx5.comp_mask |= MLX5DV_WQ_INIT_ATTR_MASK_STRIDING_RQ; *mprq_attr = (struct mlx5dv_striding_rq_init_attr){ - .single_stride_log_num_of_bytes = rxq_data->strd_sz_n, - .single_wqe_log_num_of_strides = rxq_data->strd_num_n, + .single_stride_log_num_of_bytes = rxq_data->log_strd_sz, + .single_wqe_log_num_of_strides = rxq_data->log_strd_num, .two_byte_shift_en = MLX5_MPRQ_TWO_BYTE_SHIFT, }; } @@ -1205,11 +1205,11 @@ mlx5_devx_rq_new(struct rte_eth_dev *dev, uint16_t idx, uint32_t cqn) * 512*2^single_wqe_log_num_of_strides. */ rq_attr.wq_attr.single_wqe_log_num_of_strides = - rxq_data->strd_num_n - + rxq_data->log_strd_num - MLX5_MIN_SINGLE_WQE_LOG_NUM_STRIDES; /* Stride size = (2^single_stride_log_num_of_bytes)*64B. */ rq_attr.wq_attr.single_stride_log_num_of_bytes = - rxq_data->strd_sz_n - + rxq_data->log_strd_sz - MLX5_MIN_SINGLE_STRIDE_LOG_NUM_BYTES; wqe_size = sizeof(struct mlx5_wqe_mprq); } else { @@ -1360,7 +1360,7 @@ mlx5_rxq_obj_new(struct rte_eth_dev *dev, uint16_t idx, } } if (mlx5_rxq_mprq_enabled(rxq_data)) - cqe_n = wqe_n * (1 << rxq_data->strd_num_n) - 1; + cqe_n = wqe_n * (1 << rxq_data->log_strd_num) - 1; else cqe_n = wqe_n - 1; tmpl->cq = mlx5_ibv_cq_new(dev, priv, rxq_data, cqe_n, tmpl); @@ -1604,8 +1604,8 @@ mlx5_mprq_alloc_mp(struct rte_eth_dev *dev) unsigned int buf_len; unsigned int obj_num; unsigned int obj_size; - unsigned int strd_num_n = 0; - unsigned int strd_sz_n = 0; + unsigned int log_strd_num = 0; + unsigned int log_strd_sz = 0; unsigned int i; unsigned int n_ibv = 0; @@ -1622,16 +1622,18 @@ mlx5_mprq_alloc_mp(struct rte_eth_dev *dev) n_ibv++; desc += 1 << rxq->elts_n; /* Get the max number of strides. */ - if (strd_num_n < rxq->strd_num_n) - strd_num_n = rxq->strd_num_n; + if (log_strd_num < rxq->log_strd_num) + log_strd_num = rxq->log_strd_num; /* Get the max size of a stride. */ - if (strd_sz_n < rxq->strd_sz_n) - strd_sz_n = rxq->strd_sz_n; - } - assert(strd_num_n && strd_sz_n); - buf_len = (1 << strd_num_n) * (1 << strd_sz_n); - obj_size = sizeof(struct mlx5_mprq_buf) + buf_len + (1 << strd_num_n) * - sizeof(struct rte_mbuf_ext_shared_info) + RTE_PKTMBUF_HEADROOM; + if (log_strd_sz < rxq->log_strd_sz) + log_strd_sz = rxq->log_strd_sz; + } + assert(log_strd_num && log_strd_sz); + buf_len = (1 << log_strd_num) * (1 << log_strd_sz); + obj_size = sizeof(struct mlx5_mprq_buf) + buf_len + + (1 << log_strd_num) * + sizeof(struct rte_mbuf_ext_shared_info) + + RTE_PKTMBUF_HEADROOM; /* * Received packets can be either memcpy'd or externally referenced. In * case that the packet is attached to an mbuf as an external buffer, as @@ -1677,7 +1679,7 @@ mlx5_mprq_alloc_mp(struct rte_eth_dev *dev) snprintf(name, sizeof(name), "port-%u-mprq", dev->data->port_id); mp = rte_mempool_create(name, obj_num, obj_size, MLX5_MPRQ_MP_CACHE_SZ, 0, NULL, NULL, mlx5_mprq_buf_init, - (void *)((uintptr_t)1 << strd_num_n), + (void *)((uintptr_t)1 << log_strd_num), dev->device->numa_node, 0); if (mp == NULL) { DRV_LOG(ERR, @@ -1762,16 +1764,15 @@ mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, struct mlx5_priv *priv = dev->data->dev_private; struct mlx5_rxq_ctrl *tmpl; unsigned int mb_len = rte_pktmbuf_data_room_size(mp); - unsigned int mprq_stride_nums; - unsigned int mprq_stride_size; + unsigned int log_mprq_stride_nums; + unsigned int log_mprq_stride_size; unsigned int mprq_stride_cap; struct mlx5_dev_config *config = &priv->config; /* * Always allocate extra slots, even if eventually * the vector Rx will not be used. */ - uint16_t desc_n = - desc + config->rx_vec_en * MLX5_VPMD_DESCS_PER_LOOP; + uint16_t desc_n = desc + config->rx_vec_en * MLX5_VPMD_DESCS_PER_LOOP; uint64_t offloads = conf->offloads | dev->data->dev_conf.rxmode.offloads; unsigned int lro_on_queue = !!(offloads & DEV_RX_OFFLOAD_TCP_LRO); @@ -1811,52 +1812,55 @@ mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, tmpl->socket = socket; if (dev->data->dev_conf.intr_conf.rxq) tmpl->irq = 1; - mprq_stride_nums = config->mprq.stride_num_n ? - config->mprq.stride_num_n : MLX5_MPRQ_STRIDE_NUM_N; - mprq_stride_size = non_scatter_min_mbuf_size <= - (1U << config->mprq.max_stride_size_n) ? - log2above(non_scatter_min_mbuf_size) : MLX5_MPRQ_STRIDE_SIZE_N; - mprq_stride_cap = (config->mprq.stride_num_n ? - (1U << config->mprq.stride_num_n) : (1U << mprq_stride_nums)) * - (config->mprq.stride_size_n ? - (1U << config->mprq.stride_size_n) : (1U << mprq_stride_size)); + log_mprq_stride_nums = config->mprq.log_stride_num ? + config->mprq.log_stride_num : MLX5_MPRQ_DEFAULT_LOG_STRIDE_NUM; + log_mprq_stride_size = non_scatter_min_mbuf_size <= + (1U << config->mprq.log_max_stride_size) ? + log2above(non_scatter_min_mbuf_size) : + MLX5_MPRQ_DEFAULT_LOG_STRIDE_SIZE; + mprq_stride_cap = (config->mprq.log_stride_num ? + (1U << config->mprq.log_stride_num) : + (1U << log_mprq_stride_nums)) * + (config->mprq.log_stride_size ? + (1U << config->mprq.log_stride_size) : + (1U << log_mprq_stride_size)); /* * This Rx queue can be configured as a Multi-Packet RQ if all of the * following conditions are met: * - MPRQ is enabled. * - The number of descs is more than the number of strides. * - max_rx_pkt_len plus overhead is less than the max size - * of a stride or mprq_stride_size is specified by a user. - * Need to nake sure that there are enough stides to encap - * the maximum packet size in case mprq_stride_size is set. + * of a stride or log_mprq_stride_size is specified by a user. + * Need to make sure that there are enough strides to encap + * the maximum packet size in case log_mprq_stride_size is set. * Otherwise, enable Rx scatter if necessary. */ - if (mprq_en && desc > (1U << mprq_stride_nums) && + if (mprq_en && desc > (1U << log_mprq_stride_nums) && (non_scatter_min_mbuf_size <= - (1U << config->mprq.max_stride_size_n) || - (config->mprq.stride_size_n && + (1U << config->mprq.log_max_stride_size) || + (config->mprq.log_stride_size && non_scatter_min_mbuf_size <= mprq_stride_cap))) { /* TODO: Rx scatter isn't supported yet. */ tmpl->rxq.sges_n = 0; /* Trim the number of descs needed. */ - desc >>= mprq_stride_nums; - tmpl->rxq.strd_num_n = config->mprq.stride_num_n ? - config->mprq.stride_num_n : mprq_stride_nums; - tmpl->rxq.strd_sz_n = config->mprq.stride_size_n ? - config->mprq.stride_size_n : mprq_stride_size; + desc >>= log_mprq_stride_nums; + tmpl->rxq.log_strd_num = config->mprq.log_stride_num ? + config->mprq.log_stride_num : log_mprq_stride_nums; + tmpl->rxq.log_strd_sz = config->mprq.log_stride_size ? + config->mprq.log_stride_size : log_mprq_stride_size; tmpl->rxq.strd_shift_en = MLX5_MPRQ_TWO_BYTE_SHIFT; tmpl->rxq.strd_scatter_en = !!(offloads & DEV_RX_OFFLOAD_SCATTER); tmpl->rxq.mprq_max_memcpy_len = RTE_MIN(first_mb_free_size, config->mprq.max_memcpy_len); max_lro_size = RTE_MIN(max_rx_pkt_len, - (1u << tmpl->rxq.strd_num_n) * - (1u << tmpl->rxq.strd_sz_n)); + (1u << tmpl->rxq.log_strd_num) * + (1u << tmpl->rxq.log_strd_sz)); DRV_LOG(DEBUG, "port %u Rx queue %u: Multi-Packet RQ is enabled" " strd_num_n = %u, strd_sz_n = %u", dev->data->port_id, idx, - tmpl->rxq.strd_num_n, tmpl->rxq.strd_sz_n); + tmpl->rxq.log_strd_num, tmpl->rxq.log_strd_sz); } else if (max_rx_pkt_len <= first_mb_free_size) { tmpl->rxq.sges_n = 0; max_lro_size = max_rx_pkt_len; @@ -1899,15 +1903,15 @@ mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, " min_stride_sz = %u, max_stride_sz = %u).", dev->data->port_id, non_scatter_min_mbuf_size, desc, priv->rxqs_n, - config->mprq.stride_size_n ? - (1U << config->mprq.stride_size_n) : - (1U << mprq_stride_size), - config->mprq.stride_num_n ? - (1U << config->mprq.stride_num_n) : - (1U << mprq_stride_nums), + config->mprq.log_stride_size ? + (1U << config->mprq.log_stride_size) : + (1U << log_mprq_stride_size), + config->mprq.log_stride_num ? + (1U << config->mprq.log_stride_num) : + (1U << log_mprq_stride_nums), config->mprq.min_rxqs_num, - (1U << config->mprq.min_stride_size_n), - (1U << config->mprq.max_stride_size_n)); + (1U << config->mprq.log_min_stride_size), + (1U << config->mprq.log_max_stride_size)); DRV_LOG(DEBUG, "port %u maximum number of segments per packet: %u", dev->data->port_id, 1 << tmpl->rxq.sges_n); if (desc % (1 << tmpl->rxq.sges_n)) { diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index 73dbf68d2b..87bfd832c5 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -471,7 +471,7 @@ rx_queue_count(struct mlx5_rxq_data *rxq) const unsigned int cqe_n = (1 << rxq->cqe_n); const unsigned int sges_n = (1 << rxq->sges_n); const unsigned int elts_n = (1 << rxq->elts_n); - const unsigned int strd_n = (1 << rxq->strd_num_n); + const unsigned int strd_n = (1 << rxq->log_strd_num); const unsigned int cqe_cnt = cqe_n - 1; unsigned int cq_ci, used; @@ -769,10 +769,10 @@ mlx5_rxq_initialize(struct mlx5_rxq_data *rxq) scat = &((volatile struct mlx5_wqe_mprq *) rxq->wqes)[i].dseg; - addr = (uintptr_t)mlx5_mprq_buf_addr(buf, - 1 << rxq->strd_num_n); - byte_count = (1 << rxq->strd_sz_n) * - (1 << rxq->strd_num_n); + addr = (uintptr_t)mlx5_mprq_buf_addr + (buf, (1 << rxq->log_strd_num)); + byte_count = (1 << rxq->log_strd_sz) * + (1 << rxq->log_strd_num); } else { struct rte_mbuf *buf = (*rxq->elts)[i]; @@ -1579,8 +1579,8 @@ uint16_t mlx5_rx_burst_mprq(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n) { struct mlx5_rxq_data *rxq = dpdk_rxq; - const unsigned int strd_n = 1 << rxq->strd_num_n; - const unsigned int strd_sz = 1 << rxq->strd_sz_n; + const unsigned int strd_n = 1 << rxq->log_strd_num; + const unsigned int strd_sz = 1 << rxq->log_strd_sz; const unsigned int strd_shift = MLX5_MPRQ_STRIDE_SHIFT_BYTE * rxq->strd_shift_en; const unsigned int cq_mask = (1 << rxq->cqe_n) - 1; diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index 34ec66a3ae..e43d465f93 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -110,8 +110,8 @@ struct mlx5_rxq_data { unsigned int elts_n:4; /* Log 2 of Mbufs. */ unsigned int rss_hash:1; /* RSS hash result is enabled. */ unsigned int mark:1; /* Marked flow available on the queue. */ - unsigned int strd_num_n:5; /* Log 2 of the number of stride. */ - unsigned int strd_sz_n:4; /* Log 2 of stride size. */ + unsigned int log_strd_num:5; /* Log 2 of the number of stride. */ + unsigned int log_strd_sz:4; /* Log 2 of stride size. */ unsigned int strd_shift_en:1; /* Enable 2bytes shift on a stride. */ unsigned int err_state:2; /* enum mlx5_rxq_err_state. */ unsigned int strd_scatter_en:1; /* Scattered packets from a stride. */ -- 2.25.1