aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDamjan Marion <damjan.marion@gmail.com>2019-01-24 14:41:35 +0100
committerNeale Ranns <nranns@cisco.com>2019-01-24 14:30:51 +0000
commit478839b9eccabc9abf6717b9b8a8fb545f294bca (patch)
treef45ab9a5acda68bbbbbf426f8163931cbb4c59d8 /src
parentddd218386835e5de18f452337822cfb0222a1d81 (diff)
avf: fix queue enable issue
It is actually a bitmap.... Change-Id: Ie359e085df3f371512f773600f8d7460b2232b3e Signed-off-by: Damjan Marion <damjan.marion@gmail.com>
Diffstat (limited to 'src')
-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 ff893056de9..f73e5d372d2 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;