* [net-next-2.6 PATCH] net: netif_set_real_num_rx_queues may cap num_rx_queues at init time
@ 2010-10-04 22:00 John Fastabend
2010-10-05 5:35 ` Eric Dumazet
2010-10-07 6:16 ` Eric Dumazet
0 siblings, 2 replies; 16+ messages in thread
From: John Fastabend @ 2010-10-04 22:00 UTC (permalink / raw)
To: bhutchings, netdev; +Cc: john.r.fastabend, therbert
The logic for netif_set_real_num_rx_queues is the following,
netif_set_real_num_rx_queues(dev, rxq)
{
...
if (dev->reg_state == NETREG_REGISTERED) {
...
} else {
dev->num_rx_queues = rxq;
}
dev->real_num_rx_queues = rxq;
return 0;
}
Some drivers init path looks like the following,
alloc_etherdev_mq(priv_sz, max_num_queues_ever);
...
netif_set_real_num_rx_queues(dev, queues_to_use_now);
...
register_netdev(dev);
...
Because netif_set_real_num_rx_queues sets num_rx_queues if the
reg state is not NETREG_REGISTERED we end up with the incorrect
max number of rx queues. This patch proposes to remove the else
clause above so this does not occur. Also just reading the
function set_real_num it seems a bit unexpected that num_rx_queues
gets set.
CC: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
---
net/core/dev.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index a313bab..f78d996 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1592,8 +1592,6 @@ int netif_set_real_num_rx_queues(struct net_device *dev, unsigned int rxq)
rxq);
if (rc)
return rc;
- } else {
- dev->num_rx_queues = rxq;
}
dev->real_num_rx_queues = rxq;
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [net-next-2.6 PATCH] net: netif_set_real_num_rx_queues may cap num_rx_queues at init time 2010-10-04 22:00 [net-next-2.6 PATCH] net: netif_set_real_num_rx_queues may cap num_rx_queues at init time John Fastabend @ 2010-10-05 5:35 ` Eric Dumazet 2010-10-05 16:08 ` John Fastabend 2010-10-07 6:16 ` Eric Dumazet 1 sibling, 1 reply; 16+ messages in thread From: Eric Dumazet @ 2010-10-05 5:35 UTC (permalink / raw) To: John Fastabend; +Cc: bhutchings, netdev, therbert Le lundi 04 octobre 2010 à 15:00 -0700, John Fastabend a écrit : > The logic for netif_set_real_num_rx_queues is the following, > > netif_set_real_num_rx_queues(dev, rxq) > { > ... > if (dev->reg_state == NETREG_REGISTERED) { > ... > } else { > dev->num_rx_queues = rxq; > } > > dev->real_num_rx_queues = rxq; > return 0; > } > > Some drivers init path looks like the following, > > alloc_etherdev_mq(priv_sz, max_num_queues_ever); > ... > netif_set_real_num_rx_queues(dev, queues_to_use_now); > ... > register_netdev(dev); > ... > > Because netif_set_real_num_rx_queues sets num_rx_queues if the > reg state is not NETREG_REGISTERED we end up with the incorrect > max number of rx queues. This patch proposes to remove the else > clause above so this does not occur. Also just reading the > function set_real_num it seems a bit unexpected that num_rx_queues > gets set. > You dont tell why its "incorrect". Why should we keep num_rx_queues > real_num_rx_queues ? It creates /sys files, and Qdisc stuff for nothing... > CC: Ben Hutchings <bhutchings@solarflare.com> > > Signed-off-by: John Fastabend <john.r.fastabend@intel.com> > --- > > net/core/dev.c | 2 -- > 1 files changed, 0 insertions(+), 2 deletions(-) > > diff --git a/net/core/dev.c b/net/core/dev.c > index a313bab..f78d996 100644 > --- a/net/core/dev.c > +++ b/net/core/dev.c > @@ -1592,8 +1592,6 @@ int netif_set_real_num_rx_queues(struct net_device *dev, unsigned int rxq) > rxq); > if (rc) > return rc; > - } else { > - dev->num_rx_queues = rxq; > } > > dev->real_num_rx_queues = rxq; > > -- ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [net-next-2.6 PATCH] net: netif_set_real_num_rx_queues may cap num_rx_queues at init time 2010-10-05 5:35 ` Eric Dumazet @ 2010-10-05 16:08 ` John Fastabend 2010-10-05 16:34 ` Ben Hutchings 0 siblings, 1 reply; 16+ messages in thread From: John Fastabend @ 2010-10-05 16:08 UTC (permalink / raw) To: Eric Dumazet Cc: bhutchings@solarflare.com, netdev@vger.kernel.org, therbert@google.com On 10/4/2010 10:35 PM, Eric Dumazet wrote: > Le lundi 04 octobre 2010 à 15:00 -0700, John Fastabend a écrit : >> The logic for netif_set_real_num_rx_queues is the following, >> >> netif_set_real_num_rx_queues(dev, rxq) >> { >> ... >> if (dev->reg_state == NETREG_REGISTERED) { >> ... >> } else { >> dev->num_rx_queues = rxq; >> } >> >> dev->real_num_rx_queues = rxq; >> return 0; >> } >> >> Some drivers init path looks like the following, >> >> alloc_etherdev_mq(priv_sz, max_num_queues_ever); >> ... >> netif_set_real_num_rx_queues(dev, queues_to_use_now); >> ... >> register_netdev(dev); >> ... >> >> Because netif_set_real_num_rx_queues sets num_rx_queues if the >> reg state is not NETREG_REGISTERED we end up with the incorrect >> max number of rx queues. This patch proposes to remove the else >> clause above so this does not occur. Also just reading the >> function set_real_num it seems a bit unexpected that num_rx_queues >> gets set. >> > > You dont tell why its "incorrect". > OK that is a poor description. > Why should we keep num_rx_queues > real_num_rx_queues ? > If we do not ever need them then we should not keep them I agree. But having netif_set_real_num_rx_queues set something other then 'real_num_rx_queues' does not seem right to me at least. Also netif_set_real_num_tx_queues and netif_set_real_num_rx_queues have different behavior. It would be nice if this weren't the case but they allocate queues in two places. The drivers Ben modified seem to be split between these two flows alloc_etherdev_mq(priv_sz, max_num_queues_ever); register_netdev(dev); netif_set_real_num_rx_queues(dev, queues_to_use_now); and alloc_etherdev_mq(priv_sz, max_num_queues_ever); netif_set_real_num_rx_queues(dev, queues_to_use_now); register_netdev(dev); In the first case we never set 'num_rx_queues' because its after the register so that leaves the second case. All the remaining drivers except ixgbe, igb, and myri10ge know or could easily find out the number of rx queues at alloc_etherdev_mq and are really trying to explicitly set the num_rx_queues. Adding a num_rx_queues param to alloc_etherdev_mq might make more sense in this case. The myri10ge is querying the firmware which seems to be tangled up with the netdev priv space, but otherwise isn't using any new knowledge. And ixgbe/igb may end up capping the max number of queues because it is trying to set the number of queues it intends to use now not the max it will ever consume. My point with this patch is I do not see any cases where we really do not know the max number rx queues until after alloc_etherdev_mq() but before register_netdev(). The piece I missed is if a driver wants to set rx queues and tx queues separately they either need to explicitly set rx_num_queues or use netif_set_real_num_rx_queues before registering the netdev. This syntax seems error prone to me, and it would be better to set this in alloc_etherdev_mq(). But, maybe you disagree? So I can either go rework the ixgbe/igb init flow so it does what I want. Or add a parameter to alloc_etherdev_mq for rx queues, remove the netif_set_real_num_rx_queues where it is not needed and modify the drivers to use this interface. I like the second case because it makes the netif_set_real_num_[rx|tx}_queues() behave the same but could do the first just as easily. Thanks, John > It creates /sys files, and Qdisc stuff for nothing... > > > >> CC: Ben Hutchings <bhutchings@solarflare.com> >> >> Signed-off-by: John Fastabend <john.r.fastabend@intel.com> >> --- >> >> net/core/dev.c | 2 -- >> 1 files changed, 0 insertions(+), 2 deletions(-) >> >> diff --git a/net/core/dev.c b/net/core/dev.c >> index a313bab..f78d996 100644 >> --- a/net/core/dev.c >> +++ b/net/core/dev.c >> @@ -1592,8 +1592,6 @@ int netif_set_real_num_rx_queues(struct net_device *dev, unsigned int rxq) >> rxq); >> if (rc) >> return rc; >> - } else { >> - dev->num_rx_queues = rxq; >> } >> >> dev->real_num_rx_queues = rxq; >> >> -- > > ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [net-next-2.6 PATCH] net: netif_set_real_num_rx_queues may cap num_rx_queues at init time 2010-10-05 16:08 ` John Fastabend @ 2010-10-05 16:34 ` Ben Hutchings 2010-10-05 17:45 ` John Fastabend 0 siblings, 1 reply; 16+ messages in thread From: Ben Hutchings @ 2010-10-05 16:34 UTC (permalink / raw) To: John Fastabend; +Cc: Eric Dumazet, netdev@vger.kernel.org, therbert@google.com On Tue, 2010-10-05 at 09:08 -0700, John Fastabend wrote: > On 10/4/2010 10:35 PM, Eric Dumazet wrote: > > Le lundi 04 octobre 2010 à 15:00 -0700, John Fastabend a écrit : > >> The logic for netif_set_real_num_rx_queues is the following, > >> > >> netif_set_real_num_rx_queues(dev, rxq) > >> { > >> ... > >> if (dev->reg_state == NETREG_REGISTERED) { > >> ... > >> } else { > >> dev->num_rx_queues = rxq; > >> } > >> > >> dev->real_num_rx_queues = rxq; > >> return 0; > >> } > >> > >> Some drivers init path looks like the following, > >> > >> alloc_etherdev_mq(priv_sz, max_num_queues_ever); > >> ... > >> netif_set_real_num_rx_queues(dev, queues_to_use_now); > >> ... > >> register_netdev(dev); > >> ... > >> > >> Because netif_set_real_num_rx_queues sets num_rx_queues if the > >> reg state is not NETREG_REGISTERED we end up with the incorrect > >> max number of rx queues. This patch proposes to remove the else > >> clause above so this does not occur. Also just reading the > >> function set_real_num it seems a bit unexpected that num_rx_queues > >> gets set. > >> > > > > You dont tell why its "incorrect". > > > > OK that is a poor description. > > > Why should we keep num_rx_queues > real_num_rx_queues ? > > > > If we do not ever need them then we should not keep them I agree. > But having netif_set_real_num_rx_queues set something other then > 'real_num_rx_queues' does not seem right to me at least. Also > netif_set_real_num_tx_queues and netif_set_real_num_rx_queues have > different behavior. It would be nice if this weren't the case but > they allocate queues in two places. [...] I only did this to satisfy Eric's desire to reduce memory usage. However, I believe that there are currently no drivers that dynamically increase numbers of RX or TX queues. Until there are, there is not much point in removing this assignment to num_rx_queues. 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] 16+ messages in thread
* Re: [net-next-2.6 PATCH] net: netif_set_real_num_rx_queues may cap num_rx_queues at init time 2010-10-05 16:34 ` Ben Hutchings @ 2010-10-05 17:45 ` John Fastabend 2010-10-06 14:52 ` John Fastabend 0 siblings, 1 reply; 16+ messages in thread From: John Fastabend @ 2010-10-05 17:45 UTC (permalink / raw) To: Ben Hutchings; +Cc: Eric Dumazet, netdev@vger.kernel.org, therbert@google.com On 10/5/2010 9:34 AM, Ben Hutchings wrote: > On Tue, 2010-10-05 at 09:08 -0700, John Fastabend wrote: >> On 10/4/2010 10:35 PM, Eric Dumazet wrote: >>> Le lundi 04 octobre 2010 à 15:00 -0700, John Fastabend a écrit : >>>> The logic for netif_set_real_num_rx_queues is the following, >>>> >>>> netif_set_real_num_rx_queues(dev, rxq) >>>> { >>>> ... >>>> if (dev->reg_state == NETREG_REGISTERED) { >>>> ... >>>> } else { >>>> dev->num_rx_queues = rxq; >>>> } >>>> >>>> dev->real_num_rx_queues = rxq; >>>> return 0; >>>> } >>>> >>>> Some drivers init path looks like the following, >>>> >>>> alloc_etherdev_mq(priv_sz, max_num_queues_ever); >>>> ... >>>> netif_set_real_num_rx_queues(dev, queues_to_use_now); >>>> ... >>>> register_netdev(dev); >>>> ... >>>> >>>> Because netif_set_real_num_rx_queues sets num_rx_queues if the >>>> reg state is not NETREG_REGISTERED we end up with the incorrect >>>> max number of rx queues. This patch proposes to remove the else >>>> clause above so this does not occur. Also just reading the >>>> function set_real_num it seems a bit unexpected that num_rx_queues >>>> gets set. >>>> >>> >>> You dont tell why its "incorrect". >>> >> >> OK that is a poor description. >> >>> Why should we keep num_rx_queues > real_num_rx_queues ? >>> >> >> If we do not ever need them then we should not keep them I agree. >> But having netif_set_real_num_rx_queues set something other then >> 'real_num_rx_queues' does not seem right to me at least. Also >> netif_set_real_num_tx_queues and netif_set_real_num_rx_queues have >> different behavior. It would be nice if this weren't the case but >> they allocate queues in two places. > [...] > > I only did this to satisfy Eric's desire to reduce memory usage. > However, I believe that there are currently no drivers that dynamically > increase numbers of RX or TX queues. Until there are, there is not much > point in removing this assignment to num_rx_queues. > > Ben. > ixgbe increases the real_num_[rx|tx]_queues when FCoE or DCB is enabled. Also many of the drivers could increase the number of queues if they were given more interrupt vectors at some point. But, it is easy enough to patch ixgbe to not set the number of RX queues currently in use until after the device is registered. Which brings it inline with many of the other drivers. And then the drivers that are using it to explicitly set num_rx_queues do not need to change. Thanks, John ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [net-next-2.6 PATCH] net: netif_set_real_num_rx_queues may cap num_rx_queues at init time 2010-10-05 17:45 ` John Fastabend @ 2010-10-06 14:52 ` John Fastabend 2010-10-06 15:07 ` Ben Hutchings 2010-10-06 15:20 ` Eric Dumazet 0 siblings, 2 replies; 16+ messages in thread From: John Fastabend @ 2010-10-06 14:52 UTC (permalink / raw) To: Ben Hutchings; +Cc: Eric Dumazet, netdev@vger.kernel.org, therbert@google.com On 10/5/2010 10:45 AM, John Fastabend wrote: > On 10/5/2010 9:34 AM, Ben Hutchings wrote: >> On Tue, 2010-10-05 at 09:08 -0700, John Fastabend wrote: >>> On 10/4/2010 10:35 PM, Eric Dumazet wrote: >>>> Le lundi 04 octobre 2010 à 15:00 -0700, John Fastabend a écrit : >>>>> The logic for netif_set_real_num_rx_queues is the following, >>>>> >>>>> netif_set_real_num_rx_queues(dev, rxq) >>>>> { >>>>> ... >>>>> if (dev->reg_state == NETREG_REGISTERED) { >>>>> ... >>>>> } else { >>>>> dev->num_rx_queues = rxq; >>>>> } >>>>> >>>>> dev->real_num_rx_queues = rxq; >>>>> return 0; >>>>> } >>>>> >>>>> Some drivers init path looks like the following, >>>>> >>>>> alloc_etherdev_mq(priv_sz, max_num_queues_ever); >>>>> ... >>>>> netif_set_real_num_rx_queues(dev, queues_to_use_now); >>>>> ... >>>>> register_netdev(dev); >>>>> ... >>>>> >>>>> Because netif_set_real_num_rx_queues sets num_rx_queues if the >>>>> reg state is not NETREG_REGISTERED we end up with the incorrect >>>>> max number of rx queues. This patch proposes to remove the else >>>>> clause above so this does not occur. Also just reading the >>>>> function set_real_num it seems a bit unexpected that num_rx_queues >>>>> gets set. >>>>> >>>> >>>> You dont tell why its "incorrect". >>>> >>> >>> OK that is a poor description. >>> >>>> Why should we keep num_rx_queues > real_num_rx_queues ? >>>> >>> >>> If we do not ever need them then we should not keep them I agree. >>> But having netif_set_real_num_rx_queues set something other then >>> 'real_num_rx_queues' does not seem right to me at least. Also >>> netif_set_real_num_tx_queues and netif_set_real_num_rx_queues have >>> different behavior. It would be nice if this weren't the case but >>> they allocate queues in two places. >> [...] >> >> I only did this to satisfy Eric's desire to reduce memory usage. >> However, I believe that there are currently no drivers that dynamically >> increase numbers of RX or TX queues. Until there are, there is not much >> point in removing this assignment to num_rx_queues. >> >> Ben. >> > > ixgbe increases the real_num_[rx|tx]_queues when FCoE or DCB is enabled. > Also many of the drivers could increase the number of queues if they were > given more interrupt vectors at some point. If I update the handful drivers that use netif_set_real_num_rx_queues() before the netdevice is registered to explicitly set num_rx_queues this would address Eric's concerns and fix drivers that really only want to set real_num_rx_queue. Any thoughts? -- John ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [net-next-2.6 PATCH] net: netif_set_real_num_rx_queues may cap num_rx_queues at init time 2010-10-06 14:52 ` John Fastabend @ 2010-10-06 15:07 ` Ben Hutchings 2010-10-06 15:20 ` John Fastabend 2010-10-06 15:23 ` Eric Dumazet 2010-10-06 15:20 ` Eric Dumazet 1 sibling, 2 replies; 16+ messages in thread From: Ben Hutchings @ 2010-10-06 15:07 UTC (permalink / raw) To: John Fastabend; +Cc: Eric Dumazet, netdev@vger.kernel.org, therbert@google.com On Wed, 2010-10-06 at 07:52 -0700, John Fastabend wrote: > On 10/5/2010 10:45 AM, John Fastabend wrote: > > On 10/5/2010 9:34 AM, Ben Hutchings wrote: > >> On Tue, 2010-10-05 at 09:08 -0700, John Fastabend wrote: > >>> On 10/4/2010 10:35 PM, Eric Dumazet wrote: [...] > >>>> Why should we keep num_rx_queues > real_num_rx_queues ? > >>>> > >>> > >>> If we do not ever need them then we should not keep them I agree. > >>> But having netif_set_real_num_rx_queues set something other then > >>> 'real_num_rx_queues' does not seem right to me at least. Also > >>> netif_set_real_num_tx_queues and netif_set_real_num_rx_queues have > >>> different behavior. It would be nice if this weren't the case but > >>> they allocate queues in two places. > >> [...] > >> > >> I only did this to satisfy Eric's desire to reduce memory usage. > >> However, I believe that there are currently no drivers that dynamically > >> increase numbers of RX or TX queues. Until there are, there is not much > >> point in removing this assignment to num_rx_queues. > >> > >> Ben. > >> > > > > ixgbe increases the real_num_[rx|tx]_queues when FCoE or DCB is enabled. > > Also many of the drivers could increase the number of queues if they were > > given more interrupt vectors at some point. > > > If I update the handful drivers that use netif_set_real_num_rx_queues() > before the netdevice is registered to explicitly set num_rx_queues this > would address Eric's concerns and fix drivers that really only want to set > real_num_rx_queue. > > Any thoughts? Don't add assignments to num_rx_queues. If it's useful to increase the number of RX queues later then just remove the assignment to num_rx_queues from netif_set_real_num_rx_queues() and be done with it. The waste of memory is minimal now that we only allocate kobjects for real_num_rx_queues. 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] 16+ messages in thread
* Re: [net-next-2.6 PATCH] net: netif_set_real_num_rx_queues may cap num_rx_queues at init time 2010-10-06 15:07 ` Ben Hutchings @ 2010-10-06 15:20 ` John Fastabend 2010-10-06 15:23 ` Eric Dumazet 1 sibling, 0 replies; 16+ messages in thread From: John Fastabend @ 2010-10-06 15:20 UTC (permalink / raw) To: Ben Hutchings; +Cc: Eric Dumazet, netdev@vger.kernel.org, therbert@google.com On 10/6/2010 8:07 AM, Ben Hutchings wrote: > On Wed, 2010-10-06 at 07:52 -0700, John Fastabend wrote: >> On 10/5/2010 10:45 AM, John Fastabend wrote: >>> On 10/5/2010 9:34 AM, Ben Hutchings wrote: >>>> On Tue, 2010-10-05 at 09:08 -0700, John Fastabend wrote: >>>>> On 10/4/2010 10:35 PM, Eric Dumazet wrote: > [...] >>>>>> Why should we keep num_rx_queues > real_num_rx_queues ? >>>>>> >>>>> >>>>> If we do not ever need them then we should not keep them I agree. >>>>> But having netif_set_real_num_rx_queues set something other then >>>>> 'real_num_rx_queues' does not seem right to me at least. Also >>>>> netif_set_real_num_tx_queues and netif_set_real_num_rx_queues have >>>>> different behavior. It would be nice if this weren't the case but >>>>> they allocate queues in two places. >>>> [...] >>>> >>>> I only did this to satisfy Eric's desire to reduce memory usage. >>>> However, I believe that there are currently no drivers that dynamically >>>> increase numbers of RX or TX queues. Until there are, there is not much >>>> point in removing this assignment to num_rx_queues. >>>> >>>> Ben. >>>> >>> >>> ixgbe increases the real_num_[rx|tx]_queues when FCoE or DCB is enabled. >>> Also many of the drivers could increase the number of queues if they were >>> given more interrupt vectors at some point. >> >> >> If I update the handful drivers that use netif_set_real_num_rx_queues() >> before the netdevice is registered to explicitly set num_rx_queues this >> would address Eric's concerns and fix drivers that really only want to set >> real_num_rx_queue. >> >> Any thoughts? > > Don't add assignments to num_rx_queues. If it's useful to increase the > number of RX queues later then just remove the assignment to > num_rx_queues from netif_set_real_num_rx_queues() and be done with it. > The waste of memory is minimal now that we only allocate kobjects for > real_num_rx_queues. > > Ben. > OK Thanks Ben. I will get a better description on this and resend it. John. ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [net-next-2.6 PATCH] net: netif_set_real_num_rx_queues may cap num_rx_queues at init time 2010-10-06 15:07 ` Ben Hutchings 2010-10-06 15:20 ` John Fastabend @ 2010-10-06 15:23 ` Eric Dumazet 2010-10-06 15:31 ` Ben Hutchings 1 sibling, 1 reply; 16+ messages in thread From: Eric Dumazet @ 2010-10-06 15:23 UTC (permalink / raw) To: Ben Hutchings; +Cc: John Fastabend, netdev@vger.kernel.org, therbert@google.com Le mercredi 06 octobre 2010 à 16:07 +0100, Ben Hutchings a écrit : > The waste of memory is minimal now that we only allocate kobjects for > real_num_rx_queues. Thats strange, here with tg3 (and mono queue device) : 0a:04.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5715S Gigabit Ethernet (rev a3) grep . /sys/class/net/eth2/queues/rx-*/rps_cpus /sys/class/net/eth2/queues/rx-0/rps_cpus:00000000 /sys/class/net/eth2/queues/rx-1/rps_cpus:00000000 /sys/class/net/eth2/queues/rx-2/rps_cpus:00000000 /sys/class/net/eth2/queues/rx-3/rps_cpus:00000000 /sys/class/net/eth2/queues/rx-4/rps_cpus:00000000 ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [net-next-2.6 PATCH] net: netif_set_real_num_rx_queues may cap num_rx_queues at init time 2010-10-06 15:23 ` Eric Dumazet @ 2010-10-06 15:31 ` Ben Hutchings 2010-10-06 18:14 ` Matt Carlson 0 siblings, 1 reply; 16+ messages in thread From: Ben Hutchings @ 2010-10-06 15:31 UTC (permalink / raw) To: Eric Dumazet, Matt Carlson Cc: John Fastabend, netdev@vger.kernel.org, therbert@google.com On Wed, 2010-10-06 at 17:23 +0200, Eric Dumazet wrote: > Le mercredi 06 octobre 2010 à 16:07 +0100, Ben Hutchings a écrit : > > > The waste of memory is minimal now that we only allocate kobjects for > > real_num_rx_queues. > > Thats strange, here with tg3 (and mono queue device) : > > 0a:04.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5715S > Gigabit Ethernet (rev a3) > > grep . /sys/class/net/eth2/queues/rx-*/rps_cpus > /sys/class/net/eth2/queues/rx-0/rps_cpus:00000000 > /sys/class/net/eth2/queues/rx-1/rps_cpus:00000000 > /sys/class/net/eth2/queues/rx-2/rps_cpus:00000000 > /sys/class/net/eth2/queues/rx-3/rps_cpus:00000000 > /sys/class/net/eth2/queues/rx-4/rps_cpus:00000000 It looks like I missed a necessary call to netif_set_real_num_rx_queues() in tg3. I suggest that Matt should check and correct this since I got the numbers wrong last time. 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] 16+ messages in thread
* Re: [net-next-2.6 PATCH] net: netif_set_real_num_rx_queues may cap num_rx_queues at init time 2010-10-06 15:31 ` Ben Hutchings @ 2010-10-06 18:14 ` Matt Carlson 2010-10-06 18:49 ` Eric Dumazet 0 siblings, 1 reply; 16+ messages in thread From: Matt Carlson @ 2010-10-06 18:14 UTC (permalink / raw) To: Ben Hutchings Cc: Eric Dumazet, Matthew Carlson, John Fastabend, netdev@vger.kernel.org, therbert@google.com On Wed, Oct 06, 2010 at 08:31:45AM -0700, Ben Hutchings wrote: > On Wed, 2010-10-06 at 17:23 +0200, Eric Dumazet wrote: > > Le mercredi 06 octobre 2010 ?? 16:07 +0100, Ben Hutchings a ??crit : > > > > > The waste of memory is minimal now that we only allocate kobjects for > > > real_num_rx_queues. > > > > Thats strange, here with tg3 (and mono queue device) : > > > > 0a:04.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5715S > > Gigabit Ethernet (rev a3) > > > > grep . /sys/class/net/eth2/queues/rx-*/rps_cpus > > /sys/class/net/eth2/queues/rx-0/rps_cpus:00000000 > > /sys/class/net/eth2/queues/rx-1/rps_cpus:00000000 > > /sys/class/net/eth2/queues/rx-2/rps_cpus:00000000 > > /sys/class/net/eth2/queues/rx-3/rps_cpus:00000000 > > /sys/class/net/eth2/queues/rx-4/rps_cpus:00000000 > > It looks like I missed a necessary call to > netif_set_real_num_rx_queues() in tg3. I suggest that Matt should check > and correct this since I got the numbers wrong last time. Yes. We were missing a call to this function in the legacy case. [PATCH net-next] tg3: Set real_num_rx_queues for non-multiq devs Commit 2ddaad397c47de012dfb956b0c05540da1a0dde5 entitled "tg3: Use netif_set_real_num_{rx,tx}_queues()" added a new call to netif_set_real_num_rx_queues in tg3_enable_msix(). This call also needs to be added to the legacy path to correctly reflect the actual number of rx queues. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> --- drivers/net/tg3.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 16e1a95..e5b9ec5 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -8906,6 +8906,7 @@ defcfg: tp->irq_cnt = 1; tp->napi[0].irq_vec = tp->pdev->irq; netif_set_real_num_tx_queues(tp->dev, 1); + netif_set_real_num_rx_queues(tp->dev, 1); } } -- 1.7.2.2 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [net-next-2.6 PATCH] net: netif_set_real_num_rx_queues may cap num_rx_queues at init time 2010-10-06 18:14 ` Matt Carlson @ 2010-10-06 18:49 ` Eric Dumazet 2010-10-06 20:41 ` David Miller 0 siblings, 1 reply; 16+ messages in thread From: Eric Dumazet @ 2010-10-06 18:49 UTC (permalink / raw) To: Matt Carlson Cc: Ben Hutchings, John Fastabend, netdev@vger.kernel.org, therbert@google.com Le mercredi 06 octobre 2010 à 11:14 -0700, Matt Carlson a écrit : > Yes. We were missing a call to this function in the legacy case. > > > [PATCH net-next] tg3: Set real_num_rx_queues for non-multiq devs > > Commit 2ddaad397c47de012dfb956b0c05540da1a0dde5 entitled "tg3: Use > netif_set_real_num_{rx,tx}_queues()" added a new call to > netif_set_real_num_rx_queues in tg3_enable_msix(). This call also needs > to be added to the legacy path to correctly reflect the actual number of > rx queues. > > Signed-off-by: Matt Carlson <mcarlson@broadcom.com> > --- > drivers/net/tg3.c | 1 + > 1 files changed, 1 insertions(+), 0 deletions(-) > > diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c > index 16e1a95..e5b9ec5 100644 > --- a/drivers/net/tg3.c > +++ b/drivers/net/tg3.c > @@ -8906,6 +8906,7 @@ defcfg: > tp->irq_cnt = 1; > tp->napi[0].irq_vec = tp->pdev->irq; > netif_set_real_num_tx_queues(tp->dev, 1); > + netif_set_real_num_rx_queues(tp->dev, 1); > } > } > Thanks, this fixed the thing for me, once device is UP # insmod drivers/net/tg3.ko # grep . /sys/class/net/eth3/queues/*/rps_cpus /sys/class/net/eth3/queues/rx-0/rps_cpus:00000000 /sys/class/net/eth3/queues/rx-1/rps_cpus:00000000 /sys/class/net/eth3/queues/rx-2/rps_cpus:00000000 /sys/class/net/eth3/queues/rx-3/rps_cpus:00000000 /sys/class/net/eth3/queues/rx-4/rps_cpus:00000000 # echo ff >/sys/class/net/eth3/queues/rx-2/rps_cpus # grep . /sys/class/net/eth3/queues/*/rps_cpus /sys/class/net/eth3/queues/rx-0/rps_cpus:00000000 /sys/class/net/eth3/queues/rx-1/rps_cpus:00000000 /sys/class/net/eth3/queues/rx-2/rps_cpus:000000ff /sys/class/net/eth3/queues/rx-3/rps_cpus:00000000 /sys/class/net/eth3/queues/rx-4/rps_cpus:00000000 # ifconfig eth3 up # grep . /sys/class/net/eth3/queues/*/rps_cpus 00000000 Acked-by: Eric Dumazet <eric.dumazet@gmail.com> ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [net-next-2.6 PATCH] net: netif_set_real_num_rx_queues may cap num_rx_queues at init time 2010-10-06 18:49 ` Eric Dumazet @ 2010-10-06 20:41 ` David Miller 0 siblings, 0 replies; 16+ messages in thread From: David Miller @ 2010-10-06 20:41 UTC (permalink / raw) To: eric.dumazet; +Cc: mcarlson, bhutchings, john.r.fastabend, netdev, therbert From: Eric Dumazet <eric.dumazet@gmail.com> Date: Wed, 06 Oct 2010 20:49:05 +0200 > Le mercredi 06 octobre 2010 à 11:14 -0700, Matt Carlson a écrit : > >> Yes. We were missing a call to this function in the legacy case. >> >> >> [PATCH net-next] tg3: Set real_num_rx_queues for non-multiq devs >> >> Commit 2ddaad397c47de012dfb956b0c05540da1a0dde5 entitled "tg3: Use >> netif_set_real_num_{rx,tx}_queues()" added a new call to >> netif_set_real_num_rx_queues in tg3_enable_msix(). This call also needs >> to be added to the legacy path to correctly reflect the actual number of >> rx queues. >> >> Signed-off-by: Matt Carlson <mcarlson@broadcom.com> ... > Acked-by: Eric Dumazet <eric.dumazet@gmail.com> Applied, thanks everyone. ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [net-next-2.6 PATCH] net: netif_set_real_num_rx_queues may cap num_rx_queues at init time 2010-10-06 14:52 ` John Fastabend 2010-10-06 15:07 ` Ben Hutchings @ 2010-10-06 15:20 ` Eric Dumazet 1 sibling, 0 replies; 16+ messages in thread From: Eric Dumazet @ 2010-10-06 15:20 UTC (permalink / raw) To: John Fastabend; +Cc: Ben Hutchings, netdev@vger.kernel.org, therbert@google.com Le mercredi 06 octobre 2010 à 07:52 -0700, John Fastabend a écrit : > If I update the handful drivers that use netif_set_real_num_rx_queues() > before the netdevice is registered to explicitly set num_rx_queues this > would address Eric's concerns and fix drivers that really only want to set > real_num_rx_queue. > John, it seems current API is not very clean/orthogonal. If you believe a driver can increase real_num_rx_queue, then we should apply your patch, and refine API if necessary. We now allocate rx queues in register_netdevice(), maybe we should do the same for tx queues. ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [net-next-2.6 PATCH] net: netif_set_real_num_rx_queues may cap num_rx_queues at init time 2010-10-04 22:00 [net-next-2.6 PATCH] net: netif_set_real_num_rx_queues may cap num_rx_queues at init time John Fastabend 2010-10-05 5:35 ` Eric Dumazet @ 2010-10-07 6:16 ` Eric Dumazet 2010-10-07 6:35 ` David Miller 1 sibling, 1 reply; 16+ messages in thread From: Eric Dumazet @ 2010-10-07 6:16 UTC (permalink / raw) To: John Fastabend; +Cc: bhutchings, netdev, therbert Le lundi 04 octobre 2010 à 15:00 -0700, John Fastabend a écrit : > The logic for netif_set_real_num_rx_queues is the following, > ... > Because netif_set_real_num_rx_queues sets num_rx_queues if the > reg state is not NETREG_REGISTERED we end up with the incorrect > max number of rx queues. This patch proposes to remove the else > clause above so this does not occur. Also just reading the > function set_real_num it seems a bit unexpected that num_rx_queues > gets set. > > CC: Ben Hutchings <bhutchings@solarflare.com> > > Signed-off-by: John Fastabend <john.r.fastabend@intel.com> > --- Acked-by: Eric Dumazet <eric.dumazet@gmail.com> ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [net-next-2.6 PATCH] net: netif_set_real_num_rx_queues may cap num_rx_queues at init time 2010-10-07 6:16 ` Eric Dumazet @ 2010-10-07 6:35 ` David Miller 0 siblings, 0 replies; 16+ messages in thread From: David Miller @ 2010-10-07 6:35 UTC (permalink / raw) To: eric.dumazet; +Cc: john.r.fastabend, bhutchings, netdev, therbert From: Eric Dumazet <eric.dumazet@gmail.com> Date: Thu, 07 Oct 2010 08:16:39 +0200 > Le lundi 04 octobre 2010 à 15:00 -0700, John Fastabend a écrit : >> The logic for netif_set_real_num_rx_queues is the following, >> > > > ... > >> Because netif_set_real_num_rx_queues sets num_rx_queues if the >> reg state is not NETREG_REGISTERED we end up with the incorrect >> max number of rx queues. This patch proposes to remove the else >> clause above so this does not occur. Also just reading the >> function set_real_num it seems a bit unexpected that num_rx_queues >> gets set. >> >> CC: Ben Hutchings <bhutchings@solarflare.com> >> >> Signed-off-by: John Fastabend <john.r.fastabend@intel.com> >> --- > > Acked-by: Eric Dumazet <eric.dumazet@gmail.com> Applied, thanks everyone. ^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2010-10-07 6:35 UTC | newest] Thread overview: 16+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-10-04 22:00 [net-next-2.6 PATCH] net: netif_set_real_num_rx_queues may cap num_rx_queues at init time John Fastabend 2010-10-05 5:35 ` Eric Dumazet 2010-10-05 16:08 ` John Fastabend 2010-10-05 16:34 ` Ben Hutchings 2010-10-05 17:45 ` John Fastabend 2010-10-06 14:52 ` John Fastabend 2010-10-06 15:07 ` Ben Hutchings 2010-10-06 15:20 ` John Fastabend 2010-10-06 15:23 ` Eric Dumazet 2010-10-06 15:31 ` Ben Hutchings 2010-10-06 18:14 ` Matt Carlson 2010-10-06 18:49 ` Eric Dumazet 2010-10-06 20:41 ` David Miller 2010-10-06 15:20 ` Eric Dumazet 2010-10-07 6:16 ` Eric Dumazet 2010-10-07 6:35 ` David Miller
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).