From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 5A919A055A
	for <public@inbox.dpdk.org>; Thu, 27 Feb 2020 10:34:32 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 4283F1BFCD;
	Thu, 27 Feb 2020 10:34:32 +0100 (CET)
Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com
 [209.85.128.47]) by dpdk.org (Postfix) with ESMTP id CB9021BFE1
 for <stable@dpdk.org>; Thu, 27 Feb 2020 10:34:30 +0100 (CET)
Received: by mail-wm1-f47.google.com with SMTP id z12so2657003wmi.4
 for <stable@dpdk.org>; Thu, 27 Feb 2020 01:34:30 -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=P19IqOMo86KOoQmBCrYIS9OBmYiVLLRcP0CB2VRPH6s=;
 b=Ibw29F1L7UK88UX7zLTI6KjLhrI+0qwWLtfAJLCQvK2jXaHuQ/+Az79aT8idAQWYDv
 M2ywryUR3oaHJLsDAh6J/x8LWqEYEAnRpeTnge2/LruCfDp+Bvc0nDJiFxX+pFuZmXFH
 lGlboYyMXWtvJgCxvBy4EBlhG7bf9cWbrjLBN3o8cdysyMPXkKwOD8o9/7gQqbciQlWt
 3f8dnreYcDMwpcnQFORvm64NdcXBXRX310Ku8yxQ5Cr3Zh8LnBmpU9hyYxZKOV6XWgsj
 p/IJeEwnzaVjT2dhi0xhPFT/VS0QOYcxdqajPORd4GAmzK0Qs4y2UTl2OWIsb8X9kGas
 ZNtw==
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=P19IqOMo86KOoQmBCrYIS9OBmYiVLLRcP0CB2VRPH6s=;
 b=RffMOY3KpcEp5z7wqeMx4qIklQtuCkG1aGOWQH06+B4q2pJ+X7bj85iKxljf/07CJA
 cYt6VBEfaitt1dWiOgNItmA1U/PFYadDQ23NjrjoSvS5ov026YOVys7AvY/hNq4ipG2u
 f1e49wmvGdvUxw5nJEAcCEIf7SH5X0XaHfk5u/fr/3h085Hm5Ij3UA3s0rGMvN996AAJ
 /jSTSQ7tGxjwp8RCcovKA+WdH42/8aRBXJ1efOunKs2uYwtjVaE7u+e9EjZPBISOmKY2
 QtKDVGolPEp8lvwWSAXeX1wHwu8xe3Wvyx6xLBX0IPrHSW8WEXdyrRknjYe3ap5HF0Ga
 u3rg==
X-Gm-Message-State: APjAAAWWDP3qpAxrnmkJT84RNAWdsD/wkIBjZR7K3kOtC8Yjy3SwajxX
 wX7FG8YqVR/jGvePjOd7PRU=
X-Google-Smtp-Source: APXvYqzMS9R4g0HfeVeDf+MFgAxwp6RBLLXZ1y7ONOD2xlidszCCcK1DJixRmO1lgurwJ3O9ZfW51g==
X-Received: by 2002:a7b:c190:: with SMTP id y16mr4157798wmi.107.1582796069933; 
 Thu, 27 Feb 2020 01:34:29 -0800 (PST)
Received: from localhost ([88.98.246.218])
 by smtp.gmail.com with ESMTPSA id v8sm7051213wrw.2.2020.02.27.01.34.29
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 27 Feb 2020 01:34:29 -0800 (PST)
From: luca.boccassi@gmail.com
To: Bing Zhao <bingz@mellanox.com>
Cc: Ori Kam <orika@mellanox.com>,
	dpdk stable <stable@dpdk.org>
Date: Thu, 27 Feb 2020 09:33:30 +0000
Message-Id: <20200227093402.17690-10-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 matching for ICMP fragments' 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 <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org
Sender: "stable" <stable-bounces@dpdk.org>

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 2d8874356471c962a855fe674506dfe8387ea2ef Mon Sep 17 00:00:00 2001
From: Bing Zhao <bingz@mellanox.com>
Date: Mon, 17 Feb 2020 22:10:55 +0800
Subject: [PATCH] net/mlx5: fix matching for ICMP fragments

[ upstream commit 72dcb9177367e84f2566a067dc3c65ec2a800c13 ]

The hardware can recognize and mark the layer 4 protocol type for TCP,
UDP and IPSec non-fragmented packets. For all the fragmented packets,
L4 type will be considered as None. This can be used when creating a
flow with L4 matching, then hops number will be reduced and a better
performance could be gained.

But for ICMP packets, it cannot be recognized correctly because it is
not a L4 protocol in the stack, even if the packet format is similar.

All the fragmented and non-fragmented ICMP will have the None L4 type.
Fragmented packets with incomplete headers could not hit the flow,
even for the first fragment. Because then it will make it complex to
defragment for both HW and SW. For other types, the implicit rules
could be used directly and all the fragments will miss the flow.

