diff options
| author | Liam Girdwood <lrg@slimlogic.co.uk> | 2010-11-03 10:11:27 -0400 |
|---|---|---|
| committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2010-11-03 10:11:27 -0400 |
| commit | 8f987768eb99631374f4ab0bb19cd062baf1397d (patch) | |
| tree | b89aa5c207f7ba6a688f45657424b937f17ceb8a /include/linux/netdevice.h | |
| parent | 63f7526f26f0a9291ac3f7a986aa18ebfb61ec19 (diff) | |
| parent | c8ddb2713c624f432fa5fe3c7ecffcdda46ea0d4 (diff) | |
Merge commit 'v2.6.37-rc1' into for-2.6.37
Diffstat (limited to 'include/linux/netdevice.h')
| -rw-r--r-- | include/linux/netdevice.h | 136 |
1 files changed, 98 insertions, 38 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 46c36ffe20ee..072652d94d9f 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -228,9 +228,9 @@ struct netdev_hw_addr { | |||
| 228 | #define NETDEV_HW_ADDR_T_SLAVE 3 | 228 | #define NETDEV_HW_ADDR_T_SLAVE 3 |
| 229 | #define NETDEV_HW_ADDR_T_UNICAST 4 | 229 | #define NETDEV_HW_ADDR_T_UNICAST 4 |
| 230 | #define NETDEV_HW_ADDR_T_MULTICAST 5 | 230 | #define NETDEV_HW_ADDR_T_MULTICAST 5 |
| 231 | int refcount; | ||
| 232 | bool synced; | 231 | bool synced; |
| 233 | bool global_use; | 232 | bool global_use; |
| 233 | int refcount; | ||
| 234 | struct rcu_head rcu_head; | 234 | struct rcu_head rcu_head; |
| 235 | }; | 235 | }; |
| 236 | 236 | ||
| @@ -281,6 +281,12 @@ struct hh_cache { | |||
| 281 | unsigned long hh_data[HH_DATA_ALIGN(LL_MAX_HEADER) / sizeof(long)]; | 281 | unsigned long hh_data[HH_DATA_ALIGN(LL_MAX_HEADER) / sizeof(long)]; |
| 282 | }; | 282 | }; |
| 283 | 283 | ||
| 284 | static inline void hh_cache_put(struct hh_cache *hh) | ||
| 285 | { | ||
| 286 | if (atomic_dec_and_test(&hh->hh_refcnt)) | ||
| 287 | kfree(hh); | ||
| 288 | } | ||
| 289 | |||
| 284 | /* Reserve HH_DATA_MOD byte aligned hard_header_len, but at least that much. | 290 | /* Reserve HH_DATA_MOD byte aligned hard_header_len, but at least that much. |
| 285 | * Alternative is: | 291 | * Alternative is: |
| 286 | * dev->hard_header_len ? (dev->hard_header_len + | 292 | * dev->hard_header_len ? (dev->hard_header_len + |
| @@ -579,15 +585,15 @@ static inline void rps_reset_sock_flow(struct rps_sock_flow_table *table, | |||
| 579 | table->ents[hash & table->mask] = RPS_NO_CPU; | 585 | table->ents[hash & table->mask] = RPS_NO_CPU; |
| 580 | } | 586 | } |
| 581 | 587 | ||
| 582 | extern struct rps_sock_flow_table *rps_sock_flow_table; | 588 | extern struct rps_sock_flow_table __rcu *rps_sock_flow_table; |
| 583 | 589 | ||
| 584 | /* This structure contains an instance of an RX queue. */ | 590 | /* This structure contains an instance of an RX queue. */ |
| 585 | struct netdev_rx_queue { | 591 | struct netdev_rx_queue { |
| 586 | struct rps_map *rps_map; | 592 | struct rps_map __rcu *rps_map; |
| 587 | struct rps_dev_flow_table *rps_flow_table; | 593 | struct rps_dev_flow_table __rcu *rps_flow_table; |
| 588 | struct kobject kobj; | 594 | struct kobject kobj; |
| 589 | struct netdev_rx_queue *first; | 595 | struct netdev_rx_queue *first; |
| 590 | atomic_t count; | 596 | atomic_t count; |
| 591 | } ____cacheline_aligned_in_smp; | 597 | } ____cacheline_aligned_in_smp; |
| 592 | #endif /* CONFIG_RPS */ | 598 | #endif /* CONFIG_RPS */ |
| 593 | 599 | ||
| @@ -884,6 +890,9 @@ struct net_device { | |||
| 884 | int iflink; | 890 | int iflink; |
| 885 | 891 | ||
| 886 | struct net_device_stats stats; | 892 | struct net_device_stats stats; |
| 893 | atomic_long_t rx_dropped; /* dropped packets by core network | ||
| 894 | * Do not use this in drivers. | ||
| 895 | */ | ||
| 887 | 896 | ||
| 888 | #ifdef CONFIG_WIRELESS_EXT | 897 | #ifdef CONFIG_WIRELESS_EXT |
| 889 | /* List of functions to handle Wireless Extensions (instead of ioctl). | 898 | /* List of functions to handle Wireless Extensions (instead of ioctl). |
| @@ -901,7 +910,7 @@ struct net_device { | |||
| 901 | 910 | ||
| 902 | unsigned int flags; /* interface flags (a la BSD) */ | 911 | unsigned int flags; /* interface flags (a la BSD) */ |
| 903 | unsigned short gflags; | 912 | unsigned short gflags; |
| 904 | unsigned short priv_flags; /* Like 'flags' but invisible to userspace. */ | 913 | unsigned int priv_flags; /* Like 'flags' but invisible to userspace. */ |
| 905 | unsigned short padded; /* How much padding added by alloc_netdev() */ | 914 | unsigned short padded; /* How much padding added by alloc_netdev() */ |
| 906 | 915 | ||
| 907 | unsigned char operstate; /* RFC2863 operstate */ | 916 | unsigned char operstate; /* RFC2863 operstate */ |
| @@ -918,10 +927,6 @@ struct net_device { | |||
| 918 | unsigned short needed_headroom; | 927 | unsigned short needed_headroom; |
| 919 | unsigned short needed_tailroom; | 928 | unsigned short needed_tailroom; |
| 920 | 929 | ||
| 921 | struct net_device *master; /* Pointer to master device of a group, | ||
| 922 | * which this device is member of. | ||
| 923 | */ | ||
| 924 | |||
| 925 | /* Interface address info. */ | 930 | /* Interface address info. */ |
| 926 | unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */ | 931 | unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */ |
| 927 | unsigned char addr_assign_type; /* hw address assignment type */ | 932 | unsigned char addr_assign_type; /* hw address assignment type */ |
| @@ -937,23 +942,37 @@ struct net_device { | |||
| 937 | 942 | ||
| 938 | 943 | ||
| 939 | /* Protocol specific pointers */ | 944 | /* Protocol specific pointers */ |
| 940 | 945 | ||
| 946 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) | ||
| 947 | struct vlan_group __rcu *vlgrp; /* VLAN group */ | ||
| 948 | #endif | ||
| 941 | #ifdef CONFIG_NET_DSA | 949 | #ifdef CONFIG_NET_DSA |
| 942 | void *dsa_ptr; /* dsa specific data */ | 950 | void *dsa_ptr; /* dsa specific data */ |
| 943 | #endif | 951 | #endif |
| 944 | void *atalk_ptr; /* AppleTalk link */ | 952 | void *atalk_ptr; /* AppleTalk link */ |
| 945 | void *ip_ptr; /* IPv4 specific data */ | 953 | struct in_device __rcu *ip_ptr; /* IPv4 specific data */ |
| 946 | void *dn_ptr; /* DECnet specific data */ | 954 | void *dn_ptr; /* DECnet specific data */ |
| 947 | void *ip6_ptr; /* IPv6 specific data */ | 955 | struct inet6_dev __rcu *ip6_ptr; /* IPv6 specific data */ |
| 948 | void *ec_ptr; /* Econet specific data */ | 956 | void *ec_ptr; /* Econet specific data */ |
| 949 | void *ax25_ptr; /* AX.25 specific data */ | 957 | void *ax25_ptr; /* AX.25 specific data */ |
| 950 | struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data, | 958 | struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data, |
| 951 | assign before registering */ | 959 | assign before registering */ |
| 952 | 960 | ||
| 953 | /* | 961 | /* |
| 954 | * Cache line mostly used on receive path (including eth_type_trans()) | 962 | * Cache lines mostly used on receive path (including eth_type_trans()) |
| 955 | */ | 963 | */ |
| 956 | unsigned long last_rx; /* Time of last Rx */ | 964 | unsigned long last_rx; /* Time of last Rx |
| 965 | * This should not be set in | ||
| 966 | * drivers, unless really needed, | ||
| 967 | * because network stack (bonding) | ||
| 968 | * use it if/when necessary, to | ||
| 969 | * avoid dirtying this cache line. | ||
| 970 | */ | ||
| 971 | |||
| 972 | struct net_device *master; /* Pointer to master device of a group, | ||
| 973 | * which this device is member of. | ||
| 974 | */ | ||
| 975 | |||
| 957 | /* Interface address info used in eth_type_trans() */ | 976 | /* Interface address info used in eth_type_trans() */ |
| 958 | unsigned char *dev_addr; /* hw address, (before bcast | 977 | unsigned char *dev_addr; /* hw address, (before bcast |
| 959 | because most packets are | 978 | because most packets are |
| @@ -969,14 +988,21 @@ struct net_device { | |||
| 969 | 988 | ||
| 970 | struct netdev_rx_queue *_rx; | 989 | struct netdev_rx_queue *_rx; |
| 971 | 990 | ||
| 972 | /* Number of RX queues allocated at alloc_netdev_mq() time */ | 991 | /* Number of RX queues allocated at register_netdev() time */ |
| 973 | unsigned int num_rx_queues; | 992 | unsigned int num_rx_queues; |
| 993 | |||
| 994 | /* Number of RX queues currently active in device */ | ||
| 995 | unsigned int real_num_rx_queues; | ||
| 974 | #endif | 996 | #endif |
| 975 | 997 | ||
| 976 | struct netdev_queue rx_queue; | ||
| 977 | rx_handler_func_t *rx_handler; | 998 | rx_handler_func_t *rx_handler; |
| 978 | void *rx_handler_data; | 999 | void *rx_handler_data; |
| 979 | 1000 | ||
| 1001 | struct netdev_queue __rcu *ingress_queue; | ||
| 1002 | |||
| 1003 | /* | ||
| 1004 | * Cache lines mostly used on transmit path | ||
| 1005 | */ | ||
| 980 | struct netdev_queue *_tx ____cacheline_aligned_in_smp; | 1006 | struct netdev_queue *_tx ____cacheline_aligned_in_smp; |
| 981 | 1007 | ||
| 982 | /* Number of TX queues allocated at alloc_netdev_mq() time */ | 1008 | /* Number of TX queues allocated at alloc_netdev_mq() time */ |
| @@ -990,9 +1016,7 @@ struct net_device { | |||
| 990 | 1016 | ||
| 991 | unsigned long tx_queue_len; /* Max frames per queue allowed */ | 1017 | unsigned long tx_queue_len; /* Max frames per queue allowed */ |
| 992 | spinlock_t tx_global_lock; | 1018 | spinlock_t tx_global_lock; |
| 993 | /* | 1019 | |
| 994 | * One part is mostly used on xmit path (device) | ||
| 995 | */ | ||
| 996 | /* These may be needed for future network-power-down code. */ | 1020 | /* These may be needed for future network-power-down code. */ |
| 997 | 1021 | ||
| 998 | /* | 1022 | /* |
| @@ -1005,7 +1029,7 @@ struct net_device { | |||
| 1005 | struct timer_list watchdog_timer; | 1029 | struct timer_list watchdog_timer; |
| 1006 | 1030 | ||
| 1007 | /* Number of references to this device */ | 1031 | /* Number of references to this device */ |
| 1008 | atomic_t refcnt ____cacheline_aligned_in_smp; | 1032 | int __percpu *pcpu_refcnt; |
| 1009 | 1033 | ||
| 1010 | /* delayed register/unregister */ | 1034 | /* delayed register/unregister */ |
| 1011 | struct list_head todo_list; | 1035 | struct list_head todo_list; |
| @@ -1041,10 +1065,14 @@ struct net_device { | |||
| 1041 | #endif | 1065 | #endif |
| 1042 | 1066 | ||
| 1043 | /* mid-layer private */ | 1067 | /* mid-layer private */ |
| 1044 | void *ml_priv; | 1068 | union { |
| 1045 | 1069 | void *ml_priv; | |
| 1070 | struct pcpu_lstats __percpu *lstats; /* loopback stats */ | ||
| 1071 | struct pcpu_tstats __percpu *tstats; /* tunnel stats */ | ||
| 1072 | struct pcpu_dstats __percpu *dstats; /* dummy stats */ | ||
| 1073 | }; | ||
| 1046 | /* GARP */ | 1074 | /* GARP */ |
| 1047 | struct garp_port *garp_port; | 1075 | struct garp_port __rcu *garp_port; |
| 1048 | 1076 | ||
| 1049 | /* class/net/name entry */ | 1077 | /* class/net/name entry */ |
| 1050 | struct device dev; | 1078 | struct device dev; |
| @@ -1305,6 +1333,7 @@ static inline void unregister_netdevice(struct net_device *dev) | |||
| 1305 | unregister_netdevice_queue(dev, NULL); | 1333 | unregister_netdevice_queue(dev, NULL); |
| 1306 | } | 1334 | } |
| 1307 | 1335 | ||
| 1336 | extern int netdev_refcnt_read(const struct net_device *dev); | ||
| 1308 | extern void free_netdev(struct net_device *dev); | 1337 | extern void free_netdev(struct net_device *dev); |
| 1309 | extern void synchronize_net(void); | 1338 | extern void synchronize_net(void); |
| 1310 | extern int register_netdevice_notifier(struct notifier_block *nb); | 1339 | extern int register_netdevice_notifier(struct notifier_block *nb); |
| @@ -1667,11 +1696,34 @@ static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index) | |||
| 1667 | */ | 1696 | */ |
| 1668 | static inline int netif_is_multiqueue(const struct net_device *dev) | 1697 | static inline int netif_is_multiqueue(const struct net_device *dev) |
| 1669 | { | 1698 | { |
| 1670 | return (dev->num_tx_queues > 1); | 1699 | return dev->num_tx_queues > 1; |
| 1671 | } | 1700 | } |
| 1672 | 1701 | ||
| 1673 | extern void netif_set_real_num_tx_queues(struct net_device *dev, | 1702 | extern int netif_set_real_num_tx_queues(struct net_device *dev, |
| 1674 | unsigned int txq); | 1703 | unsigned int txq); |
| 1704 | |||
| 1705 | #ifdef CONFIG_RPS | ||
| 1706 | extern int netif_set_real_num_rx_queues(struct net_device *dev, | ||
| 1707 | unsigned int rxq); | ||
| 1708 | #else | ||
| 1709 | static inline int netif_set_real_num_rx_queues(struct net_device *dev, | ||
| 1710 | unsigned int rxq) | ||
| 1711 | { | ||
| 1712 | return 0; | ||
| 1713 | } | ||
| 1714 | #endif | ||
| 1715 | |||
| 1716 | static inline int netif_copy_real_num_queues(struct net_device *to_dev, | ||
| 1717 | const struct net_device *from_dev) | ||
| 1718 | { | ||
| 1719 | netif_set_real_num_tx_queues(to_dev, from_dev->real_num_tx_queues); | ||
| 1720 | #ifdef CONFIG_RPS | ||
| 1721 | return netif_set_real_num_rx_queues(to_dev, | ||
| 1722 | from_dev->real_num_rx_queues); | ||
| 1723 | #else | ||
| 1724 | return 0; | ||
| 1725 | #endif | ||
| 1726 | } | ||
| 1675 | 1727 | ||
| 1676 | /* Use this variant when it is known for sure that it | 1728 | /* Use this variant when it is known for sure that it |
| 1677 | * is executing from hardware interrupt context or with hardware interrupts | 1729 | * is executing from hardware interrupt context or with hardware interrupts |
| @@ -1695,8 +1747,7 @@ extern gro_result_t dev_gro_receive(struct napi_struct *napi, | |||
| 1695 | extern gro_result_t napi_skb_finish(gro_result_t ret, struct sk_buff *skb); | 1747 | extern gro_result_t napi_skb_finish(gro_result_t ret, struct sk_buff *skb); |
| 1696 | extern gro_result_t napi_gro_receive(struct napi_struct *napi, | 1748 | extern gro_result_t napi_gro_receive(struct napi_struct *napi, |
| 1697 | struct sk_buff *skb); | 1749 | struct sk_buff *skb); |
| 1698 | extern void napi_reuse_skb(struct napi_struct *napi, | 1750 | extern void napi_gro_flush(struct napi_struct *napi); |
| 1699 | struct sk_buff *skb); | ||
| 1700 | extern struct sk_buff * napi_get_frags(struct napi_struct *napi); | 1751 | extern struct sk_buff * napi_get_frags(struct napi_struct *napi); |
| 1701 | extern gro_result_t napi_frags_finish(struct napi_struct *napi, | 1752 | extern gro_result_t napi_frags_finish(struct napi_struct *napi, |
| 1702 | struct sk_buff *skb, | 1753 | struct sk_buff *skb, |
| @@ -1715,7 +1766,6 @@ extern int netdev_rx_handler_register(struct net_device *dev, | |||
| 1715 | void *rx_handler_data); | 1766 | void *rx_handler_data); |
| 1716 | extern void netdev_rx_handler_unregister(struct net_device *dev); | 1767 | extern void netdev_rx_handler_unregister(struct net_device *dev); |
| 1717 | 1768 | ||
| 1718 | extern void netif_nit_deliver(struct sk_buff *skb); | ||
| 1719 | extern int dev_valid_name(const char *name); | 1769 | extern int dev_valid_name(const char *name); |
| 1720 | extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); | 1770 | extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); |
| 1721 | extern int dev_ethtool(struct net *net, struct ifreq *); | 1771 | extern int dev_ethtool(struct net *net, struct ifreq *); |
| @@ -1749,7 +1799,7 @@ extern void netdev_run_todo(void); | |||
| 1749 | */ | 1799 | */ |
| 1750 | static inline void dev_put(struct net_device *dev) | 1800 | static inline void dev_put(struct net_device *dev) |
| 1751 | { | 1801 | { |
| 1752 | atomic_dec(&dev->refcnt); | 1802 | irqsafe_cpu_dec(*dev->pcpu_refcnt); |
| 1753 | } | 1803 | } |
| 1754 | 1804 | ||
| 1755 | /** | 1805 | /** |
| @@ -1760,7 +1810,7 @@ static inline void dev_put(struct net_device *dev) | |||
| 1760 | */ | 1810 | */ |
| 1761 | static inline void dev_hold(struct net_device *dev) | 1811 | static inline void dev_hold(struct net_device *dev) |
| 1762 | { | 1812 | { |
| 1763 | atomic_inc(&dev->refcnt); | 1813 | irqsafe_cpu_inc(*dev->pcpu_refcnt); |
| 1764 | } | 1814 | } |
| 1765 | 1815 | ||
| 1766 | /* Carrier loss detection, dial on demand. The functions netif_carrier_on | 1816 | /* Carrier loss detection, dial on demand. The functions netif_carrier_on |
| @@ -2171,6 +2221,8 @@ extern void dev_seq_stop(struct seq_file *seq, void *v); | |||
| 2171 | extern int netdev_class_create_file(struct class_attribute *class_attr); | 2221 | extern int netdev_class_create_file(struct class_attribute *class_attr); |
| 2172 | extern void netdev_class_remove_file(struct class_attribute *class_attr); | 2222 | extern void netdev_class_remove_file(struct class_attribute *class_attr); |
| 2173 | 2223 | ||
| 2224 | extern struct kobj_ns_type_operations net_ns_type_operations; | ||
| 2225 | |||
| 2174 | extern char *netdev_drivername(const struct net_device *dev, char *buffer, int len); | 2226 | extern char *netdev_drivername(const struct net_device *dev, char *buffer, int len); |
| 2175 | 2227 | ||
| 2176 | extern void linkwatch_run_queue(void); | 2228 | extern void linkwatch_run_queue(void); |
| @@ -2191,14 +2243,22 @@ static inline int net_gso_ok(int features, int gso_type) | |||
| 2191 | static inline int skb_gso_ok(struct sk_buff *skb, int features) | 2243 | static inline int skb_gso_ok(struct sk_buff *skb, int features) |
| 2192 | { | 2244 | { |
| 2193 | return net_gso_ok(features, skb_shinfo(skb)->gso_type) && | 2245 | return net_gso_ok(features, skb_shinfo(skb)->gso_type) && |
| 2194 | (!skb_has_frags(skb) || (features & NETIF_F_FRAGLIST)); | 2246 | (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST)); |
| 2195 | } | 2247 | } |
| 2196 | 2248 | ||
| 2197 | static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb) | 2249 | static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb) |
| 2198 | { | 2250 | { |
| 2199 | return skb_is_gso(skb) && | 2251 | if (skb_is_gso(skb)) { |
| 2200 | (!skb_gso_ok(skb, dev->features) || | 2252 | int features = dev->features; |
| 2201 | unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); | 2253 | |
| 2254 | if (skb->protocol == htons(ETH_P_8021Q) || skb->vlan_tci) | ||
| 2255 | features &= dev->vlan_features; | ||
| 2256 | |||
| 2257 | return (!skb_gso_ok(skb, features) || | ||
| 2258 | unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); | ||
| 2259 | } | ||
| 2260 | |||
| 2261 | return 0; | ||
| 2202 | } | 2262 | } |
| 2203 | 2263 | ||
| 2204 | static inline void netif_set_gso_max_size(struct net_device *dev, | 2264 | static inline void netif_set_gso_max_size(struct net_device *dev, |
