diff options
Diffstat (limited to 'include/linux/netdevice.h')
| -rw-r--r-- | include/linux/netdevice.h | 85 |
1 files changed, 83 insertions, 2 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 96e4c21e15e0..0741a1e919a5 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -324,12 +324,15 @@ struct napi_struct { | |||
| 324 | struct sk_buff *gro_list; | 324 | struct sk_buff *gro_list; |
| 325 | struct sk_buff *skb; | 325 | struct sk_buff *skb; |
| 326 | struct list_head dev_list; | 326 | struct list_head dev_list; |
| 327 | struct hlist_node napi_hash_node; | ||
| 328 | unsigned int napi_id; | ||
| 327 | }; | 329 | }; |
| 328 | 330 | ||
| 329 | enum { | 331 | enum { |
| 330 | NAPI_STATE_SCHED, /* Poll is scheduled */ | 332 | NAPI_STATE_SCHED, /* Poll is scheduled */ |
| 331 | NAPI_STATE_DISABLE, /* Disable pending */ | 333 | NAPI_STATE_DISABLE, /* Disable pending */ |
| 332 | NAPI_STATE_NPSVC, /* Netpoll - don't dequeue from poll_list */ | 334 | NAPI_STATE_NPSVC, /* Netpoll - don't dequeue from poll_list */ |
| 335 | NAPI_STATE_HASHED, /* In NAPI hash */ | ||
| 333 | }; | 336 | }; |
| 334 | 337 | ||
| 335 | enum gro_result { | 338 | enum gro_result { |
| @@ -446,6 +449,32 @@ extern void __napi_complete(struct napi_struct *n); | |||
| 446 | extern void napi_complete(struct napi_struct *n); | 449 | extern void napi_complete(struct napi_struct *n); |
| 447 | 450 | ||
| 448 | /** | 451 | /** |
| 452 | * napi_by_id - lookup a NAPI by napi_id | ||
| 453 | * @napi_id: hashed napi_id | ||
| 454 | * | ||
| 455 | * lookup @napi_id in napi_hash table | ||
| 456 | * must be called under rcu_read_lock() | ||
| 457 | */ | ||
| 458 | extern struct napi_struct *napi_by_id(unsigned int napi_id); | ||
| 459 | |||
| 460 | /** | ||
| 461 | * napi_hash_add - add a NAPI to global hashtable | ||
| 462 | * @napi: napi context | ||
| 463 | * | ||
| 464 | * generate a new napi_id and store a @napi under it in napi_hash | ||
| 465 | */ | ||
| 466 | extern void napi_hash_add(struct napi_struct *napi); | ||
| 467 | |||
| 468 | /** | ||
| 469 | * napi_hash_del - remove a NAPI from global table | ||
| 470 | * @napi: napi context | ||
| 471 | * | ||
| 472 | * Warning: caller must observe rcu grace period | ||
| 473 | * before freeing memory containing @napi | ||
| 474 | */ | ||
| 475 | extern void napi_hash_del(struct napi_struct *napi); | ||
| 476 | |||
| 477 | /** | ||
| 449 | * napi_disable - prevent NAPI from scheduling | 478 | * napi_disable - prevent NAPI from scheduling |
| 450 | * @n: napi context | 479 | * @n: napi context |
| 451 | * | 480 | * |
| @@ -800,6 +829,7 @@ struct netdev_fcoe_hbainfo { | |||
| 800 | * int (*ndo_set_vf_spoofchk)(struct net_device *dev, int vf, bool setting); | 829 | * int (*ndo_set_vf_spoofchk)(struct net_device *dev, int vf, bool setting); |
| 801 | * int (*ndo_get_vf_config)(struct net_device *dev, | 830 | * int (*ndo_get_vf_config)(struct net_device *dev, |
| 802 | * int vf, struct ifla_vf_info *ivf); | 831 | * int vf, struct ifla_vf_info *ivf); |
| 832 | * int (*ndo_set_vf_link_state)(struct net_device *dev, int vf, int link_state); | ||
| 803 | * int (*ndo_set_vf_port)(struct net_device *dev, int vf, | 833 | * int (*ndo_set_vf_port)(struct net_device *dev, int vf, |
| 804 | * struct nlattr *port[]); | 834 | * struct nlattr *port[]); |
| 805 | * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb); | 835 | * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb); |
| @@ -943,6 +973,9 @@ struct net_device_ops { | |||
| 943 | gfp_t gfp); | 973 | gfp_t gfp); |
| 944 | void (*ndo_netpoll_cleanup)(struct net_device *dev); | 974 | void (*ndo_netpoll_cleanup)(struct net_device *dev); |
| 945 | #endif | 975 | #endif |
| 976 | #ifdef CONFIG_NET_LL_RX_POLL | ||
| 977 | int (*ndo_busy_poll)(struct napi_struct *dev); | ||
| 978 | #endif | ||
| 946 | int (*ndo_set_vf_mac)(struct net_device *dev, | 979 | int (*ndo_set_vf_mac)(struct net_device *dev, |
| 947 | int queue, u8 *mac); | 980 | int queue, u8 *mac); |
| 948 | int (*ndo_set_vf_vlan)(struct net_device *dev, | 981 | int (*ndo_set_vf_vlan)(struct net_device *dev, |
| @@ -954,6 +987,8 @@ struct net_device_ops { | |||
| 954 | int (*ndo_get_vf_config)(struct net_device *dev, | 987 | int (*ndo_get_vf_config)(struct net_device *dev, |
| 955 | int vf, | 988 | int vf, |
| 956 | struct ifla_vf_info *ivf); | 989 | struct ifla_vf_info *ivf); |
| 990 | int (*ndo_set_vf_link_state)(struct net_device *dev, | ||
| 991 | int vf, int link_state); | ||
| 957 | int (*ndo_set_vf_port)(struct net_device *dev, | 992 | int (*ndo_set_vf_port)(struct net_device *dev, |
| 958 | int vf, | 993 | int vf, |
| 959 | struct nlattr *port[]); | 994 | struct nlattr *port[]); |
| @@ -1088,6 +1123,8 @@ struct net_device { | |||
| 1088 | * need to set them appropriately. | 1123 | * need to set them appropriately. |
| 1089 | */ | 1124 | */ |
| 1090 | netdev_features_t hw_enc_features; | 1125 | netdev_features_t hw_enc_features; |
| 1126 | /* mask of fetures inheritable by MPLS */ | ||
| 1127 | netdev_features_t mpls_features; | ||
| 1091 | 1128 | ||
| 1092 | /* Interface index. Unique device identifier */ | 1129 | /* Interface index. Unique device identifier */ |
| 1093 | int ifindex; | 1130 | int ifindex; |
| @@ -1140,8 +1177,10 @@ struct net_device { | |||
| 1140 | unsigned char addr_assign_type; /* hw address assignment type */ | 1177 | unsigned char addr_assign_type; /* hw address assignment type */ |
| 1141 | unsigned char addr_len; /* hardware address length */ | 1178 | unsigned char addr_len; /* hardware address length */ |
| 1142 | unsigned char neigh_priv_len; | 1179 | unsigned char neigh_priv_len; |
| 1143 | unsigned short dev_id; /* for shared network cards */ | 1180 | unsigned short dev_id; /* Used to differentiate devices |
| 1144 | 1181 | * that share the same link | |
| 1182 | * layer address | ||
| 1183 | */ | ||
| 1145 | spinlock_t addr_list_lock; | 1184 | spinlock_t addr_list_lock; |
| 1146 | struct netdev_hw_addr_list uc; /* Unicast mac addresses */ | 1185 | struct netdev_hw_addr_list uc; /* Unicast mac addresses */ |
| 1147 | struct netdev_hw_addr_list mc; /* Multicast mac addresses */ | 1186 | struct netdev_hw_addr_list mc; /* Multicast mac addresses */ |
| @@ -1593,9 +1632,34 @@ struct packet_offload { | |||
| 1593 | #define NETDEV_RELEASE 0x0012 | 1632 | #define NETDEV_RELEASE 0x0012 |
| 1594 | #define NETDEV_NOTIFY_PEERS 0x0013 | 1633 | #define NETDEV_NOTIFY_PEERS 0x0013 |
| 1595 | #define NETDEV_JOIN 0x0014 | 1634 | #define NETDEV_JOIN 0x0014 |
| 1635 | #define NETDEV_CHANGEUPPER 0x0015 | ||
| 1596 | 1636 | ||
| 1597 | extern int register_netdevice_notifier(struct notifier_block *nb); | 1637 | extern int register_netdevice_notifier(struct notifier_block *nb); |
| 1598 | extern int unregister_netdevice_notifier(struct notifier_block *nb); | 1638 | extern int unregister_netdevice_notifier(struct notifier_block *nb); |
| 1639 | |||
| 1640 | struct netdev_notifier_info { | ||
| 1641 | struct net_device *dev; | ||
| 1642 | }; | ||
| 1643 | |||
| 1644 | struct netdev_notifier_change_info { | ||
| 1645 | struct netdev_notifier_info info; /* must be first */ | ||
| 1646 | unsigned int flags_changed; | ||
| 1647 | }; | ||
| 1648 | |||
| 1649 | static inline void netdev_notifier_info_init(struct netdev_notifier_info *info, | ||
| 1650 | struct net_device *dev) | ||
| 1651 | { | ||
| 1652 | info->dev = dev; | ||
| 1653 | } | ||
| 1654 | |||
| 1655 | static inline struct net_device * | ||
| 1656 | netdev_notifier_info_to_dev(const struct netdev_notifier_info *info) | ||
| 1657 | { | ||
| 1658 | return info->dev; | ||
| 1659 | } | ||
| 1660 | |||
| 1661 | extern int call_netdevice_notifiers_info(unsigned long val, struct net_device *dev, | ||
| 1662 | struct netdev_notifier_info *info); | ||
| 1599 | extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev); | 1663 | extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev); |
| 1600 | 1664 | ||
| 1601 | 1665 | ||
| @@ -1779,6 +1843,19 @@ static inline int unregister_gifconf(unsigned int family) | |||
| 1779 | return register_gifconf(family, NULL); | 1843 | return register_gifconf(family, NULL); |
| 1780 | } | 1844 | } |
| 1781 | 1845 | ||
| 1846 | #ifdef CONFIG_NET_FLOW_LIMIT | ||
| 1847 | #define FLOW_LIMIT_HISTORY (1 << 7) /* must be ^2 and !overflow buckets */ | ||
| 1848 | struct sd_flow_limit { | ||
| 1849 | u64 count; | ||
| 1850 | unsigned int num_buckets; | ||
| 1851 | unsigned int history_head; | ||
| 1852 | u16 history[FLOW_LIMIT_HISTORY]; | ||
| 1853 | u8 buckets[]; | ||
| 1854 | }; | ||
| 1855 | |||
| 1856 | extern int netdev_flow_limit_table_len; | ||
| 1857 | #endif /* CONFIG_NET_FLOW_LIMIT */ | ||
| 1858 | |||
| 1782 | /* | 1859 | /* |
| 1783 | * Incoming packets are placed on per-cpu queues | 1860 | * Incoming packets are placed on per-cpu queues |
| 1784 | */ | 1861 | */ |
| @@ -1808,6 +1885,10 @@ struct softnet_data { | |||
| 1808 | unsigned int dropped; | 1885 | unsigned int dropped; |
| 1809 | struct sk_buff_head input_pkt_queue; | 1886 | struct sk_buff_head input_pkt_queue; |
| 1810 | struct napi_struct backlog; | 1887 | struct napi_struct backlog; |
| 1888 | |||
| 1889 | #ifdef CONFIG_NET_FLOW_LIMIT | ||
| 1890 | struct sd_flow_limit __rcu *flow_limit; | ||
| 1891 | #endif | ||
| 1811 | }; | 1892 | }; |
| 1812 | 1893 | ||
| 1813 | static inline void input_queue_head_incr(struct softnet_data *sd) | 1894 | static inline void input_queue_head_incr(struct softnet_data *sd) |
