summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2021-11-15 11:12:51 +0000
committerDamjan Marion <dmarion@me.com>2021-11-15 12:41:50 +0000
commit23ff4ce21e71b697fb059ea82857413d993db9d0 (patch)
treedfcffa0c15e271be3449ed4b9a825616f9a56f9e
parente75084025ac967c45af3d4f485a0399b0718c8ec (diff)
memif: fix the coverity warning
Type: fix Fixes: 2bae16b238bd ("memif: fix the default txq placement") Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> Change-Id: I8fbb2aa92dc31d84a5cd0f7b9a3c7f39dfb064ee
-rw-r--r--src/plugins/memif/memif.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/plugins/memif/memif.c b/src/plugins/memif/memif.c
index 31dd4a539da..3b01819491b 100644
--- a/src/plugins/memif/memif.c
+++ b/src/plugins/memif/memif.c
@@ -236,7 +236,7 @@ memif_connect (memif_if_t * mif)
clib_file_t template = { 0 };
memif_region_t *mr;
int i, j;
- u32 n_txqs, n_threads = vlib_get_n_threads ();
+ u32 n_txqs = 0, n_threads = vlib_get_n_threads ();
clib_error_t *err = NULL;
memif_log_debug (mif, "connect %u", mif->dev_instance);
@@ -284,11 +284,14 @@ memif_connect (memif_if_t * mif)
clib_spinlock_init (&mq->lockp);
}
- n_txqs = vec_len (mif->tx_queues);
- for (j = 0; j < n_threads; j++)
+ if (vec_len (mif->tx_queues) > 0)
{
- u32 qi = mif->tx_queues[j % n_txqs].queue_index;
- vnet_hw_if_tx_queue_assign_thread (vnm, qi, j);
+ n_txqs = vec_len (mif->tx_queues);
+ for (j = 0; j < n_threads; j++)
+ {
+ u32 qi = mif->tx_queues[j % n_txqs].queue_index;
+ vnet_hw_if_tx_queue_assign_thread (vnm, qi, j);
+ }
}
vec_foreach_index (i, mif->rx_queues)