From patchwork Thu Nov 8 23:18:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= X-Patchwork-Id: 10675123 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8CDD61709 for ; Thu, 8 Nov 2018 23:18:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7BC9E2E7D4 for ; Thu, 8 Nov 2018 23:18:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F6302E7FE; Thu, 8 Nov 2018 23:18:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 10B7F2E7D4 for ; Thu, 8 Nov 2018 23:18:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726926AbeKIIz6 (ORCPT ); Fri, 9 Nov 2018 03:55:58 -0500 Received: from rere.qmqm.pl ([91.227.64.183]:60516 "EHLO rere.qmqm.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727229AbeKIIz5 (ORCPT ); Fri, 9 Nov 2018 03:55:57 -0500 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 42rfLn454xzq9; Fri, 9 Nov 2018 00:17:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1541719025; bh=1xuJXtjV5hytt2iG1DL1iAAGIGKMbpAH6C9sfbCkKP4=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=SHpAS3J9lHBNoqqsyNZS2pz2CdzQ5W21xepSFdksvuCcKzxffzqohL/b8dLkF21qK 2EdTwkAkHKueGGozkoesxhHo8yjh8JQXz202d02WMRnPoORDwnYM5wp/M5rC/1lNuv HGRmtkQs1FomKPyfTRdz8uW0ldWpfQUFqvP+4G6MnLisUi4Zn3pul8IT7Zr4TmCQI+ E6+UU+G6sqfvUQ1TaX/UdQiClD6KEBLp0NAjmWZIve0XZFR+yY4PdF7cQUx0Qt3/Mx fVK4JPpqmHrIQ3sM1CuA0Wpi22Kt3n7bhLUOaO5tbBKotvJ2/1wynJVP1fooA1onyI zXAmwHvQtlRCw== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.100.2 at mail Date: Fri, 09 Nov 2018 00:18:03 +0100 Message-Id: In-Reply-To: References: From: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Subject: [PATCH net-next 5/9] bridge: use __vlan_hwaccel helpers MIME-Version: 1.0 To: netdev@vger.kernel.org Cc: Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , Roopa Prabhu , Nikolay Aleksandrov , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, bridge@lists.linux-foundation.org, Ajit Khaparde , Alexey Kuznetsov , Cong Wang , "David S. Miller" , Hideaki YOSHIFUJI , Jamal Hadi Salim , Jiri Pirko , linux-rdma@vger.kernel.org, Mirko Lindner , Sathya Perla , Somnath Kotur , Sriharsha Basavapatna , Stephen Hemminger , Steve Wise , Tariq Toukan Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This removes assumption than vlan_tci != 0 when tag is present. Signed-off-by: Michał Mirosław --- net/bridge/br_netfilter_hooks.c | 15 +++++++++------ net/bridge/br_private.h | 2 +- net/bridge/br_vlan.c | 6 +++--- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c index b1b5e8516724..c9383c470a83 100644 --- a/net/bridge/br_netfilter_hooks.c +++ b/net/bridge/br_netfilter_hooks.c @@ -671,10 +671,8 @@ static int br_nf_push_frag_xmit(struct net *net, struct sock *sk, struct sk_buff return 0; } - if (data->vlan_tci) { - skb->vlan_tci = data->vlan_tci; - skb->vlan_proto = data->vlan_proto; - } + if (data->vlan_proto) + __vlan_hwaccel_put_tag(skb, data->vlan_proto, data->vlan_tci); skb_copy_to_linear_data_offset(skb, -data->size, data->mac, data->size); __skb_push(skb, data->encap_size); @@ -740,8 +738,13 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff data = this_cpu_ptr(&brnf_frag_data_storage); - data->vlan_tci = skb->vlan_tci; - data->vlan_proto = skb->vlan_proto; + if (skb_vlan_tag_present(skb)) { + data->vlan_tci = skb->vlan_tci; + data->vlan_proto = skb->vlan_proto; + } else { + data->vlan_proto = 0; + } + data->encap_size = nf_bridge_encap_header_len(skb); data->size = ETH_HLEN + data->encap_size; diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 2920e06a5403..67105c66584a 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -905,7 +905,7 @@ static inline int br_vlan_get_tag(const struct sk_buff *skb, u16 *vid) int err = 0; if (skb_vlan_tag_present(skb)) { - *vid = skb_vlan_tag_get(skb) & VLAN_VID_MASK; + *vid = skb_vlan_tag_get_id(skb); } else { *vid = 0; err = -EINVAL; diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c index 8c9297a01947..a7e869da21bf 100644 --- a/net/bridge/br_vlan.c +++ b/net/bridge/br_vlan.c @@ -420,7 +420,7 @@ struct sk_buff *br_handle_vlan(struct net_bridge *br, } if (v->flags & BRIDGE_VLAN_INFO_UNTAGGED) - skb->vlan_tci = 0; + __vlan_hwaccel_clear_tag(skb); if (p && (p->flags & BR_VLAN_TUNNEL) && br_handle_egress_vlan_tunnel(skb, v)) { @@ -493,8 +493,8 @@ static bool __allowed_ingress(const struct net_bridge *br, __vlan_hwaccel_put_tag(skb, br->vlan_proto, pvid); else /* Priority-tagged Frame. - * At this point, We know that skb->vlan_tci had - * VLAN_TAG_PRESENT bit and its VID field was 0x000. + * At this point, we know that skb->vlan_tci VID + * field was 0. * We update only VID field and preserve PCP field. */ skb->vlan_tci |= pvid;