diff options
Diffstat (limited to 'net/core/dev.c')
| -rw-r--r-- | net/core/dev.c | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 7c6a46f8037..8ae6631abcc 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
| @@ -749,7 +749,8 @@ EXPORT_SYMBOL(dev_get_by_index); | |||
| 749 | * @ha: hardware address | 749 | * @ha: hardware address |
| 750 | * | 750 | * |
| 751 | * Search for an interface by MAC address. Returns NULL if the device | 751 | * Search for an interface by MAC address. Returns NULL if the device |
| 752 | * is not found or a pointer to the device. The caller must hold RCU | 752 | * is not found or a pointer to the device. |
| 753 | * The caller must hold RCU or RTNL. | ||
| 753 | * The returned device has not had its ref count increased | 754 | * The returned device has not had its ref count increased |
| 754 | * and the caller must therefore be careful about locking | 755 | * and the caller must therefore be careful about locking |
| 755 | * | 756 | * |
| @@ -1279,10 +1280,13 @@ static int __dev_close_many(struct list_head *head) | |||
| 1279 | 1280 | ||
| 1280 | static int __dev_close(struct net_device *dev) | 1281 | static int __dev_close(struct net_device *dev) |
| 1281 | { | 1282 | { |
| 1283 | int retval; | ||
| 1282 | LIST_HEAD(single); | 1284 | LIST_HEAD(single); |
| 1283 | 1285 | ||
| 1284 | list_add(&dev->unreg_list, &single); | 1286 | list_add(&dev->unreg_list, &single); |
| 1285 | return __dev_close_many(&single); | 1287 | retval = __dev_close_many(&single); |
| 1288 | list_del(&single); | ||
| 1289 | return retval; | ||
| 1286 | } | 1290 | } |
| 1287 | 1291 | ||
| 1288 | int dev_close_many(struct list_head *head) | 1292 | int dev_close_many(struct list_head *head) |
| @@ -1324,7 +1328,7 @@ int dev_close(struct net_device *dev) | |||
| 1324 | 1328 | ||
| 1325 | list_add(&dev->unreg_list, &single); | 1329 | list_add(&dev->unreg_list, &single); |
| 1326 | dev_close_many(&single); | 1330 | dev_close_many(&single); |
| 1327 | 1331 | list_del(&single); | |
| 1328 | return 0; | 1332 | return 0; |
| 1329 | } | 1333 | } |
| 1330 | EXPORT_SYMBOL(dev_close); | 1334 | EXPORT_SYMBOL(dev_close); |
| @@ -2562,7 +2566,8 @@ static int get_rps_cpu(struct net_device *dev, struct sk_buff *skb, | |||
| 2562 | 2566 | ||
| 2563 | map = rcu_dereference(rxqueue->rps_map); | 2567 | map = rcu_dereference(rxqueue->rps_map); |
| 2564 | if (map) { | 2568 | if (map) { |
| 2565 | if (map->len == 1) { | 2569 | if (map->len == 1 && |
| 2570 | !rcu_dereference_raw(rxqueue->rps_flow_table)) { | ||
| 2566 | tcpu = map->cpus[0]; | 2571 | tcpu = map->cpus[0]; |
| 2567 | if (cpu_online(tcpu)) | 2572 | if (cpu_online(tcpu)) |
| 2568 | cpu = tcpu; | 2573 | cpu = tcpu; |
| @@ -3423,6 +3428,8 @@ static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb) | |||
| 3423 | __skb_pull(skb, skb_headlen(skb)); | 3428 | __skb_pull(skb, skb_headlen(skb)); |
| 3424 | skb_reserve(skb, NET_IP_ALIGN - skb_headroom(skb)); | 3429 | skb_reserve(skb, NET_IP_ALIGN - skb_headroom(skb)); |
| 3425 | skb->vlan_tci = 0; | 3430 | skb->vlan_tci = 0; |
| 3431 | skb->dev = napi->dev; | ||
| 3432 | skb->skb_iif = 0; | ||
| 3426 | 3433 | ||
| 3427 | napi->skb = skb; | 3434 | napi->skb = skb; |
| 3428 | } | 3435 | } |
| @@ -5059,6 +5066,7 @@ static void rollback_registered(struct net_device *dev) | |||
| 5059 | 5066 | ||
| 5060 | list_add(&dev->unreg_list, &single); | 5067 | list_add(&dev->unreg_list, &single); |
| 5061 | rollback_registered_many(&single); | 5068 | rollback_registered_many(&single); |
| 5069 | list_del(&single); | ||
| 5062 | } | 5070 | } |
| 5063 | 5071 | ||
| 5064 | unsigned long netdev_fix_features(unsigned long features, const char *name) | 5072 | unsigned long netdev_fix_features(unsigned long features, const char *name) |
| @@ -5656,30 +5664,35 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, | |||
| 5656 | 5664 | ||
| 5657 | dev_net_set(dev, &init_net); | 5665 | dev_net_set(dev, &init_net); |
| 5658 | 5666 | ||
| 5667 | dev->gso_max_size = GSO_MAX_SIZE; | ||
| 5668 | |||
| 5669 | INIT_LIST_HEAD(&dev->ethtool_ntuple_list.list); | ||
| 5670 | dev->ethtool_ntuple_list.count = 0; | ||
| 5671 | INIT_LIST_HEAD(&dev->napi_list); | ||
| 5672 | INIT_LIST_HEAD(&dev->unreg_list); | ||
| 5673 | INIT_LIST_HEAD(&dev->link_watch_list); | ||
| 5674 | dev->priv_flags = IFF_XMIT_DST_RELEASE; | ||
| 5675 | setup(dev); | ||
| 5676 | |||
| 5659 | dev->num_tx_queues = txqs; | 5677 | dev->num_tx_queues = txqs; |
| 5660 | dev->real_num_tx_queues = txqs; | 5678 | dev->real_num_tx_queues = txqs; |
| 5661 | if (netif_alloc_netdev_queues(dev)) | 5679 | if (netif_alloc_netdev_queues(dev)) |
| 5662 | goto free_pcpu; | 5680 | goto free_all; |
| 5663 | 5681 | ||
| 5664 | #ifdef CONFIG_RPS | 5682 | #ifdef CONFIG_RPS |
| 5665 | dev->num_rx_queues = rxqs; | 5683 | dev->num_rx_queues = rxqs; |
| 5666 | dev->real_num_rx_queues = rxqs; | 5684 | dev->real_num_rx_queues = rxqs; |
| 5667 | if (netif_alloc_rx_queues(dev)) | 5685 | if (netif_alloc_rx_queues(dev)) |
| 5668 | goto free_pcpu; | 5686 | goto free_all; |
| 5669 | #endif | 5687 | #endif |
| 5670 | 5688 | ||
| 5671 | dev->gso_max_size = GSO_MAX_SIZE; | ||
| 5672 | |||
| 5673 | INIT_LIST_HEAD(&dev->ethtool_ntuple_list.list); | ||
| 5674 | dev->ethtool_ntuple_list.count = 0; | ||
| 5675 | INIT_LIST_HEAD(&dev->napi_list); | ||
| 5676 | INIT_LIST_HEAD(&dev->unreg_list); | ||
| 5677 | INIT_LIST_HEAD(&dev->link_watch_list); | ||
| 5678 | dev->priv_flags = IFF_XMIT_DST_RELEASE; | ||
| 5679 | setup(dev); | ||
| 5680 | strcpy(dev->name, name); | 5689 | strcpy(dev->name, name); |
| 5681 | return dev; | 5690 | return dev; |
| 5682 | 5691 | ||
| 5692 | free_all: | ||
| 5693 | free_netdev(dev); | ||
| 5694 | return NULL; | ||
| 5695 | |||
| 5683 | free_pcpu: | 5696 | free_pcpu: |
| 5684 | free_percpu(dev->pcpu_refcnt); | 5697 | free_percpu(dev->pcpu_refcnt); |
| 5685 | kfree(dev->_tx); | 5698 | kfree(dev->_tx); |
| @@ -6207,6 +6220,7 @@ static void __net_exit default_device_exit_batch(struct list_head *net_list) | |||
| 6207 | } | 6220 | } |
| 6208 | } | 6221 | } |
| 6209 | unregister_netdevice_many(&dev_kill_list); | 6222 | unregister_netdevice_many(&dev_kill_list); |
| 6223 | list_del(&dev_kill_list); | ||
| 6210 | rtnl_unlock(); | 6224 | rtnl_unlock(); |
| 6211 | } | 6225 | } |
| 6212 | 6226 | ||
