Skip to content

Commit 343ec93

Browse files
author
Octavian Purdila
authored
Merge pull request torvalds#189 from liuyuan10/fixt
Add test for tap offloading
2 parents 47e5676 + ddf318c commit 343ec93

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

tools/lkl/lib/virtio_net_linux_fdnet.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static int linux_fdnet_net_tx(struct lkl_netdev *nd,
4747

4848
do {
4949
ret = writev(nd_fdnet->fd, (struct iovec *)iov, cnt);
50-
} while (ret == -1 && errno == EINVAL);
50+
} while (ret == -1 && errno == EINTR);
5151

5252
if (ret < 0 && errno != EAGAIN)
5353
perror("write to Linux fd netdev fails");
@@ -63,7 +63,7 @@ static int linux_fdnet_net_rx(struct lkl_netdev *nd,
6363

6464
do {
6565
ret = readv(nd_fdnet->fd, (struct iovec *)iov, cnt);
66-
} while (ret == -1 && errno == EINVAL);
66+
} while (ret == -1 && errno == EINTR);
6767

6868
if (ret < 0 && errno != EAGAIN)
6969
perror("read from fdnet device fails");

tools/lkl/lib/virtio_net_tap.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ struct lkl_netdev *lkl_netdev_tap_create(const char *ifname, int offload)
6666
close(fd);
6767
return NULL;
6868
}
69-
if (tap_arg && ioctl(fd, TUNSETOFFLOAD, tap_arg) != 0) {
69+
if (ioctl(fd, TUNSETOFFLOAD, tap_arg) != 0) {
7070
fprintf(stderr, "tap: failed to TUNSETOFFLOAD to %s: %s\n",
7171
ifr.ifr_name, strerror(errno));
7272
close(fd);
@@ -75,6 +75,7 @@ struct lkl_netdev *lkl_netdev_tap_create(const char *ifname, int offload)
7575
nd = lkl_register_netdev_linux_fdnet(fd);
7676
if (!nd) {
7777
perror("failed to register to.");
78+
close(fd);
7879
return NULL;
7980
}
8081
nd->dev.has_vnet_hdr = (vnet_hdr_sz != 0);

tools/lkl/tests/hijack-test.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,14 @@ echo "$ans" | tail -n 15 | grep "192.168.13.1"
118118
ans=$(${hijack_script} ip -6 route show) || true
119119
echo "$ans" | tail -n 15 | grep "2001:db8:0:f102::1"
120120

121-
sh ${script_dir}/run_netperf.sh 192.168.13.1 1 0 TCP_STREAM
121+
# LKL_VIRTIO_NET_F_HOST_TSO4 && LKL_VIRTIO_NET_F_GUEST_TSO4
122+
# LKL_VIRTIO_NET_F_CSUM && LKL_VIRTIO_NET_F_GUEST_CSUM
123+
LKL_HIJACK_OFFLOAD=0x883 sh ${script_dir}/run_netperf.sh 192.168.13.1 1 0 TCP_STREAM
124+
LKL_HIJACK_OFFLOAD=0x883 sh ${script_dir}/run_netperf.sh 192.168.13.1 1 0 TCP_MAERTS
125+
126+
# LKL_VIRTIO_NET_F_HOST_TSO4 && LKL_VIRTIO_NET_F_MRG_RXBUF
127+
# LKL_VIRTIO_NET_F_CSUM && LKL_VIRTIO_NET_F_GUEST_CSUM
128+
LKL_HIJACK_OFFLOAD=0x8803 sh ${script_dir}/run_netperf.sh 192.168.13.1 1 0 TCP_MAERTS
122129
sh ${script_dir}/run_netperf.sh 192.168.13.1 1 0 TCP_RR
123130

124131
echo "== VDE tests =="

0 commit comments

Comments
 (0)