From patchwork Wed Jun 24 11:33:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Baum X-Patchwork-Id: 72154 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 61ECCA0350; Wed, 24 Jun 2020 16:14:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 18B551D9A4; Wed, 24 Jun 2020 16:14:35 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id C2B301D547 for ; Wed, 24 Jun 2020 16:14:26 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from matan@mellanox.com) with SMTP; 24 Jun 2020 17:14:25 +0300 Received: from pegasus07.mtr.labs.mlnx (pegasus07.mtr.labs.mlnx [10.210.16.112]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 05OBXhuH007248; Wed, 24 Jun 2020 14:33:43 +0300 From: Michael Baum To: dev@dpdk.org Cc: matan@mellanox.com, viacheslavo@mellanox.com, stable@dpdk.org Date: Wed, 24 Jun 2020 11:33:01 +0000 Message-Id: <1592998387-28181-1-git-send-email-michaelba@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH 1/7] common/mlx5: fix code arrangement in tag allocation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Flow tag action is supported only when the driver has DR or DV support. The tag allocation is adjusted to the modes DV or DR. In case both DR and DV are not supported in the system, the driver handles static code for error report. This error code, wrongly, was compiled when DV is supported while in this case it cannot be accessed at all. Ignore the aforementioned static error code in case of DV by preprocessor commands rearrangement. Fixes: cbb66daa3c85 ("net/mlx5: prepare Direct Verbs for Direct Rule") Cc: stable@dpdk.org Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/common/mlx5/linux/mlx5_glue.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/common/mlx5/linux/mlx5_glue.c b/drivers/common/mlx5/linux/mlx5_glue.c index c91ee33..a41650d 100644 --- a/drivers/common/mlx5/linux/mlx5_glue.c +++ b/drivers/common/mlx5/linux/mlx5_glue.c @@ -752,7 +752,7 @@ #ifdef HAVE_IBV_FLOW_DV_SUPPORT #ifdef HAVE_MLX5DV_DR return mlx5dv_dr_action_create_tag(tag); -#else +#else /* HAVE_MLX5DV_DR */ struct mlx5dv_flow_action_attr *action; action = malloc(sizeof(*action)); if (!action) @@ -760,11 +760,12 @@ action->type = MLX5DV_FLOW_ACTION_TAG; action->tag_value = tag; return action; -#endif -#endif +#endif /* HAVE_MLX5DV_DR */ +#else /* HAVE_IBV_FLOW_DV_SUPPORT */ (void)tag; errno = ENOTSUP; return NULL; +#endif /* HAVE_IBV_FLOW_DV_SUPPORT */ } static void * From patchwork Wed Jun 24 11:33:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Baum X-Patchwork-Id: 72152 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9F1EEA0350; Wed, 24 Jun 2020 16:14:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 816C41D6E9; Wed, 24 Jun 2020 16:14:32 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 190151D578 for ; Wed, 24 Jun 2020 16:14:23 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from matan@mellanox.com) with SMTP; 24 Jun 2020 17:14:21 +0300 Received: from pegasus07.mtr.labs.mlnx (pegasus07.mtr.labs.mlnx [10.210.16.112]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 05OBXhuI007248; Wed, 24 Jun 2020 14:34:04 +0300 From: Michael Baum To: dev@dpdk.org Cc: matan@mellanox.com, viacheslavo@mellanox.com Date: Wed, 24 Jun 2020 11:33:02 +0000 Message-Id: <1592998387-28181-2-git-send-email-michaelba@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1592998387-28181-1-git-send-email-michaelba@mellanox.com> References: <1592998387-28181-1-git-send-email-michaelba@mellanox.com> Subject: [dpdk-dev] [PATCH 2/7] net/mlx5: use direct API to find port by device X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Using RTE_ETH_FOREACH_DEV_OF loop is not necessary when the driver wants to find only the first match. Use rte_eth_find_next_of to find it. Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_mr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/mlx5/mlx5_mr.c b/drivers/net/mlx5/mlx5_mr.c index adbe07c..3b781b6 100644 --- a/drivers/net/mlx5/mlx5_mr.c +++ b/drivers/net/mlx5/mlx5_mr.c @@ -313,9 +313,10 @@ struct mr_update_mp_data { { uint16_t port_id; - RTE_ETH_FOREACH_DEV_OF(port_id, &pdev->device) - return &rte_eth_devices[port_id]; - return NULL; + port_id = rte_eth_find_next_of(0, &pdev->device); + if (port_id == RTE_MAX_ETHPORTS) + return NULL; + return &rte_eth_devices[port_id]; } /** From patchwork Wed Jun 24 11:33:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Baum X-Patchwork-Id: 72112 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9BF9AA0350; Wed, 24 Jun 2020 13:35:20 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D8DFE1D68E; Wed, 24 Jun 2020 13:35:19 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 484FF1D608 for ; Wed, 24 Jun 2020 13:35:19 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from matan@mellanox.com) with SMTP; 24 Jun 2020 14:35:16 +0300 Received: from pegasus07.mtr.labs.mlnx (pegasus07.mtr.labs.mlnx [10.210.16.112]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 05OBXhuJ007248; Wed, 24 Jun 2020 14:34:16 +0300 From: Michael Baum To: dev@dpdk.org Cc: matan@mellanox.com, viacheslavo@mellanox.com, stable@dpdk.org Date: Wed, 24 Jun 2020 11:33:03 +0000 Message-Id: <1592998387-28181-3-git-send-email-michaelba@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1592998387-28181-1-git-send-email-michaelba@mellanox.com> References: <1592998387-28181-1-git-send-email-michaelba@mellanox.com> Subject: [dpdk-dev] [PATCH 3/7] net/mlx5: fix iterator type in Rx queue management X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" The mlx5_check_vec_rx_support function in the mlx5_rxtx_vec.c file passes the RX queues array in the loop. Similarly, the mlx5_mprq_enabled function in the mlx5_rxq.c file passes the RX queues array in the loop. In both cases, the iterator of the loop is called i and the variable representing the array size is called rxqs_n. The i variable is of UINT16_T type while the rxqs_n variable is of unsigned int type. The size of the rxqs_n variable is much larger than the number of iterations allowed by the i type, theoretically there may be a situation where the value of the rxqs_n will be greater than can be represented by 16 bits and the loop will never end. Change the type of i to UINT32_T. Fixes: 7d6bf6b866b8 ("net/mlx5: add Multi-Packet Rx support") Fixes: 6cb559d67b83 ("net/mlx5: add vectorized Rx/Tx burst for x86") Cc: stable@dpdk.org Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_rxq.c | 2 +- drivers/net/mlx5/mlx5_rxtx_vec.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index bd0037b..b436f06 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -108,7 +108,7 @@ mlx5_mprq_enabled(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; - uint16_t i; + uint32_t i; uint16_t n = 0; uint16_t n_ibv = 0; diff --git a/drivers/net/mlx5/mlx5_rxtx_vec.c b/drivers/net/mlx5/mlx5_rxtx_vec.c index b38bd20..7fae201 100644 --- a/drivers/net/mlx5/mlx5_rxtx_vec.c +++ b/drivers/net/mlx5/mlx5_rxtx_vec.c @@ -156,7 +156,7 @@ mlx5_check_vec_rx_support(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; - uint16_t i; + uint32_t i; if (!priv->config.rx_vec_en) return -ENOTSUP; From patchwork Wed Jun 24 11:33:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Baum X-Patchwork-Id: 72113 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B20D6A0350; Wed, 24 Jun 2020 13:35:30 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9456C1D8D9; Wed, 24 Jun 2020 13:35:30 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 0C32E1D608 for ; Wed, 24 Jun 2020 13:35:28 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from matan@mellanox.com) with SMTP; 24 Jun 2020 14:35:23 +0300 Received: from pegasus07.mtr.labs.mlnx (pegasus07.mtr.labs.mlnx [10.210.16.112]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 05OBXhuK007248; Wed, 24 Jun 2020 14:34:23 +0300 From: Michael Baum To: dev@dpdk.org Cc: matan@mellanox.com, viacheslavo@mellanox.com Date: Wed, 24 Jun 2020 11:33:04 +0000 Message-Id: <1592998387-28181-4-git-send-email-michaelba@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1592998387-28181-1-git-send-email-michaelba@mellanox.com> References: <1592998387-28181-1-git-send-email-michaelba@mellanox.com> Subject: [dpdk-dev] [PATCH 4/7] net/mlx4: use anonymous DV allocator argument X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" The mlx4_pci_probe function defines an struct mlx4dv_ctx_allocators type variable several hundred rows after it starts, with the only use it being passed as a parameter to the mlx4_glue->dv_set_context_attr function. However, according to DPDK Coding Style Guidelines, variables should be declared at the start of a block of code rather than in the middle. Therefore, to improve the Coding Style, the variable is passed directly to the function without declaring it before. Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/net/mlx4/mlx4.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 5d72027..ff270b4 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -1054,14 +1054,13 @@ struct mlx4_conf { eth_dev->dev_ops = &mlx4_dev_ops; #ifdef HAVE_IBV_MLX4_BUF_ALLOCATORS /* Hint libmlx4 to use PMD allocator for data plane resources */ - struct mlx4dv_ctx_allocators alctr = { - .alloc = &mlx4_alloc_verbs_buf, - .free = &mlx4_free_verbs_buf, - .data = priv, - }; err = mlx4_glue->dv_set_context_attr (ctx, MLX4DV_SET_CTX_ATTR_BUF_ALLOCATORS, - (void *)((uintptr_t)&alctr)); + (void *)((uintptr_t)&(struct mlx4dv_ctx_allocators){ + .alloc = &mlx4_alloc_verbs_buf, + .free = &mlx4_free_verbs_buf, + .data = priv, + })); if (err) WARN("Verbs external allocator is not supported"); else From patchwork Wed Jun 24 11:33:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Baum X-Patchwork-Id: 72114 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 05F1FA0350; Wed, 24 Jun 2020 13:35:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DBC4F1D903; Wed, 24 Jun 2020 13:35:45 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 22AAC1D608 for ; Wed, 24 Jun 2020 13:35:44 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from matan@mellanox.com) with SMTP; 24 Jun 2020 14:35:41 +0300 Received: from pegasus07.mtr.labs.mlnx (pegasus07.mtr.labs.mlnx [10.210.16.112]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 05OBXhuL007248; Wed, 24 Jun 2020 14:34:32 +0300 From: Michael Baum To: dev@dpdk.org Cc: matan@mellanox.com, viacheslavo@mellanox.com Date: Wed, 24 Jun 2020 11:33:05 +0000 Message-Id: <1592998387-28181-5-git-send-email-michaelba@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1592998387-28181-1-git-send-email-michaelba@mellanox.com> References: <1592998387-28181-1-git-send-email-michaelba@mellanox.com> Subject: [dpdk-dev] [PATCH 5/7] net/mlx4: remove useless assignment X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" The mlx4_ibv_device_to_pci_addr function defines a variable called ret inside a loop and uses it. During the loop, the function assigns a value within the variable and breaks from the loop, so that this assigning has done nothing and is actually unnecessary. Remove the unnecessary assigning. Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/net/mlx4/mlx4.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index ff270b4..1657ea3 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -492,7 +492,6 @@ struct mlx4_conf { &pci_addr->bus, &pci_addr->devid, &pci_addr->function) == 4) { - ret = 0; break; } } From patchwork Wed Jun 24 11:33:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Baum X-Patchwork-Id: 72115 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2BA5AA0350; Wed, 24 Jun 2020 13:35:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 566371D916; Wed, 24 Jun 2020 13:35:47 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 267F61D90E for ; Wed, 24 Jun 2020 13:35:44 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from matan@mellanox.com) with SMTP; 24 Jun 2020 14:35:40 +0300 Received: from pegasus07.mtr.labs.mlnx (pegasus07.mtr.labs.mlnx [10.210.16.112]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 05OBXhuM007248; Wed, 24 Jun 2020 14:34:37 +0300 From: Michael Baum To: dev@dpdk.org Cc: matan@mellanox.com, viacheslavo@mellanox.com Date: Wed, 24 Jun 2020 11:33:06 +0000 Message-Id: <1592998387-28181-6-git-send-email-michaelba@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1592998387-28181-1-git-send-email-michaelba@mellanox.com> References: <1592998387-28181-1-git-send-email-michaelba@mellanox.com> Subject: [dpdk-dev] [PATCH 6/7] common/mlx5: remove useless assignment X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" The mlx5_dev_to_pci_addr function defines a variable called ret inside a loop and uses it. During the loop, the function assigns a value within the variable and breaks from the loop, so that this assigning has done nothing and is actually unnecessary. Remove the unnecessary assigning. Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/common/mlx5/linux/mlx5_common_os.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/common/mlx5/linux/mlx5_common_os.c b/drivers/common/mlx5/linux/mlx5_common_os.c index e422e95..e74aa89 100644 --- a/drivers/common/mlx5/linux/mlx5_common_os.c +++ b/drivers/common/mlx5/linux/mlx5_common_os.c @@ -66,7 +66,6 @@ &pci_addr->bus, &pci_addr->devid, &pci_addr->function) == 4) { - ret = 0; break; } } From patchwork Wed Jun 24 11:33:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Baum X-Patchwork-Id: 72153 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2CC82A0350; Wed, 24 Jun 2020 16:14:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D6E711D96C; Wed, 24 Jun 2020 16:14:33 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 1D63B1D653 for ; Wed, 24 Jun 2020 16:14:23 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from matan@mellanox.com) with SMTP; 24 Jun 2020 17:14:22 +0300 Received: from pegasus07.mtr.labs.mlnx (pegasus07.mtr.labs.mlnx [10.210.16.112]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 05OBXhuN007248; Wed, 24 Jun 2020 14:34:48 +0300 From: Michael Baum To: dev@dpdk.org Cc: matan@mellanox.com, viacheslavo@mellanox.com Date: Wed, 24 Jun 2020 11:33:07 +0000 Message-Id: <1592998387-28181-7-git-send-email-michaelba@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1592998387-28181-1-git-send-email-michaelba@mellanox.com> References: <1592998387-28181-1-git-send-email-michaelba@mellanox.com> Subject: [dpdk-dev] [PATCH 7/7] net/mlx5: use anonymous DV allocator argument X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" The mlx5_dev_spawn function defines an struct mlx5dv_ctx_allocators type variable several hundred rows after it starts, with the only use it being passed as a parameter to the mlx5_glue->dv_set_context_attr function. However, according to DPDK Coding Style Guidelines, variables should be declared at the start of a block of code rather than in the middle. Therefore, to improve the Coding Style, the variable is passed directly to the function without declaring it before. Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/net/mlx5/linux/mlx5_os.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index f0147e6..2dc57b2 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -988,14 +988,13 @@ TAILQ_INIT(&priv->flow_meters); TAILQ_INIT(&priv->flow_meter_profiles); /* Hint libmlx5 to use PMD allocator for data plane resources */ - struct mlx5dv_ctx_allocators alctr = { - .alloc = &mlx5_alloc_verbs_buf, - .free = &mlx5_free_verbs_buf, - .data = priv, - }; mlx5_glue->dv_set_context_attr(sh->ctx, - MLX5DV_CTX_ATTR_BUF_ALLOCATORS, - (void *)((uintptr_t)&alctr)); + MLX5DV_CTX_ATTR_BUF_ALLOCATORS, + (void *)((uintptr_t)&(struct mlx5dv_ctx_allocators){ + .alloc = &mlx5_alloc_verbs_buf, + .free = &mlx5_free_verbs_buf, + .data = priv, + })); /* Bring Ethernet device up. */ DRV_LOG(DEBUG, "port %u forcing Ethernet interface up", eth_dev->data->port_id);