From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 165BFA055A for ; Thu, 27 Feb 2020 10:35:29 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0D90C1C01; Thu, 27 Feb 2020 10:35:29 +0100 (CET) Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) by dpdk.org (Postfix) with ESMTP id BF8CA1C01 for ; Thu, 27 Feb 2020 10:35:25 +0100 (CET) Received: by mail-wr1-f42.google.com with SMTP id j7so2360834wrp.13 for ; Thu, 27 Feb 2020 01:35:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vDA6B8sDddjqk76TYz2RLF7Yp1wLGXR0+78iXgdxKoc=; b=O9H7VS4JMiexq5mwpW3qcCYmMrBmMRAVD2VGC9inTEAiKWy9oqs4fGM//ieT1vvqhw 6JovS6FGuxUGwLsEHyyGtWRxQDsoUwYr98KByl7gJ2/nSF4gQzYZ4AeKl7uDy76ZzbM9 3SbaWSKut+nlNWejruTorwbl4nckOJzLbZ2F/S4kItSfZhGelkNbHI+It6wp7ljCtaQQ R49EJ277fchUfLW44Ux7W5SvD6hRlfkhUIet2Uw5xb1QDYlcmA7s5XJxRfHZyllkwOzw K360bkTQWzAqRnnrBYRft11PH2JuwUmmcdQiSX+4AKUDRloq6LxjQk6uh0HYgwlPuZQ9 w6xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vDA6B8sDddjqk76TYz2RLF7Yp1wLGXR0+78iXgdxKoc=; b=jWCLslaJmbccxwingBArCRYQg9w+dDX/aRapnVx2hJ/BXxvltkgspEabGh4u0R2Fm6 6rh5D+xNZK8kWJGwGNUh/PyqUWuN8jz4UgrjxEMmWhS7KPGJ/JPmt2WfisVj+W931nff EGr4r/uquo36XMCeHWzPh6ediZtwIGU/mO4KdYF7btzHkLlAhO38F1+i8bUJ0GLfdDB4 a36Sx/cU576bALIrBBIx0bRDhYfnmK/w/sHXq0a30ExOW1MLb6e53AEMkV7pqQ5KYacW JFFbfXjl9Y6gSvgW2/wM3tg/W/RVkHDyIfOYNLMmowMiSoPOmp9TVI2GcvMpj3WN/7/A nEqQ== X-Gm-Message-State: APjAAAXQ9w8NvcRKqQofEgirTtqQNZQt7O4y2Clg1kyJfnQHcAvIx0iK dIIFc5Lkx1Uk83K0UnxjWE4= X-Google-Smtp-Source: APXvYqy26jYC2oiDBM8PiRR603F546c2dUO9yzH+4rt8zWZQ7xEkVo54ax+qx9xPr+y8CxJdF76Hmg== X-Received: by 2002:adf:a505:: with SMTP id i5mr3536764wrb.33.1582796125478; Thu, 27 Feb 2020 01:35:25 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id p16sm6425840wrw.15.2020.02.27.01.35.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 01:35:24 -0800 (PST) From: luca.boccassi@gmail.com To: Suanming Mou Cc: Matan Azrad , dpdk stable Date: Thu, 27 Feb 2020 09:33:50 +0000 Message-Id: <20200227093402.17690-30-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200227093402.17690-1-luca.boccassi@gmail.com> References: <20200217174546.25334-54-luca.boccassi@gmail.com> <20200227093402.17690-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/mlx5: fix layer type in header modify action' has been queued to stable release 19.11.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 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 Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/29/20. 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. Thanks. Luca Boccassi --- >From 063e7d176d1b39241b780b33a79ce47515e3a730 Mon Sep 17 00:00:00 2001 From: Suanming Mou Date: Wed, 19 Feb 2020 16:26:20 +0200 Subject: [PATCH] net/mlx5: fix layer type in header modify action [ upstream commit 04233f36c712ea35fe0f1d02c5c6f323a28ec588 ] Currently, for header modify actions after tunnel decapsulation, the header modify actions will still select the old outermost layer type. It will cause header modify actions get the wrong layer type. Add the tunnel decap flag to indicate the layer type to get for header modify actions. Fixes: 4bb14c83df95 ("net/mlx5: support modify header using Direct Verbs") Signed-off-by: Suanming Mou Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow_dv.c | 68 +++++++++++++++++++++++++++------ 1 file changed, 57 insertions(+), 11 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 9a79e6e7a4..e06892b530 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -82,19 +82,55 @@ union flow_dv_attr { * Pointer to item specification. * @param[out] attr * Pointer to flow attributes structure. + * @param[in] tunnel_decap + * Whether action is after tunnel decapsulation. */ static void -flow_dv_attr_init(const struct rte_flow_item *item, union flow_dv_attr *attr) +flow_dv_attr_init(const struct rte_flow_item *item, union flow_dv_attr *attr, + bool tunnel_decap) { for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) { + uint8_t next_protocol = 0xff; + switch (item->type) { + case RTE_FLOW_ITEM_TYPE_GRE: + case RTE_FLOW_ITEM_TYPE_NVGRE: + case RTE_FLOW_ITEM_TYPE_VXLAN: + case RTE_FLOW_ITEM_TYPE_VXLAN_GPE: + case RTE_FLOW_ITEM_TYPE_GENEVE: + case RTE_FLOW_ITEM_TYPE_MPLS: + if (tunnel_decap) + attr->attr = 0; + break; case RTE_FLOW_ITEM_TYPE_IPV4: if (!attr->ipv6) attr->ipv4 = 1; + if (item->mask != NULL && + ((const struct rte_flow_item_ipv4 *) + item->mask)->hdr.next_proto_id) + next_protocol = + ((const struct rte_flow_item_ipv4 *) + (item->spec))->hdr.next_proto_id & + ((const struct rte_flow_item_ipv4 *) + (item->mask))->hdr.next_proto_id; + if ((next_protocol == IPPROTO_IPIP || + next_protocol == IPPROTO_IPV6) && tunnel_decap) + attr->attr = 0; break; case RTE_FLOW_ITEM_TYPE_IPV6: if (!attr->ipv4) attr->ipv6 = 1; + if (item->mask != NULL && + ((const struct rte_flow_item_ipv6 *) + item->mask)->hdr.proto) + next_protocol = + ((const struct rte_flow_item_ipv6 *) + (item->spec))->hdr.proto & + ((const struct rte_flow_item_ipv6 *) + (item->mask))->hdr.proto; + if ((next_protocol == IPPROTO_IPIP || + next_protocol == IPPROTO_IPV6) && tunnel_decap) + attr->attr = 0; break; case RTE_FLOW_ITEM_TYPE_UDP: if (!attr->tcp) @@ -599,6 +635,8 @@ flow_dv_convert_action_modify_vlan_vid * Pointer to rte_flow_item objects list. * @param[in] attr * Pointer to flow attributes structure. + * @param[in] tunnel_decap + * Whether action is after tunnel decapsulation. * @param[out] error * Pointer to the error structure. * @@ -610,7 +648,7 @@ flow_dv_convert_action_modify_tp (struct mlx5_flow_dv_modify_hdr_resource *resource, const struct rte_flow_action *action, const struct rte_flow_item *items, - union flow_dv_attr *attr, + union flow_dv_attr *attr, bool tunnel_decap, struct rte_flow_error *error) { const struct rte_flow_action_set_tp *conf = @@ -623,7 +661,7 @@ flow_dv_convert_action_modify_tp struct field_modify_info *field; if (!attr->valid) - flow_dv_attr_init(items, attr); + flow_dv_attr_init(items, attr, tunnel_decap); if (attr->udp) { memset(&udp, 0, sizeof(udp)); memset(&udp_mask, 0, sizeof(udp_mask)); @@ -673,6 +711,8 @@ flow_dv_convert_action_modify_tp * Pointer to rte_flow_item objects list. * @param[in] attr * Pointer to flow attributes structure. + * @param[in] tunnel_decap + * Whether action is after tunnel decapsulation. * @param[out] error * Pointer to the error structure. * @@ -684,7 +724,7 @@ flow_dv_convert_action_modify_ttl (struct mlx5_flow_dv_modify_hdr_resource *resource, const struct rte_flow_action *action, const struct rte_flow_item *items, - union flow_dv_attr *attr, + union flow_dv_attr *attr, bool tunnel_decap, struct rte_flow_error *error) { const struct rte_flow_action_set_ttl *conf = @@ -697,7 +737,7 @@ flow_dv_convert_action_modify_ttl struct field_modify_info *field; if (!attr->valid) - flow_dv_attr_init(items, attr); + flow_dv_attr_init(items, attr, tunnel_decap); if (attr->ipv4) { memset(&ipv4, 0, sizeof(ipv4)); memset(&ipv4_mask, 0, sizeof(ipv4_mask)); @@ -733,6 +773,8 @@ flow_dv_convert_action_modify_ttl * Pointer to rte_flow_item objects list. * @param[in] attr * Pointer to flow attributes structure. + * @param[in] tunnel_decap + * Whether action is after tunnel decapsulation. * @param[out] error * Pointer to the error structure. * @@ -743,7 +785,7 @@ static int flow_dv_convert_action_modify_dec_ttl (struct mlx5_flow_dv_modify_hdr_resource *resource, const struct rte_flow_item *items, - union flow_dv_attr *attr, + union flow_dv_attr *attr, bool tunnel_decap, struct rte_flow_error *error) { struct rte_flow_item item; @@ -754,7 +796,7 @@ flow_dv_convert_action_modify_dec_ttl struct field_modify_info *field; if (!attr->valid) - flow_dv_attr_init(items, attr); + flow_dv_attr_init(items, attr, tunnel_decap); if (attr->ipv4) { memset(&ipv4, 0, sizeof(ipv4)); memset(&ipv4_mask, 0, sizeof(ipv4_mask)); @@ -7130,7 +7172,8 @@ cnt_err: case RTE_FLOW_ACTION_TYPE_SET_TP_DST: if (flow_dv_convert_action_modify_tp (mhdr_res, actions, items, - &flow_attr, error)) + &flow_attr, !!(action_flags & + MLX5_FLOW_ACTION_DECAP), error)) return -rte_errno; action_flags |= actions->type == RTE_FLOW_ACTION_TYPE_SET_TP_SRC ? @@ -7139,14 +7182,17 @@ cnt_err: break; case RTE_FLOW_ACTION_TYPE_DEC_TTL: if (flow_dv_convert_action_modify_dec_ttl - (mhdr_res, items, &flow_attr, error)) + (mhdr_res, items, &flow_attr, + !!(action_flags & + MLX5_FLOW_ACTION_DECAP), error)) return -rte_errno; action_flags |= MLX5_FLOW_ACTION_DEC_TTL; break; case RTE_FLOW_ACTION_TYPE_SET_TTL: if (flow_dv_convert_action_modify_ttl - (mhdr_res, actions, items, - &flow_attr, error)) + (mhdr_res, actions, items, &flow_attr, + !!(action_flags & + MLX5_FLOW_ACTION_DECAP), error)) return -rte_errno; action_flags |= MLX5_FLOW_ACTION_SET_TTL; break; -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-02-27 09:31:56.800429736 +0000 +++ 0030-net-mlx5-fix-layer-type-in-header-modify-action.patch 2020-02-27 09:31:55.795946313 +0000 @@ -1,8 +1,10 @@ -From 04233f36c712ea35fe0f1d02c5c6f323a28ec588 Mon Sep 17 00:00:00 2001 +From 063e7d176d1b39241b780b33a79ce47515e3a730 Mon Sep 17 00:00:00 2001 From: Suanming Mou Date: Wed, 19 Feb 2020 16:26:20 +0200 Subject: [PATCH] net/mlx5: fix layer type in header modify action +[ upstream commit 04233f36c712ea35fe0f1d02c5c6f323a28ec588 ] + Currently, for header modify actions after tunnel decapsulation, the header modify actions will still select the old outermost layer type. It will cause header modify actions get the wrong layer type. @@ -11,7 +13,6 @@ modify actions. Fixes: 4bb14c83df95 ("net/mlx5: support modify header using Direct Verbs") -Cc: stable@dpdk.org Signed-off-by: Suanming Mou Acked-by: Matan Azrad @@ -20,10 +21,10 @@ 1 file changed, 57 insertions(+), 11 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c -index caa0ff8bad..b6e50b14e1 100644 +index 9a79e6e7a4..e06892b530 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c -@@ -85,19 +85,55 @@ union flow_dv_attr { +@@ -82,19 +82,55 @@ union flow_dv_attr { * Pointer to item specification. * @param[out] attr * Pointer to flow attributes structure. @@ -80,7 +81,7 @@ break; case RTE_FLOW_ITEM_TYPE_UDP: if (!attr->tcp) -@@ -604,6 +640,8 @@ flow_dv_convert_action_modify_vlan_vid +@@ -599,6 +635,8 @@ flow_dv_convert_action_modify_vlan_vid * Pointer to rte_flow_item objects list. * @param[in] attr * Pointer to flow attributes structure. @@ -89,7 +90,7 @@ * @param[out] error * Pointer to the error structure. * -@@ -615,7 +653,7 @@ flow_dv_convert_action_modify_tp +@@ -610,7 +648,7 @@ flow_dv_convert_action_modify_tp (struct mlx5_flow_dv_modify_hdr_resource *resource, const struct rte_flow_action *action, const struct rte_flow_item *items, @@ -98,7 +99,7 @@ struct rte_flow_error *error) { const struct rte_flow_action_set_tp *conf = -@@ -628,7 +666,7 @@ flow_dv_convert_action_modify_tp +@@ -623,7 +661,7 @@ flow_dv_convert_action_modify_tp struct field_modify_info *field; if (!attr->valid) @@ -107,7 +108,7 @@ if (attr->udp) { memset(&udp, 0, sizeof(udp)); memset(&udp_mask, 0, sizeof(udp_mask)); -@@ -678,6 +716,8 @@ flow_dv_convert_action_modify_tp +@@ -673,6 +711,8 @@ flow_dv_convert_action_modify_tp * Pointer to rte_flow_item objects list. * @param[in] attr * Pointer to flow attributes structure. @@ -116,7 +117,7 @@ * @param[out] error * Pointer to the error structure. * -@@ -689,7 +729,7 @@ flow_dv_convert_action_modify_ttl +@@ -684,7 +724,7 @@ flow_dv_convert_action_modify_ttl (struct mlx5_flow_dv_modify_hdr_resource *resource, const struct rte_flow_action *action, const struct rte_flow_item *items, @@ -125,7 +126,7 @@ struct rte_flow_error *error) { const struct rte_flow_action_set_ttl *conf = -@@ -702,7 +742,7 @@ flow_dv_convert_action_modify_ttl +@@ -697,7 +737,7 @@ flow_dv_convert_action_modify_ttl struct field_modify_info *field; if (!attr->valid) @@ -134,7 +135,7 @@ if (attr->ipv4) { memset(&ipv4, 0, sizeof(ipv4)); memset(&ipv4_mask, 0, sizeof(ipv4_mask)); -@@ -738,6 +778,8 @@ flow_dv_convert_action_modify_ttl +@@ -733,6 +773,8 @@ flow_dv_convert_action_modify_ttl * Pointer to rte_flow_item objects list. * @param[in] attr * Pointer to flow attributes structure. @@ -143,7 +144,7 @@ * @param[out] error * Pointer to the error structure. * -@@ -748,7 +790,7 @@ static int +@@ -743,7 +785,7 @@ static int flow_dv_convert_action_modify_dec_ttl (struct mlx5_flow_dv_modify_hdr_resource *resource, const struct rte_flow_item *items, @@ -152,7 +153,7 @@ struct rte_flow_error *error) { struct rte_flow_item item; -@@ -759,7 +801,7 @@ flow_dv_convert_action_modify_dec_ttl +@@ -754,7 +796,7 @@ flow_dv_convert_action_modify_dec_ttl struct field_modify_info *field; if (!attr->valid) @@ -161,7 +162,7 @@ if (attr->ipv4) { memset(&ipv4, 0, sizeof(ipv4)); memset(&ipv4_mask, 0, sizeof(ipv4_mask)); -@@ -7463,7 +7505,8 @@ cnt_err: +@@ -7130,7 +7172,8 @@ cnt_err: case RTE_FLOW_ACTION_TYPE_SET_TP_DST: if (flow_dv_convert_action_modify_tp (mhdr_res, actions, items, @@ -171,7 +172,7 @@ return -rte_errno; action_flags |= actions->type == RTE_FLOW_ACTION_TYPE_SET_TP_SRC ? -@@ -7472,14 +7515,17 @@ cnt_err: +@@ -7139,14 +7182,17 @@ cnt_err: break; case RTE_FLOW_ACTION_TYPE_DEC_TTL: if (flow_dv_convert_action_modify_dec_ttl