Message ID | 20240915-queue-v1-3-b49bd49b926d@daynix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | virtio-net fixes | expand |
On Sun, Sep 15, 2024 at 9:07 AM Akihiko Odaki <akihiko.odaki@daynix.com> wrote: > > virtio_net_can_receive() checks if the queue is ready, but RSS will > change the queue to use so, strictly speaking, we may still be able to > receive the packet even if the queue initially provided is not ready. > Perform RSS before virtio_net_can_receive() to cover such a case. > > Fixes: 4474e37a5b3a ("virtio-net: implement RX RSS processing") > Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> > --- > hw/net/virtio-net.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > The patch does not apply cleanly: Applying: virtio-net: Fix hash reporting when the queue changes error: patch failed: hw/net/virtio-net.c:1901 error: hw/net/virtio-net.c: patch does not apply Patch failed at 0004 virtio-net: Fix hash reporting when the queue changes hint: Use 'git am --show-current-patch=diff' to see the failed patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". Thansk
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 755530c035e4..3ee1ebd88daa 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1901,10 +1901,6 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf, size_t offset, i, guest_offset, j; ssize_t err; - if (!virtio_net_can_receive(nc)) { - return -1; - } - if (!no_rss && n->rss_data.enabled && n->rss_data.enabled_software_rss) { int index = virtio_net_process_rss(nc, buf, size, &extra_hdr); if (index >= 0) { @@ -1913,6 +1909,10 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf, } } + if (!virtio_net_can_receive(nc)) { + return -1; + } + /* hdr_len refers to the header we supply to the guest */ if (!virtio_net_has_buffers(q, size + n->guest_hdr_len - n->host_hdr_len)) { return 0;
virtio_net_can_receive() checks if the queue is ready, but RSS will change the queue to use so, strictly speaking, we may still be able to receive the packet even if the queue initially provided is not ready. Perform RSS before virtio_net_can_receive() to cover such a case. Fixes: 4474e37a5b3a ("virtio-net: implement RX RSS processing") Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> --- hw/net/virtio-net.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)