Re: [PATCH 2/2] virtio_net: fixing XDP for fully checksummed packets handling

2024-06-17 Thread Heng Qi
On Tue, 18 Jun 2024 11:10:26 +0800, Jason Wang wrote: > On Mon, Jun 17, 2024 at 9:15 PM Heng Qi wrote: > > > > The XDP program can't correctly handle partially checksummed > > packets, but works fine with fully checksummed packets. > > Not sure this is ture, if I was not wrong, XDP can try to ca

Re: [PATCH 1/2] virtio_net: checksum offloading handling fix

2024-06-17 Thread Heng Qi
On Tue, 18 Jun 2024 11:01:27 +0800, Jason Wang wrote: > On Mon, Jun 17, 2024 at 9:15 PM Heng Qi wrote: > > > > In virtio spec 0.95, VIRTIO_NET_F_GUEST_CSUM was designed to handle > > partially checksummed packets, and the validation of fully checksummed > > packets by the device is independent of

Re: [PATCH 2/2] virtio_net: fixing XDP for fully checksummed packets handling

2024-06-17 Thread Jason Wang
On Mon, Jun 17, 2024 at 9:15 PM Heng Qi wrote: > > The XDP program can't correctly handle partially checksummed > packets, but works fine with fully checksummed packets. Not sure this is ture, if I was not wrong, XDP can try to calculate checksum. Thanks > If the > device has already validated

Re: [PATCH 1/2] virtio_net: checksum offloading handling fix

2024-06-17 Thread Jason Wang
On Mon, Jun 17, 2024 at 9:15 PM Heng Qi wrote: > > In virtio spec 0.95, VIRTIO_NET_F_GUEST_CSUM was designed to handle > partially checksummed packets, and the validation of fully checksummed > packets by the device is independent of VIRTIO_NET_F_GUEST_CSUM > negotiation. However, the specificatio

Re: [PATCH net-next v5 11/15] virtio_net: xsk: tx: support xmit xsk buffer

2024-06-17 Thread Xuan Zhuo
On Tue, 18 Jun 2024 09:06:50 +0800, Jason Wang wrote: > On Mon, Jun 17, 2024 at 3:54 PM Xuan Zhuo wrote: > > > > On Mon, 17 Jun 2024 14:30:07 +0800, Jason Wang wrote: > > > On Fri, Jun 14, 2024 at 2:40 PM Xuan Zhuo > > > wrote: > > > > > > > > The driver's tx napi is very important for XSK. It

Re: [PATCH net-next v5 09/15] virtio_net: xsk: bind/unbind xsk

2024-06-17 Thread Xuan Zhuo
On Tue, 18 Jun 2024 09:04:03 +0800, Jason Wang wrote: > On Mon, Jun 17, 2024 at 3:49 PM Xuan Zhuo wrote: > > > > On Mon, 17 Jun 2024 14:19:10 +0800, Jason Wang wrote: > > > On Fri, Jun 14, 2024 at 2:39 PM Xuan Zhuo > > > wrote: > > > > > > > > This patch implement the logic of bind/unbind xsk

Re: [PATCH net-next v5 08/15] virtio_net: sq support premapped mode

2024-06-17 Thread Xuan Zhuo
On Tue, 18 Jun 2024 08:57:52 +0800, Jason Wang wrote: > On Mon, Jun 17, 2024 at 3:39 PM Xuan Zhuo wrote: > > > > On Mon, 17 Jun 2024 13:00:13 +0800, Jason Wang wrote: > > > On Fri, Jun 14, 2024 at 2:39 PM Xuan Zhuo > > > wrote: > > > > > > > > If the xsk is enabling, the xsk tx will share the

Re: [PATCH net-next v5 08/15] virtio_net: sq support premapped mode

