Re: [PATCH] vhost/net: Fix receive queue test in busy poll

From: Michael S. Tsirkin

Date: Thu Nov 19 2026 - 10:17:39 EST


On Tue, Nov 10, 2026 at 01:16:42PM +0800, raoxu wrote:
> From: Xu Rao <raoxu@xxxxxxxxxxxxx>
>
> sock_has_rx_data() returns a positive result when receive data is
> available. Socket implementations with a peek_len() callback follow
> that convention, but the fallback for sockets without one returns
> skb_queue_empty(), which has the opposite meaning.
>
> This makes busy polling stop when a raw packet socket has no queued data
> and fail to recognize queued data through the fallback path. Return the
> negated queue-empty result so the fallback matches the callback and its
> callers.
>
> Signed-off-by: Xu Rao <raoxu@xxxxxxxxxxxxx>


do u want to send v2 addressing review?

> ---
> drivers/vhost/net.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> index 4570a4ffbab2..10ed2d55ff07 100644
> --- a/drivers/vhost/net.c
> +++ b/drivers/vhost/net.c
> @@ -538,7 +538,7 @@ static int sock_has_rx_data(struct socket *sock)
> if (sock->ops->peek_len)
> return sock->ops->peek_len(sock);
>
> - return skb_queue_empty(&sock->sk->sk_receive_queue);
> + return !skb_queue_empty(&sock->sk->sk_receive_queue);
> }
>
> static void vhost_net_busy_poll_try_queue(struct vhost_net *net,
> --
> 2.50.1