diff options
author | Heng Qi <hengqi@linux.alibaba.com> | 2023-12-11 18:36:04 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-12-13 12:49:04 +0000 |
commit | 7949c06ad9a8fefc4aabe4baed057f8f4a8e33d8 (patch) | |
tree | cc77a37aa3227148c50af69d63f505c97db3708b /drivers/net/virtio_net.c | |
parent | d2e9464e63366a2a89375a2b14e8a5adb4d0b1d5 (diff) | |
download | lwn-7949c06ad9a8fefc4aabe4baed057f8f4a8e33d8.tar.gz lwn-7949c06ad9a8fefc4aabe4baed057f8f4a8e33d8.zip |
virtio-net: returns whether napi is complete
rx netdim needs to count the traffic during a complete napi process,
and start updating and comparing samples to make decisions after
the napi ends. Let virtqueue_napi_complete() return true if napi is done,
otherwise vice versa.
Signed-off-by: Heng Qi <hengqi@linux.alibaba.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r-- | drivers/net/virtio_net.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index d16f592c2061..0ad2894e6a5e 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -431,7 +431,7 @@ static void virtqueue_napi_schedule(struct napi_struct *napi, } } -static void virtqueue_napi_complete(struct napi_struct *napi, +static bool virtqueue_napi_complete(struct napi_struct *napi, struct virtqueue *vq, int processed) { int opaque; @@ -440,9 +440,13 @@ static void virtqueue_napi_complete(struct napi_struct *napi, if (napi_complete_done(napi, processed)) { if (unlikely(virtqueue_poll(vq, opaque))) virtqueue_napi_schedule(napi, vq); + else + return true; } else { virtqueue_disable_cb(vq); } + + return false; } static void skb_xmit_done(struct virtqueue *vq) |