2024-06-17 Thread Xuan Zhuo
On Tue, 18 Jun 2024 09:00:56 +0800, Jason Wang wrote: > On Mon, Jun 17, 2024 at 3:41 PM Xuan Zhuo wrote: > > > > On Mon, 17 Jun 2024 14:28:05 +0800, Jason Wang wrote: > > > On Mon, Jun 17, 2024 at 1:00 PM Jason Wang wrote: > > > > > > > > On Fri, Jun 14, 2024 at 2:39 PM Xuan Zhuo > > > > wrot

Re: [PATCH net-next v3 4/4] virtio_net: improve dim command request efficiency

2024-06-17 Thread Jason Wang
On Mon, Jun 17, 2024 at 4:08 PM Heng Qi wrote: > > On Mon, 17 Jun 2024 12:05:30 +0800, Jason Wang wrote: > > On Thu, Jun 6, 2024 at 2:15 PM Heng Qi wrote: > > > > > > Currently, control vq handles commands synchronously, > > > leading to increased delays for dim commands during multi-queue > > >

Re: [patch net-next] virtio_net: add support for Byte Queue Limits

2024-06-17 Thread Jason Wang
On Tue, Jun 18, 2024 at 12:16 AM Michael S. Tsirkin wrote: > > On Mon, Jun 17, 2024 at 11:30:36AM +0200, Jiri Pirko wrote: > > Mon, Jun 17, 2024 at 03:44:55AM CEST, jasow...@redhat.com wrote: > > >On Mon, Jun 10, 2024 at 10:19 PM Michael S. Tsirkin > > >wrote: > > >> > > >> On Fri, Jun 07, 2024

Re: [PATCH net-next v5 11/15] virtio_net: xsk: tx: support xmit xsk buffer

2024-06-17 Thread Jason Wang
On Mon, Jun 17, 2024 at 3:54 PM Xuan Zhuo wrote: > > On Mon, 17 Jun 2024 14:30:07 +0800, Jason Wang wrote: > > On Fri, Jun 14, 2024 at 2:40 PM Xuan Zhuo > > wrote: > > > > > > The driver's tx napi is very important for XSK. It is responsible for > > > obtaining data from the XSK queue and sendi

Re: [PATCH net-next v5 09/15] virtio_net: xsk: bind/unbind xsk

2024-06-17 Thread Jason Wang
On Mon, Jun 17, 2024 at 3:49 PM Xuan Zhuo wrote: > > On Mon, 17 Jun 2024 14:19:10 +0800, Jason Wang wrote: > > On Fri, Jun 14, 2024 at 2:39 PM Xuan Zhuo > > wrote: > > > > > > This patch implement the logic of bind/unbind xsk pool to sq and rq. > > > > > > Signed-off-by: Xuan Zhuo > > > --- >

Re: [PATCH net-next v5 08/15] virtio_net: sq support premapped mode

2024-06-17 Thread Jason Wang
On Mon, Jun 17, 2024 at 3:41 PM Xuan Zhuo wrote: > > On Mon, 17 Jun 2024 14:28:05 +0800, Jason Wang wrote: > > On Mon, Jun 17, 2024 at 1:00 PM Jason Wang wrote: > > > > > > On Fri, Jun 14, 2024 at 2:39 PM Xuan Zhuo > > > wrote: > > > > > > > > If the xsk is enabling, the xsk tx will share the

Re: [PATCH net-next v5 08/15] virtio_net: sq support premapped mode

2024-06-17 Thread Jason Wang
On Tue, Jun 18, 2024 at 8:57 AM Jason Wang wrote: > > On Mon, Jun 17, 2024 at 3:39 PM Xuan Zhuo wrote: > > > > On Mon, 17 Jun 2024 13:00:13 +0800, Jason Wang wrote: > > > On Fri, Jun 14, 2024 at 2:39 PM Xuan Zhuo > > > wrote: > > > > > > > > If the xsk is enabling, the xsk tx will share the se

Re: [PATCH net-next v5 08/15] virtio_net: sq support premapped mode

