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 085024569C for ; Wed, 24 Jul 2024 13:34:19 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 02E4A43390; Wed, 24 Jul 2024 13:34:19 +0200 (CEST) Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) by mails.dpdk.org (Postfix) with ESMTP id 121F5433C1 for ; Wed, 24 Jul 2024 13:34:18 +0200 (CEST) Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-369c609d0c7so3772977f8f.3 for ; Wed, 24 Jul 2024 04:34:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721820857; x=1722425657; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CzxNA8OMyScx8/wWpahYAn7dkHohFXBb+/d9BoID/KY=; b=HAViEBtDhYCCGugNEQTZjXPuLl9rBJMzLA+TmDBAgi7J7Jnz9kpdUZrhKGvBuaNoY8 UJuPYRPObWLwUQddAHAk7I80neK8nGdjy9BqJg2VyBHyln0mLvsMV2W8i+R0ZC8HqPcB PJWCGY96N6uflaGOLB1/dmduvWOael6cxGubgvPAK6bEqUUvAFWtz5ZspFoyX53GCD/f rFlpJffLK1acQxbCSn6jEfHH9xwfliJDrsx2Q3wKL0fPvbkJBd4sNKiMCx14AusikOzL oSYY42xzS3aYKa+Xq4iEYPSqEygn9HI9L3LvFA2OptAoGPqyXGznNtSjN7JPiND6GCN+ yu7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721820857; x=1722425657; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CzxNA8OMyScx8/wWpahYAn7dkHohFXBb+/d9BoID/KY=; b=Txl3MMUp9FehXAWWk05hLPAdYqfJCwIZroE/CZXvdWKT4o9x0eYxHU8KTqEpnnOrnB BN+R33+zVJo42wf9m8VGBs/88GiTf6c2G3pcftGF0EKpLr7Xjyy8LhkBl0dKNTCUrAuv ZTfz+GcbHS63YOg4TKF4M4csAqS4VMkBBcJgd+LrOi4aMro1MWeTiMmURunjFY2xCsWL mbCROYz/CPA+cwxODt6Ju91uGOzauw5l83D4G7I/yM/Eqo/8wUEX2O6nYnvYvdQ9Gr5x E6VgdJ0deOgs7VMdhgBwPGFe+xdytMy5lBZV14Nmu6MknBQq+3yRTC7WrpWIMsyqGZsP WMTQ== X-Forwarded-Encrypted: i=1; AJvYcCVHXSa9P8tsUCUMEwa1/6HAftH944vXDzlX/rlBMjOBBzv3fxBj7kH/dj6TYWIwV0hZryHoMDYw4hxzXuv8MfA= X-Gm-Message-State: AOJu0YzaApw5y9j4FSSNJcJC+W9M/IBx/rN+RzceOxLurl6K7tzWYyKg LekbN+EdLMni0eGqEM5d1goVo5Op+kOcND5xUPUW1ICyHB8YjJvh+mupKkN7 X-Google-Smtp-Source: AGHT+IFN00R407WIsabnT1oeHVbrwW7NkbD+fVhrpUo5M+ZBzNdRDmqR8Mw8lszIeDZqZXaisGuKow== X-Received: by 2002:a05:6000:1847:b0:368:7868:2d76 with SMTP id ffacd0b85a97d-369f0a985a1mr2678439f8f.51.1721820857437; Wed, 24 Jul 2024 04:34:17 -0700 (PDT) Received: from localhost ([137.220.120.171]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-368787ed580sm13969087f8f.112.2024.07.24.04.34.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jul 2024 04:34:17 -0700 (PDT) From: luca.boccassi@gmail.com To: Dariusz Sosnowski Cc: Viacheslav Ovsiienko , dpdk stable Subject: patch 'net/mlx5: fix disabling E-Switch default flow rules' has been queued to stable release 22.11.6 Date: Wed, 24 Jul 2024 12:32:57 +0100 Message-Id: <20240724113318.616754-19-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240724113318.616754-1-luca.boccassi@gmail.com> References: <20240715152704.2229503-86-luca.boccassi@gmail.com> <20240724113318.616754-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Hi, FYI, your patch has been queued to stable release 22.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 07/26/24. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/5669dcea46cecc3719837f17b0c34b24647379b4 Thanks. Luca Boccassi --- >From 5669dcea46cecc3719837f17b0c34b24647379b4 Mon Sep 17 00:00:00 2001 From: Dariusz Sosnowski Date: Thu, 18 Jul 2024 11:57:15 +0200 Subject: [PATCH] net/mlx5: fix disabling E-Switch default flow rules [ upstream commit cf9a91c67b88071a03beb32a3ea9970e6ee00391 ] `fdb_def_rule_en` devarg controls whether mlx5 PMD creates default E-Switch flow rules for: - Transferring traffic from wire, VFs and SFs to group 1 (default jump). - Providing default behavior for application traffic (default SQ miss flow rules). With these flow rules, applications effectively create transfer flow rules in group 1 and higher (application group is translated to one higher) allowing for faster insertion on all groups and providing ability to forward to VF, SF and wire on any group. By default, these rules are created (`fdb_def_rule_en` == 1). When these default flow rules are disabled (`fdb_def_rule_en` == 0) with HW Steering flow engine (`dv_flow_en` == 2) only creation of default jump rules was disabled. Also, necessary template table and pattern/actions templates were created as well, but they were never used. SQ miss flow rules were still created. This is a bug, because with `fdb_def_rule_en` == 0, application should not expect any default E-Switch flow rules. This patch fixes that by disabling all default E-Switch flow rules creation and disabling creating templates for these flow rules, when `fdb_def_rule_en` == 0. If an application needs to run with these flow rules disabled, and requires flow rules providing SQ miss flow rules functionality, then application must explicitly create similar flow rules. Fixes: 1939eb6f660c ("net/mlx5: support flow port action with HWS") Signed-off-by: Dariusz Sosnowski Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow_hw.c | 142 ++++++++++++++++++-------------- drivers/net/mlx5/mlx5_trigger.c | 4 +- drivers/net/mlx5/mlx5_txq.c | 13 ++- 3 files changed, 91 insertions(+), 68 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index 45709c9fd2..aa315c054d 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -6469,6 +6469,7 @@ flow_hw_create_ctrl_tables(struct rte_eth_dev *dev, struct rte_flow_error *error struct mlx5_flow_hw_ctrl_fdb *hw_ctrl_fdb; uint32_t xmeta = priv->sh->config.dv_xmeta_en; uint32_t repr_matching = priv->sh->config.repr_matching; + uint32_t fdb_def_rule = priv->sh->config.fdb_def_rule; MLX5_ASSERT(priv->hw_ctrl_fdb == NULL); hw_ctrl_fdb = mlx5_malloc(MLX5_MEM_ZERO, sizeof(*hw_ctrl_fdb), 0, SOCKET_ID_ANY); @@ -6479,70 +6480,79 @@ flow_hw_create_ctrl_tables(struct rte_eth_dev *dev, struct rte_flow_error *error goto err; } priv->hw_ctrl_fdb = hw_ctrl_fdb; - /* Create templates and table for default SQ miss flow rules - root table. */ - hw_ctrl_fdb->esw_mgr_items_tmpl = flow_hw_create_ctrl_esw_mgr_pattern_template(dev, error); - if (!hw_ctrl_fdb->esw_mgr_items_tmpl) { - DRV_LOG(ERR, "port %u failed to create E-Switch Manager item" - " template for control flows", dev->data->port_id); - goto err; - } - hw_ctrl_fdb->regc_jump_actions_tmpl = flow_hw_create_ctrl_regc_jump_actions_template - (dev, error); - if (!hw_ctrl_fdb->regc_jump_actions_tmpl) { - DRV_LOG(ERR, "port %u failed to create REG_C set and jump action template" - " for control flows", dev->data->port_id); - goto err; - } - hw_ctrl_fdb->hw_esw_sq_miss_root_tbl = flow_hw_create_ctrl_sq_miss_root_table - (dev, hw_ctrl_fdb->esw_mgr_items_tmpl, hw_ctrl_fdb->regc_jump_actions_tmpl, - error); - if (!hw_ctrl_fdb->hw_esw_sq_miss_root_tbl) { - DRV_LOG(ERR, "port %u failed to create table for default sq miss (root table)" - " for control flows", dev->data->port_id); - goto err; - } - /* Create templates and table for default SQ miss flow rules - non-root table. */ - hw_ctrl_fdb->regc_sq_items_tmpl = flow_hw_create_ctrl_regc_sq_pattern_template(dev, error); - if (!hw_ctrl_fdb->regc_sq_items_tmpl) { - DRV_LOG(ERR, "port %u failed to create SQ item template for" - " control flows", dev->data->port_id); - goto err; - } - hw_ctrl_fdb->port_actions_tmpl = flow_hw_create_ctrl_port_actions_template(dev, error); - if (!hw_ctrl_fdb->port_actions_tmpl) { - DRV_LOG(ERR, "port %u failed to create port action template" - " for control flows", dev->data->port_id); - goto err; - } - hw_ctrl_fdb->hw_esw_sq_miss_tbl = flow_hw_create_ctrl_sq_miss_table - (dev, hw_ctrl_fdb->regc_sq_items_tmpl, hw_ctrl_fdb->port_actions_tmpl, - error); - if (!hw_ctrl_fdb->hw_esw_sq_miss_tbl) { - DRV_LOG(ERR, "port %u failed to create table for default sq miss (non-root table)" - " for control flows", dev->data->port_id); - goto err; - } - /* Create templates and table for default FDB jump flow rules. */ - hw_ctrl_fdb->port_items_tmpl = flow_hw_create_ctrl_port_pattern_template(dev, error); - if (!hw_ctrl_fdb->port_items_tmpl) { - DRV_LOG(ERR, "port %u failed to create SQ item template for" - " control flows", dev->data->port_id); - goto err; - } - hw_ctrl_fdb->jump_one_actions_tmpl = flow_hw_create_ctrl_jump_actions_template - (dev, MLX5_HW_LOWEST_USABLE_GROUP, error); - if (!hw_ctrl_fdb->jump_one_actions_tmpl) { - DRV_LOG(ERR, "port %u failed to create jump action template" - " for control flows", dev->data->port_id); - goto err; - } - hw_ctrl_fdb->hw_esw_zero_tbl = flow_hw_create_ctrl_jump_table - (dev, hw_ctrl_fdb->port_items_tmpl, hw_ctrl_fdb->jump_one_actions_tmpl, - error); - if (!hw_ctrl_fdb->hw_esw_zero_tbl) { - DRV_LOG(ERR, "port %u failed to create table for default jump to group 1" - " for control flows", dev->data->port_id); - goto err; + if (fdb_def_rule) { + /* Create templates and table for default SQ miss flow rules - root table. */ + hw_ctrl_fdb->esw_mgr_items_tmpl = + flow_hw_create_ctrl_esw_mgr_pattern_template(dev, error); + if (!hw_ctrl_fdb->esw_mgr_items_tmpl) { + DRV_LOG(ERR, "port %u failed to create E-Switch Manager item" + " template for control flows", dev->data->port_id); + goto err; + } + hw_ctrl_fdb->regc_jump_actions_tmpl = + flow_hw_create_ctrl_regc_jump_actions_template(dev, error); + if (!hw_ctrl_fdb->regc_jump_actions_tmpl) { + DRV_LOG(ERR, "port %u failed to create REG_C set and jump action template" + " for control flows", dev->data->port_id); + goto err; + } + hw_ctrl_fdb->hw_esw_sq_miss_root_tbl = + flow_hw_create_ctrl_sq_miss_root_table + (dev, hw_ctrl_fdb->esw_mgr_items_tmpl, + hw_ctrl_fdb->regc_jump_actions_tmpl, error); + if (!hw_ctrl_fdb->hw_esw_sq_miss_root_tbl) { + DRV_LOG(ERR, "port %u failed to create table for default sq miss (root table)" + " for control flows", dev->data->port_id); + goto err; + } + /* Create templates and table for default SQ miss flow rules - non-root table. */ + hw_ctrl_fdb->regc_sq_items_tmpl = + flow_hw_create_ctrl_regc_sq_pattern_template(dev, error); + if (!hw_ctrl_fdb->regc_sq_items_tmpl) { + DRV_LOG(ERR, "port %u failed to create SQ item template for" + " control flows", dev->data->port_id); + goto err; + } + hw_ctrl_fdb->port_actions_tmpl = + flow_hw_create_ctrl_port_actions_template(dev, error); + if (!hw_ctrl_fdb->port_actions_tmpl) { + DRV_LOG(ERR, "port %u failed to create port action template" + " for control flows", dev->data->port_id); + goto err; + } + hw_ctrl_fdb->hw_esw_sq_miss_tbl = + flow_hw_create_ctrl_sq_miss_table + (dev, hw_ctrl_fdb->regc_sq_items_tmpl, + hw_ctrl_fdb->port_actions_tmpl, error); + if (!hw_ctrl_fdb->hw_esw_sq_miss_tbl) { + DRV_LOG(ERR, "port %u failed to create table for default sq miss (non-root table)" + " for control flows", dev->data->port_id); + goto err; + } + /* Create templates and table for default FDB jump flow rules. */ + hw_ctrl_fdb->port_items_tmpl = + flow_hw_create_ctrl_port_pattern_template(dev, error); + if (!hw_ctrl_fdb->port_items_tmpl) { + DRV_LOG(ERR, "port %u failed to create SQ item template for" + " control flows", dev->data->port_id); + goto err; + } + hw_ctrl_fdb->jump_one_actions_tmpl = + flow_hw_create_ctrl_jump_actions_template + (dev, MLX5_HW_LOWEST_USABLE_GROUP, error); + if (!hw_ctrl_fdb->jump_one_actions_tmpl) { + DRV_LOG(ERR, "port %u failed to create jump action template" + " for control flows", dev->data->port_id); + goto err; + } + hw_ctrl_fdb->hw_esw_zero_tbl = flow_hw_create_ctrl_jump_table + (dev, hw_ctrl_fdb->port_items_tmpl, + hw_ctrl_fdb->jump_one_actions_tmpl, error); + if (!hw_ctrl_fdb->hw_esw_zero_tbl) { + DRV_LOG(ERR, "port %u failed to create table for default jump to group 1" + " for control flows", dev->data->port_id); + goto err; + } } /* Create templates and table for default Tx metadata copy flow rule. */ if (!repr_matching && xmeta == MLX5_XMETA_MODE_META32_HWS) { @@ -9211,6 +9221,8 @@ mlx5_flow_hw_esw_destroy_sq_miss_flow(struct rte_eth_dev *dev, uint32_t sqn) } proxy_dev = &rte_eth_devices[proxy_port_id]; proxy_priv = proxy_dev->data->dev_private; + /* FDB default flow rules must be enabled. */ + MLX5_ASSERT(proxy_priv->sh->config.fdb_def_rule); if (!proxy_priv->dr_ctx) return 0; if (!proxy_priv->hw_ctrl_fdb || @@ -9275,6 +9287,8 @@ mlx5_flow_hw_esw_create_default_jump_flow(struct rte_eth_dev *dev) } proxy_dev = &rte_eth_devices[proxy_port_id]; proxy_priv = proxy_dev->data->dev_private; + /* FDB default flow rules must be enabled. */ + MLX5_ASSERT(proxy_priv->sh->config.fdb_def_rule); if (!proxy_priv->dr_ctx) { DRV_LOG(DEBUG, "Transfer proxy port (port %u) of port %u must be configured " "for HWS to create default FDB jump rule. Default rule will " diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index dbf5719a7e..1cb0b56ae1 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -1498,7 +1498,9 @@ mlx5_traffic_enable_hws(struct rte_eth_dev *dev) if (!txq) continue; queue = mlx5_txq_get_sqn(txq); - if ((priv->representor || priv->master) && config->dv_esw_en) { + if ((priv->representor || priv->master) && + config->dv_esw_en && + config->fdb_def_rule) { if (mlx5_flow_hw_esw_create_sq_miss_flow(dev, queue, false)) { mlx5_txq_release(dev, i); goto error; diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c index d617784dba..46badcd0cc 100644 --- a/drivers/net/mlx5/mlx5_txq.c +++ b/drivers/net/mlx5/mlx5_txq.c @@ -1311,11 +1311,18 @@ rte_pmd_mlx5_external_sq_enable(uint16_t port_id, uint32_t sq_num) } #ifdef HAVE_MLX5_HWS_SUPPORT if (priv->sh->config.dv_flow_en == 2) { - if (mlx5_flow_hw_esw_create_sq_miss_flow(dev, sq_num, true)) - return -rte_errno; + bool sq_miss_created = false; + + if (priv->sh->config.fdb_def_rule) { + if (mlx5_flow_hw_esw_create_sq_miss_flow(dev, sq_num, true)) + return -rte_errno; + sq_miss_created = true; + } + if (priv->sh->config.repr_matching && mlx5_flow_hw_tx_repr_matching_flow(dev, sq_num, true)) { - mlx5_flow_hw_esw_destroy_sq_miss_flow(dev, sq_num); + if (sq_miss_created) + mlx5_flow_hw_esw_destroy_sq_miss_flow(dev, sq_num); return -rte_errno; } return 0; -- 2.39.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-07-24 12:29:22.222031805 +0100 +++ 0019-net-mlx5-fix-disabling-E-Switch-default-flow-rules.patch 2024-07-24 12:29:20.751025728 +0100 @@ -1 +1 @@ -From cf9a91c67b88071a03beb32a3ea9970e6ee00391 Mon Sep 17 00:00:00 2001 +From 5669dcea46cecc3719837f17b0c34b24647379b4 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit cf9a91c67b88071a03beb32a3ea9970e6ee00391 ] + @@ -37 +38,0 @@ -Cc: stable@dpdk.org @@ -48 +49 @@ -index e7d8c251a0..fe7df7305f 100644 +index 45709c9fd2..aa315c054d 100644 @@ -51 +52 @@ -@@ -10580,6 +10580,7 @@ flow_hw_create_ctrl_tables(struct rte_eth_dev *dev, struct rte_flow_error *error +@@ -6469,6 +6469,7 @@ flow_hw_create_ctrl_tables(struct rte_eth_dev *dev, struct rte_flow_error *error @@ -59 +60 @@ -@@ -10590,70 +10591,79 @@ flow_hw_create_ctrl_tables(struct rte_eth_dev *dev, struct rte_flow_error *error +@@ -6479,70 +6480,79 @@ flow_hw_create_ctrl_tables(struct rte_eth_dev *dev, struct rte_flow_error *error @@ -203 +204 @@ -@@ -15383,6 +15393,8 @@ mlx5_flow_hw_esw_destroy_sq_miss_flow(struct rte_eth_dev *dev, uint32_t sqn) +@@ -9211,6 +9221,8 @@ mlx5_flow_hw_esw_destroy_sq_miss_flow(struct rte_eth_dev *dev, uint32_t sqn) @@ -212 +213 @@ -@@ -15447,6 +15459,8 @@ mlx5_flow_hw_esw_create_default_jump_flow(struct rte_eth_dev *dev) +@@ -9275,6 +9287,8 @@ mlx5_flow_hw_esw_create_default_jump_flow(struct rte_eth_dev *dev) @@ -222 +223 @@ -index 6fa7c01cd0..a65a460731 100644 +index dbf5719a7e..1cb0b56ae1 100644 @@ -225 +226 @@ -@@ -1504,7 +1504,9 @@ mlx5_traffic_enable_hws(struct rte_eth_dev *dev) +@@ -1498,7 +1498,9 @@ mlx5_traffic_enable_hws(struct rte_eth_dev *dev) @@ -237 +238 @@ -index 8eb1ae1f03..f05534e168 100644 +index d617784dba..46badcd0cc 100644 @@ -240 +241 @@ -@@ -1363,11 +1363,18 @@ rte_pmd_mlx5_external_sq_enable(uint16_t port_id, uint32_t sq_num) +@@ -1311,11 +1311,18 @@ rte_pmd_mlx5_external_sq_enable(uint16_t port_id, uint32_t sq_num)