aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/netdevice.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r--include/linux/netdevice.h105
1 files changed, 40 insertions, 65 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 59dc05f38247..f8eda0276f03 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -25,12 +25,6 @@
25#ifndef _LINUX_NETDEVICE_H 25#ifndef _LINUX_NETDEVICE_H
26#define _LINUX_NETDEVICE_H 26#define _LINUX_NETDEVICE_H
27 27
28#include <linux/if.h>
29#include <linux/if_ether.h>
30#include <linux/if_packet.h>
31#include <linux/if_link.h>
32
33#ifdef __KERNEL__
34#include <linux/pm_qos.h> 28#include <linux/pm_qos.h>
35#include <linux/timer.h> 29#include <linux/timer.h>
36#include <linux/bug.h> 30#include <linux/bug.h>
@@ -55,6 +49,7 @@
55 49
56#include <linux/netdev_features.h> 50#include <linux/netdev_features.h>
57#include <linux/neighbour.h> 51#include <linux/neighbour.h>
52#include <uapi/linux/netdevice.h>
58 53
59struct netpoll_info; 54struct netpoll_info;
60struct device; 55struct device;
@@ -133,14 +128,6 @@ static inline bool dev_xmit_complete(int rc)
133 return false; 128 return false;
134} 129}
135 130
136#endif
137
138#define MAX_ADDR_LEN 32 /* Largest hardware address length */
139
140/* Initial net device group. All devices belong to group 0 by default. */
141#define INIT_NETDEV_GROUP 0
142
143#ifdef __KERNEL__
144/* 131/*
145 * Compute the worst case header length according to the protocols 132 * Compute the worst case header length according to the protocols
146 * used. 133 * used.
@@ -196,21 +183,6 @@ struct net_device_stats {
196 unsigned long tx_compressed; 183 unsigned long tx_compressed;
197}; 184};
198 185
199#endif /* __KERNEL__ */
200
201
202/* Media selection options. */
203enum {
204 IF_PORT_UNKNOWN = 0,
205 IF_PORT_10BASE2,
206 IF_PORT_10BASET,
207 IF_PORT_AUI,
208 IF_PORT_100BASET,
209 IF_PORT_100BASETX,
210 IF_PORT_100BASEFX
211};
212
213#ifdef __KERNEL__
214 186
215#include <linux/cache.h> 187#include <linux/cache.h>
216#include <linux/skbuff.h> 188#include <linux/skbuff.h>
@@ -338,18 +310,16 @@ struct napi_struct {
338 310
339 unsigned long state; 311 unsigned long state;
340 int weight; 312 int weight;
313 unsigned int gro_count;
341 int (*poll)(struct napi_struct *, int); 314 int (*poll)(struct napi_struct *, int);
342#ifdef CONFIG_NETPOLL 315#ifdef CONFIG_NETPOLL
343 spinlock_t poll_lock; 316 spinlock_t poll_lock;
344 int poll_owner; 317 int poll_owner;
345#endif 318#endif
346
347 unsigned int gro_count;
348
349 struct net_device *dev; 319 struct net_device *dev;
350 struct list_head dev_list;
351 struct sk_buff *gro_list; 320 struct sk_buff *gro_list;
352 struct sk_buff *skb; 321 struct sk_buff *skb;
322 struct list_head dev_list;
353}; 323};
354 324
355enum { 325enum {
@@ -906,11 +876,12 @@ struct netdev_fcoe_hbainfo {
906 * feature set might be less than what was returned by ndo_fix_features()). 876 * feature set might be less than what was returned by ndo_fix_features()).
907 * Must return >0 or -errno if it changed dev->features itself. 877 * Must return >0 or -errno if it changed dev->features itself.
908 * 878 *
909 * int (*ndo_fdb_add)(struct ndmsg *ndm, struct net_device *dev, 879 * int (*ndo_fdb_add)(struct ndmsg *ndm, struct nlattr *tb[],
910 * unsigned char *addr, u16 flags) 880 * struct net_device *dev,
881 * const unsigned char *addr, u16 flags)
911 * Adds an FDB entry to dev for addr. 882 * Adds an FDB entry to dev for addr.
912 * int (*ndo_fdb_del)(struct ndmsg *ndm, struct net_device *dev, 883 * int (*ndo_fdb_del)(struct ndmsg *ndm, struct net_device *dev,
913 * unsigned char *addr) 884 * const unsigned char *addr)
914 * Deletes the FDB entry from dev coresponding to addr. 885 * Deletes the FDB entry from dev coresponding to addr.
915 * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb, 886 * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb,
916 * struct net_device *dev, int idx) 887 * struct net_device *dev, int idx)
@@ -1016,12 +987,13 @@ struct net_device_ops {
1016 void (*ndo_neigh_destroy)(struct neighbour *n); 987 void (*ndo_neigh_destroy)(struct neighbour *n);
1017 988
1018 int (*ndo_fdb_add)(struct ndmsg *ndm, 989 int (*ndo_fdb_add)(struct ndmsg *ndm,
990 struct nlattr *tb[],
1019 struct net_device *dev, 991 struct net_device *dev,
1020 unsigned char *addr, 992 const unsigned char *addr,
1021 u16 flags); 993 u16 flags);
1022 int (*ndo_fdb_del)(struct ndmsg *ndm, 994 int (*ndo_fdb_del)(struct ndmsg *ndm,
1023 struct net_device *dev, 995 struct net_device *dev,
1024 unsigned char *addr); 996 const unsigned char *addr);
1025 int (*ndo_fdb_dump)(struct sk_buff *skb, 997 int (*ndo_fdb_dump)(struct sk_buff *skb,
1026 struct netlink_callback *cb, 998 struct netlink_callback *cb,
1027 struct net_device *dev, 999 struct net_device *dev,
@@ -1322,6 +1294,8 @@ struct net_device {
1322 /* phy device may attach itself for hardware timestamping */ 1294 /* phy device may attach itself for hardware timestamping */
1323 struct phy_device *phydev; 1295 struct phy_device *phydev;
1324 1296
1297 struct lock_class_key *qdisc_tx_busylock;
1298
1325 /* group the device belongs to */ 1299 /* group the device belongs to */
1326 int group; 1300 int group;
1327 1301
@@ -1401,6 +1375,9 @@ static inline void netdev_for_each_tx_queue(struct net_device *dev,
1401 f(dev, &dev->_tx[i], arg); 1375 f(dev, &dev->_tx[i], arg);
1402} 1376}
1403 1377
1378extern struct netdev_queue *netdev_pick_tx(struct net_device *dev,
1379 struct sk_buff *skb);
1380
1404/* 1381/*
1405 * Net namespace inlines 1382 * Net namespace inlines
1406 */ 1383 */
@@ -1492,19 +1469,25 @@ struct napi_gro_cb {
1492 /* This indicates where we are processing relative to skb->data. */ 1469 /* This indicates where we are processing relative to skb->data. */
1493 int data_offset; 1470 int data_offset;
1494 1471
1495 /* This is non-zero if the packet may be of the same flow. */
1496 int same_flow;
1497
1498 /* This is non-zero if the packet cannot be merged with the new skb. */ 1472 /* This is non-zero if the packet cannot be merged with the new skb. */
1499 int flush; 1473 int flush;
1500 1474
1501 /* Number of segments aggregated. */ 1475 /* Number of segments aggregated. */
1502 int count; 1476 u16 count;
1477
1478 /* This is non-zero if the packet may be of the same flow. */
1479 u8 same_flow;
1503 1480
1504 /* Free the skb? */ 1481 /* Free the skb? */
1505 int free; 1482 u8 free;
1506#define NAPI_GRO_FREE 1 1483#define NAPI_GRO_FREE 1
1507#define NAPI_GRO_FREE_STOLEN_HEAD 2 1484#define NAPI_GRO_FREE_STOLEN_HEAD 2
1485
1486 /* jiffies when first packet was created/queued */
1487 unsigned long age;
1488
1489 /* Used in ipv6_gro_receive() */
1490 int proto;
1508}; 1491};
1509 1492
1510#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb) 1493#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb)
@@ -1553,7 +1536,7 @@ struct packet_type {
1553#define NETDEV_PRE_TYPE_CHANGE 0x000E 1536#define NETDEV_PRE_TYPE_CHANGE 0x000E
1554#define NETDEV_POST_TYPE_CHANGE 0x000F 1537#define NETDEV_POST_TYPE_CHANGE 0x000F
1555#define NETDEV_POST_INIT 0x0010 1538#define NETDEV_POST_INIT 0x0010
1556#define NETDEV_UNREGISTER_BATCH 0x0011 1539#define NETDEV_UNREGISTER_FINAL 0x0011
1557#define NETDEV_RELEASE 0x0012 1540#define NETDEV_RELEASE 0x0012
1558#define NETDEV_NOTIFY_PEERS 0x0013 1541#define NETDEV_NOTIFY_PEERS 0x0013
1559#define NETDEV_JOIN 0x0014 1542#define NETDEV_JOIN 0x0014
@@ -1658,7 +1641,6 @@ extern int netpoll_trap(void);
1658#endif 1641#endif
1659extern int skb_gro_receive(struct sk_buff **head, 1642extern int skb_gro_receive(struct sk_buff **head,
1660 struct sk_buff *skb); 1643 struct sk_buff *skb);
1661extern void skb_gro_reset_offset(struct sk_buff *skb);
1662 1644
1663static inline unsigned int skb_gro_offset(const struct sk_buff *skb) 1645static inline unsigned int skb_gro_offset(const struct sk_buff *skb)
1664{ 1646{
@@ -2152,7 +2134,7 @@ extern gro_result_t dev_gro_receive(struct napi_struct *napi,
2152extern gro_result_t napi_skb_finish(gro_result_t ret, struct sk_buff *skb); 2134extern gro_result_t napi_skb_finish(gro_result_t ret, struct sk_buff *skb);
2153extern gro_result_t napi_gro_receive(struct napi_struct *napi, 2135extern gro_result_t napi_gro_receive(struct napi_struct *napi,
2154 struct sk_buff *skb); 2136 struct sk_buff *skb);
2155extern void napi_gro_flush(struct napi_struct *napi); 2137extern void napi_gro_flush(struct napi_struct *napi, bool flush_old);
2156extern struct sk_buff * napi_get_frags(struct napi_struct *napi); 2138extern struct sk_buff * napi_get_frags(struct napi_struct *napi);
2157extern gro_result_t napi_frags_finish(struct napi_struct *napi, 2139extern gro_result_t napi_frags_finish(struct napi_struct *napi,
2158 struct sk_buff *skb, 2140 struct sk_buff *skb,
@@ -2227,6 +2209,7 @@ static inline void dev_hold(struct net_device *dev)
2227 * kind of lower layer not just hardware media. 2209 * kind of lower layer not just hardware media.
2228 */ 2210 */
2229 2211
2212extern void linkwatch_init_dev(struct net_device *dev);
2230extern void linkwatch_fire_event(struct net_device *dev); 2213extern void linkwatch_fire_event(struct net_device *dev);
2231extern void linkwatch_forget_dev(struct net_device *dev); 2214extern void linkwatch_forget_dev(struct net_device *dev);
2232 2215
@@ -2249,8 +2232,6 @@ extern void netif_carrier_on(struct net_device *dev);
2249 2232
2250extern void netif_carrier_off(struct net_device *dev); 2233extern void netif_carrier_off(struct net_device *dev);
2251 2234
2252extern void netif_notify_peers(struct net_device *dev);
2253
2254/** 2235/**
2255 * netif_dormant_on - mark device as dormant. 2236 * netif_dormant_on - mark device as dormant.
2256 * @dev: network device 2237 * @dev: network device
@@ -2560,9 +2541,9 @@ extern void __hw_addr_flush(struct netdev_hw_addr_list *list);
2560extern void __hw_addr_init(struct netdev_hw_addr_list *list); 2541extern void __hw_addr_init(struct netdev_hw_addr_list *list);
2561 2542
2562/* Functions used for device addresses handling */ 2543/* Functions used for device addresses handling */
2563extern int dev_addr_add(struct net_device *dev, unsigned char *addr, 2544extern int dev_addr_add(struct net_device *dev, const unsigned char *addr,
2564 unsigned char addr_type); 2545 unsigned char addr_type);
2565extern int dev_addr_del(struct net_device *dev, unsigned char *addr, 2546extern int dev_addr_del(struct net_device *dev, const unsigned char *addr,
2566 unsigned char addr_type); 2547 unsigned char addr_type);
2567extern int dev_addr_add_multiple(struct net_device *to_dev, 2548extern int dev_addr_add_multiple(struct net_device *to_dev,
2568 struct net_device *from_dev, 2549 struct net_device *from_dev,
@@ -2574,20 +2555,20 @@ extern void dev_addr_flush(struct net_device *dev);
2574extern int dev_addr_init(struct net_device *dev); 2555extern int dev_addr_init(struct net_device *dev);
2575 2556
2576/* Functions used for unicast addresses handling */ 2557/* Functions used for unicast addresses handling */
2577extern int dev_uc_add(struct net_device *dev, unsigned char *addr); 2558extern int dev_uc_add(struct net_device *dev, const unsigned char *addr);
2578extern int dev_uc_add_excl(struct net_device *dev, unsigned char *addr); 2559extern int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr);
2579extern int dev_uc_del(struct net_device *dev, unsigned char *addr); 2560extern int dev_uc_del(struct net_device *dev, const unsigned char *addr);
2580extern int dev_uc_sync(struct net_device *to, struct net_device *from); 2561extern int dev_uc_sync(struct net_device *to, struct net_device *from);
2581extern void dev_uc_unsync(struct net_device *to, struct net_device *from); 2562extern void dev_uc_unsync(struct net_device *to, struct net_device *from);
2582extern void dev_uc_flush(struct net_device *dev); 2563extern void dev_uc_flush(struct net_device *dev);
2583extern void dev_uc_init(struct net_device *dev); 2564extern void dev_uc_init(struct net_device *dev);
2584 2565
2585/* Functions used for multicast addresses handling */ 2566/* Functions used for multicast addresses handling */
2586extern int dev_mc_add(struct net_device *dev, unsigned char *addr); 2567extern int dev_mc_add(struct net_device *dev, const unsigned char *addr);
2587extern int dev_mc_add_global(struct net_device *dev, unsigned char *addr); 2568extern int dev_mc_add_global(struct net_device *dev, const unsigned char *addr);
2588extern int dev_mc_add_excl(struct net_device *dev, unsigned char *addr); 2569extern int dev_mc_add_excl(struct net_device *dev, const unsigned char *addr);
2589extern int dev_mc_del(struct net_device *dev, unsigned char *addr); 2570extern int dev_mc_del(struct net_device *dev, const unsigned char *addr);
2590extern int dev_mc_del_global(struct net_device *dev, unsigned char *addr); 2571extern int dev_mc_del_global(struct net_device *dev, const unsigned char *addr);
2591extern int dev_mc_sync(struct net_device *to, struct net_device *from); 2572extern int dev_mc_sync(struct net_device *to, struct net_device *from);
2592extern void dev_mc_unsync(struct net_device *to, struct net_device *from); 2573extern void dev_mc_unsync(struct net_device *to, struct net_device *from);
2593extern void dev_mc_flush(struct net_device *dev); 2574extern void dev_mc_flush(struct net_device *dev);
@@ -2599,8 +2580,7 @@ extern void __dev_set_rx_mode(struct net_device *dev);
2599extern int dev_set_promiscuity(struct net_device *dev, int inc); 2580extern int dev_set_promiscuity(struct net_device *dev, int inc);
2600extern int dev_set_allmulti(struct net_device *dev, int inc); 2581extern int dev_set_allmulti(struct net_device *dev, int inc);
2601extern void netdev_state_change(struct net_device *dev); 2582extern void netdev_state_change(struct net_device *dev);
2602extern int netdev_bonding_change(struct net_device *dev, 2583extern void netdev_notify_peers(struct net_device *dev);
2603 unsigned long event);
2604extern void netdev_features_change(struct net_device *dev); 2584extern void netdev_features_change(struct net_device *dev);
2605/* Load a device via the kmod */ 2585/* Load a device via the kmod */
2606extern void dev_load(struct net *net, const char *name); 2586extern void dev_load(struct net *net, const char *name);
@@ -2720,9 +2700,6 @@ static inline const char *netdev_name(const struct net_device *dev)
2720 return dev->name; 2700 return dev->name;
2721} 2701}
2722 2702
2723extern int __netdev_printk(const char *level, const struct net_device *dev,
2724 struct va_format *vaf);
2725
2726extern __printf(3, 4) 2703extern __printf(3, 4)
2727int netdev_printk(const char *level, const struct net_device *dev, 2704int netdev_printk(const char *level, const struct net_device *dev,
2728 const char *format, ...); 2705 const char *format, ...);
@@ -2839,6 +2816,4 @@ do { \
2839}) 2816})
2840#endif 2817#endif
2841 2818
2842#endif /* __KERNEL__ */
2843
2844#endif /* _LINUX_NETDEVICE_H */ 2819#endif /* _LINUX_NETDEVICE_H */