Merge branch 'fix/hda' of git://github.com/tiwai/sound
[pandora-kernel.git] / net / core / dev.c
index 9393078..b10ff0a 100644 (file)
@@ -199,6 +199,11 @@ static struct list_head ptype_all __read_mostly;   /* Taps */
 DEFINE_RWLOCK(dev_base_lock);
 EXPORT_SYMBOL(dev_base_lock);
 
+static inline void dev_base_seq_inc(struct net *net)
+{
+       while (++net->dev_base_seq == 0);
+}
+
 static inline struct hlist_head *dev_name_hash(struct net *net, const char *name)
 {
        unsigned hash = full_name_hash(name, strnlen(name, IFNAMSIZ));
@@ -237,6 +242,9 @@ static int list_netdevice(struct net_device *dev)
        hlist_add_head_rcu(&dev->index_hlist,
                           dev_index_hash(net, dev->ifindex));
        write_unlock_bh(&dev_base_lock);
+
+       dev_base_seq_inc(net);
+
        return 0;
 }
 
@@ -253,6 +261,8 @@ static void unlist_netdevice(struct net_device *dev)
        hlist_del_rcu(&dev->name_hlist);
        hlist_del_rcu(&dev->index_hlist);
        write_unlock_bh(&dev_base_lock);
+
+       dev_base_seq_inc(dev_net(dev));
 }
 
 /*
@@ -1505,6 +1515,14 @@ static inline bool is_skb_forwardable(struct net_device *dev,
  */
 int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
 {
+       if (skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY) {
+               if (skb_copy_ubufs(skb, GFP_ATOMIC)) {
+                       atomic_long_inc(&dev->rx_dropped);
+                       kfree_skb(skb);
+                       return NET_RX_DROP;
+               }
+       }
+
        skb_orphan(skb);
        nf_reset(skb);
 
@@ -2532,7 +2550,7 @@ __u32 __skb_get_rxhash(struct sk_buff *skb)
                        goto done;
 
                ip = (const struct iphdr *) (skb->data + nhoff);
-               if (ip->frag_off & htons(IP_MF | IP_OFFSET))
+               if (ip_is_fragment(ip))
                        ip_proto = 0;
                else
                        ip_proto = ip->protocol;
@@ -3114,7 +3132,7 @@ static int __netif_receive_skb(struct sk_buff *skb)
 
        skb_reset_network_header(skb);
        skb_reset_transport_header(skb);
-       skb->mac_len = skb->network_header - skb->mac_header;
+       skb_reset_mac_len(skb);
 
        pt_prev = NULL;
 
@@ -4487,10 +4505,10 @@ void __dev_set_rx_mode(struct net_device *dev)
                 */
                if (!netdev_uc_empty(dev) && !dev->uc_promisc) {
                        __dev_set_promiscuity(dev, 1);
-                       dev->uc_promisc = 1;
+                       dev->uc_promisc = true;
                } else if (netdev_uc_empty(dev) && dev->uc_promisc) {
                        __dev_set_promiscuity(dev, -1);
-                       dev->uc_promisc = 0;
+                       dev->uc_promisc = false;
                }
 
                if (ops->ndo_set_multicast_list)
@@ -5199,7 +5217,7 @@ static void rollback_registered(struct net_device *dev)
        list_del(&single);
 }
 
-u32 netdev_fix_features(struct net_device *dev, u32 features)
+static u32 netdev_fix_features(struct net_device *dev, u32 features)
 {
        /* Fix illegal checksum combinations */
        if ((features & NETIF_F_HW_CSUM) &&
@@ -5258,7 +5276,6 @@ u32 netdev_fix_features(struct net_device *dev, u32 features)
 
        return features;
 }
-EXPORT_SYMBOL(netdev_fix_features);
 
 int __netdev_update_features(struct net_device *dev)
 {
@@ -5478,11 +5495,9 @@ int register_netdevice(struct net_device *dev)
                dev->features |= NETIF_F_NOCACHE_COPY;
        }
 
-       /* Enable GRO and NETIF_F_HIGHDMA for vlans by default,
-        * vlan_dev_init() will do the dev->features check, so these features
-        * are enabled only if supported by underlying device.
+       /* Make NETIF_F_HIGHDMA inheritable to VLAN devices.
         */
-       dev->vlan_features |= (NETIF_F_GRO | NETIF_F_HIGHDMA);
+       dev->vlan_features |= NETIF_F_HIGHDMA;
 
        ret = call_netdevice_notifiers(NETDEV_POST_INIT, dev);
        ret = notifier_to_errno(ret);
@@ -5867,8 +5882,6 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
 
        dev->gso_max_size = GSO_MAX_SIZE;
 
-       INIT_LIST_HEAD(&dev->ethtool_ntuple_list.list);
-       dev->ethtool_ntuple_list.count = 0;
        INIT_LIST_HEAD(&dev->napi_list);
        INIT_LIST_HEAD(&dev->unreg_list);
        INIT_LIST_HEAD(&dev->link_watch_list);
@@ -5932,9 +5945,6 @@ void free_netdev(struct net_device *dev)
        /* Flush device addresses */
        dev_addr_flush(dev);
 
-       /* Clear ethtool n-tuple list */
-       ethtool_ntuple_flush(dev);
-
        list_for_each_entry_safe(p, n, &dev->napi_list, dev_list)
                netif_napi_del(p);
 
@@ -6178,6 +6188,11 @@ static int dev_cpu_callback(struct notifier_block *nfb,
                oldsd->output_queue = NULL;
                oldsd->output_queue_tailp = &oldsd->output_queue;
        }
+       /* Append NAPI poll list from offline CPU. */
+       if (!list_empty(&oldsd->poll_list)) {
+               list_splice_init(&oldsd->poll_list, &sd->poll_list);
+               raise_softirq_irqoff(NET_RX_SOFTIRQ);
+       }
 
        raise_softirq_irqoff(NET_TX_SOFTIRQ);
        local_irq_enable();
@@ -6264,29 +6279,23 @@ err_name:
 /**
  *     netdev_drivername - network driver for the device
  *     @dev: network device
- *     @buffer: buffer for resulting name
- *     @len: size of buffer
  *
  *     Determine network driver for device.
  */
-char *netdev_drivername(const struct net_device *dev, char *buffer, int len)
+const char *netdev_drivername(const struct net_device *dev)
 {
        const struct device_driver *driver;
        const struct device *parent;
-
-       if (len <= 0 || !buffer)
-               return buffer;
-       buffer[0] = 0;
+       const char *empty = "";
 
        parent = dev->dev.parent;
-
        if (!parent)
-               return buffer;
+               return empty;
 
        driver = parent->driver;
        if (driver && driver->name)
-               strlcpy(buffer, driver->name, len);
-       return buffer;
+               return driver->name;
+       return empty;
 }
 
 static int __netdev_printk(const char *level, const struct net_device *dev,