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 ED4EAA0093 for ; Wed, 9 Mar 2022 17:32:44 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E5A28410E8; Wed, 9 Mar 2022 17:32:44 +0100 (CET) Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by mails.dpdk.org (Postfix) with ESMTP id 01FE3410EF for ; Wed, 9 Mar 2022 17:32:44 +0100 (CET) Received: by mail-wr1-f54.google.com with SMTP id i8so3916045wrr.8 for ; Wed, 09 Mar 2022 08:32:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gozM5e+r24MXnKz5IKeh+1jGRg8+mYiA5wfeYsfQUoY=; b=T25zFuXncQugzb/Hp1nzcmC5poTcKXVIRKoR6nPFQh1O66Uo536krWSOHGatYtT5/7 wMQRjb/RSgbwNq00OmwqtR4rvcxAMyiKx/wT+hAnJaxMaYOX/k8RRdCRQ9o+999PL9KK mUnnnYP3XjV/vzduT+UDb8cSFN3mgHWEszV13QZEOkHnwYK+lttgcUx2gFRqiRyy9/cx VvuB4OPS6BtTzpf78KZoOPoK4rK4Sg0I3HI/Ur5FVwgmS9AtdhfFBdlZD17EbN8wFsee zOh8IcvE8S8dch3wUswlMxEHrLFh0ecGx9BVgCHeK2HCFfgAqLcFdESd8ZKMwysJYO15 e+oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gozM5e+r24MXnKz5IKeh+1jGRg8+mYiA5wfeYsfQUoY=; b=VgKqFO9Ji9Hblk168C/rP2ps/JRDPBeAYdHg52jtDEoWyb56My763znS1Yno4xSNbg GclolmIlwSkf5C9pfkXPhr1bbG20zU7BDlbyVmME/bvYHHBPyY6YFcb0O+Sq1lAz7io1 O2jKCvYeVe7WTa10ZSUbJe8H9JYIo8GSY/Vna1ji924V/G1mGl8Tzz8ezbi/Eqk9O2az XrIlUgM+RLKvfwYCicfCuZeRHxNKbuIh7PdfX/LTWvXTXrWH/Tyrcl8Xitp9+gP//mkH 0oFnb4WI10S7jQE165bNzRKEVElh0P8VCJsrSq3KACW4TovKFXRZddvsD5B3F7184dbh p0pQ== X-Gm-Message-State: AOAM533fFtDJfxUijk4OrS5fO23jQbDTbbu8mPSQTUgLDCiVdaHpHlvM qvBEnoGeccrKxnML+th8581PvyOlOsk= X-Google-Smtp-Source: ABdhPJwUVh9+KQeXglfKA+5qR5v0BrRpoHMWf/E8DvF29FY1939qGgjfXA75N048sYEwJK7AgaiM+A== X-Received: by 2002:adf:f28c:0:b0:1f1:e5e5:28c0 with SMTP id k12-20020adff28c000000b001f1e5e528c0mr330938wro.417.1646843563683; Wed, 09 Mar 2022 08:32:43 -0800 (PST) Received: from localhost ([137.220.125.106]) by smtp.gmail.com with ESMTPSA id z5-20020a05600c0a0500b0037bb8df81a2sm6722835wmp.13.2022.03.09.08.32.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Mar 2022 08:32:43 -0800 (PST) From: luca.boccassi@gmail.com To: Dariusz Sosnowski Cc: Viacheslav Ovsiienko , dpdk stable Subject: patch 'net/mlx5: fix MPLS/GRE Verbs spec ordering' has been queued to stable release 20.11.5 Date: Wed, 9 Mar 2022 16:30:51 +0000 Message-Id: <20220309163053.245754-35-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220309163053.245754-1-luca.boccassi@gmail.com> References: <20220218123931.1749595-1-luca.boccassi@gmail.com> <20220309163053.245754-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 20.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/11/22. 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/6b746a423fe910bb6cf0846c86f47674b735dbbf Thanks. Luca Boccassi --- >From 6b746a423fe910bb6cf0846c86f47674b735dbbf Mon Sep 17 00:00:00 2001 From: Dariusz Sosnowski Date: Wed, 2 Mar 2022 17:06:59 +0000 Subject: [PATCH] net/mlx5: fix MPLS/GRE Verbs spec ordering [ upstream commit 98008ce6ec2f31c2e94c0eb39740c8178aeb8392 ] When using Verbs flow engine to create flows, GRE Verbs spec was put at the end of specs list. This created problems for flows matching MPLSoGRE packets. In generated specs list MPLS spec was put before GRE spec, but Verbs API requires that MPLS spec must be put in its exact location in protocol stack. This patch fixes this behavior. Space for GRE Verbs spec is reserved at its exact location. MPLS Verbs is inserted at its exact location as well. GRE spec is filled after all flow items are parsed. Fixes: 985b479267aa ("net/mlx5: fix GRE protocol type translation for Verbs") Signed-off-by: Dariusz Sosnowski Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow_verbs.c | 49 +++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c index a0c6d23c6a..6a755e7c36 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -935,13 +935,48 @@ flow_verbs_item_gre_ip_protocol_update(struct ibv_flow_attr *attr, } } +/** + * Reserve space for GRE spec in spec buffer. + * + * @param[in,out] dev_flow + * Pointer to dev_flow structure. + * + * @return + * Pointer to reserved space in spec buffer. + */ +static uint8_t * +flow_verbs_reserve_gre(struct mlx5_flow *dev_flow) +{ + uint8_t *buffer; + struct mlx5_flow_verbs_workspace *verbs = &dev_flow->verbs; +#ifndef HAVE_IBV_DEVICE_MPLS_SUPPORT + unsigned int size = sizeof(struct ibv_flow_spec_tunnel); + struct ibv_flow_spec_tunnel tunnel = { + .type = IBV_FLOW_SPEC_VXLAN_TUNNEL, + .size = size, + }; +#else + unsigned int size = sizeof(struct ibv_flow_spec_gre); + struct ibv_flow_spec_gre tunnel = { + .type = IBV_FLOW_SPEC_GRE, + .size = size, + }; +#endif + + buffer = verbs->specs + verbs->size; + flow_verbs_spec_add(verbs, &tunnel, size); + return buffer; +} + /** * Convert the @p item into a Verbs specification. This function assumes that - * the input is valid and that there is space to insert the requested item - * into the flow. + * the input is valid and that Verbs specification will be placed in + * the pre-reserved space. * * @param[in, out] dev_flow * Pointer to dev_flow structure. + * @param[in, out] gre_spec + * Pointer to space reserved for GRE spec. * @param[in] item * Item specification. * @param[in] item_flags @@ -949,6 +984,7 @@ flow_verbs_item_gre_ip_protocol_update(struct ibv_flow_attr *attr, */ static void flow_verbs_translate_item_gre(struct mlx5_flow *dev_flow, + uint8_t *gre_spec, const struct rte_flow_item *item __rte_unused, uint64_t item_flags) { @@ -1002,7 +1038,8 @@ flow_verbs_translate_item_gre(struct mlx5_flow *dev_flow, flow_verbs_item_gre_ip_protocol_update(&verbs->attr, IBV_FLOW_SPEC_IPV6, IPPROTO_GRE); - flow_verbs_spec_add(verbs, &tunnel, size); + MLX5_ASSERT(gre_spec); + memcpy(gre_spec, &tunnel, size); } /** @@ -1723,6 +1760,7 @@ flow_verbs_translate(struct rte_eth_dev *dev, struct mlx5_flow_workspace *wks = mlx5_flow_get_thread_workspace(); struct mlx5_flow_rss_desc *rss_desc; const struct rte_flow_item *tunnel_item = NULL; + uint8_t *gre_spec = NULL; MLX5_ASSERT(wks); rss_desc = &wks->rss_desc; @@ -1860,6 +1898,7 @@ flow_verbs_translate(struct rte_eth_dev *dev, item_flags |= MLX5_FLOW_LAYER_VXLAN_GPE; break; case RTE_FLOW_ITEM_TYPE_GRE: + gre_spec = flow_verbs_reserve_gre(dev_flow); subpriority = MLX5_TUNNEL_PRIO_GET(rss_desc); item_flags |= MLX5_FLOW_LAYER_GRE; tunnel_item = items; @@ -1877,8 +1916,8 @@ flow_verbs_translate(struct rte_eth_dev *dev, } } if (item_flags & MLX5_FLOW_LAYER_GRE) - flow_verbs_translate_item_gre(dev_flow, tunnel_item, - item_flags); + flow_verbs_translate_item_gre(dev_flow, gre_spec, + tunnel_item, item_flags); dev_flow->handle->layers = item_flags; /* Other members of attr will be ignored. */ dev_flow->verbs.attr.priority = -- 2.30.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-03-09 16:30:09.831062928 +0000 +++ 0035-net-mlx5-fix-MPLS-GRE-Verbs-spec-ordering.patch 2022-03-09 16:30:08.603026407 +0000 @@ -1 +1 @@ -From 98008ce6ec2f31c2e94c0eb39740c8178aeb8392 Mon Sep 17 00:00:00 2001 +From 6b746a423fe910bb6cf0846c86f47674b735dbbf Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 98008ce6ec2f31c2e94c0eb39740c8178aeb8392 ] + @@ -17 +18,0 @@ -Cc: stable@dpdk.org @@ -26 +27 @@ -index 85f0788222..fd902078f8 100644 +index a0c6d23c6a..6a755e7c36 100644 @@ -29 +30 @@ -@@ -882,13 +882,48 @@ flow_verbs_item_gre_ip_protocol_update(struct ibv_flow_attr *attr, +@@ -935,13 +935,48 @@ flow_verbs_item_gre_ip_protocol_update(struct ibv_flow_attr *attr, @@ -80 +81 @@ -@@ -896,6 +931,7 @@ flow_verbs_item_gre_ip_protocol_update(struct ibv_flow_attr *attr, +@@ -949,6 +984,7 @@ flow_verbs_item_gre_ip_protocol_update(struct ibv_flow_attr *attr, @@ -88 +89 @@ -@@ -949,7 +985,8 @@ flow_verbs_translate_item_gre(struct mlx5_flow *dev_flow, +@@ -1002,7 +1038,8 @@ flow_verbs_translate_item_gre(struct mlx5_flow *dev_flow, @@ -98 +99 @@ -@@ -1680,6 +1717,7 @@ flow_verbs_translate(struct rte_eth_dev *dev, +@@ -1723,6 +1760,7 @@ flow_verbs_translate(struct rte_eth_dev *dev, @@ -106 +107 @@ -@@ -1817,6 +1855,7 @@ flow_verbs_translate(struct rte_eth_dev *dev, +@@ -1860,6 +1898,7 @@ flow_verbs_translate(struct rte_eth_dev *dev, @@ -114 +115 @@ -@@ -1834,8 +1873,8 @@ flow_verbs_translate(struct rte_eth_dev *dev, +@@ -1877,8 +1916,8 @@ flow_verbs_translate(struct rte_eth_dev *dev,