DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx5: fix TPID check for VLAN push action on E-Switch
@ 2018-11-21 11:27 Viacheslav Ovsiienko
  2018-11-22 12:08 ` Shahaf Shuler
  0 siblings, 1 reply; 2+ messages in thread
From: Viacheslav Ovsiienko @ 2018-11-21 11:27 UTC (permalink / raw)
  To: shahafs; +Cc: dev

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 <viacheslavo@mellanox.com>
---
 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] net/mlx5: fix TPID check for VLAN push action on E-Switch
  2018-11-21 11:27 [dpdk-dev] [PATCH] net/mlx5: fix TPID check for VLAN push action on E-Switch Viacheslav Ovsiienko
@ 2018-11-22 12:08 ` Shahaf Shuler
  0 siblings, 0 replies; 2+ messages in thread
From: Shahaf Shuler @ 2018-11-22 12:08 UTC (permalink / raw)
  To: Slava Ovsiienko; +Cc: dev

Wednesday, November 21, 2018 1:28 PM, Viacheslav Ovsiienko:
> Subject: [PATCH] net/mlx5: fix TPID check for VLAN push action on E-Switch
> 
> 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 <viacheslavo@mellanox.com>

Applied to next-net-mlx, thanks. 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-11-22 12:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-21 11:27 [dpdk-dev] [PATCH] net/mlx5: fix TPID check for VLAN push action on E-Switch Viacheslav Ovsiienko
2018-11-22 12:08 ` Shahaf Shuler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).