* [PATCH net-next-2.6 01/17] net: Allow changing number of RX queues after device allocation
2010-09-27 18:23 [PATCH net-next-2.6 00/17] netdev: Fix queue count initialisation Ben Hutchings
@ 2010-09-27 18:24 ` Ben Hutchings
2010-09-27 18:24 ` [PATCH net-next-2.6 02/17] net: Add netif_copy_real_num_queues() for use by virtual net drivers Ben Hutchings
` (16 subsequent siblings)
17 siblings, 0 replies; 28+ messages in thread
From: Ben Hutchings @ 2010-09-27 18:24 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-net-drivers, Tom Herbert
For RPS, we create a kobject for each RX queue based on the number of
queues passed to alloc_netdev_mq(). However, drivers generally do not
determine the numbers of hardware queues to use until much later, so
this usually represents the maximum number the driver may use and not
the actual number in use.
For TX queues, drivers can update the actual number using
netif_set_real_num_tx_queues(). Add a corresponding function for RX
queues, netif_set_real_num_rx_queues().
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
include/linux/netdevice.h | 16 +++++++++++++++-
net/core/dev.c | 45 +++++++++++++++++++++++++++++++++++++++++----
net/core/net-sysfs.c | 34 +++++++++++++++++++---------------
net/core/net-sysfs.h | 4 ++++
4 files changed, 79 insertions(+), 20 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 01bd4c8..cf3d5a3 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -976,8 +976,11 @@ struct net_device {
struct netdev_rx_queue *_rx;
- /* Number of RX queues allocated at alloc_netdev_mq() time */
+ /* Number of RX queues allocated at register_netdev() time */
unsigned int num_rx_queues;
+
+ /* Number of RX queues currently active in device */
+ unsigned int real_num_rx_queues;
#endif
rx_handler_func_t *rx_handler;
@@ -1684,6 +1687,17 @@ static inline int netif_is_multiqueue(const struct net_device *dev)
extern void netif_set_real_num_tx_queues(struct net_device *dev,
unsigned int txq);
+#ifdef CONFIG_RPS
+extern int netif_set_real_num_rx_queues(struct net_device *dev,
+ unsigned int rxq);
+#else
+static inline int netif_set_real_num_rx_queues(struct net_device *dev,
+ unsigned int rxq)
+{
+ return 0;
+}
+#endif
+
/* Use this variant when it is known for sure that it
* is executing from hardware interrupt context or with hardware interrupts
* disabled.
diff --git a/net/core/dev.c b/net/core/dev.c
index 42b200f..48ad47f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1567,6 +1567,41 @@ void netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq)
}
EXPORT_SYMBOL(netif_set_real_num_tx_queues);
+#ifdef CONFIG_RPS
+/**
+ * netif_set_real_num_rx_queues - set actual number of RX queues used
+ * @dev: Network device
+ * @rxq: Actual number of RX queues
+ *
+ * This must be called either with the rtnl_lock held or before
+ * registration of the net device. Returns 0 on success, or a
+ * negative error code. If called before registration, it also
+ * sets the maximum number of queues, and always succeeds.
+ */
+int netif_set_real_num_rx_queues(struct net_device *dev, unsigned int rxq)
+{
+ int rc;
+
+ if (dev->reg_state == NETREG_REGISTERED) {
+ ASSERT_RTNL();
+
+ if (rxq > dev->num_rx_queues)
+ return -EINVAL;
+
+ rc = net_rx_queue_update_kobjects(dev, dev->real_num_rx_queues,
+ rxq);
+ if (rc)
+ return rc;
+ } else {
+ dev->num_rx_queues = rxq;
+ }
+
+ dev->real_num_rx_queues = rxq;
+ return 0;
+}
+EXPORT_SYMBOL(netif_set_real_num_rx_queues);
+#endif
+
static inline void __netif_reschedule(struct Qdisc *q)
{
struct softnet_data *sd;
@@ -2352,10 +2387,11 @@ static int get_rps_cpu(struct net_device *dev, struct sk_buff *skb,
if (skb_rx_queue_recorded(skb)) {
u16 index = skb_get_rx_queue(skb);
- if (unlikely(index >= dev->num_rx_queues)) {
- WARN_ONCE(dev->num_rx_queues > 1, "%s received packet "
- "on queue %u, but number of RX queues is %u\n",
- dev->name, index, dev->num_rx_queues);
+ if (unlikely(index >= dev->real_num_rx_queues)) {
+ WARN_ONCE(dev->real_num_rx_queues > 1,
+ "%s received packet on queue %u, but number "
+ "of RX queues is %u\n",
+ dev->name, index, dev->real_num_rx_queues);
goto done;
}
rxqueue = dev->_rx + index;
@@ -5472,6 +5508,7 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
#ifdef CONFIG_RPS
dev->num_rx_queues = queue_count;
+ dev->real_num_rx_queues = queue_count;
#endif
dev->gso_max_size = GSO_MAX_SIZE;
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 76485a3..4791cfc 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -742,34 +742,38 @@ static int rx_queue_add_kobject(struct net_device *net, int index)
return error;
}
-static int rx_queue_register_kobjects(struct net_device *net)
+int
+net_rx_queue_update_kobjects(struct net_device *net, int old_num, int new_num)
{
int i;
int error = 0;
-
- net->queues_kset = kset_create_and_add("queues",
- NULL, &net->dev.kobj);
- if (!net->queues_kset)
- return -ENOMEM;
- for (i = 0; i < net->num_rx_queues; i++) {
+
+ for (i = old_num; i < new_num; i++) {
error = rx_queue_add_kobject(net, i);
- if (error)
+ if (error) {
+ new_num = old_num;
break;
+ }
}
- if (error)
- while (--i >= 0)
- kobject_put(&net->_rx[i].kobj);
+ while (--i >= new_num)
+ kobject_put(&net->_rx[i].kobj);
return error;
}
-static void rx_queue_remove_kobjects(struct net_device *net)
+static int rx_queue_register_kobjects(struct net_device *net)
{
- int i;
+ net->queues_kset = kset_create_and_add("queues",
+ NULL, &net->dev.kobj);
+ if (!net->queues_kset)
+ return -ENOMEM;
+ return net_rx_queue_update_kobjects(net, 0, net->real_num_rx_queues);
+}
- for (i = 0; i < net->num_rx_queues; i++)
- kobject_put(&net->_rx[i].kobj);
+static void rx_queue_remove_kobjects(struct net_device *net)
+{
+ net_rx_queue_update_kobjects(net, net->real_num_rx_queues, 0);
kset_unregister(net->queues_kset);
}
#endif /* CONFIG_RPS */
diff --git a/net/core/net-sysfs.h b/net/core/net-sysfs.h
index 805555e..778e157 100644
--- a/net/core/net-sysfs.h
+++ b/net/core/net-sysfs.h
@@ -4,4 +4,8 @@
int netdev_kobject_init(void);
int netdev_register_kobject(struct net_device *);
void netdev_unregister_kobject(struct net_device *);
+#ifdef CONFIG_RPS
+int net_rx_queue_update_kobjects(struct net_device *, int old_num, int new_num);
+#endif
+
#endif
--
1.7.2.1
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH net-next-2.6 02/17] net: Add netif_copy_real_num_queues() for use by virtual net drivers
2010-09-27 18:23 [PATCH net-next-2.6 00/17] netdev: Fix queue count initialisation Ben Hutchings
2010-09-27 18:24 ` [PATCH net-next-2.6 01/17] net: Allow changing number of RX queues after device allocation Ben Hutchings
@ 2010-09-27 18:24 ` Ben Hutchings
2010-09-27 18:25 ` [PATCH net-next-2.6 03/17] bnx2: Use netif_set_real_num_{rx,tx}_queues() Ben Hutchings
` (15 subsequent siblings)
17 siblings, 0 replies; 28+ messages in thread
From: Ben Hutchings @ 2010-09-27 18:24 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-net-drivers
This sets the active numbers of queues on a net device to match another.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
include/linux/netdevice.h | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index cf3d5a3..7fd39b3 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1698,6 +1698,18 @@ static inline int netif_set_real_num_rx_queues(struct net_device *dev,
}
#endif
+static inline int netif_copy_real_num_queues(struct net_device *to_dev,
+ const struct net_device *from_dev)
+{
+ netif_set_real_num_tx_queues(to_dev, from_dev->real_num_tx_queues);
+#ifdef CONFIG_RPS
+ return netif_set_real_num_rx_queues(to_dev,
+ from_dev->real_num_rx_queues);
+#else
+ return 0;
+#endif
+}
+
/* Use this variant when it is known for sure that it
* is executing from hardware interrupt context or with hardware interrupts
* disabled.
--
1.7.2.1
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH net-next-2.6 03/17] bnx2: Use netif_set_real_num_{rx,tx}_queues()
2010-09-27 18:23 [PATCH net-next-2.6 00/17] netdev: Fix queue count initialisation Ben Hutchings
2010-09-27 18:24 ` [PATCH net-next-2.6 01/17] net: Allow changing number of RX queues after device allocation Ben Hutchings
2010-09-27 18:24 ` [PATCH net-next-2.6 02/17] net: Add netif_copy_real_num_queues() for use by virtual net drivers Ben Hutchings
@ 2010-09-27 18:25 ` Ben Hutchings
2010-09-27 18:25 ` [PATCH net-next-2.6 04/17] bnx2x: " Ben Hutchings
` (14 subsequent siblings)
17 siblings, 0 replies; 28+ messages in thread
From: Ben Hutchings @ 2010-09-27 18:25 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-net-drivers, Michael Chan
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/net/bnx2.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 3d1a5da..b10be27 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -6202,7 +6202,7 @@ bnx2_enable_msix(struct bnx2 *bp, int msix_vecs)
}
}
-static void
+static int
bnx2_setup_int_mode(struct bnx2 *bp, int dis_msi)
{
int cpus = num_online_cpus();
@@ -6231,9 +6231,10 @@ bnx2_setup_int_mode(struct bnx2 *bp, int dis_msi)
}
bp->num_tx_rings = rounddown_pow_of_two(bp->irq_nvecs);
- bp->dev->real_num_tx_queues = bp->num_tx_rings;
+ netif_set_real_num_tx_queues(bp->dev, bp->num_tx_rings);
bp->num_rx_rings = bp->irq_nvecs;
+ return netif_set_real_num_rx_queues(bp->dev, bp->num_rx_rings);
}
/* Called with rtnl_lock */
@@ -6248,7 +6249,9 @@ bnx2_open(struct net_device *dev)
bnx2_set_power_state(bp, PCI_D0);
bnx2_disable_int(bp);
- bnx2_setup_int_mode(bp, disable_msi);
+ rc = bnx2_setup_int_mode(bp, disable_msi);
+ if (rc)
+ goto open_err;
bnx2_init_napi(bp);
bnx2_napi_enable(bp);
rc = bnx2_alloc_mem(bp);
--
1.7.2.1
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH net-next-2.6 04/17] bnx2x: Use netif_set_real_num_{rx,tx}_queues()
2010-09-27 18:23 [PATCH net-next-2.6 00/17] netdev: Fix queue count initialisation Ben Hutchings
` (2 preceding siblings ...)
2010-09-27 18:25 ` [PATCH net-next-2.6 03/17] bnx2: Use netif_set_real_num_{rx,tx}_queues() Ben Hutchings
@ 2010-09-27 18:25 ` Ben Hutchings
2010-09-28 9:26 ` Vladislav Zolotarov
2010-09-27 18:25 ` [PATCH net-next-2.6 05/17] cxgb3: " Ben Hutchings
` (13 subsequent siblings)
17 siblings, 1 reply; 28+ messages in thread
From: Ben Hutchings @ 2010-09-27 18:25 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-net-drivers, Eilon Greenstein
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/net/bnx2x/bnx2x_cmn.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/bnx2x/bnx2x_cmn.c b/drivers/net/bnx2x/bnx2x_cmn.c
index efc7be4..05c05a4 100644
--- a/drivers/net/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/bnx2x/bnx2x_cmn.c
@@ -1207,8 +1207,8 @@ static int bnx2x_set_num_queues(struct bnx2x *bp)
bp->num_queues = 1;
break;
}
- bp->dev->real_num_tx_queues = bp->num_queues;
- return rc;
+ netif_set_real_num_tx_queues(bp->dev, bp->num_queues);
+ return netif_set_real_num_rx_queues(bp->dev, bp->num_queues);
}
static void bnx2x_release_firmware(struct bnx2x *bp)
@@ -1240,6 +1240,8 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
bp->state = BNX2X_STATE_OPENING_WAIT4_LOAD;
rc = bnx2x_set_num_queues(bp);
+ if (rc)
+ return rc;
if (bnx2x_alloc_mem(bp)) {
bnx2x_free_irq(bp, true);
--
1.7.2.1
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 28+ messages in thread* RE: [PATCH net-next-2.6 04/17] bnx2x: Use netif_set_real_num_{rx,tx}_queues()
2010-09-27 18:25 ` [PATCH net-next-2.6 04/17] bnx2x: " Ben Hutchings
@ 2010-09-28 9:26 ` Vladislav Zolotarov
2010-09-28 12:59 ` Vladislav Zolotarov
0 siblings, 1 reply; 28+ messages in thread
From: Vladislav Zolotarov @ 2010-09-28 9:26 UTC (permalink / raw)
To: Ben Hutchings, David Miller
Cc: netdev@vger.kernel.org, linux-net-drivers@solarflare.com,
Eilon Greenstein
> -----Original Message-----
> From: netdev-owner@vger.kernel.org [mailto:netdev-
> owner@vger.kernel.org] On Behalf Of Ben Hutchings
> Sent: Monday, September 27, 2010 8:25 PM
> To: David Miller
> Cc: netdev@vger.kernel.org; linux-net-drivers@solarflare.com; Eilon
> Greenstein
> Subject: [PATCH net-next-2.6 04/17] bnx2x: Use
> netif_set_real_num_{rx,tx}_queues()
>
> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
> ---
> drivers/net/bnx2x/bnx2x_cmn.c | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/bnx2x/bnx2x_cmn.c
> b/drivers/net/bnx2x/bnx2x_cmn.c
> index efc7be4..05c05a4 100644
> --- a/drivers/net/bnx2x/bnx2x_cmn.c
> +++ b/drivers/net/bnx2x/bnx2x_cmn.c
> @@ -1207,8 +1207,8 @@ static int bnx2x_set_num_queues(struct bnx2x *bp)
> bp->num_queues = 1;
> break;
> }
> - bp->dev->real_num_tx_queues = bp->num_queues;
> - return rc;
> + netif_set_real_num_tx_queues(bp->dev, bp->num_queues);
> + return netif_set_real_num_rx_queues(bp->dev, bp->num_queues);
> }
>
> static void bnx2x_release_firmware(struct bnx2x *bp)
> @@ -1240,6 +1240,8 @@ int bnx2x_nic_load(struct bnx2x *bp, int
> load_mode)
> bp->state = BNX2X_STATE_OPENING_WAIT4_LOAD;
>
> rc = bnx2x_set_num_queues(bp);
> + if (rc)
> + return rc;
>
> if (bnx2x_alloc_mem(bp)) {
> bnx2x_free_irq(bp, true);
> --
> 1.7.2.1
>
This patch breaks our interrupt enablement flow. I'll send the new one that incorporates the netif_set_real_num_rx_queues() shortly.
Thanks,
vlad
>
>
> --
> Ben Hutchings, Senior Software Engineer, Solarflare Communications
> Not speaking for my employer; that's the marketing department's job.
> They asked us to note that Solarflare product names are trademarked.
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 28+ messages in thread* RE: [PATCH net-next-2.6 04/17] bnx2x: Use netif_set_real_num_{rx,tx}_queues()
2010-09-28 9:26 ` Vladislav Zolotarov
@ 2010-09-28 12:59 ` Vladislav Zolotarov
2010-09-28 17:39 ` David Miller
0 siblings, 1 reply; 28+ messages in thread
From: Vladislav Zolotarov @ 2010-09-28 12:59 UTC (permalink / raw)
To: Vladislav Zolotarov, Ben Hutchings, David Miller
Cc: netdev@vger.kernel.org, linux-net-drivers@solarflare.com,
Eilon Greenstein
> -----Original Message-----
> From: netdev-owner@vger.kernel.org [mailto:netdev-
> owner@vger.kernel.org] On Behalf Of Vladislav Zolotarov
> Sent: Tuesday, September 28, 2010 11:26 AM
> To: Ben Hutchings; David Miller
> Cc: netdev@vger.kernel.org; linux-net-drivers@solarflare.com; Eilon
> Greenstein
> Subject: RE: [PATCH net-next-2.6 04/17] bnx2x: Use
> netif_set_real_num_{rx,tx}_queues()
>
>
>
> > -----Original Message-----
> > From: netdev-owner@vger.kernel.org [mailto:netdev-
> > owner@vger.kernel.org] On Behalf Of Ben Hutchings
> > Sent: Monday, September 27, 2010 8:25 PM
> > To: David Miller
> > Cc: netdev@vger.kernel.org; linux-net-drivers@solarflare.com; Eilon
> > Greenstein
> > Subject: [PATCH net-next-2.6 04/17] bnx2x: Use
> > netif_set_real_num_{rx,tx}_queues()
> >
> > Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
> > ---
> > drivers/net/bnx2x/bnx2x_cmn.c | 6 ++++--
> > 1 files changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/bnx2x/bnx2x_cmn.c
> > b/drivers/net/bnx2x/bnx2x_cmn.c
> > index efc7be4..05c05a4 100644
> > --- a/drivers/net/bnx2x/bnx2x_cmn.c
> > +++ b/drivers/net/bnx2x/bnx2x_cmn.c
> > @@ -1207,8 +1207,8 @@ static int bnx2x_set_num_queues(struct bnx2x
> *bp)
> > bp->num_queues = 1;
> > break;
> > }
> > - bp->dev->real_num_tx_queues = bp->num_queues;
> > - return rc;
> > + netif_set_real_num_tx_queues(bp->dev, bp->num_queues);
> > + return netif_set_real_num_rx_queues(bp->dev, bp->num_queues);
> > }
> >
> > static void bnx2x_release_firmware(struct bnx2x *bp)
> > @@ -1240,6 +1240,8 @@ int bnx2x_nic_load(struct bnx2x *bp, int
> > load_mode)
> > bp->state = BNX2X_STATE_OPENING_WAIT4_LOAD;
> >
> > rc = bnx2x_set_num_queues(bp);
> > + if (rc)
> > + return rc;
> >
> > if (bnx2x_alloc_mem(bp)) {
> > bnx2x_free_irq(bp, true);
> > --
> > 1.7.2.1
> >
>
> This patch breaks our interrupt enablement flow. I'll send the new one
> that incorporates the netif_set_real_num_rx_queues() shortly.
Ben, I'm going to fix the bnx2x the way your patch would apply. I suspect this would probably require u to respin the bnx2x patch.
Sorry for the inconvenience.
Thanks,
vlad
>
> Thanks,
> vlad
>
> >
> >
> > --
> > Ben Hutchings, Senior Software Engineer, Solarflare Communications
> > Not speaking for my employer; that's the marketing department's job.
> > They asked us to note that Solarflare product names are trademarked.
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe netdev" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
>
> \x13��칻\x1c�&�~�&�\x18��+-��ݶ\x17��w��˛���m�ׯ�{ay�\x1dʇڙ�,j\r��f���h���z�\x1e�w���
>
> ���j:+v���w�j�m����\r����zZ+�����ݢj"��!�i
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: [PATCH net-next-2.6 04/17] bnx2x: Use netif_set_real_num_{rx,tx}_queues()
2010-09-28 12:59 ` Vladislav Zolotarov
@ 2010-09-28 17:39 ` David Miller
0 siblings, 0 replies; 28+ messages in thread
From: David Miller @ 2010-09-28 17:39 UTC (permalink / raw)
To: vladz; +Cc: bhutchings, netdev, linux-net-drivers, eilong
From: "Vladislav Zolotarov" <vladz@broadcom.com>
Date: Tue, 28 Sep 2010 05:59:15 -0700
> Ben, I'm going to fix the bnx2x the way your patch would apply. I
> suspect this would probably require u to respin the bnx2x patch.
> Sorry for the inconvenience.
Ben's patch is already in the tree, so you need to send me patches
relative to his.
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH net-next-2.6 05/17] cxgb3: Use netif_set_real_num_{rx,tx}_queues()
2010-09-27 18:23 [PATCH net-next-2.6 00/17] netdev: Fix queue count initialisation Ben Hutchings
` (3 preceding siblings ...)
2010-09-27 18:25 ` [PATCH net-next-2.6 04/17] bnx2x: " Ben Hutchings
@ 2010-09-27 18:25 ` Ben Hutchings
2010-09-27 18:25 ` [PATCH net-next-2.6 06/17] cxgb4: " Ben Hutchings
` (12 subsequent siblings)
17 siblings, 0 replies; 28+ messages in thread
From: Ben Hutchings @ 2010-09-27 18:25 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-net-drivers, Divy Le Ray
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/net/cxgb3/cxgb3_main.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index f9eede0..a04ce6a 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -1399,7 +1399,10 @@ static int cxgb_open(struct net_device *dev)
"Could not initialize offload capabilities\n");
}
- dev->real_num_tx_queues = pi->nqsets;
+ netif_set_real_num_tx_queues(dev, pi->nqsets);
+ err = netif_set_real_num_rx_queues(dev, pi->nqsets);
+ if (err)
+ return err;
link_start(dev);
t3_port_intr_enable(adapter, pi->port_id);
netif_tx_start_all_queues(dev);
--
1.7.2.1
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH net-next-2.6 06/17] cxgb4: Use netif_set_real_num_{rx,tx}_queues()
2010-09-27 18:23 [PATCH net-next-2.6 00/17] netdev: Fix queue count initialisation Ben Hutchings
` (4 preceding siblings ...)
2010-09-27 18:25 ` [PATCH net-next-2.6 05/17] cxgb3: " Ben Hutchings
@ 2010-09-27 18:25 ` Ben Hutchings
2010-09-27 18:26 ` [PATCH net-next-2.6 07/17] cxgb4vf: " Ben Hutchings
` (11 subsequent siblings)
17 siblings, 0 replies; 28+ messages in thread
From: Ben Hutchings @ 2010-09-27 18:25 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-net-drivers, Dimitris Michailidis
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/net/cxgb4/cxgb4_main.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/drivers/net/cxgb4/cxgb4_main.c b/drivers/net/cxgb4/cxgb4_main.c
index 75b9401..4fb08e3 100644
--- a/drivers/net/cxgb4/cxgb4_main.c
+++ b/drivers/net/cxgb4/cxgb4_main.c
@@ -2763,7 +2763,10 @@ static int cxgb_open(struct net_device *dev)
return err;
}
- dev->real_num_tx_queues = pi->nqsets;
+ netif_set_real_num_tx_queues(dev, pi->nqsets);
+ err = netif_set_real_num_rx_queues(dev, pi->nqsets);
+ if (err)
+ return err;
err = link_start(dev);
if (!err)
netif_tx_start_all_queues(dev);
--
1.7.2.1
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH net-next-2.6 07/17] cxgb4vf: Use netif_set_real_num_{rx,tx}_queues()
2010-09-27 18:23 [PATCH net-next-2.6 00/17] netdev: Fix queue count initialisation Ben Hutchings
` (5 preceding siblings ...)
2010-09-27 18:25 ` [PATCH net-next-2.6 06/17] cxgb4: " Ben Hutchings
@ 2010-09-27 18:26 ` Ben Hutchings
2010-09-27 18:27 ` [PATCH net-next-2.6 08/17] gianfar: Use netif_set_real_num_rx_queues() Ben Hutchings
` (10 subsequent siblings)
17 siblings, 0 replies; 28+ messages in thread
From: Ben Hutchings @ 2010-09-27 18:26 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-net-drivers, Casey Leedom
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/net/cxgb4vf/cxgb4vf_main.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/drivers/net/cxgb4vf/cxgb4vf_main.c b/drivers/net/cxgb4vf/cxgb4vf_main.c
index 7b6d07f..555ecc5 100644
--- a/drivers/net/cxgb4vf/cxgb4vf_main.c
+++ b/drivers/net/cxgb4vf/cxgb4vf_main.c
@@ -748,7 +748,10 @@ static int cxgb4vf_open(struct net_device *dev)
/*
* Note that this interface is up and start everything up ...
*/
- dev->real_num_tx_queues = pi->nqsets;
+ netif_set_real_num_tx_queues(dev, pi->nqsets);
+ err = netif_set_real_num_rx_queues(dev, pi->nqsets);
+ if (err)
+ return err;
set_bit(pi->port_id, &adapter->open_device_map);
link_start(dev);
netif_tx_start_all_queues(dev);
--
1.7.2.1
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH net-next-2.6 08/17] gianfar: Use netif_set_real_num_rx_queues()
2010-09-27 18:23 [PATCH net-next-2.6 00/17] netdev: Fix queue count initialisation Ben Hutchings
` (6 preceding siblings ...)
2010-09-27 18:26 ` [PATCH net-next-2.6 07/17] cxgb4vf: " Ben Hutchings
@ 2010-09-27 18:27 ` Ben Hutchings
2010-09-27 18:28 ` [PATCH net-next-2.6 09/17] igb: Use netif_set_real_num_{rx,tx}_queues() Ben Hutchings
` (9 subsequent siblings)
17 siblings, 0 replies; 28+ messages in thread
From: Ben Hutchings @ 2010-09-27 18:27 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-net-drivers, Anton Vorontsov
Do not set num_tx_queues or real_num_tx_queues, since
alloc_etherdev_mq() does that.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/net/gianfar.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index f30adbf..6180089 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -654,9 +654,8 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
priv->node = ofdev->dev.of_node;
priv->ndev = dev;
- dev->num_tx_queues = num_tx_qs;
- dev->real_num_tx_queues = num_tx_qs;
priv->num_tx_queues = num_tx_qs;
+ netif_set_real_num_rx_queues(dev, num_rx_qs);
priv->num_rx_queues = num_rx_qs;
priv->num_grps = 0x0;
--
1.7.2.1
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH net-next-2.6 09/17] igb: Use netif_set_real_num_{rx,tx}_queues()
2010-09-27 18:23 [PATCH net-next-2.6 00/17] netdev: Fix queue count initialisation Ben Hutchings
` (7 preceding siblings ...)
2010-09-27 18:27 ` [PATCH net-next-2.6 08/17] gianfar: Use netif_set_real_num_rx_queues() Ben Hutchings
@ 2010-09-27 18:28 ` Ben Hutchings
2010-09-27 18:28 ` [PATCH net-next-2.6 10/17] ixgbe: " Ben Hutchings
` (8 subsequent siblings)
17 siblings, 0 replies; 28+ messages in thread
From: Ben Hutchings @ 2010-09-27 18:28 UTC (permalink / raw)
To: David Miller
Cc: netdev, linux-net-drivers, e1000-devel, Jeff Kirsher,
Jesse Brandeburg, Bruce Allan, Alex Duyck, PJ Waskiewicz,
John Ronciak
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/net/igb/igb_main.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 0394ca9..55edcb7 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -988,7 +988,7 @@ static void igb_clear_interrupt_scheme(struct igb_adapter *adapter)
* Attempt to configure interrupts using the best available
* capabilities of the hardware and kernel.
**/
-static void igb_set_interrupt_capability(struct igb_adapter *adapter)
+static int igb_set_interrupt_capability(struct igb_adapter *adapter)
{
int err;
int numvecs, i;
@@ -1054,8 +1054,10 @@ msi_only:
if (!pci_enable_msi(adapter->pdev))
adapter->flags |= IGB_FLAG_HAS_MSI;
out:
- /* Notify the stack of the (possibly) reduced Tx Queue count. */
- adapter->netdev->real_num_tx_queues = adapter->num_tx_queues;
+ /* Notify the stack of the (possibly) reduced queue counts. */
+ netif_set_real_num_tx_queues(adapter->netdev, adapter->num_tx_queues);
+ return netif_set_real_num_rx_queues(adapter->netdev,
+ adapter->num_rx_queues);
}
/**
@@ -1154,7 +1156,9 @@ static int igb_init_interrupt_scheme(struct igb_adapter *adapter)
struct pci_dev *pdev = adapter->pdev;
int err;
- igb_set_interrupt_capability(adapter);
+ err = igb_set_interrupt_capability(adapter);
+ if (err)
+ return err;
err = igb_alloc_q_vectors(adapter);
if (err) {
--
1.7.2.1
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH net-next-2.6 10/17] ixgbe: Use netif_set_real_num_{rx,tx}_queues()
2010-09-27 18:23 [PATCH net-next-2.6 00/17] netdev: Fix queue count initialisation Ben Hutchings
` (8 preceding siblings ...)
2010-09-27 18:28 ` [PATCH net-next-2.6 09/17] igb: Use netif_set_real_num_{rx,tx}_queues() Ben Hutchings
@ 2010-09-27 18:28 ` Ben Hutchings
2010-09-27 18:29 ` [PATCH net-next-2.6 11/17] mlx4_en: " Ben Hutchings
` (7 subsequent siblings)
17 siblings, 0 replies; 28+ messages in thread
From: Ben Hutchings @ 2010-09-27 18:28 UTC (permalink / raw)
To: David Miller
Cc: netdev, linux-net-drivers, PJ Waskiewicz, John Ronciak,
e1000-devel, Jeff Kirsher, Jesse Brandeburg, Bruce Allan,
Alex Duyck
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/net/ixgbe/ixgbe_main.c | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 4e0ce91..c35185c 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -4088,7 +4088,7 @@ static inline bool ixgbe_set_sriov_queues(struct ixgbe_adapter *adapter)
* fallthrough conditions.
*
**/
-static void ixgbe_set_num_queues(struct ixgbe_adapter *adapter)
+static int ixgbe_set_num_queues(struct ixgbe_adapter *adapter)
{
/* Start with base case */
adapter->num_rx_queues = 1;
@@ -4097,7 +4097,7 @@ static void ixgbe_set_num_queues(struct ixgbe_adapter *adapter)
adapter->num_rx_queues_per_pool = 1;
if (ixgbe_set_sriov_queues(adapter))
- return;
+ goto done;
#ifdef IXGBE_FCOE
if (ixgbe_set_fcoe_queues(adapter))
@@ -4120,8 +4120,10 @@ static void ixgbe_set_num_queues(struct ixgbe_adapter *adapter)
adapter->num_tx_queues = 1;
done:
- /* Notify the stack of the (possibly) reduced Tx Queue count. */
+ /* Notify the stack of the (possibly) reduced queue counts. */
netif_set_real_num_tx_queues(adapter->netdev, adapter->num_tx_queues);
+ return netif_set_real_num_rx_queues(adapter->netdev,
+ adapter->num_rx_queues);
}
static void ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter,
@@ -4550,7 +4552,9 @@ static int ixgbe_set_interrupt_capability(struct ixgbe_adapter *adapter)
if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)
ixgbe_disable_sriov(adapter);
- ixgbe_set_num_queues(adapter);
+ err = ixgbe_set_num_queues(adapter);
+ if (err)
+ return err;
err = pci_enable_msi(adapter->pdev);
if (!err) {
@@ -4675,7 +4679,9 @@ int ixgbe_init_interrupt_scheme(struct ixgbe_adapter *adapter)
int err;
/* Number of supported queues */
- ixgbe_set_num_queues(adapter);
+ err = ixgbe_set_num_queues(adapter);
+ if (err)
+ return err;
err = ixgbe_set_interrupt_capability(adapter);
if (err) {
--
1.7.2.1
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH net-next-2.6 11/17] mlx4_en: Use netif_set_real_num_{rx,tx}_queues()
2010-09-27 18:23 [PATCH net-next-2.6 00/17] netdev: Fix queue count initialisation Ben Hutchings
` (9 preceding siblings ...)
2010-09-27 18:28 ` [PATCH net-next-2.6 10/17] ixgbe: " Ben Hutchings
@ 2010-09-27 18:29 ` Ben Hutchings
2010-09-27 18:30 ` [PATCH net-next-2.6 12/17] mv643xx_eth: " Ben Hutchings
` (6 subsequent siblings)
17 siblings, 0 replies; 28+ messages in thread
From: Ben Hutchings @ 2010-09-27 18:29 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-net-drivers, Yevgeny Petrilin
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/net/mlx4/en_netdev.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/net/mlx4/en_netdev.c b/drivers/net/mlx4/en_netdev.c
index 411bda5..79478bd 100644
--- a/drivers/net/mlx4/en_netdev.c
+++ b/drivers/net/mlx4/en_netdev.c
@@ -1025,7 +1025,8 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
*/
dev->netdev_ops = &mlx4_netdev_ops;
dev->watchdog_timeo = MLX4_EN_WATCHDOG_TIMEOUT;
- dev->real_num_tx_queues = MLX4_EN_NUM_TX_RINGS;
+ netif_set_real_num_tx_queues(dev, priv->tx_ring_num);
+ netif_set_real_num_rx_queues(dev, priv->rx_ring_num);
SET_ETHTOOL_OPS(dev, &mlx4_en_ethtool_ops);
--
1.7.2.1
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH net-next-2.6 12/17] mv643xx_eth: Use netif_set_real_num_{rx,tx}_queues()
2010-09-27 18:23 [PATCH net-next-2.6 00/17] netdev: Fix queue count initialisation Ben Hutchings
` (10 preceding siblings ...)
2010-09-27 18:29 ` [PATCH net-next-2.6 11/17] mlx4_en: " Ben Hutchings
@ 2010-09-27 18:30 ` Ben Hutchings
2010-09-28 4:18 ` Lennert Buytenhek
2010-09-27 18:30 ` [PATCH net-next-2.6 13/17] myri10ge: " Ben Hutchings
` (5 subsequent siblings)
17 siblings, 1 reply; 28+ messages in thread
From: Ben Hutchings @ 2010-09-27 18:30 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-net-drivers, Lennert Buytenhek
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/net/mv643xx_eth.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 2d488ab..dd2b6a7 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -2901,7 +2901,8 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
mp->dev = dev;
set_params(mp, pd);
- dev->real_num_tx_queues = mp->txq_count;
+ netif_set_real_num_tx_queues(dev, mp->txq_count);
+ netif_set_real_num_rx_queues(dev, mp->rxq_count);
if (pd->phy_addr != MV643XX_ETH_PHY_NONE)
mp->phy = phy_scan(mp, pd->phy_addr);
--
1.7.2.1
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH net-next-2.6 13/17] myri10ge: Use netif_set_real_num_{rx,tx}_queues()
2010-09-27 18:23 [PATCH net-next-2.6 00/17] netdev: Fix queue count initialisation Ben Hutchings
` (11 preceding siblings ...)
2010-09-27 18:30 ` [PATCH net-next-2.6 12/17] mv643xx_eth: " Ben Hutchings
@ 2010-09-27 18:30 ` Ben Hutchings
2010-09-27 18:30 ` [PATCH net-next-2.6 14/17] niu: " Ben Hutchings
` (4 subsequent siblings)
17 siblings, 0 replies; 28+ messages in thread
From: Ben Hutchings @ 2010-09-27 18:30 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-net-drivers, Andrew Gallatin, Brice Goglin
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/net/myri10ge/myri10ge.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 4f3a3c0..3ad1a21 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -990,7 +990,7 @@ static int myri10ge_reset(struct myri10ge_priv *mgp)
* RX queues, so if we get an error, first retry using a
* single TX queue before giving up */
if (status != 0 && mgp->dev->real_num_tx_queues > 1) {
- mgp->dev->real_num_tx_queues = 1;
+ netif_set_real_num_tx_queues(mgp->dev, 1);
cmd.data0 = mgp->num_slices;
cmd.data1 = MXGEFW_SLICE_INTR_MODE_ONE_PER_SLICE;
status = myri10ge_send_cmd(mgp,
@@ -3923,7 +3923,8 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
dev_err(&pdev->dev, "failed to alloc slice state\n");
goto abort_with_firmware;
}
- netdev->real_num_tx_queues = mgp->num_slices;
+ netif_set_real_num_tx_queues(netdev, mgp->num_slices);
+ netif_set_real_num_rx_queues(netdev, mgp->num_slices);
status = myri10ge_reset(mgp);
if (status != 0) {
dev_err(&pdev->dev, "failed reset\n");
--
1.7.2.1
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH net-next-2.6 14/17] niu: Use netif_set_real_num_{rx,tx}_queues()
2010-09-27 18:23 [PATCH net-next-2.6 00/17] netdev: Fix queue count initialisation Ben Hutchings
` (12 preceding siblings ...)
2010-09-27 18:30 ` [PATCH net-next-2.6 13/17] myri10ge: " Ben Hutchings
@ 2010-09-27 18:30 ` Ben Hutchings
2010-09-27 18:31 ` [PATCH net-next-2.6 15/17] sfc: " Ben Hutchings
` (3 subsequent siblings)
17 siblings, 0 replies; 28+ messages in thread
From: Ben Hutchings @ 2010-09-27 18:30 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-net-drivers
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/net/niu.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index 4cd9242..c0437fd 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -4501,7 +4501,8 @@ static int niu_alloc_channels(struct niu *np)
np->num_rx_rings = parent->rxchan_per_port[port];
np->num_tx_rings = parent->txchan_per_port[port];
- np->dev->real_num_tx_queues = np->num_tx_rings;
+ netif_set_real_num_rx_queues(np->dev, np->num_rx_rings);
+ netif_set_real_num_tx_queues(np->dev, np->num_tx_rings);
np->rx_rings = kcalloc(np->num_rx_rings, sizeof(struct rx_ring_info),
GFP_KERNEL);
--
1.7.2.1
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH net-next-2.6 15/17] sfc: Use netif_set_real_num_{rx,tx}_queues()
2010-09-27 18:23 [PATCH net-next-2.6 00/17] netdev: Fix queue count initialisation Ben Hutchings
` (13 preceding siblings ...)
2010-09-27 18:30 ` [PATCH net-next-2.6 14/17] niu: " Ben Hutchings
@ 2010-09-27 18:31 ` Ben Hutchings
2010-09-27 18:32 ` [PATCH net-next-2.6 16/17] tg3: " Ben Hutchings
` (2 subsequent siblings)
17 siblings, 0 replies; 28+ messages in thread
From: Ben Hutchings @ 2010-09-27 18:31 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-net-drivers
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/net/sfc/efx.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
index 5be71f4..fa6e020 100644
--- a/drivers/net/sfc/efx.c
+++ b/drivers/net/sfc/efx.c
@@ -1315,7 +1315,8 @@ static int efx_probe_nic(struct efx_nic *efx)
efx->rx_indir_table[i] = i % efx->n_rx_channels;
efx_set_channels(efx);
- efx->net_dev->real_num_tx_queues = efx->n_tx_channels;
+ netif_set_real_num_tx_queues(efx->net_dev, efx->n_tx_channels);
+ netif_set_real_num_rx_queues(efx->net_dev, efx->n_rx_channels);
/* Initialise the interrupt moderation settings */
efx_init_irq_moderation(efx, tx_irq_mod_usec, rx_irq_mod_usec, true);
--
1.7.2.1
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 28+ messages in thread* [PATCH net-next-2.6 16/17] tg3: Use netif_set_real_num_{rx,tx}_queues()
2010-09-27 18:23 [PATCH net-next-2.6 00/17] netdev: Fix queue count initialisation Ben Hutchings
` (14 preceding siblings ...)
2010-09-27 18:31 ` [PATCH net-next-2.6 15/17] sfc: " Ben Hutchings
@ 2010-09-27 18:32 ` Ben Hutchings
2010-09-27 21:41 ` Matt Carlson
2010-09-27 18:32 ` [PATCH net-next-2.6 17/17] 8021q: Use netif_copy_real_num_queues() to set queue counts Ben Hutchings
2010-09-28 5:12 ` [PATCH net-next-2.6 00/17] netdev: Fix queue count initialisation David Miller
17 siblings, 1 reply; 28+ messages in thread
From: Ben Hutchings @ 2010-09-27 18:32 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-net-drivers, Matt Carlson, Michael Chan
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
This *always* sets real_num_tx_queues to 1, so this could be improved.
For now, do a simple conversion.
Ben.
drivers/net/tg3.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index fdb438d..ca41140 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -8821,7 +8821,11 @@ static bool tg3_enable_msix(struct tg3 *tp)
for (i = 0; i < tp->irq_max; i++)
tp->napi[i].irq_vec = msix_ent[i].vector;
- tp->dev->real_num_tx_queues = 1;
+ netif_set_real_num_tx_queues(tp->dev, 1);
+ if (netif_set_real_num_rx_queues(tp->dev, tp->irq_cnt)) {
+ pci_disable_msix(tp->pdev);
+ return false;
+ }
if (tp->irq_cnt > 1)
tp->tg3_flags3 |= TG3_FLG3_ENABLE_RSS;
@@ -8856,7 +8860,7 @@ defcfg:
if (!(tp->tg3_flags2 & TG3_FLG2_USING_MSIX)) {
tp->irq_cnt = 1;
tp->napi[0].irq_vec = tp->pdev->irq;
- tp->dev->real_num_tx_queues = 1;
+ netif_set_real_num_tx_queues(tp->dev, 1);
}
}
--
1.7.2.1
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 28+ messages in thread* Re: [PATCH net-next-2.6 16/17] tg3: Use netif_set_real_num_{rx,tx}_queues()
2010-09-27 18:32 ` [PATCH net-next-2.6 16/17] tg3: " Ben Hutchings
@ 2010-09-27 21:41 ` Matt Carlson
2010-09-27 21:44 ` Matt Carlson
0 siblings, 1 reply; 28+ messages in thread
From: Matt Carlson @ 2010-09-27 21:41 UTC (permalink / raw)
To: Ben Hutchings
Cc: David Miller, netdev@vger.kernel.org,
linux-net-drivers@solarflare.com, Matthew Carlson, Michael Chan
On Mon, Sep 27, 2010 at 11:32:37AM -0700, Ben Hutchings wrote:
> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
> ---
> This *always* sets real_num_tx_queues to 1, so this could be improved.
> For now, do a simple conversion.
>
> Ben.
>
> drivers/net/tg3.c | 8 ++++++--
> 1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
> index fdb438d..ca41140 100644
> --- a/drivers/net/tg3.c
> +++ b/drivers/net/tg3.c
> @@ -8821,7 +8821,11 @@ static bool tg3_enable_msix(struct tg3 *tp)
> for (i = 0; i < tp->irq_max; i++)
> tp->napi[i].irq_vec = msix_ent[i].vector;
>
> - tp->dev->real_num_tx_queues = 1;
> + netif_set_real_num_tx_queues(tp->dev, 1);
> + if (netif_set_real_num_rx_queues(tp->dev, tp->irq_cnt)) {
This should be tp->irq_cnt - 1, not tp->irq_cnt. The first MSI-X vector
only handles link interrupts and device errors.
> + pci_disable_msix(tp->pdev);
> + return false;
> + }
> if (tp->irq_cnt > 1)
> tp->tg3_flags3 |= TG3_FLG3_ENABLE_RSS;
>
> @@ -8856,7 +8860,7 @@ defcfg:
> if (!(tp->tg3_flags2 & TG3_FLG2_USING_MSIX)) {
> tp->irq_cnt = 1;
> tp->napi[0].irq_vec = tp->pdev->irq;
> - tp->dev->real_num_tx_queues = 1;
> + netif_set_real_num_tx_queues(tp->dev, 1);
> }
> }
>
> --
> 1.7.2.1
>
>
>
> --
> Ben Hutchings, Senior Software Engineer, Solarflare Communications
> Not speaking for my employer; that's the marketing department's job.
> They asked us to note that Solarflare product names are trademarked.
>
>
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: [PATCH net-next-2.6 16/17] tg3: Use netif_set_real_num_{rx,tx}_queues()
2010-09-27 21:41 ` Matt Carlson
@ 2010-09-27 21:44 ` Matt Carlson
2010-09-28 5:13 ` David Miller
0 siblings, 1 reply; 28+ messages in thread
From: Matt Carlson @ 2010-09-27 21:44 UTC (permalink / raw)
To: Matt Carlson
Cc: Ben Hutchings, David Miller, netdev@vger.kernel.org,
linux-net-drivers@solarflare.com, Michael Chan
On Mon, Sep 27, 2010 at 02:41:07PM -0700, Matt Carlson wrote:
> On Mon, Sep 27, 2010 at 11:32:37AM -0700, Ben Hutchings wrote:
> > Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
> > ---
> > This *always* sets real_num_tx_queues to 1, so this could be improved.
> > For now, do a simple conversion.
> >
> > Ben.
> >
> > drivers/net/tg3.c | 8 ++++++--
> > 1 files changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
> > index fdb438d..ca41140 100644
> > --- a/drivers/net/tg3.c
> > +++ b/drivers/net/tg3.c
> > @@ -8821,7 +8821,11 @@ static bool tg3_enable_msix(struct tg3 *tp)
> > for (i = 0; i < tp->irq_max; i++)
> > tp->napi[i].irq_vec = msix_ent[i].vector;
> >
> > - tp->dev->real_num_tx_queues = 1;
> > + netif_set_real_num_tx_queues(tp->dev, 1);
> > + if (netif_set_real_num_rx_queues(tp->dev, tp->irq_cnt)) {
>
> This should be tp->irq_cnt - 1, not tp->irq_cnt. The first MSI-X vector
> only handles link interrupts and device errors.
I need to correct myself. If the irq_cnt > 1, then it needs to be
tp->irq_cnt - 1. If the irq_cnt == 1, then it should be 1.
> > + pci_disable_msix(tp->pdev);
> > + return false;
> > + }
> > if (tp->irq_cnt > 1)
> > tp->tg3_flags3 |= TG3_FLG3_ENABLE_RSS;
> >
> > @@ -8856,7 +8860,7 @@ defcfg:
> > if (!(tp->tg3_flags2 & TG3_FLG2_USING_MSIX)) {
> > tp->irq_cnt = 1;
> > tp->napi[0].irq_vec = tp->pdev->irq;
> > - tp->dev->real_num_tx_queues = 1;
> > + netif_set_real_num_tx_queues(tp->dev, 1);
> > }
> > }
> >
> > --
> > 1.7.2.1
> >
> >
> >
> > --
> > Ben Hutchings, Senior Software Engineer, Solarflare Communications
> > Not speaking for my employer; that's the marketing department's job.
> > They asked us to note that Solarflare product names are trademarked.
> >
> >
>
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: [PATCH net-next-2.6 16/17] tg3: Use netif_set_real_num_{rx,tx}_queues()
2010-09-27 21:44 ` Matt Carlson
@ 2010-09-28 5:13 ` David Miller
0 siblings, 0 replies; 28+ messages in thread
From: David Miller @ 2010-09-28 5:13 UTC (permalink / raw)
To: mcarlson; +Cc: bhutchings, netdev, linux-net-drivers, mchan
From: "Matt Carlson" <mcarlson@broadcom.com>
Date: Mon, 27 Sep 2010 14:44:16 -0700
> On Mon, Sep 27, 2010 at 02:41:07PM -0700, Matt Carlson wrote:
>> This should be tp->irq_cnt - 1, not tp->irq_cnt. The first MSI-X vector
>> only handles link interrupts and device errors.
>
> I need to correct myself. If the irq_cnt > 1, then it needs to be
> tp->irq_cnt - 1. If the irq_cnt == 1, then it should be 1.
I fixed this when I applied Ben's patch, thanks!
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH net-next-2.6 17/17] 8021q: Use netif_copy_real_num_queues() to set queue counts
2010-09-27 18:23 [PATCH net-next-2.6 00/17] netdev: Fix queue count initialisation Ben Hutchings
` (15 preceding siblings ...)
2010-09-27 18:32 ` [PATCH net-next-2.6 16/17] tg3: " Ben Hutchings
@ 2010-09-27 18:32 ` Ben Hutchings
2010-09-28 5:12 ` [PATCH net-next-2.6 00/17] netdev: Fix queue count initialisation David Miller
17 siblings, 0 replies; 28+ messages in thread
From: Ben Hutchings @ 2010-09-27 18:32 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-net-drivers, Patrick McHardy
This covers RX if necessary, as well as TX.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
net/8021q/vlan.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 2c6c2bd..25c2133 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -321,7 +321,7 @@ static int register_vlan_device(struct net_device *real_dev, u16 vlan_id)
if (new_dev == NULL)
return -ENOBUFS;
- new_dev->real_num_tx_queues = real_dev->real_num_tx_queues;
+ netif_copy_real_num_queues(new_dev, real_dev);
dev_net_set(new_dev, net);
/* need 4 bytes for extra VLAN header info,
* hope the underlying device can handle it.
--
1.7.2.1
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 28+ messages in thread* Re: [PATCH net-next-2.6 00/17] netdev: Fix queue count initialisation
2010-09-27 18:23 [PATCH net-next-2.6 00/17] netdev: Fix queue count initialisation Ben Hutchings
` (16 preceding siblings ...)
2010-09-27 18:32 ` [PATCH net-next-2.6 17/17] 8021q: Use netif_copy_real_num_queues() to set queue counts Ben Hutchings
@ 2010-09-28 5:12 ` David Miller
2010-09-28 12:02 ` Ben Hutchings
17 siblings, 1 reply; 28+ messages in thread
From: David Miller @ 2010-09-28 5:12 UTC (permalink / raw)
To: bhutchings; +Cc: netdev, linux-net-drivers
From: Ben Hutchings <bhutchings@solarflare.com>
Date: Mon, 27 Sep 2010 19:23:11 +0100
> This adds the functions:
> - netif_set_real_num_rx_queues() - set actual number of RX queues used
> - netif_copy_real_num_queues() - copy queue counts from another device
>
> and changes all drivers that currently set
> net_device::real_num_tx_queues to use netif_set_real_num_tx_queues()
> and/or these functions.
>
> The changes are compile-tested only, except that:
> - sfc and 8021q have been briefly tested
> - gianfar and mv643xx_eth have not been compiled, since they are
> platform-specific
>
> I noticed that the bonding driver sets its numbers of queues without
> regard to its slave devices. This makes some sense since a bond device
> initially has no slave devices. However, it seems to mean that a bond
> device can pass up an skb with an out-of-range queue_index, triggering a
> warning in get_rps_cpu().
Series applied, thanks Ben.
^ permalink raw reply [flat|nested] 28+ messages in thread* Re: [PATCH net-next-2.6 00/17] netdev: Fix queue count initialisation
2010-09-28 5:12 ` [PATCH net-next-2.6 00/17] netdev: Fix queue count initialisation David Miller
@ 2010-09-28 12:02 ` Ben Hutchings
2010-09-28 12:07 ` Eric Dumazet
0 siblings, 1 reply; 28+ messages in thread
From: Ben Hutchings @ 2010-09-28 12:02 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-net-drivers
On Mon, 2010-09-27 at 22:12 -0700, David Miller wrote:
> From: Ben Hutchings <bhutchings@solarflare.com>
> Date: Mon, 27 Sep 2010 19:23:11 +0100
>
> > This adds the functions:
> > - netif_set_real_num_rx_queues() - set actual number of RX queues used
> > - netif_copy_real_num_queues() - copy queue counts from another device
> >
> > and changes all drivers that currently set
> > net_device::real_num_tx_queues to use netif_set_real_num_tx_queues()
> > and/or these functions.
> >
> > The changes are compile-tested only, except that:
> > - sfc and 8021q have been briefly tested
> > - gianfar and mv643xx_eth have not been compiled, since they are
> > platform-specific
> >
> > I noticed that the bonding driver sets its numbers of queues without
> > regard to its slave devices. This makes some sense since a bond device
> > initially has no slave devices. However, it seems to mean that a bond
> > device can pass up an skb with an out-of-range queue_index, triggering a
> > warning in get_rps_cpu().
>
> Series applied, thanks Ben.
That seems a bit premature, as the driver maintainers have not had a
chance to review these. If it's not too late, perhaps you could roll
these changes back for now.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH net-next-2.6 00/17] netdev: Fix queue count initialisation
2010-09-28 12:02 ` Ben Hutchings
@ 2010-09-28 12:07 ` Eric Dumazet
0 siblings, 0 replies; 28+ messages in thread
From: Eric Dumazet @ 2010-09-28 12:07 UTC (permalink / raw)
To: Ben Hutchings; +Cc: David Miller, netdev, linux-net-drivers
Le mardi 28 septembre 2010 à 13:02 +0100, Ben Hutchings a écrit :
> That seems a bit premature, as the driver maintainers have not had a
> chance to review these. If it's not too late, perhaps you could roll
> these changes back for now.
I am afraid its not possible.
If you want to revert, please submit a patch.
However, changes should be small and we have some time before Linus
opens 2.6.37, dont you think ?
^ permalink raw reply [flat|nested] 28+ messages in thread