]> err.no Git - linux-2.6/commitdiff
[NET]: migrate HARD_TX_LOCK to header file
authorJamal Hadi Salim <hadi@cyberus.ca>
Sun, 16 Sep 2007 21:40:49 +0000 (14:40 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Wed, 10 Oct 2007 23:51:20 +0000 (16:51 -0700)
HARD_TX_LOCK micro is a nice aggregation that could be used
in other spots. move it to netdevice.h
Also makes sure the previously superflous cpu arguement is used.
Thanks to DaveM for the suggestions.

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netdevice.h
net/core/dev.c

index de387c5400b387438c29c82874306a17e4dbf254..96964fb7478b9f7f36a88b86c15b155c9f6c17c1 100644 (file)
@@ -1265,10 +1265,15 @@ static inline void netif_rx_complete(struct net_device *dev,
  *
  * Get network device transmit lock
  */
-static inline void netif_tx_lock(struct net_device *dev)
+static inline void __netif_tx_lock(struct net_device *dev, int cpu)
 {
        spin_lock(&dev->_xmit_lock);
-       dev->xmit_lock_owner = smp_processor_id();
+       dev->xmit_lock_owner = cpu;
+}
+
+static inline void netif_tx_lock(struct net_device *dev)
+{
+       __netif_tx_lock(dev, smp_processor_id());
 }
 
 static inline void netif_tx_lock_bh(struct net_device *dev)
@@ -1297,6 +1302,18 @@ static inline void netif_tx_unlock_bh(struct net_device *dev)
        spin_unlock_bh(&dev->_xmit_lock);
 }
 
+#define HARD_TX_LOCK(dev, cpu) {                       \
+       if ((dev->features & NETIF_F_LLTX) == 0) {      \
+               __netif_tx_lock(dev, cpu);                      \
+       }                                               \
+}
+
+#define HARD_TX_UNLOCK(dev) {                          \
+       if ((dev->features & NETIF_F_LLTX) == 0) {      \
+               netif_tx_unlock(dev);                   \
+       }                                               \
+}
+
 static inline void netif_tx_disable(struct net_device *dev)
 {
        netif_tx_lock_bh(dev);
index 666c112efb55fc6bd76fd7f073dca951665952da..e9a6d93a194f3f209ccb51b20bc22dd93713e705 100644 (file)
@@ -1574,18 +1574,6 @@ out_kfree_skb:
        return 0;
 }
 
-#define HARD_TX_LOCK(dev, cpu) {                       \
-       if ((dev->features & NETIF_F_LLTX) == 0) {      \
-               netif_tx_lock(dev);                     \
-       }                                               \
-}
-
-#define HARD_TX_UNLOCK(dev) {                          \
-       if ((dev->features & NETIF_F_LLTX) == 0) {      \
-               netif_tx_unlock(dev);                   \
-       }                                               \
-}
-
 /**
  *     dev_queue_xmit - transmit a buffer
  *     @skb: buffer to transmit