Typos. A bunch of typos I've been collecting.
[vpp.git] / src / plugins / avf / device.c
index 38af1cb..7d01149 100644 (file)
@@ -229,6 +229,9 @@ avf_rxq_init (vlib_main_t * vm, avf_device_t * ad, u16 qid, u16 rxq_size)
                                                   2 * CLIB_CACHE_LINE_BYTES,
                                                   ad->numa_node);
 
+  rxq->buffer_pool_index =
+    vlib_buffer_pool_get_default_for_numa (vm, ad->numa_node);
+
   if (rxq->descs == 0)
     return vlib_physmem_last_error (vm);
 
@@ -239,7 +242,8 @@ avf_rxq_init (vlib_main_t * vm, avf_device_t * ad, u16 qid, u16 rxq_size)
   vec_validate_aligned (rxq->bufs, rxq->size, CLIB_CACHE_LINE_BYTES);
   rxq->qrx_tail = ad->bar0 + AVF_QRX_TAIL (qid);
 
-  n_alloc = vlib_buffer_alloc (vm, rxq->bufs, rxq->size - 8);
+  n_alloc = vlib_buffer_alloc_from_pool (vm, rxq->bufs, rxq->size - 8,
+                                        rxq->buffer_pool_index);
 
   if (n_alloc == 0)
     return clib_error_return (0, "buffer allocation error");
@@ -373,7 +377,7 @@ avf_send_to_pf (vlib_main_t * vm, avf_device_t * ad, virtchnl_ops_t op,
   int n_retry = 5;
 
 
-  /* supppres interrupt in the next adminq receive slot
+  /* suppress interrupt in the next adminq receive slot
      as we are going to wait for response
      we only need interrupts when event is received */
   d = &ad->arq[ad->arq_next_slot];
@@ -590,7 +594,7 @@ avf_op_config_vsi_queues (vlib_main_t * vm, avf_device_t * ad)
        {
          avf_rxq_t *q = vec_elt_at_index (ad->rxqs, i);
          rxq->ring_len = q->size;
-         rxq->databuffer_size = VLIB_BUFFER_DEFAULT_FREE_LIST_BYTES;
+         rxq->databuffer_size = vlib_buffer_get_default_data_size (vm);
          rxq->dma_ring_addr = avf_dma_addr (vm, ad, (void *) q->descs);
          avf_reg_write (ad, AVF_QRX_TAIL (i), q->size - 1);
        }
@@ -653,14 +657,19 @@ clib_error_t *
 avf_op_enable_queues (vlib_main_t * vm, avf_device_t * ad, u32 rx, u32 tx)
 {
   virtchnl_queue_select_t qs = { 0 };
-  int i;
+  int i = 0;
   qs.vsi_id = ad->vsi_id;
   qs.rx_queues = rx;
   qs.tx_queues = tx;
-  for (i = 0; i < ad->n_rx_queues; i++)
+  while (rx)
     {
-      avf_rxq_t *rxq = vec_elt_at_index (ad->rxqs, i);
-      avf_reg_write (ad, AVF_QRX_TAIL (i), rxq->n_enqueued);
+      if (rx & (1 << i))
+       {
+         avf_rxq_t *rxq = vec_elt_at_index (ad->rxqs, i);
+         avf_reg_write (ad, AVF_QRX_TAIL (i), rxq->n_enqueued);
+         rx &= ~(1 << i);
+       }
+      i++;
     }
   return avf_send_to_pf (vm, ad, VIRTCHNL_OP_ENABLE_QUEUES, &qs,
                         sizeof (virtchnl_queue_select_t), 0, 0);
@@ -718,7 +727,7 @@ avf_request_queues (vlib_main_t * vm, avf_device_t * ad, u16 num_queue_pairs)
                          sizeof (virtchnl_vf_res_request_t));
 
   /*
-   * if PF respondes, the request failed
+   * if PF responds, the request failed
    * else PF initializes restart and avf_send_to_pf returns an error
    */
   if (!error)
@@ -779,7 +788,7 @@ avf_device_init (vlib_main_t * vm, avf_main_t * am, avf_device_t * ad,
                              "(remote %d.%d)", ver.major, ver.minor);
 
   /*
-   * OP_GET_VF_RESOUCES
+   * OP_GET_VF_RESOURCES
    */
   if ((error = avf_op_get_vf_resources (vm, ad, &res)))
     return error;
@@ -850,10 +859,8 @@ avf_device_init (vlib_main_t * vm, avf_main_t * am, avf_device_t * ad,
   if ((error = avf_op_add_eth_addr (vm, ad, 1, ad->hwaddr)))
     return error;
 
-  if ((error = avf_op_enable_queues (vm, ad, ad->n_rx_queues, 0)))
-    return error;
-
-  if ((error = avf_op_enable_queues (vm, ad, 0, ad->n_tx_queues)))
+  if ((error = avf_op_enable_queues (vm, ad, pow2_mask (ad->n_rx_queues),
+                                    pow2_mask (ad->n_tx_queues))))
     return error;
 
   ad->flags |= AVF_DEVICE_F_INITIALIZED;