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]
Date:   Wed, 22 Apr 2020 09:09:38 -0600
From:   David Ahern <dsahern@...il.com>
To:     Maor Gottlieb <maorg@...lanox.com>, davem@...emloft.net,
        jgg@...lanox.com, dledford@...hat.com, j.vosburgh@...il.com,
        vfalico@...il.com, andy@...yhouse.net, kuba@...nel.org,
        jiri@...lanox.com, dsahern@...nel.org
Cc:     leonro@...lanox.com, saeedm@...lanox.com,
        linux-rdma@...r.kernel.org, netdev@...r.kernel.org,
        alexr@...lanox.com
Subject: Re: [PATCH V4 mlx5-next 01/15] net/core: Introduce
 netdev_get_xmit_slave

On 4/22/20 2:39 AM, Maor Gottlieb wrote:
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 9c9e763bfe0e..294553551ba5 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -7785,6 +7785,36 @@ void netdev_bonding_info_change(struct net_device *dev,
>  }
>  EXPORT_SYMBOL(netdev_bonding_info_change);
>  
> +/**
> + * netdev_get_xmit_slave - Get the xmit slave of master device
> + * @skb: The packet
> + * @all_slaves: assume all the slaves are active
> + *
> + * This can be called from any context and does its own locking.
> + * The returned handle has the usage count incremented and the caller must
> + * use dev_put() to release it when it is no longer needed.
> + * %NULL is returned if no slave is found.
> + */
> +
> +struct net_device *netdev_get_xmit_slave(struct net_device *dev,
> +					 struct sk_buff *skb,
> +					 bool all_slaves)
> +{
> +	const struct net_device_ops *ops = dev->netdev_ops;
> +	struct net_device *slave_dev;
> +
> +	if (!ops->ndo_get_xmit_slave)
> +		return NULL;
> +
> +	rcu_read_lock();
> +	slave_dev = ops->ndo_get_xmit_slave(dev, skb, all_slaves);
> +	if (slave_dev)
> +		dev_hold(slave_dev);
> +	rcu_read_unlock();
> +	return slave_dev;
> +}
> +EXPORT_SYMBOL(netdev_get_xmit_slave);
> +
>  static void netdev_adjacent_add_links(struct net_device *dev)
>  {
>  	struct netdev_adjacent *iter;
> 

The rcu_read_lock and reference seem overkill for a general purpose
helper. When this set goes in I want to make modifications for use with
XDP and that does not need either.

Looking at the mlx5 changes, you could easily handle that in the driver.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