From patchwork Mon Jul 16 10:00:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianbo Liu X-Patchwork-Id: 944278 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=mellanox.com Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41Tf9D1V86z9rxs for ; Mon, 16 Jul 2018 20:02:40 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 2C670C9A; Mon, 16 Jul 2018 10:00:26 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id D3E43C7A for ; Mon, 16 Jul 2018 10:00:21 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by smtp1.linuxfoundation.org (Postfix) with ESMTP id 02202FC for ; Mon, 16 Jul 2018 10:00:18 +0000 (UTC) Received: from Internal Mail-Server by MTLPINE1 (envelope-from jianbol@mellanox.com) with ESMTPS (AES256-SHA encrypted); 16 Jul 2018 13:03:18 +0300 Received: from r-vrt-24-60.mtr.labs.mlnx. (r-vrt-24-60.mtr.labs.mlnx [10.213.24.60]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id w6GA0D4h027489; Mon, 16 Jul 2018 13:00:14 +0300 From: Jianbo Liu To: dev@openvswitch.org, simon.horman@netronome.com Date: Mon, 16 Jul 2018 10:00:01 +0000 Message-Id: <20180716100003.19174-3-jianbol@mellanox.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180716100003.19174-1-jianbol@mellanox.com> References: <20180716100003.19174-1-jianbol@mellanox.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 2/4] netdev-tc-offloads: Add support to match on 802.1AD ethertype X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Currently, we assume VLAN ethtertype is 0x8100, but it could be 0x88a8 if QinQ is supported. Signed-off-by: Jianbo Liu Reviewed-by: Roi Dayan --- 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