summaryrefslogtreecommitdiffstats
path: root/src/plugins/af_xdp/device.c
diff options
context:
space:
mode:
authorJoshua Roys <roysjosh@gmail.com>2021-10-01 16:41:04 -0400
committerBeno�t Ganne <bganne@cisco.com>2021-10-11 07:37:52 +0000
commit5e5f800480f4344a3bf22a6df937f94ce5c10ba1 (patch)
treef7dd942bd8c04a67c3f4ff589e93f80c098533c2 /src/plugins/af_xdp/device.c
parent6fff5ef8a91e9297b2477b5ee29750bf11dc96a9 (diff)
af_xdp: ensure at least one queue is created
Attempting to create an af_xdp interface with zerocopy where the underlying driver didn't support it would lead to a crash due to queue creation silently failing. Type: fix Signed-off-by: Joshua Roys <roysjosh@gmail.com> Change-Id: Ifd9070b8c2b3023d71120c5cf20f7e89d04e4cb3
Diffstat (limited to 'src/plugins/af_xdp/device.c')
-rw-r--r--src/plugins/af_xdp/device.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/plugins/af_xdp/device.c b/src/plugins/af_xdp/device.c
index 30d3c9571e6..8365a716e97 100644
--- a/src/plugins/af_xdp/device.c
+++ b/src/plugins/af_xdp/device.c
@@ -460,6 +460,8 @@ af_xdp_create_if (vlib_main_t * vm, af_xdp_create_if_args_t * args)
* requested 'max'
* we might create less tx queues than workers but this is ok
*/
+ af_xdp_log (VLIB_LOG_LEVEL_DEBUG, ad,
+ "create interface failed to create queue qid=%d", i);
/* fixup vectors length */
vec_set_len (ad->umem, i);
@@ -470,7 +472,8 @@ af_xdp_create_if (vlib_main_t * vm, af_xdp_create_if_args_t * args)
ad->rxq_num = clib_min (i, rxq_num);
ad->txq_num = clib_min (i, txq_num);
- if (i < rxq_num && AF_XDP_NUM_RX_QUEUES_ALL != args->rxq_num)
+ if (i == 0 ||
+ (i < rxq_num && AF_XDP_NUM_RX_QUEUES_ALL != args->rxq_num))
{
ad->rxq_num = ad->txq_num = 0;
goto err1; /* failed creating requested rxq: fatal error, bailing