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>,
<suanmingm@nvidia.com>, Volodymyr Fialko <vfialko@marvell.com>
Subject: [PATCH v2 6/6] examples/ipsec-secgw: reduce number of QP for event lookaside
Date: Mon, 10 Oct 2022 14:31:02 +0200 [thread overview]
Message-ID: <20221010123102.3962719-7-vfialko@marvell.com> (raw)
In-Reply-To: <20221010123102.3962719-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 | 56 +++++++++++++++++++-----------
1 file changed, 36 insertions(+), 20 deletions(-)
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index 1d74aa60e5..e20bf50752 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -1540,7 +1540,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;
@@ -1596,6 +1596,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)
@@ -1607,13 +1638,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;
@@ -1654,23 +1685,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;
--
2.25.1
next prev parent reply other threads:[~2022-10-10 12:32 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 ` [PATCH 6/6] examples/ipsec-secgw: reduce number of QP for event lookaside Volodymyr Fialko
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 ` Volodymyr Fialko [this message]
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=20221010123102.3962719-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 \
--cc=suanmingm@nvidia.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).