Patchwork [net-next-2.6,16/17] tg3: Use netif_set_real_num_{rx,tx}_queues()

login
register
mail settings
Submitter Ben Hutchings
Date Sept. 27, 2010, 6:32 p.m.
Message ID <1285612357.2263.319.camel@achroite.uk.solarflarecom.com>
Download mbox | patch
Permalink /patch/65905/
State Accepted
Delegated to: David Miller
Headers show

Comments

Ben Hutchings - Sept. 27, 2010, 6:32 p.m.
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(-)
Matt Carlson - Sept. 27, 2010, 9:41 p.m.
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.
> 
> 

--
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
Matt Carlson - Sept. 27, 2010, 9:44 p.m.
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.
> > 
> > 
> 

--
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
David Miller - Sept. 28, 2010, 5:13 a.m.
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!
--
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

Patch

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);
 	}
 }