Currently, we assume VLAN ethtertype is 0x8100, but it could be 0x88a8 if QinQ is supported.
Signed-off-by: Jianbo Liu <jian...@mellanox.com> Reviewed-by: Roi Dayan <r...@mellanox.com> --- lib/netdev-tc-offloads.c | 6 +++--- lib/tc.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/netdev-tc-offloads.c b/lib/netdev-tc-offloads.c index 93a762d..5c15f6a 100644 --- a/lib/netdev-tc-offloads.c +++ b/lib/netdev-tc-offloads.c @@ -430,7 +430,7 @@ parse_tc_flower_to_match(struct tc_flower *flower, match_set_dl_src_masked(match, key->src_mac, mask->src_mac); match_set_dl_dst_masked(match, key->dst_mac, mask->dst_mac); - if (key->eth_type == htons(ETH_TYPE_VLAN)) { + if (eth_type_vlan(key->eth_type)) { match_set_dl_vlan(match, htons(key->vlan_id)); match_set_dl_vlan_pcp(match, key->vlan_prio); match_set_dl_type(match, key->encap_eth_type); @@ -517,7 +517,7 @@ parse_tc_flower_to_match(struct tc_flower *flower, push = nl_msg_put_unspec_zero(buf, OVS_ACTION_ATTR_PUSH_VLAN, sizeof *push); - push->vlan_tpid = htons(ETH_TYPE_VLAN); + push->vlan_tpid = action->vlan.vlan_push_tpid; push->vlan_tci = htons(action->vlan.vlan_push_id | (action->vlan.vlan_push_prio << 13) | VLAN_CFI); @@ -962,7 +962,7 @@ netdev_tc_flow_put(struct netdev *netdev, struct match *match, VLOG_DBG_RL(&rl, "vlan_prio: %d\n", flower.key.vlan_prio); } flower.key.encap_eth_type = flower.key.eth_type; - flower.key.eth_type = htons(ETH_TYPE_VLAN); + 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 */ diff --git a/lib/tc.c b/lib/tc.c index 66234ce..5030399 100644 --- a/lib/tc.c +++ b/lib/tc.c @@ -332,7 +332,7 @@ nl_parse_flower_eth(struct nlattr **attrs, struct tc_flower *flower) static void nl_parse_flower_vlan(struct nlattr **attrs, struct tc_flower *flower) { - if (flower->key.eth_type != htons(ETH_TYPE_VLAN)) { + if (!eth_type_vlan(flower->key.eth_type)) { return; } @@ -1576,7 +1576,7 @@ nl_msg_put_flower_options(struct ofpbuf *request, struct tc_flower *flower) { uint16_t host_eth_type = ntohs(flower->key.eth_type); - bool is_vlan = (host_eth_type == ETH_TYPE_VLAN); + bool is_vlan = eth_type_vlan(flower->key.eth_type); int err; /* need to parse acts first as some acts require changing the matching -- 2.9.5 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev