headers_check fix: linux/synclink.h
[safe/jmp/linux-2.6] / include / linux / netdevice.h
index 0df0db0..ec54785 100644 (file)
@@ -313,15 +313,18 @@ struct napi_struct {
 #ifdef CONFIG_NETPOLL
        spinlock_t              poll_lock;
        int                     poll_owner;
+#endif
        struct net_device       *dev;
        struct list_head        dev_list;
-#endif
+       struct sk_buff          *gro_list;
+       struct sk_buff          *skb;
 };
 
 enum
 {
        NAPI_STATE_SCHED,       /* Poll is scheduled */
        NAPI_STATE_DISABLE,     /* Disable pending */
+       NAPI_STATE_NPSVC,       /* Netpoll - don't dequeue from poll_list */
 };
 
 extern void __napi_schedule(struct napi_struct *n);
@@ -375,22 +378,8 @@ static inline int napi_reschedule(struct napi_struct *napi)
  *
  * Mark NAPI processing as complete.
  */
-static inline void __napi_complete(struct napi_struct *n)
-{
-       BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state));
-       list_del(&n->poll_list);
-       smp_mb__before_clear_bit();
-       clear_bit(NAPI_STATE_SCHED, &n->state);
-}
-
-static inline void napi_complete(struct napi_struct *n)
-{
-       unsigned long flags;
-
-       local_irq_save(flags);
-       __napi_complete(n);
-       local_irq_restore(flags);
-}
+extern void __napi_complete(struct napi_struct *n);
+extern void napi_complete(struct napi_struct *n);
 
 /**
  *     napi_disable - prevent NAPI from scheduling
@@ -478,7 +467,7 @@ struct netdev_queue {
  *     This function is called when network device transistions to the down
  *     state.
  *
- * int (*ndo_hard_start_xmit)(struct sk_buff *skb, struct net_device *dev);
+ * int (*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,
  *     Required can not be NULL.
@@ -639,9 +628,7 @@ struct net_device
        unsigned long           state;
 
        struct list_head        dev_list;
-#ifdef CONFIG_NETPOLL
        struct list_head        napi_list;
-#endif
 
        /* Net device features */
        unsigned long           features;
@@ -660,6 +647,7 @@ struct net_device
 #define NETIF_F_LLTX           4096    /* LockLess TX - deprecated. Please */
                                        /* do not use LLTX in new drivers */
 #define NETIF_F_NETNS_LOCAL    8192    /* Does not change network namespaces */
+#define NETIF_F_GRO            16384   /* Generic receive offload */
 #define NETIF_F_LRO            32768   /* large receive offload */
 
        /* Segmentation offload features */
@@ -785,7 +773,6 @@ struct net_device
 /*
  * One part is mostly used on xmit path (device)
  */
-       void                    *priv;  /* pointer to private data      */
        /* These may be needed for future network-power-down code. */
        unsigned long           trans_start;    /* Time (in jiffies) of last Tx */
 
@@ -808,6 +795,7 @@ struct net_device
               NETREG_UNREGISTERING,    /* called unregister_netdevice */
               NETREG_UNREGISTERED,     /* completed unregister todo */
               NETREG_RELEASED,         /* called free_netdev */
+              NETREG_DUMMY,            /* dummy device for NAPI poll */
        } reg_state;
 
        /* Called from unregister, can be used to call free_netdev */
@@ -984,22 +972,8 @@ static inline void *netdev_priv(const struct net_device *dev)
  * netif_napi_add() must be used to initialize a napi context prior to calling
  * *any* of the other napi related functions.
  */
-static inline void netif_napi_add(struct net_device *dev,
-                                 struct napi_struct *napi,
-                                 int (*poll)(struct napi_struct *, int),
-                                 int weight)
-{
-       INIT_LIST_HEAD(&napi->poll_list);
-       napi->poll = poll;
-       napi->weight = weight;
-#ifdef CONFIG_NETPOLL
-       napi->dev = dev;
-       list_add(&napi->dev_list, &dev->napi_list);
-       spin_lock_init(&napi->poll_lock);
-       napi->poll_owner = -1;
-#endif
-       set_bit(NAPI_STATE_SCHED, &napi->state);
-}
+void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
+                   int (*poll)(struct napi_struct *, int), int weight);
 
 /**
  *  netif_napi_del - remove a napi context
@@ -1007,12 +981,23 @@ static inline void netif_napi_add(struct net_device *dev,
  *
  *  netif_napi_del() removes a napi context from the network device napi list
  */
