summaryrefslogtreecommitdiff
path: root/lib/tc.c
diff options
context:
space:
mode:
authorEelco Chaudron <echaudro@redhat.com>2022-02-22 16:21:42 +0100
committerIlya Maximets <i.maximets@ovn.org>2022-03-21 00:31:24 +0100
commitb4868ee1637a17d59f9bc3d308e93d7e555f609b (patch)
treed7bad9c76bdb1abdaeeeda0f1acdf66828519984 /lib/tc.c
parent2bdf5b288c0c6b9fe3ddd46581aba507457b6b62 (diff)
downloadopenvswitch-b4868ee1637a17d59f9bc3d308e93d7e555f609b.tar.gz
netdev-offload-tc: Set the correct VLAN_VID and VLAN_PCP masks.
This change will set the correct VID and PCP masks, as well as the ethernet type mask. Signed-off-by: Eelco Chaudron <echaudro@redhat.com> Acked-by: Roi Dayan <roid@nvidia.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'lib/tc.c')
-rw-r--r--lib/tc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/tc.c b/lib/tc.c
index 3dd2d36df..75ca40478 100644
--- a/lib/tc.c
+++ b/lib/tc.c
@@ -568,16 +568,17 @@ nl_parse_flower_vlan(struct nlattr **attrs, struct tc_flower *flower)
flower->key.encap_eth_type[0] =
nl_attr_get_be16(attrs[TCA_FLOWER_KEY_ETH_TYPE]);
+ flower->mask.encap_eth_type[0] = CONSTANT_HTONS(0xffff);
if (attrs[TCA_FLOWER_KEY_VLAN_ID]) {
flower->key.vlan_id[0] =
nl_attr_get_u16(attrs[TCA_FLOWER_KEY_VLAN_ID]);
- flower->mask.vlan_id[0] = 0xffff;
+ flower->mask.vlan_id[0] = VLAN_VID_MASK >> VLAN_VID_SHIFT;
}
if (attrs[TCA_FLOWER_KEY_VLAN_PRIO]) {
flower->key.vlan_prio[0] =
nl_attr_get_u8(attrs[TCA_FLOWER_KEY_VLAN_PRIO]);
- flower->mask.vlan_prio[0] = 0xff;
+ flower->mask.vlan_prio[0] = VLAN_PCP_MASK >> VLAN_PCP_SHIFT;
}
if (!attrs[TCA_FLOWER_KEY_VLAN_ETH_TYPE]) {
@@ -590,17 +591,18 @@ nl_parse_flower_vlan(struct nlattr **attrs, struct tc_flower *flower)
}
flower->key.encap_eth_type[1] = flower->key.encap_eth_type[0];
+ flower->mask.encap_eth_type[1] = CONSTANT_HTONS(0xffff);
flower->key.encap_eth_type[0] = encap_ethtype;
if (attrs[TCA_FLOWER_KEY_CVLAN_ID]) {
flower->key.vlan_id[1] =
nl_attr_get_u16(attrs[TCA_FLOWER_KEY_CVLAN_ID]);
- flower->mask.vlan_id[1] = 0xffff;
+ flower->mask.vlan_id[1] = VLAN_VID_MASK >> VLAN_VID_SHIFT;
}
if (attrs[TCA_FLOWER_KEY_CVLAN_PRIO]) {
flower->key.vlan_prio[1] =
nl_attr_get_u8(attrs[TCA_FLOWER_KEY_CVLAN_PRIO]);
- flower->mask.vlan_prio[1] = 0xff;
+ flower->mask.vlan_prio[1] = VLAN_PCP_MASK >> VLAN_PCP_SHIFT;
}
}