linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Andrew Lunn <andrew@lunn.ch>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	"olteanv@gmail.com" <olteanv@gmail.com>
Subject: Re: [PATCH net-next 4/4] net: dsa: Utilize __vlan_find_dev_deep_rcu()
Date: Fri, 2 Oct 2020 08:42:20 +0000	[thread overview]
Message-ID: <20201002084219.w54cgkivclwzuy44@skbuf> (raw)
In-Reply-To: <20201002024215.660240-5-f.fainelli@gmail.com>

On Thu, Oct 01, 2020 at 07:42:15PM -0700, Florian Fainelli wrote:
> Now that we are guaranteed that dsa_untag_bridge_pvid() is called after
> eth_type_trans() we can utilize __vlan_find_dev_deep_rcu() which will
> take care of finding an 802.1Q upper on top of a bridge master.
> 
> A common use case, prior to 12a1526d067 ("net: dsa: untag the bridge
> pvid from rx skbs") was to configure a bridge 802.1Q upper like this:
> 
> ip link add name br0 type bridge vlan_filtering 0
> ip link add link br0 name br0.1 type vlan id 1
> 
> in order to pop the default_pvid VLAN tag.
> 
> With this change we restore that behavior while still allowing the DSA
> receive path to automatically pop the VLAN tag.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---

Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>

>  net/dsa/dsa_priv.h | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
> index d6ce8c2a2590..12998bf04e55 100644
> --- a/net/dsa/dsa_priv.h
> +++ b/net/dsa/dsa_priv.h
> @@ -204,7 +204,6 @@ static inline struct sk_buff *dsa_untag_bridge_pvid(struct sk_buff *skb)
>  	struct net_device *br = dp->bridge_dev;
>  	struct net_device *dev = skb->dev;
>  	struct net_device *upper_dev;
> -	struct list_head *iter;
>  	u16 vid, pvid, proto;
>  	int err;
>  
> @@ -246,13 +245,9 @@ static inline struct sk_buff *dsa_untag_bridge_pvid(struct sk_buff *skb)
>  	 * supports because vlan_filtering is 0. In that case, we should
>  	 * definitely keep the tag, to make sure it keeps working.
>  	 */
> -	netdev_for_each_upper_dev_rcu(dev, upper_dev, iter) {
> -		if (!is_vlan_dev(upper_dev))
> -			continue;
> -
> -		if (vid == vlan_dev_vlan_id(upper_dev))
> -			return skb;
> -	}
> +	upper_dev = __vlan_find_dev_deep_rcu(br, htons(proto), vid);
> +	if (upper_dev)
> +		return skb;
>  
>  	__vlan_hwaccel_clear_tag(skb);
>  
> -- 
> 2.25.1
> 

  reply	other threads:[~2020-10-02  8:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-02  2:42 [PATCH net-next 0/4] net: dsa: Improve dsa_untag_bridge_pvid() Florian Fainelli
2020-10-02  2:42 ` [PATCH net-next 1/4] net: dsa: Call dsa_untag_bridge_pvid() from dsa_switch_rcv() Florian Fainelli
2020-10-02  8:39   ` Vladimir Oltean
2020-10-02  2:42 ` [PATCH net-next 2/4] net: dsa: b53: Set untag_bridge_pvid Florian Fainelli
2020-10-02  8:40   ` Vladimir Oltean
2020-10-02  2:42 ` [PATCH net-next 3/4] net: dsa: Obtain VLAN protocol from skb->protocol Florian Fainelli
2020-10-02  8:41   ` Vladimir Oltean
2020-10-02  2:42 ` [PATCH net-next 4/4] net: dsa: Utilize __vlan_find_dev_deep_rcu() Florian Fainelli
2020-10-02  8:42   ` Vladimir Oltean [this message]
2020-10-02 20:36 ` [PATCH net-next 0/4] net: dsa: Improve dsa_untag_bridge_pvid() David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201002084219.w54cgkivclwzuy44@skbuf \
    --to=vladimir.oltean@nxp.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=vivien.didelot@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).