diff options
author | Milan Lenco <milan.lenco@pantheon.tech> | 2017-12-14 10:04:25 +0100 |
---|---|---|
committer | Damjan Marion <dmarion.lists@gmail.com> | 2017-12-14 11:08:49 +0000 |
commit | 73e7f427e8865b0af71740c5ecfa55c7ee78dbd1 (patch) | |
tree | dfd02ef5ad15eda2143d5a092bfd9d5628d47ef6 /src/vnet/devices/tap/tap.c | |
parent | 545d9eaeff62af74b6c1d2c27e6067f40685af93 (diff) |
tap_v2: include host-side parameters in the dump binary API
Change-Id: I097a738b96a304621520f1842dcac7dbf61a8e3f
Signed-off-by: Milan Lenco <milan.lenco@pantheon.tech>
Diffstat (limited to 'src/vnet/devices/tap/tap.c')
-rw-r--r-- | src/vnet/devices/tap/tap.c | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/src/vnet/devices/tap/tap.c b/src/vnet/devices/tap/tap.c index 4f76321071c..ff7bd91e8db 100644 --- a/src/vnet/devices/tap/tap.c +++ b/src/vnet/devices/tap/tap.c @@ -335,10 +335,22 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args) args->mac_addr[0] = 2; args->mac_addr[1] = 0xfe; } + vif->rx_ring_sz = args->rx_ring_sz != 0 ? args->rx_ring_sz : 256; + vif->tx_ring_sz = args->tx_ring_sz != 0 ? args->tx_ring_sz : 256; vif->host_if_name = args->host_if_name; args->host_if_name = 0; vif->net_ns = args->host_namespace; args->host_namespace = 0; + vif->host_bridge = args->host_bridge; + args->host_bridge = 0; + clib_memcpy (vif->host_mac_addr, args->host_mac_addr, 6); + vif->host_ip4_prefix_len = args->host_ip4_prefix_len; + vif->host_ip6_prefix_len = args->host_ip6_prefix_len; + if (args->host_ip4_prefix_len) + clib_memcpy (&vif->host_ip4_addr, &args->host_ip4_addr, 4); + if (args->host_ip6_prefix_len) + clib_memcpy (&vif->host_ip6_addr, &args->host_ip6_addr, 16); + args->error = ethernet_register_interface (vnm, virtio_device_class.index, vif->dev_instance, args->mac_addr, @@ -441,11 +453,39 @@ tap_dump_ifs (tap_interface_details_t ** out_tapids) pool_foreach (vif, mm->interfaces, vec_add2(r_tapids, tapid, 1); memset (tapid, 0, sizeof (*tapid)); + tapid->id = vif->id; tapid->sw_if_index = vif->sw_if_index; hi = vnet_get_hw_interface (vnm, vif->hw_if_index); clib_memcpy(tapid->dev_name, hi->name, - MIN (ARRAY_LEN (tapid->dev_name) - 1, - strlen ((const char *) hi->name))); + MIN (ARRAY_LEN (tapid->dev_name) - 1, + strlen ((const char *) hi->name))); + tapid->rx_ring_sz = vif->rx_ring_sz; + tapid->tx_ring_sz = vif->tx_ring_sz; + clib_memcpy(tapid->host_mac_addr, vif->host_mac_addr, 6); + if (vif->host_if_name) + { + clib_memcpy(tapid->host_if_name, vif->host_if_name, + MIN (ARRAY_LEN (tapid->host_if_name) - 1, + strlen ((const char *) vif->host_if_name))); + } + if (vif->net_ns) + { + clib_memcpy(tapid->host_namespace, vif->net_ns, + MIN (ARRAY_LEN (tapid->host_namespace) - 1, + strlen ((const char *) vif->net_ns))); + } + if (vif->host_bridge) + { + clib_memcpy(tapid->host_bridge, vif->host_bridge, + MIN (ARRAY_LEN (tapid->host_bridge) - 1, + strlen ((const char *) vif->host_bridge))); + } + if (vif->host_ip4_prefix_len) + clib_memcpy(tapid->host_ip4_addr, &vif->host_ip4_addr, 4); + tapid->host_ip4_prefix_len = vif->host_ip4_prefix_len; + if (vif->host_ip6_prefix_len) + clib_memcpy(tapid->host_ip6_addr, &vif->host_ip6_addr, 16); + tapid->host_ip6_prefix_len = vif->host_ip6_prefix_len; ); /* *INDENT-ON* */ |