diff options
| author | Takashi Iwai <tiwai@suse.de> | 2011-08-08 08:30:29 -0400 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2011-08-08 08:30:29 -0400 |
| commit | 0a2d31b62dba9b5b92a38c67c9cc42630513662a (patch) | |
| tree | f755d74ec85248de645e10c45ed1a2ed467530f6 /net/core/dev.c | |
| parent | 8039290a91c5dc4414093c086987a5d7738fe2fd (diff) | |
| parent | df944f66784e6d4f2f50739263a4947885d8b6ae (diff) | |
Merge branch 'fix/kconfig' into for-linus
Diffstat (limited to 'net/core/dev.c')
| -rw-r--r-- | net/core/dev.c | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 939307891e71..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; |
| @@ -3114,7 +3124,7 @@ static int __netif_receive_skb(struct sk_buff *skb) | |||
| 3114 | 3124 | ||
| 3115 | skb_reset_network_header(skb); | 3125 | skb_reset_network_header(skb); |
| 3116 | skb_reset_transport_header(skb); | 3126 | skb_reset_transport_header(skb); |
| 3117 | skb->mac_len = skb->network_header - skb->mac_header; | 3127 | skb_reset_mac_len(skb); |
| 3118 | 3128 | ||
| 3119 | pt_prev = NULL; | 3129 | pt_prev = NULL; |
| 3120 | 3130 | ||
| @@ -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 | ||
| @@ -6178,6 +6180,11 @@ static int dev_cpu_callback(struct notifier_block *nfb, | |||
| 6178 | oldsd->output_queue = NULL; | 6180 | oldsd->output_queue = NULL; |
| 6179 | oldsd->output_queue_tailp = &oldsd->output_queue; | 6181 | oldsd->output_queue_tailp = &oldsd->output_queue; |
| 6180 | } | 6182 | } |
| 6183 | /* Append NAPI poll list from offline CPU. */ | ||
| 6184 | if (!list_empty(&oldsd->poll_list)) { | ||
| 6185 | list_splice_init(&oldsd->poll_list, &sd->poll_list); | ||
| 6186 | raise_softirq_irqoff(NET_RX_SOFTIRQ); | ||
| 6187 | } | ||
| 6181 | 6188 | ||
| 6182 | raise_softirq_irqoff(NET_TX_SOFTIRQ); | 6189 | raise_softirq_irqoff(NET_TX_SOFTIRQ); |
| 6183 | local_irq_enable(); | 6190 | local_irq_enable(); |
| @@ -6264,29 +6271,23 @@ err_name: | |||
| 6264 | /** | 6271 | /** |
| 6265 | * netdev_drivername - network driver for the device | 6272 | * netdev_drivername - network driver for the device |
| 6266 | * @dev: network device | 6273 | * @dev: network device |
| 6267 | * @buffer: buffer for resulting name | ||
| 6268 | * @len: size of buffer | ||
| 6269 | * | 6274 | * |
| 6270 | * Determine network driver for device. | 6275 | * Determine network driver for device. |
| 6271 | */ | 6276 | */ |
| 6272 | char *netdev_drivername(const struct net_device *dev, char *buffer, int len) | 6277 | const char *netdev_drivername(const struct net_device *dev) |
| 6273 | { | 6278 | { |
| 6274 | const struct device_driver *driver; | 6279 | const struct device_driver *driver; |
| 6275 | const struct device *parent; | 6280 | const struct device *parent; |
| 6276 | 6281 | const char *empty = ""; | |
| 6277 | if (len <= 0 || !buffer) | ||
| 6278 | return buffer; | ||
| 6279 | buffer[0] = 0; | ||
| 6280 | 6282 | ||
| 6281 | parent = dev->dev.parent; | 6283 | parent = dev->dev.parent; |
| 6282 | |||
| 6283 | if (!parent) | 6284 | if (!parent) |
| 6284 | return buffer; | 6285 | return empty; |
| 6285 | 6286 | ||
| 6286 | driver = parent->driver; | 6287 | driver = parent->driver; |
| 6287 | if (driver && driver->name) | 6288 | if (driver && driver->name) |
| 6288 | strlcpy(buffer, driver->name, len); | 6289 | return driver->name; |
| 6289 | return buffer; | 6290 | return empty; |
| 6290 | } | 6291 | } |
| 6291 | 6292 | ||
| 6292 | static int __netdev_printk(const char *level, const struct net_device *dev, | 6293 | static int __netdev_printk(const char *level, const struct net_device *dev, |
