[PATCH] vhost/net: Fix receive queue test in busy poll
From: raoxu
Date: Tue Nov 10 2026 - 00:46:50 EST
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>
---
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