#include <linux/if_ether.h>
#include <linux/slab.h>
#include <net/dsa.h>
+#include <net/netdev_lock.h>
#include <net/sock.h>
#include <linux/if_vlan.h>
#include <net/switchdev.h>
* Determine initial path cost based on speed.
* using recommendations from 802.1d standard
*
- * Since driver might sleep need to not be holding any locks.
+ * Since driver might sleep, we need to not be holding any bridge spinlocks.
*/
static int port_cost(struct net_device *dev)
{
struct ethtool_link_ksettings ecmd;
- if (!__ethtool_get_link_ksettings(dev, &ecmd)) {
+ if (!netif_get_link_ksettings(dev, &ecmd)) {
switch (ecmd.base.speed) {
case SPEED_10000:
return 2;
p->br = br;
netdev_hold(dev, &p->dev_tracker, GFP_KERNEL);
p->dev = dev;
+ netdev_lock_ops(dev);
p->path_cost = port_cost(dev);
+ netdev_unlock_ops(dev);
p->priority = 0x8000 >> BR_PORT_BITS;
p->port_no = index;
p->flags = BR_LEARNING | BR_FLOOD | BR_MCAST_FLOOD | BR_BCAST_FLOOD;