af_xdp: fix init lock for shared txq
Type: fix
@@ -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 =
