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 D996543CE7 for ; Mon, 18 Mar 2024 16:40:26 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D55FA406B8; Mon, 18 Mar 2024 16:40:26 +0100 (CET) Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by mails.dpdk.org (Postfix) with ESMTP id 87CE740289 for ; Mon, 18 Mar 2024 16:40:25 +0100 (CET) Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-33ec7e38b84so2693642f8f.1 for ; Mon, 18 Mar 2024 08:40:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710776425; x=1711381225; 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=gAZ4+pFTFuF2i4wzkqOEZMWpUk/iP/5UDzX1CR++t3o=; b=HKPghhnzavAz0dLhYepG4iI7wanEG6Ha9hb7hKQNw9cBgN0MeJDvaWZq4qkFhuNvTU zH9ebUWrtd28pDkwFm5KqdDUslI+eqGIyvvHTq1xCuhwBJAsf7cG1EvR5qm7N+eTic2W CHlwJ99E0+OvRYSWgQ6S0OFTH0e/fB7QkZdmSK2PqPemDG7sFJwodODRtjopAXsxWfje IbZEOQfy/hQwTWVycLhs9cyVkkvFA1zw5Abubnl0SXsu79oYXzk64aJ4M/vIBaGYB6yX Uq+UqHYIkFP2Prt9Ii1hKdCB+K4gkRK7SmReFgGmTCu3QZ1JdD2KBtgTmnlQIT8AkR7J +MiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710776425; x=1711381225; 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=gAZ4+pFTFuF2i4wzkqOEZMWpUk/iP/5UDzX1CR++t3o=; b=aqLRUfth8QkFwybIie1kgkRDF8VXo9k+ikub4ZUtUpQKnpPplcAXG/VG/AeYJOGQ0X Pp5LnEAF+dJtUk0xQcQ9fOhdsdvnsTQg5nke/k5CwD60zWkM6MJtSwVw0mqY50fjDvpR D5qgYnp7dPDd7nYX8Is+ueLvPtI5Ssez7FFVdQUK3xtr2d6XVwdulpvwctwkOXTaZeXV TpsIyTuUWc9cTodWx+lWoWk3ucxjB2tt282c1B8xoMiw1smh20nEPAC0TGYRGMoBjDpx hDEKolimDNnEZlfIXv6SzhwHMuIZ34Ma9gam97PZyp7f/qZnjMf6FID2AMlBz4au0Sio 7poA== X-Forwarded-Encrypted: i=1; AJvYcCVJywIJ4+Gb3RX+0rkSFvuUXFq4WFyrJ2tbKExrcHPDCFc65CnIlmFoABTyYXKIGTDIQQoPsrKvrTS3Yv9IRKM= X-Gm-Message-State: AOJu0YwG0Ivp44hW5MrpLmYBhpQStdJlmf2gLPXaHI/pY95Nu4kkkFWn rSuLu5Hucx6pPZWVvpHXgJMj/rU1gqfV5TQBiA73gerMpA0opD0T X-Google-Smtp-Source: AGHT+IHJijpbugXxM3/n2W4Ml9weNJNyyuv8b8FMo1fKJbtaMHzhYSAhz34zROJapVLJdfDwTweCtw== X-Received: by 2002:adf:fc0b:0:b0:33e:6ce2:88ab with SMTP id i11-20020adffc0b000000b0033e6ce288abmr8908808wrr.46.1710776425095; Mon, 18 Mar 2024 08:40:25 -0700 (PDT) Received: from localhost ([137.220.120.171]) by smtp.gmail.com with ESMTPSA id d4-20020a05600c3ac400b004145e92bf60sm1076779wms.11.2024.03.18.08.40.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 08:40:24 -0700 (PDT) From: luca.boccassi@gmail.com To: Gregory Etelson Cc: Ori Kam , dpdk stable Subject: patch 'net/mlx5: fix IP-in-IP tunnels recognition' has been queued to stable release 22.11.5 Date: Mon, 18 Mar 2024 15:39:10 +0000 Message-Id: <20240318153919.3407921-20-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240318153919.3407921-1-luca.boccassi@gmail.com> References: <20240314000957.2810803-61-luca.boccassi@gmail.com> <20240318153919.3407921-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/20/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/fd3721be47bb39a9b67467e97a848d4b493bd1bd Thanks. Luca Boccassi --- >From fd3721be47bb39a9b67467e97a848d4b493bd1bd Mon Sep 17 00:00:00 2001 From: Gregory Etelson Date: Thu, 29 Feb 2024 18:05:04 +0200 Subject: [PATCH] net/mlx5: fix IP-in-IP tunnels recognition [ upstream commit 2db234e769e121446b7b6d8e97e00212bebf7a3c ] The patch fixes IP-in-IP tunnel recognition for the following patterns / [ipv4|ipv6] proto is [ipv4|ipv6] / end / [ipv4|ipv6] / [ipv4|ipv6] / Fixes: 3d69434113d1 ("net/mlx5: add Direct Verbs validation function") Signed-off-by: Gregory Etelson Acked-by: Ori Kam --- drivers/net/mlx5/mlx5_flow_dv.c | 104 ++++++++++++++++++++++++-------- 1 file changed, 80 insertions(+), 24 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index a4fca70b07..68d3ee0c36 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -267,21 +267,41 @@ struct field_modify_info modify_tcp[] = { {0, 0, 0}, }; -static void +enum mlx5_l3_tunnel_detection { + l3_tunnel_none, + l3_tunnel_outer, + l3_tunnel_inner +}; + +static enum mlx5_l3_tunnel_detection mlx5_flow_tunnel_ip_check(const struct rte_flow_item *item __rte_unused, - uint8_t next_protocol, uint64_t *item_flags, - int *tunnel) + uint8_t next_protocol, uint64_t item_flags, + uint64_t *l3_tunnel_flag) { + enum mlx5_l3_tunnel_detection td = l3_tunnel_none; + MLX5_ASSERT(item->type == RTE_FLOW_ITEM_TYPE_IPV4 || item->type == RTE_FLOW_ITEM_TYPE_IPV6); - if (next_protocol == IPPROTO_IPIP) { - *item_flags |= MLX5_FLOW_LAYER_IPIP; - *tunnel = 1; - } - if (next_protocol == IPPROTO_IPV6) { - *item_flags |= MLX5_FLOW_LAYER_IPV6_ENCAP; - *tunnel = 1; + if ((item_flags & MLX5_FLOW_LAYER_OUTER_L3) == 0) { + switch (next_protocol) { + case IPPROTO_IPIP: + td = l3_tunnel_outer; + *l3_tunnel_flag = MLX5_FLOW_LAYER_IPIP; + break; + case IPPROTO_IPV6: + td = l3_tunnel_outer; + *l3_tunnel_flag = MLX5_FLOW_LAYER_IPV6_ENCAP; + break; + default: + break; + } + } else { + td = l3_tunnel_inner; + *l3_tunnel_flag = item->type == RTE_FLOW_ITEM_TYPE_IPV4 ? + MLX5_FLOW_LAYER_IPIP : + MLX5_FLOW_LAYER_IPV6_ENCAP; } + return td; } static inline struct mlx5_hlist * @@ -7142,6 +7162,8 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, return ret; is_root = (uint64_t)ret; for (; items->type != RTE_FLOW_ITEM_TYPE_END; items++) { + enum mlx5_l3_tunnel_detection l3_tunnel_detection; + uint64_t l3_tunnel_flag; int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL); int type = items->type; @@ -7219,8 +7241,16 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, vlan_m = items->mask; break; case RTE_FLOW_ITEM_TYPE_IPV4: - mlx5_flow_tunnel_ip_check(items, next_protocol, - &item_flags, &tunnel); + next_protocol = mlx5_flow_l3_next_protocol + (items, (enum MLX5_SET_MATCHER)-1); + l3_tunnel_detection = + mlx5_flow_tunnel_ip_check(items, next_protocol, + item_flags, + &l3_tunnel_flag); + if (l3_tunnel_detection == l3_tunnel_inner) { + item_flags |= l3_tunnel_flag; + tunnel = 1; + } ret = flow_dv_validate_item_ipv4(dev, items, item_flags, last_item, ether_type, error); @@ -7228,12 +7258,20 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, return ret; last_item = tunnel ? MLX5_FLOW_LAYER_INNER_L3_IPV4 : MLX5_FLOW_LAYER_OUTER_L3_IPV4; - next_protocol = mlx5_flow_l3_next_protocol - (items, (enum MLX5_SET_MATCHER)-1); + if (l3_tunnel_detection == l3_tunnel_outer) + item_flags |= l3_tunnel_flag; break; case RTE_FLOW_ITEM_TYPE_IPV6: - mlx5_flow_tunnel_ip_check(items, next_protocol, - &item_flags, &tunnel); + next_protocol = mlx5_flow_l3_next_protocol + (items, (enum MLX5_SET_MATCHER)-1); + l3_tunnel_detection = + mlx5_flow_tunnel_ip_check(items, next_protocol, + item_flags, + &l3_tunnel_flag); + if (l3_tunnel_detection == l3_tunnel_inner) { + item_flags |= l3_tunnel_flag; + tunnel = 1; + } ret = mlx5_flow_validate_item_ipv6(items, item_flags, last_item, ether_type, @@ -7243,8 +7281,8 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, return ret; last_item = tunnel ? MLX5_FLOW_LAYER_INNER_L3_IPV6 : MLX5_FLOW_LAYER_OUTER_L3_IPV6; - next_protocol = mlx5_flow_l3_next_protocol - (items, (enum MLX5_SET_MATCHER)-1); + if (l3_tunnel_detection == l3_tunnel_outer) + item_flags |= l3_tunnel_flag; break; case RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT: ret = flow_dv_validate_item_ipv6_frag_ext(items, @@ -13197,6 +13235,8 @@ flow_dv_translate_items(struct rte_eth_dev *dev, int tunnel = !!(wks->item_flags & MLX5_FLOW_LAYER_TUNNEL); int item_type = items->type; uint64_t last_item = wks->last_item; + enum mlx5_l3_tunnel_detection l3_tunnel_detection; + uint64_t l3_tunnel_flag; int ret; switch (item_type) { @@ -13240,24 +13280,40 @@ flow_dv_translate_items(struct rte_eth_dev *dev, MLX5_FLOW_LAYER_OUTER_VLAN); break; case RTE_FLOW_ITEM_TYPE_IPV4: - mlx5_flow_tunnel_ip_check(items, next_protocol, - &wks->item_flags, &tunnel); + next_protocol = mlx5_flow_l3_next_protocol(items, key_type); + l3_tunnel_detection = + mlx5_flow_tunnel_ip_check(items, next_protocol, + wks->item_flags, + &l3_tunnel_flag); + if (l3_tunnel_detection == l3_tunnel_inner) { + wks->item_flags |= l3_tunnel_flag; + tunnel = 1; + } flow_dv_translate_item_ipv4(key, items, tunnel, wks->group, key_type); wks->priority = MLX5_PRIORITY_MAP_L3; last_item = tunnel ? MLX5_FLOW_LAYER_INNER_L3_IPV4 : MLX5_FLOW_LAYER_OUTER_L3_IPV4; - next_protocol = mlx5_flow_l3_next_protocol(items, key_type); + if (l3_tunnel_detection == l3_tunnel_outer) + wks->item_flags |= l3_tunnel_flag; break; case RTE_FLOW_ITEM_TYPE_IPV6: - mlx5_flow_tunnel_ip_check(items, next_protocol, - &wks->item_flags, &tunnel); + next_protocol = mlx5_flow_l3_next_protocol(items, key_type); + l3_tunnel_detection = + mlx5_flow_tunnel_ip_check(items, next_protocol, + wks->item_flags, + &l3_tunnel_flag); + if (l3_tunnel_detection == l3_tunnel_inner) { + wks->item_flags |= l3_tunnel_flag; + tunnel = 1; + } flow_dv_translate_item_ipv6(key, items, tunnel, wks->group, key_type); wks->priority = MLX5_PRIORITY_MAP_L3; last_item = tunnel ? MLX5_FLOW_LAYER_INNER_L3_IPV6 : MLX5_FLOW_LAYER_OUTER_L3_IPV6; - next_protocol = mlx5_flow_l3_next_protocol(items, key_type); + if (l3_tunnel_detection == l3_tunnel_outer) + wks->item_flags |= l3_tunnel_flag; break; case RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT: flow_dv_translate_item_ipv6_frag_ext -- 2.39.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-03-18 12:58:40.123113801 +0000 +++ 0020-net-mlx5-fix-IP-in-IP-tunnels-recognition.patch 2024-03-18 12:58:39.199347086 +0000 @@ -1 +1 @@ -From 2db234e769e121446b7b6d8e97e00212bebf7a3c Mon Sep 17 00:00:00 2001 +From fd3721be47bb39a9b67467e97a848d4b493bd1bd Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 2db234e769e121446b7b6d8e97e00212bebf7a3c ] + @@ -13 +14,0 @@ -Cc: stable@dpdk.org @@ -22 +23 @@ -index 9e444c8a1c..80239bebee 100644 +index a4fca70b07..68d3ee0c36 100644 @@ -25 +26 @@ -@@ -275,21 +275,41 @@ struct field_modify_info modify_tcp[] = { +@@ -267,21 +267,41 @@ struct field_modify_info modify_tcp[] = { @@ -77 +78 @@ -@@ -7718,6 +7738,8 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, +@@ -7142,6 +7162,8 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, @@ -86 +87 @@ -@@ -7795,8 +7817,16 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, +@@ -7219,8 +7241,16 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, @@ -105 +106 @@ -@@ -7804,12 +7834,20 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, +@@ -7228,12 +7258,20 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, @@ -130 +131 @@ -@@ -7819,8 +7857,8 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, +@@ -7243,8 +7281,8 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, @@ -141 +142 @@ -@@ -13945,6 +13983,8 @@ flow_dv_translate_items(struct rte_eth_dev *dev, +@@ -13197,6 +13235,8 @@ flow_dv_translate_items(struct rte_eth_dev *dev, @@ -150 +151 @@ -@@ -13988,24 +14028,40 @@ flow_dv_translate_items(struct rte_eth_dev *dev, +@@ -13240,24 +13280,40 @@ flow_dv_translate_items(struct rte_eth_dev *dev,