diff options
Diffstat (limited to 'net/core/dev.c')
| -rw-r--r-- | net/core/dev.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 9c58c1ec41a9..17d67b579beb 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
| @@ -199,6 +199,11 @@ static struct list_head ptype_all __read_mostly; /* Taps */ | |||
| 199 | DEFINE_RWLOCK(dev_base_lock); | 199 | DEFINE_RWLOCK(dev_base_lock); |
| 200 | EXPORT_SYMBOL(dev_base_lock); | 200 | EXPORT_SYMBOL(dev_base_lock); |
| 201 | 201 | ||
| 202 | static inline void dev_base_seq_inc(struct net *net) | ||
| 203 | { | ||
| 204 | while (++net->dev_base_seq == 0); | ||
| 205 | } | ||
| 206 | |||
| 202 | static inline struct hlist_head *dev_name_hash(struct net *net, const char *name) | 207 | static inline struct hlist_head *dev_name_hash(struct net *net, const char *name) |
| 203 | { | 208 | { |
| 204 | unsigned hash = full_name_hash(name, strnlen(name, IFNAMSIZ)); | 209 | unsigned hash = full_name_hash(name, strnlen(name, IFNAMSIZ)); |
| @@ -237,6 +242,9 @@ static int list_netdevice(struct net_device *dev) | |||
| 237 | hlist_add_head_rcu(&dev->index_hlist, | 242 | hlist_add_head_rcu(&dev->index_hlist, |
| 238 | dev_index_hash(net, dev->ifindex)); | 243 | dev_index_hash(net, dev->ifindex)); |
| 239 | write_unlock_bh(&dev_base_lock); | 244 | write_unlock_bh(&dev_base_lock); |
| 245 | |||
| 246 | dev_base_seq_inc(net); | ||
| 247 | |||
| 240 | return 0; | 248 | return 0; |
| 241 | } | 249 | } |
| 242 | 250 | ||
| @@ -253,6 +261,8 @@ static void unlist_netdevice(struct net_device *dev) | |||
| 253 | hlist_del_rcu(&dev->name_hlist); | 261 | hlist_del_rcu(&dev->name_hlist); |
| 254 | hlist_del_rcu(&dev->index_hlist); | 262 | hlist_del_rcu(&dev->index_hlist); |
| 255 | write_unlock_bh(&dev_base_lock); | 263 | write_unlock_bh(&dev_base_lock); |
| 264 | |||
| 265 | dev_base_seq_inc(dev_net(dev)); | ||
| 256 | } | 266 | } |
| 257 | 267 | ||
| 258 | /* | 268 | /* |
| @@ -2532,7 +2542,7 @@ __u32 __skb_get_rxhash(struct sk_buff *skb) | |||
| 2532 | goto done; | 2542 | goto done; |
| 2533 | 2543 | ||
| 2534 | ip = (const struct iphdr *) (skb->data + nhoff); | 2544 | ip = (const struct iphdr *) (skb->data + nhoff); |
| 2535 | if (ip->frag_off & htons(IP_MF | IP_OFFSET)) | 2545 | if (ip_is_fragment(ip)) |
| 2536 | ip_proto = 0; | 2546 | ip_proto = 0; |
| 2537 | else | 2547 | else |
| 2538 | ip_proto = ip->protocol; | 2548 | ip_proto = ip->protocol; |
| @@ -4487,10 +4497,10 @@ void __dev_set_rx_mode(struct net_device *dev) | |||
| 4487 | */ | 4497 | */ |
| 4488 | if (!netdev_uc_empty(dev) && !dev->uc_promisc) { | 4498 | if (!netdev_uc_empty(dev) && !dev->uc_promisc) { |
| 4489 | __dev_set_promiscuity(dev, 1); | 4499 | __dev_set_promiscuity(dev, 1); |
| 4490 | dev->uc_promisc = 1; | 4500 | dev->uc_promisc = true; |
| 4491 | } else if (netdev_uc_empty(dev) && dev->uc_promisc) { | 4501 | } else if (netdev_uc_empty(dev) && dev->uc_promisc) { |
| 4492 | __dev_set_promiscuity(dev, -1); | 4502 | __dev_set_promiscuity(dev, -1); |
| 4493 | dev->uc_promisc = 0; | 4503 | dev->uc_promisc = false; |
| 4494 | } | 4504 | } |
| 4495 | 4505 | ||
| 4496 | if (ops->ndo_set_multicast_list) | 4506 | if (ops->ndo_set_multicast_list) |
| @@ -5199,7 +5209,7 @@ static void rollback_registered(struct net_device *dev) | |||
| 5199 | list_del(&single); | 5209 | list_del(&single); |
| 5200 | } | 5210 | } |
| 5201 | 5211 | ||
| 5202 | u32 netdev_fix_features(struct net_device *dev, u32 features) | 5212 | static u32 netdev_fix_features(struct net_device *dev, u32 features) |
| 5203 | { | 5213 | { |
| 5204 | /* Fix illegal checksum combinations */ | 5214 | /* Fix illegal checksum combinations */ |
| 5205 | if ((features & NETIF_F_HW_CSUM) && | 5215 | if ((features & NETIF_F_HW_CSUM) && |
| @@ -5258,7 +5268,6 @@ u32 netdev_fix_features(struct net_device *dev, u32 features) | |||
| 5258 | 5268 | ||
| 5259 | return features; | 5269 | return features; |
| 5260 | } | 5270 | } |
| 5261 | EXPORT_SYMBOL(netdev_fix_features); | ||
| 5262 | 5271 | ||
| 5263 | int __netdev_update_features(struct net_device *dev) | 5272 | int __netdev_update_features(struct net_device *dev) |
| 5264 | { | 5273 | { |
| @@ -5478,11 +5487,9 @@ int register_netdevice(struct net_device *dev) | |||
| 5478 | dev->features |= NETIF_F_NOCACHE_COPY; | 5487 | dev->features |= NETIF_F_NOCACHE_COPY; |
| 5479 | } | 5488 | } |
| 5480 | 5489 | ||
| 5481 | /* Enable GRO and NETIF_F_HIGHDMA for vlans by default, | 5490 | /* Make NETIF_F_HIGHDMA inheritable to VLAN devices. |
| 5482 | * vlan_dev_init() will do the dev->features check, so these features | ||
| 5483 | * are enabled only if supported by underlying device. | ||
| 5484 | */ | 5491 | */ |
| 5485 | dev->vlan_features |= (NETIF_F_GRO | NETIF_F_HIGHDMA); | 5492 | dev->vlan_features |= NETIF_F_HIGHDMA; |
| 5486 | 5493 | ||
| 5487 | ret = call_netdevice_notifiers(NETDEV_POST_INIT, dev); | 5494 | ret = call_netdevice_notifiers(NETDEV_POST_INIT, dev); |
| 5488 | ret = notifier_to_errno(ret); | 5495 | ret = notifier_to_errno(ret); |
| @@ -5867,8 +5874,6 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, | |||
| 5867 | 5874 | ||
| 5868 | dev->gso_max_size = GSO_MAX_SIZE; | 5875 | dev->gso_max_size = GSO_MAX_SIZE; |
| 5869 | 5876 | ||
| 5870 | INIT_LIST_HEAD(&dev->ethtool_ntuple_list.list); | ||
| 5871 | dev->ethtool_ntuple_list.count = 0; | ||
| 5872 | INIT_LIST_HEAD(&dev->napi_list); | 5877 | INIT_LIST_HEAD(&dev->napi_list); |
| 5873 | INIT_LIST_HEAD(&dev->unreg_list); | 5878 | INIT_LIST_HEAD(&dev->unreg_list); |
| 5874 | INIT_LIST_HEAD(&dev->link_watch_list); | 5879 | INIT_LIST_HEAD(&dev->link_watch_list); |
| @@ -5932,9 +5937,6 @@ void free_netdev(struct net_device *dev) | |||
| 5932 | /* Flush device addresses */ | 5937 | /* Flush device addresses */ |
| 5933 | dev_addr_flush(dev); | 5938 | dev_addr_flush(dev); |
| 5934 | 5939 | ||
| 5935 | /* Clear ethtool n-tuple list */ | ||
| 5936 | ethtool_ntuple_flush(dev); | ||
| 5937 | |||
| 5938 | list_for_each_entry_safe(p, n, &dev->napi_list, dev_list) | 5940 | list_for_each_entry_safe(p, n, &dev->napi_list, dev_list) |
| 5939 | netif_napi_del(p); | 5941 | netif_napi_del(p); |
| 5940 | 5942 | ||
