DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx5: fix push VLAN action wrongly use item info
@ 2020-04-02 10:21 Xiaoyu Min
  2020-04-13  3:29 ` [dpdk-dev] [PATCH v2] " Xiaoyu Min
  0 siblings, 1 reply; 3+ messages in thread
From: Xiaoyu Min @ 2020-04-02 10:21 UTC (permalink / raw)
  To: Matan Azrad, Shahaf Shuler, Viacheslav Ovsiienko; +Cc: dev, stable, Dekel Peled

Currently when PMD create push VLAN action it need to provide VID to HW
and PMD get VID value from item VLAN in pattern if there is no
of_set_vlan_vid action following.

When user create rule like [1], which has of_set_vlan_vid action
before of_push_vlan, the intention is to modify VID on existing VLAN
header and push a new VLAN header with VID _inherit_ from the previous
of_set_vlan_vid.

Currently the above is not covered by PMD, PMD always fetch the VLAN
information from item for of_push_vlan action.

Fix it by only fetch VLAN information from item when there is no
previous of_set_vlan_vid action.

[1]: testpmd> flow create 2 ingress transfer group 1 priority 3 pattern
                eth / vlan vid is 2731 / ipv4 / end actions
		of_set_vlan_vid vlan_vid 3209 / of_push_vlan ethertype
		0x88A8 / port_id id 1 / end

Fixes: b8c0372bc5ac ("net/mlx5: fix set VLAN ID/PCP in new header")
Cc: stable@dpdk.org

Signed-off-by: Xiaoyu Min <jackmin@mellanox.com>
Reviewed-by: Dekel Peled <dekelp@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 6aa6e8383d..c790e6afd4 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -7527,7 +7527,9 @@ __flow_dv_translate(struct rte_eth_dev *dev,
 			action_flags |= MLX5_FLOW_ACTION_OF_POP_VLAN;
 			break;
 		case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN:
-			flow_dev_get_vlan_info_from_items(items, &vlan);
+			if (!(action_flags &
+			      MLX5_FLOW_ACTION_OF_SET_VLAN_VID))
+				flow_dev_get_vlan_info_from_items(items, &vlan);
 			vlan.eth_proto = rte_be_to_cpu_16
 			     ((((const struct rte_flow_action_of_push_vlan *)
 						   actions->conf)->ethertype));
-- 
2.26.0


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

* [dpdk-dev] [PATCH v2] net/mlx5: fix push VLAN action wrongly use item info
  2020-04-02 10:21 [dpdk-dev] [PATCH] net/mlx5: fix push VLAN action wrongly use item info Xiaoyu Min
@ 2020-04-13  3:29 ` Xiaoyu Min
  2020-04-15 15:35   ` Raslan Darawsheh
  0 siblings, 1 reply; 3+ messages in thread
From: Xiaoyu Min @ 2020-04-13  3:29 UTC (permalink / raw)
  To: rasland, Matan Azrad, Shahaf Shuler, Viacheslav Ovsiienko
  Cc: dev, stable, Dekel Peled

Currently when PMD create push VLAN action it need to provide VID to HW
and PMD get VID value from item VLAN in pattern if there is no
of_set_vlan_vid action following.

When user create rule like [1], which has of_set_vlan_vid action
before of_push_vlan, the intention is to modify VID on existing VLAN
header and push a new VLAN header with VID _inherit_ from the previous
of_set_vlan_vid.

Currently the above is not covered by PMD, PMD always fetch the VLAN
information from item for of_push_vlan action.

Fix it by only fetch VLAN information from item when there is no
previous of_set_vlan_vid action.

[1]: testpmd> flow create 2 ingress transfer group 1 priority 3 pattern
                eth / vlan vid is 2731 / ipv4 / end actions
		of_set_vlan_vid vlan_vid 3209 / of_push_vlan ethertype
		0x88A8 / port_id id 1 / end

Fixes: b8c0372bc5ac ("net/mlx5: fix set VLAN ID/PCP in new header")
Cc: stable@dpdk.org

Signed-off-by: Xiaoyu Min <jackmin@mellanox.com>
Reviewed-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
---
v2:
  - rebased
  - added Acked-by tag

 drivers/net/mlx5/mlx5_flow_dv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 18ea577f8c..106d0b9461 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -7511,7 +7511,9 @@ __flow_dv_translate(struct rte_eth_dev *dev,
 			action_flags |= MLX5_FLOW_ACTION_OF_POP_VLAN;
 			break;
 		case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN:
-			flow_dev_get_vlan_info_from_items(items, &vlan);
+			if (!(action_flags &
+			      MLX5_FLOW_ACTION_OF_SET_VLAN_VID))
+				flow_dev_get_vlan_info_from_items(items, &vlan);
 			vlan.eth_proto = rte_be_to_cpu_16
 			     ((((const struct rte_flow_action_of_push_vlan *)
 						   actions->conf)->ethertype));
-- 
2.26.0


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

* Re: [dpdk-dev] [PATCH v2] net/mlx5: fix push VLAN action wrongly use item info
  2020-04-13  3:29 ` [dpdk-dev] [PATCH v2] " Xiaoyu Min