2024-06-17 Thread Jason Wang
On Mon, Jun 17, 2024 at 3:39 PM Xuan Zhuo wrote: > > On Mon, 17 Jun 2024 13:00:13 +0800, Jason Wang wrote: > > On Fri, Jun 14, 2024 at 2:39 PM Xuan Zhuo > > wrote: > > > > > > If the xsk is enabling, the xsk tx will share the send queue. > > > But the xsk requires that the send queue use the pr

Re: [PATCH net-next v2] virtio_net: add support for Byte Queue Limits

2024-06-17 Thread Jason Wang
On Mon, Jun 17, 2024 at 5:18 PM Jiri Pirko wrote: > > Mon, Jun 17, 2024 at 04:34:26AM CEST, jasow...@redhat.com wrote: > >On Thu, Jun 13, 2024 at 1:09 AM Jiri Pirko wrote: > >> > >> From: Jiri Pirko > >> > >> Add support for Byte Queue Limits (BQL). > >> > >> Tested on qemu emulated virtio_net d

Re: [patch net-next] virtio_net: add support for Byte Queue Limits

2024-06-17 Thread Jason Wang
On Mon, Jun 17, 2024 at 5:30 PM Jiri Pirko wrote: > > Mon, Jun 17, 2024 at 03:44:55AM CEST, jasow...@redhat.com wrote: > >On Mon, Jun 10, 2024 at 10:19 PM Michael S. Tsirkin wrote: > >> > >> On Fri, Jun 07, 2024 at 01:30:34PM +0200, Jiri Pirko wrote: > >> > Fri, Jun 07, 2024 at 12:23:37PM CEST, m

Re: [PATCH net-next v2] virtio_net: add support for Byte Queue Limits

2024-06-17 Thread Jason Xing
On Mon, Jun 17, 2024 at 5:15 PM Jiri Pirko wrote: > > Fri, Jun 14, 2024 at 11:54:04AM CEST, kerneljasonx...@gmail.com wrote: > >Hello Jiri, > > > >On Thu, Jun 13, 2024 at 1:08 AM Jiri Pirko wrote: > >> > >> From: Jiri Pirko > >> > >> Add support for Byte Queue Limits (BQL). > >> > >> Tested on q

Re: [patch net-next] virtio_net: add support for Byte Queue Limits

2024-06-17 Thread Michael S. Tsirkin
On Mon, Jun 17, 2024 at 11:30:36AM +0200, Jiri Pirko wrote: > Mon, Jun 17, 2024 at 03:44:55AM CEST, jasow...@redhat.com wrote: > >On Mon, Jun 10, 2024 at 10:19 PM Michael S. Tsirkin wrote: > >> > >> On Fri, Jun 07, 2024 at 01:30:34PM +0200, Jiri Pirko wrote: > >> > Fri, Jun 07, 2024 at 12:23:37PM

Re: [patch net-next] virtio_net: add support for Byte Queue Limits

2024-06-17 Thread Michael S. Tsirkin
On Mon, Jun 17, 2024 at 09:44:55AM +0800, Jason Wang wrote: > Probably, but do we need to define a bar here? Looking at git history, > we didn't ask a full benchmark for a lot of commits that may touch > performance. There's no may here and we even got a report from a real user. -- MST

Re: [PATCH net-next v2] virtio_net: add support for Byte Queue Limits

2024-06-17 Thread Michael S. Tsirkin
On Wed, Jun 12, 2024 at 07:08:51PM +0200, Jiri Pirko wrote: > From: Jiri Pirko > > Add support for Byte Queue Limits (BQL). > > Tested on qemu emulated virtio_net device with 1, 2 and 4 queues. > Tested with fq_codel and pfifo_fast. Super netperf with 50 threads is > running in background. Netpe

Re: [PATCH 1/2] virtio_net: checksum offloading handling fix

