avoid using thread local storage for thread index
[vpp.git] / src / plugins / avf / output.c
index d5e71d5..4eec79b 100644 (file)
@@ -42,7 +42,7 @@ CLIB_MULTIARCH_FN (avf_interface_tx) (vlib_main_t * vm,
   avf_main_t *am = &avf_main;
   vnet_interface_output_runtime_t *rd = (void *) node->runtime_data;
   avf_device_t *ad = pool_elt_at_index (am->devices, rd->dev_instance);
-  u32 thread_index = vlib_get_thread_index ();
+  u32 thread_index = vm->thread_index;
   u8 qid = thread_index;
   avf_txq_t *txq = vec_elt_at_index (ad->txqs, qid % ad->num_queue_pairs);
   avf_tx_desc_t *d0, *d1, *d2, *d3;
@@ -57,12 +57,12 @@ CLIB_MULTIARCH_FN (avf_interface_tx) (vlib_main_t * vm,
   clib_spinlock_lock_if_init (&txq->lock);
 
   /* release cosumed bufs */
-  if (txq->n_bufs)
+  if (txq->n_enqueued)
     {
       u16 first, slot, n_free = 0;
-      first = slot = (txq->next - txq->n_bufs) & mask;
+      first = slot = (txq->next - txq->n_enqueued) & mask;
       d0 = txq->descs + slot;
-      while (n_free < txq->n_bufs && avf_tx_desc_get_dtyp (d0) == 0x0F)
+      while (n_free < txq->n_enqueued && avf_tx_desc_get_dtyp (d0) == 0x0F)
        {
          n_free++;
          slot = (slot + 1) & mask;
@@ -71,7 +71,7 @@ CLIB_MULTIARCH_FN (avf_interface_tx) (vlib_main_t * vm,
 
       if (n_free)
        {
-         txq->n_bufs -= n_free;;
+         txq->n_enqueued -= n_free;
          vlib_buffer_free_from_ring (vm, txq->bufs, first, txq->size,
                                      n_free);
        }
@@ -126,7 +126,7 @@ CLIB_MULTIARCH_FN (avf_interface_tx) (vlib_main_t * vm,
       d3->qword[1] = ((u64) b3->current_length) << 34 | bits;
 
       txq->next = (txq->next + 4) & mask;
-      txq->n_bufs += 4;
+      txq->n_enqueued += 4;
       buffers += 4;
       n_left -= 4;
     }
@@ -147,7 +147,7 @@ CLIB_MULTIARCH_FN (avf_interface_tx) (vlib_main_t * vm,
       d0->qword[1] = (((u64) b0->current_length) << 34) | bits;
 
       txq->next = (txq->next + 1) & mask;
-      txq->n_bufs++;
+      txq->n_enqueued++;
       buffers++;
       n_left--;
     }