For ICMP packets, this should be done explicitly because all packets
have None type. The first fragment will still hit the flow if there is
no explicit rule.

All ICMP fragments will still hit the rules like ETH, ETH + IP, and
ETH + IP + "ICMP protocol" only since they are wildcard rules, and
there is no next layer protocol specified field in such rules.

Fixes: d53aa89aea91 ("net/mlx5: support matching on ICMP/ICMP6")

Signed-off-by: Bing Zhao <bingz@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 57d3b1357d..cace0f31b5 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -6181,6 +6181,12 @@ flow_dv_translate_item_icmp6(void *matcher, void *key,
 		return;
 	if (!icmp6_m)
 		icmp6_m = &rte_flow_item_icmp6_mask;
+	/*
+	 * Force flow only to match the non-fragmented IPv6 ICMPv6 packets.
+	 * If only the protocol is specified, no need to match the frag.
+	 */
+	MLX5_SET(fte_match_set_lyr_2_4, headers_m, frag, 1);
+	MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag, 0);
 	MLX5_SET(fte_match_set_misc3, misc3_m, icmpv6_type, icmp6_m->type);
 	MLX5_SET(fte_match_set_misc3, misc3_v, icmpv6_type,
 		 icmp6_v->type & icmp6_m->type);
@@ -6228,6 +6234,12 @@ flow_dv_translate_item_icmp(void *matcher, void *key,
 		return;
 	if (!icmp_m)
 		icmp_m = &rte_flow_item_icmp_mask;
+	/*
+	 * Force flow only to match the non-fragmented IPv4 ICMP packets.
+	 * If only the protocol is specified, no need to match the frag.
+	 */
+	MLX5_SET(fte_match_set_lyr_2_4, headers_m, frag, 1);
+	MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag, 0);
 	MLX5_SET(fte_match_set_misc3, misc3_m, icmp_type,
 		 icmp_m->hdr.icmp_type);
 	MLX5_SET(fte_match_set_misc3, misc3_v, icmp_type,
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-02-27 09:31:56.175527120 +0000
+++ 0010-net-mlx5-fix-matching-for-ICMP-fragments.patch	2020-02-27 09:31:55.687945522 +0000
@@ -1,8 +1,10 @@
-From 72dcb9177367e84f2566a067dc3c65ec2a800c13 Mon Sep 17 00:00:00 2001
+From 2d8874356471c962a855fe674506dfe8387ea2ef Mon Sep 17 00:00:00 2001
 From: Bing Zhao <bingz@mellanox.com>
 Date: Mon, 17 Feb 2020 22:10:55 +0800
 Subject: [PATCH] net/mlx5: fix matching for ICMP fragments
 
+[ upstream commit 72dcb9177367e84f2566a067dc3c65ec2a800c13 ]
+
 The hardware can recognize and mark the layer 4 protocol type for TCP,
 UDP and IPSec non-fragmented packets. For all the fragmented packets,
 L4 type will be considered as None. This can be used when creating a
@@ -27,7 +29,6 @@
 there is no next layer protocol specified field in such rules.
 
 Fixes: d53aa89aea91 ("net/mlx5: support matching on ICMP/ICMP6")
-Cc: stable@dpdk.org
 
 Signed-off-by: Bing Zhao <bingz@mellanox.com>
 Acked-by: Ori Kam <orika@mellanox.com>
@@ -36,10 +37,10 @@
  1 file changed, 12 insertions(+)
 
 diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
-index a8c8a585a4..341d51152a 100644
+index 57d3b1357d..cace0f31b5 100644
 --- a/drivers/net/mlx5/mlx5_flow_dv.c
 +++ b/drivers/net/mlx5/mlx5_flow_dv.c
-@@ -6403,6 +6403,12 @@ flow_dv_translate_item_icmp6(void *matcher, void *key,
+@@ -6181,6 +6181,12 @@ flow_dv_translate_item_icmp6(void *matcher, void *key,
  		return;
  	if (!icmp6_m)
  		icmp6_m = &rte_flow_item_icmp6_mask;
@@ -52,7 +53,7 @@
  	MLX5_SET(fte_match_set_misc3, misc3_m, icmpv6_type, icmp6_m->type);
  	MLX5_SET(fte_match_set_misc3, misc3_v, icmpv6_type,
  		 icmp6_v->type & icmp6_m->type);
-@@ -6450,6 +6456,12 @@ flow_dv_translate_item_icmp(void *matcher, void *key,
+@@ -6228,6 +6234,12 @@ flow_dv_translate_item_icmp(void *matcher, void *key,
  		return;
  	if (!icmp_m)
  		icmp_m = &rte_flow_item_icmp_mask;