summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/af_xdp/device.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/plugins/af_xdp/device.c b/src/plugins/af_xdp/device.c
index c82b700bbea..30d3c9571e6 100644
--- a/src/plugins/af_xdp/device.c
+++ b/src/plugins/af_xdp/device.c
@@ -477,12 +477,6 @@ af_xdp_create_if (vlib_main_t * vm, af_xdp_create_if_args_t * args)
out */
}
- if (i < txq_num)
- {
- /* we created less txq than threads not an error but initialize lock for shared txq */
- for (i = 0; i < ad->txq_num; i++)
- clib_spinlock_init (&vec_elt (ad->txqs, i).lock);
- }
args->rv = 0;
clib_error_free (args->error);
@@ -490,6 +484,13 @@ af_xdp_create_if (vlib_main_t * vm, af_xdp_create_if_args_t * args)
}
}
+ if (ad->txq_num < tm->n_vlib_mains)
+ {
+ /* initialize lock for shared txq */
+ for (i = 0; i < ad->txq_num; i++)
+ clib_spinlock_init (&vec_elt (ad->txqs, i).lock);
+ }
+
ad->dev_instance = ad - am->devices;
ad->per_interface_next_index = VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT;
ad->pool =