From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nelio Laranjeiro Subject: [PATCH 4/4] net/mlx5: refuse empty VLAN flow specification Date: Tue, 13 Mar 2018 15:17:39 +0100 Message-ID: <0fdcf57a444961b082e7b4baaab6cc072c99da0d.1520950386.git.nelio.laranjeiro@6wind.com> References: Cc: dev@dpdk.org To: Adrien Mazarguil , Yongseok Koh Return-path: Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com [209.85.128.194]) by dpdk.org (Postfix) with ESMTP id 66350A49B for ; Tue, 13 Mar 2018 15:18:59 +0100 (CET) Received: by mail-wr0-f194.google.com with SMTP id o8so23211859wra.1 for ; Tue, 13 Mar 2018 07:18:59 -0700 (PDT) In-Reply-To: In-Reply-To: References: <7aeb54018d1a8dd06638632076f25fbc88945afd.1518686582.git.nelio.laranjeiro@6wind.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" Verbs specification does help to distinguish between packets having an VLAN and those which do not have, this ends by having flow rule which does not react as the user expects e.g. flow create 0 ingress pattern eth / vlan / end action queue index 0 / end flow create 0 ingress pattern eth / end action queue index 1 / end are colliding in Verbs definition as in both rule are matching packets with or without VLAN. For this reason, the VLAN specification must not be empty, otherwise the PMD has to refuse it. Signed-off-by: Nelio Laranjeiro --- drivers/net/mlx5/mlx5_flow.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 5c096ca9c..875a5028d 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -1305,9 +1305,18 @@ mlx5_flow_create_vlan(const struct rte_flow_item *item, eth->val.vlan_tag = spec->tci; eth->mask.vlan_tag = mask->tci; eth->val.vlan_tag &= eth->mask.vlan_tag; + /* + * From verbs perspective an empty VLAN is equivalent + * to a packet without VLAN layer. + */ + if (!eth->mask.vlan_tag) + goto error; } + return 0; } - return 0; +error: + return rte_flow_error_set(data->error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, + item, "VLAN cannot be empty"); } /** -- 2.11.0