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 calculated 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: 9aee7a8418d4 ("net/mlx5: support push flow action on VLAN header")
Cc: stable@dpdk.org

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
This commit is contained in:
Ophir Munk 2020-02-26 08:27:48 +00:00 committed by Ferruh Yigit
parent bade47a757
commit 3c3f27e905

View File

@ -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);