FD.io VPP  v18.01-8-g0eacf49
Vector Packet Processing
tap.c
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * Copyright (c) 2017 Cisco and/or its affiliates.
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *------------------------------------------------------------------
16  */
17 
18 #define _GNU_SOURCE
19 #include <sys/types.h>
20 #include <sys/stat.h>
21 #include <fcntl.h>
22 #include <net/if.h>
23 #include <linux/if_tun.h>
24 #include <sys/ioctl.h>
25 #include <linux/virtio_net.h>
26 #include <linux/vhost.h>
27 #include <sys/eventfd.h>
28 #include <sched.h>
29 
30 #include <linux/netlink.h>
31 #include <linux/rtnetlink.h>
32 
33 #include <vlib/vlib.h>
34 #include <vlib/unix/unix.h>
35 #include <vnet/ethernet/ethernet.h>
36 #include <vnet/ip/ip4_packet.h>
37 #include <vnet/ip/ip6_packet.h>
38 #include <vnet/devices/netlink.h>
40 #include <vnet/devices/tap/tap.h>
41 
43 
44 #define _IOCTL(fd,a,...) \
45  if (ioctl (fd, a, __VA_ARGS__) < 0) \
46  { \
47  err = clib_error_return_unix (0, "ioctl(" #a ")"); \
48  goto error; \
49  }
50 
51 static u32
53  u32 flags)
54 {
55  /* nothing for now */
56  //TODO On MTU change call vnet_netlink_set_if_mtu
57  return 0;
58 }
59 
60 static int
61 open_netns_fd (char *netns)
62 {
63  u8 *s = 0;
64  int fd;
65 
66  if (strncmp (netns, "pid:", 4) == 0)
67  s = format (0, "/proc/%u/ns/net%c", atoi (netns + 4), 0);
68  else if (netns[0] == '/')
69  s = format (0, "%s%c", netns, 0);
70  else
71  s = format (0, "/var/run/netns/%s%c", netns, 0);
72 
73  fd = open ((char *) s, O_RDONLY);
74  vec_free (s);
75  return fd;
76 }
77 
78 
79 void
81 {
82  vnet_main_t *vnm = vnet_get_main ();
83  virtio_main_t *vim = &virtio_main;
84  tap_main_t *tm = &tap_main;
87  int i;
88  int old_netns_fd = -1;
89  struct ifreq ifr;
90  size_t hdrsz;
91  struct vhost_memory *vhost_mem = 0;
92  virtio_if_t *vif = 0;
93  clib_error_t *err = 0;
94  uword *p;
95 
96  if (args->id != ~0)
97  {
98  p = hash_get (tm->dev_instance_by_interface_id, args->id);
99  if (p)
100  {
101  args->rv = VNET_API_ERROR_INVALID_INTERFACE;
102  args->error = clib_error_return (0, "interface already exists");
103  return;
104  }
105  }
106  else
107  {
108  int tries = 1000;
109  while (--tries)
110  {
111  args->id = tm->last_used_interface_id++;
112  p = hash_get (tm->dev_instance_by_interface_id, args->id);
113  if (!p)
114  break;
115  }
116 
117  if (!tries)
118  {
119  args->rv = VNET_API_ERROR_UNSPECIFIED;
120  args->error =
121  clib_error_return (0, "cannot find free interface id");
122  return;
123  }
124  }
125 
126  memset (&ifr, 0, sizeof (ifr));
127  pool_get (vim->interfaces, vif);
128  vif->dev_instance = vif - vim->interfaces;
129  vif->tap_fd = -1;
130  vif->id = args->id;
131 
133 
134  if ((vif->fd = open ("/dev/vhost-net", O_RDWR | O_NONBLOCK)) < 0)
135  {
136  args->rv = VNET_API_ERROR_SYSCALL_ERROR_1;
137  args->error = clib_error_return_unix (0, "open '/dev/vhost-net'");
138  goto error;
139  }
140 
141  _IOCTL (vif->fd, VHOST_GET_FEATURES, &vif->remote_features);
142 
143  if ((vif->remote_features & (1ULL << VIRTIO_NET_F_MRG_RXBUF)) == 0)
144  {
145  args->rv = VNET_API_ERROR_UNSUPPORTED;
146  args->error = clib_error_return (0, "vhost-net backend doesn't support "
147  "VIRTIO_NET_F_MRG_RXBUF feature");
148  goto error;
149  }
150 
151  if ((vif->remote_features & (1ULL << VIRTIO_RING_F_INDIRECT_DESC)) == 0)
152  {
153  args->rv = VNET_API_ERROR_UNSUPPORTED;
154  args->error = clib_error_return (0, "vhost-net backend doesn't support "
155  "VIRTIO_RING_F_INDIRECT_DESC feature");
156  goto error;
157  }
158 
159  if ((vif->remote_features & (1ULL << VIRTIO_F_VERSION_1)) == 0)
160  {
161  args->rv = VNET_API_ERROR_UNSUPPORTED;
162  args->error = clib_error_return (0, "vhost-net backend doesn't support "
163  "VIRTIO_F_VERSION_1 features");
164  goto error;
165  }
166 
167  vif->features |= 1ULL << VIRTIO_NET_F_MRG_RXBUF;
168  vif->features |= 1ULL << VIRTIO_F_VERSION_1;
169  vif->features |= 1ULL << VIRTIO_RING_F_INDIRECT_DESC;
170 
171  _IOCTL (vif->fd, VHOST_SET_FEATURES, &vif->features);
172 
173  if ((vif->tap_fd = open ("/dev/net/tun", O_RDWR | O_NONBLOCK)) < 0)
174  {
175  args->rv = VNET_API_ERROR_SYSCALL_ERROR_2;
176  args->error = clib_error_return_unix (0, "open '/dev/net/tun'");
177  goto error;
178  }
179 
180  ifr.ifr_flags = IFF_TAP | IFF_NO_PI | IFF_ONE_QUEUE | IFF_VNET_HDR;
181  _IOCTL (vif->tap_fd, TUNSETIFF, (void *) &ifr);
182  vif->ifindex = if_nametoindex (ifr.ifr_ifrn.ifrn_name);
183 
184  unsigned int offload = 0;
185  hdrsz = sizeof (struct virtio_net_hdr_v1);
186  _IOCTL (vif->tap_fd, TUNSETOFFLOAD, offload);
187  _IOCTL (vif->tap_fd, TUNSETVNETHDRSZ, &hdrsz);
188  _IOCTL (vif->fd, VHOST_SET_OWNER, 0);
189 
190  /* if namespace is specified, all further netlink messages should be excuted
191  after we change our net namespace */
192  if (args->host_namespace)
193  {
194  int fd;
195  old_netns_fd = open ("/proc/self/ns/net", O_RDONLY);
196  if ((fd = open_netns_fd ((char *) args->host_namespace)) == -1)
197  {
198  args->rv = VNET_API_ERROR_SYSCALL_ERROR_2;
199  args->error = clib_error_return_unix (0, "open_netns_fd '%s'",
200  args->host_namespace);
201  goto error;
202  }
203  args->error = vnet_netlink_set_link_netns (vif->ifindex, fd,
204  (char *) args->host_if_name);
205  if (args->error)
206  {
207  args->rv = VNET_API_ERROR_NETLINK_ERROR;
208  goto error;
209  }
210  if (setns (fd, CLONE_NEWNET) == -1)
211  {
212  args->rv = VNET_API_ERROR_SYSCALL_ERROR_3;
213  args->error = clib_error_return_unix (0, "setns '%s'",
214  args->host_namespace);
215  goto error;
216  }
217  close (fd);
218  if ((vif->ifindex = if_nametoindex ((char *) args->host_if_name)) == 0)
219  {
220  args->rv = VNET_API_ERROR_SYSCALL_ERROR_3;
221  args->error = clib_error_return_unix (0, "if_nametoindex '%s'",
222  args->host_if_name);
223  goto error;
224  }
225  }
226  else
227  {
228  if (args->host_if_name)
229  {
231  (char *)
232  args->host_if_name);
233  if (args->error)
234  {
235  args->rv = VNET_API_ERROR_NETLINK_ERROR;
236  goto error;
237  }
238  }
239  }
240 
242  {
244  args->host_mac_addr);
245  if (args->error)
246  {
247  args->rv = VNET_API_ERROR_NETLINK_ERROR;
248  goto error;
249  }
250  }
251 
252  if (args->host_bridge)
253  {
255  (char *) args->host_bridge);
256  if (args->error)
257  {
258  args->rv = VNET_API_ERROR_NETLINK_ERROR;
259  goto error;
260  }
261  }
262 
263 
264  if (args->host_ip4_prefix_len)
265  {
267  &args->host_ip4_addr,
268  args->host_ip4_prefix_len);
269  if (args->error)
270  {
271  args->rv = VNET_API_ERROR_NETLINK_ERROR;
272  goto error;
273  }
274  }
275 
276  if (args->host_ip6_prefix_len)
277  {
279  &args->host_ip6_addr,
280  args->host_ip6_prefix_len);
281  if (args->error)
282  {
283  args->rv = VNET_API_ERROR_NETLINK_ERROR;
284  goto error;
285  }
286  }
287 
288  args->error = vnet_netlink_set_link_state (vif->ifindex, 1 /* UP */ );
289  if (args->error)
290  {
291  args->rv = VNET_API_ERROR_NETLINK_ERROR;
292  goto error;
293  }
294 
295  /* switch back to old net namespace */
296  if (args->host_namespace)
297  {
298  if (setns (old_netns_fd, CLONE_NEWNET) == -1)
299  {
300  args->rv = VNET_API_ERROR_SYSCALL_ERROR_2;
301  args->error = clib_error_return_unix (0, "setns '%s'",
302  args->host_namespace);
303  goto error;
304  }
305  }
306 
307  /* Set vhost memory table */
308  i = sizeof (struct vhost_memory) + sizeof (struct vhost_memory_region);
309  vhost_mem = clib_mem_alloc (i);
310  memset (vhost_mem, 0, i);
311  vhost_mem->nregions = 1;
312  vhost_mem->regions[0].memory_size = (1ULL << 47) - 4096;
313  _IOCTL (vif->fd, VHOST_SET_MEM_TABLE, vhost_mem);
314 
315  if ((args->error = virtio_vring_init (vm, vif, 0, args->rx_ring_sz)))
316  {
317  args->rv = VNET_API_ERROR_INIT_FAILED;
318  goto error;
319  }
320 
321  if ((args->error = virtio_vring_init (vm, vif, 1, args->tx_ring_sz)))
322  {
323  args->rv = VNET_API_ERROR_INIT_FAILED;
324  goto error;
325  }
326 
327  if (!args->mac_addr_set)
328  {
329  f64 now = vlib_time_now (vm);
330  u32 rnd;
331  rnd = (u32) (now * 1e6);
332  rnd = random_u32 (&rnd);
333 
334  memcpy (args->mac_addr + 2, &rnd, sizeof (rnd));
335  args->mac_addr[0] = 2;
336  args->mac_addr[1] = 0xfe;
337  }
338  vif->rx_ring_sz = args->rx_ring_sz != 0 ? args->rx_ring_sz : 256;
339  vif->tx_ring_sz = args->tx_ring_sz != 0 ? args->tx_ring_sz : 256;
340  vif->host_if_name = args->host_if_name;
341  args->host_if_name = 0;
342  vif->net_ns = args->host_namespace;
343  args->host_namespace = 0;
344  vif->host_bridge = args->host_bridge;
345  args->host_bridge = 0;
346  clib_memcpy (vif->host_mac_addr, args->host_mac_addr, 6);
349  if (args->host_ip4_prefix_len)
350  clib_memcpy (&vif->host_ip4_addr, &args->host_ip4_addr, 4);
351  if (args->host_ip6_prefix_len)
352  clib_memcpy (&vif->host_ip6_addr, &args->host_ip6_addr, 16);
353 
355  vif->dev_instance,
356  args->mac_addr,
357  &vif->hw_if_index,
359  if (args->error)
360  {
361  args->rv = VNET_API_ERROR_INVALID_REGISTRATION;
362  goto error;
363  }
364 
365  sw = vnet_get_hw_sw_interface (vnm, vif->hw_if_index);
366  vif->sw_if_index = sw->sw_if_index;
367  args->sw_if_index = vif->sw_if_index;
368  hw = vnet_get_hw_interface (vnm, vif->hw_if_index);
371  virtio_input_node.index);
375  vif->per_interface_next_index = ~0;
376  vif->type = VIRTIO_IF_TYPE_TAP;
377  vif->flags |= VIRTIO_IF_FLAG_ADMIN_UP;
380  goto done;
381 
382 error:
383  if (err)
384  {
385  ASSERT (args->error == 0);
386  args->error = err;
387  args->rv = VNET_API_ERROR_SYSCALL_ERROR_3;
388  }
389  if (vif->tap_fd != -1)
390  close (vif->tap_fd);
391  if (vif->fd != -1)
392  close (vif->fd);
393  vec_foreach_index (i, vif->vrings) virtio_vring_free (vm, vif, i);
394  memset (vif, 0, sizeof (virtio_if_t));
395  pool_put (vim->interfaces, vif);
396 
397 done:
398  if (vhost_mem)
399  clib_mem_free (vhost_mem);
400  if (old_netns_fd != -1)
401  close (old_netns_fd);
402 }
403 
404 int
405 tap_delete_if (vlib_main_t * vm, u32 sw_if_index)
406 {
407  vnet_main_t *vnm = vnet_get_main ();
408  virtio_main_t *mm = &virtio_main;
409  tap_main_t *tm = &tap_main;
410  int i;
411  virtio_if_t *vif;
413 
414  hw = vnet_get_sup_hw_interface (vnm, sw_if_index);
415  if (hw == NULL || virtio_device_class.index != hw->dev_class_index)
416  return VNET_API_ERROR_INVALID_SW_IF_INDEX;
417 
418  vif = pool_elt_at_index (mm->interfaces, hw->dev_instance);
419 
420  /* bring down the interface */
423 
425  vif->hw_if_index = ~0;
426 
427  if (vif->tap_fd != -1)
428  close (vif->tap_fd);
429  if (vif->fd != -1)
430  close (vif->fd);
431 
432  vec_foreach_index (i, vif->vrings) virtio_vring_free (vm, vif, i);
433  vec_free (vif->vrings);
434 
436  memset (vif, 0, sizeof (*vif));
437  pool_put (mm->interfaces, vif);
438 
439  return 0;
440 }
441 
442 int
444 {
445  vnet_main_t *vnm = vnet_get_main ();
446  virtio_main_t *mm = &virtio_main;
447  virtio_if_t *vif;
449  tap_interface_details_t *r_tapids = NULL;
450  tap_interface_details_t *tapid = NULL;
451 
452  /* *INDENT-OFF* */
453  pool_foreach (vif, mm->interfaces,
454  vec_add2(r_tapids, tapid, 1);
455  memset (tapid, 0, sizeof (*tapid));
456  tapid->id = vif->id;
457  tapid->sw_if_index = vif->sw_if_index;
458  hi = vnet_get_hw_interface (vnm, vif->hw_if_index);
459  clib_memcpy(tapid->dev_name, hi->name,
460  MIN (ARRAY_LEN (tapid->dev_name) - 1,
461  strlen ((const char *) hi->name)));
462  tapid->rx_ring_sz = vif->rx_ring_sz;
463  tapid->tx_ring_sz = vif->tx_ring_sz;
464  clib_memcpy(tapid->host_mac_addr, vif->host_mac_addr, 6);
465  if (vif->host_if_name)
466  {
468  MIN (ARRAY_LEN (tapid->host_if_name) - 1,
469  strlen ((const char *) vif->host_if_name)));
470  }
471  if (vif->net_ns)
472  {
473  clib_memcpy(tapid->host_namespace, vif->net_ns,
474  MIN (ARRAY_LEN (tapid->host_namespace) - 1,
475  strlen ((const char *) vif->net_ns)));
476  }
477  if (vif->host_bridge)
478  {
479  clib_memcpy(tapid->host_bridge, vif->host_bridge,
480  MIN (ARRAY_LEN (tapid->host_bridge) - 1,
481  strlen ((const char *) vif->host_bridge)));
482  }
483  if (vif->host_ip4_prefix_len)
484  clib_memcpy(tapid->host_ip4_addr, &vif->host_ip4_addr, 4);
486  if (vif->host_ip6_prefix_len)
487  clib_memcpy(tapid->host_ip6_addr, &vif->host_ip6_addr, 16);
489  );
490  /* *INDENT-ON* */
491 
492  *out_tapids = r_tapids;
493 
494  return 0;
495 }
496 
497 static clib_error_t *
499 {
500  tap_main_t *tm = &tap_main;
501  tm->dev_instance_by_interface_id = hash_create (0, sizeof (uword));
502  return 0;
503 }
504 
506 
507 /*
508  * fd.io coding-style-patch-verification: ON
509  *
510  * Local Variables:
511  * eval: (c-set-style "gnu")
512  * End:
513  */
u32 per_interface_next_index
Definition: virtio.h:98
vmrglw vmrglh hi
#define vec_foreach_index(var, v)
Iterate over vector indices.
vlib_node_registration_t virtio_input_node
(constructor) VLIB_REGISTER_NODE (virtio_input_node)
Definition: node.c:284
#define hash_set(h, key, value)
Definition: hash.h:254
virtio_if_t * interfaces
Definition: virtio.h:122
sll srl srl sll sra u16x4 i
Definition: vector_sse2.h:337
static u32 virtio_eth_flag_change(vnet_main_t *vnm, vnet_hw_interface_t *hi, u32 flags)
Definition: tap.c:52
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
Definition: interface.c:538
ip4_address_t host_ip4_addr
Definition: virtio.h:112
u8 host_if_name[64]
Definition: tap.h:55
#define hash_unset(h, key)
Definition: hash.h:260
u8 host_namespace[64]
Definition: tap.h:56
ip4_address_t host_ip4_addr
Definition: tap.h:36
void ethernet_delete_interface(vnet_main_t *vnm, u32 hw_if_index)
Definition: interface.c:322
vnet_main_t * vnet_get_main(void)
Definition: misc.c:47
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
u32 dev_instance
Definition: virtio.h:95
#define NULL
Definition: clib.h:55
static f64 vlib_time_now(vlib_main_t *vm)
Definition: main.h:224
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
u8 host_ip6_prefix_len
Definition: tap.h:39
vnet_device_class_t virtio_device_class
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
Definition: vec.h:557
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:419
#define VNET_HW_INTERFACE_FLAG_LINK_UP
Definition: interface.h:394
virtio_vring_t * vrings
Definition: virtio.h:101
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
Definition: pool.h:225
int tap_dump_ifs(tap_interface_details_t **out_tapids)
Definition: tap.c:443
#define MIN(x, y)
Definition: tap.h:22
static vnet_sw_interface_t * vnet_get_hw_sw_interface(vnet_main_t *vnm, u32 hw_if_index)
u8 host_bridge[64]
Definition: tap.h:57
u8 host_ip6_addr[16]
Definition: tap.h:60
u64 features
Definition: virtio.h:103
u32 hw_if_index
Definition: virtio.h:96
u8 host_mac_addr[6]
Definition: tap.h:54
u8 host_ip6_prefix_len
Definition: virtio.h:115
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
Definition: pool.h:438
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:111
u8 * host_bridge
Definition: virtio.h:110
int ifindex
Definition: virtio.h:117
u32 last_used_interface_id
Definition: tap.h:66
int tap_delete_if(vlib_main_t *vm, u32 sw_if_index)
Definition: tap.c:405
#define clib_error_return(e, args...)
Definition: error.h:99
u8 host_mac_addr[6]
Definition: tap.h:34
u32 id
Definition: virtio.h:94
u8 host_ip4_addr[4]
Definition: tap.h:58
#define hash_get(h, key)
Definition: hash.h:248
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:459
int tap_fd
Definition: virtio.h:100
#define clib_error_return_unix(e, args...)
Definition: error.h:102
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:271
u16 tx_ring_sz
Definition: virtio.h:106
ip6_address_t host_ip6_addr
Definition: tap.h:38
#define VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE
Definition: interface.h:420
u8 host_ip4_prefix_len
Definition: tap.h:37
static int ethernet_mac_address_is_zero(u8 *mac)
Definition: ethernet.h:65
vlib_main_t * vm
Definition: buffer.c:283
static int open_netns_fd(char *netns)
Definition: tap.c:61
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:336
ip6_address_t host_ip6_addr
Definition: virtio.h:114
#define clib_memcpy(a, b, c)
Definition: string.h:75
u8 * net_ns
Definition: virtio.h:109
u32 flags
Definition: virtio.h:93
#define ARRAY_LEN(x)
Definition: clib.h:59
u16 rx_ring_sz
Definition: virtio.h:107
#define hash_create(elts, value_bytes)
Definition: hash.h:681
u8 * host_bridge
Definition: tap.h:35
virtio_if_type_t type
Definition: virtio.h:105
#define ASSERT(truth)
unsigned int u32
Definition: types.h:88
void vnet_hw_interface_assign_rx_thread(vnet_main_t *vnm, u32 hw_if_index, u16 queue_id, uword thread_index)
Definition: devices.c:138
u64 remote_features
Definition: virtio.h:103
clib_error_t * virtio_vring_init(vlib_main_t *vm, virtio_if_t *vif, u16 idx, u16 sz)
Definition: virtio.c:63
u8 * host_if_name
Definition: tap.h:33
u8 host_mac_addr[6]
Definition: virtio.h:111
static void clib_mem_free(void *p)
Definition: mem.h:179
clib_error_t * ethernet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, u8 *address, u32 *hw_if_index_return, ethernet_flag_change_function_t flag_change)
Definition: interface.c:273
clib_error_t * virtio_vring_free(vlib_main_t *vm, virtio_if_t *vif, u32 idx)
Definition: virtio.c:153
unsigned int if_nametoindex(const char *ifname)
static void * clib_mem_alloc(uword size)
Definition: mem.h:112
virtio_main_t virtio_main
Definition: virtio.c:35
u64 uword
Definition: types.h:112
void tap_create_if(vlib_main_t *vm, tap_create_if_args_t *args)
Definition: tap.c:80
tap_main_t tap_main
Definition: tap.c:42
double f64
Definition: types.h:142
unsigned char u8
Definition: types.h:56
int fd
Definition: virtio.h:99
u8 mac_addr[6]
Definition: tap.h:29
Definition: tap.h:64
clib_error_t * error
Definition: tap.h:43
u8 host_ip4_prefix_len
Definition: virtio.h:113
u32 sw_if_index
Definition: virtio.h:97
static u32 random_u32(u32 *seed)
32-bit random number generator
Definition: random.h:69
TAP interface details struct.
Definition: tap.h:47
clib_error_t * vnet_sw_interface_set_flags(vnet_main_t *vnm, u32 sw_if_index, u32 flags)
Definition: interface.c:546
int vnet_hw_interface_set_rx_mode(vnet_main_t *vnm, u32 hw_if_index, u16 queue_id, vnet_hw_interface_rx_mode mode)
Definition: devices.c:252
u8 * host_namespace
Definition: tap.h:32
u32 flags
Definition: vhost-user.h:77
static void vnet_hw_interface_set_input_node(vnet_main_t *vnm, u32 hw_if_index, u32 node_index)
Definition: devices.h:79
uword * dev_instance_by_interface_id
Definition: tap.h:67
static clib_error_t * tap_init(vlib_main_t *vm)
Definition: tap.c:498
u8 * host_if_name
Definition: virtio.h:108