examples/ipsec-secgw: reserve crypto queues in event mode
authorLukasz Bartosik <lbartosik@marvell.com>
Thu, 27 Feb 2020 16:18:37 +0000 (17:18 +0100)
committerAkhil Goyal <akhil.goyal@oss.nxp.com>
Sun, 5 Apr 2020 16:26:04 +0000 (18:26 +0200)
Reserve minimum number of crypto queues equal to number of ports.
This is to fulfill inline protocol offload requirements.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Lukasz Bartosik <lbartosik@marvell.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
examples/ipsec-secgw/ipsec-secgw.c

index af6e3de..5fde4f7 100644 (file)
@@ -1930,7 +1930,7 @@ check_cryptodev_mask(uint8_t cdev_id)
 }
 
 static uint16_t
-cryptodevs_init(void)
+cryptodevs_init(uint16_t req_queue_num)
 {
        struct rte_cryptodev_config dev_conf;
        struct rte_cryptodev_qp_conf qp_conf;
@@ -1993,6 +1993,7 @@ cryptodevs_init(void)
                        i++;
                }
 
+               qp = RTE_MIN(max_nb_qps, RTE_MAX(req_queue_num, qp));
                if (qp == 0)
                        continue;
 
@@ -2761,7 +2762,16 @@ main(int32_t argc, char **argv)
 
        sess_sz = max_session_size();
 
-       nb_crypto_qp = cryptodevs_init();
+       /*
+        * In event mode request minimum number of crypto queues
+        * to be reserved equal to number of ports.
+        */
+       if (eh_conf->mode == EH_PKT_TRANSFER_MODE_EVENT)
+               nb_crypto_qp = rte_eth_dev_count_avail();
+       else
+               nb_crypto_qp = 0;
+
+       nb_crypto_qp = cryptodevs_init(nb_crypto_qp);
 
        if (nb_bufs_in_pool == 0) {
                RTE_ETH_FOREACH_DEV(portid) {