summaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/tap/tap.c
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2020-08-31 17:17:16 +0200
committerDamjan Marion <dmarion@me.com>2020-09-04 13:34:20 +0000
commita7a2281732b926df139b0fd946a084299d813654 (patch)
tree9e6eb7d5a2774c62e1d84041fe0b01182b0ab087 /src/vnet/devices/tap/tap.c
parentf1cd3da20f1a5a7ed94a18b6d7ea4bf9d491a7d3 (diff)
virtio: remove kernel virtio header dependencies
Type: refactor tap, virtio and vhost use virtio/vhost header files from linux kernel. Different features are supported on different kernel versions, making it difficult to use those in VPP. This patch removes virtio/vhost based header dependencies to local header files. Change-Id: I064a8adb5cd9753c986b6f224bb075200b3856af Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vnet/devices/tap/tap.c')
-rw-r--r--src/vnet/devices/tap/tap.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/vnet/devices/tap/tap.c b/src/vnet/devices/tap/tap.c
index a76b4e0c16a..c265aa201ec 100644
--- a/src/vnet/devices/tap/tap.c
+++ b/src/vnet/devices/tap/tap.c
@@ -22,8 +22,6 @@
#include <net/if.h>
#include <linux/if_tun.h>
#include <sys/ioctl.h>
-#include <linux/virtio_net.h>
-#include <linux/vhost.h>
#include <sys/eventfd.h>
#include <net/if_arp.h>
#include <sched.h>
@@ -144,7 +142,7 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args)
struct ifreq ifr = {.ifr_flags = IFF_NO_PI | IFF_VNET_HDR };
struct ifreq get_ifr = {.ifr_flags = 0 };
size_t hdrsz;
- struct vhost_memory *vhost_mem = 0;
+ vhost_memory_t *vhost_mem = 0;
virtio_if_t *vif = 0;
clib_error_t *err = 0;
unsigned int tap_features;
@@ -268,7 +266,7 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args)
else
ifr.ifr_flags |= IFF_MULTI_QUEUE;
- hdrsz = sizeof (struct virtio_net_hdr_v1);
+ hdrsz = sizeof (virtio_net_hdr_v1_t);
if (args->tap_flags & TAP_FLAG_GSO)
{
offload = TUN_F_CSUM | TUN_F_TSO4 | TUN_F_TSO6;
@@ -588,7 +586,7 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args)
}
/* setup features and memtable */
- i = sizeof (struct vhost_memory) + sizeof (struct vhost_memory_region);
+ i = sizeof (vhost_memory_t) + sizeof (vhost_memory_region_t);
vhost_mem = clib_mem_alloc (i);
clib_memset (vhost_mem, 0, i);
vhost_mem->nregions = 1;
@@ -618,9 +616,9 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args)
/* finish initializing queue pair */
for (i = 0; i < num_vhost_queues * 2; i++)
{
- struct vhost_vring_addr addr = { 0 };
- struct vhost_vring_state state = { 0 };
- struct vhost_vring_file file = { 0 };
+ vhost_vring_addr_t addr = { 0 };
+ vhost_vring_state_t state = { 0 };
+ vhost_vring_file_t file = { 0 };
virtio_vring_t *vring;
u16 qp = i >> 1;
int fd = vif->vhost_fds[qp];