From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id C46E35F20 for ; Wed, 21 Nov 2018 12:27:54 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from viacheslavo@mellanox.com) with ESMTPS (AES256-SHA encrypted); 21 Nov 2018 13:33:35 +0200 Received: from pegasus11.mtr.labs.mlnx. (pegasus11.mtr.labs.mlnx [10.210.16.104]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id wALBRqmJ028924; Wed, 21 Nov 2018 13:27:52 +0200 From: Viacheslav Ovsiienko To: shahafs@mellanox.com Cc: dev@dpdk.org Date: Wed, 21 Nov 2018 11:27:49 +0000 Message-Id: <1542799669-21425-1-git-send-email-viacheslavo@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH] net/mlx5: fix TPID check for VLAN push action on E-Switch X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Nov 2018 11:27:55 -0000 The VLAN push action on E-Switch supports only 802.1Q (0x8100) and 802.1AD (0x88A8) Tag Protocol ID (TPID) insertions. The parameter check for RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN action is added. Fixes: 57123c00c1b8 ("net/mlx5: add Linux TC flower driver for E-Switch flow") Signed-off-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow_tcf.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index 2f6b7d6..22a866d 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -1887,9 +1887,23 @@ struct pedit_parser { case RTE_FLOW_ACTION_TYPE_OF_POP_VLAN: current_action_flag = MLX5_FLOW_ACTION_OF_POP_VLAN; break; - case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN: + case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN: { + rte_be16_t ethertype; + current_action_flag = MLX5_FLOW_ACTION_OF_PUSH_VLAN; + if (!actions->conf) + break; + conf.of_push_vlan = actions->conf; + ethertype = conf.of_push_vlan->ethertype; + if (ethertype != RTE_BE16(ETH_P_8021Q) && + ethertype != RTE_BE16(ETH_P_8021AD)) + return rte_flow_error_set + (error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, actions, + "vlan push TPID must be " + "802.1Q or 802.1AD"); break; + } case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID: if (!(action_flags & MLX5_FLOW_ACTION_OF_PUSH_VLAN)) return rte_flow_error_set -- 1.8.3.1