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.h400
1 files changed, 252 insertions, 148 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index e26f54952892..41e1224651cf 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -43,6 +43,9 @@
43 43
44#include <net/net_namespace.h> 44#include <net/net_namespace.h>
45#include <net/dsa.h> 45#include <net/dsa.h>
46#ifdef CONFIG_DCB
47#include <net/dcbnl.h>
48#endif
46 49
47struct vlan_group; 50struct vlan_group;
48struct ethtool_ops; 51struct ethtool_ops;
@@ -311,8 +314,9 @@ struct napi_struct {
311 spinlock_t poll_lock; 314 spinlock_t poll_lock;
312 int poll_owner; 315 int poll_owner;
313 struct net_device *dev; 316 struct net_device *dev;
314 struct list_head dev_list;
315#endif 317#endif
318 struct list_head dev_list;
319 struct sk_buff *gro_list;
316}; 320};
317 321
318enum 322enum
@@ -373,22 +377,8 @@ static inline int napi_reschedule(struct napi_struct *napi)
373 * 377 *
374 * Mark NAPI processing as complete. 378 * Mark NAPI processing as complete.
375 */ 379 */
376static inline void __napi_complete(struct napi_struct *n) 380extern void __napi_complete(struct napi_struct *n);
377{ 381extern void napi_complete(struct napi_struct *n);
378 BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state));
379 list_del(&n->poll_list);
380 smp_mb__before_clear_bit();
381 clear_bit(NAPI_STATE_SCHED, &n->state);
382}
383
384static inline void napi_complete(struct napi_struct *n)
385{
386 unsigned long flags;
387
388 local_irq_save(flags);
389 __napi_complete(n);
390 local_irq_restore(flags);
391}
392 382
393/** 383/**
394 * napi_disable - prevent NAPI from scheduling 384 * napi_disable - prevent NAPI from scheduling
@@ -452,6 +442,147 @@ struct netdev_queue {
452 struct Qdisc *qdisc_sleeping; 442 struct Qdisc *qdisc_sleeping;
453} ____cacheline_aligned_in_smp; 443} ____cacheline_aligned_in_smp;
454 444
445
446/*
447 * This structure defines the management hooks for network devices.
448 * The following hooks can be defined; unless noted otherwise, they are
449 * optional and can be filled with a null pointer.
450 *
451 * int (*ndo_init)(struct net_device *dev);
452 * This function is called once when network device is registered.
453 * The network device can use this to any late stage initializaton
454 * or semantic validattion. It can fail with an error code which will
455 * be propogated back to register_netdev
456 *
457 * void (*ndo_uninit)(struct net_device *dev);
458 * This function is called when device is unregistered or when registration
459 * fails. It is not called if init fails.
460 *
461 * int (*ndo_open)(struct net_device *dev);
462 * This function is called when network device transistions to the up
463 * state.
464 *
465 * int (*ndo_stop)(struct net_device *dev);
466 * This function is called when network device transistions to the down
467 * state.
468 *
469 * int (*ndo_hard_start_xmit)(struct sk_buff *skb, struct net_device *dev);
470 * Called when a packet needs to be transmitted.
471 * Must return NETDEV_TX_OK , NETDEV_TX_BUSY, or NETDEV_TX_LOCKED,
472 * Required can not be NULL.
473 *
474 * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb);
475 * Called to decide which queue to when device supports multiple
476 * transmit queues.
477 *
478 * void (*ndo_change_rx_flags)(struct net_device *dev, int flags);
479 * This function is called to allow device receiver to make
480 * changes to configuration when multicast or promiscious is enabled.
481 *
482 * void (*ndo_set_rx_mode)(struct net_device *dev);
483 * This function is called device changes address list filtering.
484 *
485 * void (*ndo_set_multicast_list)(struct net_device *dev);
486 * This function is called when the multicast address list changes.
487 *
488 * int (*ndo_set_mac_address)(struct net_device *dev, void *addr);
489 * This function is called when the Media Access Control address
490 * needs to be changed. If not this interface is not defined, the
491 * mac address can not be changed.
492 *
493 * int (*ndo_validate_addr)(struct net_device *dev);
494 * Test if Media Access Control address is valid for the device.
495 *
496 * int (*ndo_do_ioctl)(struct net_device *dev, struct ifreq *ifr, int cmd);
497 * Called when a user request an ioctl which can't be handled by
498 * the generic interface code. If not defined ioctl's return
499 * not supported error code.
500 *
501 * int (*ndo_set_config)(struct net_device *dev, struct ifmap *map);
502 * Used to set network devices bus interface parameters. This interface
503 * is retained for legacy reason, new devices should use the bus
504 * interface (PCI) for low level management.
505 *
506 * int (*ndo_change_mtu)(struct net_device *dev, int new_mtu);
507 * Called when a user wants to change the Maximum Transfer Unit
508 * of a device. If not defined, any request to change MTU will
509 * will return an error.
510 *
511 * void (*ndo_tx_timeout)(struct net_device *dev);
512 * Callback uses when the transmitter has not made any progress
513 * for dev->watchdog ticks.
514 *
515 * struct net_device_stats* (*get_stats)(struct net_device *dev);
516 * Called when a user wants to get the network device usage
517 * statistics. If not defined, the counters in dev->stats will
518 * be used.
519 *
520 * void (*ndo_vlan_rx_register)(struct net_device *dev, struct vlan_group *grp);
521 * If device support VLAN receive accleration
522 * (ie. dev->features & NETIF_F_HW_VLAN_RX), then this function is called
523 * when vlan groups for the device changes. Note: grp is NULL
524 * if no vlan's groups are being used.
525 *
526 * void (*ndo_vlan_rx_add_vid)(struct net_device *dev, unsigned short vid);
527 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER)
528 * this function is called when a VLAN id is registered.
529 *
530 * void (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid);
531 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER)
532 * this function is called when a VLAN id is unregistered.
533 *
534 * void (*ndo_poll_controller)(struct net_device *dev);
535 */
536#define HAVE_NET_DEVICE_OPS
537struct net_device_ops {
538 int (*ndo_init)(struct net_device *dev);
539 void (*ndo_uninit)(struct net_device *dev);
540 int (*ndo_open)(struct net_device *dev);
541 int (*ndo_stop)(struct net_device *dev);
542 int (*ndo_start_xmit) (struct sk_buff *skb,
543 struct net_device *dev);
544 u16 (*ndo_select_queue)(struct net_device *dev,
545 struct sk_buff *skb);
546#define HAVE_CHANGE_RX_FLAGS
547 void (*ndo_change_rx_flags)(struct net_device *dev,
548 int flags);
549#define HAVE_SET_RX_MODE
550 void (*ndo_set_rx_mode)(struct net_device *dev);
551#define HAVE_MULTICAST
552 void (*ndo_set_multicast_list)(struct net_device *dev);
553#define HAVE_SET_MAC_ADDR
554 int (*ndo_set_mac_address)(struct net_device *dev,
555 void *addr);
556#define HAVE_VALIDATE_ADDR
557 int (*ndo_validate_addr)(struct net_device *dev);
558#define HAVE_PRIVATE_IOCTL
559 int (*ndo_do_ioctl)(struct net_device *dev,
560 struct ifreq *ifr, int cmd);
561#define HAVE_SET_CONFIG
562 int (*ndo_set_config)(struct net_device *dev,
563 struct ifmap *map);
564#define HAVE_CHANGE_MTU
565 int (*ndo_change_mtu)(struct net_device *dev,
566 int new_mtu);
567 int (*ndo_neigh_setup)(struct net_device *dev,
568 struct neigh_parms *);
569#define HAVE_TX_TIMEOUT
570 void (*ndo_tx_timeout) (struct net_device *dev);
571
572 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
573
574 void (*ndo_vlan_rx_register)(struct net_device *dev,
575 struct vlan_group *grp);
576 void (*ndo_vlan_rx_add_vid)(struct net_device *dev,
577 unsigned short vid);
578 void (*ndo_vlan_rx_kill_vid)(struct net_device *dev,
579 unsigned short vid);
580#ifdef CONFIG_NET_POLL_CONTROLLER
581#define HAVE_NETDEV_POLL
582 void (*ndo_poll_controller)(struct net_device *dev);
583#endif
584};
585
455/* 586/*
456 * The DEVICE structure. 587 * The DEVICE structure.
457 * Actually, this whole structure is a big mistake. It mixes I/O 588 * Actually, this whole structure is a big mistake. It mixes I/O
@@ -496,14 +627,7 @@ struct net_device
496 unsigned long state; 627 unsigned long state;
497 628
498 struct list_head dev_list; 629 struct list_head dev_list;
499#ifdef CONFIG_NETPOLL
500 struct list_head napi_list; 630 struct list_head napi_list;
501#endif
502
503 /* The device initialization function. Called only once. */
504 int (*init)(struct net_device *dev);
505
506 /* ------- Fields preinitialized in Space.c finish here ------- */
507 631
508 /* Net device features */ 632 /* Net device features */
509 unsigned long features; 633 unsigned long features;
@@ -522,6 +646,7 @@ struct net_device
522#define NETIF_F_LLTX 4096 /* LockLess TX - deprecated. Please */ 646#define NETIF_F_LLTX 4096 /* LockLess TX - deprecated. Please */
523 /* do not use LLTX in new drivers */ 647 /* do not use LLTX in new drivers */
524#define NETIF_F_NETNS_LOCAL 8192 /* Does not change network namespaces */ 648#define NETIF_F_NETNS_LOCAL 8192 /* Does not change network namespaces */
649#define NETIF_F_GRO 16384 /* Generic receive offload */
525#define NETIF_F_LRO 32768 /* large receive offload */ 650#define NETIF_F_LRO 32768 /* large receive offload */
526 651
527 /* Segmentation offload features */ 652 /* Segmentation offload features */
@@ -547,15 +672,13 @@ struct net_device
547 * for all in netdev_increment_features. 672 * for all in netdev_increment_features.
548 */ 673 */
549#define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \ 674#define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \
550 NETIF_F_SG | NETIF_F_HIGHDMA | \ 675 NETIF_F_SG | NETIF_F_HIGHDMA | \
551 NETIF_F_FRAGLIST) 676 NETIF_F_FRAGLIST)
552 677
553 /* Interface index. Unique device identifier */ 678 /* Interface index. Unique device identifier */
554 int ifindex; 679 int ifindex;
555 int iflink; 680 int iflink;
556 681
557
558 struct net_device_stats* (*get_stats)(struct net_device *dev);
559 struct net_device_stats stats; 682 struct net_device_stats stats;
560 683
561#ifdef CONFIG_WIRELESS_EXT 684#ifdef CONFIG_WIRELESS_EXT
@@ -565,18 +688,13 @@ struct net_device
565 /* Instance data managed by the core of Wireless Extensions. */ 688 /* Instance data managed by the core of Wireless Extensions. */
566 struct iw_public_data * wireless_data; 689 struct iw_public_data * wireless_data;
567#endif 690#endif
691 /* Management operations */
692 const struct net_device_ops *netdev_ops;
568 const struct ethtool_ops *ethtool_ops; 693 const struct ethtool_ops *ethtool_ops;
569 694
570 /* Hardware header description */ 695 /* Hardware header description */
571 const struct header_ops *header_ops; 696 const struct header_ops *header_ops;
572 697
573 /*
574 * This marks the end of the "visible" part of the structure. All
575 * fields hereafter are internal to the system, and may change at
576 * will (read: may be cleaned up at will).
577 */
578
579
580 unsigned int flags; /* interface flags (a la BSD) */ 698 unsigned int flags; /* interface flags (a la BSD) */
581 unsigned short gflags; 699 unsigned short gflags;
582 unsigned short priv_flags; /* Like 'flags' but invisible to userspace. */ 700 unsigned short priv_flags; /* Like 'flags' but invisible to userspace. */
@@ -635,7 +753,7 @@ struct net_device
635 unsigned long last_rx; /* Time of last Rx */ 753 unsigned long last_rx; /* Time of last Rx */
636 /* Interface address info used in eth_type_trans() */ 754 /* Interface address info used in eth_type_trans() */
637 unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast 755 unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast
638 because most packets are unicast) */ 756 because most packets are unicast) */
639 757
640 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ 758 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
641 759
@@ -654,18 +772,12 @@ struct net_device
654/* 772/*
655 * One part is mostly used on xmit path (device) 773 * One part is mostly used on xmit path (device)
656 */ 774 */
657 void *priv; /* pointer to private data */
658 int (*hard_start_xmit) (struct sk_buff *skb,
659 struct net_device *dev);
660 /* These may be needed for future network-power-down code. */ 775 /* These may be needed for future network-power-down code. */
661 unsigned long trans_start; /* Time (in jiffies) of last Tx */ 776 unsigned long trans_start; /* Time (in jiffies) of last Tx */
662 777
663 int watchdog_timeo; /* used by dev_watchdog() */ 778 int watchdog_timeo; /* used by dev_watchdog() */
664 struct timer_list watchdog_timer; 779 struct timer_list watchdog_timer;
665 780
666/*
667 * refcnt is a very hot point, so align it on SMP
668 */
669 /* Number of references to this device */ 781 /* Number of references to this device */
670 atomic_t refcnt ____cacheline_aligned_in_smp; 782 atomic_t refcnt ____cacheline_aligned_in_smp;
671 783
@@ -684,56 +796,12 @@ struct net_device
684 NETREG_RELEASED, /* called free_netdev */ 796 NETREG_RELEASED, /* called free_netdev */
685 } reg_state; 797 } reg_state;
686 798
687 /* Called after device is detached from network. */ 799 /* Called from unregister, can be used to call free_netdev */
688 void (*uninit)(struct net_device *dev); 800 void (*destructor)(struct net_device *dev);
689 /* Called after last user reference disappears. */
690 void (*destructor)(struct net_device *dev);
691
692 /* Pointers to interface service routines. */
693 int (*open)(struct net_device *dev);
694 int (*stop)(struct net_device *dev);
695#define HAVE_NETDEV_POLL
696#define HAVE_CHANGE_RX_FLAGS
697 void (*change_rx_flags)(struct net_device *dev,
698 int flags);
699#define HAVE_SET_RX_MODE
700 void (*set_rx_mode)(struct net_device *dev);
701#define HAVE_MULTICAST
702 void (*set_multicast_list)(struct net_device *dev);
703#define HAVE_SET_MAC_ADDR
704 int (*set_mac_address)(struct net_device *dev,
705 void *addr);
706#define HAVE_VALIDATE_ADDR
707 int (*validate_addr)(struct net_device *dev);
708#define HAVE_PRIVATE_IOCTL
709 int (*do_ioctl)(struct net_device *dev,
710 struct ifreq *ifr, int cmd);
711#define HAVE_SET_CONFIG
712 int (*set_config)(struct net_device *dev,
713 struct ifmap *map);
714#define HAVE_CHANGE_MTU
715 int (*change_mtu)(struct net_device *dev, int new_mtu);
716
717#define HAVE_TX_TIMEOUT
718 void (*tx_timeout) (struct net_device *dev);
719
720 void (*vlan_rx_register)(struct net_device *dev,
721 struct vlan_group *grp);
722 void (*vlan_rx_add_vid)(struct net_device *dev,
723 unsigned short vid);
724 void (*vlan_rx_kill_vid)(struct net_device *dev,
725 unsigned short vid);
726 801
727 int (*neigh_setup)(struct net_device *dev, struct neigh_parms *);
728#ifdef CONFIG_NETPOLL 802#ifdef CONFIG_NETPOLL
729 struct netpoll_info *npinfo; 803 struct netpoll_info *npinfo;
730#endif 804#endif
731#ifdef CONFIG_NET_POLL_CONTROLLER
732 void (*poll_controller)(struct net_device *dev);
733#endif
734
735 u16 (*select_queue)(struct net_device *dev,
736 struct sk_buff *skb);
737 805
738#ifdef CONFIG_NET_NS 806#ifdef CONFIG_NET_NS
739 /* Network namespace this network device is inside */ 807 /* Network namespace this network device is inside */
@@ -764,6 +832,49 @@ struct net_device
764 /* for setting kernel sock attribute on TCP connection setup */ 832 /* for setting kernel sock attribute on TCP connection setup */
765#define GSO_MAX_SIZE 65536 833#define GSO_MAX_SIZE 65536
766 unsigned int gso_max_size; 834 unsigned int gso_max_size;
835
836#ifdef CONFIG_DCB
837 /* Data Center Bridging netlink ops */
838 struct dcbnl_rtnl_ops *dcbnl_ops;
839#endif
840
841#ifdef CONFIG_COMPAT_NET_DEV_OPS
842 struct {
843 int (*init)(struct net_device *dev);
844 void (*uninit)(struct net_device *dev);
845 int (*open)(struct net_device *dev);
846 int (*stop)(struct net_device *dev);
847 int (*hard_start_xmit) (struct sk_buff *skb,
848 struct net_device *dev);
849 u16 (*select_queue)(struct net_device *dev,
850 struct sk_buff *skb);
851 void (*change_rx_flags)(struct net_device *dev,
852 int flags);
853 void (*set_rx_mode)(struct net_device *dev);
854 void (*set_multicast_list)(struct net_device *dev);
855 int (*set_mac_address)(struct net_device *dev,
856 void *addr);
857 int (*validate_addr)(struct net_device *dev);
858 int (*do_ioctl)(struct net_device *dev,
859 struct ifreq *ifr, int cmd);
860 int (*set_config)(struct net_device *dev,
861 struct ifmap *map);
862 int (*change_mtu)(struct net_device *dev, int new_mtu);
863 int (*neigh_setup)(struct net_device *dev,
864 struct neigh_parms *);
865 void (*tx_timeout) (struct net_device *dev);
866 struct net_device_stats* (*get_stats)(struct net_device *dev);
867 void (*vlan_rx_register)(struct net_device *dev,
868 struct vlan_group *grp);
869 void (*vlan_rx_add_vid)(struct net_device *dev,
870 unsigned short vid);
871 void (*vlan_rx_kill_vid)(struct net_device *dev,
872 unsigned short vid);
873#ifdef CONFIG_NET_POLL_CONTROLLER
874 void (*poll_controller)(struct net_device *dev);
875#endif
876 };
877#endif
767}; 878};
768#define to_net_dev(d) container_of(d, struct net_device, dev) 879#define to_net_dev(d) container_of(d, struct net_device, dev)
769 880
@@ -859,22 +970,8 @@ static inline void *netdev_priv(const struct net_device *dev)
859 * netif_napi_add() must be used to initialize a napi context prior to calling 970 * netif_napi_add() must be used to initialize a napi context prior to calling
860 * *any* of the other napi related functions. 971 * *any* of the other napi related functions.
861 */ 972 */
862static inline void netif_napi_add(struct net_device *dev, 973void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
863 struct napi_struct *napi, 974 int (*poll)(struct napi_struct *, int), int weight);
864 int (*poll)(struct napi_struct *, int),
865 int weight)
866{
867 INIT_LIST_HEAD(&napi->poll_list);
868 napi->poll = poll;
869 napi->weight = weight;
870#ifdef CONFIG_NETPOLL
871 napi->dev = dev;
872 list_add(&napi->dev_list, &dev->napi_list);
873 spin_lock_init(&napi->poll_lock);
874 napi->poll_owner = -1;
875#endif
876 set_bit(NAPI_STATE_SCHED, &napi->state);
877}
878 975
879/** 976/**
880 * netif_napi_del - remove a napi context 977 * netif_napi_del - remove a napi context
@@ -882,12 +979,20 @@ static inline void netif_napi_add(struct net_device *dev,
882 * 979 *
883 * netif_napi_del() removes a napi context from the network device napi list 980 * netif_napi_del() removes a napi context from the network device napi list
884 */ 981 */
885static inline void netif_napi_del(struct napi_struct *napi) 982void netif_napi_del(struct napi_struct *napi);
886{ 983
887#ifdef CONFIG_NETPOLL 984struct napi_gro_cb {
888 list_del(&napi->dev_list); 985 /* This is non-zero if the packet may be of the same flow. */
889#endif 986 int same_flow;
890} 987
988 /* This is non-zero if the packet cannot be merged with the new skb. */
989 int flush;
990
991 /* Number of segments aggregated. */
992 int count;
993};
994
995#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb)
891 996
892struct packet_type { 997struct packet_type {
893 __be16 type; /* This is really htons(ether_type). */ 998 __be16 type; /* This is really htons(ether_type). */
@@ -899,6 +1004,9 @@ struct packet_type {
899 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 1004 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
900 int features); 1005 int features);
901 int (*gso_send_check)(struct sk_buff *skb); 1006 int (*gso_send_check)(struct sk_buff *skb);
1007 struct sk_buff **(*gro_receive)(struct sk_buff **head,
1008 struct sk_buff *skb);
1009 int (*gro_complete)(struct sk_buff *skb);
902 void *af_packet_priv; 1010 void *af_packet_priv;
903 struct list_head list; 1011 struct list_head list;
904}; 1012};
@@ -1252,6 +1360,9 @@ extern int netif_rx(struct sk_buff *skb);
1252extern int netif_rx_ni(struct sk_buff *skb); 1360extern int netif_rx_ni(struct sk_buff *skb);
1253#define HAVE_NETIF_RECEIVE_SKB 1 1361#define HAVE_NETIF_RECEIVE_SKB 1
1254extern int netif_receive_skb(struct sk_buff *skb); 1362extern int netif_receive_skb(struct sk_buff *skb);
1363extern void napi_gro_flush(struct napi_struct *napi);
1364extern int napi_gro_receive(struct napi_struct *napi,
1365 struct sk_buff *skb);
1255extern void netif_nit_deliver(struct sk_buff *skb); 1366extern void netif_nit_deliver(struct sk_buff *skb);
1256extern int dev_valid_name(const char *name); 1367extern int dev_valid_name(const char *name);
1257extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); 1368extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
@@ -1444,8 +1555,7 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits)
1444} 1555}
1445 1556
1446/* Test if receive needs to be scheduled but only if up */ 1557/* Test if receive needs to be scheduled but only if up */
1447static inline int netif_rx_schedule_prep(struct net_device *dev, 1558static inline int netif_rx_schedule_prep(struct napi_struct *napi)
1448 struct napi_struct *napi)
1449{ 1559{
1450 return napi_schedule_prep(napi); 1560 return napi_schedule_prep(napi);
1451} 1561}
@@ -1453,27 +1563,24 @@ static inline int netif_rx_schedule_prep(struct net_device *dev,
1453/* Add interface to tail of rx poll list. This assumes that _prep has 1563/* Add interface to tail of rx poll list. This assumes that _prep has
1454 * already been called and returned 1. 1564 * already been called and returned 1.
1455 */ 1565 */
1456static inline void __netif_rx_schedule(struct net_device *dev, 1566static inline void __netif_rx_schedule(struct napi_struct *napi)
1457 struct napi_struct *napi)
1458{ 1567{
1459 __napi_schedule(napi); 1568 __napi_schedule(napi);
1460} 1569}
1461 1570
1462/* Try to reschedule poll. Called by irq handler. */ 1571/* Try to reschedule poll. Called by irq handler. */
1463 1572
1464static inline void netif_rx_schedule(struct net_device *dev, 1573static inline void netif_rx_schedule(struct napi_struct *napi)
1465 struct napi_struct *napi)
1466{ 1574{
1467 if (netif_rx_schedule_prep(dev, napi)) 1575 if (netif_rx_schedule_prep(napi))
1468 __netif_rx_schedule(dev, napi); 1576 __netif_rx_schedule(napi);
1469} 1577}
1470 1578
1471/* Try to reschedule poll. Called by dev->poll() after netif_rx_complete(). */ 1579/* Try to reschedule poll. Called by dev->poll() after netif_rx_complete(). */
1472static inline int netif_rx_reschedule(struct net_device *dev, 1580static inline int netif_rx_reschedule(struct napi_struct *napi)
1473 struct napi_struct *napi)
1474{ 1581{
1475 if (napi_schedule_prep(napi)) { 1582 if (napi_schedule_prep(napi)) {
1476 __netif_rx_schedule(dev, napi); 1583 __netif_rx_schedule(napi);
1477 return 1; 1584 return 1;
1478 } 1585 }
1479 return 0; 1586 return 0;
@@ -1482,8 +1589,7 @@ static inline int netif_rx_reschedule(struct net_device *dev,
1482/* same as netif_rx_complete, except that local_irq_save(flags) 1589/* same as netif_rx_complete, except that local_irq_save(flags)
1483 * has already been issued 1590 * has already been issued
1484 */ 1591 */
1485static inline void __netif_rx_complete(struct net_device *dev, 1592static inline void __netif_rx_complete(struct napi_struct *napi)
1486 struct napi_struct *napi)
1487{ 1593{
1488 __napi_complete(napi); 1594 __napi_complete(napi);
1489} 1595}
@@ -1493,20 +1599,9 @@ static inline void __netif_rx_complete(struct net_device *dev,
1493 * it completes the work. The device cannot be out of poll list at this 1599 * it completes the work. The device cannot be out of poll list at this
1494 * moment, it is BUG(). 1600 * moment, it is BUG().
1495 */ 1601 */
1496static inline void netif_rx_complete(struct net_device *dev, 1602static inline void netif_rx_complete(struct napi_struct *napi)
1497 struct napi_struct *napi)
1498{ 1603{
1499 unsigned long flags; 1604 napi_complete(napi);
1500
1501 /*
1502 * don't let napi dequeue from the cpu poll list
1503 * just in case its running on a different cpu
1504 */
1505 if (unlikely(test_bit(NAPI_STATE_NPSVC, &napi->state)))
1506 return;
1507 local_irq_save(flags);
1508 __netif_rx_complete(dev, napi);
1509 local_irq_restore(flags);
1510} 1605}
1511 1606
1512static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu) 1607static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu)
@@ -1683,6 +1778,8 @@ extern void netdev_features_change(struct net_device *dev);
1683/* Load a device via the kmod */ 1778/* Load a device via the kmod */
1684extern void dev_load(struct net *net, const char *name); 1779extern void dev_load(struct net *net, const char *name);
1685extern void dev_mcast_init(void); 1780extern void dev_mcast_init(void);
1781extern const struct net_device_stats *dev_get_stats(struct net_device *dev);
1782
1686extern int netdev_max_backlog; 1783extern int netdev_max_backlog;
1687extern int weight_p; 1784extern int weight_p;
1688extern int netdev_set_master(struct net_device *dev, struct net_device *master); 1785extern int netdev_set_master(struct net_device *dev, struct net_device *master);
@@ -1731,6 +1828,8 @@ static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
1731{ 1828{
1732 return skb_is_gso(skb) && 1829 return skb_is_gso(skb) &&
1733 (!skb_gso_ok(skb, dev->features) || 1830 (!skb_gso_ok(skb, dev->features) ||
1831 (skb_shinfo(skb)->frag_list &&
1832 !(dev->features & NETIF_F_FRAGLIST)) ||
1734 unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); 1833 unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
1735} 1834}
1736 1835
@@ -1749,26 +1848,31 @@ static inline int skb_bond_should_drop(struct sk_buff *skb)
1749 struct net_device *dev = skb->dev; 1848 struct net_device *dev = skb->dev;
1750 struct net_device *master = dev->master; 1849 struct net_device *master = dev->master;
1751 1850
1752 if (master && 1851 if (master) {
1753 (dev->priv_flags & IFF_SLAVE_INACTIVE)) { 1852 if (master->priv_flags & IFF_MASTER_ARPMON)
1754 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) && 1853 dev->last_rx = jiffies;
1755 skb->protocol == __constant_htons(ETH_P_ARP))
1756 return 0;
1757 1854
1758 if (master->priv_flags & IFF_MASTER_ALB) { 1855 if (dev->priv_flags & IFF_SLAVE_INACTIVE) {
1759 if (skb->pkt_type != PACKET_BROADCAST && 1856 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) &&
1760 skb->pkt_type != PACKET_MULTICAST) 1857 skb->protocol == __constant_htons(ETH_P_ARP))
1761 return 0; 1858 return 0;
1762 }
1763 if (master->priv_flags & IFF_MASTER_8023AD &&
1764 skb->protocol == __constant_htons(ETH_P_SLOW))
1765 return 0;
1766 1859
1767 return 1; 1860 if (master->priv_flags & IFF_MASTER_ALB) {
1861 if (skb->pkt_type != PACKET_BROADCAST &&
1862 skb->pkt_type != PACKET_MULTICAST)
1863 return 0;
1864 }
1865 if (master->priv_flags & IFF_MASTER_8023AD &&
1866 skb->protocol == __constant_htons(ETH_P_SLOW))
1867 return 0;
1868
1869 return 1;
1870 }
1768 } 1871 }
1769 return 0; 1872 return 0;
1770} 1873}
1771 1874
1875extern struct pernet_operations __net_initdata loopback_net_ops;
1772#endif /* __KERNEL__ */ 1876#endif /* __KERNEL__ */
1773 1877
1774#endif /* _LINUX_DEV_H */ 1878#endif /* _LINUX_DEV_H */