Lines 673-686
static int macb_poll(struct napi_struct *napi, int budget)
Link Here
|
673 |
(unsigned long)status, budget); |
673 |
(unsigned long)status, budget); |
674 |
|
674 |
|
675 |
work_done = macb_rx(bp, budget); |
675 |
work_done = macb_rx(bp, budget); |
676 |
if (work_done < budget) |
676 |
if (work_done < budget) { |
677 |
netif_rx_complete(dev, napi); |
677 |
/* |
|
|
678 |
* We've done what we can to clean the buffers. Make sure we |
679 |
* get notified when new packets arrive. |
680 |
*/ |
681 |
macb_writel(bp, IER, MACB_RX_INT_FLAGS); |
678 |
|
682 |
|
679 |
/* |
683 |
/* |
680 |
* We've done what we can to clean the buffers. Make sure we |
684 |
* Then check if there's any more work, just in case |
681 |
* get notified when new packets arrive. |
685 |
* more work arrived before we enabled interrupts again. |
682 |
*/ |
686 |
*/ |
683 |
macb_writel(bp, IER, MACB_RX_INT_FLAGS); |
687 |
work_done = macb_rx(bp, 1); |
|
|
688 |
|
689 |
if (work_done < 1) { |
690 |
netif_rx_complete(dev, napi); |
691 |
} |
692 |
} |
684 |
|
693 |
|
685 |
/* TODO: Handle errors */ |
694 |
/* TODO: Handle errors */ |
686 |
|
695 |
|
Lines 708-719
static irqreturn_t macb_interrupt(int irq, void *dev_id)
Link Here
|
708 |
} |
717 |
} |
709 |
|
718 |
|
710 |
if (status & MACB_RX_INT_FLAGS) { |
719 |
if (status & MACB_RX_INT_FLAGS) { |
|
|
720 |
/* |
721 |
* There's no point taking any more interrupts |
722 |
* until we have processed the buffers. The |
723 |
* scheduling call may fail if the poll routine |
724 |
* is already scheduled, so disable interrupts |
725 |
* now. |
726 |
*/ |
727 |
macb_writel(bp, IDR, MACB_RX_INT_FLAGS); |
728 |
|
711 |
if (netif_rx_schedule_prep(dev, &bp->napi)) { |
729 |
if (netif_rx_schedule_prep(dev, &bp->napi)) { |
712 |
/* |
|
|
713 |
* There's no point taking any more interrupts |
714 |
* until we have processed the buffers |
715 |
*/ |
716 |
macb_writel(bp, IDR, MACB_RX_INT_FLAGS); |
717 |
dev_dbg(&bp->pdev->dev, |
730 |
dev_dbg(&bp->pdev->dev, |
718 |
"scheduling RX softirq\n"); |
731 |
"scheduling RX softirq\n"); |
719 |
__netif_rx_schedule(dev, &bp->napi); |
732 |
__netif_rx_schedule(dev, &bp->napi); |
720 |
- |
|
|
721 |
* An RX interrupt would result in the polling routine being scheduled. |
733 |
* An RX interrupt would result in the polling routine being scheduled. |
722 |
* The polling routine would finish processing packets and re-enable interrupts, at which point... |
734 |
* The polling routine would finish processing packets and re-enable interrupts, at which point... |
723 |
* Another RX interrupt could arrive, resulting in the interrupt routine disabling interrupts again and trying to schedule the polling routine. The latter fails, since the running polling routine has not yet called netif_rx_complete. |
735 |
* Another RX interrupt could arrive, resulting in the interrupt routine disabling interrupts again and trying to schedule the polling routine. The latter fails, since the running polling routine has not yet called netif_rx_complete. |
724 |
* The polling routine resumes and calls netif_rx_complete. |
736 |
* The polling routine resumes and calls netif_rx_complete. |
725 |
-- |
|
|
726 |
drivers/net/macb.c | 17 ++++++++--------- |
737 |
drivers/net/macb.c | 17 ++++++++--------- |
727 |
1 files changed, 8 insertions(+), 9 deletions(-) |
738 |
1 files changed, 8 insertions(+), 9 deletions(-) |