Skip to content

Commit

Permalink
Merge pull request torvalds#189 from liuyuan10/fixt
Browse files Browse the repository at this point in the history
Add test for tap offloading
  • Loading branch information
Octavian Purdila authored Aug 3, 2016
2 parents 47e5676 + ddf318c commit 343ec93
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tools/lkl/lib/virtio_net_linux_fdnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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");
Expand Down
3 changes: 2 additions & 1 deletion tools/lkl/lib/virtio_net_tap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
9 changes: 8 additions & 1 deletion tools/lkl/tests/hijack-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,14 @@ echo "$ans" | tail -n 15 | grep "192.168.13.1"
ans=$(${hijack_script} ip -6 route show) || true
echo "$ans" | tail -n 15 | grep "2001:db8:0:f102::1"

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 =="
Expand Down

0 comments on commit 343ec93

Please sign in to comment.