From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xueming Li Subject: [PATCH v1 17/21] net/mlx5: allow flow tunnel ID 0 with outer pattern Date: Fri, 9 Mar 2018 19:29:17 +0800 Message-ID: <20180309112921.2105-18-xuemingl@mellanox.com> References: <20180309112921.2105-1-xuemingl@mellanox.com> Cc: Xueming Li , dev@dpdk.org To: Wenzhuo Lu , Jingjing Wu , Thomas Monjalon , Nelio Laranjeiro , Adrien Mazarguil , Shahaf Shuler , Olivier Matz Return-path: Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 6C08FAAEE for ; Fri, 9 Mar 2018 12:30:12 +0100 (CET) In-Reply-To: <20180309112921.2105-1-xuemingl@mellanox.com> In-Reply-To: <20180226150947.107179-2-xuemingl@mellanox.com> References: <20180226150947.107179-2-xuemingl@mellanox.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- drivers/net/mlx5/mlx5_flow.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index cddf562..bda1a58 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -1747,7 +1747,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; @@ -1809,10 +1813,15 @@ 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) { r = EINVAL; return r; } + mlx5_flow_create_copy(parser, &vxlan, size); return 0; } -- 1.8.3.1