avf: tx dequeue optimizations
[vpp.git] / src / plugins / avf / device.c
index 4f6c869..f6a00a1 100644 (file)
@@ -16,6 +16,7 @@
  */
 
 #include <vlib/vlib.h>
+#include <vppinfra/ring.h>
 #include <vlib/unix/unix.h>
 #include <vlib/pci/pci.h>
 #include <vnet/ethernet/ethernet.h>
@@ -289,6 +290,9 @@ avf_txq_init (vlib_main_t * vm, avf_device_t * ad, u16 qid, u16 txq_size)
   vec_validate_aligned (txq->bufs, txq->size, CLIB_CACHE_LINE_BYTES);
   txq->qtx_tail = ad->bar0 + AVF_QTX_TAIL (qid);
 
+  /* initialize ring of pending RS slots */
+  clib_ring_new_aligned (txq->rs_slots, 32, CLIB_CACHE_LINE_BYTES);
+
   ad->n_tx_queues = clib_min (ad->num_queue_pairs, qid + 1);
   return 0;
 }
@@ -578,7 +582,7 @@ avf_op_config_vsi_queues (vlib_main_t * vm, avf_device_t * ad)
 
       rxq->vsi_id = ad->vsi_id;
       rxq->queue_id = i;
-      rxq->max_pkt_size = 1518;
+      rxq->max_pkt_size = ETHERNET_MAX_PACKET_BYTES;
       if (i < vec_len (ad->rxqs))
        {
          avf_rxq_t *q = vec_elt_at_index (ad->rxqs, i);
@@ -1166,6 +1170,7 @@ avf_delete_if (vlib_main_t * vm, avf_device_t * ad)
                                      txq->n_enqueued);
        }
       vec_free (txq->bufs);
+      clib_ring_free (txq->rs_slots);
     }
   /* *INDENT-ON* */
   vec_free (ad->txqs);
@@ -1407,7 +1412,6 @@ avf_init (vlib_main_t * vm)
   avf_main_t *am = &avf_main;
   clib_error_t *error;
   vlib_thread_main_t *tm = vlib_get_thread_main ();
-  int i;
 
   if ((error = vlib_call_init_function (vm, pci_bus_init)))
     return error;
@@ -1415,30 +1419,6 @@ avf_init (vlib_main_t * vm)
   vec_validate_aligned (am->per_thread_data, tm->n_vlib_mains - 1,
                        CLIB_CACHE_LINE_BYTES);
 
-  /* initialize ptype based loopup table */
-  vec_validate_aligned (am->ptypes, 255, CLIB_CACHE_LINE_BYTES);
-
-  /* *INDENT-OFF* */
-  vec_foreach_index (i, am->ptypes)
-    {
-      avf_ptype_t *p = vec_elt_at_index (am->ptypes, i);
-      if ((i >= 22) && (i <= 87))
-       {
-         p->next_node = VNET_DEVICE_INPUT_NEXT_IP4_NCS_INPUT;
-         p->flags = VNET_BUFFER_F_IS_IP4;
-       }
-      else if ((i >= 88) && (i <= 153))
-       {
-         p->next_node = VNET_DEVICE_INPUT_NEXT_IP6_INPUT;
-         p->flags = VNET_BUFFER_F_IS_IP6;
-       }
-      else
-       p->next_node = VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT;
-      p->buffer_advance = device_input_next_node_advance[p->next_node];
-      p->flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;
-    }
-  /* *INDENT-ON* */
-
   am->log_class = vlib_log_register_class ("avf_plugin", 0);
   vlib_log_debug (am->log_class, "initialized");