diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2009-09-03 04:29:39 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-09-03 04:29:39 -0400 |
commit | d1b19dff9159bb88fe839c30a7c071faf4761933 (patch) | |
tree | 647b5a9186e5339b1160d7694ffefc76b140bfa3 | |
parent | 137742cf9738f1b4784058ff79aec7ca85e769d4 (diff) |
net: net/core/dev.c cleanups
Pure style cleanup patch before surgery :)
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/core/dev.c | 589 |
1 files changed, 292 insertions, 297 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 4b3356616976..dd94ae637e66 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -191,7 +191,6 @@ static struct list_head ptype_all __read_mostly; /* Taps */ | |||
191 | * semaphore held. | 191 | * semaphore held. |
192 | */ | 192 | */ |
193 | DEFINE_RWLOCK(dev_base_lock); | 193 | DEFINE_RWLOCK(dev_base_lock); |
194 | |||
195 | EXPORT_SYMBOL(dev_base_lock); | 194 | EXPORT_SYMBOL(dev_base_lock); |
196 | 195 | ||
197 | #define NETDEV_HASHBITS 8 | 196 | #define NETDEV_HASHBITS 8 |
@@ -248,6 +247,7 @@ static RAW_NOTIFIER_HEAD(netdev_chain); | |||
248 | */ | 247 | */ |
249 | 248 | ||
250 | DEFINE_PER_CPU(struct softnet_data, softnet_data); | 249 | DEFINE_PER_CPU(struct softnet_data, softnet_data); |
250 | EXPORT_PER_CPU_SYMBOL(softnet_data); | ||
251 | 251 | ||
252 | #ifdef CONFIG_LOCKDEP | 252 | #ifdef CONFIG_LOCKDEP |
253 | /* | 253 | /* |
@@ -381,6 +381,7 @@ void dev_add_pack(struct packet_type *pt) | |||
381 | } | 381 | } |
382 | spin_unlock_bh(&ptype_lock); | 382 | spin_unlock_bh(&ptype_lock); |
383 | } | 383 | } |
384 | EXPORT_SYMBOL(dev_add_pack); | ||
384 | 385 | ||
385 | /** | 386 | /** |
386 | * __dev_remove_pack - remove packet handler | 387 | * __dev_remove_pack - remove packet handler |
@@ -418,6 +419,8 @@ void __dev_remove_pack(struct packet_type *pt) | |||
418 | out: | 419 | out: |
419 | spin_unlock_bh(&ptype_lock); | 420 | spin_unlock_bh(&ptype_lock); |
420 | } | 421 | } |
422 | EXPORT_SYMBOL(__dev_remove_pack); | ||
423 | |||
421 | /** | 424 | /** |
422 | * dev_remove_pack - remove packet handler | 425 | * dev_remove_pack - remove packet handler |
423 | * @pt: packet type declaration | 426 | * @pt: packet type declaration |
@@ -436,6 +439,7 @@ void dev_remove_pack(struct packet_type *pt) | |||
436 | 439 | ||
437 | synchronize_net(); | 440 | synchronize_net(); |
438 | } | 441 | } |
442 | EXPORT_SYMBOL(dev_remove_pack); | ||
439 | 443 | ||
440 | /****************************************************************************** | 444 | /****************************************************************************** |
441 | 445 | ||
@@ -499,6 +503,7 @@ int netdev_boot_setup_check(struct net_device *dev) | |||
499 | } | 503 | } |
500 | return 0; | 504 | return 0; |
501 | } | 505 | } |
506 | EXPORT_SYMBOL(netdev_boot_setup_check); | ||
502 | 507 | ||
503 | 508 | ||
504 | /** | 509 | /** |
@@ -591,6 +596,7 @@ struct net_device *__dev_get_by_name(struct net *net, const char *name) | |||
591 | } | 596 | } |
592 | return NULL; | 597 | return NULL; |
593 | } | 598 | } |
599 | EXPORT_SYMBOL(__dev_get_by_name); | ||
594 | 600 | ||
595 | /** | 601 | /** |
596 | * dev_get_by_name - find a device by its name | 602 | * dev_get_by_name - find a device by its name |
@@ -615,6 +621,7 @@ struct net_device *dev_get_by_name(struct net *net, const char *name) | |||
615 | read_unlock(&dev_base_lock); | 621 | read_unlock(&dev_base_lock); |
616 | return dev; | 622 | return dev; |
617 | } | 623 | } |
624 | EXPORT_SYMBOL(dev_get_by_name); | ||
618 | 625 | ||
619 | /** | 626 | /** |
620 | * __dev_get_by_index - find a device by its ifindex | 627 | * __dev_get_by_index - find a device by its ifindex |
@@ -640,6 +647,7 @@ struct net_device *__dev_get_by_index(struct net *net, int ifindex) | |||
640 | } | 647 | } |
641 | return NULL; | 648 | return NULL; |
642 | } | 649 | } |
650 | EXPORT_SYMBOL(__dev_get_by_index); | ||
643 | 651 | ||
644 | 652 | ||
645 | /** | 653 | /** |
@@ -664,6 +672,7 @@ struct net_device *dev_get_by_index(struct net *net, int ifindex) | |||
664 | read_unlock(&dev_base_lock); | 672 | read_unlock(&dev_base_lock); |
665 | return dev; | 673 | return dev; |
666 | } | 674 | } |
675 | EXPORT_SYMBOL(dev_get_by_index); | ||
667 | 676 | ||
668 | /** | 677 | /** |
669 | * dev_getbyhwaddr - find a device by its hardware address | 678 | * dev_getbyhwaddr - find a device by its hardware address |
@@ -693,7 +702,6 @@ struct net_device *dev_getbyhwaddr(struct net *net, unsigned short type, char *h | |||
693 | 702 | ||
694 | return NULL; | 703 | return NULL; |
695 | } | 704 | } |
696 | |||
697 | EXPORT_SYMBOL(dev_getbyhwaddr); | 705 | EXPORT_SYMBOL(dev_getbyhwaddr); |
698 | 706 | ||
699 | struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short type) | 707 | struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short type) |
@@ -707,7 +715,6 @@ struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short type) | |||
707 | 715 | ||
708 | return NULL; | 716 | return NULL; |
709 | } | 717 | } |
710 | |||
711 | EXPORT_SYMBOL(__dev_getfirstbyhwtype); | 718 | EXPORT_SYMBOL(__dev_getfirstbyhwtype); |
712 | 719 | ||
713 | struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type) | 720 | struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type) |
@@ -721,7 +728,6 @@ struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type) | |||
721 | rtnl_unlock(); | 728 | rtnl_unlock(); |
722 | return dev; | 729 | return dev; |
723 | } | 730 | } |
724 | |||
725 | EXPORT_SYMBOL(dev_getfirstbyhwtype); | 731 | EXPORT_SYMBOL(dev_getfirstbyhwtype); |
726 | 732 | ||
727 | /** | 733 | /** |
@@ -736,7 +742,8 @@ EXPORT_SYMBOL(dev_getfirstbyhwtype); | |||
736 | * dev_put to indicate they have finished with it. | 742 | * dev_put to indicate they have finished with it. |
737 | */ | 743 | */ |
738 | 744 | ||
739 | struct net_device * dev_get_by_flags(struct net *net, unsigned short if_flags, unsigned short mask) | 745 | struct net_device *dev_get_by_flags(struct net *net, unsigned short if_flags, |
746 | unsigned short mask) | ||
740 | { | 747 | { |
741 | struct net_device *dev, *ret; | 748 | struct net_device *dev, *ret; |
742 | 749 | ||
@@ -752,6 +759,7 @@ struct net_device * dev_get_by_flags(struct net *net, unsigned short if_flags, u | |||
752 | read_unlock(&dev_base_lock); | 759 | read_unlock(&dev_base_lock); |
753 | return ret; | 760 | return ret; |
754 | } | 761 | } |
762 | EXPORT_SYMBOL(dev_get_by_flags); | ||
755 | 763 | ||
756 | /** | 764 | /** |
757 | * dev_valid_name - check if name is okay for network device | 765 | * dev_valid_name - check if name is okay for network device |
@@ -777,6 +785,7 @@ int dev_valid_name(const char *name) | |||
777 | } | 785 | } |
778 | return 1; | 786 | return 1; |
779 | } | 787 | } |
788 | EXPORT_SYMBOL(dev_valid_name); | ||
780 | 789 | ||
781 | /** | 790 | /** |
782 | * __dev_alloc_name - allocate a name for a device | 791 | * __dev_alloc_name - allocate a name for a device |
@@ -870,6 +879,7 @@ int dev_alloc_name(struct net_device *dev, const char *name) | |||
870 | strlcpy(dev->name, buf, IFNAMSIZ); | 879 | strlcpy(dev->name, buf, IFNAMSIZ); |
871 | return ret; | 880 | return ret; |
872 | } | 881 | } |
882 | EXPORT_SYMBOL(dev_alloc_name); | ||
873 | 883 | ||
874 | 884 | ||
875 | /** | 885 | /** |
@@ -906,8 +916,7 @@ int dev_change_name(struct net_device *dev, const char *newname) | |||
906 | err = dev_alloc_name(dev, newname); | 916 | err = dev_alloc_name(dev, newname); |
907 | if (err < 0) | 917 | if (err < 0) |
908 | return err; | 918 | return err; |
909 | } | 919 | } else if (__dev_get_by_name(net, newname)) |
910 | else if (__dev_get_by_name(net, newname)) | ||
911 | return -EEXIST; | 920 | return -EEXIST; |
912 | else | 921 | else |
913 | strlcpy(dev->name, newname, IFNAMSIZ); | 922 | strlcpy(dev->name, newname, IFNAMSIZ); |
@@ -970,7 +979,7 @@ int dev_set_alias(struct net_device *dev, const char *alias, size_t len) | |||
970 | return 0; | 979 | return 0; |
971 | } | 980 | } |
972 | 981 | ||
973 | dev->ifalias = krealloc(dev->ifalias, len+1, GFP_KERNEL); | 982 | dev->ifalias = krealloc(dev->ifalias, len + 1, GFP_KERNEL); |
974 | if (!dev->ifalias) | 983 | if (!dev->ifalias) |
975 | return -ENOMEM; | 984 | return -ENOMEM; |
976 | 985 | ||
@@ -1006,6 +1015,7 @@ void netdev_state_change(struct net_device *dev) | |||
1006 | rtmsg_ifinfo(RTM_NEWLINK, dev, 0); | 1015 | rtmsg_ifinfo(RTM_NEWLINK, dev, 0); |
1007 | } | 1016 | } |
1008 | } | 1017 | } |
1018 | EXPORT_SYMBOL(netdev_state_change); | ||
1009 | 1019 | ||
1010 | void netdev_bonding_change(struct net_device *dev) | 1020 | void netdev_bonding_change(struct net_device *dev) |
1011 | { | 1021 | { |
@@ -1034,6 +1044,7 @@ void dev_load(struct net *net, const char *name) | |||
1034 | if (!dev && capable(CAP_SYS_MODULE)) | 1044 | if (!dev && capable(CAP_SYS_MODULE)) |
1035 | request_module("%s", name); | 1045 | request_module("%s", name); |
1036 | } | 1046 | } |
1047 | EXPORT_SYMBOL(dev_load); | ||
1037 | 1048 | ||
1038 | /** | 1049 | /** |
1039 | * dev_open - prepare an interface for use. | 1050 | * dev_open - prepare an interface for use. |
@@ -1118,6 +1129,7 @@ int dev_open(struct net_device *dev) | |||
1118 | 1129 | ||
1119 | return ret; | 1130 | return ret; |
1120 | } | 1131 | } |
1132 | EXPORT_SYMBOL(dev_open); | ||
1121 | 1133 | ||
1122 | /** | 1134 | /** |
1123 | * dev_close - shutdown an interface. | 1135 | * dev_close - shutdown an interface. |
@@ -1184,6 +1196,7 @@ int dev_close(struct net_device *dev) | |||
1184 | 1196 | ||
1185 | return 0; | 1197 | return 0; |
1186 | } | 1198 | } |
1199 | EXPORT_SYMBOL(dev_close); | ||
1187 | 1200 | ||
1188 | 1201 | ||
1189 | /** | 1202 | /** |
@@ -1279,6 +1292,7 @@ rollback: | |||
1279 | raw_notifier_chain_unregister(&netdev_chain, nb); | 1292 | raw_notifier_chain_unregister(&netdev_chain, nb); |
1280 | goto unlock; | 1293 | goto unlock; |
1281 | } | 1294 | } |
1295 | EXPORT_SYMBOL(register_netdevice_notifier); | ||
1282 | 1296 | ||
1283 | /** | 1297 | /** |
1284 | * unregister_netdevice_notifier - unregister a network notifier block | 1298 | * unregister_netdevice_notifier - unregister a network notifier block |
@@ -1299,6 +1313,7 @@ int unregister_netdevice_notifier(struct notifier_block *nb) | |||
1299 | rtnl_unlock(); | 1313 | rtnl_unlock(); |
1300 | return err; | 1314 | return err; |
1301 | } | 1315 | } |
1316 | EXPORT_SYMBOL(unregister_netdevice_notifier); | ||
1302 | 1317 | ||
1303 | /** | 1318 | /** |
1304 | * call_netdevice_notifiers - call all network notifier blocks | 1319 | * call_netdevice_notifiers - call all network notifier blocks |
@@ -1321,11 +1336,13 @@ void net_enable_timestamp(void) | |||
1321 | { | 1336 | { |
1322 | atomic_inc(&netstamp_needed); | 1337 | atomic_inc(&netstamp_needed); |
1323 | } | 1338 | } |
1339 | EXPORT_SYMBOL(net_enable_timestamp); | ||
1324 | 1340 | ||
1325 | void net_disable_timestamp(void) | 1341 | void net_disable_timestamp(void) |
1326 | { | 1342 | { |
1327 | atomic_dec(&netstamp_needed); | 1343 | atomic_dec(&netstamp_needed); |
1328 | } | 1344 | } |
1345 | EXPORT_SYMBOL(net_disable_timestamp); | ||
1329 | 1346 | ||
1330 | static inline void net_timestamp(struct sk_buff *skb) | 1347 | static inline void net_timestamp(struct sk_buff *skb) |
1331 | { | 1348 | { |
@@ -1359,7 +1376,7 @@ static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev) | |||
1359 | if ((ptype->dev == dev || !ptype->dev) && | 1376 | if ((ptype->dev == dev || !ptype->dev) && |
1360 | (ptype->af_packet_priv == NULL || | 1377 | (ptype->af_packet_priv == NULL || |
1361 | (struct sock *)ptype->af_packet_priv != skb->sk)) { | 1378 | (struct sock *)ptype->af_packet_priv != skb->sk)) { |
1362 | struct sk_buff *skb2= skb_clone(skb, GFP_ATOMIC); | 1379 | struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC); |
1363 | if (!skb2) | 1380 | if (!skb2) |
1364 | break; | 1381 | break; |
1365 | 1382 | ||
@@ -1527,6 +1544,7 @@ out_set_summed: | |||
1527 | out: | 1544 | out: |
1528 | return ret; | 1545 | return ret; |
1529 | } | 1546 | } |
1547 | EXPORT_SYMBOL(skb_checksum_help); | ||
1530 | 1548 | ||
1531 | /** | 1549 | /** |
1532 | * skb_gso_segment - Perform segmentation on skb. | 1550 | * skb_gso_segment - Perform segmentation on skb. |
@@ -1589,7 +1607,6 @@ struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features) | |||
1589 | 1607 | ||
1590 | return segs; | 1608 | return segs; |
1591 | } | 1609 | } |
1592 | |||
1593 | EXPORT_SYMBOL(skb_gso_segment); | 1610 | EXPORT_SYMBOL(skb_gso_segment); |
1594 | 1611 | ||
1595 | /* Take action when hardware reception checksum errors are detected. */ | 1612 | /* Take action when hardware reception checksum errors are detected. */ |
@@ -1755,7 +1772,7 @@ u16 skb_tx_hash(const struct net_device *dev, const struct sk_buff *skb) | |||
1755 | 1772 | ||
1756 | if (skb_rx_queue_recorded(skb)) { | 1773 | if (skb_rx_queue_recorded(skb)) { |
1757 | hash = skb_get_rx_queue(skb); | 1774 | hash = skb_get_rx_queue(skb); |
1758 | while (unlikely (hash >= dev->real_num_tx_queues)) | 1775 | while (unlikely(hash >= dev->real_num_tx_queues)) |
1759 | hash -= dev->real_num_tx_queues; | 1776 | hash -= dev->real_num_tx_queues; |
1760 | return hash; | 1777 | return hash; |
1761 | } | 1778 | } |
@@ -1890,7 +1907,7 @@ gso: | |||
1890 | q = rcu_dereference(txq->qdisc); | 1907 | q = rcu_dereference(txq->qdisc); |
1891 | 1908 | ||
1892 | #ifdef CONFIG_NET_CLS_ACT | 1909 | #ifdef CONFIG_NET_CLS_ACT |
1893 | skb->tc_verd = SET_TC_AT(skb->tc_verd,AT_EGRESS); | 1910 | skb->tc_verd = SET_TC_AT(skb->tc_verd, AT_EGRESS); |
1894 | #endif | 1911 | #endif |
1895 | if (q->enqueue) { | 1912 | if (q->enqueue) { |
1896 | rc = __dev_xmit_skb(skb, q, dev, txq); | 1913 | rc = __dev_xmit_skb(skb, q, dev, txq); |
@@ -1946,6 +1963,7 @@ out: | |||
1946 | rcu_read_unlock_bh(); | 1963 | rcu_read_unlock_bh(); |
1947 | return rc; | 1964 | return rc; |
1948 | } | 1965 | } |
1966 | EXPORT_SYMBOL(dev_queue_xmit); | ||
1949 | 1967 | ||
1950 | 1968 | ||
1951 | /*======================================================================= | 1969 | /*======================================================================= |
@@ -2012,6 +2030,7 @@ enqueue: | |||
2012 | kfree_skb(skb); | 2030 | kfree_skb(skb); |
2013 | return NET_RX_DROP; | 2031 | return NET_RX_DROP; |
2014 | } | 2032 | } |
2033 | EXPORT_SYMBOL(netif_rx); | ||
2015 | 2034 | ||
2016 | int netif_rx_ni(struct sk_buff *skb) | 2035 | int netif_rx_ni(struct sk_buff *skb) |
2017 | { | 2036 | { |
@@ -2025,7 +2044,6 @@ int netif_rx_ni(struct sk_buff *skb) | |||
2025 | 2044 | ||
2026 | return err; | 2045 | return err; |
2027 | } | 2046 | } |
2028 | |||
2029 | EXPORT_SYMBOL(netif_rx_ni); | 2047 | EXPORT_SYMBOL(netif_rx_ni); |
2030 | 2048 | ||
2031 | static void net_tx_action(struct softirq_action *h) | 2049 | static void net_tx_action(struct softirq_action *h) |
@@ -2358,6 +2376,7 @@ out: | |||
2358 | rcu_read_unlock(); | 2376 | rcu_read_unlock(); |
2359 | return ret; | 2377 | return ret; |
2360 | } | 2378 | } |
2379 | EXPORT_SYMBOL(netif_receive_skb); | ||
2361 | 2380 | ||
2362 | /* Network device is going away, flush any packets still pending */ | 2381 | /* Network device is going away, flush any packets still pending */ |
2363 | static void flush_backlog(void *arg) | 2382 | static void flush_backlog(void *arg) |
@@ -2874,7 +2893,7 @@ softnet_break: | |||
2874 | goto out; | 2893 | goto out; |
2875 | } | 2894 | } |
2876 | 2895 | ||
2877 | static gifconf_func_t * gifconf_list [NPROTO]; | 2896 | static gifconf_func_t *gifconf_list[NPROTO]; |
2878 | 2897 | ||
2879 | /** | 2898 | /** |
2880 | * register_gifconf - register a SIOCGIF handler | 2899 | * register_gifconf - register a SIOCGIF handler |
@@ -2885,13 +2904,14 @@ static gifconf_func_t * gifconf_list [NPROTO]; | |||
2885 | * that is passed must not be freed or reused until it has been replaced | 2904 | * that is passed must not be freed or reused until it has been replaced |
2886 | * by another handler. | 2905 | * by another handler. |
2887 | */ | 2906 | */ |
2888 | int register_gifconf(unsigned int family, gifconf_func_t * gifconf) | 2907 | int register_gifconf(unsigned int family, gifconf_func_t *gifconf) |
2889 | { | 2908 | { |
2890 | if (family >= NPROTO) | 2909 | if (family >= NPROTO) |
2891 | return -EINVAL; | 2910 | return -EINVAL; |
2892 | gifconf_list[family] = gifconf; | 2911 | gifconf_list[family] = gifconf; |
2893 | return 0; | 2912 | return 0; |
2894 | } | 2913 | } |
2914 | EXPORT_SYMBOL(register_gifconf); | ||
2895 | 2915 | ||
2896 | 2916 | ||
2897 | /* | 2917 | /* |
@@ -3102,7 +3122,7 @@ static int softnet_seq_show(struct seq_file *seq, void *v) | |||
3102 | seq_printf(seq, "%08x %08x %08x %08x %08x %08x %08x %08x %08x\n", | 3122 | seq_printf(seq, "%08x %08x %08x %08x %08x %08x %08x %08x %08x\n", |
3103 | s->total, s->dropped, s->time_squeeze, 0, | 3123 | s->total, s->dropped, s->time_squeeze, 0, |
3104 | 0, 0, 0, 0, /* was fastroute */ | 3124 | 0, 0, 0, 0, /* was fastroute */ |
3105 | s->cpu_collision ); | 3125 | s->cpu_collision); |
3106 | return 0; | 3126 | return 0; |
3107 | } | 3127 | } |
3108 | 3128 | ||
@@ -3338,6 +3358,7 @@ int netdev_set_master(struct net_device *slave, struct net_device *master) | |||
3338 | rtmsg_ifinfo(RTM_NEWLINK, slave, IFF_SLAVE); | 3358 | rtmsg_ifinfo(RTM_NEWLINK, slave, IFF_SLAVE); |
3339 | return 0; | 3359 | return 0; |
3340 | } | 3360 | } |
3361 | EXPORT_SYMBOL(netdev_set_master); | ||
3341 | 3362 | ||
3342 | static void dev_change_rx_flags(struct net_device *dev, int flags) | 3363 | static void dev_change_rx_flags(struct net_device *dev, int flags) |
3343 | { | 3364 | { |
@@ -3416,6 +3437,7 @@ int dev_set_promiscuity(struct net_device *dev, int inc) | |||
3416 | dev_set_rx_mode(dev); | 3437 | dev_set_rx_mode(dev); |
3417 | return err; | 3438 | return err; |
3418 | } | 3439 | } |
3440 | EXPORT_SYMBOL(dev_set_promiscuity); | ||
3419 | 3441 | ||
3420 | /** | 3442 | /** |
3421 | * dev_set_allmulti - update allmulti count on a device | 3443 | * dev_set_allmulti - update allmulti count on a device |
@@ -3459,6 +3481,7 @@ int dev_set_allmulti(struct net_device *dev, int inc) | |||
3459 | } | 3481 | } |
3460 | return 0; | 3482 | return 0; |
3461 | } | 3483 | } |
3484 | EXPORT_SYMBOL(dev_set_allmulti); | ||
3462 | 3485 | ||
3463 | /* | 3486 | /* |
3464 | * Upload unicast and multicast address lists to device and | 3487 | * Upload unicast and multicast address lists to device and |
@@ -4088,6 +4111,7 @@ unsigned dev_get_flags(const struct net_device *dev) | |||
4088 | 4111 | ||
4089 | return flags; | 4112 | return flags; |
4090 | } | 4113 | } |
4114 | EXPORT_SYMBOL(dev_get_flags); | ||
4091 | 4115 | ||
4092 | /** | 4116 | /** |
4093 | * dev_change_flags - change device settings | 4117 | * dev_change_flags - change device settings |
@@ -4138,12 +4162,13 @@ int dev_change_flags(struct net_device *dev, unsigned flags) | |||
4138 | } | 4162 | } |
4139 | 4163 | ||
4140 | if (dev->flags & IFF_UP && | 4164 | if (dev->flags & IFF_UP && |
4141 | ((old_flags ^ dev->flags) &~ (IFF_UP | IFF_PROMISC | IFF_ALLMULTI | | 4165 | ((old_flags ^ dev->flags) & ~(IFF_UP | IFF_PROMISC | IFF_ALLMULTI | |
4142 | IFF_VOLATILE))) | 4166 | IFF_VOLATILE))) |
4143 | call_netdevice_notifiers(NETDEV_CHANGE, dev); | 4167 | call_netdevice_notifiers(NETDEV_CHANGE, dev); |
4144 | 4168 | ||
4145 | if ((flags ^ dev->gflags) & IFF_PROMISC) { | 4169 | if ((flags ^ dev->gflags) & IFF_PROMISC) { |
4146 | int inc = (flags & IFF_PROMISC) ? +1 : -1; | 4170 | int inc = (flags & IFF_PROMISC) ? 1 : -1; |
4171 | |||
4147 | dev->gflags ^= IFF_PROMISC; | 4172 | dev->gflags ^= IFF_PROMISC; |
4148 | dev_set_promiscuity(dev, inc); | 4173 | dev_set_promiscuity(dev, inc); |
4149 | } | 4174 | } |
@@ -4153,7 +4178,8 @@ int dev_change_flags(struct net_device *dev, unsigned flags) | |||
4153 | IFF_ALLMULTI is requested not asking us and not reporting. | 4178 | IFF_ALLMULTI is requested not asking us and not reporting. |
4154 | */ | 4179 | */ |
4155 | if ((flags ^ dev->gflags) & IFF_ALLMULTI) { | 4180 | if ((flags ^ dev->gflags) & IFF_ALLMULTI) { |
4156 | int inc = (flags & IFF_ALLMULTI) ? +1 : -1; | 4181 | int inc = (flags & IFF_ALLMULTI) ? 1 : -1; |
4182 | |||
4157 | dev->gflags ^= IFF_ALLMULTI; | 4183 | dev->gflags ^= IFF_ALLMULTI; |
4158 | dev_set_allmulti(dev, inc); | 4184 | dev_set_allmulti(dev, inc); |
4159 | } | 4185 | } |
@@ -4165,6 +4191,7 @@ int dev_change_flags(struct net_device *dev, unsigned flags) | |||
4165 | 4191 | ||
4166 | return ret; | 4192 | return ret; |
4167 | } | 4193 | } |
4194 | EXPORT_SYMBOL(dev_change_flags); | ||
4168 | 4195 | ||
4169 | /** | 4196 | /** |
4170 | * dev_set_mtu - Change maximum transfer unit | 4197 | * dev_set_mtu - Change maximum transfer unit |
@@ -4198,6 +4225,7 @@ int dev_set_mtu(struct net_device *dev, int new_mtu) | |||
4198 | call_netdevice_notifiers(NETDEV_CHANGEMTU, dev); | 4225 | call_netdevice_notifiers(NETDEV_CHANGEMTU, dev); |
4199 | return err; | 4226 | return err; |
4200 | } | 4227 | } |
4228 | EXPORT_SYMBOL(dev_set_mtu); | ||
4201 | 4229 | ||
4202 | /** | 4230 | /** |
4203 | * dev_set_mac_address - Change Media Access Control Address | 4231 | * dev_set_mac_address - Change Media Access Control Address |
@@ -4222,6 +4250,7 @@ int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa) | |||
4222 | call_netdevice_notifiers(NETDEV_CHANGEADDR, dev); | 4250 | call_netdevice_notifiers(NETDEV_CHANGEADDR, dev); |
4223 | return err; | 4251 | return err; |
4224 | } | 4252 | } |
4253 | EXPORT_SYMBOL(dev_set_mac_address); | ||
4225 | 4254 | ||
4226 | /* | 4255 | /* |
4227 | * Perform the SIOCxIFxxx calls, inside read_lock(dev_base_lock) | 4256 | * Perform the SIOCxIFxxx calls, inside read_lock(dev_base_lock) |
@@ -4235,56 +4264,56 @@ static int dev_ifsioc_locked(struct net *net, struct ifreq *ifr, unsigned int cm | |||
4235 | return -ENODEV; | 4264 | return -ENODEV; |
4236 | 4265 | ||
4237 | switch (cmd) { | 4266 | switch (cmd) { |
4238 | case SIOCGIFFLAGS: /* Get interface flags */ | 4267 | case SIOCGIFFLAGS: /* Get interface flags */ |
4239 | ifr->ifr_flags = (short) dev_get_flags(dev); | 4268 | ifr->ifr_flags = (short) dev_get_flags(dev); |
4240 | return 0; | 4269 | return 0; |
4241 | 4270 | ||
4242 | case SIOCGIFMETRIC: /* Get the metric on the interface | 4271 | case SIOCGIFMETRIC: /* Get the metric on the interface |
4243 | (currently unused) */ | 4272 | (currently unused) */ |
4244 | ifr->ifr_metric = 0; | 4273 | ifr->ifr_metric = 0; |
4245 | return 0; | 4274 | return 0; |
4246 | 4275 | ||
4247 | case SIOCGIFMTU: /* Get the MTU of a device */ | 4276 | case SIOCGIFMTU: /* Get the MTU of a device */ |
4248 | ifr->ifr_mtu = dev->mtu; | 4277 | ifr->ifr_mtu = dev->mtu; |
4249 | return 0; | 4278 | return 0; |
4250 | 4279 | ||
4251 | case SIOCGIFHWADDR: | 4280 | case SIOCGIFHWADDR: |
4252 | if (!dev->addr_len) | 4281 | if (!dev->addr_len) |
4253 | memset(ifr->ifr_hwaddr.sa_data, 0, sizeof ifr->ifr_hwaddr.sa_data); | 4282 | memset(ifr->ifr_hwaddr.sa_data, 0, sizeof ifr->ifr_hwaddr.sa_data); |
4254 | else | 4283 | else |
4255 | memcpy(ifr->ifr_hwaddr.sa_data, dev->dev_addr, | 4284 | memcpy(ifr->ifr_hwaddr.sa_data, dev->dev_addr, |
4256 | min(sizeof ifr->ifr_hwaddr.sa_data, (size_t) dev->addr_len)); | 4285 | min(sizeof ifr->ifr_hwaddr.sa_data, (size_t) dev->addr_len)); |
4257 | ifr->ifr_hwaddr.sa_family = dev->type; | 4286 | ifr->ifr_hwaddr.sa_family = dev->type; |
4258 | return 0; | 4287 | return 0; |
4259 | 4288 | ||
4260 | case SIOCGIFSLAVE: | 4289 | case SIOCGIFSLAVE: |
4261 | err = -EINVAL; | 4290 | err = -EINVAL; |
4262 | break; | 4291 | break; |
4263 | 4292 | ||
4264 | case SIOCGIFMAP: | 4293 | case SIOCGIFMAP: |
4265 | ifr->ifr_map.mem_start = dev->mem_start; | 4294 | ifr->ifr_map.mem_start = dev->mem_start; |
4266 | ifr->ifr_map.mem_end = dev->mem_end; | 4295 | ifr->ifr_map.mem_end = dev->mem_end; |
4267 | ifr->ifr_map.base_addr = dev->base_addr; | 4296 | ifr->ifr_map.base_addr = dev->base_addr; |
4268 | ifr->ifr_map.irq = dev->irq; | 4297 | ifr->ifr_map.irq = dev->irq; |
4269 | ifr->ifr_map.dma = dev->dma; | 4298 | ifr->ifr_map.dma = dev->dma; |
4270 | ifr->ifr_map.port = dev->if_port; | 4299 | ifr->ifr_map.port = dev->if_port; |
4271 | return 0; | 4300 | return 0; |
4272 | 4301 | ||
4273 | case SIOCGIFINDEX: | 4302 | case SIOCGIFINDEX: |
4274 | ifr->ifr_ifindex = dev->ifindex; | 4303 | ifr->ifr_ifindex = dev->ifindex; |
4275 | return 0; | 4304 | return 0; |
4276 | 4305 | ||
4277 | case SIOCGIFTXQLEN: | 4306 | case SIOCGIFTXQLEN: |
4278 | ifr->ifr_qlen = dev->tx_queue_len; | 4307 | ifr->ifr_qlen = dev->tx_queue_len; |
4279 | return 0; | 4308 | return 0; |
4280 | 4309 | ||
4281 | default: | 4310 | default: |
4282 | /* dev_ioctl() should ensure this case | 4311 | /* dev_ioctl() should ensure this case |
4283 | * is never reached | 4312 | * is never reached |
4284 | */ | 4313 | */ |
4285 | WARN_ON(1); | 4314 | WARN_ON(1); |
4286 | err = -EINVAL; | 4315 | err = -EINVAL; |
4287 | break; | 4316 | break; |
4288 | 4317 | ||
4289 | } | 4318 | } |
4290 | return err; | 4319 | return err; |
@@ -4305,92 +4334,91 @@ static int dev_ifsioc(struct net *net, struct ifreq *ifr, unsigned int cmd) | |||
4305 | ops = dev->netdev_ops; | 4334 | ops = dev->netdev_ops; |
4306 | 4335 | ||
4307 | switch (cmd) { | 4336 | switch (cmd) { |
4308 | case SIOCSIFFLAGS: /* Set interface flags */ | 4337 | case SIOCSIFFLAGS: /* Set interface flags */ |
4309 | return dev_change_flags(dev, ifr->ifr_flags); | 4338 | return dev_change_flags(dev, ifr->ifr_flags); |
4310 | |||
4311 | case SIOCSIFMETRIC: /* Set the metric on the interface | ||
4312 | (currently unused) */ | ||
4313 | return -EOPNOTSUPP; | ||
4314 | |||
4315 | case SIOCSIFMTU: /* Set the MTU of a device */ | ||
4316 | return dev_set_mtu(dev, ifr->ifr_mtu); | ||
4317 | 4339 | ||
4318 | case SIOCSIFHWADDR: | 4340 | case SIOCSIFMETRIC: /* Set the metric on the interface |
4319 | return dev_set_mac_address(dev, &ifr->ifr_hwaddr); | 4341 | (currently unused) */ |
4342 | return -EOPNOTSUPP; | ||
4320 | 4343 | ||
4321 | case SIOCSIFHWBROADCAST: | 4344 | case SIOCSIFMTU: /* Set the MTU of a device */ |
4322 | if (ifr->ifr_hwaddr.sa_family != dev->type) | 4345 | return dev_set_mtu(dev, ifr->ifr_mtu); |
4323 | return -EINVAL; | ||
4324 | memcpy(dev->broadcast, ifr->ifr_hwaddr.sa_data, | ||
4325 | min(sizeof ifr->ifr_hwaddr.sa_data, (size_t) dev->addr_len)); | ||
4326 | call_netdevice_notifiers(NETDEV_CHANGEADDR, dev); | ||
4327 | return 0; | ||
4328 | 4346 | ||
4329 | case SIOCSIFMAP: | 4347 | case SIOCSIFHWADDR: |
4330 | if (ops->ndo_set_config) { | 4348 | return dev_set_mac_address(dev, &ifr->ifr_hwaddr); |
4331 | if (!netif_device_present(dev)) | ||
4332 | return -ENODEV; | ||
4333 | return ops->ndo_set_config(dev, &ifr->ifr_map); | ||
4334 | } | ||
4335 | return -EOPNOTSUPP; | ||
4336 | 4349 | ||
4337 | case SIOCADDMULTI: | 4350 | case SIOCSIFHWBROADCAST: |
4338 | if ((!ops->ndo_set_multicast_list && !ops->ndo_set_rx_mode) || | 4351 | if (ifr->ifr_hwaddr.sa_family != dev->type) |
4339 | ifr->ifr_hwaddr.sa_family != AF_UNSPEC) | 4352 | return -EINVAL; |
4340 | return -EINVAL; | 4353 | memcpy(dev->broadcast, ifr->ifr_hwaddr.sa_data, |
4341 | if (!netif_device_present(dev)) | 4354 | min(sizeof ifr->ifr_hwaddr.sa_data, (size_t) dev->addr_len)); |
4342 | return -ENODEV; | 4355 | call_netdevice_notifiers(NETDEV_CHANGEADDR, dev); |
4343 | return dev_mc_add(dev, ifr->ifr_hwaddr.sa_data, | 4356 | return 0; |
4344 | dev->addr_len, 1); | ||
4345 | 4357 | ||
4346 | case SIOCDELMULTI: | 4358 | case SIOCSIFMAP: |
4347 | if ((!ops->ndo_set_multicast_list && !ops->ndo_set_rx_mode) || | 4359 | if (ops->ndo_set_config) { |
4348 | ifr->ifr_hwaddr.sa_family != AF_UNSPEC) | ||
4349 | return -EINVAL; | ||
4350 | if (!netif_device_present(dev)) | 4360 | if (!netif_device_present(dev)) |
4351 | return -ENODEV; | 4361 | return -ENODEV; |
4352 | return dev_mc_delete(dev, ifr->ifr_hwaddr.sa_data, | 4362 | return ops->ndo_set_config(dev, &ifr->ifr_map); |
4353 | dev->addr_len, 1); | 4363 | } |
4364 | return -EOPNOTSUPP; | ||
4354 | 4365 | ||
4355 | case SIOCSIFTXQLEN: | 4366 | case SIOCADDMULTI: |
4356 | if (ifr->ifr_qlen < 0) | 4367 | if ((!ops->ndo_set_multicast_list && !ops->ndo_set_rx_mode) || |
4357 | return -EINVAL; | 4368 | ifr->ifr_hwaddr.sa_family != AF_UNSPEC) |
4358 | dev->tx_queue_len = ifr->ifr_qlen; | 4369 | return -EINVAL; |
4359 | return 0; | 4370 | if (!netif_device_present(dev)) |
4371 | return -ENODEV; | ||
4372 | return dev_mc_add(dev, ifr->ifr_hwaddr.sa_data, | ||
4373 | dev->addr_len, 1); | ||
4374 | |||
4375 | case SIOCDELMULTI: | ||
4376 | if ((!ops->ndo_set_multicast_list && !ops->ndo_set_rx_mode) || | ||
4377 | ifr->ifr_hwaddr.sa_family != AF_UNSPEC) | ||
4378 | return -EINVAL; | ||
4379 | if (!netif_device_present(dev)) | ||
4380 | return -ENODEV; | ||
4381 | return dev_mc_delete(dev, ifr->ifr_hwaddr.sa_data, | ||
4382 | dev->addr_len, 1); | ||
4360 | 4383 | ||
4361 | case SIOCSIFNAME: | 4384 | case SIOCSIFTXQLEN: |
4362 | ifr->ifr_newname[IFNAMSIZ-1] = '\0'; | 4385 | if (ifr->ifr_qlen < 0) |
4363 | return dev_change_name(dev, ifr->ifr_newname); | 4386 | return -EINVAL; |
4387 | dev->tx_queue_len = ifr->ifr_qlen; | ||
4388 | return 0; | ||
4364 | 4389 | ||
4365 | /* | 4390 | case SIOCSIFNAME: |
4366 | * Unknown or private ioctl | 4391 | ifr->ifr_newname[IFNAMSIZ-1] = '\0'; |
4367 | */ | 4392 | return dev_change_name(dev, ifr->ifr_newname); |
4368 | 4393 | ||
4369 | default: | 4394 | /* |
4370 | if ((cmd >= SIOCDEVPRIVATE && | 4395 | * Unknown or private ioctl |
4371 | cmd <= SIOCDEVPRIVATE + 15) || | 4396 | */ |
4372 | cmd == SIOCBONDENSLAVE || | 4397 | default: |
4373 | cmd == SIOCBONDRELEASE || | 4398 | if ((cmd >= SIOCDEVPRIVATE && |
4374 | cmd == SIOCBONDSETHWADDR || | 4399 | cmd <= SIOCDEVPRIVATE + 15) || |
4375 | cmd == SIOCBONDSLAVEINFOQUERY || | 4400 | cmd == SIOCBONDENSLAVE || |
4376 | cmd == SIOCBONDINFOQUERY || | 4401 | cmd == SIOCBONDRELEASE || |
4377 | cmd == SIOCBONDCHANGEACTIVE || | 4402 | cmd == SIOCBONDSETHWADDR || |
4378 | cmd == SIOCGMIIPHY || | 4403 | cmd == SIOCBONDSLAVEINFOQUERY || |
4379 | cmd == SIOCGMIIREG || | 4404 | cmd == SIOCBONDINFOQUERY || |
4380 | cmd == SIOCSMIIREG || | 4405 | cmd == SIOCBONDCHANGEACTIVE || |
4381 | cmd == SIOCBRADDIF || | 4406 | cmd == SIOCGMIIPHY || |
4382 | cmd == SIOCBRDELIF || | 4407 | cmd == SIOCGMIIREG || |
4383 | cmd == SIOCSHWTSTAMP || | 4408 | cmd == SIOCSMIIREG || |
4384 | cmd == SIOCWANDEV) { | 4409 | cmd == SIOCBRADDIF || |
4385 | err = -EOPNOTSUPP; | 4410 | cmd == SIOCBRDELIF || |
4386 | if (ops->ndo_do_ioctl) { | 4411 | cmd == SIOCSHWTSTAMP || |
4387 | if (netif_device_present(dev)) | 4412 | cmd == SIOCWANDEV) { |
4388 | err = ops->ndo_do_ioctl(dev, ifr, cmd); | 4413 | err = -EOPNOTSUPP; |
4389 | else | 4414 | if (ops->ndo_do_ioctl) { |
4390 | err = -ENODEV; | 4415 | if (netif_device_present(dev)) |
4391 | } | 4416 | err = ops->ndo_do_ioctl(dev, ifr, cmd); |
4392 | } else | 4417 | else |
4393 | err = -EINVAL; | 4418 | err = -ENODEV; |
4419 | } | ||
4420 | } else | ||
4421 | err = -EINVAL; | ||
4394 | 4422 | ||
4395 | } | 4423 | } |
4396 | return err; | 4424 | return err; |
@@ -4447,135 +4475,135 @@ int dev_ioctl(struct net *net, unsigned int cmd, void __user *arg) | |||
4447 | */ | 4475 | */ |
4448 | 4476 | ||
4449 | switch (cmd) { | 4477 | switch (cmd) { |
4450 | /* | 4478 | /* |
4451 | * These ioctl calls: | 4479 | * These ioctl calls: |
4452 | * - can be done by all. | 4480 | * - can be done by all. |
4453 | * - atomic and do not require locking. | 4481 | * - atomic and do not require locking. |
4454 | * - return a value | 4482 | * - return a value |
4455 | */ | 4483 | */ |
4456 | case SIOCGIFFLAGS: | 4484 | case SIOCGIFFLAGS: |
4457 | case SIOCGIFMETRIC: | 4485 | case SIOCGIFMETRIC: |
4458 | case SIOCGIFMTU: | 4486 | case SIOCGIFMTU: |
4459 | case SIOCGIFHWADDR: | 4487 | case SIOCGIFHWADDR: |
4460 | case SIOCGIFSLAVE: | 4488 | case SIOCGIFSLAVE: |
4461 | case SIOCGIFMAP: | 4489 | case SIOCGIFMAP: |
4462 | case SIOCGIFINDEX: | 4490 | case SIOCGIFINDEX: |
4463 | case SIOCGIFTXQLEN: | 4491 | case SIOCGIFTXQLEN: |
4464 | dev_load(net, ifr.ifr_name); | 4492 | dev_load(net, ifr.ifr_name); |
4465 | read_lock(&dev_base_lock); | 4493 | read_lock(&dev_base_lock); |
4466 | ret = dev_ifsioc_locked(net, &ifr, cmd); | 4494 | ret = dev_ifsioc_locked(net, &ifr, cmd); |
4467 | read_unlock(&dev_base_lock); | 4495 | read_unlock(&dev_base_lock); |
4468 | if (!ret) { | 4496 | if (!ret) { |
4469 | if (colon) | 4497 | if (colon) |
4470 | *colon = ':'; | 4498 | *colon = ':'; |
4471 | if (copy_to_user(arg, &ifr, | 4499 | if (copy_to_user(arg, &ifr, |
4472 | sizeof(struct ifreq))) | 4500 | sizeof(struct ifreq))) |
4473 | ret = -EFAULT; | 4501 | ret = -EFAULT; |
4474 | } | 4502 | } |
4475 | return ret; | 4503 | return ret; |
4476 | 4504 | ||
4477 | case SIOCETHTOOL: | 4505 | case SIOCETHTOOL: |
4478 | dev_load(net, ifr.ifr_name); | 4506 | dev_load(net, ifr.ifr_name); |
4479 | rtnl_lock(); | 4507 | rtnl_lock(); |
4480 | ret = dev_ethtool(net, &ifr); | 4508 | ret = dev_ethtool(net, &ifr); |
4481 | rtnl_unlock(); | 4509 | rtnl_unlock(); |
4482 | if (!ret) { | 4510 | if (!ret) { |
4483 | if (colon) | 4511 | if (colon) |
4484 | *colon = ':'; | 4512 | *colon = ':'; |
4485 | if (copy_to_user(arg, &ifr, | 4513 | if (copy_to_user(arg, &ifr, |
4486 | sizeof(struct ifreq))) | 4514 | sizeof(struct ifreq))) |
4487 | ret = -EFAULT; | 4515 | ret = -EFAULT; |
4488 | } | 4516 | } |
4489 | return ret; | 4517 | return ret; |
4490 | 4518 | ||
4491 | /* | 4519 | /* |
4492 | * These ioctl calls: | 4520 | * These ioctl calls: |
4493 | * - require superuser power. | 4521 | * - require superuser power. |
4494 | * - require strict serialization. | 4522 | * - require strict serialization. |
4495 | * - return a value | 4523 | * - return a value |
4496 | */ | 4524 | */ |
4497 | case SIOCGMIIPHY: | 4525 | case SIOCGMIIPHY: |
4498 | case SIOCGMIIREG: | 4526 | case SIOCGMIIREG: |
4499 | case SIOCSIFNAME: | 4527 | case SIOCSIFNAME: |
4500 | if (!capable(CAP_NET_ADMIN)) | 4528 | if (!capable(CAP_NET_ADMIN)) |
4501 | return -EPERM; | 4529 | return -EPERM; |
4502 | dev_load(net, ifr.ifr_name); | 4530 | dev_load(net, ifr.ifr_name); |
4503 | rtnl_lock(); | 4531 | rtnl_lock(); |
4504 | ret = dev_ifsioc(net, &ifr, cmd); | 4532 | ret = dev_ifsioc(net, &ifr, cmd); |
4505 | rtnl_unlock(); | 4533 | rtnl_unlock(); |
4506 | if (!ret) { | 4534 | if (!ret) { |
4507 | if (colon) | 4535 | if (colon) |
4508 | *colon = ':'; | 4536 | *colon = ':'; |
4509 | if (copy_to_user(arg, &ifr, | 4537 | if (copy_to_user(arg, &ifr, |
4510 | sizeof(struct ifreq))) | 4538 | sizeof(struct ifreq))) |
4511 | ret = -EFAULT; | 4539 | ret = -EFAULT; |
4512 | } | 4540 | } |
4513 | return ret; | 4541 | return ret; |
4514 | 4542 | ||
4515 | /* | 4543 | /* |
4516 | * These ioctl calls: | 4544 | * These ioctl calls: |
4517 | * - require superuser power. | 4545 | * - require superuser power. |
4518 | * - require strict serialization. | 4546 | * - require strict serialization. |
4519 | * - do not return a value | 4547 | * - do not return a value |
4520 | */ | 4548 | */ |
4521 | case SIOCSIFFLAGS: | 4549 | case SIOCSIFFLAGS: |
4522 | case SIOCSIFMETRIC: | 4550 | case SIOCSIFMETRIC: |
4523 | case SIOCSIFMTU: | 4551 | case SIOCSIFMTU: |
4524 | case SIOCSIFMAP: | 4552 | case SIOCSIFMAP: |
4525 | case SIOCSIFHWADDR: | 4553 | case SIOCSIFHWADDR: |
4526 | case SIOCSIFSLAVE: | 4554 | case SIOCSIFSLAVE: |
4527 | case SIOCADDMULTI: | 4555 | case SIOCADDMULTI: |
4528 | case SIOCDELMULTI: | 4556 | case SIOCDELMULTI: |
4529 | case SIOCSIFHWBROADCAST: | 4557 | case SIOCSIFHWBROADCAST: |
4530 | case SIOCSIFTXQLEN: | 4558 | case SIOCSIFTXQLEN: |
4531 | case SIOCSMIIREG: | 4559 | case SIOCSMIIREG: |
4532 | case SIOCBONDENSLAVE: | 4560 | case SIOCBONDENSLAVE: |
4533 | case SIOCBONDRELEASE: | 4561 | case SIOCBONDRELEASE: |
4534 | case SIOCBONDSETHWADDR: | 4562 | case SIOCBONDSETHWADDR: |
4535 | case SIOCBONDCHANGEACTIVE: | 4563 | case SIOCBONDCHANGEACTIVE: |
4536 | case SIOCBRADDIF: | 4564 | case SIOCBRADDIF: |
4537 | case SIOCBRDELIF: | 4565 | case SIOCBRDELIF: |
4538 | case SIOCSHWTSTAMP: | 4566 | case SIOCSHWTSTAMP: |
4539 | if (!capable(CAP_NET_ADMIN)) | 4567 | if (!capable(CAP_NET_ADMIN)) |
4540 | return -EPERM; | 4568 | return -EPERM; |
4541 | /* fall through */ | 4569 | /* fall through */ |
4542 | case SIOCBONDSLAVEINFOQUERY: | 4570 | case SIOCBONDSLAVEINFOQUERY: |
4543 | case SIOCBONDINFOQUERY: | 4571 | case SIOCBONDINFOQUERY: |
4572 | dev_load(net, ifr.ifr_name); | ||
4573 | rtnl_lock(); | ||
4574 | ret = dev_ifsioc(net, &ifr, cmd); | ||
4575 | rtnl_unlock(); | ||
4576 | return ret; | ||
4577 | |||
4578 | case SIOCGIFMEM: | ||
4579 | /* Get the per device memory space. We can add this but | ||
4580 | * currently do not support it */ | ||
4581 | case SIOCSIFMEM: | ||
4582 | /* Set the per device memory buffer space. | ||
4583 | * Not applicable in our case */ | ||
4584 | case SIOCSIFLINK: | ||
4585 | return -EINVAL; | ||
4586 | |||
4587 | /* | ||
4588 | * Unknown or private ioctl. | ||
4589 | */ | ||
4590 | default: | ||
4591 | if (cmd == SIOCWANDEV || | ||
4592 | (cmd >= SIOCDEVPRIVATE && | ||
4593 | cmd <= SIOCDEVPRIVATE + 15)) { | ||
4544 | dev_load(net, ifr.ifr_name); | 4594 | dev_load(net, ifr.ifr_name); |
4545 | rtnl_lock(); | 4595 | rtnl_lock(); |
4546 | ret = dev_ifsioc(net, &ifr, cmd); | 4596 | ret = dev_ifsioc(net, &ifr, cmd); |
4547 | rtnl_unlock(); | 4597 | rtnl_unlock(); |
4598 | if (!ret && copy_to_user(arg, &ifr, | ||
4599 | sizeof(struct ifreq))) | ||
4600 | ret = -EFAULT; | ||
4548 | return ret; | 4601 | return ret; |
4549 | 4602 | } | |
4550 | case SIOCGIFMEM: | 4603 | /* Take care of Wireless Extensions */ |
4551 | /* Get the per device memory space. We can add this but | 4604 | if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) |
4552 | * currently do not support it */ | 4605 | return wext_handle_ioctl(net, &ifr, cmd, arg); |
4553 | case SIOCSIFMEM: | 4606 | return -EINVAL; |
4554 | /* Set the per device memory buffer space. | ||
4555 | * Not applicable in our case */ | ||
4556 | case SIOCSIFLINK: | ||
4557 | return -EINVAL; | ||
4558 | |||
4559 | /* | ||
4560 | * Unknown or private ioctl. | ||
4561 | */ | ||
4562 | default: | ||
4563 | if (cmd == SIOCWANDEV || | ||
4564 | (cmd >= SIOCDEVPRIVATE && | ||
4565 | cmd <= SIOCDEVPRIVATE + 15)) { | ||
4566 | dev_load(net, ifr.ifr_name); | ||
4567 | rtnl_lock(); | ||
4568 | ret = dev_ifsioc(net, &ifr, cmd); | ||
4569 | rtnl_unlock(); | ||
4570 | if (!ret && copy_to_user(arg, &ifr, | ||
4571 | sizeof(struct ifreq))) | ||
4572 | ret = -EFAULT; | ||
4573 | return ret; | ||
4574 | } | ||
4575 | /* Take care of Wireless Extensions */ | ||
4576 | if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) | ||
4577 | return wext_handle_ioctl(net, &ifr, cmd, arg); | ||
4578 | return -EINVAL; | ||
4579 | } | 4607 | } |
4580 | } | 4608 | } |
4581 | 4609 | ||
@@ -4840,6 +4868,7 @@ err_uninit: | |||
4840 | dev->netdev_ops->ndo_uninit(dev); | 4868 | dev->netdev_ops->ndo_uninit(dev); |
4841 | goto out; | 4869 | goto out; |
4842 | } | 4870 | } |
4871 | EXPORT_SYMBOL(register_netdevice); | ||
4843 | 4872 | ||
4844 | /** | 4873 | /** |
4845 | * init_dummy_netdev - init a dummy network device for NAPI | 4874 | * init_dummy_netdev - init a dummy network device for NAPI |
@@ -5126,6 +5155,8 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name, | |||
5126 | } | 5155 | } |
5127 | 5156 | ||
5128 | dev = PTR_ALIGN(p, NETDEV_ALIGN); | 5157 | dev = PTR_ALIGN(p, NETDEV_ALIGN); |
5158 | pr_err("%s dev=%p queue_count=%d tx=%p\n", name, dev, queue_count, tx); | ||
5159 | WARN_ON(queue_count == 1); | ||
5129 | dev->padded = (char *)dev - (char *)p; | 5160 | dev->padded = (char *)dev - (char *)p; |
5130 | 5161 | ||
5131 | if (dev_addr_init(dev)) | 5162 | if (dev_addr_init(dev)) |
@@ -5192,6 +5223,7 @@ void free_netdev(struct net_device *dev) | |||
5192 | /* will free via device release */ | 5223 | /* will free via device release */ |
5193 | put_device(&dev->dev); | 5224 | put_device(&dev->dev); |
5194 | } | 5225 | } |
5226 | EXPORT_SYMBOL(free_netdev); | ||
5195 | 5227 | ||
5196 | /** | 5228 | /** |
5197 | * synchronize_net - Synchronize with packet receive processing | 5229 | * synchronize_net - Synchronize with packet receive processing |
@@ -5204,6 +5236,7 @@ void synchronize_net(void) | |||
5204 | might_sleep(); | 5236 | might_sleep(); |
5205 | synchronize_rcu(); | 5237 | synchronize_rcu(); |
5206 | } | 5238 | } |
5239 | EXPORT_SYMBOL(synchronize_net); | ||
5207 | 5240 | ||
5208 | /** | 5241 | /** |
5209 | * unregister_netdevice - remove device from the kernel | 5242 | * unregister_netdevice - remove device from the kernel |
@@ -5224,6 +5257,7 @@ void unregister_netdevice(struct net_device *dev) | |||
5224 | /* Finish processing unregister after unlock */ | 5257 | /* Finish processing unregister after unlock */ |
5225 | net_set_todo(dev); | 5258 | net_set_todo(dev); |
5226 | } | 5259 | } |
5260 | EXPORT_SYMBOL(unregister_netdevice); | ||
5227 | 5261 | ||
5228 | /** | 5262 | /** |
5229 | * unregister_netdev - remove device from the kernel | 5263 | * unregister_netdev - remove device from the kernel |
@@ -5242,7 +5276,6 @@ void unregister_netdev(struct net_device *dev) | |||
5242 | unregister_netdevice(dev); | 5276 | unregister_netdevice(dev); |
5243 | rtnl_unlock(); | 5277 | rtnl_unlock(); |
5244 | } | 5278 | } |
5245 | |||
5246 | EXPORT_SYMBOL(unregister_netdev); | 5279 | EXPORT_SYMBOL(unregister_netdev); |
5247 | 5280 | ||
5248 | /** | 5281 | /** |
@@ -5432,7 +5465,7 @@ unsigned long netdev_increment_features(unsigned long all, unsigned long one, | |||
5432 | unsigned long mask) | 5465 | unsigned long mask) |
5433 | { | 5466 | { |
5434 | /* If device needs checksumming, downgrade to it. */ | 5467 | /* If device needs checksumming, downgrade to it. */ |
5435 | if (all & NETIF_F_NO_CSUM && !(one & NETIF_F_NO_CSUM)) | 5468 | if (all & NETIF_F_NO_CSUM && !(one & NETIF_F_NO_CSUM)) |
5436 | all ^= NETIF_F_NO_CSUM | (one & NETIF_F_ALL_CSUM); | 5469 | all ^= NETIF_F_NO_CSUM | (one & NETIF_F_ALL_CSUM); |
5437 | else if (mask & NETIF_F_ALL_CSUM) { | 5470 | else if (mask & NETIF_F_ALL_CSUM) { |
5438 | /* If one device supports v4/v6 checksumming, set for all. */ | 5471 | /* If one device supports v4/v6 checksumming, set for all. */ |
@@ -5658,41 +5691,3 @@ static int __init initialize_hashrnd(void) | |||
5658 | 5691 | ||
5659 | late_initcall_sync(initialize_hashrnd); | 5692 | late_initcall_sync(initialize_hashrnd); |
5660 | 5693 | ||
5661 | EXPORT_SYMBOL(__dev_get_by_index); | ||
5662 | EXPORT_SYMBOL(__dev_get_by_name); | ||
5663 | EXPORT_SYMBOL(__dev_remove_pack); | ||
5664 | EXPORT_SYMBOL(dev_valid_name); | ||
5665 | EXPORT_SYMBOL(dev_add_pack); | ||
5666 | EXPORT_SYMBOL(dev_alloc_name); | ||
5667 | EXPORT_SYMBOL(dev_close); | ||
5668 | EXPORT_SYMBOL(dev_get_by_flags); | ||
5669 | EXPORT_SYMBOL(dev_get_by_index); | ||
5670 | EXPORT_SYMBOL(dev_get_by_name); | ||
5671 | EXPORT_SYMBOL(dev_open); | ||
5672 | EXPORT_SYMBOL(dev_queue_xmit); | ||
5673 | EXPORT_SYMBOL(dev_remove_pack); | ||
5674 | EXPORT_SYMBOL(dev_set_allmulti); | ||
5675 | EXPORT_SYMBOL(dev_set_promiscuity); | ||
5676 | EXPORT_SYMBOL(dev_change_flags); | ||
5677 | EXPORT_SYMBOL(dev_set_mtu); | ||
5678 | EXPORT_SYMBOL(dev_set_mac_address); | ||
5679 | EXPORT_SYMBOL(free_netdev); | ||
5680 | EXPORT_SYMBOL(netdev_boot_setup_check); | ||
5681 | EXPORT_SYMBOL(netdev_set_master); | ||
5682 | EXPORT_SYMBOL(netdev_state_change); | ||
5683 | EXPORT_SYMBOL(netif_receive_skb); | ||
5684 | EXPORT_SYMBOL(netif_rx); | ||
5685 | EXPORT_SYMBOL(register_gifconf); | ||
5686 | EXPORT_SYMBOL(register_netdevice); | ||
5687 | EXPORT_SYMBOL(register_netdevice_notifier); | ||
5688 | EXPORT_SYMBOL(skb_checksum_help); | ||
5689 | EXPORT_SYMBOL(synchronize_net); | ||
5690 | EXPORT_SYMBOL(unregister_netdevice); | ||
5691 | EXPORT_SYMBOL(unregister_netdevice_notifier); | ||
5692 | EXPORT_SYMBOL(net_enable_timestamp); | ||
5693 | EXPORT_SYMBOL(net_disable_timestamp); | ||
5694 | EXPORT_SYMBOL(dev_get_flags); | ||
5695 | |||
5696 | EXPORT_SYMBOL(dev_load); | ||
5697 | |||
5698 | EXPORT_PER_CPU_SYMBOL(softnet_data); | ||