From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <xuemingl@mellanox.com>
Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])
 by dpdk.org (Postfix) with ESMTP id ED99E5F2F
 for <dev@dpdk.org>; Mon, 26 Feb 2018 16:10:40 +0100 (CET)
Received: from Internal Mail-Server by MTLPINE1 (envelope-from
 xuemingl@mellanox.com)
 with ESMTPS (AES256-SHA encrypted); 26 Feb 2018 17:10:56 +0200
Received: from dev-r630-06.mtbc.labs.mlnx (dev-r630-06.mtbc.labs.mlnx
 [10.12.205.180])
 by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id w1QFAbkB021510;
 Mon, 26 Feb 2018 17:10:38 +0200
Received: from dev-r630-06.mtbc.labs.mlnx (localhost [127.0.0.1])
 by dev-r630-06.mtbc.labs.mlnx (8.14.7/8.14.7) with ESMTP id w1QFAbmQ107296;
 Mon, 26 Feb 2018 23:10:37 +0800
Received: (from xuemingl@localhost)
 by dev-r630-06.mtbc.labs.mlnx (8.14.7/8.14.7/Submit) id w1QFAbq4107295;
 Mon, 26 Feb 2018 23:10:37 +0800
From: Xueming Li <xuemingl@mellanox.com>
To: Wenzhuo Lu <wenzhuo.lu@intel.com>, Jingjing Wu <jingjing.wu@intel.com>,
 Thomas Monjalon <thomas@monjalon.net>,
 Nelio Laranjeiro <nelio.laranjeiro@6wind.com>,
 Adrien Mazarguil <adrien.mazarguil@6wind.com>,
 Shahaf Shuler <shahafs@mellanox.com>
Cc: Xueming Li <xuemingl@mellanox.com>, dev@dpdk.org
Date: Mon, 26 Feb 2018 23:09:46 +0800
Message-Id: <20180226150947.107179-18-xuemingl@mellanox.com>
X-Mailer: git-send-email 2.13.3
In-Reply-To: <20180226150947.107179-1-xuemingl@mellanox.com>
References: <20180226150947.107179-1-xuemingl@mellanox.com>
Subject: [dpdk-dev] [PATCH 17/18] net/mlx5: allow flow tunnel ID 0 with
	outer pattern
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 26 Feb 2018 15:10:41 -0000

Tunnel w/o tunnel id pattern could match any non-tunneled packet,
thus this patch only allow tunnel pattern with outer spec.

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index fe10904..eb4b447 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -1748,7 +1748,11 @@ struct ibv_spec_header {
 	 * before will also match this rule.
 	 * To avoid such situation, VNI 0 is currently refused.
 	 */
-	if (!vxlan.val.tunnel_id)
+	/*
+	 * Tunnel w/o tunnel id pattern could match any non-tunneled packet,
+	 * thus only allow tunnel pattern with outer spec.
+	 */
+	if (parser->out_layer == HASH_RXQ_ETH && !vxlan.val.tunnel_id)
 		return EINVAL;
 	mlx5_flow_create_copy(parser, &vxlan, size);
 	return 0;
@@ -1810,7 +1814,11 @@ struct ibv_spec_header {
 	 * before will also match this rule.
 	 * To avoid such situation, VNI 0 is currently refused.
 	 */
-	if (!vxlan.val.tunnel_id)
+	/*
+	 * Tunnel w/o tunnel id pattern could match any non-tunneled packet,
+	 * thus only allow tunnel pattern with outer spec.
+	 */
+	if (parser->out_layer == HASH_RXQ_ETH && !vxlan.val.tunnel_id)
 		return EINVAL;
 	mlx5_flow_create_copy(parser, &vxlan, size);
 	return 0;
-- 
1.8.3.1