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.h420
1 files changed, 272 insertions, 148 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index e26f54952892..114091be8872 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;
@@ -310,9 +313,11 @@ struct napi_struct {
310#ifdef CONFIG_NETPOLL 313#ifdef CONFIG_NETPOLL
311 spinlock_t poll_lock; 314 spinlock_t poll_lock;
312 int poll_owner; 315 int poll_owner;
316#endif
313 struct net_device *dev; 317 struct net_device *dev;
314 struct list_head dev_list; 318 struct list_head dev_list;
315#endif 319 struct sk_buff *gro_list;
320 struct sk_buff *skb;
316}; 321};
317 322
318enum 323enum
@@ -373,22 +378,8 @@ static inline int napi_reschedule(struct napi_struct *napi)
373 * 378 *
374 * Mark NAPI processing as complete. 379 * Mark NAPI processing as complete.
375 */ 380 */
376static inline void __napi_complete(struct napi_struct *n) 381extern void __napi_complete(struct napi_struct *n);
377{ 382extern 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 383
393/** 384/**
394 * napi_disable - prevent NAPI from scheduling 385 * napi_disable - prevent NAPI from scheduling
@@ -452,6 +443,147 @@ struct netdev_queue {
452 struct Qdisc *qdisc_sleeping; 443 struct Qdisc *qdisc_sleeping;
453} ____cacheline_aligned_in_smp; 444} ____cacheline_aligned_in_smp;
454 445
446
447/*
448 * This structure defines the management hooks for network devices.
449 * The following hooks can be defined; unless noted otherwise, they are
450 * optional and can be filled with a null pointer.
451 *
452 * int (*ndo_init)(struct net_device *dev);
453 * This function is called once when network device is registered.
454 * The network device can use this to any late stage initializaton
455 * or semantic validattion. It can fail with an error code which will
456 * be propogated back to register_netdev
457 *
458 * void (*ndo_uninit)(struct net_device *dev);
459 * This function is called when device is unregistered or when registration
460 * fails. It is not called if init fails.
461 *
462 * int (*ndo_open)(struct net_device *dev);
463 * This function is called when network device transistions to the up
464 * state.
465 *
466 * int (*ndo_stop)(struct net_device *dev);
467 * This function is called when network device transistions to the down
468 * state.
469 *
470 * int (*ndo_hard_start_xmit)(struct sk_buff *skb, struct net_device *dev);
471 * Called when a packet needs to be transmitted.
472 * Must return NETDEV_TX_OK , NETDEV_TX_BUSY, or NETDEV_TX_LOCKED,
473 * Required can not be NULL.
474 *
475 * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb);
476 * Called to decide which queue to when device supports multiple
477 * transmit queues.
478 *
479 * void (*ndo_change_rx_flags)(struct net_device *dev, int flags);
480 * This function is called to allow device receiver to make
481 * changes to configuration when multicast or promiscious is enabled.
482 *
483 * void (*ndo_set_rx_mode)(struct net_device *dev);
484 * This function is called device changes address list filtering.
485 *
486 * void (*ndo_set_multicast_list)(struct net_device *dev);
487 * This function is called when the multicast address list changes.
488 *
489 * int (*ndo_set_mac_address)(struct net_device *dev, void *addr);
490 * This function is called when the Media Access Control address
491 * needs to be changed. If not this interface is not defined, the
492 * mac address can not be changed.
493 *
494 * int (*ndo_validate_addr)(struct net_device *dev);
495 * Test if Media Access Control address is valid for the device.
496 *
497 * int (*ndo_do_ioctl)(struct net_device *dev, struct ifreq *ifr, int cmd);
498 * Called when a user request an ioctl which can't be handled by
499 * the generic interface code. If not defined ioctl's return
500 * not supported error code.
501 *
502 * int (*ndo_set_config)(struct net_device *dev, struct ifmap *map);
503 * Used to set network devices bus interface parameters. This interface
504 * is retained for legacy reason, new devices should use the bus
505 * interface (PCI) for low level management.
506 *
507 * int (*ndo_change_mtu)(struct net_device *dev, int new_mtu);
508 * Called when a user wants to change the Maximum Transfer Unit
509 * of a device. If not defined, any request to change MTU will
510 * will return an error.
511 *
512 * void (*ndo_tx_timeout)(struct net_device *dev);
513 * Callback uses when the transmitter has not made any progress
514 * for dev->watchdog ticks.
515 *
516 * struct net_device_stats* (*get_stats)(struct net_device *dev);
517 * Called when a user wants to get the network device usage
518 * statistics. If not defined, the counters in dev->stats will
519 * be used.
520 *
521 * void (*ndo_vlan_rx_register)(struct net_device *dev, struct vlan_group *grp);
522 * If device support VLAN receive accleration
523 * (ie. dev->features & NETIF_F_HW_VLAN_RX), then this function is called
524 * when vlan groups for the device changes. Note: grp is NULL
525 * if no vlan's groups are being used.
526 *
527 * void (*ndo_vlan_rx_add_vid)(struct net_device *dev, unsigned short vid);
528 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER)
529 * this function is called when a VLAN id is registered.
530 *
531 * void (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid);
532 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER)
533 * this function is called when a VLAN id is unregistered.
534 *
535 * void (*ndo_poll_controller)(struct net_device *dev);
536 */
537#define HAVE_NET_DEVICE_OPS
538struct net_device_ops {
539 int (*ndo_init)(struct net_device *dev);
540 void (*ndo_uninit)(struct net_device *dev);
541 int (*ndo_open)(struct net_device *dev);
542 int (*ndo_stop)(struct net_device *dev);
543 int (*ndo_start_xmit) (struct sk_buff *skb,
544 struct net_device *dev);
545 u16 (*ndo_select_queue)(struct net_device *dev,
546 struct sk_buff *skb);
547#define HAVE_CHANGE_RX_FLAGS
548 void (*ndo_change_rx_flags)(struct net_device *dev,
549 int flags);
550#define HAVE_SET_RX_MODE
551 void (*ndo_set_rx_mode)(struct net_device *dev);
552#define HAVE_MULTICAST
553 void (*ndo_set_multicast_list)(struct net_device *dev);
554#define HAVE_SET_MAC_ADDR
555 int (*ndo_set_mac_address)(struct net_device *dev,
556 void *addr);
557#define HAVE_VALIDATE_ADDR
558 int (*ndo_validate_addr)(struct net_device *dev);
559#define HAVE_PRIVATE_IOCTL
560 int (*ndo_do_ioctl)(struct net_device *dev,
561 struct ifreq *ifr, int cmd);
562#define HAVE_SET_CONFIG
563 int (*ndo_set_config)(struct net_device *dev,
564 struct ifmap *map);
565#define HAVE_CHANGE_MTU
566 int (*ndo_change_mtu)(struct net_device *dev,
567 int new_mtu);
568 int (*ndo_neigh_setup)(struct net_device *dev,
569 struct neigh_parms *);
570#define HAVE_TX_TIMEOUT
571 void (*ndo_tx_timeout) (struct net_device *dev);
572
573 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
574
575 void (*ndo_vlan_rx_register)(struct net_device *dev,
576 struct vlan_group *grp);
577 void (*ndo_vlan_rx_add_vid)(struct net_device *dev,
578 unsigned short vid);
579 void (*ndo_vlan_rx_kill_vid)(struct net_device *dev,
580 unsigned short vid);
581#ifdef CONFIG_NET_POLL_CONTROLLER
582#define HAVE_NETDEV_POLL
583 void (*ndo_poll_controller)(struct net_device *dev);
584#endif
585};
586
455/* 587/*
456 * The DEVICE structure. 588 * The DEVICE structure.
457 * Actually, this whole structure is a big mistake. It mixes I/O 589 * Actually, this whole structure is a big mistake. It mixes I/O
@@ -496,14 +628,7 @@ struct net_device
496 unsigned long state; 628 unsigned long state;
497 629
498 struct list_head dev_list; 630 struct list_head dev_list;
499#ifdef CONFIG_NETPOLL
500 struct list_head napi_list; 631 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 632
508 /* Net device features */ 633 /* Net device features */
509 unsigned long features; 634 unsigned long features;
@@ -522,6 +647,7 @@ struct net_device
522#define NETIF_F_LLTX 4096 /* LockLess TX - deprecated. Please */ 647#define NETIF_F_LLTX 4096 /* LockLess TX - deprecated. Please */
523 /* do not use LLTX in new drivers */ 648 /* do not use LLTX in new drivers */
524#define NETIF_F_NETNS_LOCAL 8192 /* Does not change network namespaces */ 649#define NETIF_F_NETNS_LOCAL 8192 /* Does not change network namespaces */
650#define NETIF_F_GRO 16384 /* Generic receive offload */
525#define NETIF_F_LRO 32768 /* large receive offload */ 651#define NETIF_F_LRO 32768 /* large receive offload */
526 652
527 /* Segmentation offload features */ 653 /* Segmentation offload features */
@@ -547,15 +673,13 @@ struct net_device
547 * for all in netdev_increment_features. 673 * for all in netdev_increment_features.
548 */ 674 */
549#define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \ 675#define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \
550 NETIF_F_SG | NETIF_F_HIGHDMA | \ 676 NETIF_F_SG | NETIF_F_HIGHDMA | \
551 NETIF_F_FRAGLIST) 677 NETIF_F_FRAGLIST)
552 678
553 /* Interface index. Unique device identifier */ 679 /* Interface index. Unique device identifier */
554 int ifindex; 680 int ifindex;
555 int iflink; 681 int iflink;
556 682
557
558 struct net_device_stats* (*get_stats)(struct net_device *dev);
559 struct net_device_stats stats; 683 struct net_device_stats stats;
560 684
561#ifdef CONFIG_WIRELESS_EXT 685#ifdef CONFIG_WIRELESS_EXT
@@ -565,18 +689,13 @@ struct net_device
565 /* Instance data managed by the core of Wireless Extensions. */ 689 /* Instance data managed by the core of Wireless Extensions. */
566 struct iw_public_data * wireless_data; 690 struct iw_public_data * wireless_data;
567#endif 691#endif
692 /* Management operations */
693 const struct net_device_ops *netdev_ops;
568 const struct ethtool_ops *ethtool_ops; 694 const struct ethtool_ops *ethtool_ops;
569 695
570 /* Hardware header description */ 696 /* Hardware header description */
571 const struct header_ops *header_ops; 697 const struct header_ops *header_ops;
572 698
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) */ 699 unsigned int flags; /* interface flags (a la BSD) */
581 unsigned short gflags; 700 unsigned short gflags;
582 unsigned short priv_flags; /* Like 'flags' but invisible to userspace. */ 701 unsigned short priv_flags; /* Like 'flags' but invisible to userspace. */
@@ -635,7 +754,7 @@ struct net_device
635 unsigned long last_rx; /* Time of last Rx */ 754 unsigned long last_rx; /* Time of last Rx */
636 /* Interface address info used in eth_type_trans() */ 755 /* Interface address info used in eth_type_trans() */
637 unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast 756 unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast
638 because most packets are unicast) */ 757 because most packets are unicast) */
639 758
640 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ 759 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
641 760
@@ -654,18 +773,12 @@ struct net_device
654/* 773/*
655 * One part is mostly used on xmit path (device) 774 * One part is mostly used on xmit path (device)
656 */ 775 */
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. */ 776 /* These may be needed for future network-power-down code. */
661 unsigned long trans_start; /* Time (in jiffies) of last Tx */ 777 unsigned long trans_start; /* Time (in jiffies) of last Tx */
662 778
663 int watchdog_timeo; /* used by dev_watchdog() */ 779 int watchdog_timeo; /* used by dev_watchdog() */
664 struct timer_list watchdog_timer; 780 struct timer_list watchdog_timer;
665 781
666/*
667 * refcnt is a very hot point, so align it on SMP
668 */
669 /* Number of references to this device */ 782 /* Number of references to this device */
670 atomic_t refcnt ____cacheline_aligned_in_smp; 783 atomic_t refcnt ____cacheline_aligned_in_smp;
671 784
@@ -684,56 +797,12 @@ struct net_device
684 NETREG_RELEASED, /* called free_netdev */ 797 NETREG_RELEASED, /* called free_netdev */
685 } reg_state; 798 } reg_state;
686 799
687 /* Called after device is detached from network. */ 800 /* Called from unregister, can be used to call free_netdev */
688 void (*uninit)(struct net_device *dev); 801 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 802
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
727 int (*neigh_setup)(struct net_device *dev, struct neigh_parms *);
728#ifdef CONFIG_NETPOLL 803#ifdef CONFIG_NETPOLL
729 struct netpoll_info *npinfo; 804 struct netpoll_info *npinfo;
730#endif 805#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 806
738#ifdef CONFIG_NET_NS 807#ifdef CONFIG_NET_NS
739 /* Network namespace this network device is inside */ 808 /* Network namespace this network device is inside */
@@ -764,6 +833,49 @@ struct net_device
764 /* for setting kernel sock attribute on TCP connection setup */ 833 /* for setting kernel sock attribute on TCP connection setup */
765#define GSO_MAX_SIZE 65536 834#define GSO_MAX_SIZE 65536
766 unsigned int gso_max_size; 835 unsigned int gso_max_size;
836
837#ifdef CONFIG_DCB
838 /* Data Center Bridging netlink ops */
839 struct dcbnl_rtnl_ops *dcbnl_ops;
840#endif
841
842#ifdef CONFIG_COMPAT_NET_DEV_OPS
843 struct {
844 int (*init)(struct net_device *dev);
845 void (*uninit)(struct net_device *dev);
846 int (*open)(struct net_device *dev);
847 int (*stop)(struct net_device *dev);
848 int (*hard_start_xmit) (struct sk_buff *skb,
849 struct net_device *dev);
850 u16 (*select_queue)(struct net_device *dev,
851 struct sk_buff *skb);
852 void (*change_rx_flags)(struct net_device *dev,
853 int flags);
854 void (*set_rx_mode)(struct net_device *dev);
855 void (*set_multicast_list)(struct net_device *dev);
856 int (*set_mac_address)(struct net_device *dev,
857 void *addr);
858 int (*validate_addr)(struct net_device *dev);
859 int (*do_ioctl)(struct net_device *dev,
860 struct ifreq *ifr, int cmd);
861 int (*set_config)(struct net_device *dev,
862 struct ifmap *map);
863 int (*change_mtu)(struct net_device *dev, int new_mtu);
864 int (*neigh_setup)(struct net_device *dev,
865 struct neigh_parms *);
866 void (*tx_timeout) (struct net_device *dev);
867 struct net_device_stats* (*get_stats)(struct net_device *dev);
868 void (*vlan_rx_register)(struct net_device *dev,
869 struct vlan_group *grp);
870 void (*vlan_rx_add_vid)(struct net_device *dev,
871 unsigned short vid);
872 void (*vlan_rx_kill_vid)(struct net_device *dev,
873 unsigned short vid);
874#ifdef CONFIG_NET_POLL_CONTROLLER
875 void (*poll_controller)(struct net_device *dev);
876#endif
877 };
878#endif
767}; 879};
768#define to_net_dev(d) container_of(d, struct net_device, dev) 880#define to_net_dev(d) container_of(d, struct net_device, dev)
769 881
@@ -859,22 +971,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 971 * netif_napi_add() must be used to initialize a napi context prior to calling
860 * *any* of the other napi related functions. 972 * *any* of the other napi related functions.
861 */ 973 */
862static inline void netif_napi_add(struct net_device *dev, 974void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
863 struct napi_struct *napi, 975 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 976
879/** 977/**
880 * netif_napi_del - remove a napi context 978 * netif_napi_del - remove a napi context
@@ -882,12 +980,23 @@ static inline void netif_napi_add(struct net_device *dev,
882 * 980 *
883 * netif_napi_del() removes a napi context from the network device napi list 981 * netif_napi_del() removes a napi context from the network device napi list
884 */ 982 */
885static inline void netif_napi_del(struct napi_struct *napi) 983void netif_napi_del(struct napi_struct *napi);
886{ 984
887#ifdef CONFIG_NETPOLL 985struct napi_gro_cb {
888 list_del(&napi->dev_list); 986 /* This is non-zero if the packet may be of the same flow. */
889#endif 987 int same_flow;
890} 988
989 /* This is non-zero if the packet cannot be merged with the new skb. */
990 int flush;
991
992 /* Number of segments aggregated. */
993 int count;
994
995 /* Free the skb? */
996 int free;
997};
998
999#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb)
891 1000
892struct packet_type { 1001struct packet_type {
893 __be16 type; /* This is really htons(ether_type). */ 1002 __be16 type; /* This is really htons(ether_type). */
@@ -899,10 +1008,21 @@ struct packet_type {
899 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 1008 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
900 int features); 1009 int features);
901 int (*gso_send_check)(struct sk_buff *skb); 1010 int (*gso_send_check)(struct sk_buff *skb);
1011 struct sk_buff **(*gro_receive)(struct sk_buff **head,
1012 struct sk_buff *skb);
1013 int (*gro_complete)(struct sk_buff *skb);
902 void *af_packet_priv; 1014 void *af_packet_priv;
903 struct list_head list; 1015 struct list_head list;
904}; 1016};
905 1017
1018struct napi_gro_fraginfo {
1019 skb_frag_t frags[MAX_SKB_FRAGS];
1020 unsigned int nr_frags;
1021 unsigned int ip_summed;
1022 unsigned int len;
1023 __wsum csum;
1024};
1025
906#include <linux/interrupt.h> 1026#include <linux/interrupt.h>
907#include <linux/notifier.h> 1027#include <linux/notifier.h>
908 1028
@@ -1252,6 +1372,17 @@ extern int netif_rx(struct sk_buff *skb);
1252extern int netif_rx_ni(struct sk_buff *skb); 1372extern int netif_rx_ni(struct sk_buff *skb);
1253#define HAVE_NETIF_RECEIVE_SKB 1 1373#define HAVE_NETIF_RECEIVE_SKB 1
1254extern int netif_receive_skb(struct sk_buff *skb); 1374extern int netif_receive_skb(struct sk_buff *skb);
1375extern void napi_gro_flush(struct napi_struct *napi);
1376extern int dev_gro_receive(struct napi_struct *napi,
1377 struct sk_buff *skb);
1378extern int napi_gro_receive(struct napi_struct *napi,
1379 struct sk_buff *skb);
1380extern void napi_reuse_skb(struct napi_struct *napi,
1381 struct sk_buff *skb);
1382extern struct sk_buff * napi_fraginfo_skb(struct napi_struct *napi,
1383 struct napi_gro_fraginfo *info);
1384extern int napi_gro_frags(struct napi_struct *napi,
1385 struct napi_gro_fraginfo *info);
1255extern void netif_nit_deliver(struct sk_buff *skb); 1386extern void netif_nit_deliver(struct sk_buff *skb);
1256extern int dev_valid_name(const char *name); 1387extern int dev_valid_name(const char *name);
1257extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); 1388extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
@@ -1444,8 +1575,7 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits)
1444} 1575}
1445 1576
1446/* Test if receive needs to be scheduled but only if up */ 1577/* Test if receive needs to be scheduled but only if up */
1447static inline int netif_rx_schedule_prep(struct net_device *dev, 1578static inline int netif_rx_schedule_prep(struct napi_struct *napi)
1448 struct napi_struct *napi)
1449{ 1579{
1450 return napi_schedule_prep(napi); 1580 return napi_schedule_prep(napi);
1451} 1581}
@@ -1453,27 +1583,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 1583/* Add interface to tail of rx poll list. This assumes that _prep has
1454 * already been called and returned 1. 1584 * already been called and returned 1.
1455 */ 1585 */
1456static inline void __netif_rx_schedule(struct net_device *dev, 1586static inline void __netif_rx_schedule(struct napi_struct *napi)
1457 struct napi_struct *napi)
1458{ 1587{
1459 __napi_schedule(napi); 1588 __napi_schedule(napi);
1460} 1589}
1461 1590
1462/* Try to reschedule poll. Called by irq handler. */ 1591/* Try to reschedule poll. Called by irq handler. */
1463 1592
1464static inline void netif_rx_schedule(struct net_device *dev, 1593static inline void netif_rx_schedule(struct napi_struct *napi)
1465 struct napi_struct *napi)
1466{ 1594{
1467 if (netif_rx_schedule_prep(dev, napi)) 1595 if (netif_rx_schedule_prep(napi))
1468 __netif_rx_schedule(dev, napi); 1596 __netif_rx_schedule(napi);
1469} 1597}
1470 1598
1471/* Try to reschedule poll. Called by dev->poll() after netif_rx_complete(). */ 1599/* Try to reschedule poll. Called by dev->poll() after netif_rx_complete(). */
1472static inline int netif_rx_reschedule(struct net_device *dev, 1600static inline int netif_rx_reschedule(struct napi_struct *napi)
1473 struct napi_struct *napi)
1474{ 1601{
1475 if (napi_schedule_prep(napi)) { 1602 if (napi_schedule_prep(napi)) {
1476 __netif_rx_schedule(dev, napi); 1603 __netif_rx_schedule(napi);
1477 return 1; 1604 return 1;
1478 } 1605 }
1479 return 0; 1606 return 0;
@@ -1482,8 +1609,7 @@ static inline int netif_rx_reschedule(struct net_device *dev,
1482/* same as netif_rx_complete, except that local_irq_save(flags) 1609/* same as netif_rx_complete, except that local_irq_save(flags)
1483 * has already been issued 1610 * has already been issued
1484 */ 1611 */
1485static inline void __netif_rx_complete(struct net_device *dev, 1612static inline void __netif_rx_complete(struct napi_struct *napi)
1486 struct napi_struct *napi)
1487{ 1613{
1488 __napi_complete(napi); 1614 __napi_complete(napi);
1489} 1615}
@@ -1493,20 +1619,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 1619 * it completes the work. The device cannot be out of poll list at this
1494 * moment, it is BUG(). 1620 * moment, it is BUG().
1495 */ 1621 */
1496static inline void netif_rx_complete(struct net_device *dev, 1622static inline void netif_rx_complete(struct napi_struct *napi)
1497 struct napi_struct *napi)
1498{ 1623{
1499 unsigned long flags; 1624 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} 1625}
1511 1626
1512static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu) 1627static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu)
@@ -1683,6 +1798,8 @@ extern void netdev_features_change(struct net_device *dev);
1683/* Load a device via the kmod */ 1798/* Load a device via the kmod */
1684extern void dev_load(struct net *net, const char *name); 1799extern void dev_load(struct net *net, const char *name);
1685extern void dev_mcast_init(void); 1800extern void dev_mcast_init(void);
1801extern const struct net_device_stats *dev_get_stats(struct net_device *dev);
1802
1686extern int netdev_max_backlog; 1803extern int netdev_max_backlog;
1687extern int weight_p; 1804extern int weight_p;
1688extern int netdev_set_master(struct net_device *dev, struct net_device *master); 1805extern int netdev_set_master(struct net_device *dev, struct net_device *master);
@@ -1731,6 +1848,8 @@ static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
1731{ 1848{
1732 return skb_is_gso(skb) && 1849 return skb_is_gso(skb) &&
1733 (!skb_gso_ok(skb, dev->features) || 1850 (!skb_gso_ok(skb, dev->features) ||
1851 (skb_shinfo(skb)->frag_list &&
1852 !(dev->features & NETIF_F_FRAGLIST)) ||
1734 unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); 1853 unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
1735} 1854}
1736 1855
@@ -1749,26 +1868,31 @@ static inline int skb_bond_should_drop(struct sk_buff *skb)
1749 struct net_device *dev = skb->dev; 1868 struct net_device *dev = skb->dev;
1750 struct net_device *master = dev->master; 1869 struct net_device *master = dev->master;
1751 1870
1752 if (master && 1871 if (master) {
1753 (dev->priv_flags & IFF_SLAVE_INACTIVE)) { 1872 if (master->priv_flags & IFF_MASTER_ARPMON)
1754 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) && 1873 dev->last_rx = jiffies;
1755 skb->protocol == __constant_htons(ETH_P_ARP))
1756 return 0;
1757 1874
1758 if (master->priv_flags & IFF_MASTER_ALB) { 1875 if (dev->priv_flags & IFF_SLAVE_INACTIVE) {
1759 if (skb->pkt_type != PACKET_BROADCAST && 1876 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) &&
1760 skb->pkt_type != PACKET_MULTICAST) 1877 skb->protocol == __constant_htons(ETH_P_ARP))
1761 return 0; 1878 return 0;
1762 }
1763 if (master->priv_flags & IFF_MASTER_8023AD &&
1764 skb->protocol == __constant_htons(ETH_P_SLOW))
1765 return 0;
1766 1879
1767 return 1; 1880 if (master->priv_flags & IFF_MASTER_ALB) {
1881 if (skb->pkt_type != PACKET_BROADCAST &&
1882 skb->pkt_type != PACKET_MULTICAST)
1883 return 0;
1884 }
1885 if (master->priv_flags & IFF_MASTER_8023AD &&
1886 skb->protocol == __constant_htons(ETH_P_SLOW))
1887 return 0;
1888
1889 return 1;
1890 }
1768 } 1891 }
1769 return 0; 1892 return 0;
1770} 1893}
1771 1894
1895extern struct pernet_operations __net_initdata loopback_net_ops;
1772#endif /* __KERNEL__ */ 1896#endif /* __KERNEL__ */
1773 1897
1774#endif /* _LINUX_DEV_H */ 1898#endif /* _LINUX_DEV_H */