[Bridge] [PATCH v2 net 2/3] bridge: Simplify pvid checks.

Toshiaki Makita makita.toshiaki at lab.ntt.co.jp
Wed Oct 1 06:50:01 UTC 2014


On 2014/10/01 4:31, Vladislav Yasevich wrote:
> Currently, if the pvid is not set, we return an illegal vlan value
> even though the pvid value is set to 0.  Since pvid of 0 is currently
> invalid, just return 0 instead.  This makes the current and future
> checks simpler.
> 
> Signed-off-by: Vladislav Yasevich <vyasevic at redhat.com>
> ---
>  net/bridge/br_private.h | 2 +-
>  net/bridge/br_vlan.c    | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
> index 6fe8680..873d9da 100644
> --- a/net/bridge/br_private.h
> +++ b/net/bridge/br_private.h
> @@ -647,7 +647,7 @@ static inline u16 br_get_pvid(const struct net_port_vlans *v)
>  	 * vid wasn't set
>  	 */

The comment above should be changed as well.

>  	smp_rmb();
> -	return v->pvid ?: VLAN_N_VID;
> +	return v->pvid;
>  }

Should fix br_get_pvid() when CONFIG_BRIDGE_VLAN_FILTERING=n?
It returns VLAN_N_VID, which might be confusing.

Thanks,
Toshiaki Makita



More information about the Bridge mailing list