Containerized syslog working properly
[safe/jmp/linux-2.6] / include / linux / netdevice.h
index f8c3619..75a3ef1 100644 (file)
 #include <linux/if.h>
 #include <linux/if_ether.h>
 #include <linux/if_packet.h>
+#include <linux/if_link.h>
 
 #ifdef __KERNEL__
+#include <linux/pm_qos_params.h>
 #include <linux/timer.h>
 #include <linux/delay.h>
 #include <linux/mm.h>
@@ -39,6 +41,7 @@
 
 #include <linux/device.h>
 #include <linux/percpu.h>
+#include <linux/rculist.h>
 #include <linux/dmaengine.h>
 #include <linux/workqueue.h>
 
@@ -62,49 +65,86 @@ struct wireless_dev;
 #define HAVE_FREE_NETDEV               /* free_netdev() */
 #define HAVE_NETDEV_PRIV               /* netdev_priv() */
 
-#define NET_XMIT_SUCCESS       0
-#define NET_XMIT_DROP          1       /* skb dropped                  */
-#define NET_XMIT_CN            2       /* congestion notification      */
-#define NET_XMIT_POLICED       3       /* skb is shot by police        */
-#define NET_XMIT_MASK          0xFFFF  /* qdisc flags in net/sch_generic.h */
-
 /* Backlog congestion levels */
-#define NET_RX_SUCCESS         0   /* keep 'em coming, baby */
-#define NET_RX_DROP            1  /* packet dropped */
-#define NET_RX_CN_LOW          2   /* storm alert, just in case */
-#define NET_RX_CN_MOD          3   /* Storm on its way! */
-#define NET_RX_CN_HIGH         4   /* The storm is here */
-#define NET_RX_BAD             5  /* packet dropped due to kernel error */
+#define NET_RX_SUCCESS         0       /* keep 'em coming, baby */
+#define NET_RX_DROP            1       /* packet dropped */
+
+/*
+ * Transmit return codes: transmit return codes originate from three different
+ * namespaces:
+ *
+ * - qdisc return codes
+ * - driver transmit return codes
+ * - errno values
+ *
+ * Drivers are allowed to return any one of those in their hard_start_xmit()
+ * function. Real network devices commonly used with qdiscs should only return
+ * the driver transmit return codes though - when qdiscs are used, the actual
+ * transmission happens asynchronously, so the value is not propagated to
+ * higher layers. Virtual network devices transmit synchronously, in this case
+ * the driver transmit return codes are consumed by dev_queue_xmit(), all
+ * others are propagated to higher layers.
+ */
+
+/* qdisc ->enqueue() return codes. */
+#define NET_XMIT_SUCCESS       0x00
+#define NET_XMIT_DROP          0x01    /* skb dropped                  */
+#define NET_XMIT_CN            0x02    /* congestion notification      */
+#define NET_XMIT_POLICED       0x03    /* skb is shot by police        */
+#define NET_XMIT_MASK          0x0f    /* qdisc flags in net/sch_generic.h */
 
 /* NET_XMIT_CN is special. It does not guarantee that this packet is lost. It
  * indicates that the device will soon be dropping packets, or already drops
  * some packets of the same priority; prompting us to send less aggressively. */
-#define net_xmit_eval(e)       ((e) == NET_XMIT_CN? 0 : (e))
+#define net_xmit_eval(e)       ((e) == NET_XMIT_CN ? 0 : (e))
 #define net_xmit_errno(e)      ((e) != NET_XMIT_CN ? -ENOBUFS : 0)
 
+/* Driver transmit return codes */
+#define NETDEV_TX_MASK         0xf0
+
+enum netdev_tx {
+       __NETDEV_TX_MIN  = INT_MIN,     /* make sure enum is signed */
+       NETDEV_TX_OK     = 0x00,        /* driver took care of packet */
+       NETDEV_TX_BUSY   = 0x10,        /* driver tx path was busy*/
+       NETDEV_TX_LOCKED = 0x20,        /* driver tx lock was already taken */
+};
+typedef enum netdev_tx netdev_tx_t;
+
+/*
+ * Current order: NETDEV_TX_MASK > NET_XMIT_MASK >= 0 is significant;
+ * hard_start_xmit() return < NET_XMIT_MASK means skb was consumed.
+ */
+static inline bool dev_xmit_complete(int rc)
+{
+       /*
+        * Positive cases with an skb consumed by a driver:
+        * - successful transmission (rc == NETDEV_TX_OK)
+        * - error while transmitting (rc < 0)
+        * - error while queueing to a different device (rc & NET_XMIT_MASK)
+        */
+       if (likely(rc < NET_XMIT_MASK))
+               return true;
+
+       return false;
+}
+
 #endif
 
 #define MAX_ADDR_LEN   32              /* Largest hardware address length */
 
-/* Driver transmit return codes */
-#define NETDEV_TX_OK 0         /* driver took care of packet */
-#define NETDEV_TX_BUSY 1       /* driver tx path was busy*/
-#define NETDEV_TX_LOCKED -1    /* driver tx lock was already taken */
-
 #ifdef  __KERNEL__
-
 /*
  *     Compute the worst case header length according to the protocols
  *     used.
  */
 
-#if defined(CONFIG_WLAN_80211) || defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
+#if defined(CONFIG_WLAN) || defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
 # if defined(CONFIG_MAC80211_MESH)
 #  define LL_MAX_HEADER 128
 # else
 #  define LL_MAX_HEADER 96
 # endif
-#elif defined(CONFIG_TR)
+#elif defined(CONFIG_TR) || defined(CONFIG_TR_MODULE)
 # define LL_MAX_HEADER 48
 #else
 # define LL_MAX_HEADER 32
@@ -126,8 +166,7 @@ struct wireless_dev;
  *     with byte counters.
  */
 
