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 26E5043C60 for ; Thu, 7 Mar 2024 02:37:51 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1F3A542F49; Thu, 7 Mar 2024 02:37:51 +0100 (CET) Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by mails.dpdk.org (Postfix) with ESMTP id 318EF42F0D for ; Thu, 7 Mar 2024 02:37:50 +0100 (CET) Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-412ee78edbbso3574565e9.0 for ; Wed, 06 Mar 2024 17:37:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709775470; x=1710380270; 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=pwT973dOWuWEFjxZO478StTHLx0tIU+RfFbHN/HIEf8=; b=K9SMfjpyAamRsVf/3XWcRetqyfv91qU1erM4iCB9OMb8EgEHCYdo4c633VtiG1wGgT MeGbf37vU6NX/jsVmRHHkh0jGogrmQL6u7UchLglUVypd1+dZ2jSsxEYytMdwU5zG5LP AjIZJhuFVk8vvXijR3zjwWzTajMblncP8RgBtkBVYcQGAj7fbkVg8CFSyW/+7U0Lu+JT crWqYS9fiySZ6ebLrvMrRqKRKgVPrv9oj5YIZX6ehhXodxaPRcGNNDX/SR/z0fUCeD5w 4VEHDmJBeGUUsLhl/3cq3uFS9BOUAJgrR5JUU59LoEKSE3NKN+I3w3h7ypDA/mnGSHXb vPlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709775470; x=1710380270; 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=pwT973dOWuWEFjxZO478StTHLx0tIU+RfFbHN/HIEf8=; b=HNvGK8ELilXCSmBDavoDxTYWVCqb7znbUVUUmtmjwKMaYMyeJFC+rOaDJODposbjwS LVGwoduqKjdPdRUJ8LTaEAvXDZNUZek7ebtxKQYZe8BhPDyjxrdB+IjGJqw239q0dY1K K5OXPaXv/KNz/Op4pQz8NeQZ7+7XtrT7Hidc8MPJb40JVRQMMxdCblp/QQY9bhQSsVQ7 9dFVKrcjwvzNNs9pFUUomhg9JI89yJ4Q4kkcrSkyZAI7BFKfm7UZiDQJA/yTMHDvomij 8ksVaBahU114I9TpC+g3ZaxuM1VMvMDxJ/eHX1hiVgNO66hTMU2ohy44kFdKlP/Mkthz 0w5w== X-Forwarded-Encrypted: i=1; AJvYcCXKNmclMtwlYIabwdgiBUyAxK2t1JQr0/MgLQIqaZ9eUzAMPg9nlziJhHg3kAi2dLGPLrFDW1AtrcAme8KLjXU= X-Gm-Message-State: AOJu0YyzIoqnCb6v7p6KkV2QiZsMEXl5oiaeSMq6an87Y35zvW52mwa+ OrB9gFEBQ1mGGtuSdiFx9BoRQTChyOjETnMSEt6bQvOLCoH/Oza/AW0WdbN3Qv8= X-Google-Smtp-Source: AGHT+IFS7bRtc00ssBhKDmGaHKNpO7WL3KDfv0D6YESv1+pBlvXumNVRBq3zF99BnBqmxIR/Ju/PXg== X-Received: by 2002:a05:600c:4e0a:b0:412:f88c:b2ed with SMTP id b10-20020a05600c4e0a00b00412f88cb2edmr2044077wmq.4.1709775469803; Wed, 06 Mar 2024 17:37:49 -0800 (PST) Received: from localhost ([2a01:4b00:d036:ae00:7aef:1aaa:3dff:d546]) by smtp.gmail.com with ESMTPSA id c6-20020a05600c0a4600b00412f2136793sm870190wmq.44.2024.03.06.17.37.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 17:37:49 -0800 (PST) From: luca.boccassi@gmail.com To: Michael Baum Cc: Suanming Mou , dpdk stable Subject: patch 'net/mlx5: fix GENEVE option item translation' has been queued to stable release 22.11.5 Date: Thu, 7 Mar 2024 01:31:57 +0000 Message-Id: <20240307013159.1735343-100-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240307013159.1735343-1-luca.boccassi@gmail.com> References: <20240307013159.1735343-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/09/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/c7f17de89d48cd6effaefb2a2a512d6041e258bb Thanks. Luca Boccassi --- >From c7f17de89d48cd6effaefb2a2a512d6041e258bb Mon Sep 17 00:00:00 2001 From: Michael Baum Date: Thu, 25 Jan 2024 15:30:25 +0200 Subject: [PATCH] net/mlx5: fix GENEVE option item translation [ upstream commit efcf8a5e634e6b3ca45dfc842e0c3be64d8a44bf ] The "flow_dv_translate_item_geneve_opt()" function is called twice per flow rule, for either matcher focusing the mask or value focusing the spec. The spec is always provided and its field "option_len" indicates the data size for both spec and mask. For using it, function has another pointer "geneve_opt_vv" representing the spec regardless to focusing while the "geneve_opt_v" pointer represents the mask for matcher and spec for rule creation. The current implementation has 2 issues: 1. geneve_opt_v get the spec in rule creation as sane as geneve_opt_vv, but function use if-else which is bacicly has same value. 2. function uses "option_len" from "geneve_opt_v" instead of "geneve_opt_v" even when the focus is on mask, for HWS the mask value may be 0 even data is valid. This patch refactors the function implementation to avoid those issues. Fixes: cd4ab742064a ("net/mlx5: split flow item matcher and value translation") Signed-off-by: Michael Baum Acked-by: Suanming Mou --- drivers/net/mlx5/mlx5_flow_dv.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index ccb760cdf6..4ce6da50e8 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -9607,13 +9607,13 @@ flow_dv_translate_item_geneve_opt(struct rte_eth_dev *dev, void *key, { const struct rte_flow_item_geneve_opt *geneve_opt_m; const struct rte_flow_item_geneve_opt *geneve_opt_v; - const struct rte_flow_item_geneve_opt *geneve_opt_vv = item->spec; + const struct rte_flow_item_geneve_opt *orig_spec = item->spec; void *misc3_v = MLX5_ADDR_OF(fte_match_param, key, misc_parameters_3); rte_be32_t opt_data_key = 0, opt_data_mask = 0; - uint32_t *data; + size_t option_byte_len; int ret = 0; - if (MLX5_ITEM_VALID(item, key_type)) + if (MLX5_ITEM_VALID(item, key_type) || !orig_spec) return -1; MLX5_ITEM_UPDATE(item, key_type, geneve_opt_v, geneve_opt_m, &rte_flow_item_geneve_opt_mask); @@ -9626,21 +9626,15 @@ flow_dv_translate_item_geneve_opt(struct rte_eth_dev *dev, void *key, return ret; } } - /* Set the data. */ - if (key_type == MLX5_SET_MATCHER_SW_V) - data = geneve_opt_vv->data; - else - data = geneve_opt_v->data; - if (data) { - memcpy(&opt_data_key, data, - RTE_MIN((uint32_t)(geneve_opt_v->option_len * 4), - sizeof(opt_data_key))); - memcpy(&opt_data_mask, geneve_opt_m->data, - RTE_MIN((uint32_t)(geneve_opt_v->option_len * 4), - sizeof(opt_data_mask))); + /* Convert the option length from DW to bytes for using memcpy. */ + option_byte_len = RTE_MIN((size_t)(orig_spec->option_len * 4), + sizeof(rte_be32_t)); + if (geneve_opt_v->data) { + memcpy(&opt_data_key, geneve_opt_v->data, option_byte_len); + memcpy(&opt_data_mask, geneve_opt_m->data, option_byte_len); MLX5_SET(fte_match_set_misc3, misc3_v, - geneve_tlv_option_0_data, - rte_be_to_cpu_32(opt_data_key & opt_data_mask)); + geneve_tlv_option_0_data, + rte_be_to_cpu_32(opt_data_key & opt_data_mask)); } return ret; } -- 2.39.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-03-07 01:05:43.244107714 +0000 +++ 0100-net-mlx5-fix-GENEVE-option-item-translation.patch 2024-03-07 01:05:35.134947148 +0000 @@ -1 +1 @@ -From efcf8a5e634e6b3ca45dfc842e0c3be64d8a44bf Mon Sep 17 00:00:00 2001 +From c7f17de89d48cd6effaefb2a2a512d6041e258bb Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit efcf8a5e634e6b3ca45dfc842e0c3be64d8a44bf ] + @@ -25 +26,0 @@ -Cc: stable@dpdk.org @@ -34 +35 @@ -index 4f8062d0ab..afcec4a63d 100644 +index ccb760cdf6..4ce6da50e8 100644 @@ -37 +38 @@ -@@ -10103,13 +10103,13 @@ flow_dv_translate_item_geneve_opt(struct rte_eth_dev *dev, void *key, +@@ -9607,13 +9607,13 @@ flow_dv_translate_item_geneve_opt(struct rte_eth_dev *dev, void *key, @@ -54 +55 @@ -@@ -10122,21 +10122,15 @@ flow_dv_translate_item_geneve_opt(struct rte_eth_dev *dev, void *key, +@@ -9626,21 +9626,15 @@ flow_dv_translate_item_geneve_opt(struct rte_eth_dev *dev, void *key,