aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/netdevice.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 03:40:34 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 03:40:34 -0500
commit42a2d923cc349583ebf6fdd52a7d35e1c2f7e6bd (patch)
tree2b2b0c03b5389c1301800119333967efafd994ca /include/linux/netdevice.h
parent5cbb3d216e2041700231bcfc383ee5f8b7fc8b74 (diff)
parent75ecab1df14d90e86cebef9ec5c76befde46e65f (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking updates from David Miller: 1) The addition of nftables. No longer will we need protocol aware firewall filtering modules, it can all live in userspace. At the core of nftables is a, for lack of a better term, virtual machine that executes byte codes to inspect packet or metadata (arriving interface index, etc.) and make verdict decisions. Besides support for loading packet contents and comparing them, the interpreter supports lookups in various datastructures as fundamental operations. For example sets are supports, and therefore one could create a set of whitelist IP address entries which have ACCEPT verdicts attached to them, and use the appropriate byte codes to do such lookups. Since the interpreted code is composed in userspace, userspace can do things like optimize things before giving it to the kernel. Another major improvement is the capability of atomically updating portions of the ruleset. In the existing netfilter implementation, one has to update the entire rule set in order to make a change and this is very expensive. Userspace tools exist to create nftables rules using existing netfilter rule sets, but both kernel implementations will need to co-exist for quite some time as we transition from the old to the new stuff. Kudos to Patrick McHardy, Pablo Neira Ayuso, and others who have worked so hard on this. 2) Daniel Borkmann and Hannes Frederic Sowa made several improvements to our pseudo-random number generator, mostly used for things like UDP port randomization and netfitler, amongst other things. In particular the taus88 generater is updated to taus113, and test cases are added. 3) Support 64-bit rates in HTB and TBF schedulers, from Eric Dumazet and Yang Yingliang. 4) Add support for new 577xx tigon3 chips to tg3 driver, from Nithin Sujir. 5) Fix two fatal flaws in TCP dynamic right sizing, from Eric Dumazet, Neal Cardwell, and Yuchung Cheng. 6) Allow IP_TOS and IP_TTL to be specified in sendmsg() ancillary control message data, much like other socket option attributes. From Francesco Fusco. 7) Allow applications to specify a cap on the rate computed automatically by the kernel for pacing flows, via a new SO_MAX_PACING_RATE socket option. From Eric Dumazet. 8) Make the initial autotuned send buffer sizing in TCP more closely reflect actual needs, from Eric Dumazet. 9) Currently early socket demux only happens for TCP sockets, but we can do it for connected UDP sockets too. Implementation from Shawn Bohrer. 10) Refactor inet socket demux with the goal of improving hash demux performance for listening sockets. With the main goals being able to use RCU lookups on even request sockets, and eliminating the listening lock contention. From Eric Dumazet. 11) The bonding layer has many demuxes in it's fast path, and an RCU conversion was started back in 3.11, several changes here extend the RCU usage to even more locations. From Ding Tianhong and Wang Yufen, based upon suggestions by Nikolay Aleksandrov and Veaceslav Falico. 12) Allow stackability of segmentation offloads to, in particular, allow segmentation offloading over tunnels. From Eric Dumazet. 13) Significantly improve the handling of secret keys we input into the various hash functions in the inet hashtables, TCP fast open, as well as syncookies. From Hannes Frederic Sowa. The key fundamental operation is "net_get_random_once()" which uses static keys. Hannes even extended this to ipv4/ipv6 fragmentation handling and our generic flow dissector. 14) The generic driver layer takes care now to set the driver data to NULL on device removal, so it's no longer necessary for drivers to explicitly set it to NULL any more. Many drivers have been cleaned up in this way, from Jingoo Han. 15) Add a BPF based packet scheduler classifier, from Daniel Borkmann. 16) Improve CRC32 interfaces and generic SKB checksum iterators so that SCTP's checksumming can more cleanly be handled. Also from Daniel Borkmann. 17) Add a new PMTU discovery mode, IP_PMTUDISC_INTERFACE, which forces using the interface MTU value. This helps avoid PMTU attacks, particularly on DNS servers. From Hannes Frederic Sowa. 18) Use generic XPS for transmit queue steering rather than internal (re-)implementation in virtio-net. From Jason Wang. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1622 commits) random32: add test cases for taus113 implementation random32: upgrade taus88 generator to taus113 from errata paper random32: move rnd_state to linux/random.h random32: add prandom_reseed_late() and call when nonblocking pool becomes initialized random32: add periodic reseeding random32: fix off-by-one in seeding requirement PHY: Add RTL8201CP phy_driver to realtek xtsonic: add missing platform_set_drvdata() in xtsonic_probe() macmace: add missing platform_set_drvdata() in mace_probe() ethernet/arc/arc_emac: add missing platform_set_drvdata() in arc_emac_probe() ipv6: protect for_each_sk_fl_rcu in mem_check with rcu_read_lock_bh vlan: Implement vlan_dev_get_egress_qos_mask as an inline. ixgbe: add warning when max_vfs is out of range. igb: Update link modes display in ethtool netfilter: push reasm skb through instead of original frag skbs ip6_output: fragment outgoing reassembled skb properly MAINTAINERS: mv643xx_eth: take over maintainership from Lennart net_sched: tbf: support of 64bit rates ixgbe: deleting dfwd stations out of order can cause null ptr deref ixgbe: fix build err, num_rx_queues is only available with CONFIG_RPS ...
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r--include/linux/netdevice.h506
1 files changed, 281 insertions, 225 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index adf4070586d6..8b3de7cc2ffc 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -60,8 +60,8 @@ struct wireless_dev;
60#define SET_ETHTOOL_OPS(netdev,ops) \ 60#define SET_ETHTOOL_OPS(netdev,ops) \
61 ( (netdev)->ethtool_ops = (ops) ) 61 ( (netdev)->ethtool_ops = (ops) )
62 62
63extern void netdev_set_default_ethtool_ops(struct net_device *dev, 63void netdev_set_default_ethtool_ops(struct net_device *dev,
64 const struct ethtool_ops *ops); 64 const struct ethtool_ops *ops);
65 65
66/* hardware address assignment types */ 66/* hardware address assignment types */
67#define NET_ADDR_PERM 0 /* address is permanent (default) */ 67#define NET_ADDR_PERM 0 /* address is permanent (default) */
@@ -298,7 +298,7 @@ struct netdev_boot_setup {
298}; 298};
299#define NETDEV_BOOT_SETUP_MAX 8 299#define NETDEV_BOOT_SETUP_MAX 8
300 300
301extern int __init netdev_boot_setup(char *str); 301int __init netdev_boot_setup(char *str);
302 302
303/* 303/*
304 * Structure for NAPI scheduling similar to tasklet but with weighting 304 * Structure for NAPI scheduling similar to tasklet but with weighting
@@ -394,7 +394,7 @@ enum rx_handler_result {
394typedef enum rx_handler_result rx_handler_result_t; 394typedef enum rx_handler_result rx_handler_result_t;
395typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **pskb); 395typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **pskb);
396 396
397extern void __napi_schedule(struct napi_struct *n); 397void __napi_schedule(struct napi_struct *n);
398 398
399static inline bool napi_disable_pending(struct napi_struct *n) 399static inline bool napi_disable_pending(struct napi_struct *n)
400{ 400{
@@ -445,8 +445,8 @@ static inline bool napi_reschedule(struct napi_struct *napi)
445 * 445 *
446 * Mark NAPI processing as complete. 446 * Mark NAPI processing as complete.
447 */ 447 */
448extern void __napi_complete(struct napi_struct *n); 448void __napi_complete(struct napi_struct *n);
449extern void napi_complete(struct napi_struct *n); 449void napi_complete(struct napi_struct *n);
450 450
451/** 451/**
452 * napi_by_id - lookup a NAPI by napi_id 452 * napi_by_id - lookup a NAPI by napi_id
@@ -455,7 +455,7 @@ extern void napi_complete(struct napi_struct *n);
455 * lookup @napi_id in napi_hash table 455 * lookup @napi_id in napi_hash table
456 * must be called under rcu_read_lock() 456 * must be called under rcu_read_lock()
457 */ 457 */
458extern struct napi_struct *napi_by_id(unsigned int napi_id); 458struct napi_struct *napi_by_id(unsigned int napi_id);
459 459
460/** 460/**
461 * napi_hash_add - add a NAPI to global hashtable 461 * napi_hash_add - add a NAPI to global hashtable
@@ -463,7 +463,7 @@ extern struct napi_struct *napi_by_id(unsigned int napi_id);
463 * 463 *
464 * generate a new napi_id and store a @napi under it in napi_hash 464 * generate a new napi_id and store a @napi under it in napi_hash
465 */ 465 */
466extern void napi_hash_add(struct napi_struct *napi); 466void napi_hash_add(struct napi_struct *napi);
467 467
468/** 468/**
469 * napi_hash_del - remove a NAPI from global table 469 * napi_hash_del - remove a NAPI from global table
@@ -472,7 +472,7 @@ extern void napi_hash_add(struct napi_struct *napi);
472 * Warning: caller must observe rcu grace period 472 * Warning: caller must observe rcu grace period
473 * before freeing memory containing @napi 473 * before freeing memory containing @napi
474 */ 474 */
475extern void napi_hash_del(struct napi_struct *napi); 475void napi_hash_del(struct napi_struct *napi);
476 476
477/** 477/**
478 * napi_disable - prevent NAPI from scheduling 478 * napi_disable - prevent NAPI from scheduling
@@ -483,6 +483,7 @@ extern void napi_hash_del(struct napi_struct *napi);
483 */ 483 */
484static inline void napi_disable(struct napi_struct *n) 484static inline void napi_disable(struct napi_struct *n)
485{ 485{
486 might_sleep();
486 set_bit(NAPI_STATE_DISABLE, &n->state); 487 set_bit(NAPI_STATE_DISABLE, &n->state);
487 while (test_and_set_bit(NAPI_STATE_SCHED, &n->state)) 488 while (test_and_set_bit(NAPI_STATE_SCHED, &n->state))
488 msleep(1); 489 msleep(1);
@@ -664,8 +665,8 @@ static inline void rps_reset_sock_flow(struct rps_sock_flow_table *table,
664extern struct rps_sock_flow_table __rcu *rps_sock_flow_table; 665extern struct rps_sock_flow_table __rcu *rps_sock_flow_table;
665 666
666#ifdef CONFIG_RFS_ACCEL 667#ifdef CONFIG_RFS_ACCEL
667extern bool rps_may_expire_flow(struct net_device *dev, u16 rxq_index, 668bool rps_may_expire_flow(struct net_device *dev, u16 rxq_index, u32 flow_id,
668 u32 flow_id, u16 filter_id); 669 u16 filter_id);
669#endif 670#endif
670 671
671/* This structure contains an instance of an RX queue. */ 672/* This structure contains an instance of an RX queue. */
@@ -961,6 +962,25 @@ struct netdev_phys_port_id {
961 * Called by vxlan to notify the driver about a UDP port and socket 962 * Called by vxlan to notify the driver about a UDP port and socket
962 * address family that vxlan is not listening to anymore. The operation 963 * address family that vxlan is not listening to anymore. The operation
963 * is protected by the vxlan_net->sock_lock. 964 * is protected by the vxlan_net->sock_lock.
965 *
966 * void* (*ndo_dfwd_add_station)(struct net_device *pdev,
967 * struct net_device *dev)
968 * Called by upper layer devices to accelerate switching or other
969 * station functionality into hardware. 'pdev is the lowerdev
970 * to use for the offload and 'dev' is the net device that will
971 * back the offload. Returns a pointer to the private structure
972 * the upper layer will maintain.
973 * void (*ndo_dfwd_del_station)(struct net_device *pdev, void *priv)
974 * Called by upper layer device to delete the station created
975 * by 'ndo_dfwd_add_station'. 'pdev' is the net device backing
976 * the station and priv is the structure returned by the add
977 * operation.
978 * netdev_tx_t (*ndo_dfwd_start_xmit)(struct sk_buff *skb,
979 * struct net_device *dev,
980 * void *priv);
981 * Callback to use for xmit over the accelerated station. This
982 * is used in place of ndo_start_xmit on accelerated net
983 * devices.
964 */ 984 */
965struct net_device_ops { 985struct net_device_ops {
966 int (*ndo_init)(struct net_device *dev); 986 int (*ndo_init)(struct net_device *dev);
@@ -1097,6 +1117,15 @@ struct net_device_ops {
1097 void (*ndo_del_vxlan_port)(struct net_device *dev, 1117 void (*ndo_del_vxlan_port)(struct net_device *dev,
1098 sa_family_t sa_family, 1118 sa_family_t sa_family,
1099 __be16 port); 1119 __be16 port);
1120
1121 void* (*ndo_dfwd_add_station)(struct net_device *pdev,
1122 struct net_device *dev);
1123 void (*ndo_dfwd_del_station)(struct net_device *pdev,
1124 void *priv);
1125
1126 netdev_tx_t (*ndo_dfwd_start_xmit) (struct sk_buff *skb,
1127 struct net_device *dev,
1128 void *priv);
1100}; 1129};
1101 1130
1102/* 1131/*
@@ -1131,7 +1160,7 @@ struct net_device {
1131 unsigned long mem_end; /* shared mem end */ 1160 unsigned long mem_end; /* shared mem end */
1132 unsigned long mem_start; /* shared mem start */ 1161 unsigned long mem_start; /* shared mem start */
1133 unsigned long base_addr; /* device I/O address */ 1162 unsigned long base_addr; /* device I/O address */
1134 unsigned int irq; /* device IRQ number */ 1163 int irq; /* device IRQ number */
1135 1164
1136 /* 1165 /*
1137 * Some hardware also needs these fields, but they are not 1166 * Some hardware also needs these fields, but they are not
@@ -1143,8 +1172,19 @@ struct net_device {
1143 struct list_head dev_list; 1172 struct list_head dev_list;
1144 struct list_head napi_list; 1173 struct list_head napi_list;
1145 struct list_head unreg_list; 1174 struct list_head unreg_list;
1146 struct list_head upper_dev_list; /* List of upper devices */ 1175 struct list_head close_list;
1147 struct list_head lower_dev_list; 1176
1177 /* directly linked devices, like slaves for bonding */
1178 struct {
1179 struct list_head upper;
1180 struct list_head lower;
1181 } adj_list;
1182
1183 /* all linked devices, *including* neighbours */
1184 struct {
1185 struct list_head upper;
1186 struct list_head lower;
1187 } all_adj_list;
1148 1188
1149 1189
1150 /* currently active device features */ 1190 /* currently active device features */
@@ -1183,6 +1223,7 @@ struct net_device {
1183 /* Management operations */ 1223 /* Management operations */
1184 const struct net_device_ops *netdev_ops; 1224 const struct net_device_ops *netdev_ops;
1185 const struct ethtool_ops *ethtool_ops; 1225 const struct ethtool_ops *ethtool_ops;
1226 const struct forwarding_accel_ops *fwd_ops;
1186 1227
1187 /* Hardware header description */ 1228 /* Hardware header description */
1188 const struct header_ops *header_ops; 1229 const struct header_ops *header_ops;
@@ -1487,9 +1528,9 @@ static inline void netdev_for_each_tx_queue(struct net_device *dev,
1487 f(dev, &dev->_tx[i], arg); 1528 f(dev, &dev->_tx[i], arg);
1488} 1529}
1489 1530
1490extern struct netdev_queue *netdev_pick_tx(struct net_device *dev, 1531struct netdev_queue *netdev_pick_tx(struct net_device *dev,
1491 struct sk_buff *skb); 1532 struct sk_buff *skb);
1492extern u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb); 1533u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb);
1493 1534
1494/* 1535/*
1495 * Net namespace inlines 1536 * Net namespace inlines
@@ -1673,8 +1714,8 @@ struct packet_offload {
1673#define NETDEV_CHANGEUPPER 0x0015 1714#define NETDEV_CHANGEUPPER 0x0015
1674#define NETDEV_RESEND_IGMP 0x0016 1715#define NETDEV_RESEND_IGMP 0x0016
1675 1716
1676extern int register_netdevice_notifier(struct notifier_block *nb); 1717int register_netdevice_notifier(struct notifier_block *nb);
1677extern int unregister_netdevice_notifier(struct notifier_block *nb); 1718int unregister_netdevice_notifier(struct notifier_block *nb);
1678 1719
1679struct netdev_notifier_info { 1720struct netdev_notifier_info {
1680 struct net_device *dev; 1721 struct net_device *dev;
@@ -1697,9 +1738,9 @@ netdev_notifier_info_to_dev(const struct netdev_notifier_info *info)
1697 return info->dev; 1738 return info->dev;
1698} 1739}
1699 1740
1700extern int call_netdevice_notifiers_info(unsigned long val, struct net_device *dev, 1741int call_netdevice_notifiers_info(unsigned long val, struct net_device *dev,
1701 struct netdev_notifier_info *info); 1742 struct netdev_notifier_info *info);
1702extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev); 1743int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
1703 1744
1704 1745
1705extern rwlock_t dev_base_lock; /* Device list lock */ 1746extern rwlock_t dev_base_lock; /* Device list lock */
@@ -1754,54 +1795,53 @@ static inline struct net_device *first_net_device_rcu(struct net *net)
1754 return lh == &net->dev_base_head ? NULL : net_device_entry(lh); 1795 return lh == &net->dev_base_head ? NULL : net_device_entry(lh);
1755} 1796}
1756 1797
1757extern int netdev_boot_setup_check(struct net_device *dev); 1798int netdev_boot_setup_check(struct net_device *dev);
1758extern unsigned long netdev_boot_base(const char *prefix, int unit); 1799unsigned long netdev_boot_base(const char *prefix, int unit);
1759extern struct net_device *dev_getbyhwaddr_rcu(struct net *net, unsigned short type, 1800struct net_device *dev_getbyhwaddr_rcu(struct net *net, unsigned short type,
1760 const char *hwaddr); 1801 const char *hwaddr);
1761extern struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type); 1802struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type);
1762extern struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short type); 1803struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short type);
1763extern void dev_add_pack(struct packet_type *pt); 1804void dev_add_pack(struct packet_type *pt);
1764extern void dev_remove_pack(struct packet_type *pt); 1805void dev_remove_pack(struct packet_type *pt);
1765extern void __dev_remove_pack(struct packet_type *pt); 1806void __dev_remove_pack(struct packet_type *pt);
1766extern void dev_add_offload(struct packet_offload *po); 1807void dev_add_offload(struct packet_offload *po);
1767extern void dev_remove_offload(struct packet_offload *po); 1808void dev_remove_offload(struct packet_offload *po);
1768extern void __dev_remove_offload(struct packet_offload *po); 1809void __dev_remove_offload(struct packet_offload *po);
1769 1810
1770extern struct net_device *dev_get_by_flags_rcu(struct net *net, unsigned short flags, 1811struct net_device *dev_get_by_flags_rcu(struct net *net, unsigned short flags,
1771 unsigned short mask); 1812 unsigned short mask);
1772extern struct net_device *dev_get_by_name(struct net *net, const char *name); 1813struct net_device *dev_get_by_name(struct net *net, const char *name);
1773extern struct net_device *dev_get_by_name_rcu(struct net *net, const char *name); 1814struct net_device *dev_get_by_name_rcu(struct net *net, const char *name);
1774extern struct net_device *__dev_get_by_name(struct net *net, const char *name); 1815struct net_device *__dev_get_by_name(struct net *net, const char *name);
1775extern int dev_alloc_name(struct net_device *dev, const char *name); 1816int dev_alloc_name(struct net_device *dev, const char *name);
1776extern int dev_open(struct net_device *dev); 1817int dev_open(struct net_device *dev);
1777extern int dev_close(struct net_device *dev); 1818int dev_close(struct net_device *dev);
1778extern void dev_disable_lro(struct net_device *dev); 1819void dev_disable_lro(struct net_device *dev);
1779extern int dev_loopback_xmit(struct sk_buff *newskb); 1820int dev_loopback_xmit(struct sk_buff *newskb);
1780extern int dev_queue_xmit(struct sk_buff *skb); 1821int dev_queue_xmit(struct sk_buff *skb);
1781extern int register_netdevice(struct net_device *dev); 1822int register_netdevice(struct net_device *dev);
1782extern void unregister_netdevice_queue(struct net_device *dev, 1823void unregister_netdevice_queue(struct net_device *dev, struct list_head *head);
1783 struct list_head *head); 1824void unregister_netdevice_many(struct list_head *head);
1784extern void unregister_netdevice_many(struct list_head *head);
1785static inline void unregister_netdevice(struct net_device *dev) 1825static inline void unregister_netdevice(struct net_device *dev)
1786{ 1826{
1787 unregister_netdevice_queue(dev, NULL); 1827 unregister_netdevice_queue(dev, NULL);
1788} 1828}
1789 1829
1790extern int netdev_refcnt_read(const struct net_device *dev); 1830int netdev_refcnt_read(const struct net_device *dev);
1791extern void free_netdev(struct net_device *dev); 1831void free_netdev(struct net_device *dev);
1792extern void synchronize_net(void); 1832void netdev_freemem(struct net_device *dev);
1793extern int init_dummy_netdev(struct net_device *dev); 1833void synchronize_net(void);
1834int init_dummy_netdev(struct net_device *dev);
1794 1835
1795extern struct net_device *dev_get_by_index(struct net *net, int ifindex); 1836struct net_device *dev_get_by_index(struct net *net, int ifindex);
1796extern struct net_device *__dev_get_by_index(struct net *net, int ifindex); 1837struct net_device *__dev_get_by_index(struct net *net, int ifindex);
1797extern struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex); 1838struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex);
1798extern int netdev_get_name(struct net *net, char *name, int ifindex); 1839int netdev_get_name(struct net *net, char *name, int ifindex);
1799extern int dev_restart(struct net_device *dev); 1840int dev_restart(struct net_device *dev);
1800#ifdef CONFIG_NETPOLL_TRAP 1841#ifdef CONFIG_NETPOLL_TRAP
1801extern int netpoll_trap(void); 1842int netpoll_trap(void);
1802#endif 1843#endif
1803extern int skb_gro_receive(struct sk_buff **head, 1844int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb);
1804 struct sk_buff *skb);
1805 1845
1806static inline unsigned int skb_gro_offset(const struct sk_buff *skb) 1846static inline unsigned int skb_gro_offset(const struct sk_buff *skb)
1807{ 1847{
@@ -1873,7 +1913,7 @@ static inline int dev_parse_header(const struct sk_buff *skb,
1873} 1913}
1874 1914
1875typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len); 1915typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len);
1876extern int register_gifconf(unsigned int family, gifconf_func_t * gifconf); 1916int register_gifconf(unsigned int family, gifconf_func_t *gifconf);
1877static inline int unregister_gifconf(unsigned int family) 1917static inline int unregister_gifconf(unsigned int family)
1878{ 1918{
1879 return register_gifconf(family, NULL); 1919 return register_gifconf(family, NULL);
@@ -1944,7 +1984,7 @@ static inline void input_queue_tail_incr_save(struct softnet_data *sd,
1944 1984
1945DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data); 1985DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data);
1946 1986
1947extern void __netif_schedule(struct Qdisc *q); 1987void __netif_schedule(struct Qdisc *q);
1948 1988
1949static inline void netif_schedule_queue(struct netdev_queue *txq) 1989static inline void netif_schedule_queue(struct netdev_queue *txq)
1950{ 1990{
@@ -2264,9 +2304,8 @@ static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
2264} 2304}
2265 2305
2266#ifdef CONFIG_XPS 2306#ifdef CONFIG_XPS
2267extern int netif_set_xps_queue(struct net_device *dev, 2307int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask,
2268 const struct cpumask *mask, 2308 u16 index);
2269 u16 index);
2270#else 2309#else
2271static inline int netif_set_xps_queue(struct net_device *dev, 2310static inline int netif_set_xps_queue(struct net_device *dev,
2272 const struct cpumask *mask, 2311 const struct cpumask *mask,
@@ -2297,12 +2336,10 @@ static inline bool netif_is_multiqueue(const struct net_device *dev)
2297 return dev->num_tx_queues > 1; 2336 return dev->num_tx_queues > 1;
2298} 2337}
2299 2338
2300extern int netif_set_real_num_tx_queues(struct net_device *dev, 2339int netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq);
2301 unsigned int txq);
2302 2340
2303#ifdef CONFIG_RPS 2341#ifdef CONFIG_RPS
2304extern int netif_set_real_num_rx_queues(struct net_device *dev, 2342int netif_set_real_num_rx_queues(struct net_device *dev, unsigned int rxq);
2305 unsigned int rxq);
2306#else 2343#else
2307static inline int netif_set_real_num_rx_queues(struct net_device *dev, 2344static inline int netif_set_real_num_rx_queues(struct net_device *dev,
2308 unsigned int rxq) 2345 unsigned int rxq)
@@ -2329,28 +2366,27 @@ static inline int netif_copy_real_num_queues(struct net_device *to_dev,
2329} 2366}
2330 2367
2331#define DEFAULT_MAX_NUM_RSS_QUEUES (8) 2368#define DEFAULT_MAX_NUM_RSS_QUEUES (8)
2332extern int netif_get_num_default_rss_queues(void); 2369int netif_get_num_default_rss_queues(void);
2333 2370
2334/* Use this variant when it is known for sure that it 2371/* Use this variant when it is known for sure that it
2335 * is executing from hardware interrupt context or with hardware interrupts 2372 * is executing from hardware interrupt context or with hardware interrupts
2336 * disabled. 2373 * disabled.
2337 */ 2374 */
2338extern void dev_kfree_skb_irq(struct sk_buff *skb); 2375void dev_kfree_skb_irq(struct sk_buff *skb);
2339 2376
2340/* Use this variant in places where it could be invoked 2377/* Use this variant in places where it could be invoked
2341 * from either hardware interrupt or other context, with hardware interrupts 2378 * from either hardware interrupt or other context, with hardware interrupts
2342 * either disabled or enabled. 2379 * either disabled or enabled.
2343 */ 2380 */
2344extern void dev_kfree_skb_any(struct sk_buff *skb); 2381void dev_kfree_skb_any(struct sk_buff *skb);
2345 2382
2346extern int netif_rx(struct sk_buff *skb); 2383int netif_rx(struct sk_buff *skb);
2347extern int netif_rx_ni(struct sk_buff *skb); 2384int netif_rx_ni(struct sk_buff *skb);
2348extern int netif_receive_skb(struct sk_buff *skb); 2385int netif_receive_skb(struct sk_buff *skb);
2349extern gro_result_t napi_gro_receive(struct napi_struct *napi, 2386gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb);
2350 struct sk_buff *skb); 2387void napi_gro_flush(struct napi_struct *napi, bool flush_old);
2351extern void napi_gro_flush(struct napi_struct *napi, bool flush_old); 2388struct sk_buff *napi_get_frags(struct napi_struct *napi);
2352extern struct sk_buff * napi_get_frags(struct napi_struct *napi); 2389gro_result_t napi_gro_frags(struct napi_struct *napi);
2353extern gro_result_t napi_gro_frags(struct napi_struct *napi);
2354 2390
2355static inline void napi_free_frags(struct napi_struct *napi) 2391static inline void napi_free_frags(struct napi_struct *napi)
2356{ 2392{
@@ -2358,40 +2394,36 @@ static inline void napi_free_frags(struct napi_struct *napi)
2358 napi->skb = NULL; 2394 napi->skb = NULL;
2359} 2395}
2360 2396
2361extern int netdev_rx_handler_register(struct net_device *dev, 2397int netdev_rx_handler_register(struct net_device *dev,
2362 rx_handler_func_t *rx_handler, 2398 rx_handler_func_t *rx_handler,
2363 void *rx_handler_data); 2399 void *rx_handler_data);
2364extern void netdev_rx_handler_unregister(struct net_device *dev); 2400void netdev_rx_handler_unregister(struct net_device *dev);
2365 2401
2366extern bool dev_valid_name(const char *name); 2402bool dev_valid_name(const char *name);
2367extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); 2403int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
2368extern int dev_ethtool(struct net *net, struct ifreq *); 2404int dev_ethtool(struct net *net, struct ifreq *);
2369extern unsigned int dev_get_flags(const struct net_device *); 2405unsigned int dev_get_flags(const struct net_device *);
2370extern int __dev_change_flags(struct net_device *, unsigned int flags); 2406int __dev_change_flags(struct net_device *, unsigned int flags);
2371extern int dev_change_flags(struct net_device *, unsigned int); 2407int dev_change_flags(struct net_device *, unsigned int);
2372extern void __dev_notify_flags(struct net_device *, unsigned int old_flags); 2408void __dev_notify_flags(struct net_device *, unsigned int old_flags,
2373extern int dev_change_name(struct net_device *, const char *); 2409 unsigned int gchanges);
2374extern int dev_set_alias(struct net_device *, const char *, size_t); 2410int dev_change_name(struct net_device *, const char *);
2375extern int dev_change_net_namespace(struct net_device *, 2411int dev_set_alias(struct net_device *, const char *, size_t);
2376 struct net *, const char *); 2412int dev_change_net_namespace(struct net_device *, struct net *, const char *);
2377extern int dev_set_mtu(struct net_device *, int); 2413int dev_set_mtu(struct net_device *, int);
2378extern void dev_set_group(struct net_device *, int); 2414void dev_set_group(struct net_device *, int);
2379extern int dev_set_mac_address(struct net_device *, 2415int dev_set_mac_address(struct net_device *, struct sockaddr *);
2380 struct sockaddr *); 2416int dev_change_carrier(struct net_device *, bool new_carrier);
2381extern int dev_change_carrier(struct net_device *, 2417int dev_get_phys_port_id(struct net_device *dev,
2382 bool new_carrier); 2418 struct netdev_phys_port_id *ppid);
2383extern int dev_get_phys_port_id(struct net_device *dev, 2419int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
2384 struct netdev_phys_port_id *ppid); 2420 struct netdev_queue *txq, void *accel_priv);
2385extern int dev_hard_start_xmit(struct sk_buff *skb, 2421int dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
2386 struct net_device *dev,
2387 struct netdev_queue *txq);
2388extern int dev_forward_skb(struct net_device *dev,
2389 struct sk_buff *skb);
2390 2422
2391extern int netdev_budget; 2423extern int netdev_budget;
2392 2424
2393/* Called by rtnetlink.c:rtnl_unlock() */ 2425/* Called by rtnetlink.c:rtnl_unlock() */
2394extern void netdev_run_todo(void); 2426void netdev_run_todo(void);
2395 2427
2396/** 2428/**
2397 * dev_put - release reference to device 2429 * dev_put - release reference to device
@@ -2424,9 +2456,9 @@ static inline void dev_hold(struct net_device *dev)
2424 * kind of lower layer not just hardware media. 2456 * kind of lower layer not just hardware media.
2425 */ 2457 */
2426 2458
2427extern void linkwatch_init_dev(struct net_device *dev); 2459void linkwatch_init_dev(struct net_device *dev);
2428extern void linkwatch_fire_event(struct net_device *dev); 2460void linkwatch_fire_event(struct net_device *dev);
2429extern void linkwatch_forget_dev(struct net_device *dev); 2461void linkwatch_forget_dev(struct net_device *dev);
2430 2462
2431/** 2463/**
2432 * netif_carrier_ok - test if carrier present 2464 * netif_carrier_ok - test if carrier present
@@ -2439,13 +2471,13 @@ static inline bool netif_carrier_ok(const struct net_device *dev)
2439 return !test_bit(__LINK_STATE_NOCARRIER, &dev->state); 2471 return !test_bit(__LINK_STATE_NOCARRIER, &dev->state);
2440} 2472}
2441 2473
2442extern unsigned long dev_trans_start(struct net_device *dev); 2474unsigned long dev_trans_start(struct net_device *dev);
2443 2475
2444extern void __netdev_watchdog_up(struct net_device *dev); 2476void __netdev_watchdog_up(struct net_device *dev);
2445 2477
2446extern void netif_carrier_on(struct net_device *dev); 2478void netif_carrier_on(struct net_device *dev);
2447 2479
2448extern void netif_carrier_off(struct net_device *dev); 2480void netif_carrier_off(struct net_device *dev);
2449 2481
2450/** 2482/**
2451 * netif_dormant_on - mark device as dormant. 2483 * netif_dormant_on - mark device as dormant.
@@ -2513,9 +2545,9 @@ static inline bool netif_device_present(struct net_device *dev)
2513 return test_bit(__LINK_STATE_PRESENT, &dev->state); 2545 return test_bit(__LINK_STATE_PRESENT, &dev->state);
2514} 2546}
2515 2547
2516extern void netif_device_detach(struct net_device *dev); 2548void netif_device_detach(struct net_device *dev);
2517 2549
2518extern void netif_device_attach(struct net_device *dev); 2550void netif_device_attach(struct net_device *dev);
2519 2551
2520/* 2552/*
2521 * Network interface message level settings 2553 * Network interface message level settings
@@ -2724,119 +2756,138 @@ static inline void netif_addr_unlock_bh(struct net_device *dev)
2724 2756
2725/* These functions live elsewhere (drivers/net/net_init.c, but related) */ 2757/* These functions live elsewhere (drivers/net/net_init.c, but related) */
2726 2758
2727extern void ether_setup(struct net_device *dev); 2759void ether_setup(struct net_device *dev);
2728 2760
2729/* Support for loadable net-drivers */ 2761/* Support for loadable net-drivers */
2730extern struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, 2762struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
2731 void (*setup)(struct net_device *), 2763 void (*setup)(struct net_device *),
2732 unsigned int txqs, unsigned int rxqs); 2764 unsigned int txqs, unsigned int rxqs);
2733#define alloc_netdev(sizeof_priv, name, setup) \ 2765#define alloc_netdev(sizeof_priv, name, setup) \
2734 alloc_netdev_mqs(sizeof_priv, name, setup, 1, 1) 2766 alloc_netdev_mqs(sizeof_priv, name, setup, 1, 1)
2735 2767
2736#define alloc_netdev_mq(sizeof_priv, name, setup, count) \ 2768#define alloc_netdev_mq(sizeof_priv, name, setup, count) \
2737 alloc_netdev_mqs(sizeof_priv, name, setup, count, count) 2769 alloc_netdev_mqs(sizeof_priv, name, setup, count, count)
2738 2770
2739extern int register_netdev(struct net_device *dev); 2771int register_netdev(struct net_device *dev);
2740extern void unregister_netdev(struct net_device *dev); 2772void unregister_netdev(struct net_device *dev);
2741 2773
2742/* General hardware address lists handling functions */ 2774/* General hardware address lists handling functions */
2743extern int __hw_addr_add_multiple(struct netdev_hw_addr_list *to_list, 2775int __hw_addr_add_multiple(struct netdev_hw_addr_list *to_list,
2744 struct netdev_hw_addr_list *from_list, 2776 struct netdev_hw_addr_list *from_list,
2745 int addr_len, unsigned char addr_type); 2777 int addr_len, unsigned char addr_type);
2746extern void __hw_addr_del_multiple(struct netdev_hw_addr_list *to_list, 2778void __hw_addr_del_multiple(struct netdev_hw_addr_list *to_list,
2747 struct netdev_hw_addr_list *from_list, 2779 struct netdev_hw_addr_list *from_list,
2748 int addr_len, unsigned char addr_type); 2780 int addr_len, unsigned char addr_type);
2749extern int __hw_addr_sync(struct netdev_hw_addr_list *to_list, 2781int __hw_addr_sync(struct netdev_hw_addr_list *to_list,
2750 struct netdev_hw_addr_list *from_list, 2782 struct netdev_hw_addr_list *from_list, int addr_len);
2751 int addr_len); 2783void __hw_addr_unsync(struct netdev_hw_addr_list *to_list,
2752extern void __hw_addr_unsync(struct netdev_hw_addr_list *to_list, 2784 struct netdev_hw_addr_list *from_list, int addr_len);
2753 struct netdev_hw_addr_list *from_list, 2785void __hw_addr_flush(struct netdev_hw_addr_list *list);
2754 int addr_len); 2786void __hw_addr_init(struct netdev_hw_addr_list *list);
2755extern void __hw_addr_flush(struct netdev_hw_addr_list *list);
2756extern void __hw_addr_init(struct netdev_hw_addr_list *list);
2757 2787
2758/* Functions used for device addresses handling */ 2788/* Functions used for device addresses handling */
2759extern int dev_addr_add(struct net_device *dev, const unsigned char *addr, 2789int dev_addr_add(struct net_device *dev, const unsigned char *addr,
2760 unsigned char addr_type); 2790 unsigned char addr_type);
2761extern int dev_addr_del(struct net_device *dev, const unsigned char *addr, 2791int dev_addr_del(struct net_device *dev, const unsigned char *addr,
2762 unsigned char addr_type); 2792 unsigned char addr_type);
2763extern int dev_addr_add_multiple(struct net_device *to_dev, 2793int dev_addr_add_multiple(struct net_device *to_dev,
2764 struct net_device *from_dev, 2794 struct net_device *from_dev, unsigned char addr_type);
2765 unsigned char addr_type); 2795int dev_addr_del_multiple(struct net_device *to_dev,
2766extern int dev_addr_del_multiple(struct net_device *to_dev, 2796 struct net_device *from_dev, unsigned char addr_type);
2767 struct net_device *from_dev, 2797void dev_addr_flush(struct net_device *dev);
2768 unsigned char addr_type); 2798int dev_addr_init(struct net_device *dev);
2769extern void dev_addr_flush(struct net_device *dev);
2770extern int dev_addr_init(struct net_device *dev);
2771 2799
2772/* Functions used for unicast addresses handling */ 2800/* Functions used for unicast addresses handling */
2773extern int dev_uc_add(struct net_device *dev, const unsigned char *addr); 2801int dev_uc_add(struct net_device *dev, const unsigned char *addr);
2774extern int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr); 2802int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr);
2775extern int dev_uc_del(struct net_device *dev, const unsigned char *addr); 2803int dev_uc_del(struct net_device *dev, const unsigned char *addr);
2776extern int dev_uc_sync(struct net_device *to, struct net_device *from); 2804int dev_uc_sync(struct net_device *to, struct net_device *from);
2777extern int dev_uc_sync_multiple(struct net_device *to, struct net_device *from); 2805int dev_uc_sync_multiple(struct net_device *to, struct net_device *from);
2778extern void dev_uc_unsync(struct net_device *to, struct net_device *from); 2806void dev_uc_unsync(struct net_device *to, struct net_device *from);
2779extern void dev_uc_flush(struct net_device *dev); 2807void dev_uc_flush(struct net_device *dev);
2780extern void dev_uc_init(struct net_device *dev); 2808void dev_uc_init(struct net_device *dev);
2781 2809
2782/* Functions used for multicast addresses handling */ 2810/* Functions used for multicast addresses handling */
2783extern int dev_mc_add(struct net_device *dev, const unsigned char *addr); 2811int dev_mc_add(struct net_device *dev, const unsigned char *addr);
2784extern int dev_mc_add_global(struct net_device *dev, const unsigned char *addr); 2812int dev_mc_add_global(struct net_device *dev, const unsigned char *addr);
2785extern int dev_mc_add_excl(struct net_device *dev, const unsigned char *addr); 2813int dev_mc_add_excl(struct net_device *dev, const unsigned char *addr);
2786extern int dev_mc_del(struct net_device *dev, const unsigned char *addr); 2814int dev_mc_del(struct net_device *dev, const unsigned char *addr);
2787extern int dev_mc_del_global(struct net_device *dev, const unsigned char *addr); 2815int dev_mc_del_global(struct net_device *dev, const unsigned char *addr);
2788extern int dev_mc_sync(struct net_device *to, struct net_device *from); 2816int dev_mc_sync(struct net_device *to, struct net_device *from);
2789extern int dev_mc_sync_multiple(struct net_device *to, struct net_device *from); 2817int dev_mc_sync_multiple(struct net_device *to, struct net_device *from);
2790extern void dev_mc_unsync(struct net_device *to, struct net_device *from); 2818void dev_mc_unsync(struct net_device *to, struct net_device *from);
2791extern void dev_mc_flush(struct net_device *dev); 2819void dev_mc_flush(struct net_device *dev);
2792extern void dev_mc_init(struct net_device *dev); 2820void dev_mc_init(struct net_device *dev);
2793 2821
2794/* Functions used for secondary unicast and multicast support */ 2822/* Functions used for secondary unicast and multicast support */
2795extern void dev_set_rx_mode(struct net_device *dev); 2823void dev_set_rx_mode(struct net_device *dev);
2796extern void __dev_set_rx_mode(struct net_device *dev); 2824void __dev_set_rx_mode(struct net_device *dev);
2797extern int dev_set_promiscuity(struct net_device *dev, int inc); 2825int dev_set_promiscuity(struct net_device *dev, int inc);
2798extern int dev_set_allmulti(struct net_device *dev, int inc); 2826int dev_set_allmulti(struct net_device *dev, int inc);
2799extern void netdev_state_change(struct net_device *dev); 2827void netdev_state_change(struct net_device *dev);
2800extern void netdev_notify_peers(struct net_device *dev); 2828void netdev_notify_peers(struct net_device *dev);
2801extern void netdev_features_change(struct net_device *dev); 2829void netdev_features_change(struct net_device *dev);
2802/* Load a device via the kmod */ 2830/* Load a device via the kmod */
2803extern void dev_load(struct net *net, const char *name); 2831void dev_load(struct net *net, const char *name);
2804extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev, 2832struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
2805 struct rtnl_link_stats64 *storage); 2833 struct rtnl_link_stats64 *storage);
2806extern void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64, 2834void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64,
2807 const struct net_device_stats *netdev_stats); 2835 const struct net_device_stats *netdev_stats);
2808 2836
2809extern int netdev_max_backlog; 2837extern int netdev_max_backlog;
2810extern int netdev_tstamp_prequeue; 2838extern int netdev_tstamp_prequeue;
2811extern int weight_p; 2839extern int weight_p;
2812extern int bpf_jit_enable; 2840extern int bpf_jit_enable;
2813 2841
2814extern bool netdev_has_upper_dev(struct net_device *dev, 2842bool netdev_has_upper_dev(struct net_device *dev, struct net_device *upper_dev);
2815 struct net_device *upper_dev); 2843bool netdev_has_any_upper_dev(struct net_device *dev);
2816extern bool netdev_has_any_upper_dev(struct net_device *dev); 2844struct net_device *netdev_all_upper_get_next_dev_rcu(struct net_device *dev,
2817extern struct net_device *netdev_upper_get_next_dev_rcu(struct net_device *dev, 2845 struct list_head **iter);
2818 struct list_head **iter);
2819 2846
2820/* iterate through upper list, must be called under RCU read lock */ 2847/* iterate through upper list, must be called under RCU read lock */
2821#define netdev_for_each_upper_dev_rcu(dev, upper, iter) \ 2848#define netdev_for_each_all_upper_dev_rcu(dev, updev, iter) \
2822 for (iter = &(dev)->upper_dev_list, \ 2849 for (iter = &(dev)->all_adj_list.upper, \
2823 upper = netdev_upper_get_next_dev_rcu(dev, &(iter)); \ 2850 updev = netdev_all_upper_get_next_dev_rcu(dev, &(iter)); \
2824 upper; \ 2851 updev; \
2825 upper = netdev_upper_get_next_dev_rcu(dev, &(iter))) 2852 updev = netdev_all_upper_get_next_dev_rcu(dev, &(iter)))
2826 2853
2827extern struct net_device *netdev_master_upper_dev_get(struct net_device *dev); 2854void *netdev_lower_get_next_private(struct net_device *dev,
2828extern struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev); 2855 struct list_head **iter);
2829extern int netdev_upper_dev_link(struct net_device *dev, 2856void *netdev_lower_get_next_private_rcu(struct net_device *dev,
2857 struct list_head **iter);
2858
2859#define netdev_for_each_lower_private(dev, priv, iter) \
2860 for (iter = (dev)->adj_list.lower.next, \
2861 priv = netdev_lower_get_next_private(dev, &(iter)); \
2862 priv; \
2863 priv = netdev_lower_get_next_private(dev, &(iter)))
2864
2865#define netdev_for_each_lower_private_rcu(dev, priv, iter) \
2866 for (iter = &(dev)->adj_list.lower, \
2867 priv = netdev_lower_get_next_private_rcu(dev, &(iter)); \
2868 priv; \
2869 priv = netdev_lower_get_next_private_rcu(dev, &(iter)))
2870
2871void *netdev_adjacent_get_private(struct list_head *adj_list);
2872struct net_device *netdev_master_upper_dev_get(struct net_device *dev);
2873struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev);
2874int netdev_upper_dev_link(struct net_device *dev, struct net_device *upper_dev);
2875int netdev_master_upper_dev_link(struct net_device *dev,
2830 struct net_device *upper_dev); 2876 struct net_device *upper_dev);
2831extern int netdev_master_upper_dev_link(struct net_device *dev, 2877int netdev_master_upper_dev_link_private(struct net_device *dev,
2832 struct net_device *upper_dev); 2878 struct net_device *upper_dev,
2833extern void netdev_upper_dev_unlink(struct net_device *dev, 2879 void *private);
2834 struct net_device *upper_dev); 2880void netdev_upper_dev_unlink(struct net_device *dev,
2835extern int skb_checksum_help(struct sk_buff *skb); 2881 struct net_device *upper_dev);
2836extern struct sk_buff *__skb_gso_segment(struct sk_buff *skb, 2882void *netdev_lower_dev_get_private_rcu(struct net_device *dev,
2837 netdev_features_t features, bool tx_path); 2883 struct net_device *lower_dev);
2838extern struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb, 2884void *netdev_lower_dev_get_private(struct net_device *dev,
2839 netdev_features_t features); 2885 struct net_device *lower_dev);
2886int skb_checksum_help(struct sk_buff *skb);
2887struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
2888 netdev_features_t features, bool tx_path);
2889struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb,
2890 netdev_features_t features);
2840 2891
2841static inline 2892static inline
2842struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features) 2893struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features)
@@ -2858,26 +2909,26 @@ static inline bool can_checksum_protocol(netdev_features_t features,
2858} 2909}
2859 2910
2860#ifdef CONFIG_BUG 2911#ifdef CONFIG_BUG
2861extern void netdev_rx_csum_fault(struct net_device *dev); 2912void netdev_rx_csum_fault(struct net_device *dev);
2862#else 2913#else
2863static inline void netdev_rx_csum_fault(struct net_device *dev) 2914static inline void netdev_rx_csum_fault(struct net_device *dev)
2864{ 2915{
2865} 2916}
2866#endif 2917#endif
2867/* rx skb timestamps */ 2918/* rx skb timestamps */
2868extern void net_enable_timestamp(void); 2919void net_enable_timestamp(void);
2869extern void net_disable_timestamp(void); 2920void net_disable_timestamp(void);
2870 2921
2871#ifdef CONFIG_PROC_FS 2922#ifdef CONFIG_PROC_FS
2872extern int __init dev_proc_init(void); 2923int __init dev_proc_init(void);
2873#else 2924#else
2874#define dev_proc_init() 0 2925#define dev_proc_init() 0
2875#endif 2926#endif
2876 2927
2877extern int netdev_class_create_file_ns(struct class_attribute *class_attr, 2928int netdev_class_create_file_ns(struct class_attribute *class_attr,
2878 const void *ns); 2929 const void *ns);
2879extern void netdev_class_remove_file_ns(struct class_attribute *class_attr, 2930void netdev_class_remove_file_ns(struct class_attribute *class_attr,
2880 const void *ns); 2931 const void *ns);
2881 2932
2882static inline int netdev_class_create_file(struct class_attribute *class_attr) 2933static inline int netdev_class_create_file(struct class_attribute *class_attr)
2883{ 2934{
@@ -2891,9 +2942,9 @@ static inline void netdev_class_remove_file(struct class_attribute *class_attr)
2891 2942
2892extern struct kobj_ns_type_operations net_ns_type_operations; 2943extern struct kobj_ns_type_operations net_ns_type_operations;
2893 2944
2894extern const char *netdev_drivername(const struct net_device *dev); 2945const char *netdev_drivername(const struct net_device *dev);
2895 2946
2896extern void linkwatch_run_queue(void); 2947void linkwatch_run_queue(void);
2897 2948
2898static inline netdev_features_t netdev_get_wanted_features( 2949static inline netdev_features_t netdev_get_wanted_features(
2899 struct net_device *dev) 2950 struct net_device *dev)
@@ -2957,6 +3008,11 @@ static inline void netif_set_gso_max_size(struct net_device *dev,
2957 dev->gso_max_size = size; 3008 dev->gso_max_size = size;
2958} 3009}
2959 3010
3011static inline bool netif_is_macvlan(struct net_device *dev)
3012{
3013 return dev->priv_flags & IFF_MACVLAN;
3014}
3015
2960static inline bool netif_is_bond_master(struct net_device *dev) 3016static inline bool netif_is_bond_master(struct net_device *dev)
2961{ 3017{
2962 return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING; 3018 return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING;
@@ -2985,22 +3041,22 @@ static inline const char *netdev_name(const struct net_device *dev)
2985 return dev->name; 3041 return dev->name;
2986} 3042}
2987 3043
2988extern __printf(3, 4) 3044__printf(3, 4)
2989int netdev_printk(const char *level, const struct net_device *dev, 3045int netdev_printk(const char *level, const struct net_device *dev,
2990 const char *format, ...); 3046 const char *format, ...);
2991extern __printf(2, 3) 3047__printf(2, 3)
2992int netdev_emerg(const struct net_device *dev, const char *format, ...); 3048int netdev_emerg(const struct net_device *dev, const char *format, ...);
2993extern __printf(2, 3) 3049__printf(2, 3)
2994int netdev_alert(const struct net_device *dev, const char *format, ...); 3050int netdev_alert(const struct net_device *dev, const char *format, ...);
2995extern __printf(2, 3) 3051__printf(2, 3)
2996int netdev_crit(const struct net_device *dev, const char *format, ...); 3052int netdev_crit(const struct net_device *dev, const char *format, ...);
2997extern __printf(2, 3) 3053__printf(2, 3)
2998int netdev_err(const struct net_device *dev, const char *format, ...); 3054int netdev_err(const struct net_device *dev, const char *format, ...);
2999extern __printf(2, 3) 3055__printf(2, 3)
3000int netdev_warn(const struct net_device *dev, const char *format, ...); 3056int netdev_warn(const struct net_device *dev, const char *format, ...);
3001extern __printf(2, 3) 3057__printf(2, 3)
3002int netdev_notice(const struct net_device *dev, const char *format, ...); 3058int netdev_notice(const struct net_device *dev, const char *format, ...);
3003extern __printf(2, 3) 3059__printf(2, 3)
3004int netdev_info(const struct net_device *dev, const char *format, ...); 3060int netdev_info(const struct net_device *dev, const char *format, ...);
3005 3061
3006#define MODULE_ALIAS_NETDEV(device) \ 3062#define MODULE_ALIAS_NETDEV(device) \
@@ -3041,7 +3097,7 @@ do { \
3041 * file/line information and a backtrace. 3097 * file/line information and a backtrace.
3042 */ 3098 */
3043#define netdev_WARN(dev, format, args...) \ 3099#define netdev_WARN(dev, format, args...) \
3044 WARN(1, "netdevice: %s\n" format, netdev_name(dev), ##args); 3100 WARN(1, "netdevice: %s\n" format, netdev_name(dev), ##args)
3045 3101
3046/* netif printk helpers, similar to netdev_printk */ 3102/* netif printk helpers, similar to netdev_printk */
3047 3103