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 EF68C454E9 for ; Tue, 25 Jun 2024 02:03:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EA6F242709; Tue, 25 Jun 2024 02:03:10 +0200 (CEST) Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) by mails.dpdk.org (Postfix) with ESMTP id 284A7410DC for ; Tue, 25 Jun 2024 02:03:10 +0200 (CEST) Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-421d32fda86so54240365e9.0 for ; Mon, 24 Jun 2024 17:03:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719273790; x=1719878590; 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=a+suIBy1NQhTADQ620uUhciNajAdlEVyDT9xC3P6WHk=; b=PMlx/+cIthJg1nVoQiztf1ynwPGHNyTcTR5ZoKx8ZR4atd8rK6oaGHDaWFEq/47FuM R+wXI+o1wSoUMv+oiqxdPf0GVP5AMJEL+QQda/TLnhbEGsHZCOWZKHa8KmVoX/aj5ndP fDund2cW8RJ4aqV99ma/NKvjg5+j1uONodoQKXSZ6vY0L2gBQJkofAfkLuCWta/JcJ1w Jj7bE3f9Dtn4Jt38I2X8ABbnbGysjONN7cGN4rJDyVh39/tHdtzmUX77hCaP0Iyf3Vf1 77A2V5KLRBW0bFiWpQDvNQqSaPd/NXeY4pT6EBA1clX8fV/IFPA5THS1bGagAy4RUacw T7iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719273790; x=1719878590; 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=a+suIBy1NQhTADQ620uUhciNajAdlEVyDT9xC3P6WHk=; b=brcFFTKWcPS7h/fyXkhE/FgqruqhrowRunmHqRhRNpAtIv5xfeU8AgemmmF5aQFbjT tTHqRuXxA71+ePMffuV+dMbzgJXdZ/i/BZMI+Cll8TJ+97gwZZGASK2xKoa3MFIxLE+d soc+s8KyBPV7CQlmjTezM9UbCPktaJ+acqJMvnJXGlRZwCSyNTl+Cr/B+gjrl/smvNLE mESs9sfrjcAC9UjERQ9qqusCx7cEY1G4s/XWlCS5dB++Pec4hCWfrtI+g6l/4oIdPRL+ ZxD2GhRlsKw+qfxNNi1n2qDOg5Dy2Bw3mQCVklikkmAEOUZk1Txr15B1YKLY6ey6cYG+ g37Q== X-Forwarded-Encrypted: i=1; AJvYcCVjFDmIQWx5awX33bwcBJ2j4IQpSz2cf3PAg7KvlRAuMVnQL7xI/qRrh5hHfHWWkpWlwXNsIA9xG2LMNt8r4u4= X-Gm-Message-State: AOJu0Yx8YJgPraq0jiDXf+du1BdxT8KFQ/nNQuxWIYYEgnpvf8wFrwv4 xfqSNgy8p/l0GWCYPAJQbdzKzk9utfs/Q+VWYeqG0Pdx+kvbd3JiU4Fy6wGX X-Google-Smtp-Source: AGHT+IG2N/DL84GXF7UHNb1FCjEZ87tU547Q0CzangFFFj/PXsEhzaGvq27Bi6SaKpkBMf7/WcYEzA== X-Received: by 2002:a05:600c:470d:b0:424:784c:b134 with SMTP id 5b1f17b1804b1-4248cc17964mr52129685e9.6.1719273789701; Mon, 24 Jun 2024 17:03:09 -0700 (PDT) Received: from localhost ([137.220.120.171]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3663a8c7bdfsm11321597f8f.102.2024.06.24.17.03.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 17:03:09 -0700 (PDT) From: luca.boccassi@gmail.com To: Gregory Etelson Cc: Dariusz Sosnowski , dpdk stable Subject: patch 'net/mlx5: fix access to flow template operations' has been queued to stable release 22.11.6 Date: Tue, 25 Jun 2024 00:59:01 +0100 Message-Id: <20240624235907.885628-75-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240624235907.885628-1-luca.boccassi@gmail.com> References: <20240624235907.885628-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 06/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/739bd81a4664d03fc0357dab0de07e87d8896f4a Thanks. Luca Boccassi --- >From 739bd81a4664d03fc0357dab0de07e87d8896f4a Mon Sep 17 00:00:00 2001 From: Gregory Etelson Date: Sun, 2 Jun 2024 09:00:49 +0300 Subject: [PATCH] net/mlx5: fix access to flow template operations [ upstream commit acbb57b25d30147d1fd0edf1e8314a0a3d3c38c9 ] PMD activates HWS template API context during port configuration. There was no validation that the HWS context was activated before the PMD tried to process other template function calls. The patch adds HWS context validation. Fixes: b401400db24e ("net/mlx5: add port flow configuration") Signed-off-by: Gregory Etelson Acked-by: Dariusz Sosnowski --- drivers/net/mlx5/mlx5_flow_hw.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index c902b35f0b..45709c9fd2 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -56,6 +56,20 @@ #define MLX5_HW_VLAN_PUSH_VID_IDX 1 #define MLX5_HW_VLAN_PUSH_PCP_IDX 2 +static bool +mlx5_hw_ctx_validate(const struct rte_eth_dev *dev, struct rte_flow_error *error) +{ + const struct mlx5_priv *priv = dev->data->dev_private; + + if (!priv->dr_ctx) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, + "non-template flow engine was not configured"); + return false; + } + return true; +} + static int flow_hw_flush_all_ctrl_flows(struct rte_eth_dev *dev); static int flow_hw_translate_group(struct rte_eth_dev *dev, const struct mlx5_flow_template_table_cfg *cfg, @@ -3965,6 +3979,8 @@ mlx5_flow_hw_actions_validate(struct rte_eth_dev *dev, bool actions_end = false; int ret; + if (!mlx5_hw_ctx_validate(dev, error)) + return -rte_errno; /* FDB actions are only valid to proxy port. */ if (attr->transfer && (!priv->sh->config.dv_esw_en || !priv->master)) return rte_flow_error_set(error, EINVAL, @@ -4717,6 +4733,8 @@ flow_hw_pattern_validate(struct rte_eth_dev *dev, bool items_end = false; uint32_t tag_bitmap = 0; + if (!mlx5_hw_ctx_validate(dev, error)) + return -rte_errno; if (!attr->ingress && !attr->egress && !attr->transfer) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ATTR, NULL, "at least one of the direction attributes" @@ -7975,6 +7993,9 @@ flow_hw_action_handle_create(struct rte_eth_dev *dev, uint32_t queue, bool push = true; bool aso = false; + if (!mlx5_hw_ctx_validate(dev, error)) + return NULL; + if (attr) { MLX5_ASSERT(queue != MLX5_HW_INV_QUEUE); if (unlikely(!priv->hw_q[queue].job_idx)) { -- 2.39.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-06-25 00:22:17.404405798 +0100 +++ 0075-net-mlx5-fix-access-to-flow-template-operations.patch 2024-06-25 00:22:13.281187606 +0100 @@ -1 +1 @@ -From acbb57b25d30147d1fd0edf1e8314a0a3d3c38c9 Mon Sep 17 00:00:00 2001 +From 739bd81a4664d03fc0357dab0de07e87d8896f4a Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit acbb57b25d30147d1fd0edf1e8314a0a3d3c38c9 ] + @@ -14 +15,0 @@ -Cc: stable@dpdk.org @@ -19,2 +20,2 @@ - drivers/net/mlx5/mlx5_flow_hw.c | 22 ++++++++++++++++++++++ - 1 file changed, 22 insertions(+) + drivers/net/mlx5/mlx5_flow_hw.c | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) @@ -23 +24 @@ -index 53c6cc5961..e97afb0c86 100644 +index c902b35f0b..45709c9fd2 100644 @@ -26,3 +27,3 @@ -@@ -206,6 +206,20 @@ mlx5_destroy_multi_pattern_segment(struct mlx5_multi_pattern_segment *segment); - static __rte_always_inline enum mlx5_indirect_list_type - flow_hw_inlist_type_get(const struct rte_flow_action *actions); +@@ -56,6 +56,20 @@ + #define MLX5_HW_VLAN_PUSH_VID_IDX 1 + #define MLX5_HW_VLAN_PUSH_PCP_IDX 2 @@ -44,4 +45,5 @@ - static __rte_always_inline int - mlx5_multi_pattern_reformat_to_index(enum mlx5dr_action_type type) - { -@@ -6399,6 +6413,8 @@ mlx5_flow_hw_actions_validate(struct rte_eth_dev *dev, + static int flow_hw_flush_all_ctrl_flows(struct rte_eth_dev *dev); + static int flow_hw_translate_group(struct rte_eth_dev *dev, + const struct mlx5_flow_template_table_cfg *cfg, +@@ -3965,6 +3979,8 @@ mlx5_flow_hw_actions_validate(struct rte_eth_dev *dev, + bool actions_end = false; @@ -49 +50,0 @@ - const struct rte_flow_action_ipv6_ext_remove *remove_data; @@ -56 +57,2 @@ -@@ -7528,6 +7544,8 @@ flow_hw_pattern_validate(struct rte_eth_dev *dev, +@@ -4717,6 +4733,8 @@ flow_hw_pattern_validate(struct rte_eth_dev *dev, + bool items_end = false; @@ -58 +59,0 @@ - int ret; @@ -65 +66,2 @@ -@@ -11259,6 +11277,8 @@ flow_hw_action_handle_create(struct rte_eth_dev *dev, uint32_t queue, +@@ -7975,6 +7993,9 @@ flow_hw_action_handle_create(struct rte_eth_dev *dev, uint32_t queue, + bool push = true; @@ -67,10 +68,0 @@ - bool force_job = action->type == RTE_FLOW_ACTION_TYPE_METER_MARK; - -+ if (!mlx5_hw_ctx_validate(dev, error)) -+ return NULL; - if (attr || force_job) { - job = flow_hw_action_job_init(priv, queue, NULL, user_data, - NULL, MLX5_HW_Q_JOB_TYPE_CREATE, -@@ -12541,6 +12561,8 @@ flow_hw_async_action_list_handle_create(struct rte_eth_dev *dev, uint32_t queue, - } - }; @@ -80,3 +72,4 @@ - if (!actions) { - rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, - NULL, "No action list"); ++ + if (attr) { + MLX5_ASSERT(queue != MLX5_HW_INV_QUEUE); + if (unlikely(!priv->hw_q[queue].job_idx)) {