mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] vhost/net: Fix receive queue test in busy poll
@ 2026-11-10  5:16 raoxu
  2026-11-11 11:58 ` Björn Töpel
  0 siblings, 1 reply; 2+ messages in thread
From: raoxu @ 2026-11-10  5:16 UTC (permalink / raw)
  To: mst
  Cc: jasowangio, eperezma, kvm, virtualization, netdev, linux-kernel, raoxu

From: Xu Rao <raoxu@uniontech.com>

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@uniontech.com>
---
 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-11 11:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-10  5:16 [PATCH] vhost/net: Fix receive queue test in busy poll raoxu
2026-11-11 11:58 ` Björn Töpel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®