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 883F843D47 for ; Mon, 25 Mar 2024 13:08:33 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8175340A75; Mon, 25 Mar 2024 13:08:33 +0100 (CET) Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) by mails.dpdk.org (Postfix) with ESMTP id 196464068A for ; Mon, 25 Mar 2024 13:08:32 +0100 (CET) Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-513d3746950so5220156e87.1 for ; Mon, 25 Mar 2024 05:08:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711368511; x=1711973311; 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=AyGAecoYju3WNPKctTwAu5pGJAHxY0Bsbs+V5X5ewEc=; b=mGpPu0yMzBwx8vYLQSO9fMsdGrzHZY4R81v4aNJYfOc8HSrxdkLHAXT183ePBkhntJ dQBxZLSLrGb3zlnKpRKfwXN79cjMuiCo5HWZQSNMIfQbA3MtHRZ8lzVeBIqRqqiLHcCn LHmY2N6V+Tp7lTrUPu2640mCr72S85n1PcxsYBCwk/82pc/OYaNbdGBPJCKsxLajbhli Ypu8wTEJuUU0WfWflpnkDOGbEt6zvF78z4M8ayIEAVopBTwKNHAz0XSeh5zzZhf/Kl9i fSIIUUITA8pcu/zOajZhl7HzsCyb50i/v3xpMOHpI9IDMpMgM09W9HY6b8Vunt8TzB8P uI5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711368511; x=1711973311; 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=AyGAecoYju3WNPKctTwAu5pGJAHxY0Bsbs+V5X5ewEc=; b=uAcW+IZb8tKc6bMvrKCX+LayU0F7ORVUeg7VAGRvETWCgO97Ayq2DvU5RQzUR+zqCj LKVIBAfVzPWLr5gFuXh8MtiCs98N8mFZxx8EY6WQ0wsys5SnmGQh6cCPANc8WQvvqoSm d2QiXofwXIBQFjQdPMBzk0SV9FOvAj4SfKTLZ+xG9LVnnLOuRuGfnlKI4hG5tvjv+VCB Fl35ThHvPRPGK5UtoWlT139KPlaxgW6Kdfe0y+vIj6aoG9vnvVrsSPT9c6SAXgVy53vM wrfXAway2A25Wh7alvA3UL/w34MUXTuV+xCkl+7RNUjqrrQGYB/2liXD2NbUz1aiPZRv KbNg== X-Forwarded-Encrypted: i=1; AJvYcCXp8CbBLph0d4OsnSHXai1minY4ZlnzGVPQTz7D1/Zsq1fAbGm5evA5QlwTMYeRSDUKG0PDI+oQCSZfe5CxlhE= X-Gm-Message-State: AOJu0YzVvsvu1N/hHifbBa2CodX8E3WxistxmzMv0nAtYB9f6rBEd3x9 cYJa90oB7bBCZr8sp23rLxJ2aqE4ynTxLkjwxPxSe30s8D/Jd2gs/Nf58jVe X-Google-Smtp-Source: AGHT+IH4/OtQ21nqQfszbIRpbsBRBqUGwYzM1zQ3sjb3C9f9zQf9L5+YeLpW1dp+HaSItBvgQw4i4Q== X-Received: by 2002:a19:5f53:0:b0:515:af97:6776 with SMTP id a19-20020a195f53000000b00515af976776mr813888lfj.65.1711368511416; Mon, 25 Mar 2024 05:08:31 -0700 (PDT) Received: from localhost ([2a01:4b00:d036:ae00:7aef:1aaa:3dff:d546]) by smtp.gmail.com with ESMTPSA id k13-20020adff5cd000000b0033ec9936909sm9388243wrp.39.2024.03.25.05.08.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 05:08:31 -0700 (PDT) From: luca.boccassi@gmail.com To: Erez Shitrit Cc: Yevgeny Kliteynik , Matan Azrad , dpdk stable Subject: patch 'net/mlx5/hws: fix port ID for root table' has been queued to stable release 22.11.5 Date: Mon, 25 Mar 2024 12:08:19 +0000 Message-Id: <20240325120824.1104729-4-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240325120824.1104729-1-luca.boccassi@gmail.com> References: <20240318153919.3407921-28-luca.boccassi@gmail.com> <20240325120824.1104729-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.5 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 03/27/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/e96de331da11975eec51055a6b991535c30bac2b Thanks. Luca Boccassi --- >From e96de331da11975eec51055a6b991535c30bac2b Mon Sep 17 00:00:00 2001 From: Erez Shitrit Date: Thu, 21 Mar 2024 16:48:11 +0200 Subject: [PATCH] net/mlx5/hws: fix port ID for root table [ upstream commit 572fe9ef2f461b7e7e195a3a4da5bf0c11f35949 ] In root tables matcher and rule need to have their port-id, otherwise the translate function that done in dpdk layer will not get the right attributes. For that whenever the matcher is matching the source-port we need to get the relevant port-id before calling the translate function. Fixes: 405242c52dd5 ("net/mlx5/hws: add rule object") Signed-off-by: Erez Shitrit Signed-off-by: Yevgeny Kliteynik Acked-by: Matan Azrad --- drivers/net/mlx5/hws/mlx5dr_matcher.c | 17 +++++++++++++++++ drivers/net/mlx5/hws/mlx5dr_rule.c | 18 ++++++++++++++++++ drivers/net/mlx5/mlx5_flow.h | 22 ++++++++++++++++++++++ 3 files changed, 57 insertions(+) diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.c b/drivers/net/mlx5/hws/mlx5dr_matcher.c index 2e444c1179..c54bf88e78 100644 --- a/drivers/net/mlx5/hws/mlx5dr_matcher.c +++ b/drivers/net/mlx5/hws/mlx5dr_matcher.c @@ -711,6 +711,7 @@ static int mlx5dr_matcher_init_root(struct mlx5dr_matcher *matcher) struct mlx5dv_flow_match_parameters *mask; struct mlx5_flow_attr flow_attr = {0}; struct rte_flow_error rte_error; + struct rte_flow_item *item; uint8_t match_criteria; int ret; @@ -739,6 +740,22 @@ static int mlx5dr_matcher_init_root(struct mlx5dr_matcher *matcher) return rte_errno; } + /* We need the port id in case of matching representor */ + item = matcher->mt[0]->items; + while (item->type != RTE_FLOW_ITEM_TYPE_END) { + if (item->type == RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR || + item->type == RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT) { + ret = flow_hw_get_port_id_from_ctx(ctx, &flow_attr.port_id); + if (ret) { + DR_LOG(ERR, "Failed to get port id for dev %s", + ctx->ibv_ctx->device->name); + rte_errno = EINVAL; + return rte_errno; + } + } + ++item; + } + mask = simple_calloc(1, MLX5_ST_SZ_BYTES(fte_match_param) + offsetof(struct mlx5dv_flow_match_parameters, match_buf)); if (!mask) { diff --git a/drivers/net/mlx5/hws/mlx5dr_rule.c b/drivers/net/mlx5/hws/mlx5dr_rule.c index b27318e6d4..885a2bcefe 100644 --- a/drivers/net/mlx5/hws/mlx5dr_rule.c +++ b/drivers/net/mlx5/hws/mlx5dr_rule.c @@ -382,10 +382,28 @@ static int mlx5dr_rule_create_root(struct mlx5dr_rule *rule, struct mlx5dv_flow_match_parameters *value; struct mlx5_flow_attr flow_attr = {0}; struct mlx5dv_flow_action_attr *attr; + const struct rte_flow_item *cur_item; struct rte_flow_error error; uint8_t match_criteria; int ret; + /* We need the port id in case of matching representor */ + cur_item = items; + while (cur_item->type != RTE_FLOW_ITEM_TYPE_END) { + if (cur_item->type == RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR || + cur_item->type == RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT) { + ret = flow_hw_get_port_id_from_ctx(rule->matcher->tbl->ctx, + &flow_attr.port_id); + if (ret) { + DR_LOG(ERR, "Failed to get port id for dev %s", + rule->matcher->tbl->ctx->ibv_ctx->device->name); + rte_errno = EINVAL; + return rte_errno; + } + } + ++cur_item; + } + attr = simple_calloc(num_actions, sizeof(*attr)); if (!attr) { rte_errno = ENOMEM; diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 9ce34ef556..4f3a216ed4 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -1594,6 +1594,28 @@ flow_hw_get_reg_id(enum rte_flow_item_type type, uint32_t id) } } +static __rte_always_inline int +flow_hw_get_port_id_from_ctx(void *dr_ctx, uint32_t *port_val) +{ +#if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H) + uint32_t port; + + MLX5_ETH_FOREACH_DEV(port, NULL) { + struct mlx5_priv *priv; + priv = rte_eth_devices[port].data->dev_private; + + if (priv->dr_ctx == dr_ctx) { + *port_val = port; + return 0; + } + } +#else + RTE_SET_USED(dr_ctx); + RTE_SET_USED(port_val); +#endif + return -EINVAL; +} + void flow_hw_set_port_info(struct rte_eth_dev *dev); void flow_hw_clear_port_info(struct rte_eth_dev *dev); -- 2.39.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-03-25 11:28:37.506569905 +0000 +++ 0004-net-mlx5-hws-fix-port-ID-for-root-table.patch 2024-03-25 11:28:37.192388606 +0000 @@ -1 +1 @@ -From 572fe9ef2f461b7e7e195a3a4da5bf0c11f35949 Mon Sep 17 00:00:00 2001 +From e96de331da11975eec51055a6b991535c30bac2b Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 572fe9ef2f461b7e7e195a3a4da5bf0c11f35949 ] + @@ -13 +14,0 @@ -Cc: stable@dpdk.org @@ -25 +26 @@ -index 1c64abfa57..aeff300467 100644 +index 2e444c1179..c54bf88e78 100644 @@ -28 +29 @@ -@@ -1220,6 +1220,7 @@ static int mlx5dr_matcher_init_root(struct mlx5dr_matcher *matcher) +@@ -711,6 +711,7 @@ static int mlx5dr_matcher_init_root(struct mlx5dr_matcher *matcher) @@ -36 +37 @@ -@@ -1248,6 +1249,22 @@ static int mlx5dr_matcher_init_root(struct mlx5dr_matcher *matcher) +@@ -739,6 +740,22 @@ static int mlx5dr_matcher_init_root(struct mlx5dr_matcher *matcher) @@ -41 +42 @@ -+ item = matcher->mt[0].items; ++ item = matcher->mt[0]->items; @@ -60 +61 @@ -index 784f614d87..022263eb1d 100644 +index b27318e6d4..885a2bcefe 100644 @@ -63 +64 @@ -@@ -687,10 +687,28 @@ static int mlx5dr_rule_create_root(struct mlx5dr_rule *rule, +@@ -382,10 +382,28 @@ static int mlx5dr_rule_create_root(struct mlx5dr_rule *rule, @@ -93 +94 @@ -index 34b5e0f45b..0065727a67 100644 +index 9ce34ef556..4f3a216ed4 100644 @@ -96,2 +97,2 @@ -@@ -2001,6 +2001,28 @@ flow_hw_get_reg_id(struct rte_eth_dev *dev, - #endif +@@ -1594,6 +1594,28 @@ flow_hw_get_reg_id(enum rte_flow_item_type type, uint32_t id) + } @@ -122,3 +123,3 @@ - /** - * Get GENEVE TLV option FW information according type and class. - * + void flow_hw_set_port_info(struct rte_eth_dev *dev); + void flow_hw_clear_port_info(struct rte_eth_dev *dev); +