2024-06-17 Thread Jiri Pirko
Mon, Jun 17, 2024 at 03:15:23PM CEST, hen...@linux.alibaba.com wrote: >In virtio spec 0.95, VIRTIO_NET_F_GUEST_CSUM was designed to handle >partially checksummed packets, and the validation of fully checksummed >packets by the device is independent of VIRTIO_NET_F_GUEST_CSUM >negotiation. However,

Re: [PATCH net-next 2/2] vsock/virtio: avoid enqueue packets when work queue is empty

2024-06-17 Thread Matias Ezequiel Vara Larsen
Hello, thanks for working on this! I have some minor thoughts. On Fri, Jun 14, 2024 at 03:55:43PM +0200, Luigi Leonardi wrote: > From: Marco Pinna > > This introduces an optimization in virtio_transport_send_pkt: > when the work queue (send_pkt_queue) is empty the packet is > put directly in th

[PATCH 2/2] virtio_net: fixing XDP for fully checksummed packets handling

2024-06-17 Thread Heng Qi
The XDP program can't correctly handle partially checksummed packets, but works fine with fully checksummed packets. If the device has already validated fully checksummed packets, then the driver doesn't need to re-validate them, saving CPU resources. Additionally, the driver does not drop all par

[PATCH 0/2] virtio_net: fixes for checksum offloading and XDP handling

2024-06-17 Thread Heng Qi
This series of patches aim to address two specific issues identified in the virtio_net driver related to checksum offloading and XDP processing of fully checksummed packets. The first patch corrects the handling of checksum offloading in the driver. The second patch addresses an issue where the XD

[PATCH 1/2] virtio_net: checksum offloading handling fix

2024-06-17 Thread Heng Qi
In virtio spec 0.95, VIRTIO_NET_F_GUEST_CSUM was designed to handle partially checksummed packets, and the validation of fully checksummed packets by the device is independent of VIRTIO_NET_F_GUEST_CSUM negotiation. However, the specification erroneously stated: "If VIRTIO_NET_F_GUEST_CSUM is no

Re: [patch net-next] virtio_net: add support for Byte Queue Limits

2024-06-17 Thread Jiri Pirko
Mon, Jun 17, 2024 at 03:44:55AM CEST, jasow...@redhat.com wrote: >On Mon, Jun 10, 2024 at 10:19 PM Michael S. Tsirkin wrote: >> >> On Fri, Jun 07, 2024 at 01:30:34PM +0200, Jiri Pirko wrote: >> > Fri, Jun 07, 2024 at 12:23:37PM CEST, m...@redhat.com wrote: >> > >On Fri, Jun 07, 2024 at 11:57:37AM

Re: [PATCH net-next v2] virtio_net: add support for Byte Queue Limits

2024-06-17 Thread Jiri Pirko
Mon, Jun 17, 2024 at 04:34:26AM CEST, jasow...@redhat.com wrote: >On Thu, Jun 13, 2024 at 1:09 AM Jiri Pirko wrote: >> >> From: Jiri Pirko >> >> Add support for Byte Queue Limits (BQL). >> >> Tested on qemu emulated virtio_net device with 1, 2 and 4 queues. >> Tested with fq_codel and pfifo_fast.

Re: [PATCH net-next v2] virtio_net: add support for Byte Queue Limits

2024-06-17 Thread Jiri Pirko
Fri, Jun 14, 2024 at 11:54:04AM CEST, kerneljasonx...@gmail.com wrote: >Hello Jiri, > >On Thu, Jun 13, 2024 at 1:08 AM Jiri Pirko wrote: >> >> From: Jiri Pirko >> >> Add support for Byte Queue Limits (BQL). >> >> Tested on qemu emulated virtio_net device with 1, 2 and 4 queues. >> Tested with fq_

Re: [PATCH net-next v3 4/4] virtio_net: improve dim command request efficiency

