aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/af_xdp
diff options
context:
space:
mode:
authorarikachen <eaglesora@gmail.com>2021-09-22 11:13:11 +0800
committerBeno�t Ganne <bganne@cisco.com>2021-09-28 13:49:55 +0000
commit1ae9819908ca2ba78c6fa0c0051bb1d4b2066be8 (patch)
tree3c2e181acb52782f5a9a3c6b05032cdef4cbd7bf /src/plugins/af_xdp
parent11c7cdd590a06a9681c43bde53055183c9d0058b (diff)
af_xdp: fix init lock for shared txq
Type: fix Signed-off-by: arikachen <eaglesora@gmail.com> Change-Id: Idb5e66d7a2a7ccb6fb5155341df54586186eb11f
Diffstat (limited to 'src/plugins/af_xdp')
-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 =