lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f7b854f6-265b-2a1e-cbc7-e577344df2d7@cumulusnetworks.com>
Date:   Wed, 5 Dec 2018 18:00:16 +0200
From:   Nikolay Aleksandrov <nikolay@...ulusnetworks.com>
To:     Ido Schimmel <idosch@...lanox.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "bridge@...ts.linux-foundation.org" 
        <bridge@...ts.linux-foundation.org>
Cc:     "davem@...emloft.net" <davem@...emloft.net>,
        Jiri Pirko <jiri@...lanox.com>,
        Petr Machata <petrm@...lanox.com>,
        "roopa@...ulusnetworks.com" <roopa@...ulusnetworks.com>,
        mlxsw <mlxsw@...lanox.com>
Subject: Re: [PATCH net-next 04/12] bridge: Add br_fdb_clear_offload()

On 05/12/2018 17:50, Ido Schimmel wrote:
> From: Petr Machata <petrm@...lanox.com>
> 
> When a driver unoffloads all FDB entries en bloc, it's inefficient to
> send the switchdev notification one by one. Add a helper that unsets the
> offload flag on FDB entries on a given bridge port and VLAN.
> 
> Signed-off-by: Petr Machata <petrm@...lanox.com>
> Signed-off-by: Ido Schimmel <idosch@...lanox.com>
> ---
>  include/linux/if_bridge.h |  6 ++++++
>  net/bridge/br_fdb.c       | 20 ++++++++++++++++++++
>  2 files changed, 26 insertions(+)
> 
> diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
> index ef7c3d376b21..627b788ba0ff 100644
> --- a/include/linux/if_bridge.h
> +++ b/include/linux/if_bridge.h
> @@ -119,6 +119,7 @@ static inline int br_vlan_get_info(const struct net_device *dev, u16 vid,
>  struct net_device *br_fdb_find_port(const struct net_device *br_dev,
>  				    const unsigned char *addr,
>  				    __u16 vid);
> +void br_fdb_clear_offload(const struct net_device *dev, u16 vid);
>  bool br_port_flag_is_set(const struct net_device *dev, unsigned long flag);
>  #else
>  static inline struct net_device *
> @@ -128,6 +129,11 @@ br_fdb_find_port(const struct net_device *br_dev,
>  {
>  	return NULL;
>  }
> +
> +static inline void br_fdb_clear_offload(const struct net_device *dev, u16 vid)
> +{
> +}
> +
>  static inline bool
>  br_port_flag_is_set(const struct net_device *dev, unsigned long flag)
>  {
> diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
> index e56ba3912a90..38b1d0dd0529 100644
> --- a/net/bridge/br_fdb.c
> +++ b/net/bridge/br_fdb.c
> @@ -1164,3 +1164,23 @@ void br_fdb_offloaded_set(struct net_bridge *br, struct net_bridge_port *p,
>  
>  	spin_unlock_bh(&br->hash_lock);
>  }
> +
> +void br_fdb_clear_offload(const struct net_device *dev, u16 vid)
> +{
> +	struct net_bridge_fdb_entry *f;
> +	struct net_bridge_port *p;
> +
> +	ASSERT_RTNL();
> +
> +	p = br_port_get_rtnl(dev);
> +	if (!p)
> +		return;
> +
> +	spin_lock_bh(&p->br->hash_lock);
> +	hlist_for_each_entry(f, &p->br->fdb_list, fdb_node) {
> +		if (f->dst == p && f->key.vlan_id == vid)
> +			f->offloaded = 0;
> +	}
> +	spin_unlock_bh(&p->br->hash_lock);
> +}
> +EXPORT_SYMBOL_GPL(br_fdb_clear_offload);
> 

Looks good.

Acked-by: Nikolay Aleksandrov <nikolay@...ulusnetworks.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