]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/netdevice.h
[NET]: Add NETIF_F_GEN_CSUM and NETIF_F_ALL_CSUM
[linux-2.6-omap-h63xx.git] / include / linux / netdevice.h
index 01db7b88a2b1c626f668085364ca6181ba9ca641..e432b743dda24e8a0cacc263f4790d2fdb73cc6e 100644 (file)
@@ -37,6 +37,7 @@
 #include <linux/config.h>
 #include <linux/device.h>
 #include <linux/percpu.h>
+#include <linux/dmaengine.h>
 
 struct divert_blk;
 struct vlan_group;
@@ -311,6 +312,9 @@ struct net_device
 #define NETIF_F_LLTX           4096    /* LockLess TX */
 #define NETIF_F_UFO             8192    /* Can offload UDP Large Send*/
 
+#define NETIF_F_GEN_CSUM       (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM)
+#define NETIF_F_ALL_CSUM       (NETIF_F_IP_CSUM | NETIF_F_GEN_CSUM)
+
        struct net_device       *next_sched;
 
        /* Interface index. Unique device identifier    */
@@ -406,7 +410,7 @@ struct net_device
  * One part is mostly used on xmit path (device)
  */
        /* hard_start_xmit synchronizer */
-       spinlock_t              xmit_lock ____cacheline_aligned_in_smp;
+       spinlock_t              _xmit_lock ____cacheline_aligned_in_smp;
        /* cpu id of processor entered to hard_start_xmit or -1,
           if nobody entered there.
         */
@@ -433,8 +437,7 @@ struct net_device
 
        /* register/unregister state machine */
        enum { NETREG_UNINITIALIZED=0,
-              NETREG_REGISTERING,      /* called register_netdevice */
-              NETREG_REGISTERED,       /* completed register todo */
+              NETREG_REGISTERED,       /* completed register_netdevice */
               NETREG_UNREGISTERING,    /* called unregister_netdevice */
               NETREG_UNREGISTERED,     /* completed unregister todo */
               NETREG_RELEASED,         /* called free_netdev */
@@ -506,6 +509,8 @@ struct net_device
 
        /* class/net/name entry */
        struct class_device     class_dev;
+       /* space for optional statistics and wireless sysfs groups */
+       struct attribute_group  *sysfs_groups[3];
 };
 
 #define        NETDEV_ALIGN            32
@@ -592,6 +597,9 @@ struct softnet_data
        struct sk_buff          *completion_queue;
 
        struct net_device       backlog_dev;    /* Sorry. 8) */
+#ifdef CONFIG_NET_DMA
+       struct dma_chan         *net_dma;
+#endif
 };
 
 DECLARE_PER_CPU(struct softnet_data,softnet_data);
@@ -829,21 +837,19 @@ static inline void netif_rx_schedule(struct net_device *dev)
                __netif_rx_schedule(dev);
 }
 
-
-static inline void  __netif_rx_reschedule(struct net_device *dev, int undo)
-{
-       dev->quota += undo;
-       list_add_tail(&dev->poll_list, &__get_cpu_var(softnet_data).poll_list);
-       __raise_softirq_irqoff(NET_RX_SOFTIRQ);
-}
-
-/* Try to reschedule poll. Called by dev->poll() after netif_rx_complete(). */
+/* Try to reschedule poll. Called by dev->poll() after netif_rx_complete().
+ * Do not inline this?
+ */
 static inline int netif_rx_reschedule(struct net_device *dev, int undo)
 {
        if (netif_rx_schedule_prep(dev)) {
                unsigned long flags;
+
+               dev->quota += undo;
+
                local_irq_save(flags);
-               __netif_rx_reschedule(dev, undo);
+               list_add_tail(&dev->poll_list, &__get_cpu_var(softnet_data).poll_list);
+               __raise_softirq_irqoff(NET_RX_SOFTIRQ);
                local_irq_restore(flags);
                return 1;
        }
@@ -890,11 +896,43 @@ static inline void __netif_rx_complete(struct net_device *dev)
        clear_bit(__LINK_STATE_RX_SCHED, &dev->state);
 }
 
+static inline void netif_tx_lock(struct net_device *dev)
+{
+       spin_lock(&dev->_xmit_lock);
+       dev->xmit_lock_owner = smp_processor_id();
+}
+
+static inline void netif_tx_lock_bh(struct net_device *dev)
+{
+       spin_lock_bh(&dev->_xmit_lock);
+       dev->xmit_lock_owner = smp_processor_id();
+}
+
+static inline int netif_tx_trylock(struct net_device *dev)
+{
+       int err = spin_trylock(&dev->_xmit_lock);
+       if (!err)
+               dev->xmit_lock_owner = smp_processor_id();
+       return err;
+}
+
+static inline void netif_tx_unlock(struct net_device *dev)
+{
+       dev->xmit_lock_owner = -1;
+       spin_unlock(&dev->_xmit_lock);
+}
+
+static inline void netif_tx_unlock_bh(struct net_device *dev)
+{
+       dev->xmit_lock_owner = -1;
+       spin_unlock_bh(&dev->_xmit_lock);
+}
+
 static inline void netif_tx_disable(struct net_device *dev)
 {
-       spin_lock_bh(&dev->xmit_lock);
+       netif_tx_lock_bh(dev);
        netif_stop_queue(dev);
-       spin_unlock_bh(&dev->xmit_lock);
+       netif_tx_unlock_bh(dev);
 }
 
 /* These functions live elsewhere (drivers/net/net_init.c, but related) */