summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamjan Marion <damjan.marion@gmail.com>2019-01-24 14:41:35 +0100
committerDamjan Marion <damarion@cisco.com>2019-01-28 15:53:34 +0100
commit9124874e2e4ada5f247ef26577e61395c30a38db (patch)
tree1e23157f86c1d59c91f060d28490a4ad70f89f63
parentb2962715e6b22a5c0e8e9ced0759ad61124c2f42 (diff)
avf: fix queue enable issue
It is actually a bitmap.... Change-Id: Ie359e085df3f371512f773600f8d7460b2232b3e Signed-off-by: Damjan Marion <damjan.marion@gmail.com>
-rw-r--r--src/plugins/avf/device.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/plugins/avf/device.c b/src/plugins/avf/device.c
index 38af1cbcf8b..e5c87ed1a2a 100644
--- a/src/plugins/avf/device.c
+++ b/src/plugins/avf/device.c
@@ -653,14 +653,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);
@@ -850,10 +855,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;