From: Volodymyr Fialko <vfialko@marvell.com>
To: <dev@dpdk.org>, Radu Nicolau <radu.nicolau@intel.com>,
Akhil Goyal <gakhil@marvell.com>
Cc: <jerinj@marvell.com>, <anoobj@marvell.com>,
Volodymyr Fialko <vfialko@marvell.com>
Subject: [PATCH 6/6] examples/ipsec-secgw: reduce number of QP for event lookaside
Date: Thu, 4 Aug 2022 12:36:26 +0200 [thread overview]
Message-ID: <20220804103626.102688-7-vfialko@marvell.com> (raw)
In-Reply-To: <20220804103626.102688-1-vfialko@marvell.com>
Limit number of queue pairs to one for event lookaside mode, since all
cores are using same queue in this mode.
Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
---
examples/ipsec-secgw/ipsec-secgw.c | 67 +++++++++++++++++-------------
1 file changed, 37 insertions(+), 30 deletions(-)
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index 02b1fabaf5..d6b5b73811 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -1541,7 +1541,7 @@ add_mapping(const char *str, uint16_t cdev_id,
}
static int32_t
-add_cdev_mapping(struct rte_cryptodev_info *dev_info, uint16_t cdev_id,
+add_cdev_mapping(const struct rte_cryptodev_info *dev_info, uint16_t cdev_id,
uint16_t qp, struct lcore_params *params)
{
int32_t ret = 0;
@@ -1597,6 +1597,37 @@ add_cdev_mapping(struct rte_cryptodev_info *dev_info, uint16_t cdev_id,
return ret;
}
+static uint16_t
+map_cdev_to_cores_from_config(enum eh_pkt_transfer_mode mode, int16_t cdev_id,
+ const struct rte_cryptodev_info *cdev_info,
+ uint16_t *last_used_lcore_id)
+{
+ uint16_t nb_qp = 0, i = 0, max_nb_qps;
+
+ /* For event lookaside mode all sessions are bound to single qp.
+ * It's enough to bind one core, since all cores will share same qp
+ * Event inline mode do not use this functionality.
+ */
+ if (mode == EH_PKT_TRANSFER_MODE_EVENT) {
+ add_cdev_mapping(cdev_info, cdev_id, nb_qp, &lcore_params[0]);
+ return 1;
+ }
+
+ /* Check if there are enough queue pairs for all configured cores */
+ max_nb_qps = RTE_MIN(nb_lcore_params, cdev_info->max_nb_queue_pairs);
+
+ while (nb_qp < max_nb_qps && i < nb_lcore_params) {
+ if (add_cdev_mapping(cdev_info, cdev_id, nb_qp,
+ &lcore_params[*last_used_lcore_id]))
+ nb_qp++;
+ (*last_used_lcore_id)++;
+ *last_used_lcore_id %= nb_lcore_params;
+ i++;
+ }
+
+ return nb_qp;
+}
+
/* Check if the device is enabled by cryptodev_mask */
static int
check_cryptodev_mask(uint8_t cdev_id)
@@ -1608,13 +1639,13 @@ check_cryptodev_mask(uint8_t cdev_id)
}
static uint16_t
-cryptodevs_init(uint16_t req_queue_num)
+cryptodevs_init(enum eh_pkt_transfer_mode mode)
{
+ struct rte_hash_parameters params = { 0 };
struct rte_cryptodev_config dev_conf;
struct rte_cryptodev_qp_conf qp_conf;
- uint16_t idx, max_nb_qps, qp, total_nb_qps, i;
+ uint16_t idx, qp, total_nb_qps;
int16_t cdev_id;
- struct rte_hash_parameters params = { 0 };
const uint64_t mseg_flag = multi_seg_required() ?
RTE_CRYPTODEV_FF_IN_PLACE_SGL : 0;
@@ -1655,23 +1686,8 @@ cryptodevs_init(uint16_t req_queue_num)
cdev_id,
rte_cryptodev_get_feature_name(mseg_flag));
- if (nb_lcore_params > cdev_info.max_nb_queue_pairs)
- max_nb_qps = cdev_info.max_nb_queue_pairs;
- else
- max_nb_qps = nb_lcore_params;
-
- qp = 0;
- i = 0;
- while (qp < max_nb_qps && i < nb_lcore_params) {
- if (add_cdev_mapping(&cdev_info, cdev_id, qp,
- &lcore_params[idx]))
- qp++;
- idx++;
- idx = idx % nb_lcore_params;
- i++;
- }
- qp = RTE_MIN(max_nb_qps, RTE_MAX(req_queue_num, qp));
+ qp = map_cdev_to_cores_from_config(mode, cdev_id, &cdev_info, &idx);
if (qp == 0)
continue;
@@ -2985,15 +3001,6 @@ main(int32_t argc, char **argv)
sess_sz = max_session_size();
- /*
- * 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;
-
/*
* In event lookaside mode request memory for crypto metadata. Should
* be removed once API will no longer require usage of user data in
@@ -3004,7 +3011,7 @@ main(int32_t argc, char **argv)
else
user_data_sz = 0;
- nb_crypto_qp = cryptodevs_init(nb_crypto_qp);
+ nb_crypto_qp = cryptodevs_init(eh_conf->mode);
if (nb_bufs_in_pool == 0) {
RTE_ETH_FOREACH_DEV(portid) {
--
2.25.1
next prev parent reply other threads:[~2022-08-04 10:37 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-04 10:36 [PATCH 0/6] examples/ipsec-secgw: add lookaside event mode Volodymyr Fialko
2022-08-04 10:36 ` [PATCH 1/6] examples/ipsec-secgw: add event crypto adapter init Volodymyr Fialko
2022-08-04 10:36 ` [PATCH 2/6] examples/ipsec-secgw: add queue for event crypto adapter Volodymyr Fialko
2022-08-04 10:36 ` [PATCH 3/6] examples/ipsec-secgw: add lookaside event mode Volodymyr Fialko
2022-08-05 3:26 ` Suanming Mou
2022-08-05 10:06 ` Volodymyr Fialko
2022-09-22 5:05 ` Gagandeep Singh
2022-09-22 11:07 ` Volodymyr Fialko
2022-08-04 10:36 ` [PATCH 4/6] examples/ipsec-secgw: add stats for " Volodymyr Fialko
2022-08-04 10:36 ` [PATCH 5/6] examples/ipsec-secgw: add event vector support for lookaside Volodymyr Fialko
2022-08-04 10:36 ` Volodymyr Fialko [this message]
2022-09-21 18:28 ` [PATCH 0/6] examples/ipsec-secgw: add lookaside event mode Akhil Goyal
2022-10-10 12:30 ` [PATCH v2 " Volodymyr Fialko
2022-10-10 12:30 ` [PATCH v2 1/6] examples/ipsec-secgw: add event crypto adapter init Volodymyr Fialko
2022-10-10 12:30 ` [PATCH v2 2/6] examples/ipsec-secgw: add queue for event crypto adapter Volodymyr Fialko
2022-10-10 12:30 ` [PATCH v2 3/6] examples/ipsec-secgw: add lookaside event mode Volodymyr Fialko
2022-10-10 12:31 ` [PATCH v2 4/6] examples/ipsec-secgw: add stats for " Volodymyr Fialko
2022-10-10 12:31 ` [PATCH v2 5/6] examples/ipsec-secgw: add event vector support for lookaside Volodymyr Fialko
2022-10-10 12:31 ` [PATCH v2 6/6] examples/ipsec-secgw: reduce number of QP for event lookaside Volodymyr Fialko
2022-10-10 16:56 ` [PATCH v3 0/6] examples/ipsec-secgw: add lookaside event mode Volodymyr Fialko
2022-10-10 16:56 ` [PATCH v3 1/6] examples/ipsec-secgw: add event crypto adapter init Volodymyr Fialko
2022-10-10 16:56 ` [PATCH v3 2/6] examples/ipsec-secgw: add queue for event crypto adapter Volodymyr Fialko
2022-10-10 16:56 ` [PATCH v3 3/6] examples/ipsec-secgw: add lookaside event mode Volodymyr Fialko
2022-10-10 16:56 ` [PATCH v3 4/6] examples/ipsec-secgw: add stats for " Volodymyr Fialko
2022-10-10 16:56 ` [PATCH v3 5/6] examples/ipsec-secgw: add event vector support for lookaside Volodymyr Fialko
2022-10-10 16:56 ` [PATCH v3 6/6] examples/ipsec-secgw: reduce number of QP for event lookaside Volodymyr Fialko
2022-10-10 19:02 ` [PATCH v3 0/6] examples/ipsec-secgw: add lookaside event mode Akhil Goyal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220804103626.102688-7-vfialko@marvell.com \
--to=vfialko@marvell.com \
--cc=anoobj@marvell.com \
--cc=dev@dpdk.org \
--cc=gakhil@marvell.com \
--cc=jerinj@marvell.com \
--cc=radu.nicolau@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).