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 2/6] examples/ipsec-secgw: add queue for event crypto adapter
Date: Mon, 10 Oct 2022 14:30:58 +0200 [thread overview]
Message-ID: <20221010123102.3962719-3-vfialko@marvell.com> (raw)
In-Reply-To: <20221010123102.3962719-1-vfialko@marvell.com>
Add separate event queue for event crypto adapter processing, to resolve
queue contention between new and already processed events.
Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
---
examples/ipsec-secgw/event_helper.c | 95 +++++++++++++++++++++--------
examples/ipsec-secgw/event_helper.h | 2 +
2 files changed, 71 insertions(+), 26 deletions(-)
diff --git a/examples/ipsec-secgw/event_helper.c b/examples/ipsec-secgw/event_helper.c
index 30a1f253c8..90c5d716ff 100644
--- a/examples/ipsec-secgw/event_helper.c
+++ b/examples/ipsec-secgw/event_helper.c
@@ -19,6 +19,8 @@
#define DEFAULT_VECTOR_SIZE 16
#define DEFAULT_VECTOR_TMO 102400
+#define INVALID_EV_QUEUE_ID -1
+
static volatile bool eth_core_running;
static int
@@ -153,11 +155,10 @@ eh_dev_has_burst_mode(uint8_t dev_id)
}
static int
-eh_set_default_conf_eventdev(struct eventmode_conf *em_conf)
+eh_set_nb_eventdev(struct eventmode_conf *em_conf)
{
- int lcore_count, nb_eventdev, nb_eth_dev, ret;
struct eventdev_params *eventdev_config;
- struct rte_event_dev_info dev_info;
+ int nb_eventdev;
/* Get the number of event devices */
nb_eventdev = rte_event_dev_count();
@@ -172,6 +173,23 @@ eh_set_default_conf_eventdev(struct eventmode_conf *em_conf)
return -EINVAL;
}
+ /* Set event dev id*/
+ eventdev_config = &(em_conf->eventdev_config[0]);
+ eventdev_config->eventdev_id = 0;
+
+ /* Update the number of event devices */
+ em_conf->nb_eventdev = 1;
+
+ return 0;
+}
+
+static int
+eh_set_default_conf_eventdev(struct eventmode_conf *em_conf)
+{
+ int lcore_count, nb_eth_dev, ret;
+ struct eventdev_params *eventdev_config;
+ struct rte_event_dev_info dev_info;
+
/* Get the number of eth devs */
nb_eth_dev = rte_eth_dev_count_avail();
if (nb_eth_dev == 0) {
@@ -199,15 +217,30 @@ eh_set_default_conf_eventdev(struct eventmode_conf *em_conf)
eventdev_config = &(em_conf->eventdev_config[0]);
/* Save number of queues & ports available */
- eventdev_config->eventdev_id = 0;
- eventdev_config->nb_eventqueue = dev_info.max_event_queues;
+ eventdev_config->nb_eventqueue = nb_eth_dev;
eventdev_config->nb_eventport = dev_info.max_event_ports;
eventdev_config->ev_queue_mode = RTE_EVENT_QUEUE_CFG_ALL_TYPES;
- /* Check if there are more queues than required */
- if (eventdev_config->nb_eventqueue > nb_eth_dev + 1) {
- /* One queue is reserved for Tx */
- eventdev_config->nb_eventqueue = nb_eth_dev + 1;
+ /* One queue is reserved for Tx */
+ eventdev_config->tx_queue_id = INVALID_EV_QUEUE_ID;
+ if (eventdev_config->all_internal_ports) {
+ if (eventdev_config->nb_eventqueue >= dev_info.max_event_queues) {
+ EH_LOG_ERR("Not enough event queues available");
+ return -EINVAL;
+ }
+ eventdev_config->tx_queue_id =
+ eventdev_config->nb_eventqueue++;
+ }
+
+ /* One queue is reserved for event crypto adapter */
+ eventdev_config->ev_cpt_queue_id = INVALID_EV_QUEUE_ID;
+ if (em_conf->enable_event_crypto_adapter) {
+ if (eventdev_config->nb_eventqueue >= dev_info.max_event_queues) {
+ EH_LOG_ERR("Not enough event queues available");
+ return -EINVAL;
+ }
+ eventdev_config->ev_cpt_queue_id =
+ eventdev_config->nb_eventqueue++;
}
/* Check if there are more ports than required */
@@ -216,9 +249,6 @@ eh_set_default_conf_eventdev(struct eventmode_conf *em_conf)
eventdev_config->nb_eventport = lcore_count;
}
- /* Update the number of event devices */
- em_conf->nb_eventdev++;
-
return 0;
}
@@ -247,15 +277,10 @@ eh_do_capability_check(struct eventmode_conf *em_conf)
/*
* If Rx & Tx internal ports are supported by all event devices then
- * eth cores won't be required. Override the eth core mask requested
- * and decrement number of event queues by one as it won't be needed
- * for Tx.
+ * eth cores won't be required. Override the eth core mask requested.
*/
- if (all_internal_ports) {
+ if (all_internal_ports)
rte_bitmap_reset(em_conf->eth_core_mask);
- for (i = 0; i < em_conf->nb_eventdev; i++)
- em_conf->eventdev_config[i].nb_eventqueue--;
- }
}
static int
@@ -372,6 +397,10 @@ eh_set_default_conf_rx_adapter(struct eventmode_conf *em_conf)
eventdev_config->nb_eventqueue :
eventdev_config->nb_eventqueue - 1;
+ /* Reserve one queue for event crypto adapter */
+ if (em_conf->enable_event_crypto_adapter)
+ nb_eventqueue--;
+
/*
* Map all queues of eth device (port) to an event queue. If there
* are more event queues than eth ports then create 1:1 mapping.
@@ -543,14 +572,18 @@ eh_validate_conf(struct eventmode_conf *em_conf)
* and initialize the config with all ports & queues available
*/
if (em_conf->nb_eventdev == 0) {
+ ret = eh_set_nb_eventdev(em_conf);
+ if (ret != 0)
+ return ret;
+ eh_do_capability_check(em_conf);
ret = eh_set_default_conf_eventdev(em_conf);
if (ret != 0)
return ret;
+ } else {
+ /* Perform capability check for the selected event devices */
+ eh_do_capability_check(em_conf);
}
- /* Perform capability check for the selected event devices */
- eh_do_capability_check(em_conf);
-
/*
* Check if links are specified. Else generate a default config for
* the event ports used.
@@ -596,8 +629,8 @@ eh_initialize_eventdev(struct eventmode_conf *em_conf)
uint8_t *queue = NULL;
uint8_t eventdev_id;
int nb_eventqueue;
- uint8_t i, j;
- int ret;
+ int ret, j;
+ uint8_t i;
for (i = 0; i < nb_eventdev; i++) {
@@ -659,14 +692,24 @@ eh_initialize_eventdev(struct eventmode_conf *em_conf)
* stage if event device does not have internal
* ports. This will be an atomic queue.
*/
- if (!eventdev_config->all_internal_ports &&
- j == nb_eventqueue-1) {
+ if (j == eventdev_config->tx_queue_id) {
eventq_conf.schedule_type =
RTE_SCHED_TYPE_ATOMIC;
} else {
eventq_conf.schedule_type =
em_conf->ext_params.sched_type;
}
+ /*
+ * Give event crypto device's queue higher priority then Rx queues. This
+ * will allow crypto events to be processed with highest priority.
+ */
+ if (j == eventdev_config->ev_cpt_queue_id) {
+ eventq_conf.priority =
+ RTE_EVENT_DEV_PRIORITY_HIGHEST;
+ } else {
+ eventq_conf.priority =
+ RTE_EVENT_DEV_PRIORITY_NORMAL;
+ }
/* Set max atomic flows to 1024 */
eventq_conf.nb_atomic_flows = 1024;
diff --git a/examples/ipsec-secgw/event_helper.h b/examples/ipsec-secgw/event_helper.h
index 4b26dc8fc2..af5cfcf794 100644
--- a/examples/ipsec-secgw/event_helper.h
+++ b/examples/ipsec-secgw/event_helper.h
@@ -88,6 +88,8 @@ struct eventdev_params {
uint8_t nb_eventport;
uint8_t ev_queue_mode;
uint8_t all_internal_ports;
+ int tx_queue_id;
+ int ev_cpt_queue_id;
};
/**
--
2.25.1
next prev parent reply other threads:[~2022-10-10 12:31 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 ` Volodymyr Fialko [this message]
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=20221010123102.3962719-3-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).