All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Aleksandrov <nikolay@nvidia.com>
To: Vladimir Oltean <vladimir.oltean@nxp.com>, <netdev@vger.kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Andrew Lunn <andrew@lunn.ch>,
	"Vivien Didelot" <vivien.didelot@gmail.com>,
	Vladimir Oltean <olteanv@gmail.com>,
	Roopa Prabhu <roopa@nvidia.com>, Jiri Pirko <jiri@nvidia.com>,
	Ido Schimmel <idosch@nvidia.com>,
	Rafael Richter <rafael.richter@gin.de>,
	Daniel Klauer <daniel.klauer@gin.de>,
	Tobias Waldekranz <tobias@waldekranz.com>
Subject: Re: [PATCH v3 net-next 03/11] net: bridge: vlan: make __vlan_add_flags react only to PVID and UNTAGGED
Date: Wed, 16 Feb 2022 13:03:54 +0200	[thread overview]
Message-ID: <79237e2d-e1d2-c6cd-975d-b28f064a2c20@nvidia.com> (raw)
In-Reply-To: <20220215170218.2032432-4-vladimir.oltean@nxp.com>

On 15/02/2022 19:02, Vladimir Oltean wrote:
> Currently there is a very subtle aspect to the behavior of
> __vlan_add_flags(): it changes the struct net_bridge_vlan flags and
> pvid, yet it returns true ("changed") even if none of those changed,
> just a transition of br_vlan_is_brentry(v) took place from false to
> true.
> 
> This can be seen in br_vlan_add_existing(), however we do not actually
> rely on this subtle behavior, since the "if" condition that checks that
> the vlan wasn't a brentry before had a useless (until now) assignment:
> 
> 	*changed = true;
> 
> Make things more obvious by actually making __vlan_add_flags() do what's
> written on the box, and be more specific about what is actually written
> on the box. This is needed because further transformations will be done
> to __vlan_add_flags().
> 
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> ---
> v2->v3: patch is new
> 
>  net/bridge/br_vlan.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
> index 498cc297b492..89e2cfed7bdb 100644
> --- a/net/bridge/br_vlan.c
> +++ b/net/bridge/br_vlan.c
> @@ -58,7 +58,9 @@ static bool __vlan_delete_pvid(struct net_bridge_vlan_group *vg, u16 vid)
>  	return true;
>  }
>  
> -/* return true if anything changed, false otherwise */
> +/* Returns true if the BRIDGE_VLAN_INFO_PVID and BRIDGE_VLAN_INFO_UNTAGGED bits
> + * of @flags produced any change onto @v, false otherwise
> + */
>  static bool __vlan_add_flags(struct net_bridge_vlan *v, u16 flags)
>  {
>  	struct net_bridge_vlan_group *vg;
> @@ -80,7 +82,7 @@ static bool __vlan_add_flags(struct net_bridge_vlan *v, u16 flags)
>  	else
>  		v->flags &= ~BRIDGE_VLAN_INFO_UNTAGGED;
>  
> -	return ret || !!(old_flags ^ v->flags);
> +	return ret || !!((old_flags ^ v->flags) & BRIDGE_VLAN_INFO_UNTAGGED);
>  }
>  
>  static int __vlan_vid_add(struct net_device *dev, struct net_bridge *br,

This patch is unnecessary and can be dropped given the next one.

  reply	other threads:[~2022-02-16 11:04 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-15 17:02 [PATCH v3 net-next 00/11] Replay and offload host VLAN entries in DSA Vladimir Oltean
2022-02-15 17:02 ` [PATCH v3 net-next 01/11] net: bridge: vlan: check early for lack of BRENTRY flag in br_vlan_add_existing Vladimir Oltean
2022-02-16 10:58   ` Nikolay Aleksandrov
2022-02-15 17:02 ` [PATCH v3 net-next 02/11] net: bridge: vlan: don't notify to switchdev master VLANs without BRENTRY flag Vladimir Oltean
2022-02-16 11:00   ` Nikolay Aleksandrov
2022-02-16 11:10     ` Vladimir Oltean
2022-02-16 11:11       ` Nikolay Aleksandrov
2022-02-15 17:02 ` [PATCH v3 net-next 03/11] net: bridge: vlan: make __vlan_add_flags react only to PVID and UNTAGGED Vladimir Oltean
2022-02-16 11:03   ` Nikolay Aleksandrov [this message]
2022-02-16 11:07     ` Nikolay Aleksandrov
2022-02-16 11:08     ` Vladimir Oltean
2022-02-16 11:22       ` Nikolay Aleksandrov
2022-02-15 17:02 ` [PATCH v3 net-next 04/11] net: bridge: vlan: notify switchdev only when something changed Vladimir Oltean
2022-02-16 11:25   ` Nikolay Aleksandrov
2022-02-15 17:02 ` [PATCH v3 net-next 05/11] net: bridge: switchdev: differentiate new VLANs from changed ones Vladimir Oltean
2022-02-16 11:27   ` Nikolay Aleksandrov
2022-02-15 17:02 ` [PATCH v3 net-next 06/11] net: bridge: make nbp_switchdev_unsync_objs() follow reverse order of sync() Vladimir Oltean
2022-02-16 11:34   ` Nikolay Aleksandrov
2022-02-15 17:02 ` [PATCH v3 net-next 07/11] net: bridge: switchdev: replay all VLAN groups Vladimir Oltean
2022-02-16 11:38   ` Nikolay Aleksandrov
2022-02-15 17:02 ` [PATCH v3 net-next 08/11] net: switchdev: rename switchdev_lower_dev_find to switchdev_lower_dev_find_rcu Vladimir Oltean
2022-02-15 17:02 ` [PATCH v3 net-next 09/11] net: switchdev: introduce switchdev_handle_port_obj_{add,del} for foreign interfaces Vladimir Oltean
2022-02-15 17:02 ` [PATCH v3 net-next 10/11] net: dsa: add explicit support for host bridge VLANs Vladimir Oltean
2022-02-15 17:02 ` [PATCH v3 net-next 11/11] net: dsa: offload bridge port VLANs on foreign interfaces Vladimir Oltean
2022-02-16 16:01 ` [PATCH v3 net-next 00/11] Replay and offload host VLAN entries in DSA Jakub Kicinski

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=79237e2d-e1d2-c6cd-975d-b28f064a2c20@nvidia.com \
    --to=nikolay@nvidia.com \
    --cc=andrew@lunn.ch \
    --cc=daniel.klauer@gin.de \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=idosch@nvidia.com \
    --cc=jiri@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=rafael.richter@gin.de \
    --cc=roopa@nvidia.com \
    --cc=tobias@waldekranz.com \
    --cc=vivien.didelot@gmail.com \
    --cc=vladimir.oltean@nxp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.