Commit c5d3705c authored by Yunsheng Lin's avatar Yunsheng Lin Committed by Paolo Abeni

tools: virtio: introduce vhost_net_test

introduce vhost_net_test for both vhost_net tx and rx basing
on virtio_test to test vhost_net changing in the kernel.

Steps for vhost_net tx testing:
1. Prepare a out buf.
2. Kick the vhost_net to do tx processing.
3. Do the receiving in the tun side.
4. verify the data received by tun is correct.

Steps for vhost_net rx testing:
1. Prepare a in buf.
2. Do the sending in the tun side.
3. Kick the vhost_net to do rx processing.
4. verify the data received by vhost_net is correct.
Signed-off-by: default avatarYunsheng Lin <linyunsheng@huawei.com>
Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 4051bd81
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
*.d *.d
virtio_test virtio_test
vhost_net_test
vringh_test vringh_test
virtio-trace/trace-agent virtio-trace/trace-agent
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
all: test mod all: test mod
test: virtio_test vringh_test test: virtio_test vringh_test vhost_net_test
virtio_test: virtio_ring.o virtio_test.o virtio_test: virtio_ring.o virtio_test.o
vringh_test: vringh_test.o vringh.o virtio_ring.o vringh_test: vringh_test.o vringh.o virtio_ring.o
vhost_net_test: virtio_ring.o vhost_net_test.o
try-run = $(shell set -e; \ try-run = $(shell set -e; \
if ($(1)) >/dev/null 2>&1; \ if ($(1)) >/dev/null 2>&1; \
...@@ -49,6 +50,7 @@ oot-clean: OOT_BUILD+=clean ...@@ -49,6 +50,7 @@ oot-clean: OOT_BUILD+=clean
.PHONY: all test mod clean vhost oot oot-clean oot-build .PHONY: all test mod clean vhost oot oot-clean oot-build
clean: clean:
${RM} *.o vringh_test virtio_test vhost_test/*.o vhost_test/.*.cmd \ ${RM} *.o vringh_test virtio_test vhost_net_test vhost_test/*.o \
vhost_test/Module.symvers vhost_test/modules.order *.d vhost_test/.*.cmd vhost_test/Module.symvers \
vhost_test/modules.order *.d
-include *.d -include *.d
/* SPDX-License-Identifier: GPL-2.0 */ /* SPDX-License-Identifier: GPL-2.0 */
#ifndef LINUX_VIRTIO_CONFIG_H
#define LINUX_VIRTIO_CONFIG_H
#include <linux/virtio_byteorder.h> #include <linux/virtio_byteorder.h>
#include <linux/virtio.h> #include <linux/virtio.h>
#include <uapi/linux/virtio_config.h> #include <uapi/linux/virtio_config.h>
...@@ -95,3 +97,5 @@ static inline __virtio64 cpu_to_virtio64(struct virtio_device *vdev, u64 val) ...@@ -95,3 +97,5 @@ static inline __virtio64 cpu_to_virtio64(struct virtio_device *vdev, u64 val)
{ {
return __cpu_to_virtio64(virtio_is_little_endian(vdev), val); return __cpu_to_virtio64(virtio_is_little_endian(vdev), val);
} }
#endif
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment