diff options
Diffstat (limited to 'include/linux/netdevice.h')
| -rw-r--r-- | include/linux/netdevice.h | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index f4169bbb60eb..e432b743dda2 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -37,6 +37,7 @@ | |||
| 37 | #include <linux/config.h> | 37 | #include <linux/config.h> |
| 38 | #include <linux/device.h> | 38 | #include <linux/device.h> |
| 39 | #include <linux/percpu.h> | 39 | #include <linux/percpu.h> |
| 40 | #include <linux/dmaengine.h> | ||
| 40 | 41 | ||
| 41 | struct divert_blk; | 42 | struct divert_blk; |
| 42 | struct vlan_group; | 43 | struct vlan_group; |
| @@ -311,6 +312,9 @@ struct net_device | |||
| 311 | #define NETIF_F_LLTX 4096 /* LockLess TX */ | 312 | #define NETIF_F_LLTX 4096 /* LockLess TX */ |
| 312 | #define NETIF_F_UFO 8192 /* Can offload UDP Large Send*/ | 313 | #define NETIF_F_UFO 8192 /* Can offload UDP Large Send*/ |
| 313 | 314 | ||
| 315 | #define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM) | ||
| 316 | #define NETIF_F_ALL_CSUM (NETIF_F_IP_CSUM | NETIF_F_GEN_CSUM) | ||
| 317 | |||
| 314 | struct net_device *next_sched; | 318 | struct net_device *next_sched; |
| 315 | 319 | ||
| 316 | /* Interface index. Unique device identifier */ | 320 | /* Interface index. Unique device identifier */ |
| @@ -406,7 +410,7 @@ struct net_device | |||
| 406 | * One part is mostly used on xmit path (device) | 410 | * One part is mostly used on xmit path (device) |
| 407 | */ | 411 | */ |
| 408 | /* hard_start_xmit synchronizer */ | 412 | /* hard_start_xmit synchronizer */ |
| 409 | spinlock_t xmit_lock ____cacheline_aligned_in_smp; | 413 | spinlock_t _xmit_lock ____cacheline_aligned_in_smp; |
| 410 | /* cpu id of processor entered to hard_start_xmit or -1, | 414 | /* cpu id of processor entered to hard_start_xmit or -1, |
| 411 | if nobody entered there. | 415 | if nobody entered there. |
| 412 | */ | 416 | */ |
| @@ -593,6 +597,9 @@ struct softnet_data | |||
| 593 | struct sk_buff *completion_queue; | 597 | struct sk_buff *completion_queue; |
| 594 | 598 | ||
| 595 | struct net_device backlog_dev; /* Sorry. 8) */ | 599 | struct net_device backlog_dev; /* Sorry. 8) */ |
| 600 | #ifdef CONFIG_NET_DMA | ||
| 601 | struct dma_chan *net_dma; | ||
| 602 | #endif | ||
| 596 | }; | 603 | }; |
| 597 | 604 | ||
| 598 | DECLARE_PER_CPU(struct softnet_data,softnet_data); | 605 | DECLARE_PER_CPU(struct softnet_data,softnet_data); |
| @@ -889,11 +896,43 @@ static inline void __netif_rx_complete(struct net_device *dev) | |||
| 889 | clear_bit(__LINK_STATE_RX_SCHED, &dev->state); | 896 | clear_bit(__LINK_STATE_RX_SCHED, &dev->state); |
| 890 | } | 897 | } |
| 891 | 898 | ||
| 899 | static inline void netif_tx_lock(struct net_device *dev) | ||
| 900 | { | ||
| 901 | spin_lock(&dev->_xmit_lock); | ||
| 902 | dev->xmit_lock_owner = smp_processor_id(); | ||
| 903 | } | ||
| 904 | |||
| 905 | static inline void netif_tx_lock_bh(struct net_device *dev) | ||
| 906 | { | ||
| 907 | spin_lock_bh(&dev->_xmit_lock); | ||
| 908 | dev->xmit_lock_owner = smp_processor_id(); | ||
| 909 | } | ||
| 910 | |||
| 911 | static inline int netif_tx_trylock(struct net_device *dev) | ||
| 912 | { | ||
| 913 | int err = spin_trylock(&dev->_xmit_lock); | ||
| 914 | if (!err) | ||
| 915 | dev->xmit_lock_owner = smp_processor_id(); | ||
| 916 | return err; | ||
| 917 | } | ||
| 918 | |||
| 919 | static inline void netif_tx_unlock(struct net_device *dev) | ||
| 920 | { | ||
| 921 | dev->xmit_lock_owner = -1; | ||
| 922 | spin_unlock(&dev->_xmit_lock); | ||
| 923 | } | ||
| 924 | |||
| 925 | static inline void netif_tx_unlock_bh(struct net_device *dev) | ||
| 926 | { | ||
| 927 | dev->xmit_lock_owner = -1; | ||
| 928 | spin_unlock_bh(&dev->_xmit_lock); | ||
| 929 | } | ||
| 930 | |||
| 892 | static inline void netif_tx_disable(struct net_device *dev) | 931 | static inline void netif_tx_disable(struct net_device *dev) |
| 893 | { | 932 | { |
| 894 | spin_lock_bh(&dev->xmit_lock); | 933 | netif_tx_lock_bh(dev); |
| 895 | netif_stop_queue(dev); | 934 | netif_stop_queue(dev); |
| 896 | spin_unlock_bh(&dev->xmit_lock); | 935 | netif_tx_unlock_bh(dev); |
| 897 | } | 936 | } |
| 898 | 937 | ||
| 899 | /* These functions live elsewhere (drivers/net/net_init.c, but related) */ | 938 | /* These functions live elsewhere (drivers/net/net_init.c, but related) */ |
