summaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/cryptodev
diff options
context:
space:
mode:
authorVladimir Ratnikov <vratnikov@netgate.com>2020-07-23 05:11:09 -0400
committerMatthew Smith <mgsmith@netgate.com>2020-07-23 22:24:48 +0000
commit5a849e3b359dcf8f730429e1ccb7421f1c4217b6 (patch)
tree3857a006865f9ae5a1303d2c25ee92d879195845 /src/plugins/dpdk/cryptodev
parentc79a14f13a0db6f59123e0e6b0b71d4f24433b01 (diff)
dpdk: device_id sorted order for cryptodev
By default, VPP automatically assignes for each tunnel next available QAT device by order dev_id-que-pair. In most cases we have more than one device and it can greatly increase ipsec perfomance without any actions with configuration from user if we use all the devices first and first que-pairs Type: feature Signed-off-by: Vladimir Ratnikov <vratnikov@netgate.com> Change-Id: Iac9fe74768775459e22f69bb3706b542090a9375
Diffstat (limited to 'src/plugins/dpdk/cryptodev')
-rw-r--r--src/plugins/dpdk/cryptodev/cryptodev.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/plugins/dpdk/cryptodev/cryptodev.c b/src/plugins/dpdk/cryptodev/cryptodev.c
index 86cec8a5cbc..2ae09ce226e 100644
--- a/src/plugins/dpdk/cryptodev/cryptodev.c
+++ b/src/plugins/dpdk/cryptodev/cryptodev.c
@@ -1182,8 +1182,22 @@ cryptodev_create_device (vlib_main_t *vm, u32 n_queues)
}
static int
+cryptodev_cmp (void *v1, void *v2)
+{
+ cryptodev_inst_t *a1 = v1;
+ cryptodev_inst_t *a2 = v2;
+
+ if (a1->q_id > a2->q_id)
+ return 1;
+ if (a1->q_id < a2->q_id)
+ return -1;
+ return 0;
+}
+
+static int
cryptodev_probe (vlib_main_t *vm, u32 n_workers)
{
+ cryptodev_main_t *cmt = &cryptodev_main;
u32 n_queues = cryptodev_count_queue (vm->numa_node);
u32 i;
int ret;
@@ -1204,6 +1218,8 @@ cryptodev_probe (vlib_main_t *vm, u32 n_workers)
return ret;
}
+ vec_sort_with_function(cmt->cryptodev_inst, cryptodev_cmp);
+
return 0;
}