diff options
Diffstat (limited to 'include/linux/netdevice.h')
| -rw-r--r-- | include/linux/netdevice.h | 516 |
1 files changed, 292 insertions, 224 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 25f5d2d11e7c..7f0ed423a360 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 | ||
| 63 | extern void netdev_set_default_ethtool_ops(struct net_device *dev, | 63 | void 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 | ||
| 301 | extern int __init netdev_boot_setup(char *str); | 301 | int __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 { | |||
| 394 | typedef enum rx_handler_result rx_handler_result_t; | 394 | typedef enum rx_handler_result rx_handler_result_t; |
| 395 | typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **pskb); | 395 | typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **pskb); |
| 396 | 396 | ||
| 397 | extern void __napi_schedule(struct napi_struct *n); | 397 | void __napi_schedule(struct napi_struct *n); |
| 398 | 398 | ||
| 399 | static inline bool napi_disable_pending(struct napi_struct *n) | 399 | static 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 | */ |
| 448 | extern void __napi_complete(struct napi_struct *n); | 448 | void __napi_complete(struct napi_struct *n); |
| 449 | extern void napi_complete(struct napi_struct *n); | 449 | void 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 | */ |
| 458 | extern struct napi_struct *napi_by_id(unsigned int napi_id); | 458 | struct 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 | */ |
| 466 | extern void napi_hash_add(struct napi_struct *napi); | 466 | void 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 | */ |
| 475 | extern void napi_hash_del(struct napi_struct *napi); | 475 | void 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 | */ |
| 484 | static inline void napi_disable(struct napi_struct *n) | 484 | static 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, | |||
| 664 | extern struct rps_sock_flow_table __rcu *rps_sock_flow_table; | 665 | extern struct rps_sock_flow_table __rcu *rps_sock_flow_table; |
| 665 | 666 | ||
| 666 | #ifdef CONFIG_RFS_ACCEL | 667 | #ifdef CONFIG_RFS_ACCEL |
| 667 | extern bool rps_may_expire_flow(struct net_device *dev, u16 rxq_index, | 668 | bool 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 | */ |
| 965 | struct net_device_ops { | 985 | struct 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 | ||
| 1490 | extern struct netdev_queue *netdev_pick_tx(struct net_device *dev, | 1531 | struct netdev_queue *netdev_pick_tx(struct net_device *dev, |
| 1491 | struct sk_buff *skb); | 1532 | struct sk_buff *skb); |
| 1492 | extern u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb); | 1533 | u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb); |
| 1493 | 1534 | ||
| 1494 | /* | 1535 | /* |
| 1495 | * Net namespace inlines | 1536 | * Net namespace inlines |
| @@ -1546,7 +1587,7 @@ static inline void *netdev_priv(const struct net_device *dev) | |||
| 1546 | #define SET_NETDEV_DEV(net, pdev) ((net)->dev.parent = (pdev)) | 1587 | #define SET_NETDEV_DEV(net, pdev) ((net)->dev.parent = (pdev)) |
| 1547 | 1588 | ||
| 1548 | /* Set the sysfs device type for the network logical device to allow | 1589 | /* Set the sysfs device type for the network logical device to allow |
| 1549 | * fin grained indentification of different network device types. For | 1590 | * fine-grained identification of different network device types. For |
| 1550 | * example Ethernet, Wirelss LAN, Bluetooth, WiMAX etc. | 1591 | * example Ethernet, Wirelss LAN, Bluetooth, WiMAX etc. |
| 1551 | */ | 1592 | */ |
| 1552 | #define SET_NETDEV_DEVTYPE(net, devtype) ((net)->dev.type = (devtype)) | 1593 | #define SET_NETDEV_DEVTYPE(net, devtype) ((net)->dev.type = (devtype)) |
| @@ -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 | ||
| 1676 | extern int register_netdevice_notifier(struct notifier_block *nb); | 1717 | int register_netdevice_notifier(struct notifier_block *nb); |
| 1677 | extern int unregister_netdevice_notifier(struct notifier_block *nb); | 1718 | int unregister_netdevice_notifier(struct notifier_block *nb); |
| 1678 | 1719 | ||
| 1679 | struct netdev_notifier_info { | 1720 | struct 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 | ||
| 1700 | extern int call_netdevice_notifiers_info(unsigned long val, struct net_device *dev, | 1741 | int call_netdevice_notifiers_info(unsigned long val, struct net_device *dev, |
| 1701 | struct netdev_notifier_info *info); | 1742 | struct netdev_notifier_info *info); |
| 1702 | extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev); | 1743 | int call_netdevice_notifiers(unsigned long val, struct net_device *dev); |
| 1703 | 1744 | ||
| 1704 | 1745 | ||
| 1705 | extern rwlock_t dev_base_lock; /* Device list lock */ | 1746 | extern 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 | ||
| 1757 | extern int netdev_boot_setup_check(struct net_device *dev); | 1798 | int netdev_boot_setup_check(struct net_device *dev); |
| 1758 | extern unsigned long netdev_boot_base(const char *prefix, int unit); | 1799 | unsigned long netdev_boot_base(const char *prefix, int unit); |
| 1759 | extern struct net_device *dev_getbyhwaddr_rcu(struct net *net, unsigned short type, | 1800 | struct net_device *dev_getbyhwaddr_rcu(struct net *net, unsigned short type, |
| 1760 | const char *hwaddr); | 1801 | const char *hwaddr); |
| 1761 | extern struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type); | 1802 | struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type); |
| 1762 | extern struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short type); | 1803 | struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short type); |
| 1763 | extern void dev_add_pack(struct packet_type *pt); | 1804 | void dev_add_pack(struct packet_type *pt); |
| 1764 | extern void dev_remove_pack(struct packet_type *pt); | 1805 | void dev_remove_pack(struct packet_type *pt); |
| 1765 | extern void __dev_remove_pack(struct packet_type *pt); | 1806 | void __dev_remove_pack(struct packet_type *pt); |
| 1766 | extern void dev_add_offload(struct packet_offload *po); | 1807 | void dev_add_offload(struct packet_offload *po); |
| 1767 | extern void dev_remove_offload(struct packet_offload *po); | 1808 | void dev_remove_offload(struct packet_offload *po); |
| 1768 | extern void __dev_remove_offload(struct packet_offload *po); | 1809 | void __dev_remove_offload(struct packet_offload *po); |
| 1769 | 1810 | ||
| 1770 | extern struct net_device *dev_get_by_flags_rcu(struct net *net, unsigned short flags, | 1811 | struct net_device *dev_get_by_flags_rcu(struct net *net, unsigned short flags, |
| 1771 | unsigned short mask); | 1812 | unsigned short mask); |
| 1772 | extern struct net_device *dev_get_by_name(struct net *net, const char *name); | 1813 | struct net_device *dev_get_by_name(struct net *net, const char *name); |
| 1773 | extern struct net_device *dev_get_by_name_rcu(struct net *net, const char *name); | 1814 | struct net_device *dev_get_by_name_rcu(struct net *net, const char *name); |
| 1774 | extern struct net_device *__dev_get_by_name(struct net *net, const char *name); | 1815 | struct net_device *__dev_get_by_name(struct net *net, const char *name); |
| 1775 | extern int dev_alloc_name(struct net_device *dev, const char *name); | 1816 | int dev_alloc_name(struct net_device *dev, const char *name); |
| 1776 | extern int dev_open(struct net_device *dev); | 1817 | int dev_open(struct net_device *dev); |
| 1777 | extern int dev_close(struct net_device *dev); | 1818 | int dev_close(struct net_device *dev); |
| 1778 | extern void dev_disable_lro(struct net_device *dev); | 1819 | void dev_disable_lro(struct net_device *dev); |
| 1779 | extern int dev_loopback_xmit(struct sk_buff *newskb); | 1820 | int dev_loopback_xmit(struct sk_buff *newskb); |
| 1780 | extern int dev_queue_xmit(struct sk_buff *skb); | 1821 | int dev_queue_xmit(struct sk_buff *skb); |
| 1781 | extern int register_netdevice(struct net_device *dev); | 1822 | int register_netdevice(struct net_device *dev); |
| 1782 | extern void unregister_netdevice_queue(struct net_device *dev, | 1823 | void unregister_netdevice_queue(struct net_device *dev, struct list_head *head); |
| 1783 | struct list_head *head); | 1824 | void unregister_netdevice_many(struct list_head *head); |
| 1784 | extern void unregister_netdevice_many(struct list_head *head); | ||
| 1785 | static inline void unregister_netdevice(struct net_device *dev) | 1825 | static 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 | ||
| 1790 | extern int netdev_refcnt_read(const struct net_device *dev); | 1830 | int netdev_refcnt_read(const struct net_device *dev); |
| 1791 | extern void free_netdev(struct net_device *dev); | 1831 | void free_netdev(struct net_device *dev); |
| 1792 | extern void synchronize_net(void); | 1832 | void netdev_freemem(struct net_device *dev); |
| 1793 | extern int init_dummy_netdev(struct net_device *dev); | 1833 | void synchronize_net(void); |
| 1834 | int init_dummy_netdev(struct net_device *dev); | ||
| 1794 | 1835 | ||
| 1795 | extern struct net_device *dev_get_by_index(struct net *net, int ifindex); | 1836 | struct net_device *dev_get_by_index(struct net *net, int ifindex); |
| 1796 | extern struct net_device *__dev_get_by_index(struct net *net, int ifindex); | 1837 | struct net_device *__dev_get_by_index(struct net *net, int ifindex); |
| 1797 | extern struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex); | 1838 | struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex); |
| 1798 | extern int netdev_get_name(struct net *net, char *name, int ifindex); | 1839 | int netdev_get_name(struct net *net, char *name, int ifindex); |
| 1799 | extern int dev_restart(struct net_device *dev); | 1840 | int dev_restart(struct net_device *dev); |
| 1800 | #ifdef CONFIG_NETPOLL_TRAP | 1841 | #ifdef CONFIG_NETPOLL_TRAP |
| 1801 | extern int netpoll_trap(void); | 1842 | int netpoll_trap(void); |
| 1802 | #endif | 1843 | #endif |
| 1803 | extern int skb_gro_receive(struct sk_buff **head, | 1844 | int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb); |
| 1804 | struct sk_buff *skb); | ||
| 1805 | 1845 | ||
| 1806 | static inline unsigned int skb_gro_offset(const struct sk_buff *skb) | 1846 | static 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 | ||
| 1875 | typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len); | 1915 | typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len); |
| 1876 | extern int register_gifconf(unsigned int family, gifconf_func_t * gifconf); | 1916 | int register_gifconf(unsigned int family, gifconf_func_t *gifconf); |
| 1877 | static inline int unregister_gifconf(unsigned int family) | 1917 | static 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 | ||
| 1945 | DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data); | 1985 | DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data); |
| 1946 | 1986 | ||
| 1947 | extern void __netif_schedule(struct Qdisc *q); | 1987 | void __netif_schedule(struct Qdisc *q); |
| 1948 | 1988 | ||
| 1949 | static inline void netif_schedule_queue(struct netdev_queue *txq) | 1989 | static 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 |
| 2267 | extern int netif_set_xps_queue(struct net_device *dev, | 2307 | int 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 |
| 2271 | static inline int netif_set_xps_queue(struct net_device *dev, | 2310 | static 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 | ||
| 2300 | extern int netif_set_real_num_tx_queues(struct net_device *dev, | 2339 | int 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 |
| 2304 | extern int netif_set_real_num_rx_queues(struct net_device *dev, | 2342 | int netif_set_real_num_rx_queues(struct net_device *dev, unsigned int rxq); |
| 2305 | unsigned int rxq); | ||
| 2306 | #else | 2343 | #else |
| 2307 | static inline int netif_set_real_num_rx_queues(struct net_device *dev, | 2344 | static 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) |
| 2332 | extern int netif_get_num_default_rss_queues(void); | 2369 | int 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 | */ |
| 2338 | extern void dev_kfree_skb_irq(struct sk_buff *skb); | 2375 | void 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 | */ |
| 2344 | extern void dev_kfree_skb_any(struct sk_buff *skb); | 2381 | void dev_kfree_skb_any(struct sk_buff *skb); |
| 2345 | 2382 | ||
| 2346 | extern int netif_rx(struct sk_buff *skb); | 2383 | int netif_rx(struct sk_buff *skb); |
| 2347 | extern int netif_rx_ni(struct sk_buff *skb); | 2384 | int netif_rx_ni(struct sk_buff *skb); |
| 2348 | extern int netif_receive_skb(struct sk_buff *skb); | 2385 | int netif_receive_skb(struct sk_buff *skb); |
| 2349 | extern gro_result_t napi_gro_receive(struct napi_struct *napi, | 2386 | gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb); |
| 2350 | struct sk_buff *skb); | 2387 | void napi_gro_flush(struct napi_struct *napi, bool flush_old); |
| 2351 | extern void napi_gro_flush(struct napi_struct *napi, bool flush_old); | 2388 | struct sk_buff *napi_get_frags(struct napi_struct *napi); |
| 2352 | extern struct sk_buff * napi_get_frags(struct napi_struct *napi); | 2389 | gro_result_t napi_gro_frags(struct napi_struct *napi); |
| 2353 | extern gro_result_t napi_gro_frags(struct napi_struct *napi); | ||
| 2354 | 2390 | ||
| 2355 | static inline void napi_free_frags(struct napi_struct *napi) | 2391 | static 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 | ||
| 2361 | extern int netdev_rx_handler_register(struct net_device *dev, | 2397 | int 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); |
| 2364 | extern void netdev_rx_handler_unregister(struct net_device *dev); | 2400 | void netdev_rx_handler_unregister(struct net_device *dev); |
| 2365 | 2401 | ||
| 2366 | extern bool dev_valid_name(const char *name); | 2402 | bool dev_valid_name(const char *name); |
| 2367 | extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); | 2403 | int dev_ioctl(struct net *net, unsigned int cmd, void __user *); |
| 2368 | extern int dev_ethtool(struct net *net, struct ifreq *); | 2404 | int dev_ethtool(struct net *net, struct ifreq *); |
| 2369 | extern unsigned int dev_get_flags(const struct net_device *); | 2405 | unsigned int dev_get_flags(const struct net_device *); |
| 2370 | extern int __dev_change_flags(struct net_device *, unsigned int flags); | 2406 | int __dev_change_flags(struct net_device *, unsigned int flags); |
| 2371 | extern int dev_change_flags(struct net_device *, unsigned int); | 2407 | int dev_change_flags(struct net_device *, unsigned int); |
| 2372 | extern void __dev_notify_flags(struct net_device *, unsigned int old_flags); | 2408 | void __dev_notify_flags(struct net_device *, unsigned int old_flags, |
| 2373 | extern int dev_change_name(struct net_device *, const char *); | 2409 | unsigned int gchanges); |
| 2374 | extern int dev_set_alias(struct net_device *, const char *, size_t); | 2410 | int dev_change_name(struct net_device *, const char *); |
| 2375 | extern int dev_change_net_namespace(struct net_device *, | 2411 | int dev_set_alias(struct net_device *, const char *, size_t); |
| 2376 | struct net *, const char *); | 2412 | int dev_change_net_namespace(struct net_device *, struct net *, const char *); |
| 2377 | extern int dev_set_mtu(struct net_device *, int); | 2413 | int dev_set_mtu(struct net_device *, int); |
| 2378 | extern void dev_set_group(struct net_device *, int); | 2414 | void dev_set_group(struct net_device *, int); |
| 2379 | extern int dev_set_mac_address(struct net_device *, | 2415 | int dev_set_mac_address(struct net_device *, struct sockaddr *); |
| 2380 | struct sockaddr *); | 2416 | int dev_change_carrier(struct net_device *, bool new_carrier); |
| 2381 | extern int dev_change_carrier(struct net_device *, | 2417 | int dev_get_phys_port_id(struct net_device *dev, |
| 2382 | bool new_carrier); | 2418 | struct netdev_phys_port_id *ppid); |
| 2383 | extern int dev_get_phys_port_id(struct net_device *dev, | 2419 | int 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); |
| 2385 | extern int dev_hard_start_xmit(struct sk_buff *skb, | 2421 | int dev_forward_skb(struct net_device *dev, struct sk_buff *skb); |
| 2386 | struct net_device *dev, | ||
| 2387 | struct netdev_queue *txq); | ||
| 2388 | extern int dev_forward_skb(struct net_device *dev, | ||
| 2389 | struct sk_buff *skb); | ||
| 2390 | 2422 | ||
| 2391 | extern int netdev_budget; | 2423 | extern int netdev_budget; |
| 2392 | 2424 | ||
| 2393 | /* Called by rtnetlink.c:rtnl_unlock() */ | 2425 | /* Called by rtnetlink.c:rtnl_unlock() */ |
| 2394 | extern void netdev_run_todo(void); | 2426 | void 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 | ||
| 2427 | extern void linkwatch_init_dev(struct net_device *dev); | 2459 | void linkwatch_init_dev(struct net_device *dev); |
| 2428 | extern void linkwatch_fire_event(struct net_device *dev); | 2460 | void linkwatch_fire_event(struct net_device *dev); |
| 2429 | extern void linkwatch_forget_dev(struct net_device *dev); | 2461 | void 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 | ||
| 2442 | extern unsigned long dev_trans_start(struct net_device *dev); | 2474 | unsigned long dev_trans_start(struct net_device *dev); |
| 2443 | 2475 | ||
| 2444 | extern void __netdev_watchdog_up(struct net_device *dev); | 2476 | void __netdev_watchdog_up(struct net_device *dev); |
| 2445 | 2477 | ||
| 2446 | extern void netif_carrier_on(struct net_device *dev); | 2478 | void netif_carrier_on(struct net_device *dev); |
| 2447 | 2479 | ||
| 2448 | extern void netif_carrier_off(struct net_device *dev); | 2480 | void 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 | ||
| 2516 | extern void netif_device_detach(struct net_device *dev); | 2548 | void netif_device_detach(struct net_device *dev); |
| 2517 | 2549 | ||
| 2518 | extern void netif_device_attach(struct net_device *dev); | 2550 | void 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 | ||
| 2727 | extern void ether_setup(struct net_device *dev); | 2759 | void ether_setup(struct net_device *dev); |
| 2728 | 2760 | ||
| 2729 | /* Support for loadable net-drivers */ | 2761 | /* Support for loadable net-drivers */ |
| 2730 | extern struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, | 2762 | struct 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 | ||
| 2739 | extern int register_netdev(struct net_device *dev); | 2771 | int register_netdev(struct net_device *dev); |
| 2740 | extern void unregister_netdev(struct net_device *dev); | 2772 | void unregister_netdev(struct net_device *dev); |
| 2741 | 2773 | ||
| 2742 | /* General hardware address lists handling functions */ | 2774 | /* General hardware address lists handling functions */ |
| 2743 | extern int __hw_addr_add_multiple(struct netdev_hw_addr_list *to_list, | 2775 | int __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); |
| 2746 | extern void __hw_addr_del_multiple(struct netdev_hw_addr_list *to_list, | 2778 | void __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); |
| 2749 | extern int __hw_addr_sync(struct netdev_hw_addr_list *to_list, | 2781 | int __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); | 2783 | void __hw_addr_unsync(struct netdev_hw_addr_list *to_list, |
| 2752 | extern 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, | 2785 | void __hw_addr_flush(struct netdev_hw_addr_list *list); |
| 2754 | int addr_len); | 2786 | void __hw_addr_init(struct netdev_hw_addr_list *list); |
| 2755 | extern void __hw_addr_flush(struct netdev_hw_addr_list *list); | ||
| 2756 | extern 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 */ |
| 2759 | extern int dev_addr_add(struct net_device *dev, const unsigned char *addr, | 2789 | int dev_addr_add(struct net_device *dev, const unsigned char *addr, |
| 2760 | unsigned char addr_type); | 2790 | unsigned char addr_type); |
| 2761 | extern int dev_addr_del(struct net_device *dev, const unsigned char *addr, | 2791 | int dev_addr_del(struct net_device *dev, const unsigned char *addr, |
| 2762 | unsigned char addr_type); | 2792 | unsigned char addr_type); |
| 2763 | extern int dev_addr_add_multiple(struct net_device *to_dev, | 2793 | int 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); | 2795 | int dev_addr_del_multiple(struct net_device *to_dev, |
| 2766 | extern 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, | 2797 | void dev_addr_flush(struct net_device *dev); |
| 2768 | unsigned char addr_type); | 2798 | int dev_addr_init(struct net_device *dev); |
| 2769 | extern void dev_addr_flush(struct net_device *dev); | ||
| 2770 | extern int dev_addr_init(struct net_device *dev); | ||
| 2771 | 2799 | ||
| 2772 | /* Functions used for unicast addresses handling */ | 2800 | /* Functions used for unicast addresses handling */ |
| 2773 | extern int dev_uc_add(struct net_device *dev, const unsigned char *addr); | 2801 | int dev_uc_add(struct net_device *dev, const unsigned char *addr); |
| 2774 | extern int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr); | 2802 | int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr); |
| 2775 | extern int dev_uc_del(struct net_device *dev, const unsigned char *addr); | 2803 | int dev_uc_del(struct net_device *dev, const unsigned char *addr); |
| 2776 | extern int dev_uc_sync(struct net_device *to, struct net_device *from); | 2804 | int dev_uc_sync(struct net_device *to, struct net_device *from); |
| 2777 | extern int dev_uc_sync_multiple(struct net_device *to, struct net_device *from); | 2805 | int dev_uc_sync_multiple(struct net_device *to, struct net_device *from); |
| 2778 | extern void dev_uc_unsync(struct net_device *to, struct net_device *from); | 2806 | void dev_uc_unsync(struct net_device *to, struct net_device *from); |
| 2779 | extern void dev_uc_flush(struct net_device *dev); | 2807 | void dev_uc_flush(struct net_device *dev); |
| 2780 | extern void dev_uc_init(struct net_device *dev); | 2808 | void dev_uc_init(struct net_device *dev); |
| 2781 | 2809 | ||
| 2782 | /* Functions used for multicast addresses handling */ | 2810 | /* Functions used for multicast addresses handling */ |
| 2783 | extern int dev_mc_add(struct net_device *dev, const unsigned char *addr); | 2811 | int dev_mc_add(struct net_device *dev, const unsigned char *addr); |
| 2784 | extern int dev_mc_add_global(struct net_device *dev, const unsigned char *addr); | 2812 | int dev_mc_add_global(struct net_device *dev, const unsigned char *addr); |
| 2785 | extern int dev_mc_add_excl(struct net_device *dev, const unsigned char *addr); | 2813 | int dev_mc_add_excl(struct net_device *dev, const unsigned char *addr); |
| 2786 | extern int dev_mc_del(struct net_device *dev, const unsigned char *addr); | 2814 | int dev_mc_del(struct net_device *dev, const unsigned char *addr); |
| 2787 | extern int dev_mc_del_global(struct net_device *dev, const unsigned char *addr); | 2815 | int dev_mc_del_global(struct net_device *dev, const unsigned char *addr); |
| 2788 | extern int dev_mc_sync(struct net_device *to, struct net_device *from); | 2816 | int dev_mc_sync(struct net_device *to, struct net_device *from); |
| 2789 | extern int dev_mc_sync_multiple(struct net_device *to, struct net_device *from); | 2817 | int dev_mc_sync_multiple(struct net_device *to, struct net_device *from); |
| 2790 | extern void dev_mc_unsync(struct net_device *to, struct net_device *from); | 2818 | void dev_mc_unsync(struct net_device *to, struct net_device *from); |
| 2791 | extern void dev_mc_flush(struct net_device *dev); | 2819 | void dev_mc_flush(struct net_device *dev); |
| 2792 | extern void dev_mc_init(struct net_device *dev); | 2820 | void 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 */ |
| 2795 | extern void dev_set_rx_mode(struct net_device *dev); | 2823 | void dev_set_rx_mode(struct net_device *dev); |
| 2796 | extern void __dev_set_rx_mode(struct net_device *dev); | 2824 | void __dev_set_rx_mode(struct net_device *dev); |
| 2797 | extern int dev_set_promiscuity(struct net_device *dev, int inc); | 2825 | int dev_set_promiscuity(struct net_device *dev, int inc); |
| 2798 | extern int dev_set_allmulti(struct net_device *dev, int inc); | 2826 | int dev_set_allmulti(struct net_device *dev, int inc); |
| 2799 | extern void netdev_state_change(struct net_device *dev); | 2827 | void netdev_state_change(struct net_device *dev); |
| 2800 | extern void netdev_notify_peers(struct net_device *dev); | 2828 | void netdev_notify_peers(struct net_device *dev); |
| 2801 | extern void netdev_features_change(struct net_device *dev); | 2829 | void netdev_features_change(struct net_device *dev); |
| 2802 | /* Load a device via the kmod */ | 2830 | /* Load a device via the kmod */ |
| 2803 | extern void dev_load(struct net *net, const char *name); | 2831 | void dev_load(struct net *net, const char *name); |
| 2804 | extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev, | 2832 | struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev, |
| 2805 | struct rtnl_link_stats64 *storage); | 2833 | struct rtnl_link_stats64 *storage); |
| 2806 | extern void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64, | 2834 | void 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 | ||
| 2809 | extern int netdev_max_backlog; | 2837 | extern int netdev_max_backlog; |
| 2810 | extern int netdev_tstamp_prequeue; | 2838 | extern int netdev_tstamp_prequeue; |
| 2811 | extern int weight_p; | 2839 | extern int weight_p; |
| 2812 | extern int bpf_jit_enable; | 2840 | extern int bpf_jit_enable; |
| 2813 | 2841 | ||
| 2814 | extern bool netdev_has_upper_dev(struct net_device *dev, | 2842 | bool netdev_has_upper_dev(struct net_device *dev, struct net_device *upper_dev); |
| 2815 | struct net_device *upper_dev); | 2843 | bool netdev_has_any_upper_dev(struct net_device *dev); |
| 2816 | extern bool netdev_has_any_upper_dev(struct net_device *dev); | 2844 | struct net_device *netdev_all_upper_get_next_dev_rcu(struct net_device *dev, |
| 2817 | extern 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 | ||
| 2827 | extern struct net_device *netdev_master_upper_dev_get(struct net_device *dev); | 2854 | void *netdev_lower_get_next_private(struct net_device *dev, |
| 2828 | extern struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev); | 2855 | struct list_head **iter); |
| 2829 | extern int netdev_upper_dev_link(struct net_device *dev, | 2856 | void *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 | |||
| 2871 | void *netdev_adjacent_get_private(struct list_head *adj_list); | ||
| 2872 | struct net_device *netdev_master_upper_dev_get(struct net_device *dev); | ||
| 2873 | struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev); | ||
| 2874 | int netdev_upper_dev_link(struct net_device *dev, struct net_device *upper_dev); | ||
| 2875 | int netdev_master_upper_dev_link(struct net_device *dev, | ||
| 2830 | struct net_device *upper_dev); | 2876 | struct net_device *upper_dev); |
| 2831 | extern int netdev_master_upper_dev_link(struct net_device *dev, | 2877 | int netdev_master_upper_dev_link_private(struct net_device *dev, |
| 2832 | struct net_device *upper_dev); | 2878 | struct net_device *upper_dev, |
| 2833 | extern void netdev_upper_dev_unlink(struct net_device *dev, | 2879 | void *private); |
| 2834 | struct net_device *upper_dev); | 2880 | void netdev_upper_dev_unlink(struct net_device *dev, |
| 2835 | extern int skb_checksum_help(struct sk_buff *skb); | 2881 | struct net_device *upper_dev); |
| 2836 | extern struct sk_buff *__skb_gso_segment(struct sk_buff *skb, | 2882 | void *netdev_lower_dev_get_private_rcu(struct net_device *dev, |
| 2837 | netdev_features_t features, bool tx_path); | 2883 | struct net_device *lower_dev); |
| 2838 | extern struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb, | 2884 | void *netdev_lower_dev_get_private(struct net_device *dev, |
| 2839 | netdev_features_t features); | 2885 | struct net_device *lower_dev); |
| 2886 | int skb_checksum_help(struct sk_buff *skb); | ||
| 2887 | struct sk_buff *__skb_gso_segment(struct sk_buff *skb, | ||
| 2888 | netdev_features_t features, bool tx_path); | ||
| 2889 | struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb, | ||
| 2890 | netdev_features_t features); | ||
| 2840 | 2891 | ||
| 2841 | static inline | 2892 | static inline |
| 2842 | struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features) | 2893 | struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features) |
| @@ -2858,30 +2909,42 @@ static inline bool can_checksum_protocol(netdev_features_t features, | |||
| 2858 | } | 2909 | } |
| 2859 | 2910 | ||
| 2860 | #ifdef CONFIG_BUG | 2911 | #ifdef CONFIG_BUG |
| 2861 | extern void netdev_rx_csum_fault(struct net_device *dev); | 2912 | void netdev_rx_csum_fault(struct net_device *dev); |
| 2862 | #else | 2913 | #else |
| 2863 | static inline void netdev_rx_csum_fault(struct net_device *dev) | 2914 | static 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 */ |
| 2868 | extern void net_enable_timestamp(void); | 2919 | void net_enable_timestamp(void); |
| 2869 | extern void net_disable_timestamp(void); | 2920 | void net_disable_timestamp(void); |
| 2870 | 2921 | ||
| 2871 | #ifdef CONFIG_PROC_FS | 2922 | #ifdef CONFIG_PROC_FS |
| 2872 | extern int __init dev_proc_init(void); | 2923 | int __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 | ||
| 2877 | extern int netdev_class_create_file(struct class_attribute *class_attr); | 2928 | int netdev_class_create_file_ns(struct class_attribute *class_attr, |
| 2878 | extern void netdev_class_remove_file(struct class_attribute *class_attr); | 2929 | const void *ns); |
| 2930 | void netdev_class_remove_file_ns(struct class_attribute *class_attr, | ||
| 2931 | const void *ns); | ||
| 2932 | |||
| 2933 | static inline int netdev_class_create_file(struct class_attribute *class_attr) | ||
| 2934 | { | ||
| 2935 | return netdev_class_create_file_ns(class_attr, NULL); | ||
| 2936 | } | ||
| 2937 | |||
| 2938 | static inline void netdev_class_remove_file(struct class_attribute *class_attr) | ||
| 2939 | { | ||
| 2940 | netdev_class_remove_file_ns(class_attr, NULL); | ||
| 2941 | } | ||
| 2879 | 2942 | ||
| 2880 | extern struct kobj_ns_type_operations net_ns_type_operations; | 2943 | extern struct kobj_ns_type_operations net_ns_type_operations; |
| 2881 | 2944 | ||
| 2882 | extern const char *netdev_drivername(const struct net_device *dev); | 2945 | const char *netdev_drivername(const struct net_device *dev); |
| 2883 | 2946 | ||
| 2884 | extern void linkwatch_run_queue(void); | 2947 | void linkwatch_run_queue(void); |
| 2885 | 2948 | ||
| 2886 | static inline netdev_features_t netdev_get_wanted_features( | 2949 | static inline netdev_features_t netdev_get_wanted_features( |
| 2887 | struct net_device *dev) | 2950 | struct net_device *dev) |
| @@ -2945,6 +3008,11 @@ static inline void netif_set_gso_max_size(struct net_device *dev, | |||
| 2945 | dev->gso_max_size = size; | 3008 | dev->gso_max_size = size; |
| 2946 | } | 3009 | } |
| 2947 | 3010 | ||
| 3011 | static inline bool netif_is_macvlan(struct net_device *dev) | ||
| 3012 | { | ||
| 3013 | return dev->priv_flags & IFF_MACVLAN; | ||
| 3014 | } | ||
| 3015 | |||
| 2948 | static inline bool netif_is_bond_master(struct net_device *dev) | 3016 | static inline bool netif_is_bond_master(struct net_device *dev) |
| 2949 | { | 3017 | { |
| 2950 | return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING; | 3018 | return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING; |
| @@ -2973,22 +3041,22 @@ static inline const char *netdev_name(const struct net_device *dev) | |||
| 2973 | return dev->name; | 3041 | return dev->name; |
| 2974 | } | 3042 | } |
| 2975 | 3043 | ||
| 2976 | extern __printf(3, 4) | 3044 | __printf(3, 4) |
| 2977 | int netdev_printk(const char *level, const struct net_device *dev, | 3045 | int netdev_printk(const char *level, const struct net_device *dev, |
| 2978 | const char *format, ...); | 3046 | const char *format, ...); |
| 2979 | extern __printf(2, 3) | 3047 | __printf(2, 3) |
| 2980 | int netdev_emerg(const struct net_device *dev, const char *format, ...); | 3048 | int netdev_emerg(const struct net_device *dev, const char *format, ...); |
| 2981 | extern __printf(2, 3) | 3049 | __printf(2, 3) |
| 2982 | int netdev_alert(const struct net_device *dev, const char *format, ...); | 3050 | int netdev_alert(const struct net_device *dev, const char *format, ...); |
| 2983 | extern __printf(2, 3) | 3051 | __printf(2, 3) |
| 2984 | int netdev_crit(const struct net_device *dev, const char *format, ...); | 3052 | int netdev_crit(const struct net_device *dev, const char *format, ...); |
| 2985 | extern __printf(2, 3) | 3053 | __printf(2, 3) |
| 2986 | int netdev_err(const struct net_device *dev, const char *format, ...); | 3054 | int netdev_err(const struct net_device *dev, const char *format, ...); |
| 2987 | extern __printf(2, 3) | 3055 | __printf(2, 3) |
| 2988 | int netdev_warn(const struct net_device *dev, const char *format, ...); | 3056 | int netdev_warn(const struct net_device *dev, const char *format, ...); |
| 2989 | extern __printf(2, 3) | 3057 | __printf(2, 3) |
| 2990 | int netdev_notice(const struct net_device *dev, const char *format, ...); | 3058 | int netdev_notice(const struct net_device *dev, const char *format, ...); |
| 2991 | extern __printf(2, 3) | 3059 | __printf(2, 3) |
| 2992 | int netdev_info(const struct net_device *dev, const char *format, ...); | 3060 | int netdev_info(const struct net_device *dev, const char *format, ...); |
| 2993 | 3061 | ||
| 2994 | #define MODULE_ALIAS_NETDEV(device) \ | 3062 | #define MODULE_ALIAS_NETDEV(device) \ |
| @@ -3029,7 +3097,7 @@ do { \ | |||
| 3029 | * file/line information and a backtrace. | 3097 | * file/line information and a backtrace. |
| 3030 | */ | 3098 | */ |
| 3031 | #define netdev_WARN(dev, format, args...) \ | 3099 | #define netdev_WARN(dev, format, args...) \ |
| 3032 | WARN(1, "netdevice: %s\n" format, netdev_name(dev), ##args); | 3100 | WARN(1, "netdevice: %s\n" format, netdev_name(dev), ##args) |
| 3033 | 3101 | ||
| 3034 | /* netif printk helpers, similar to netdev_printk */ | 3102 | /* netif printk helpers, similar to netdev_printk */ |
| 3035 | 3103 | ||