-struct net_device_stats
-{
+struct net_device_stats {
        unsigned long   rx_packets;             /* total packets received       */
        unsigned long   tx_packets;             /* total packets transmitted    */
        unsigned long   rx_bytes;               /* total bytes received         */
@@ -180,38 +219,42 @@ struct neighbour;
 struct neigh_parms;
 struct sk_buff;
 
-struct netif_rx_stats
-{
-       unsigned total;
-       unsigned dropped;
-       unsigned time_squeeze;
-       unsigned cpu_collision;
+struct netdev_hw_addr {
+       struct list_head        list;
+       unsigned char           addr[MAX_ADDR_LEN];
+       unsigned char           type;
+#define NETDEV_HW_ADDR_T_LAN           1
+#define NETDEV_HW_ADDR_T_SAN           2
+#define NETDEV_HW_ADDR_T_SLAVE         3
+#define NETDEV_HW_ADDR_T_UNICAST       4
+#define NETDEV_HW_ADDR_T_MULTICAST     5
+       int                     refcount;
+       bool                    synced;
+       bool                    global_use;
+       struct rcu_head         rcu_head;
 };
 
-DECLARE_PER_CPU(struct netif_rx_stats, netdev_rx_stat);
-
-struct dev_addr_list
-{
-       struct dev_addr_list    *next;
-       u8                      da_addr[MAX_ADDR_LEN];
-       u8                      da_addrlen;
-       u8                      da_synced;
-       int                     da_users;
-       int                     da_gusers;
+struct netdev_hw_addr_list {
+       struct list_head        list;
+       int                     count;
 };
 
-/*
- *     We tag multicasts with these structures.
- */
+#define netdev_hw_addr_list_count(l) ((l)->count)
+#define netdev_hw_addr_list_empty(l) (netdev_hw_addr_list_count(l) == 0)
+#define netdev_hw_addr_list_for_each(ha, l) \
+       list_for_each_entry(ha, &(l)->list, list)
 
-#define dev_mc_list    dev_addr_list
-#define dmi_addr       da_addr
-#define dmi_addrlen    da_addrlen
-#define dmi_users      da_users
-#define dmi_gusers     da_gusers
+#define netdev_uc_count(dev) netdev_hw_addr_list_count(&(dev)->uc)
+#define netdev_uc_empty(dev) netdev_hw_addr_list_empty(&(dev)->uc)
+#define netdev_for_each_uc_addr(ha, dev) \
+       netdev_hw_addr_list_for_each(ha, &(dev)->uc)
 
-struct hh_cache
-{
+#define netdev_mc_count(dev) netdev_hw_addr_list_count(&(dev)->mc)
+#define netdev_mc_empty(dev) netdev_hw_addr_list_empty(&(dev)->mc)
+#define netdev_for_each_mc_addr(ha, dev) \
+       netdev_hw_addr_list_for_each(ha, &(dev)->mc)
+
+struct hh_cache {
        struct hh_cache *hh_next;       /* Next entry                        */
        atomic_t        hh_refcnt;      /* number of users                   */
 /*
@@ -274,8 +317,7 @@ struct header_ops {
  * code.
  */
 
-enum netdev_state_t
-{
+enum netdev_state_t {
        __LINK_STATE_START,
        __LINK_STATE_PRESENT,
        __LINK_STATE_NOCARRIER,
@@ -324,20 +366,20 @@ struct napi_struct {
        struct sk_buff          *skb;
 };
 
-enum
-{
+enum {
        NAPI_STATE_SCHED,       /* Poll is scheduled */
        NAPI_STATE_DISABLE,     /* Disable pending */
        NAPI_STATE_NPSVC,       /* Netpoll - don't dequeue from poll_list */
 };
 
-enum {
+enum gro_result {
        GRO_MERGED,
        GRO_MERGED_FREE,
        GRO_HELD,
        GRO_NORMAL,
        GRO_DROP,
 };
+typedef enum gro_result gro_result_t;
 
 extern void __napi_schedule(struct napi_struct *n);
 
@@ -440,21 +482,112 @@ static inline void napi_synchronize(const struct napi_struct *n)
 # define napi_synchronize(n)   barrier()
 #endif
 
-enum netdev_queue_state_t
-{
+enum netdev_queue_state_t {
        __QUEUE_STATE_XOFF,
        __QUEUE_STATE_FROZEN,
 };
 
 struct netdev_queue {
+/*
+ * read mostly part
+ */
        struct net_device       *dev;
        struct Qdisc            *qdisc;
        unsigned long           state;
-       spinlock_t              _xmit_lock;
-       int                     xmit_lock_owner;
        struct Qdisc            *qdisc_sleeping;
+/*
+ * write mostly part
+ */
+       spinlock_t              _xmit_lock ____cacheline_aligned_in_smp;
+       int                     xmit_lock_owner;
+       /*
+        * please use this field instead of dev->trans_start
+        */
+       unsigned long           trans_start;
+       unsigned long           tx_bytes;
+       unsigned long           tx_packets;
+       unsigned long           tx_dropped;
 } ____cacheline_aligned_in_smp;
 
+#ifdef CONFIG_RPS
+/*
+ * This structure holds an RPS map which can be of variable length.  The
+ * map is an array of CPUs.
+ */
+struct rps_map {
+       unsigned int len;
+       struct rcu_head rcu;
+       u16 cpus[0];
+};
+#define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + (_num * sizeof(u16)))
+
+/*
+ * The rps_dev_flow structure contains the mapping of a flow to a CPU and the
+ * tail pointer for that CPU's input queue at the time of last enqueue.
+ */
+struct rps_dev_flow {
+       u16 cpu;
+       u16 fill;
+       unsigned int last_qtail;
+};
+
+/*
+ * The rps_dev_flow_table structure contains a table of flow mappings.
+ */
+struct rps_dev_flow_table {
+       unsigned int mask;
+       struct rcu_head rcu;
+       struct work_struct free_work;
+       struct rps_dev_flow flows[0];
+};
+#define RPS_DEV_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_dev_flow_table) + \
+    (_num * sizeof(struct rps_dev_flow)))
+
+/*
+ * The rps_sock_flow_table contains mappings of flows to the last CPU
+ * on which they were processed by the application (set in recvmsg).
+ */
+struct rps_sock_flow_table {
+       unsigned int mask;
+       u16 ents[0];
+};
+#define        RPS_SOCK_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_sock_flow_table) + \
+    (_num * sizeof(u16)))
+
+#define RPS_NO_CPU 0xffff
+
+static inline void rps_record_sock_flow(struct rps_sock_flow_table *table,
+                                       u32 hash)
+{
+       if (table && hash) {
+               unsigned int cpu, index = hash & table->mask;
+
+               /* We only give a hint, preemption can change cpu under us */
+               cpu = raw_smp_processor_id();
+
+               if (table->ents[index] != cpu)
+                       table->ents[index] = cpu;
+       }
+}
+
+static inline void rps_reset_sock_flow(struct rps_sock_flow_table *table,
+                                      u32 hash)
+{
+       if (table && hash)
+               table->ents[hash & table->mask] = RPS_NO_CPU;
+}
+
+extern struct rps_sock_flow_table *rps_sock_flow_table;
+
+/* This structure contains an instance of an RX queue. */
+struct netdev_rx_queue {
+       struct rps_map *rps_map;
+       struct rps_dev_flow_table *rps_flow_table;
+       struct kobject kobj;
+       struct netdev_rx_queue *first;
+       atomic_t count;
+} ____cacheline_aligned_in_smp;
+#endif /* CONFIG_RPS */
 
 /*
  * This structure defines the management hooks for network devices.
@@ -479,9 +612,11 @@ struct netdev_queue {
  *     This function is called when network device transistions to the down
  *     state.
  *
- * int (*ndo_start_xmit)(struct sk_buff *skb, struct net_device *dev);
+ * netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb,
+ *                               struct net_device *dev);
  *     Called when a packet needs to be transmitted.
- *     Must return NETDEV_TX_OK , NETDEV_TX_BUSY, or NETDEV_TX_LOCKED,
+ *     Must return NETDEV_TX_OK , NETDEV_TX_BUSY.
+ *        (can also return NETDEV_TX_LOCKED iff NETIF_F_LLTX)
  *     Required can not be NULL.
  *
  * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb);
@@ -500,7 +635,7 @@ struct netdev_queue {
  *
  * int (*ndo_set_mac_address)(struct net_device *dev, void *addr);
  *     This function  is called when the Media Access Control address
- *     needs to be changed. If not this interface is not defined, the
+ *     needs to be changed. If this interface is not defined, the
  *     mac address can not be changed.
  *
  * int (*ndo_validate_addr)(struct net_device *dev);
@@ -525,7 +660,7 @@ struct netdev_queue {
  *     Callback uses when the transmitter has not made any progress
  *     for dev->watchdog ticks.
  *
- * struct net_device_stats* (*get_stats)(struct net_device *dev);
+ * struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
  *     Called when a user wants to get the network device usage
  *     statistics. If not defined, the counters in dev->stats will
  *     be used.
@@ -545,6 +680,16 @@ struct netdev_queue {
  *     this function is called when a VLAN id is unregistered.
  *
  * void (*ndo_poll_controller)(struct net_device *dev);
+ *
+ *     SR-IOV management functions.
+ * int (*ndo_set_vf_mac)(struct net_device *dev, int vf, u8* mac);
+ * int (*ndo_set_vf_vlan)(struct net_device *dev, int vf, u16 vlan, u8 qos);
+ * int (*ndo_set_vf_tx_rate)(struct net_device *dev, int vf, int rate);
+ * int (*ndo_get_vf_config)(struct net_device *dev,
+ *                         int vf, struct ifla_vf_info *ivf);
+ * int (*ndo_set_vf_port)(struct net_device *dev, int vf,
+ *                       struct nlattr *port[]);
+ * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb);
  */
 #define HAVE_NET_DEVICE_OPS
 struct net_device_ops {
@@ -552,34 +697,25 @@ struct net_device_ops {
        void                    (*ndo_uninit)(struct net_device *dev);
        int                     (*ndo_open)(struct net_device *dev);
        int                     (*ndo_stop)(struct net_device *dev);
-       int                     (*ndo_start_xmit) (struct sk_buff *skb,
+       netdev_tx_t             (*ndo_start_xmit) (struct sk_buff *skb,
                                                   struct net_device *dev);
        u16                     (*ndo_select_queue)(struct net_device *dev,
                                                    struct sk_buff *skb);
-#define HAVE_CHANGE_RX_FLAGS
        void                    (*ndo_change_rx_flags)(struct net_device *dev,
                                                       int flags);
-#define HAVE_SET_RX_MODE
        void                    (*ndo_set_rx_mode)(struct net_device *dev);
-#define HAVE_MULTICAST
        void                    (*ndo_set_multicast_list)(struct net_device *dev);
-#define HAVE_SET_MAC_ADDR
        int                     (*ndo_set_mac_address)(struct net_device *dev,
                                                       void *addr);
-#define HAVE_VALIDATE_ADDR
        int                     (*ndo_validate_addr)(struct net_device *dev);
-#define HAVE_PRIVATE_IOCTL
        int                     (*ndo_do_ioctl)(struct net_device *dev,
                                                struct ifreq *ifr, int cmd);
-#define HAVE_SET_CONFIG
        int                     (*ndo_set_config)(struct net_device *dev,
                                                  struct ifmap *map);
-#define HAVE_CHANGE_MTU
        int                     (*ndo_change_mtu)(struct net_device *dev,
                                                  int new_mtu);
        int                     (*ndo_neigh_setup)(struct net_device *dev,
                                                   struct neigh_parms *);
-#define HAVE_TX_TIMEOUT
        void                    (*ndo_tx_timeout) (struct net_device *dev);
 
        struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
@@ -591,16 +727,36 @@ struct net_device_ops {
        void                    (*ndo_vlan_rx_kill_vid)(struct net_device *dev,
                                                        unsigned short vid);
 #ifdef CONFIG_NET_POLL_CONTROLLER
-#define HAVE_NETDEV_POLL
        void                    (*ndo_poll_controller)(struct net_device *dev);
+       void                    (*ndo_netpoll_cleanup)(struct net_device *dev);
 #endif
+       int                     (*ndo_set_vf_mac)(struct net_device *dev,
+                                                 int queue, u8 *mac);
+       int                     (*ndo_set_vf_vlan)(struct net_device *dev,
+                                                  int queue, u16 vlan, u8 qos);
+       int                     (*ndo_set_vf_tx_rate)(struct net_device *dev,
+                                                     int vf, int rate);
+       int                     (*ndo_get_vf_config)(struct net_device *dev,
+                                                    int vf,
+                                                    struct ifla_vf_info *ivf);
+       int                     (*ndo_set_vf_port)(struct net_device *dev,
+                                                  int vf,
+                                                  struct nlattr *port[]);
+       int                     (*ndo_get_vf_port)(struct net_device *dev,
+                                                  int vf, struct sk_buff *skb);
 #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
+       int                     (*ndo_fcoe_enable)(struct net_device *dev);
+       int                     (*ndo_fcoe_disable)(struct net_device *dev);
        int                     (*ndo_fcoe_ddp_setup)(struct net_device *dev,
                                                      u16 xid,
                                                      struct scatterlist *sgl,
                                                      unsigned int sgc);
        int                     (*ndo_fcoe_ddp_done)(struct net_device *dev,
                                                     u16 xid);
+#define NETDEV_FCOE_WWNN 0
+#define NETDEV_FCOE_WWPN 1
+       int                     (*ndo_fcoe_get_wwn)(struct net_device *dev,
+                                                   u64 *wwn, int type);
 #endif
 };
 
@@ -614,8 +770,7 @@ struct net_device_ops {
  *     moves out.
  */
 
-struct net_device
-{
+struct net_device {
 
        /*
         * This is the first field of the "visible" part of this structure
@@ -623,6 +778,9 @@ struct net_device
         * the interface.
         */
        char                    name[IFNAMSIZ];
+
+       struct pm_qos_request_list *pm_qos_req;
+
        /* device name hash chain */
        struct hlist_node       name_hlist;
        /* snmp alias */
@@ -649,6 +807,7 @@ struct net_device
 
        struct list_head        dev_list;
        struct list_head        napi_list;
+       struct list_head        unreg_list;
 
        /* Net device features */
        unsigned long           features;
@@ -673,6 +832,9 @@ struct net_device
 /* the GSO_MASK reserves bits 16 through 23 */
 #define NETIF_F_FCOE_CRC       (1 << 24) /* FCoE CRC32 */
 #define NETIF_F_SCTP_CSUM      (1 << 25) /* SCTP checksum offload */
+#define NETIF_F_FCOE_MTU       (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/
+#define NETIF_F_NTUPLE         (1 << 27) /* N-tuple filters supported */
+#define NETIF_F_RXHASH         (1 << 28) /* Receive hashing offload */
 
        /* Segmentation offload features */
 #define NETIF_F_GSO_SHIFT      16
@@ -729,7 +891,7 @@ struct net_device
        unsigned char           operstate; /* RFC2863 operstate */
        unsigned char           link_mode; /* mapping policy to operstate */
 
-       unsigned                mtu;    /* interface MTU value          */
+       unsigned int            mtu;    /* interface MTU value          */
        unsigned short          type;   /* interface hardware type      */
        unsigned short          hard_header_len;        /* hardware hdr length  */
 
@@ -750,11 +912,9 @@ struct net_device
        unsigned short          dev_id;         /* for shared network cards */
 
        spinlock_t              addr_list_lock;
-       struct dev_addr_list    *uc_list;       /* Secondary unicast mac addresses */
-       int                     uc_count;       /* Number of installed ucasts   */
+       struct netdev_hw_addr_list      uc;     /* Unicast mac addresses */
+       struct netdev_hw_addr_list      mc;     /* Multicast mac addresses */
        int                     uc_promisc;
-       struct dev_addr_list    *mc_list;       /* Multicast mac addresses      */
-       int                     mc_count;       /* Number of installed mcasts   */
        unsigned int            promiscuity;
        unsigned int            allmulti;
 
@@ -778,11 +938,24 @@ struct net_device
  */
        unsigned long           last_rx;        /* Time of last Rx      */
        /* Interface address info used in eth_type_trans() */
-       unsigned char           dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast
-                                                          because most packets are unicast) */
+       unsigned char           *dev_addr;      /* hw address, (before bcast
+                                                  because most packets are
+                                                  unicast) */
+
+       struct netdev_hw_addr_list      dev_addrs; /* list of device
+                                                     hw addresses */
 
        unsigned char           broadcast[MAX_ADDR_LEN];        /* hw bcast add */
 
+#ifdef CONFIG_RPS
+       struct kset             *queues_kset;
+
+       struct netdev_rx_queue  *_rx;
+
+       /* Number of RX queues allocated at alloc_netdev_mq() time  */
+       unsigned int            num_rx_queues;
+#endif
+
        struct netdev_queue     rx_queue;
 
        struct netdev_queue     *_tx ____cacheline_aligned_in_smp;
@@ -793,12 +966,20 @@ struct net_device
        /* Number of TX queues currently active in device  */
        unsigned int            real_num_tx_queues;
 
+       /* root qdisc from userspace point of view */
+       struct Qdisc            *qdisc;
+
        unsigned long           tx_queue_len;   /* Max frames per queue allowed */
        spinlock_t              tx_global_lock;
 /*
  * One part is mostly used on xmit path (device)
  */
        /* These may be needed for future network-power-down code. */
+
+       /*
+        * trans_start here is expensive for high speed devices on SMP,
+        * please use netdev_queue->trans_start instead.
+        */
        unsigned long           trans_start;    /* Time (in jiffies) of last Tx */
 
        int                     watchdog_timeo; /* used by dev_watchdog() */
@@ -812,7 +993,7 @@ struct net_device
        /* device index hash chain */
        struct hlist_node       index_hlist;
 
-       struct net_device       *link_watch_next;
+       struct list_head        link_watch_list;
 
        /* register/unregister state machine */
        enum { NETREG_UNINITIALIZED=0,
@@ -821,7 +1002,12 @@ struct net_device
               NETREG_UNREGISTERED,     /* completed unregister todo */
               NETREG_RELEASED,         /* called free_netdev */
               NETREG_DUMMY,            /* dummy device for NAPI poll */
-       } reg_state;
+       } reg_state:16;
+
+       enum {
+               RTNL_LINK_INITIALIZED,
+               RTNL_LINK_INITIALIZING,
+       } rtnl_link_state:16;
 
        /* Called from unregister, can be used to call free_netdev */
        void (*destructor)(struct net_device *dev);
@@ -834,6 +1020,8 @@ struct net_device
        /* Network namespace this network device is inside */
        struct net              *nd_net;
 #endif
+       /* to assign a syslog chanel according device ownership */
+       struct syslog_ns        *syslog_ns;
 
        /* mid-layer private */
        void                    *ml_priv;
@@ -847,8 +1035,8 @@ struct net_device
 
        /* class/net/name entry */
        struct device           dev;
-       /* space for optional statistics and wireless sysfs groups */
-       struct attribute_group  *sysfs_groups[3];
+       /* space for optional device, statistics, and wireless sysfs groups */
+       const struct attribute_group *sysfs_groups[4];
 
        /* rtnetlink link ops */
        const struct rtnl_link_ops *rtnl_link_ops;
@@ -862,56 +1050,19 @@ struct net_device
 
 #ifdef CONFIG_DCB
        /* Data Center Bridging netlink ops */
-       struct dcbnl_rtnl_ops *dcbnl_ops;
+       const struct dcbnl_rtnl_ops *dcbnl_ops;
 #endif
 
 #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
        /* max exchange id for FCoE LRO by ddp */
        unsigned int            fcoe_ddp_xid;
 #endif
-
-#ifdef CONFIG_COMPAT_NET_DEV_OPS
-       struct {
-               int                     (*init)(struct net_device *dev);
-               void                    (*uninit)(struct net_device *dev);
-               int                     (*open)(struct net_device *dev);
-               int                     (*stop)(struct net_device *dev);
-               int                     (*hard_start_xmit) (struct sk_buff *skb,
-                                                           struct net_device *dev);
-               u16                     (*select_queue)(struct net_device *dev,
-                                                       struct sk_buff *skb);
-               void                    (*change_rx_flags)(struct net_device *dev,
-                                                          int flags);
-               void                    (*set_rx_mode)(struct net_device *dev);
-               void                    (*set_multicast_list)(struct net_device *dev);
-               int                     (*set_mac_address)(struct net_device *dev,
-                                                          void *addr);
-               int                     (*validate_addr)(struct net_device *dev);
-               int                     (*do_ioctl)(struct net_device *dev,
-                                                   struct ifreq *ifr, int cmd);
-               int                     (*set_config)(struct net_device *dev,
-                                                     struct ifmap *map);
-               int                     (*change_mtu)(struct net_device *dev, int new_mtu);
-               int                     (*neigh_setup)(struct net_device *dev,
-                                                      struct neigh_parms *);
-               void                    (*tx_timeout) (struct net_device *dev);
-               struct net_device_stats* (*get_stats)(struct net_device *dev);
-               void                    (*vlan_rx_register)(struct net_device *dev,
-                                                           struct vlan_group *grp);
-               void                    (*vlan_rx_add_vid)(struct net_device *dev,
-                                                          unsigned short vid);
-               void                    (*vlan_rx_kill_vid)(struct net_device *dev,
-                                                           unsigned short vid);
-#ifdef CONFIG_NET_POLL_CONTROLLER
-               void                    (*poll_controller)(struct net_device *dev);
-#endif
-       };
-#endif
+       /* n-tuple filter list attached to this device */
+       struct ethtool_rx_ntuple_list ethtool_ntuple_list;
 };
 #define to_net_dev(d) container_of(d, struct net_device, dev)
 
 #define        NETDEV_ALIGN            32
-#define        NETDEV_ALIGN_CONST      (NETDEV_ALIGN - 1)
 
 static inline
 struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev,
@@ -964,6 +1115,15 @@ static inline bool netdev_uses_dsa_tags(struct net_device *dev)
        return 0;
 }
 
+#ifndef CONFIG_NET_NS
+static inline void skb_set_dev(struct sk_buff *skb, struct net_device *dev)
+{
+       skb->dev = dev;
+}
+#else /* CONFIG_NET_NS */
+void skb_set_dev(struct sk_buff *skb, struct net_device *dev);
+#endif
+
 static inline bool netdev_uses_trailer_tags(struct net_device *dev)
 {
 #ifdef CONFIG_NET_DSA_TAG_TRAILER
@@ -982,9 +1142,7 @@ static inline bool netdev_uses_trailer_tags(struct net_device *dev)
  */
 static inline void *netdev_priv(const struct net_device *dev)
 {
-       return (char *)dev + ((sizeof(struct net_device)
-                              + NETDEV_ALIGN_CONST)
-                             & ~NETDEV_ALIGN_CONST);
+       return (char *)dev + ALIGN(sizeof(struct net_device), NETDEV_ALIGN);
 }
 
 /* Set the sysfs physical device reference for the network logical device
@@ -992,6 +1150,12 @@ static inline void *netdev_priv(const struct net_device *dev)
  */
 #define SET_NETDEV_DEV(net, pdev)      ((net)->dev.parent = (pdev))
 
+/* Set the sysfs device type for the network logical device to allow
+ * fin grained indentification of different network device types. For
+ * example Ethernet, Wirelss LAN, Bluetooth, WiMAX etc.
+ */
+#define SET_NETDEV_DEVTYPE(net, devtype)       ((net)->dev.type = (devtype))
+
 /**
  *     netif_napi_add - initialize a napi context
  *     @dev:  network device
@@ -1014,6 +1178,12 @@ void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
 void netif_napi_del(struct napi_struct *napi);
 
 struct napi_gro_cb {
+       /* Virtual address of skb_shinfo(skb)->frags[0].page + offset. */
+       void *frag0;
+
+       /* Length of frag0. */
+       unsigned int frag0_len;
+
        /* This indicates where we are processing relative to skb->data. */
        int data_offset;
 
@@ -1057,10 +1227,16 @@ extern rwlock_t                         dev_base_lock;          /* Device list lock */
 
 #define for_each_netdev(net, d)                \
                list_for_each_entry(d, &(net)->dev_base_head, dev_list)
+#define for_each_netdev_reverse(net, d)        \
+               list_for_each_entry_reverse(d, &(net)->dev_base_head, dev_list)
+#define for_each_netdev_rcu(net, d)            \
+               list_for_each_entry_rcu(d, &(net)->dev_base_head, dev_list)
 #define for_each_netdev_safe(net, d, n)        \
                list_for_each_entry_safe(d, n, &(net)->dev_base_head, dev_list)
 #define for_each_netdev_continue(net, d)               \
                list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list)
+#define for_each_netdev_continue_rcu(net, d)           \
+       list_for_each_entry_continue_rcu(d, &(net)->dev_base_head, dev_list)
 #define net_device_entry(lh)   list_entry(lh, struct net_device, dev_list)
 
 static inline struct net_device *next_net_device(struct net_device *dev)
@@ -1073,6 +1249,16 @@ static inline struct net_device *next_net_device(struct net_device *dev)
        return lh == &net->dev_base_head ? NULL : net_device_entry(lh);
 }
 
+static inline struct net_device *next_net_device_rcu(struct net_device *dev)
+{
+       struct list_head *lh;
+       struct net *net;
+
+       net = dev_net(dev);
+       lh = rcu_dereference(dev->dev_list.next);
+       return lh == &net->dev_base_head ? NULL : net_device_entry(lh);
+}
+
 static inline struct net_device *first_net_device(struct net *net)
 {
        return list_empty(&net->dev_base_head) ? NULL :
@@ -1091,6 +1277,7 @@ extern void               __dev_remove_pack(struct packet_type *pt);
 extern struct net_device       *dev_get_by_flags(struct net *net, unsigned short flags,
                                                  unsigned short mask);
 extern struct net_device       *dev_get_by_name(struct net *net, const char *name);
+extern struct net_device       *dev_get_by_name_rcu(struct net *net, const char *name);
 extern struct net_device       *__dev_get_by_name(struct net *net, const char *name);
 extern int             dev_alloc_name(struct net_device *dev, const char *name);
 extern int             dev_open(struct net_device *dev);
@@ -1098,7 +1285,14 @@ extern int               dev_close(struct net_device *dev);
 extern void            dev_disable_lro(struct net_device *dev);
 extern int             dev_queue_xmit(struct sk_buff *skb);
 extern int             register_netdevice(struct net_device *dev);
-extern void            unregister_netdevice(struct net_device *dev);
+extern void            unregister_netdevice_queue(struct net_device *dev,
+                                                  struct list_head *head);
+extern void            unregister_netdevice_many(struct list_head *head);
+static inline void unregister_netdevice(struct net_device *dev)
+{
+       unregister_netdevice_queue(dev, NULL);
+}
+
 extern void            free_netdev(struct net_device *dev);
 extern void            synchronize_net(void);
 extern int             register_netdevice_notifier(struct notifier_block *nb);
@@ -1109,13 +1303,14 @@ extern void             netdev_resync_ops(struct net_device *dev);
 extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
 extern struct net_device       *dev_get_by_index(struct net *net, int ifindex);
 extern struct net_device       *__dev_get_by_index(struct net *net, int ifindex);
+extern struct net_device       *dev_get_by_index_rcu(struct net *net, int ifindex);
 extern int             dev_restart(struct net_device *dev);
 #ifdef CONFIG_NETPOLL_TRAP
 extern int             netpoll_trap(void);
 #endif
-extern void          *skb_gro_header(struct sk_buff *skb, unsigned int hlen);
 extern int            skb_gro_receive(struct sk_buff **head,
                                       struct sk_buff *skb);
+extern void           skb_gro_reset_offset(struct sk_buff *skb);
 
 static inline unsigned int skb_gro_offset(const struct sk_buff *skb)
 {
@@ -1132,23 +1327,34 @@ static inline void skb_gro_pull(struct sk_buff *skb, unsigned int len)
        NAPI_GRO_CB(skb)->data_offset += len;
 }
 
-static inline void skb_gro_reset_offset(struct sk_buff *skb)
+static inline void *skb_gro_header_fast(struct sk_buff *skb,
+                                       unsigned int offset)
+{
+       return NAPI_GRO_CB(skb)->frag0 + offset;
+}
+
+static inline int skb_gro_header_hard(struct sk_buff *skb, unsigned int hlen)
 {
-       NAPI_GRO_CB(skb)->data_offset = 0;
+       return NAPI_GRO_CB(skb)->frag0_len < hlen;
+}
+
+static inline void *skb_gro_header_slow(struct sk_buff *skb, unsigned int hlen,
+                                       unsigned int offset)
+{
+       NAPI_GRO_CB(skb)->frag0 = NULL;
+       NAPI_GRO_CB(skb)->frag0_len = 0;
+       return pskb_may_pull(skb, hlen) ? skb->data + offset : NULL;
 }
 
 static inline void *skb_gro_mac_header(struct sk_buff *skb)
 {
-       return skb_headlen(skb) ? skb_mac_header(skb) :
-              page_address(skb_shinfo(skb)->frags[0].page) +
-              skb_shinfo(skb)->frags[0].page_offset;
+       return NAPI_GRO_CB(skb)->frag0 ?: skb_mac_header(skb);
 }
 
 static inline void *skb_gro_network_header(struct sk_buff *skb)
 {
-       return skb_headlen(skb) ? skb_network_header(skb) :
-              page_address(skb_shinfo(skb)->frags[0].page) +
-              skb_shinfo(skb)->frags[0].page_offset + skb_network_offset(skb);
+       return (NAPI_GRO_CB(skb)->frag0 ?: skb->data) +
+              skb_network_offset(skb);
 }
 
 static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
@@ -1180,20 +1386,52 @@ static inline int unregister_gifconf(unsigned int family)
 }
 
 /*
- * Incoming packets are placed on per-cpu queues so that
- * no locking is needed.
+ * Incoming packets are placed on per-cpu queues
  */
-struct softnet_data
-{
+struct softnet_data {
        struct Qdisc            *output_queue;
-       struct sk_buff_head     input_pkt_queue;
+       struct Qdisc            **output_queue_tailp;
        struct list_head        poll_list;
        struct sk_buff          *completion_queue;
-
+       struct sk_buff_head     process_queue;
+
+       /* stats */
+       unsigned int            processed;
+       unsigned int            time_squeeze;
+       unsigned int            cpu_collision;
+       unsigned int            received_rps;
+
+#ifdef CONFIG_RPS
+       struct softnet_data     *rps_ipi_list;
+
+       /* Elements below can be accessed between CPUs for RPS */
+       struct call_single_data csd ____cacheline_aligned_in_smp;
+       struct softnet_data     *rps_ipi_next;
+       unsigned int            cpu;
+       unsigned int            input_queue_head;
+       unsigned int            input_queue_tail;
+#endif
+       unsigned                dropped;
+       struct sk_buff_head     input_pkt_queue;
        struct napi_struct      backlog;
 };
 
-DECLARE_PER_CPU(struct softnet_data,softnet_data);
+static inline void input_queue_head_incr(struct softnet_data *sd)
+{
+#ifdef CONFIG_RPS
+       sd->input_queue_head++;
+#endif
+}
+
+static inline void input_queue_tail_incr_save(struct softnet_data *sd,
+                                             unsigned int *qtail)
+{
+#ifdef CONFIG_RPS
+       *qtail = ++sd->input_queue_tail;
+#endif
+}
+
+DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data);
 
 #define HAVE_NETIF_QUEUE
 
@@ -1243,7 +1481,7 @@ static inline void netif_tx_wake_queue(struct netdev_queue *dev_queue)
 {
 #ifdef CONFIG_NETPOLL_TRAP
        if (netpoll_trap()) {
-               clear_bit(__QUEUE_STATE_XOFF, &dev_queue->state);
+               netif_tx_start_queue(dev_queue);
                return;
        }
 #endif
@@ -1349,7 +1587,8 @@ static inline int netif_running(const struct net_device *dev)
 static inline void netif_start_subqueue(struct net_device *dev, u16 queue_index)
 {
        struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
-       clear_bit(__QUEUE_STATE_XOFF, &txq->state);
+
+       netif_tx_start_queue(txq);
 }
 
 /**
@@ -1366,7 +1605,7 @@ static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index)
        if (netpoll_trap())
                return;
 #endif
-       set_bit(__QUEUE_STATE_XOFF, &txq->state);
+       netif_tx_stop_queue(txq);
 }
 
 /**
@@ -1380,7 +1619,8 @@ static inline int __netif_subqueue_stopped(const struct net_device *dev,
                                         u16 queue_index)
 {
        struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
-       return test_bit(__QUEUE_STATE_XOFF, &txq->state);
+
+       return netif_tx_queue_stopped(txq);
 }
 
 static inline int netif_subqueue_stopped(const struct net_device *dev,
@@ -1435,19 +1675,19 @@ extern int              netif_rx(struct sk_buff *skb);
 extern int             netif_rx_ni(struct sk_buff *skb);
 #define HAVE_NETIF_RECEIVE_SKB 1
 extern int             netif_receive_skb(struct sk_buff *skb);
-extern void            napi_gro_flush(struct napi_struct *napi);
-extern int             dev_gro_receive(struct napi_struct *napi,
+extern gro_result_t    dev_gro_receive(struct napi_struct *napi,
                                        struct sk_buff *skb);
-extern int             napi_skb_finish(int ret, struct sk_buff *skb);
-extern int             napi_gro_receive(struct napi_struct *napi,
+extern gro_result_t    napi_skb_finish(gro_result_t ret, struct sk_buff *skb);
+extern gro_result_t    napi_gro_receive(struct napi_struct *napi,
                                         struct sk_buff *skb);
 extern void            napi_reuse_skb(struct napi_struct *napi,
                                       struct sk_buff *skb);
 extern struct sk_buff *        napi_get_frags(struct napi_struct *napi);
-extern int             napi_frags_finish(struct napi_struct *napi,
-                                         struct sk_buff *skb, int ret);
+extern gro_result_t    napi_frags_finish(struct napi_struct *napi,
+                                         struct sk_buff *skb,
+                                         gro_result_t ret);
 extern struct sk_buff *        napi_frags_skb(struct napi_struct *napi);
-extern int             napi_gro_frags(struct napi_struct *napi);
+extern gro_result_t    napi_gro_frags(struct napi_struct *napi);
 
 static inline void napi_free_frags(struct napi_struct *napi)
 {
@@ -1460,7 +1700,9 @@ extern int                dev_valid_name(const char *name);
 extern int             dev_ioctl(struct net *net, unsigned int cmd, void __user *);
 extern int             dev_ethtool(struct net *net, struct ifreq *);
 extern unsigned                dev_get_flags(const struct net_device *);
+extern int             __dev_change_flags(struct net_device *, unsigned int flags);
 extern int             dev_change_flags(struct net_device *, unsigned);
+extern void            __dev_notify_flags(struct net_device *, unsigned int old_flags);
 extern int             dev_change_name(struct net_device *, const char *);
 extern int             dev_set_alias(struct net_device *, const char *, size_t);
 extern int             dev_change_net_namespace(struct net_device *,
@@ -1471,6 +1713,8 @@ extern int                dev_set_mac_address(struct net_device *,
 extern int             dev_hard_start_xmit(struct sk_buff *skb,
                                            struct net_device *dev,
                                            struct netdev_queue *txq);
+extern int             dev_forward_skb(struct net_device *dev,
+                                       struct sk_buff *skb);
 
 extern int             netdev_budget;
 
@@ -1509,6 +1753,7 @@ static inline void dev_hold(struct net_device *dev)
  */
 
 extern void linkwatch_fire_event(struct net_device *dev);
+extern void linkwatch_forget_dev(struct net_device *dev);
 
 /**
  *     netif_carrier_ok - test if carrier present
@@ -1521,6 +1766,8 @@ static inline int netif_carrier_ok(const struct net_device *dev)
        return !test_bit(__LINK_STATE_NOCARRIER, &dev->state);
 }
 
+extern unsigned long dev_trans_start(struct net_device *dev);
+
 extern void __netdev_watchdog_up(struct net_device *dev);
 
 extern void netif_carrier_on(struct net_device *dev);
@@ -1576,7 +1823,8 @@ static inline int netif_dormant(const struct net_device *dev)
  *
  * Check if carrier is operational
  */
-static inline int netif_oper_up(const struct net_device *dev) {
+static inline int netif_oper_up(const struct net_device *dev)
+{
        return (dev->operstate == IF_OPER_UP ||
                dev->operstate == IF_OPER_UNKNOWN /* backward compat */);
 }
@@ -1678,6 +1926,12 @@ static inline void __netif_tx_unlock_bh(struct netdev_queue *txq)
        spin_unlock_bh(&txq->_xmit_lock);
 }
 
+static inline void txq_trans_update(struct netdev_queue *txq)
+{
+       if (txq->xmit_lock_owner != -1)
+               txq->trans_start = jiffies;
+}
+
 /**
  *     netif_tx_lock - grab network device transmit lock
  *     @dev: network device
@@ -1724,8 +1978,7 @@ static inline void netif_tx_unlock(struct net_device *dev)
                 * force a schedule.
                 */
                clear_bit(__QUEUE_STATE_FROZEN, &txq->state);
-               if (!test_bit(__QUEUE_STATE_XOFF, &txq->state))
-                       __netif_schedule(txq->qdisc);
+               netif_schedule_queue(txq);
        }
        spin_unlock(&dev->tx_global_lock);
 }
@@ -1785,6 +2038,13 @@ static inline void netif_addr_unlock_bh(struct net_device *dev)
        spin_unlock_bh(&dev->addr_list_lock);
 }
 
+/*
+ * dev_addrs walker. Should be used only for read access. Call with
+ * rcu_read_lock held.
+ */
+#define for_each_dev_addr(dev, ha) \
+               list_for_each_entry_rcu(ha, &dev->dev_addrs.list, list)
+
 /* These functions live elsewhere (drivers/net/net_init.c, but related) */
 
 extern void            ether_setup(struct net_device *dev);
@@ -1797,32 +2057,72 @@ extern struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
        alloc_netdev_mq(sizeof_priv, name, setup, 1)
 extern int             register_netdev(struct net_device *dev);
 extern void            unregister_netdev(struct net_device *dev);
+
+/* General hardware address lists handling functions */
+extern int __hw_addr_add_multiple(struct netdev_hw_addr_list *to_list,
+                                 struct netdev_hw_addr_list *from_list,
+                                 int addr_len, unsigned char addr_type);
+extern void __hw_addr_del_multiple(struct netdev_hw_addr_list *to_list,
+                                  struct netdev_hw_addr_list *from_list,
+                                  int addr_len, unsigned char addr_type);
+extern int __hw_addr_sync(struct netdev_hw_addr_list *to_list,
+                         struct netdev_hw_addr_list *from_list,
+                         int addr_len);
+extern void __hw_addr_unsync(struct netdev_hw_addr_list *to_list,
+                            struct netdev_hw_addr_list *from_list,
+                            int addr_len);
+extern void __hw_addr_flush(struct netdev_hw_addr_list *list);
+extern void __hw_addr_init(struct netdev_hw_addr_list *list);
+
+/* Functions used for device addresses handling */
+extern int dev_addr_add(struct net_device *dev, unsigned char *addr,
+                       unsigned char addr_type);
+extern int dev_addr_del(struct net_device *dev, unsigned char *addr,
+                       unsigned char addr_type);
+extern int dev_addr_add_multiple(struct net_device *to_dev,
+                                struct net_device *from_dev,
+                                unsigned char addr_type);
+extern int dev_addr_del_multiple(struct net_device *to_dev,
+                                struct net_device *from_dev,
+                                unsigned char addr_type);
+extern void dev_addr_flush(struct net_device *dev);
+extern int dev_addr_init(struct net_device *dev);
+
+/* Functions used for unicast addresses handling */
+extern int dev_uc_add(struct net_device *dev, unsigned char *addr);
+extern int dev_uc_del(struct net_device *dev, unsigned char *addr);
+extern int dev_uc_sync(struct net_device *to, struct net_device *from);
+extern void dev_uc_unsync(struct net_device *to, struct net_device *from);
+extern void dev_uc_flush(struct net_device *dev);
+extern void dev_uc_init(struct net_device *dev);
+
+/* Functions used for multicast addresses handling */
+extern int dev_mc_add(struct net_device *dev, unsigned char *addr);
+extern int dev_mc_add_global(struct net_device *dev, unsigned char *addr);
+extern int dev_mc_del(struct net_device *dev, unsigned char *addr);
+extern int dev_mc_del_global(struct net_device *dev, unsigned char *addr);
+extern int dev_mc_sync(struct net_device *to, struct net_device *from);
+extern void dev_mc_unsync(struct net_device *to, struct net_device *from);
+extern void dev_mc_flush(struct net_device *dev);
+extern void dev_mc_init(struct net_device *dev);
+
 /* Functions used for secondary unicast and multicast support */
 extern void            dev_set_rx_mode(struct net_device *dev);
 extern void            __dev_set_rx_mode(struct net_device *dev);
-extern int             dev_unicast_delete(struct net_device *dev, void *addr, int alen);
-extern int             dev_unicast_add(struct net_device *dev, void *addr, int alen);
-extern int             dev_unicast_sync(struct net_device *to, struct net_device *from);
-extern void            dev_unicast_unsync(struct net_device *to, struct net_device *from);
-extern int             dev_mc_delete(struct net_device *dev, void *addr, int alen, int all);
-extern int             dev_mc_add(struct net_device *dev, void *addr, int alen, int newonly);
-extern int             dev_mc_sync(struct net_device *to, struct net_device *from);
-extern void            dev_mc_unsync(struct net_device *to, struct net_device *from);
-extern int             __dev_addr_delete(struct dev_addr_list **list, int *count, void *addr, int alen, int all);
-extern int             __dev_addr_add(struct dev_addr_list **list, int *count, void *addr, int alen, int newonly);
-extern int             __dev_addr_sync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);
-extern void            __dev_addr_unsync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);
 extern int             dev_set_promiscuity(struct net_device *dev, int inc);
 extern int             dev_set_allmulti(struct net_device *dev, int inc);
 extern void            netdev_state_change(struct net_device *dev);
-extern void            netdev_bonding_change(struct net_device *dev);
+extern int             netdev_bonding_change(struct net_device *dev,
+                                             unsigned long event);
 extern void            netdev_features_change(struct net_device *dev);
 /* Load a device via the kmod */
 extern void            dev_load(struct net *net, const char *name);
 extern void            dev_mcast_init(void);
 extern const struct net_device_stats *dev_get_stats(struct net_device *dev);
+extern void            dev_txq_stats_fold(const struct net_device *dev, struct net_device_stats *stats);
 
 extern int             netdev_max_backlog;
+extern int             netdev_tstamp_prequeue;
 extern int             weight_p;
 extern int             netdev_set_master(struct net_device *dev, struct net_device *master);
 extern int skb_checksum_help(struct sk_buff *skb);
@@ -1855,6 +2155,9 @@ unsigned long netdev_increment_features(unsigned long all, unsigned long one,
                                        unsigned long mask);
 unsigned long netdev_fix_features(unsigned long features, const char *name);
 
+void netif_stacked_transfer_operstate(const struct net_device *rootdev,
+                                       struct net_device *dev);
+
 static inline int net_gso_ok(int features, int gso_type)
 {
        int feature = gso_type << NETIF_F_GSO_SHIFT;
@@ -1863,15 +2166,14 @@ static inline int net_gso_ok(int features, int gso_type)
 
 static inline int skb_gso_ok(struct sk_buff *skb, int features)
 {
-       return net_gso_ok(features, skb_shinfo(skb)->gso_type);
+       return net_gso_ok(features, skb_shinfo(skb)->gso_type) &&
+              (!skb_has_frags(skb) || (features & NETIF_F_FRAGLIST));
 }
 
 static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
 {
        return skb_is_gso(skb) &&
               (!skb_gso_ok(skb, dev->features) ||
-               (skb_shinfo(skb)->frag_list &&
-                !(dev->features & NETIF_F_FRAGLIST)) ||
                unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
 }
 
@@ -1881,36 +2183,14 @@ static inline void netif_set_gso_max_size(struct net_device *dev,
        dev->gso_max_size = size;
 }
 
-/* On bonding slaves other than the currently active slave, suppress
- * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and
- * ARP on active-backup slaves with arp_validate enabled.
- */
-static inline int skb_bond_should_drop(struct sk_buff *skb)
-{
-       struct net_device *dev = skb->dev;
-       struct net_device *master = dev->master;
-
-       if (master) {
-               if (master->priv_flags & IFF_MASTER_ARPMON)
-                       dev->last_rx = jiffies;
-
-               if (dev->priv_flags & IFF_SLAVE_INACTIVE) {
-                       if ((dev->priv_flags & IFF_SLAVE_NEEDARP) &&
-                           skb->protocol == __cpu_to_be16(ETH_P_ARP))
-                               return 0;
-
-                       if (master->priv_flags & IFF_MASTER_ALB) {
-                               if (skb->pkt_type != PACKET_BROADCAST &&
-                                   skb->pkt_type != PACKET_MULTICAST)
-                                       return 0;
-                       }
-                       if (master->priv_flags & IFF_MASTER_8023AD &&
-                           skb->protocol == __cpu_to_be16(ETH_P_SLOW))
-                               return 0;
-
-                       return 1;
-               }
-       }
+extern int __skb_bond_should_drop(struct sk_buff *skb,
+                                 struct net_device *master);
+
+static inline int skb_bond_should_drop(struct sk_buff *skb,
+                                      struct net_device *master)
+{
+       if (master)
+               return __skb_bond_should_drop(skb, master);
        return 0;
 }
 
@@ -1937,6 +2217,130 @@ static inline u32 dev_ethtool_get_flags(struct net_device *dev)
                return 0;
        return dev->ethtool_ops->get_flags(dev);
 }
+
+/* Logging, debugging and troubleshooting/diagnostic helpers. */
+
+/* netdev_printk helpers, similar to dev_printk */
+
+static inline const char *netdev_name(const struct net_device *dev)
+{
+       if (dev->reg_state != NETREG_REGISTERED)
+               return "(unregistered net_device)";
+       return dev->name;
+}
+
+#define netdev_printk(level, netdev, format, args...)          \
+       dev_printk(level, (netdev)->dev.parent,                 \
+                  "%s: " format,                               \
+                  netdev_name(netdev), ##args)
+
+#define netdev_emerg(dev, format, args...)                     \
+       netdev_printk(KERN_EMERG, dev, format, ##args)
+#define netdev_alert(dev, format, args...)                     \
+       netdev_printk(KERN_ALERT, dev, format, ##args)
+#define netdev_crit(dev, format, args...)                      \
+       netdev_printk(KERN_CRIT, dev, format, ##args)
+#define netdev_err(dev, format, args...)                       \
+       netdev_printk(KERN_ERR, dev, format, ##args)
+#define netdev_warn(dev, format, args...)                      \
+       netdev_printk(KERN_WARNING, dev, format, ##args)
+#define netdev_notice(dev, format, args...)                    \
+       netdev_printk(KERN_NOTICE, dev, format, ##args)
+#define netdev_info(dev, format, args...)                      \
+       netdev_printk(KERN_INFO, dev, format, ##args)
+
+#if defined(DEBUG)
+#define netdev_dbg(__dev, format, args...)                     \
+       netdev_printk(KERN_DEBUG, __dev, format, ##args)
+#elif defined(CONFIG_DYNAMIC_DEBUG)
+#define netdev_dbg(__dev, format, args...)                     \
+do {                                                           \
+       dynamic_dev_dbg((__dev)->dev.parent, "%s: " format,     \
+                       netdev_name(__dev), ##args);            \
+} while (0)
+#else
+#define netdev_dbg(__dev, format, args...)                     \
+({                                                             \
+       if (0)                                                  \
+               netdev_printk(KERN_DEBUG, __dev, format, ##args); \
+       0;                                                      \
+})
+#endif
+
+#if defined(VERBOSE_DEBUG)
+#define netdev_vdbg    netdev_dbg
+#else
+
+#define netdev_vdbg(dev, format, args...)                      \
+({                                                             \
+       if (0)                                                  \
+               netdev_printk(KERN_DEBUG, dev, format, ##args); \
+       0;                                                      \
+})
+#endif
+
+/*
+ * netdev_WARN() acts like dev_printk(), but with the key difference
+ * of using a WARN/WARN_ON to get the message out, including the
+ * file/line information and a backtrace.
+ */
+#define netdev_WARN(dev, format, args...)                      \
+       WARN(1, "netdevice: %s\n" format, netdev_name(dev), ##args);
+
+/* netif printk helpers, similar to netdev_printk */
+
+#define netif_printk(priv, type, level, dev, fmt, args...)     \
+do {                                                           \
+       if (netif_msg_##type(priv))                             \
+               netdev_printk(level, (dev), fmt, ##args);       \
+} while (0)
+
+#define netif_emerg(priv, type, dev, fmt, args...)             \
+       netif_printk(priv, type, KERN_EMERG, dev, fmt, ##args)
+#define netif_alert(priv, type, dev, fmt, args...)             \
+       netif_printk(priv, type, KERN_ALERT, dev, fmt, ##args)
+#define netif_crit(priv, type, dev, fmt, args...)              \
+       netif_printk(priv, type, KERN_CRIT, dev, fmt, ##args)
+#define netif_err(priv, type, dev, fmt, args...)               \
+       netif_printk(priv, type, KERN_ERR, dev, fmt, ##args)
+#define netif_warn(priv, type, dev, fmt, args...)              \
+       netif_printk(priv, type, KERN_WARNING, dev, fmt, ##args)
+#define netif_notice(priv, type, dev, fmt, args...)            \
+       netif_printk(priv, type, KERN_NOTICE, dev, fmt, ##args)
+#define netif_info(priv, type, dev, fmt, args...)              \
+       netif_printk(priv, type, KERN_INFO, (dev), fmt, ##args)
+
+#if defined(DEBUG)
+#define netif_dbg(priv, type, dev, format, args...)            \
+       netif_printk(priv, type, KERN_DEBUG, dev, format, ##args)
+#elif defined(CONFIG_DYNAMIC_DEBUG)
+#define netif_dbg(priv, type, netdev, format, args...)         \
+do {                                                           \
+       if (netif_msg_##type(priv))                             \
+               dynamic_dev_dbg((netdev)->dev.parent,           \
+                               "%s: " format,                  \
+                               netdev_name(netdev), ##args);   \
+} while (0)
+#else
+#define netif_dbg(priv, type, dev, format, args...)                    \
+({                                                                     \
+       if (0)                                                          \
+               netif_printk(priv, type, KERN_DEBUG, dev, format, ##args); \
+       0;                                                              \
+})
+#endif
+
+#if defined(VERBOSE_DEBUG)
+#define netif_vdbg     netdev_dbg
+#else
+#define netif_vdbg(priv, type, dev, format, args...)           \
+({                                                             \
+       if (0)                                                  \
+               netif_printk(priv, type, KERN_DEBUG, dev, format, ##args); \
+       0;                                                      \
+})
+#endif
+
 #endif /* __KERNEL__ */
 
-#endif /* _LINUX_DEV_H */
+#endif /* _LINUX_NETDEVICE_H */