2024-06-17 Thread Heng Qi
On Mon, 17 Jun 2024 12:05:30 +0800, Jason Wang wrote: > On Thu, Jun 6, 2024 at 2:15 PM Heng Qi wrote: > > > > Currently, control vq handles commands synchronously, > > leading to increased delays for dim commands during multi-queue > > VM configuration and directly impacting dim performance. > >

Re: [PATCH net-next v5 15/15] virtio_net: xsk: rx: support recv small mode

2024-06-17 Thread Xuan Zhuo
On Mon, 17 Jun 2024 15:10:48 +0800, Jason Wang wrote: > On Fri, Jun 14, 2024 at 2:39 PM Xuan Zhuo wrote: > > > > The virtnet_xdp_handler() is re-used. But > > > > 1. We need to copy data to create skb for XDP_PASS. > > 2. We need to call xsk_buff_free() to release the buffer. > > 3. The handle fo

Re: [PATCH net-next v5 11/15] virtio_net: xsk: tx: support xmit xsk buffer

2024-06-17 Thread Xuan Zhuo
On Mon, 17 Jun 2024 14:30:07 +0800, Jason Wang wrote: > On Fri, Jun 14, 2024 at 2:40 PM Xuan Zhuo wrote: > > > > The driver's tx napi is very important for XSK. It is responsible for > > obtaining data from the XSK queue and sending it out. > > > > At the beginning, we need to trigger tx napi. >

Re: [PATCH net-next v5 09/15] virtio_net: xsk: bind/unbind xsk

2024-06-17 Thread Xuan Zhuo
On Mon, 17 Jun 2024 14:19:10 +0800, Jason Wang wrote: > On Fri, Jun 14, 2024 at 2:39 PM Xuan Zhuo wrote: > > > > This patch implement the logic of bind/unbind xsk pool to sq and rq. > > > > Signed-off-by: Xuan Zhuo > > --- > > drivers/net/virtio_net.c | 201 +

Re: [PATCH net-next v5 08/15] virtio_net: sq support premapped mode

2024-06-17 Thread Xuan Zhuo
On Mon, 17 Jun 2024 13:00:13 +0800, Jason Wang wrote: > On Fri, Jun 14, 2024 at 2:39 PM Xuan Zhuo wrote: > > > > If the xsk is enabling, the xsk tx will share the send queue. > > But the xsk requires that the send queue use the premapped mode. > > So the send queue must support premapped mode whe

Re: [PATCH net-next v5 08/15] virtio_net: sq support premapped mode

2024-06-17 Thread Xuan Zhuo
On Mon, 17 Jun 2024 14:28:05 +0800, Jason Wang wrote: > On Mon, Jun 17, 2024 at 1:00 PM Jason Wang wrote: > > > > On Fri, Jun 14, 2024 at 2:39 PM Xuan Zhuo > > wrote: > > > > > > If the xsk is enabling, the xsk tx will share the send queue. > > > But the xsk requires that the send queue use the

Re: [PATCH net-next v5 07/15] virtio_net: refactor the xmit type

2024-06-17 Thread Xuan Zhuo
On Mon, 17 Jun 2024 13:00:11 +0800, Jason Wang wrote: > On Fri, Jun 14, 2024 at 2:40 PM Xuan Zhuo wrote: > > > > Because the af-xdp and sq premapped mode will introduce two > > new xmit type, so I refactor the xmit type mechanism first. > > > > We use the last two bits of the pointer to distingui

Re: [PATCH net-next v5 15/15] virtio_net: xsk: rx: support recv small mode

2024-06-17 Thread Jason Wang
On Fri, Jun 14, 2024 at 2:39 PM Xuan Zhuo wrote: > > The virtnet_xdp_handler() is re-used. But > > 1. We need to copy data to create skb for XDP_PASS. > 2. We need to call xsk_buff_free() to release the buffer. > 3. The handle for xdp_buff is difference. > > If we pushed this logic into existing r