From patchwork Wed Oct 16 08:07:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Toshiaki Makita X-Patchwork-Id: 283874 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 231802C034C for ; Wed, 16 Oct 2013 19:08:25 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760180Ab3JPIIS (ORCPT ); Wed, 16 Oct 2013 04:08:18 -0400 Received: from tama50.ecl.ntt.co.jp ([129.60.39.147]:50639 "EHLO tama50.ecl.ntt.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760004Ab3JPIIG (ORCPT ); Wed, 16 Oct 2013 04:08:06 -0400 Received: from mfs6.rdh.ecl.ntt.co.jp (mfs6.rdh.ecl.ntt.co.jp [129.60.39.149]) by tama50.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id r9G87sYu000764; Wed, 16 Oct 2013 17:07:54 +0900 Received: from mfs6.rdh.ecl.ntt.co.jp (localhost.localdomain [127.0.0.1]) by mfs6.rdh.ecl.ntt.co.jp (Postfix) with ESMTP id 8CC65E013F; Wed, 16 Oct 2013 17:07:54 +0900 (JST) Received: from imail3.m.ecl.ntt.co.jp (imail3.m.ecl.ntt.co.jp [129.60.5.248]) by mfs6.rdh.ecl.ntt.co.jp (Postfix) with ESMTP id 77861E0135; Wed, 16 Oct 2013 17:07:54 +0900 (JST) Received: from ubuntu-vm-makita ([129.60.241.144]) by imail3.m.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id r9G87s45015808; Wed, 16 Oct 2013 17:07:54 +0900 Received: by ubuntu-vm-makita (Postfix, from userid 1000) id A8EDC1E0A5E; Wed, 16 Oct 2013 17:07:38 +0900 (JST) From: Toshiaki Makita To: "David S . Miller" , Vlad Yasevich , netdev@vger.kernel.org Cc: Toshiaki Makita , Toshiaki Makita Subject: [PATCH v2 net 3/4] bridge: Fix the way the PVID is referenced Date: Wed, 16 Oct 2013 17:07:15 +0900 Message-Id: <1381910836-718-4-git-send-email-makita.toshiaki@lab.ntt.co.jp> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1381910836-718-1-git-send-email-makita.toshiaki@lab.ntt.co.jp> References: <1381910836-718-1-git-send-email-makita.toshiaki@lab.ntt.co.jp> X-TM-AS-MML: No Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org We are using the VLAN_TAG_PRESENT bit to detect whether the PVID is set or not at br_get_pvid(), while we don't care about the bit in adding/deleting the PVID, which makes it impossible to forward any incomming untagged frame with vlan_filtering enabled. Since vid 0 cannot be used for the PVID, we can use vid 0 to indicate that the PVID is not set, which is slightly more efficient than using the VLAN_TAG_PRESENT. Fix the problem by getting rid of using the VLAN_TAG_PRESENT. Signed-off-by: Toshiaki Makita Reviewed-by: Vlad Yasevich --- net/bridge/br_private.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index efb57d9..7ca2ae4 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -643,9 +643,7 @@ static inline u16 br_get_pvid(const struct net_port_vlans *v) * vid wasn't set */ smp_rmb(); - return (v->pvid & VLAN_TAG_PRESENT) ? - (v->pvid & ~VLAN_TAG_PRESENT) : - VLAN_N_VID; + return v->pvid ?: VLAN_N_VID; } #else