Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[firefly-linux-kernel-4.4.55.git] / net / core / dev.c
index 9c58c1ec41a9dba24cca0318f723b01208c7b880..17d67b579beb0c3f6f97bfd8add5d7027741854a 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));
 }
 
 /*
@@ -2532,7 +2542,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;
@@ -4487,10 +4497,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 +5209,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 +5268,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 +5487,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 +5874,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 +5937,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);