-static inline void netif_napi_del(struct napi_struct *napi)
-{
-#ifdef CONFIG_NETPOLL
-       list_del(&napi->dev_list);
-#endif
-}
+void netif_napi_del(struct napi_struct *napi);
+
+struct napi_gro_cb {
+       /* This is non-zero if the packet may be of the same flow. */
+       int same_flow;
+
+       /* This is non-zero if the packet cannot be merged with the new skb. */
+       int flush;
+
+       /* Number of segments aggregated. */
+       int count;
+
+       /* Free the skb? */
+       int free;
+};
+
+#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb)
 
 struct packet_type {
        __be16                  type;   /* This is really htons(ether_type). */
@@ -1024,10 +1009,21 @@ struct packet_type {
        struct sk_buff          *(*gso_segment)(struct sk_buff *skb,
                                                int features);
        int                     (*gso_send_check)(struct sk_buff *skb);
+       struct sk_buff          **(*gro_receive)(struct sk_buff **head,
+                                              struct sk_buff *skb);
+       int                     (*gro_complete)(struct sk_buff *skb);
        void                    *af_packet_priv;
        struct list_head        list;
 };
 
+struct napi_gro_fraginfo {
+       skb_frag_t frags[MAX_SKB_FRAGS];
+       unsigned int nr_frags;
+       unsigned int ip_summed;
+       unsigned int len;
+       __wsum csum;
+};
+
 #include <linux/interrupt.h>
 #include <linux/notifier.h>
 
@@ -1082,6 +1078,8 @@ extern void               free_netdev(struct net_device *dev);
 extern void            synchronize_net(void);
 extern int             register_netdevice_notifier(struct notifier_block *nb);
 extern int             unregister_netdevice_notifier(struct notifier_block *nb);
+extern int             init_dummy_netdev(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);
@@ -1130,9 +1128,6 @@ struct softnet_data
        struct sk_buff          *completion_queue;
 
        struct napi_struct      backlog;
-#ifdef CONFIG_NET_DMA
-       struct dma_chan         *net_dma;
-#endif
 };
 
 DECLARE_PER_CPU(struct softnet_data,softnet_data);
@@ -1377,6 +1372,17 @@ 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,
+                                       struct sk_buff *skb);
+extern int             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_fraginfo_skb(struct napi_struct *napi,
+                                         struct napi_gro_fraginfo *info);
+extern int             napi_gro_frags(struct napi_struct *napi,
+                                      struct napi_gro_fraginfo *info);
 extern void            netif_nit_deliver(struct sk_buff *skb);
 extern int             dev_valid_name(const char *name);
 extern int             dev_ioctl(struct net *net, unsigned int cmd, void __user *);
@@ -1569,8 +1575,7 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits)
 }
 
 /* Test if receive needs to be scheduled but only if up */
-static inline int netif_rx_schedule_prep(struct net_device *dev,
-                                        struct napi_struct *napi)
+static inline int netif_rx_schedule_prep(struct napi_struct *napi)
 {
        return napi_schedule_prep(napi);
 }
@@ -1578,27 +1583,24 @@ static inline int netif_rx_schedule_prep(struct net_device *dev,
 /* Add interface to tail of rx poll list. This assumes that _prep has
  * already been called and returned 1.
  */
-static inline void __netif_rx_schedule(struct net_device *dev,
-                                      struct napi_struct *napi)
+static inline void __netif_rx_schedule(struct napi_struct *napi)
 {
        __napi_schedule(napi);
 }
 
 /* Try to reschedule poll. Called by irq handler. */
 
-static inline void netif_rx_schedule(struct net_device *dev,
-                                    struct napi_struct *napi)
+static inline void netif_rx_schedule(struct napi_struct *napi)
 {
-       if (netif_rx_schedule_prep(dev, napi))
-               __netif_rx_schedule(dev, napi);
+       if (netif_rx_schedule_prep(napi))
+               __netif_rx_schedule(napi);
 }
 
 /* Try to reschedule poll. Called by dev->poll() after netif_rx_complete().  */
-static inline int netif_rx_reschedule(struct net_device *dev,
-                                     struct napi_struct *napi)
+static inline int netif_rx_reschedule(struct napi_struct *napi)
 {
        if (napi_schedule_prep(napi)) {
-               __netif_rx_schedule(dev, napi);
+               __netif_rx_schedule(napi);
                return 1;
        }
        return 0;
@@ -1607,8 +1609,7 @@ static inline int netif_rx_reschedule(struct net_device *dev,
 /* same as netif_rx_complete, except that local_irq_save(flags)
  * has already been issued
  */
-static inline void __netif_rx_complete(struct net_device *dev,
-                                      struct napi_struct *napi)
+static inline void __netif_rx_complete(struct napi_struct *napi)
 {
        __napi_complete(napi);
 }
@@ -1618,14 +1619,9 @@ static inline void __netif_rx_complete(struct net_device *dev,
  * it completes the work. The device cannot be out of poll list at this
  * moment, it is BUG().
  */
-static inline void netif_rx_complete(struct net_device *dev,
-                                    struct napi_struct *napi)
+static inline void netif_rx_complete(struct napi_struct *napi)
 {
-       unsigned long flags;
-
-       local_irq_save(flags);
-       __netif_rx_complete(dev, napi);
-       local_irq_restore(flags);
+       napi_complete(napi);
 }
 
 static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu)
@@ -1852,6 +1848,8 @@ 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));
 }