mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 19:00:25 +00:00
sunvnet: Return from vnet_napi_event() if no packets to read
vnet_event_napi() may be called as part of the NAPI ->poll, to resume reading descriptor rings. When no data is available, descriptor ring state (e.g., rcv_nxt) needs to be reset carefully to stay in lock-step with ldc_read(). In the interest of simplicity, the best way to do this is to return from vnet_event_napi() when there are no more packets to read. The next trip through ldc_rx will correctly set up the dring state. Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com> Tested-by: David Stevens <david.stevens@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
6c3ce8a30c
commit
8c4ee3e706
1 changed files with 2 additions and 3 deletions
|
@ -691,7 +691,6 @@ static int vnet_event_napi(struct vnet_port *port, int budget)
|
|||
pkt->end_idx = -1;
|
||||
goto napi_resume;
|
||||
}
|
||||
ldc_read:
|
||||
err = ldc_read(vio->lp, &msgbuf, sizeof(msgbuf));
|
||||
if (unlikely(err < 0)) {
|
||||
if (err == -ECONNRESET)
|
||||
|
@ -722,8 +721,8 @@ static int vnet_event_napi(struct vnet_port *port, int budget)
|
|||
err = vnet_rx(port, &msgbuf, &npkts, budget);
|
||||
if (npkts >= budget)
|
||||
break;
|
||||
if (npkts == 0 && err != -ECONNRESET)
|
||||
goto ldc_read;
|
||||
if (npkts == 0)
|
||||
break;
|
||||
} else if (msgbuf.tag.stype == VIO_SUBTYPE_ACK) {
|
||||
err = vnet_ack(port, &msgbuf);
|
||||
if (err > 0)
|
||||
|
|
Loading…
Reference in a new issue