Skip to content

Commit 4d6308a

Browse files
edumazetdavem330
authored andcommitted
virtio_net: exploit napi_complete_done() return value
Since commit 364b605 ("net: busy-poll: return busypolling status to drivers"), napi_complete_done() returns a boolean that can be used by drivers to conditionally rearm interrupts. This patch changes virtio_net to use this boolean to avoid a bit of overhead for busy-poll users. Jason reports about 1.1% improvement for 1 byte TCP_RR (burst 100). Signed-off-by: Eric Dumazet <[email protected]> Acked-by: Jason Wang <[email protected]> Cc: Michael S. Tsirkin <[email protected]> Cc: Willem de Bruijn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a076d1b commit 4d6308a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/net/virtio_net.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,11 +1012,12 @@ static int virtnet_poll(struct napi_struct *napi, int budget)
10121012
/* Out of packets? */
10131013
if (received < budget) {
10141014
r = virtqueue_enable_cb_prepare(rq->vq);
1015-
napi_complete_done(napi, received);
1016-
if (unlikely(virtqueue_poll(rq->vq, r)) &&
1017-
napi_schedule_prep(napi)) {
1018-
virtqueue_disable_cb(rq->vq);
1019-
__napi_schedule(napi);
1015+
if (napi_complete_done(napi, received)) {
1016+
if (unlikely(virtqueue_poll(rq->vq, r)) &&
1017+
napi_schedule_prep(napi)) {
1018+
virtqueue_disable_cb(rq->vq);
1019+
__napi_schedule(napi);
1020+
}
10201021
}
10211022
}
10221023

0 commit comments

Comments
 (0)