🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
2 messages
2 total messages Started by raoxu Tue, 10 Nov 2026 05:16
[PATCH] vhost/net: Fix receive queue test in busy poll
#13656
Author: raoxu
Date: Tue, 10 Nov 2026 05:16
33 lines
10675 bytes
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
Re: [PATCH] vhost/net: Fix receive queue test in busy poll
#14525
Author: Björn Töpel
Date: Wed, 11 Nov 2026 11:58
25 lines
8575 bytes
raoxu <raoxu@uniontech.com> writes:

> 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>

This fix is valid, but you need to carry a Fixes: tag. You should also
state what netdev tree you're targeting. Please see
Documentation/process/maintainer-netdev.rst

Could the changelog also state how the bug was found and confirmed, and
how the fix was tested?

Björn
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads