aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-07-17 03:34:19 -0400
committerDavid S. Miller <davem@davemloft.net>2008-07-17 22:21:00 -0400
commite8a0464cc950972824e2e128028ae3db666ec1ed (patch)
tree5022b95396c0f3b313531bc39b19543c03551b9a /drivers/net
parent070825b3840a743e21ebcc44f8279708a4fed977 (diff)
netdev: Allocate multiple queues for TX.
alloc_netdev_mq() now allocates an array of netdev_queue structures for TX, based upon the queue_count argument. Furthermore, all accesses to the TX queues are now vectored through the netdev_get_tx_queue() and netdev_for_each_tx_queue() interfaces. This makes it easy to grep the tree for all things that want to get to a TX queue of a net device. Problem spots which are not really multiqueue aware yet, and only work with one queue, can easily be spotted by grepping for all netdev_get_tx_queue() calls that pass in a zero index. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/bonding/bond_main.c6
-rw-r--r--drivers/net/hamradio/bpqether.c6
-rw-r--r--drivers/net/ifb.c12
-rw-r--r--drivers/net/macvlan.c6
-rw-r--r--drivers/net/wireless/hostap/hostap_hw.c6
5 files changed, 25 insertions, 11 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index fd87dbe7999a..9737c06045d6 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -5042,7 +5042,9 @@ static int bond_check_params(struct bond_params *params)
5042 5042
5043static struct lock_class_key bonding_netdev_xmit_lock_key; 5043static struct lock_class_key bonding_netdev_xmit_lock_key;
5044 5044
5045static void bond_set_lockdep_class_one(struct netdev_queue *txq) 5045static void bond_set_lockdep_class_one(struct net_device *dev,
5046 struct netdev_queue *txq,
5047 void *_unused)
5046{ 5048{
5047 lockdep_set_class(&txq->_xmit_lock, 5049 lockdep_set_class(&txq->_xmit_lock,
5048 &bonding_netdev_xmit_lock_key); 5050 &bonding_netdev_xmit_lock_key);
@@ -5050,7 +5052,7 @@ static void bond_set_lockdep_class_one(struct netdev_queue *txq)
5050 5052
5051static void bond_set_lockdep_class(struct net_device *dev) 5053static void bond_set_lockdep_class(struct net_device *dev)
5052{ 5054{
5053 bond_set_lockdep_class_one(&dev->tx_queue); 5055 netdev_for_each_tx_queue(dev, bond_set_lockdep_class_one, NULL);
5054} 5056}
5055 5057
5056/* Create a new bond based on the specified name and bonding parameters. 5058/* Create a new bond based on the specified name and bonding parameters.
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
index fb186b8c3d4d..b6500b2aacf2 100644
--- a/drivers/net/hamradio/bpqether.c
+++ b/drivers/net/hamradio/bpqether.c
@@ -124,14 +124,16 @@ static LIST_HEAD(bpq_devices);
124 */ 124 */
125static struct lock_class_key bpq_netdev_xmit_lock_key; 125static struct lock_class_key bpq_netdev_xmit_lock_key;
126 126
127static void bpq_set_lockdep_class_one(struct netdev_queue *txq) 127static void bpq_set_lockdep_class_one(struct net_device *dev,
128 struct netdev_queue *txq,
129 void *_unused)
128{ 130{
129 lockdep_set_class(&txq->_xmit_lock, &bpq_netdev_xmit_lock_key); 131 lockdep_set_class(&txq->_xmit_lock, &bpq_netdev_xmit_lock_key);
130} 132}
131 133
132static void bpq_set_lockdep_class(struct net_device *dev) 134static void bpq_set_lockdep_class(struct net_device *dev)
133{ 135{
134 bpq_set_lockdep_class_one(&dev->tx_queue); 136 netdev_for_each_tx_queue(dev, bpq_set_lockdep_class_one, NULL);
135} 137}
136 138
137/* ------------------------------------------------------------------------ */ 139/* ------------------------------------------------------------------------ */
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
index ccbd6554f6eb..897b05e79ed0 100644
--- a/drivers/net/ifb.c
+++ b/drivers/net/ifb.c
@@ -229,14 +229,20 @@ module_param(numifbs, int, 0);
229MODULE_PARM_DESC(numifbs, "Number of ifb devices"); 229MODULE_PARM_DESC(numifbs, "Number of ifb devices");
230 230
231/* 231/*
232 * dev_ifb->tx_queue.lock is usually taken after dev->rx_queue.lock, 232 * dev_ifb's TX queue lock is usually taken after dev->rx_queue.lock,
233 * reversely to e.g. qdisc_lock_tree(). It should be safe until 233 * reversely to e.g. qdisc_lock_tree(). It should be safe until
234 * ifb doesn't take dev->tx_queue.lock with dev_ifb->rx_queue.lock. 234 * ifb doesn't take dev's TX queue lock with dev_ifb->rx_queue.lock.
235 * But lockdep should know that ifb has different locks from dev. 235 * But lockdep should know that ifb has different locks from dev.
236 */ 236 */
237static struct lock_class_key ifb_tx_queue_lock_key; 237static struct lock_class_key ifb_tx_queue_lock_key;
238static struct lock_class_key ifb_rx_queue_lock_key; 238static struct lock_class_key ifb_rx_queue_lock_key;
239 239
240static void set_tx_lockdep_key(struct net_device *dev,
241 struct netdev_queue *txq,
242 void *_unused)
243{
244 lockdep_set_class(&txq->lock, &ifb_tx_queue_lock_key);
245}
240 246
241static int __init ifb_init_one(int index) 247static int __init ifb_init_one(int index)
242{ 248{
@@ -258,7 +264,7 @@ static int __init ifb_init_one(int index)
258 if (err < 0) 264 if (err < 0)
259 goto err; 265 goto err;
260 266
261 lockdep_set_class(&dev_ifb->tx_queue.lock, &ifb_tx_queue_lock_key); 267 netdev_for_each_tx_queue(dev_ifb, set_tx_lockdep_key, NULL);
262 lockdep_set_class(&dev_ifb->rx_queue.lock, &ifb_rx_queue_lock_key); 268 lockdep_set_class(&dev_ifb->rx_queue.lock, &ifb_rx_queue_lock_key);
263 269
264 return 0; 270 return 0;
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 980001c2cf96..72745ce588c6 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -285,7 +285,9 @@ static struct lock_class_key macvlan_netdev_xmit_lock_key;
285#define MACVLAN_STATE_MASK \ 285#define MACVLAN_STATE_MASK \
286 ((1<<__LINK_STATE_NOCARRIER) | (1<<__LINK_STATE_DORMANT)) 286 ((1<<__LINK_STATE_NOCARRIER) | (1<<__LINK_STATE_DORMANT))
287 287
288static void macvlan_set_lockdep_class_one(struct netdev_queue *txq) 288static void macvlan_set_lockdep_class_one(struct net_device *dev,
289 struct netdev_queue *txq,
290 void *_unused)
289{ 291{
290 lockdep_set_class(&txq->_xmit_lock, 292 lockdep_set_class(&txq->_xmit_lock,
291 &macvlan_netdev_xmit_lock_key); 293 &macvlan_netdev_xmit_lock_key);
@@ -293,7 +295,7 @@ static void macvlan_set_lockdep_class_one(struct netdev_queue *txq)
293 295
294static void macvlan_set_lockdep_class(struct net_device *dev) 296static void macvlan_set_lockdep_class(struct net_device *dev)
295{ 297{
296 macvlan_set_lockdep_class_one(&dev->tx_queue); 298 netdev_for_each_tx_queue(dev, macvlan_set_lockdep_class_one, NULL);
297} 299}
298 300
299static int macvlan_init(struct net_device *dev) 301static int macvlan_init(struct net_device *dev)
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c
index c1f4bb005d92..13d5882f1f21 100644
--- a/drivers/net/wireless/hostap/hostap_hw.c
+++ b/drivers/net/wireless/hostap/hostap_hw.c
@@ -3102,7 +3102,9 @@ static void prism2_clear_set_tim_queue(local_info_t *local)
3102 */ 3102 */
3103static struct lock_class_key hostap_netdev_xmit_lock_key; 3103static struct lock_class_key hostap_netdev_xmit_lock_key;
3104 3104
3105static void prism2_set_lockdep_class_one(struct netdev_queue *txq) 3105static void prism2_set_lockdep_class_one(struct net_device *dev,
3106 struct netdev_queue *txq,
3107 void *_unused)
3106{ 3108{
3107 lockdep_set_class(&txq->_xmit_lock, 3109 lockdep_set_class(&txq->_xmit_lock,
3108 &hostap_netdev_xmit_lock_key); 3110 &hostap_netdev_xmit_lock_key);
@@ -3110,7 +3112,7 @@ static void prism2_set_lockdep_class_one(struct netdev_queue *txq)
3110 3112
3111static void prism2_set_lockdep_class(struct net_device *dev) 3113static void prism2_set_lockdep_class(struct net_device *dev)
3112{ 3114{
3113 prism2_set_lockdep_class_one(&dev->tx_queue); 3115 netdev_for_each_tx_queue(dev, prism2_set_lockdep_class_one, NULL);
3114} 3116}
3115 3117
3116static struct net_device * 3118static struct net_device *