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.h103
1 files changed, 65 insertions, 38 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 7c717907896d..936f8b76114e 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -265,6 +265,8 @@ struct net_device
265 * the interface. 265 * the interface.
266 */ 266 */
267 char name[IFNAMSIZ]; 267 char name[IFNAMSIZ];
268 /* device name hash chain */
269 struct hlist_node name_hlist;
268 270
269 /* 271 /*
270 * I/O specific fields 272 * I/O specific fields
@@ -292,6 +294,22 @@ struct net_device
292 294
293 /* ------- Fields preinitialized in Space.c finish here ------- */ 295 /* ------- Fields preinitialized in Space.c finish here ------- */
294 296
297 /* Net device features */
298 unsigned long features;
299#define NETIF_F_SG 1 /* Scatter/gather IO. */
300#define NETIF_F_IP_CSUM 2 /* Can checksum only TCP/UDP over IPv4. */
301#define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */
302#define NETIF_F_HW_CSUM 8 /* Can checksum all the packets. */
303#define NETIF_F_HIGHDMA 32 /* Can DMA to high memory. */
304#define NETIF_F_FRAGLIST 64 /* Scatter/gather IO. */
305#define NETIF_F_HW_VLAN_TX 128 /* Transmit VLAN hw acceleration */
306#define NETIF_F_HW_VLAN_RX 256 /* Receive VLAN hw acceleration */
307#define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */
308#define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */
309#define NETIF_F_TSO 2048 /* Can offload TCP/IP segmentation */
310#define NETIF_F_LLTX 4096 /* LockLess TX */
311#define NETIF_F_UFO 8192 /* Can offload UDP Large Send*/
312
295 struct net_device *next_sched; 313 struct net_device *next_sched;
296 314
297 /* Interface index. Unique device identifier */ 315 /* Interface index. Unique device identifier */
@@ -316,9 +334,6 @@ struct net_device
316 * will (read: may be cleaned up at will). 334 * will (read: may be cleaned up at will).
317 */ 335 */
318 336
319 /* These may be needed for future network-power-down code. */
320 unsigned long trans_start; /* Time (in jiffies) of last Tx */
321 unsigned long last_rx; /* Time of last Rx */
322 337
323 unsigned short flags; /* interface flags (a la BSD) */ 338 unsigned short flags; /* interface flags (a la BSD) */
324 unsigned short gflags; 339 unsigned short gflags;
@@ -328,15 +343,12 @@ struct net_device
328 unsigned mtu; /* interface MTU value */ 343 unsigned mtu; /* interface MTU value */
329 unsigned short type; /* interface hardware type */ 344 unsigned short type; /* interface hardware type */
330 unsigned short hard_header_len; /* hardware hdr length */ 345 unsigned short hard_header_len; /* hardware hdr length */
331 void *priv; /* pointer to private data */
332 346
333 struct net_device *master; /* Pointer to master device of a group, 347 struct net_device *master; /* Pointer to master device of a group,
334 * which this device is member of. 348 * which this device is member of.
335 */ 349 */
336 350
337 /* Interface address info. */ 351 /* Interface address info. */
338 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
339 unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address */
340 unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */ 352 unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */
341 unsigned char addr_len; /* hardware address length */ 353 unsigned char addr_len; /* hardware address length */
342 unsigned short dev_id; /* for shared network cards */ 354 unsigned short dev_id; /* for shared network cards */
@@ -346,8 +358,6 @@ struct net_device
346 int promiscuity; 358 int promiscuity;
347 int allmulti; 359 int allmulti;
348 360
349 int watchdog_timeo;
350 struct timer_list watchdog_timer;
351 361
352 /* Protocol specific pointers */ 362 /* Protocol specific pointers */
353 363
@@ -358,32 +368,62 @@ struct net_device
358 void *ec_ptr; /* Econet specific data */ 368 void *ec_ptr; /* Econet specific data */
359 void *ax25_ptr; /* AX.25 specific data */ 369 void *ax25_ptr; /* AX.25 specific data */
360 370
361 struct list_head poll_list; /* Link to poll list */ 371/*
372 * Cache line mostly used on receive path (including eth_type_trans())
373 */
374 struct list_head poll_list ____cacheline_aligned_in_smp;
375 /* Link to poll list */
376
377 int (*poll) (struct net_device *dev, int *quota);
362 int quota; 378 int quota;
363 int weight; 379 int weight;
380 unsigned long last_rx; /* Time of last Rx */
381 /* Interface address info used in eth_type_trans() */
382 unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast
383 because most packets are unicast) */
364 384
385 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
386
387/*
388 * Cache line mostly used on queue transmit path (qdisc)
389 */
390 /* device queue lock */
391 spinlock_t queue_lock ____cacheline_aligned_in_smp;
365 struct Qdisc *qdisc; 392 struct Qdisc *qdisc;
366 struct Qdisc *qdisc_sleeping; 393 struct Qdisc *qdisc_sleeping;
367 struct Qdisc *qdisc_ingress;
368 struct list_head qdisc_list; 394 struct list_head qdisc_list;
369 unsigned long tx_queue_len; /* Max frames per queue allowed */ 395 unsigned long tx_queue_len; /* Max frames per queue allowed */
370 396
371 /* ingress path synchronizer */ 397 /* ingress path synchronizer */
372 spinlock_t ingress_lock; 398 spinlock_t ingress_lock;
399 struct Qdisc *qdisc_ingress;
400
401/*
402 * One part is mostly used on xmit path (device)
403 */
373 /* hard_start_xmit synchronizer */ 404 /* hard_start_xmit synchronizer */
374 spinlock_t xmit_lock; 405 spinlock_t xmit_lock ____cacheline_aligned_in_smp;
375 /* cpu id of processor entered to hard_start_xmit or -1, 406 /* cpu id of processor entered to hard_start_xmit or -1,
376 if nobody entered there. 407 if nobody entered there.
377 */ 408 */
378 int xmit_lock_owner; 409 int xmit_lock_owner;
379 /* device queue lock */ 410 void *priv; /* pointer to private data */
380 spinlock_t queue_lock; 411 int (*hard_start_xmit) (struct sk_buff *skb,
412 struct net_device *dev);
413 /* These may be needed for future network-power-down code. */
414 unsigned long trans_start; /* Time (in jiffies) of last Tx */
415
416 int watchdog_timeo; /* used by dev_watchdog() */
417 struct timer_list watchdog_timer;
418
419/*
420 * refcnt is a very hot point, so align it on SMP
421 */
381 /* Number of references to this device */ 422 /* Number of references to this device */
382 atomic_t refcnt; 423 atomic_t refcnt ____cacheline_aligned_in_smp;
424
383 /* delayed register/unregister */ 425 /* delayed register/unregister */
384 struct list_head todo_list; 426 struct list_head todo_list;
385 /* device name hash chain */
386 struct hlist_node name_hlist;
387 /* device index hash chain */ 427 /* device index hash chain */
388 struct hlist_node index_hlist; 428 struct hlist_node index_hlist;
389 429
@@ -396,21 +436,6 @@ struct net_device
396 NETREG_RELEASED, /* called free_netdev */ 436 NETREG_RELEASED, /* called free_netdev */
397 } reg_state; 437 } reg_state;
398 438
399 /* Net device features */
400 unsigned long features;
401#define NETIF_F_SG 1 /* Scatter/gather IO. */
402#define NETIF_F_IP_CSUM 2 /* Can checksum only TCP/UDP over IPv4. */
403#define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */
404#define NETIF_F_HW_CSUM 8 /* Can checksum all the packets. */
405#define NETIF_F_HIGHDMA 32 /* Can DMA to high memory. */
406#define NETIF_F_FRAGLIST 64 /* Scatter/gather IO. */
407#define NETIF_F_HW_VLAN_TX 128 /* Transmit VLAN hw acceleration */
408#define NETIF_F_HW_VLAN_RX 256 /* Receive VLAN hw acceleration */
409#define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */
410#define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */
411#define NETIF_F_TSO 2048 /* Can offload TCP/IP segmentation */
412#define NETIF_F_LLTX 4096 /* LockLess TX */
413
414 /* Called after device is detached from network. */ 439 /* Called after device is detached from network. */
415 void (*uninit)(struct net_device *dev); 440 void (*uninit)(struct net_device *dev);
416 /* Called after last user reference disappears. */ 441 /* Called after last user reference disappears. */
@@ -419,10 +444,7 @@ struct net_device
419 /* Pointers to interface service routines. */ 444 /* Pointers to interface service routines. */
420 int (*open)(struct net_device *dev); 445 int (*open)(struct net_device *dev);
421 int (*stop)(struct net_device *dev); 446 int (*stop)(struct net_device *dev);
422 int (*hard_start_xmit) (struct sk_buff *skb,
423 struct net_device *dev);
424#define HAVE_NETDEV_POLL 447#define HAVE_NETDEV_POLL
425 int (*poll) (struct net_device *dev, int *quota);
426 int (*hard_header) (struct sk_buff *skb, 448 int (*hard_header) (struct sk_buff *skb,
427 struct net_device *dev, 449 struct net_device *dev,
428 unsigned short type, 450 unsigned short type,
@@ -852,11 +874,9 @@ static inline void netif_rx_complete(struct net_device *dev)
852 874
853static inline void netif_poll_disable(struct net_device *dev) 875static inline void netif_poll_disable(struct net_device *dev)
854{ 876{
855 while (test_and_set_bit(__LINK_STATE_RX_SCHED, &dev->state)) { 877 while (test_and_set_bit(__LINK_STATE_RX_SCHED, &dev->state))
856 /* No hurry. */ 878 /* No hurry. */
857 current->state = TASK_INTERRUPTIBLE; 879 schedule_timeout_interruptible(1);
858 schedule_timeout(1);
859 }
860} 880}
861 881
862static inline void netif_poll_enable(struct net_device *dev) 882static inline void netif_poll_enable(struct net_device *dev)
@@ -907,6 +927,13 @@ extern int netdev_max_backlog;
907extern int weight_p; 927extern int weight_p;
908extern int netdev_set_master(struct net_device *dev, struct net_device *master); 928extern int netdev_set_master(struct net_device *dev, struct net_device *master);
909extern int skb_checksum_help(struct sk_buff *skb, int inward); 929extern int skb_checksum_help(struct sk_buff *skb, int inward);
930#ifdef CONFIG_BUG
931extern void netdev_rx_csum_fault(struct net_device *dev);
932#else
933static inline void netdev_rx_csum_fault(struct net_device *dev)
934{
935}
936#endif
910/* rx skb timestamps */ 937/* rx skb timestamps */
911extern void net_enable_timestamp(void); 938extern void net_enable_timestamp(void);
912extern void net_disable_timestamp(void); 939extern void net_disable_timestamp(void);