netpoll: use GFP_ATOMIC in slave_enable_netpoll() and __netpoll_setup()
[linux-3.10.git] / net / bridge / br_device.c
index feb77ea..ed0e0f9 100644 (file)
@@ -127,9 +127,9 @@ static struct rtnl_link_stats64 *br_get_stats64(struct net_device *dev,
                const struct br_cpu_netstats *bstats
                        = per_cpu_ptr(br->stats, cpu);
                do {
-                       start = u64_stats_fetch_begin(&bstats->syncp);
+                       start = u64_stats_fetch_begin_bh(&bstats->syncp);
                        memcpy(&tmp, bstats, sizeof(tmp));
-               } while (u64_stats_fetch_retry(&bstats->syncp, start));
+               } while (u64_stats_fetch_retry_bh(&bstats->syncp, start));
                sum.tx_bytes   += tmp.tx_bytes;
                sum.tx_packets += tmp.tx_packets;
                sum.rx_bytes   += tmp.rx_bytes;
@@ -167,11 +167,15 @@ static int br_set_mac_address(struct net_device *dev, void *p)
        struct sockaddr *addr = p;
 
        if (!is_valid_ether_addr(addr->sa_data))
-               return -EINVAL;
+               return -EADDRNOTAVAIL;
 
        spin_lock_bh(&br->lock);
-       memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
-       br_stp_change_bridge_id(br, addr->sa_data);
+       if (!ether_addr_equal(dev->dev_addr, addr->sa_data)) {
+               dev->addr_assign_type &= ~NET_ADDR_RANDOM;
+               memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
+               br_fdb_change_mac_address(br, addr->sa_data);
+               br_stp_change_bridge_id(br, addr->sa_data);
+       }
        br->flags |= BR_SET_MAC_ADDR;
        spin_unlock_bh(&br->lock);
 
@@ -186,7 +190,8 @@ static void br_getinfo(struct net_device *dev, struct ethtool_drvinfo *info)
        strcpy(info->bus_info, "N/A");
 }
 
-static u32 br_fix_features(struct net_device *dev, u32 features)
+static netdev_features_t br_fix_features(struct net_device *dev,
+       netdev_features_t features)
 {
        struct net_bridge *br = netdev_priv(dev);
 
@@ -208,7 +213,8 @@ static void br_netpoll_cleanup(struct net_device *dev)
        }
 }
 
-static int br_netpoll_setup(struct net_device *dev, struct netpoll_info *ni)
+static int br_netpoll_setup(struct net_device *dev, struct netpoll_info *ni,
+                           gfp_t gfp)
 {
        struct net_bridge *br = netdev_priv(dev);
        struct net_bridge_port *p, *n;
@@ -217,8 +223,7 @@ static int br_netpoll_setup(struct net_device *dev, struct netpoll_info *ni)
        list_for_each_entry_safe(p, n, &br->port_list, list) {
                if (!p->dev)
                        continue;
-
-               err = br_netpoll_enable(p);
+               err = br_netpoll_enable(p, gfp);
                if (err)
                        goto fail;
        }
@@ -231,20 +236,17 @@ fail:
        goto out;
 }
 
-int br_netpoll_enable(struct net_bridge_port *p)
+int br_netpoll_enable(struct net_bridge_port *p, gfp_t gfp)
 {
        struct netpoll *np;
        int err = 0;
 
-       np = kzalloc(sizeof(*p->np), GFP_KERNEL);
+       np = kzalloc(sizeof(*p->np), gfp);
        err = -ENOMEM;
        if (!np)
                goto out;
 
-       np->dev = p->dev;
-       strlcpy(np->dev_name, p->dev->name, IFNAMSIZ);
-
-       err = __netpoll_setup(np);
+       err = __netpoll_setup(np, p->dev, gfp);
        if (err) {
                kfree(np);
                goto out;
@@ -312,6 +314,9 @@ static const struct net_device_ops br_netdev_ops = {
        .ndo_add_slave           = br_add_slave,
        .ndo_del_slave           = br_del_slave,
        .ndo_fix_features        = br_fix_features,
+       .ndo_fdb_add             = br_fdb_add,
+       .ndo_fdb_del             = br_fdb_delete,
+       .ndo_fdb_dump            = br_fdb_dump,
 };
 
 static void br_dev_free(struct net_device *dev)
@@ -330,7 +335,7 @@ void br_dev_setup(struct net_device *dev)
 {
        struct net_bridge *br = netdev_priv(dev);
 
-       random_ether_addr(dev->dev_addr);
+       eth_hw_addr_random(dev);
        ether_setup(dev);
 
        dev->netdev_ops = &br_netdev_ops;
@@ -341,10 +346,10 @@ void br_dev_setup(struct net_device *dev)
        dev->priv_flags = IFF_EBRIDGE;
 
        dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
-                       NETIF_F_GSO_MASK | NETIF_F_NO_CSUM | NETIF_F_LLTX |
+                       NETIF_F_GSO_MASK | NETIF_F_HW_CSUM | NETIF_F_LLTX |
                        NETIF_F_NETNS_LOCAL | NETIF_F_HW_VLAN_TX;
        dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
-                          NETIF_F_GSO_MASK | NETIF_F_NO_CSUM |
+                          NETIF_F_GSO_MASK | NETIF_F_HW_CSUM |
                           NETIF_F_HW_VLAN_TX;
 
        br->dev = dev;