From 2f3ee35bf89aed5b5e75a4437663f29b9ef433cc Mon Sep 17 00:00:00 2001 From: Yuan Liu Date: Wed, 3 Aug 2016 09:41:02 -0700 Subject: [PATCH 1/2] lkl: Fix EINVAL in virtio net fd Signed-off-by: Yuan Liu --- tools/lkl/lib/virtio_net_linux_fdnet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/lkl/lib/virtio_net_linux_fdnet.c b/tools/lkl/lib/virtio_net_linux_fdnet.c index f98c886be7cf58..d8776706a0e86d 100644 --- a/tools/lkl/lib/virtio_net_linux_fdnet.c +++ b/tools/lkl/lib/virtio_net_linux_fdnet.c @@ -47,7 +47,7 @@ static int linux_fdnet_net_tx(struct lkl_netdev *nd, do { ret = writev(nd_fdnet->fd, (struct iovec *)iov, cnt); - } while (ret == -1 && errno == EINVAL); + } while (ret == -1 && errno == EINTR); if (ret < 0 && errno != EAGAIN) perror("write to Linux fd netdev fails"); @@ -63,7 +63,7 @@ static int linux_fdnet_net_rx(struct lkl_netdev *nd, do { ret = readv(nd_fdnet->fd, (struct iovec *)iov, cnt); - } while (ret == -1 && errno == EINVAL); + } while (ret == -1 && errno == EINTR); if (ret < 0 && errno != EAGAIN) perror("read from fdnet device fails"); From ddf318c6813a4de7572d7df6754e907be16e6747 Mon Sep 17 00:00:00 2001 From: Yuan Liu Date: Wed, 3 Aug 2016 10:55:16 -0700 Subject: [PATCH 2/2] lkl: add test for tap offloading Signed-off-by: Yuan Liu --- tools/lkl/lib/virtio_net_tap.c | 3 ++- tools/lkl/tests/hijack-test.sh | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/lkl/lib/virtio_net_tap.c b/tools/lkl/lib/virtio_net_tap.c index 76ee2bb23089d2..a8f180f5a4fc50 100644 --- a/tools/lkl/lib/virtio_net_tap.c +++ b/tools/lkl/lib/virtio_net_tap.c @@ -66,7 +66,7 @@ struct lkl_netdev *lkl_netdev_tap_create(const char *ifname, int offload) close(fd); return NULL; } - if (tap_arg && ioctl(fd, TUNSETOFFLOAD, tap_arg) != 0) { + if (ioctl(fd, TUNSETOFFLOAD, tap_arg) != 0) { fprintf(stderr, "tap: failed to TUNSETOFFLOAD to %s: %s\n", ifr.ifr_name, strerror(errno)); close(fd); @@ -75,6 +75,7 @@ struct lkl_netdev *lkl_netdev_tap_create(const char *ifname, int offload) nd = lkl_register_netdev_linux_fdnet(fd); if (!nd) { perror("failed to register to."); + close(fd); return NULL; } nd->dev.has_vnet_hdr = (vnet_hdr_sz != 0); diff --git a/tools/lkl/tests/hijack-test.sh b/tools/lkl/tests/hijack-test.sh index 9d98e8ca70673c..7fcd49a5aa058f 100755 --- a/tools/lkl/tests/hijack-test.sh +++ b/tools/lkl/tests/hijack-test.sh @@ -101,7 +101,14 @@ echo "$ans" | tail -n 15 | grep "12:34:56:78:9a:bc" echo "$ans" | tail -n 15 | grep "12:34:56:78:9a:be" -sh ${script_dir}/run_netperf.sh 192.168.13.1 1 0 TCP_STREAM +# LKL_VIRTIO_NET_F_HOST_TSO4 && LKL_VIRTIO_NET_F_GUEST_TSO4 +# LKL_VIRTIO_NET_F_CSUM && LKL_VIRTIO_NET_F_GUEST_CSUM +LKL_HIJACK_OFFLOAD=0x883 sh ${script_dir}/run_netperf.sh 192.168.13.1 1 0 TCP_STREAM +LKL_HIJACK_OFFLOAD=0x883 sh ${script_dir}/run_netperf.sh 192.168.13.1 1 0 TCP_MAERTS + +# LKL_VIRTIO_NET_F_HOST_TSO4 && LKL_VIRTIO_NET_F_MRG_RXBUF +# LKL_VIRTIO_NET_F_CSUM && LKL_VIRTIO_NET_F_GUEST_CSUM +LKL_HIJACK_OFFLOAD=0x8803 sh ${script_dir}/run_netperf.sh 192.168.13.1 1 0 TCP_MAERTS sh ${script_dir}/run_netperf.sh 192.168.13.1 1 0 TCP_RR echo "== VDE tests =="