Return-Path: References: <20161213151110.yapgecrospdd23oj@rere.qmqm.pl> From: Toshiaki Makita Message-ID: Date: Wed, 14 Dec 2016 09:40:57 +0900 MIME-Version: 1.0 In-Reply-To: <20161213151110.yapgecrospdd23oj@rere.qmqm.pl> Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable Subject: Re: [Bridge] [PATCH net-next 13/27] bridge: use __vlan_hwaccel helpers List-Id: Linux Ethernet Bridging List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= , Sergei Shtylyov Cc: netdev@vger.kernel.org, "moderated list:ETHERNET BRIDGE" , "open list:NETFILTER ({IP, IP6, ARP, EB , NF}TABLES)" , "Jozsef Kadlecsik (supporter:NETFILTER ({IP, IP6, ARP, EB, NF}TABLES))" , "Patrick McHardy (supporter:NETFILTER ({IP, IP6, ARP , EB, NF}TABLES))" , "Pablo Neira Ayuso (supporter:NETFILTER ({IP , IP6, ARP, EB, NF}TABLES))" On 2016/12/14 0:11, Micha=B3 Miros=B3aw wrote: > On Tue, Dec 13, 2016 at 03:59:46PM +0300, Sergei Shtylyov wrote: >> Hello! >> >> On 12/13/2016 3:12 AM, Micha=B3 Miros=B3aw wrote: >> >>> This removes assumption than vlan_tci !=3D 0 when tag is present. >>> >>> Signed-off-by: Micha=B3 Miros=B3aw >>> --- >>> net/bridge/br_netfilter_hooks.c | 14 ++++++++------ >>> net/bridge/br_private.h | 2 +- >>> net/bridge/br_vlan.c | 6 +++--- >>> 3 files changed, 12 insertions(+), 10 deletions(-) >>> >>> diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_= hooks.c >>> index b12501a..2cc0747 100644 >>> --- a/net/bridge/br_netfilter_hooks.c >>> +++ b/net/bridge/br_netfilter_hooks.c >> [...] >>> @@ -749,8 +747,12 @@ static int br_nf_dev_queue_xmit(struct net *net, s= truct sock *sk, struct sk_buff >>> >>> data =3D this_cpu_ptr(&brnf_frag_data_storage); >>> >>> - data->vlan_tci =3D skb->vlan_tci; >>> - data->vlan_proto =3D skb->vlan_proto; >>> + if (skb_vlan_tag_present(skb)) { >>> + data->vlan_tci =3D skb->vlan_tci; >>> + data->vlan_proto =3D skb->vlan_proto; >>> + } else >>> + data->vlan_proto =3D 0; >> >> CodingStyle: should use {} in all branches of *if* if at least one br= anch >> has {}. >> >> [...] >>> diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c >>> index b6de4f4..ef94664 100644 >>> --- a/net/bridge/br_vlan.c >>> +++ b/net/bridge/br_vlan.c >> >>> @@ -444,8 +444,8 @@ static bool __allowed_ingress(const struct net_brid= ge *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 >> >> s/We/we/. >> >>> + * field was 0x000. >> >> Simply 0, maybe? I originally wrote it like this because we are playing with bit field here. I meant that all of 12 bits are 0 thus we can safely perform bitwise-OR to update the VID field. Thanks, Toshiaki Makita