tap_v2: convert ring size from network to host order
[vpp.git] / src / vnet / devices / netmap / device.c
index 2152824..e39888f 100644 (file)
@@ -63,7 +63,7 @@ format_netmap_device (u8 * s, va_list * args)
   int verbose = va_arg (*args, int);
   netmap_main_t *nm = &netmap_main;
   netmap_if_t *nif = vec_elt_at_index (nm->interfaces, dev_instance);
-  uword indent = format_get_indent (s);
+  u32 indent = format_get_indent (s);
 
   s = format (s, "NETMAP interface");
   if (verbose)
@@ -105,11 +105,7 @@ netmap_interface_tx (vlib_main_t * vm,
   netmap_if_t *nif = pool_elt_at_index (nm->interfaces, rd->dev_instance);
   int cur_ring;
 
-  if (PREDICT_FALSE (nif->lockp != 0))
-    {
-      while (__sync_lock_test_and_set (nif->lockp, 1))
-       ;
-    }
+  clib_spinlock_lock_if_init (&nif->lockp);
 
   cur_ring = nif->first_tx_ring;
 
@@ -165,8 +161,7 @@ netmap_interface_tx (vlib_main_t * vm,
   if (n_left < frame->n_vectors)
     ioctl (nif->fd, NIOCTXSYNC, NULL);
 
-  if (PREDICT_FALSE (nif->lockp != 0))
-    *nif->lockp = 0;
+  clib_spinlock_unlock_if_init (&nif->lockp);
 
   if (n_left)
     vlib_error_count (vm, node->node_index,