aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/virtio/virtio.c
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2020-04-06 14:19:54 +0200
committerDamjan Marion <dmarion@me.com>2020-04-17 11:28:14 +0000
commit206acf84d6a04590e385f427edba1094c3bdf195 (patch)
treec724f0d2fedd494e163394a6a339c18dc72c0a37 /src/vnet/devices/virtio/virtio.c
parent95eb01fdc65b692065ace6d76870d8cc9f3e2c84 (diff)
tap: add initial support for tun
Type: feature Change-Id: I699a01ac925fe5c475a36032edb7018618bb4dd4 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vnet/devices/virtio/virtio.c')
-rw-r--r--src/vnet/devices/virtio/virtio.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/vnet/devices/virtio/virtio.c b/src/vnet/devices/virtio/virtio.c
index d78c9114e5c..00a588af346 100644
--- a/src/vnet/devices/virtio/virtio.c
+++ b/src/vnet/devices/virtio/virtio.c
@@ -294,7 +294,7 @@ virtio_show (vlib_main_t * vm, u32 * hw_if_indices, u8 show_descr, u32 type)
vlib_cli_output (vm, " PCI Address: %U", format_vlib_pci_addr,
&vif->pci_addr);
}
- if (type == VIRTIO_IF_TYPE_TAP)
+ if (type & (VIRTIO_IF_TYPE_TAP | VIRTIO_IF_TYPE_TUN))
{
u8 *str = 0;
if (vif->host_if_name)
@@ -304,8 +304,9 @@ virtio_show (vlib_main_t * vm, u32 * hw_if_indices, u8 show_descr, u32 type)
if (vif->host_mtu_size)
vlib_cli_output (vm, " host-mtu-size \"%d\"",
vif->host_mtu_size);
- vlib_cli_output (vm, " host-mac-addr: %U",
- format_ethernet_address, vif->host_mac_addr);
+ if (type == VIRTIO_IF_TYPE_TAP)
+ vlib_cli_output (vm, " host-mac-addr: %U",
+ format_ethernet_address, vif->host_mac_addr);
vec_foreach_index (i, vif->vhost_fds)
str = format (str, " %d", vif->vhost_fds[i]);
@@ -315,8 +316,9 @@ virtio_show (vlib_main_t * vm, u32 * hw_if_indices, u8 show_descr, u32 type)
}
vlib_cli_output (vm, " gso-enabled %d", vif->gso_enabled);
vlib_cli_output (vm, " csum-enabled %d", vif->csum_offload_enabled);
- vlib_cli_output (vm, " Mac Address: %U", format_ethernet_address,
- vif->mac_addr);
+ if (type & (VIRTIO_IF_TYPE_TAP | VIRTIO_IF_TYPE_PCI))
+ vlib_cli_output (vm, " Mac Address: %U", format_ethernet_address,
+ vif->mac_addr);
vlib_cli_output (vm, " Device instance: %u", vif->dev_instance);
vlib_cli_output (vm, " flags 0x%x", vif->flags);
flag_entry = (struct feat_struct *) &flags_array;
@@ -366,7 +368,7 @@ virtio_show (vlib_main_t * vm, u32 * hw_if_indices, u8 show_descr, u32 type)
" avail.flags 0x%x avail.idx %d used.flags 0x%x used.idx %d",
vring->avail->flags, vring->avail->idx,
vring->used->flags, vring->used->idx);
- if (type == VIRTIO_IF_TYPE_TAP)
+ if (type & (VIRTIO_IF_TYPE_TAP | VIRTIO_IF_TYPE_TUN))
{
vlib_cli_output (vm, " kickfd %d, callfd %d", vring->kick_fd,
vring->call_fd);
@@ -401,7 +403,7 @@ virtio_show (vlib_main_t * vm, u32 * hw_if_indices, u8 show_descr, u32 type)
" avail.flags 0x%x avail.idx %d used.flags 0x%x used.idx %d",
vring->avail->flags, vring->avail->idx,
vring->used->flags, vring->used->idx);
- if (type == VIRTIO_IF_TYPE_TAP)
+ if (type & (VIRTIO_IF_TYPE_TAP | VIRTIO_IF_TYPE_TUN))
{
vlib_cli_output (vm, " kickfd %d, callfd %d", vring->kick_fd,
vring->call_fd);
@@ -437,7 +439,7 @@ virtio_show (vlib_main_t * vm, u32 * hw_if_indices, u8 show_descr, u32 type)
" avail.flags 0x%x avail.idx %d used.flags 0x%x used.idx %d",
vring->avail->flags, vring->avail->idx,
vring->used->flags, vring->used->idx);
- if (type == VIRTIO_IF_TYPE_TAP)
+ if (type & (VIRTIO_IF_TYPE_TAP | VIRTIO_IF_TYPE_TUN))
{
vlib_cli_output (vm, " kickfd %d, callfd %d", vring->kick_fd,
vring->call_fd);