@ 2020-04-15 15:35   ` Raslan Darawsheh
  0 siblings, 0 replies; 3+ messages in thread
From: Raslan Darawsheh @ 2020-04-15 15:35 UTC (permalink / raw)
  To: Jack Min, Matan Azrad, Shahaf Shuler, Slava Ovsiienko
  Cc: dev, stable, Dekel Peled

Hi,

> -----Original Message-----
> From: Xiaoyu Min <jackmin@mellanox.com>
> Sent: Monday, April 13, 2020 6:29 AM
> To: Raslan Darawsheh <rasland@mellanox.com>; Matan Azrad
> <matan@mellanox.com>; Shahaf Shuler <shahafs@mellanox.com>; Slava
> Ovsiienko <viacheslavo@mellanox.com>
> Cc: dev@dpdk.org; stable@dpdk.org; Dekel Peled <dekelp@mellanox.com>
> Subject: [PATCH v2] net/mlx5: fix push VLAN action wrongly use item info
> 
> Currently when PMD create push VLAN action it need to provide VID to HW
> and PMD get VID value from item VLAN in pattern if there is no
> of_set_vlan_vid action following.
> 
> When user create rule like [1], which has of_set_vlan_vid action
> before of_push_vlan, the intention is to modify VID on existing VLAN
> header and push a new VLAN header with VID _inherit_ from the previous
> of_set_vlan_vid.
> 
> Currently the above is not covered by PMD, PMD always fetch the VLAN
> information from item for of_push_vlan action.
> 
> Fix it by only fetch VLAN information from item when there is no
> previous of_set_vlan_vid action.
> 
> [1]: testpmd> flow create 2 ingress transfer group 1 priority 3 pattern
>                 eth / vlan vid is 2731 / ipv4 / end actions
> 		of_set_vlan_vid vlan_vid 3209 / of_push_vlan ethertype
> 		0x88A8 / port_id id 1 / end
> 
> Fixes: b8c0372bc5ac ("net/mlx5: fix set VLAN ID/PCP in new header")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Xiaoyu Min <jackmin@mellanox.com>
> Reviewed-by: Dekel Peled <dekelp@mellanox.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
> ---
> v2:
>   - rebased
>   - added Acked-by tag
> 
>  drivers/net/mlx5/mlx5_flow_dv.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> b/drivers/net/mlx5/mlx5_flow_dv.c
> index 18ea577f8c..106d0b9461 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -7511,7 +7511,9 @@ __flow_dv_translate(struct rte_eth_dev *dev,
>  			action_flags |=
> MLX5_FLOW_ACTION_OF_POP_VLAN;
>  			break;
>  		case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN:
> -			flow_dev_get_vlan_info_from_items(items, &vlan);
> +			if (!(action_flags &
> +			      MLX5_FLOW_ACTION_OF_SET_VLAN_VID))
> +				flow_dev_get_vlan_info_from_items(items,
> &vlan);
>  			vlan.eth_proto = rte_be_to_cpu_16
>  			     ((((const struct rte_flow_action_of_push_vlan *)
>  						   actions->conf)-
> >ethertype));
> --
> 2.26.0


Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

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

end of thread, other threads:[~2020-04-15 15:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-02 10:21 [dpdk-dev] [PATCH] net/mlx5: fix push VLAN action wrongly use item info Xiaoyu Min
2020-04-13  3:29 ` [dpdk-dev] [PATCH v2] " Xiaoyu Min
2020-04-15 15:35   ` Raslan Darawsheh

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).