net: dnet: fix dnet_poll()
A NAPI poll() handler is supposed to return exactly the budget when/if napi_complete() has not been called. It is also supposed to return number of frames that were received, so that netdev_budget can have a meaning. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
0c8185944a
commit
12d80ac4e7
@ -398,13 +398,8 @@ static int dnet_poll(struct napi_struct *napi, int budget)
|
|||||||
* break out of while loop if there are no more
|
* break out of while loop if there are no more
|
||||||
* packets waiting
|
* packets waiting
|
||||||
*/
|
*/
|
||||||
if (!(dnet_readl(bp, RX_FIFO_WCNT) >> 16)) {
|
if (!(dnet_readl(bp, RX_FIFO_WCNT) >> 16))
|
||||||
napi_complete(napi);
|
break;
|
||||||
int_enable = dnet_readl(bp, INTR_ENB);
|
|
||||||
int_enable |= DNET_INTR_SRC_RX_CMDFIFOAF;
|
|
||||||
dnet_writel(bp, int_enable, INTR_ENB);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd_word = dnet_readl(bp, RX_LEN_FIFO);
|
cmd_word = dnet_readl(bp, RX_LEN_FIFO);
|
||||||
pkt_len = cmd_word & 0xFFFF;
|
pkt_len = cmd_word & 0xFFFF;
|
||||||
@ -433,20 +428,17 @@ static int dnet_poll(struct napi_struct *napi, int budget)
|
|||||||
"size %u.\n", dev->name, pkt_len);
|
"size %u.\n", dev->name, pkt_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
budget -= npackets;
|
|
||||||
|
|
||||||
if (npackets < budget) {
|
if (npackets < budget) {
|
||||||
/* We processed all packets available. Tell NAPI it can
|
/* We processed all packets available. Tell NAPI it can
|
||||||
* stop polling then re-enable rx interrupts */
|
* stop polling then re-enable rx interrupts.
|
||||||
|
*/
|
||||||
napi_complete(napi);
|
napi_complete(napi);
|
||||||
int_enable = dnet_readl(bp, INTR_ENB);
|
int_enable = dnet_readl(bp, INTR_ENB);
|
||||||
int_enable |= DNET_INTR_SRC_RX_CMDFIFOAF;
|
int_enable |= DNET_INTR_SRC_RX_CMDFIFOAF;
|
||||||
dnet_writel(bp, int_enable, INTR_ENB);
|
dnet_writel(bp, int_enable, INTR_ENB);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* There are still packets waiting */
|
return npackets;
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static irqreturn_t dnet_interrupt(int irq, void *dev_id)
|
static irqreturn_t dnet_interrupt(int irq, void *dev_id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user