diff options
author | Jamal Hadi Salim <hadi@cyberus.ca> | 2007-09-16 17:40:49 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:51:20 -0400 |
commit | 22dd74950172dc8979576e2bef3b439f20ef0b05 (patch) | |
tree | d918ef8e1841cd4e5938febd2c584c02dcc6ca25 | |
parent | 4885a50476b95fa0f4caad179a80783508c2fe86 (diff) |
[NET]: migrate HARD_TX_LOCK to header file
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>
-rw-r--r-- | include/linux/netdevice.h | 21 | ||||
-rw-r--r-- | net/core/dev.c | 12 |
2 files changed, 19 insertions, 14 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index de387c5400b3..96964fb7478b 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -1265,10 +1265,15 @@ static inline void netif_rx_complete(struct net_device *dev, | |||
1265 | * | 1265 | * |
1266 | * Get network device transmit lock | 1266 | * Get network device transmit lock |
1267 | */ | 1267 | */ |
1268 | static inline void netif_tx_lock(struct net_device *dev) | 1268 | static inline void __netif_tx_lock(struct net_device *dev, int cpu) |
1269 | { | 1269 | { |
1270 | spin_lock(&dev->_xmit_lock); | 1270 | spin_lock(&dev->_xmit_lock); |
1271 | dev->xmit_lock_owner = smp_processor_id(); | 1271 | dev->xmit_lock_owner = cpu; |
1272 | } | ||
1273 | |||
1274 | static inline void netif_tx_lock(struct net_device *dev) | ||
1275 | { | ||
1276 | __netif_tx_lock(dev, smp_processor_id()); | ||
1272 | } | 1277 | } |
1273 | 1278 | ||
1274 | static inline void netif_tx_lock_bh(struct net_device *dev) | 1279 | 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) | |||
1297 | spin_unlock_bh(&dev->_xmit_lock); | 1302 | spin_unlock_bh(&dev->_xmit_lock); |
1298 | } | 1303 | } |
1299 | 1304 | ||
1305 | #define HARD_TX_LOCK(dev, cpu) { \ | ||
1306 | if ((dev->features & NETIF_F_LLTX) == 0) { \ | ||
1307 | __netif_tx_lock(dev, cpu); \ | ||
1308 | } \ | ||
1309 | } | ||
1310 | |||
1311 | #define HARD_TX_UNLOCK(dev) { \ | ||
1312 | if ((dev->features & NETIF_F_LLTX) == 0) { \ | ||
1313 | netif_tx_unlock(dev); \ | ||
1314 | } \ | ||
1315 | } | ||
1316 | |||
1300 | static inline void netif_tx_disable(struct net_device *dev) | 1317 | static inline void netif_tx_disable(struct net_device *dev) |
1301 | { | 1318 | { |
1302 | netif_tx_lock_bh(dev); | 1319 | netif_tx_lock_bh(dev); |
diff --git a/net/core/dev.c b/net/core/dev.c index 666c112efb55..e9a6d93a194f 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1574,18 +1574,6 @@ out_kfree_skb: | |||
1574 | return 0; | 1574 | return 0; |
1575 | } | 1575 | } |
1576 | 1576 | ||
1577 | #define HARD_TX_LOCK(dev, cpu) { \ | ||
1578 | if ((dev->features & NETIF_F_LLTX) == 0) { \ | ||
1579 | netif_tx_lock(dev); \ | ||
1580 | } \ | ||
1581 | } | ||
1582 | |||
1583 | #define HARD_TX_UNLOCK(dev) { \ | ||
1584 | if ((dev->features & NETIF_F_LLTX) == 0) { \ | ||
1585 | netif_tx_unlock(dev); \ | ||
1586 | } \ | ||
1587 | } | ||
1588 | |||
1589 | /** | 1577 | /** |
1590 | * dev_queue_xmit - transmit a buffer | 1578 | * dev_queue_xmit - transmit a buffer |
1591 | * @skb: buffer to transmit | 1579 | * @skb: buffer to transmit |