The logic by which a TC rule has a VLAN match is by the VLAN TCI field, either the VID, PCP or CFI are non-zero. For priority-tag packets there is a VLAN tag header with a zero VLAN TCI. Match on existence of VLAN header (TPID) regardless of TCI matching.
Signed-off-by: Eli Britstein <el...@mellanox.com> Reviewed-by: Roi Dayan <r...@mellanox.com> --- lib/netdev-tc-offloads.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/netdev-tc-offloads.c b/lib/netdev-tc-offloads.c index d5c66acc1..ef9ee0786 100644 --- a/lib/netdev-tc-offloads.c +++ b/lib/netdev-tc-offloads.c @@ -1146,6 +1146,10 @@ netdev_tc_flow_put(struct netdev *netdev, struct match *match, } mask->mpls_lse[0] = 0; + if (eth_type_vlan(key->vlans[0].tpid)) { + flower.key.encap_eth_type[0] = flower.key.eth_type; + flower.key.eth_type = key->vlans[0].tpid; + } if (mask->vlans[0].tci) { ovs_be16 vid_mask = mask->vlans[0].tci & htons(VLAN_VID_MASK); ovs_be16 pcp_mask = mask->vlans[0].tci & htons(VLAN_PCP_MASK); @@ -1166,8 +1170,6 @@ netdev_tc_flow_put(struct netdev *netdev, struct match *match, VLOG_DBG_RL(&rl, "vlan_prio[0]: %d\n", flower.key.vlan_prio[0]); } - flower.key.encap_eth_type[0] = flower.key.eth_type; - flower.key.eth_type = key->vlans[0].tpid; } else if (mask->vlans[0].tci == htons(0xffff) && ntohs(key->vlans[0].tci) == 0) { /* exact && no vlan */ @@ -1177,6 +1179,10 @@ netdev_tc_flow_put(struct netdev *netdev, struct match *match, } } + if (eth_type_vlan(key->vlans[1].tpid)) { + flower.key.encap_eth_type[1] = flower.key.encap_eth_type[0]; + flower.key.encap_eth_type[0] = key->vlans[1].tpid; + } if (mask->vlans[1].tci) { ovs_be16 vid_mask = mask->vlans[1].tci & htons(VLAN_VID_MASK); ovs_be16 pcp_mask = mask->vlans[1].tci & htons(VLAN_PCP_MASK); @@ -1196,8 +1202,6 @@ netdev_tc_flow_put(struct netdev *netdev, struct match *match, flower.mask.vlan_prio[1] = vlan_tci_to_pcp(mask->vlans[1].tci); VLOG_DBG_RL(&rl, "vlan_prio[1]: %d", flower.key.vlan_prio[1]); } - flower.key.encap_eth_type[1] = flower.key.encap_eth_type[0]; - flower.key.encap_eth_type[0] = key->vlans[1].tpid; } else if (mask->vlans[1].tci == htons(0xffff) && ntohs(key->vlans[1].tci) == 0) { /* exact && no vlan */ -- 2.17.2 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev