Now, we supported AF_XDP(xsk). Add NETDEV_XDP_ACT_XSK_ZEROCOPY to
xdp_features.
Signed-off-by: Xuan Zhuo
---
drivers/net/virtio/main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/virtio/main.c b/drivers/net/virtio/main.c
index cc0194c14c98..ec28f87f04a7 1006
If send queue sent some packets, we update the tx timeout
record to prevent the tx timeout.
Signed-off-by: Xuan Zhuo
Acked-by: Jason Wang
---
drivers/net/virtio/xsk.c | 10 ++
1 file changed, 10 insertions(+)
diff --git a/drivers/net/virtio/xsk.c b/drivers/net/virtio/xsk.c
index ee09e8
Implement the logic of filling rq with XSK buffers.
Signed-off-by: Xuan Zhuo
---
drivers/net/virtio/main.c | 9 +-
drivers/net/virtio/virtio_net.h | 2 ++
drivers/net/virtio/xsk.c| 51 -
drivers/net/virtio/xsk.h| 2 ++
4 files changed,
This commit separates the function receive_buf(), then we wrap the logic
of handling the skb to an independent function virtnet_receive_done().
The subsequent commit will reuse it.
Signed-off-by: Xuan Zhuo
---
drivers/net/virtio/main.c | 56 ++-
1 file changed
Since this will be called in other circumstances(freeze), we must check
whether it is xsk's buffer in this function. It cannot be judged outside
this function.
Signed-off-by: Xuan Zhuo
---
drivers/net/virtio/main.c | 8
1 file changed, 8 insertions(+)
diff --git a/drivers/net/virtio/ma
This commit separates the function receive_mergeable(),
put the logic of appending frag to the skb as an independent function.
The subsequent commit will reuse it.
Signed-off-by: Xuan Zhuo
---
drivers/net/virtio/main.c | 77 ---
1 file changed, 47 insertions(+
receive the xsk buffer for small mode.
Signed-off-by: Xuan Zhuo
---
drivers/net/virtio/xsk.c | 33 +
1 file changed, 33 insertions(+)
diff --git a/drivers/net/virtio/xsk.c b/drivers/net/virtio/xsk.c
index 005bb5f66271..ee09e898a291 100644
--- a/drivers/net/virtio
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 receive handle(merge and small),
we would have to maintain code s
virtnet_sq_free_unused_buf() check xsk buffer.
Signed-off-by: Xuan Zhuo
Acked-by: Jason Wang
---
drivers/net/virtio/main.c | 6 --
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/virtio/main.c b/drivers/net/virtio/main.c
index 2c82418b0344..ab1970158d85 100644
---
virtnet_free_old_xmit distinguishes three type ptr(skb, xdp frame, xsk
buffer) by the last bits of the pointer.
Signed-off-by: Xuan Zhuo
---
drivers/net/virtio/virtio_net.h | 30 ++
drivers/net/virtio/xsk.c| 33 ++---
drivers/net/vi
xsk wakeup is used to trigger the logic for xsk xmit by xsk framework or
user.
Virtio-net does not support to actively generate an interruption, so it
tries to trigger tx NAPI on the local cpu.
Signed-off-by: Xuan Zhuo
---
drivers/net/virtio/main.c | 20 ++--
drivers/net/v
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.
Signed-off-by: Xuan Zhuo
---
drivers/net/virtio/main.c | 22 ++---
drivers/net/virtio/virtio_net.h | 4 ++
drivers
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.
command: pktgen_sample01_simple.sh -i eth0 -s 16/1400 -d 10.0.0.123 -m
00:16:3e:12:e1:3e -n 0 -p 100
machine: ecs.ebmg6e.2
This patch implement the logic of bind/unbind xsk pool to sq and rq.
Signed-off-by: Xuan Zhuo
---
drivers/net/virtio/Makefile | 2 +-
drivers/net/virtio/main.c | 11 +-
drivers/net/virtio/virtio_net.h | 17 +++
drivers/net/virtio/xsk.c| 187
__free_old_xmit
is_xdp_raw_buffer_queue
These two APIs are needed by the xsk part.
So this commit move theses to the header. And add prefix "virtnet_".
Signed-off-by: Xuan Zhuo
---
drivers/net/virtio/main.c | 86 +++--
drivers/net/virtio/virtio_net.h | 72 +
Now, inside virtqueue_disable_and_recycle, the recycle() just has two
parameters(vq, buf) after detach operate.
But if we are in premapped mode, we may need to get some dma info when
detach buf like virtqueue_get_buf_ctx_dma().
So we call recycle directly, this callback detaches bufs self. It sho
Since xsk's TX queue is consumed by TX NAPI, if sq is bound to xsk, then
we must stop tx napi from being disabled.
Signed-off-by: Xuan Zhuo
Acked-by: Jason Wang
---
drivers/net/virtio/main.c | 10 +-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/net/virtio/main.c
This patch separates two sub-functions from virtnet_tx_resize():
* virtnet_tx_pause
* virtnet_tx_resume
Then the subsequent virtnet_tx_reset() can share these two functions.
Signed-off-by: Xuan Zhuo
Acked-by: Jason Wang
---
drivers/net/virtio/main.c | 35 +++-
introduce virtqueue_get_buf_ctx_dma() to collect the dma info when
get buf from virtio core for premapped mode.
If the virtio queue is premapped mode, the virtio-net send buf may
have many desc. Every desc dma address need to be unmap. So here we
introduce a new helper to collect the dma address o
introduce virtqueue_detach_unused_buf_dma() to collect the dma
info when get buf from virtio core for premapped mode.
If the virtio queue is premapped mode, the virtio-net send buf may
have many desc. Every desc dma address need to be unmap. So here we
introduce a new helper to collect the dma add
Move some core structures (send_queue, receive_queue, virtnet_info)
definitions and the relative structures definitions into the
virtio_net.h file.
That will be used by the other c code files.
Signed-off-by: Xuan Zhuo
Acked-by: Jason Wang
---
drivers/net/virtio/main.c | 189 +
This patch separates two sub-functions from virtnet_rx_resize():
* virtnet_rx_pause
* virtnet_rx_resume
Then the subsequent reset rx for xsk can share these two functions.
Signed-off-by: Xuan Zhuo
Acked-by: Jason Wang
---
drivers/net/virtio/main.c | 29 +
dri
There are two completely similar and independent implementations. This
is inconvenient for the subsequent addition of new types. So extract a
function from this piece of code and call this function uniformly to
recover old xmit ptr.
Signed-off-by: Xuan Zhuo
Acked-by: Jason Wang
---
drivers/net/
Create a separate directory for virtio-net. AF_XDP support will be added
later, then a separate xsk.c file will be added, so we should create a
directory for virtio-net.
Signed-off-by: Xuan Zhuo
Acked-by: Jason Wang
---
MAINTAINERS | 2 +-
drivers/net/Kconfig
Introduce helper virtqueue_get_dma_premapped(), then the driver
can know whether dma unmap is needed.
Signed-off-by: Xuan Zhuo
---
drivers/net/virtio/main.c | 22 +-
drivers/net/virtio/virtio_net.h | 3 ---
drivers/virtio/virtio_ring.c| 22 ++
i
## AF_XDP
XDP socket(AF_XDP) is an excellent bypass kernel network framework. The zero
copy feature of xsk (XDP socket) needs to be supported by the driver. The
performance of zero copy is very good. mlx5 and intel ixgbe already support
this feature, This patch set allows virtio-net to support xsk
We move some structures to the header file, but these structures do not
prefixed with virtnet. This patch adds virtnet for these.
Signed-off-by: Xuan Zhuo
---
drivers/net/virtio/main.c | 100
drivers/net/virtio/virtio_net.h | 12 ++--
2 files changed, 56 i
Since free_old_xmit_skbs not only deals with skb, but also xdp frame and
subsequent added xsk, so change the name of this function to
free_old_xmit.
Signed-off-by: Xuan Zhuo
Acked-by: Jason Wang
---
drivers/net/virtio_net.c | 10 +-
1 file changed, 5 insertions(+), 5 deletions(-)
diff
28 matches
Mail list logo