* [PATCH] [-MM, FIX] ixgbe: incorporate napi_struct changes from net-2.6.24.git
@ 2007-09-12 18:13 Auke Kok
2007-09-12 22:16 ` Andrew Morton
0 siblings, 1 reply; 5+ messages in thread
From: Auke Kok @ 2007-09-12 18:13 UTC (permalink / raw)
To: akpm, davem; +Cc: netdev, jeff, jesse.brandeburg
This incorporates the new napi_struct changes into ixgbe.
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
---
drivers/net/ixgbe/ixgbe.h | 1 +
drivers/net/ixgbe/ixgbe_main.c | 62 +++++++++++++++++-----------------------
2 files changed, 27 insertions(+), 36 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe.h b/drivers/net/ixgbe/ixgbe.h
index b24803f..c160a7d 100644
--- a/drivers/net/ixgbe/ixgbe.h
+++ b/drivers/net/ixgbe/ixgbe.h
@@ -179,6 +179,7 @@ struct ixgbe_adapter {
/* TX */
struct ixgbe_ring *tx_ring; /* One per active queue */
+ struct napi_struct napi;
u64 restart_queue;
u64 lsc_int;
u64 hw_tso_ctxt;
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 23fb1ed..a08a462 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -557,14 +557,15 @@ static irqreturn_t ixgbe_msix_clean_rx(int irq, void *data)
struct ixgbe_adapter *adapter = rxr->adapter;
IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, rxr->eims_value);
- netif_rx_schedule(adapter->netdev);
+ netif_rx_schedule(adapter->netdev, &adapter->napi);
return IRQ_HANDLED;
}
-static int ixgbe_clean_rxonly(struct net_device *netdev, int *budget)
+static int ixgbe_clean_rxonly(struct napi_struct *napi, int budget)
{
- struct ixgbe_adapter *adapter = netdev_priv(netdev);
- int work_to_do = min(*budget, netdev->quota);
+ struct ixgbe_adapter *adapter = container_of(napi,
+ struct ixgbe_adapter, napi);
+ struct net_device *netdev = adapter->netdev;
int work_done = 0;
struct ixgbe_ring *rxr = adapter->rx_ring;
@@ -572,22 +573,18 @@ static int ixgbe_clean_rxonly(struct net_device *netdev, int *budget)
if (!netif_carrier_ok(netdev))
goto quit_polling;
- ixgbe_clean_rx_irq(adapter, rxr, &work_done, work_to_do);
-
- *budget -= work_done;
- netdev->quota -= work_done;
+ ixgbe_clean_rx_irq(adapter, rxr, &work_done, budget);
/* If no Tx and not enough Rx work done, exit the polling mode */
- if ((work_done == 0) || !netif_running(netdev)) {
+ if ((work_done < budget) || !netif_running(netdev)) {
quit_polling:
- netif_rx_complete(netdev);
+ netif_rx_complete(netdev, napi);
if (!test_bit(__IXGBE_DOWN, &adapter->state))
IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS,
rxr->eims_value);
- return 0;
}
- return 1;
+ return work_done;
}
/**
@@ -669,7 +666,8 @@ static int ixgbe_setup_msix(struct ixgbe_adapter *adapter)
goto release_irqs;
}
- adapter->netdev->poll = ixgbe_clean_rxonly;
+ /* FIXME: implement netif_napi_remove() instead */
+ adapter->napi.poll = ixgbe_clean_rxonly;
adapter->flags |= IXGBE_FLAG_MSIX_ENABLED;
return 0;
@@ -713,12 +711,12 @@ static irqreturn_t ixgbe_intr(int irq, void *data)
if (!test_bit(__IXGBE_DOWN, &adapter->state))
mod_timer(&adapter->watchdog_timer, jiffies);
}
- if (netif_rx_schedule_prep(netdev)) {
+ if (netif_rx_schedule_prep(netdev, &adapter->napi)) {
/* Disable interrupts and register for poll. The flush of the
* posted write is intentionally left out. */
atomic_inc(&adapter->irq_sem);
IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, ~0);
- __netif_rx_schedule(netdev);
+ __netif_rx_schedule(netdev, &adapter->napi);
}
return IRQ_HANDLED;
@@ -1218,7 +1216,7 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter)
ixgbe_configure_msi_and_legacy(adapter);
clear_bit(__IXGBE_DOWN, &adapter->state);
- netif_poll_enable(netdev);
+ napi_enable(&adapter->napi);
ixgbe_irq_enable(adapter);
/* bring the link up in the watchdog, this could race with our first
@@ -1412,7 +1410,7 @@ void ixgbe_down(struct ixgbe_adapter *adapter)
ixgbe_irq_disable(adapter);
- netif_poll_disable(netdev);
+ napi_disable(&adapter->napi);
del_timer_sync(&adapter->watchdog_timer);
netif_carrier_off(netdev);
@@ -1464,11 +1462,12 @@ static void ixgbe_shutdown(struct pci_dev *pdev)
* ixgbe_clean - NAPI Rx polling callback
* @adapter: board private structure
**/
-static int ixgbe_clean(struct net_device *netdev, int *budget)
+static int ixgbe_clean(struct napi_struct *napi, int budget)
{
- struct ixgbe_adapter *adapter = netdev_priv(netdev);
- int work_to_do = min(*budget, netdev->quota);
- int tx_cleaned, work_done = 0;
+ struct ixgbe_adapter *adapter = container_of(napi,
+ struct ixgbe_adapter, napi);
+ struct net_device *netdev = adapter->netdev;
+ int tx_cleaned = 0, work_done = 0;
/* Keep link state information with original netdev */
if (!netif_carrier_ok(adapter->netdev))
@@ -1477,24 +1476,17 @@ static int ixgbe_clean(struct net_device *netdev, int *budget)
/* In non-MSIX case, there is no multi-Tx/Rx queue */
tx_cleaned = ixgbe_clean_tx_irq(adapter, adapter->tx_ring);
ixgbe_clean_rx_irq(adapter, &adapter->rx_ring[0], &work_done,
- work_to_do);
-
- *budget -= work_done;
- netdev->quota -= work_done;
+ budget);
/* If no Tx and not enough Rx work done, exit the polling mode */
- if ((!tx_cleaned && (work_done == 0)) ||
+ if ((!tx_cleaned && (work_done < budget)) ||
!netif_running(adapter->netdev)) {
quit_polling:
- netif_rx_complete(netdev);
- if (test_bit(__IXGBE_DOWN, &adapter->state))
- atomic_dec(&adapter->irq_sem);
- else
- ixgbe_irq_enable(adapter);
- return 0;
+ netif_rx_complete(netdev, napi);
+ ixgbe_irq_enable(adapter);
}
- return 1;
+ return work_done;
}
/**
@@ -2592,8 +2584,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
ixgbe_set_ethtool_ops(netdev);
netdev->tx_timeout = &ixgbe_tx_timeout;
netdev->watchdog_timeo = 5 * HZ;
- netdev->poll = &ixgbe_clean;
- netdev->weight = 64;
+ netif_napi_add(netdev, &adapter->napi, ixgbe_clean, 64);
netdev->vlan_rx_register = ixgbe_vlan_rx_register;
netdev->vlan_rx_add_vid = ixgbe_vlan_rx_add_vid;
netdev->vlan_rx_kill_vid = ixgbe_vlan_rx_kill_vid;
@@ -2698,7 +2689,6 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
netif_carrier_off(netdev);
netif_stop_queue(netdev);
- netif_poll_disable(netdev);
strcpy(netdev->name, "eth%d");
err = register_netdev(netdev);
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] [-MM, FIX] ixgbe: incorporate napi_struct changes from net-2.6.24.git
2007-09-12 18:13 [PATCH] [-MM, FIX] ixgbe: incorporate napi_struct changes from net-2.6.24.git Auke Kok
@ 2007-09-12 22:16 ` Andrew Morton
2007-09-12 22:20 ` Kok, Auke
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2007-09-12 22:16 UTC (permalink / raw)
To: Auke Kok; +Cc: davem, netdev, jeff, jesse.brandeburg
On Wed, 12 Sep 2007 11:13:07 -0700
Auke Kok <auke-jan.h.kok@intel.com> wrote:
> This incorporates the new napi_struct changes into ixgbe.
I get a reject storm.
> --- a/drivers/net/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ixgbe/ixgbe_main.c
> @@ -557,14 +557,15 @@ static irqreturn_t ixgbe_msix_clean_rx(int irq, void *data)
> struct ixgbe_adapter *adapter = rxr->adapter;
>
> IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, rxr->eims_value);
> - netif_rx_schedule(adapter->netdev);
> + netif_rx_schedule(adapter->netdev, &adapter->napi);
> return IRQ_HANDLED;
> }
>
For example, my copy of ixgbe_msix_clean_rx(), from
git://lost.foo-projects.org/~aveerani/git/linux-2.6#ixgbe is:
static irqreturn_t ixgbe_msix_clean_rx(int irq, void *data)
{
struct ixgbe_ring *rxr = data;
struct ixgbe_adapter *adapter = rxr->adapter;
#ifndef CONFIG_IXGBE_NAPI
int i;
for (i = 0; i < IXGBE_MAX_INTR; i++)
if (unlikely(!ixgbe_clean_rx_irq(adapter, rxr)))
break;
#else
IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, rxr->eims_value);
netif_rx_schedule(adapter->netdev);
#endif
return IRQ_HANDLED;
}
which is quite different from the function whcih you're altering here?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] [-MM, FIX] ixgbe: incorporate napi_struct changes from net-2.6.24.git
2007-09-12 22:16 ` Andrew Morton
@ 2007-09-12 22:20 ` Kok, Auke
2007-09-12 23:14 ` Andrew Morton
0 siblings, 1 reply; 5+ messages in thread
From: Kok, Auke @ 2007-09-12 22:20 UTC (permalink / raw)
To: Andrew Morton; +Cc: davem, netdev, jeff, jesse.brandeburg
Andrew Morton wrote:
> On Wed, 12 Sep 2007 11:13:07 -0700
> Auke Kok <auke-jan.h.kok@intel.com> wrote:
>
>> This incorporates the new napi_struct changes into ixgbe.
>
> I get a reject storm.
>
>> --- a/drivers/net/ixgbe/ixgbe_main.c
>> +++ b/drivers/net/ixgbe/ixgbe_main.c
>> @@ -557,14 +557,15 @@ static irqreturn_t ixgbe_msix_clean_rx(int irq, void *data)
>> struct ixgbe_adapter *adapter = rxr->adapter;
>>
>> IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, rxr->eims_value);
>> - netif_rx_schedule(adapter->netdev);
>> + netif_rx_schedule(adapter->netdev, &adapter->napi);
>> return IRQ_HANDLED;
>> }
>>
>
> For example, my copy of ixgbe_msix_clean_rx(), from
> git://lost.foo-projects.org/~aveerani/git/linux-2.6#ixgbe is:
please drop that tree, and get the one I posted last week instead:
git://lost.foo-projects.org/~ahkok/linux-2.6 ixgbe-20070905-submission
or:
http://foo-projects.org/~sofar/ixgbe-20070905-submission.patch
http://foo-projects.org/~sofar/ixgbe-20070905-submission.patch.bz2
Cheers,
Auke
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] [-MM, FIX] ixgbe: incorporate napi_struct changes from net-2.6.24.git
2007-09-12 22:20 ` Kok, Auke
@ 2007-09-12 23:14 ` Andrew Morton
2007-09-12 23:29 ` Kok, Auke
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2007-09-12 23:14 UTC (permalink / raw)
To: Kok, Auke; +Cc: davem, netdev, jeff, jesse.brandeburg
On Wed, 12 Sep 2007 15:20:01 -0700
"Kok, Auke" <auke-jan.h.kok@intel.com> wrote:
> Andrew Morton wrote:
> > On Wed, 12 Sep 2007 11:13:07 -0700
> > Auke Kok <auke-jan.h.kok@intel.com> wrote:
> >
> >> This incorporates the new napi_struct changes into ixgbe.
> >
> > I get a reject storm.
> >
> >> --- a/drivers/net/ixgbe/ixgbe_main.c
> >> +++ b/drivers/net/ixgbe/ixgbe_main.c
> >> @@ -557,14 +557,15 @@ static irqreturn_t ixgbe_msix_clean_rx(int irq, void *data)
> >> struct ixgbe_adapter *adapter = rxr->adapter;
> >>
> >> IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, rxr->eims_value);
> >> - netif_rx_schedule(adapter->netdev);
> >> + netif_rx_schedule(adapter->netdev, &adapter->napi);
> >> return IRQ_HANDLED;
> >> }
> >>
> >
> > For example, my copy of ixgbe_msix_clean_rx(), from
> > git://lost.foo-projects.org/~aveerani/git/linux-2.6#ixgbe is:
>
> please drop that tree, and get the one I posted last week instead:
>
> git://lost.foo-projects.org/~ahkok/linux-2.6 ixgbe-20070905-submission
I think I just ignored that branch. It looks like some frozen-week-old
snapshot, whereas I like to get the latest tip-of-tree.
Or is that branch just misnamed?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] [-MM, FIX] ixgbe: incorporate napi_struct changes from net-2.6.24.git
2007-09-12 23:14 ` Andrew Morton
@ 2007-09-12 23:29 ` Kok, Auke
0 siblings, 0 replies; 5+ messages in thread
From: Kok, Auke @ 2007-09-12 23:29 UTC (permalink / raw)
To: Andrew Morton; +Cc: davem, netdev, jeff, jesse.brandeburg
Andrew Morton wrote:
> On Wed, 12 Sep 2007 15:20:01 -0700
> "Kok, Auke" <auke-jan.h.kok@intel.com> wrote:
>
>> Andrew Morton wrote:
>>> On Wed, 12 Sep 2007 11:13:07 -0700
>>> Auke Kok <auke-jan.h.kok@intel.com> wrote:
>>>
>>>> This incorporates the new napi_struct changes into ixgbe.
>>> I get a reject storm.
>>>
>>>> --- a/drivers/net/ixgbe/ixgbe_main.c
>>>> +++ b/drivers/net/ixgbe/ixgbe_main.c
>>>> @@ -557,14 +557,15 @@ static irqreturn_t ixgbe_msix_clean_rx(int irq, void *data)
>>>> struct ixgbe_adapter *adapter = rxr->adapter;
>>>>
>>>> IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, rxr->eims_value);
>>>> - netif_rx_schedule(adapter->netdev);
>>>> + netif_rx_schedule(adapter->netdev, &adapter->napi);
>>>> return IRQ_HANDLED;
>>>> }
>>>>
>>> For example, my copy of ixgbe_msix_clean_rx(), from
>>> git://lost.foo-projects.org/~aveerani/git/linux-2.6#ixgbe is:
>> please drop that tree, and get the one I posted last week instead:
>>
>> git://lost.foo-projects.org/~ahkok/linux-2.6 ixgbe-20070905-submission
>
> I think I just ignored that branch. It looks like some frozen-week-old
> snapshot, whereas I like to get the latest tip-of-tree.
I usually don't update the branches on that machine all that often, the machine
is horribly slow and a git-checkout of a new branch takes 5 minutes. However, it
*is* the very latest version of ixgbe and the one I intend to get Jeff to merge ;).
If you want to automatically pull all the changes I make for all the drivers, I
would probably prefer going to a git.kernel.org tree instead, which is something
I have been contemplating already, and I might just do so
in any case, you do want to drop the ~aveerani/git/linux-2.6#ixgbe branch, which
is quite a bit older than that.
Auke
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-09-12 23:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-12 18:13 [PATCH] [-MM, FIX] ixgbe: incorporate napi_struct changes from net-2.6.24.git Auke Kok
2007-09-12 22:16 ` Andrew Morton
2007-09-12 22:20 ` Kok, Auke
2007-09-12 23:14 ` Andrew Morton
2007-09-12 23:29 ` Kok, Auke
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).