* [dpdk-dev] [PATCH v1] net/mlx5: fix VLAN PCP item calculation
@ 2020-02-26 8:27 Ophir Munk
2020-02-26 9:34 ` Slava Ovsiienko
2020-03-01 11:16 ` Raslan Darawsheh
0 siblings, 2 replies; 3+ messages in thread
From: Ophir Munk @ 2020-02-26 8:27 UTC (permalink / raw)
To: dev; +Cc: Thomas Monjalon, Raslan Darawsheh, Ophir Munk
The VLAN 16 bits tci field contains both values of PCP and VID. When
extracting any one of them - it is required not to affect the other one.
Previous to this commit in routine flow_dev_get_vlan_info_from_items()
we calcualted the PCP as follows:
(1) vlan->vlan_tci &= MLX5DV_FLOW_VLAN_PCP_MASK;
(2) vlan->vlan_tci |= <3 bits value of PCP>
In line (1) we should have used the negated mask ('~' operator) such
that only the PCP bits will be nullified before ORing them with the
updated PCP value.
Fixes: 9aee7a8418 ("net/mlx5: support push flow action on VLAN header")
Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
---
drivers/net/mlx5/mlx5_flow_dv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 06592b5..2414a97 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1771,7 +1771,7 @@ flow_dev_get_vlan_info_from_items(const struct rte_flow_item *items,
/* Only full match values are accepted */
if ((vlan_m->tci & MLX5DV_FLOW_VLAN_PCP_MASK_BE) ==
MLX5DV_FLOW_VLAN_PCP_MASK_BE) {
- vlan->vlan_tci &= MLX5DV_FLOW_VLAN_PCP_MASK;
+ vlan->vlan_tci &= ~MLX5DV_FLOW_VLAN_PCP_MASK;
vlan->vlan_tci |=
rte_be_to_cpu_16(vlan_v->tci &
MLX5DV_FLOW_VLAN_PCP_MASK_BE);
--
2.8.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH v1] net/mlx5: fix VLAN PCP item calculation
2020-02-26 8:27 [dpdk-dev] [PATCH v1] net/mlx5: fix VLAN PCP item calculation Ophir Munk
@ 2020-02-26 9:34 ` Slava Ovsiienko
2020-03-01 11:16 ` Raslan Darawsheh
1 sibling, 0 replies; 3+ messages in thread
From: Slava Ovsiienko @ 2020-02-26 9:34 UTC (permalink / raw)
To: Ophir Munk, dev; +Cc: Thomas Monjalon, Raslan Darawsheh, Ophir Munk
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Ophir Munk
> Sent: Wednesday, February 26, 2020 10:28
> To: dev@dpdk.org
> Cc: Thomas Monjalon <thomas@monjalon.net>; Raslan Darawsheh
> <rasland@mellanox.com>; Ophir Munk <ophirmu@mellanox.com>
> Subject: [dpdk-dev] [PATCH v1] net/mlx5: fix VLAN PCP item calculation
>
> The VLAN 16 bits tci field contains both values of PCP and VID. When
> extracting any one of them - it is required not to affect the other one.
> Previous to this commit in routine flow_dev_get_vlan_info_from_items()
> we calcualted the PCP as follows:
> (1) vlan->vlan_tci &= MLX5DV_FLOW_VLAN_PCP_MASK;
> (2) vlan->vlan_tci |= <3 bits value of PCP> In line (1) we should have used
> the negated mask ('~' operator) such that only the PCP bits will be nullified
> before ORing them with the updated PCP value.
>
> Fixes: 9aee7a8418 ("net/mlx5: support push flow action on VLAN header")
>
> Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
PS. Ophir, I suppose this patch should be sent to the stable@dpdk.org either.
> ---
> drivers/net/mlx5/mlx5_flow_dv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> b/drivers/net/mlx5/mlx5_flow_dv.c index 06592b5..2414a97 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -1771,7 +1771,7 @@ flow_dev_get_vlan_info_from_items(const struct
> rte_flow_item *items,
> /* Only full match values are accepted */
> if ((vlan_m->tci & MLX5DV_FLOW_VLAN_PCP_MASK_BE) ==
> MLX5DV_FLOW_VLAN_PCP_MASK_BE) {
> - vlan->vlan_tci &= MLX5DV_FLOW_VLAN_PCP_MASK;
> + vlan->vlan_tci &= ~MLX5DV_FLOW_VLAN_PCP_MASK;
> vlan->vlan_tci |=
> rte_be_to_cpu_16(vlan_v->tci &
>
> MLX5DV_FLOW_VLAN_PCP_MASK_BE);
> --
> 2.8.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH v1] net/mlx5: fix VLAN PCP item calculation
2020-02-26 8:27 [dpdk-dev] [PATCH v1] net/mlx5: fix VLAN PCP item calculation Ophir Munk
2020-02-26 9:34 ` Slava Ovsiienko
@ 2020-03-01 11:16 ` Raslan Darawsheh
1 sibling, 0 replies; 3+ messages in thread
From: Raslan Darawsheh @ 2020-03-01 11:16 UTC (permalink / raw)
To: Ophir Munk, dev; +Cc: Thomas Monjalon, Ophir Munk
Hi,
> -----Original Message-----
> From: Ophir Munk <ophirmu@mellanox.com>
> Sent: Wednesday, February 26, 2020 10:28 AM
> To: dev@dpdk.org
> Cc: Thomas Monjalon <thomas@monjalon.net>; Raslan Darawsheh
> <rasland@mellanox.com>; Ophir Munk <ophirmu@mellanox.com>
> Subject: [PATCH v1] net/mlx5: fix VLAN PCP item calculation
>
> The VLAN 16 bits tci field contains both values of PCP and VID. When
> extracting any one of them - it is required not to affect the other one.
> Previous to this commit in routine flow_dev_get_vlan_info_from_items()
> we calcualted the PCP as follows:
> (1) vlan->vlan_tci &= MLX5DV_FLOW_VLAN_PCP_MASK;
> (2) vlan->vlan_tci |= <3 bits value of PCP>
> In line (1) we should have used the negated mask ('~' operator) such
> that only the PCP bits will be nullified before ORing them with the
> updated PCP value.
>
> Fixes: 9aee7a8418 ("net/mlx5: support push flow action on VLAN header")
>
> Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
> ---
> drivers/net/mlx5/mlx5_flow_dv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> b/drivers/net/mlx5/mlx5_flow_dv.c
> index 06592b5..2414a97 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -1771,7 +1771,7 @@ flow_dev_get_vlan_info_from_items(const struct
> rte_flow_item *items,
> /* Only full match values are accepted */
> if ((vlan_m->tci & MLX5DV_FLOW_VLAN_PCP_MASK_BE) ==
> MLX5DV_FLOW_VLAN_PCP_MASK_BE) {
> - vlan->vlan_tci &=
> MLX5DV_FLOW_VLAN_PCP_MASK;
> + vlan->vlan_tci &=
> ~MLX5DV_FLOW_VLAN_PCP_MASK;
> vlan->vlan_tci |=
> rte_be_to_cpu_16(vlan_v->tci &
>
> MLX5DV_FLOW_VLAN_PCP_MASK_BE);
> --
> 2.8.4
Added Cc: stable@dpdk.org,
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-03-01 11:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-26 8:27 [dpdk-dev] [PATCH v1] net/mlx5: fix VLAN PCP item calculation Ophir Munk
2020-02-26 9:34 ` Slava Ovsiienko
2020-03-01 11:16 ` 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).