[26/39] eventdev: add default conf for event devs field in conf
Checks
Commit Message
Generate a default conf for event devs, if it's not specified in the
conf. This routine will check the available event devices and it's
properties and sets the conf accordingly.
Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Lukasz Bartosik <lbartosik@marvell.com>
---
lib/librte_eventdev/rte_eventmode_helper.c | 67 ++++++++++++++++++++++++++++++
1 file changed, 67 insertions(+)
Comments
Regards
Sunil Kumar Kori
>-----Original Message-----
>From: dev <dev-bounces@dpdk.org> On Behalf Of Anoob Joseph
>Sent: Monday, June 3, 2019 10:20 PM
>To: Jerin Jacob Kollanukkaran <jerinj@marvell.com>; Nikhil Rao
><nikhil.rao@intel.com>; Erik Gabriel Carrillo <erik.g.carrillo@intel.com>;
>Abhinandan Gujjar <abhinandan.gujjar@intel.com>; Bruce Richardson
><bruce.richardson@intel.com>; Pablo de Lara
><pablo.de.lara.guarch@intel.com>
>Cc: Narayana Prasad Raju Athreya <pathreya@marvell.com>; dev@dpdk.org;
>Lukas Bartosik <lbartosik@marvell.com>; Pavan Nikhilesh Bhagavatula
><pbhagavatula@marvell.com>; Hemant Agrawal
><hemant.agrawal@nxp.com>; Nipun Gupta <nipun.gupta@nxp.com>; Harry
>van Haaren <harry.van.haaren@intel.com>; Mattias Rönnblom
><mattias.ronnblom@ericsson.com>; Liang Ma <liang.j.ma@intel.com>; Anoob
>Joseph <anoobj@marvell.com>
>Subject: [EXT] [dpdk-dev] [PATCH 26/39] eventdev: add default conf for event
>devs field in conf
>
>External Email
>
>----------------------------------------------------------------------
>Generate a default conf for event devs, if it's not specified in the conf. This
>routine will check the available event devices and it's properties and sets the
>conf accordingly.
>
>Signed-off-by: Anoob Joseph <anoobj@marvell.com>
>Signed-off-by: Lukasz Bartosik <lbartosik@marvell.com>
>---
> lib/librte_eventdev/rte_eventmode_helper.c | 67
>++++++++++++++++++++++++++++++
> 1 file changed, 67 insertions(+)
>
>diff --git a/lib/librte_eventdev/rte_eventmode_helper.c
>b/lib/librte_eventdev/rte_eventmode_helper.c
>index 4dbb94a..1729561 100644
>--- a/lib/librte_eventdev/rte_eventmode_helper.c
>+++ b/lib/librte_eventdev/rte_eventmode_helper.c
>@@ -179,6 +179,63 @@ rte_eventmode_validate_user_params(struct
>eventmode_conf *em_conf) }
>
> static int
>+rte_eventmode_helper_set_default_conf_eventdev(struct eventmode_conf
>+*em_conf) {
>+ int i, ret;
>+ int nb_eventdev;
>+ struct eventdev_params *eventdev_config;
>+ struct rte_event_dev_info dev_info;
>+
>+ /* Get the number of event devices */
>+ nb_eventdev = rte_event_dev_count();
>+
>+ if (nb_eventdev == 0) {
>+ RTE_EM_HLPR_LOG_ERR("No event devices detected");
>+ return -1;
>+ }
>+
>+ for (i = 0; i < nb_eventdev; i++) {
>+
>+ /* Get the event dev conf */
>+ eventdev_config = &(em_conf->eventdev_config[i]);
>+
>+ /* Read event device info */
>+ ret = rte_event_dev_info_get(i, &dev_info);
>+
>+ if (ret < 0) {
>+ RTE_EM_HLPR_LOG_ERR(
>+ "Failed reading event device info (err:%d)",
>+ ret);
>+ return ret;
>+ }
>+
>+ /* Check if enough ports are available */
>+ if (dev_info.max_event_ports < 2) {
>+ RTE_EM_HLPR_LOG_ERR("Not enough ports
>available");
"Not Enough event ports available" instead of "Not enough ports available". Otherwise it looks confusing with eth ports.
>+ return -1;
>+ }
>+
>+ /* Save number of queues & ports available */
>+ eventdev_config->eventdev_id = i;
>+ eventdev_config->nb_eventqueue =
>dev_info.max_event_queues;
>+ eventdev_config->nb_eventport = dev_info.max_event_ports;
>+ eventdev_config->ev_queue_mode =
>+ RTE_EVENT_QUEUE_CFG_SINGLE_LINK;
>+
>+ /* One port is required for eth Rx adapter */
>+ eventdev_config->nb_eventport -= 1;
>+
>+ /* One port is reserved for eth Tx adapter */
>+ eventdev_config->nb_eventport -= 1;
>+
>+ /* Update the number of eventdevs */
>+ em_conf->nb_eventdev++;
>+ }
>+
>+ return 0;
>+}
>+
>+static int
> rte_eventmode_helper_validate_conf(struct eventmode_conf *em_conf) {
> int ret;
>@@ -188,6 +245,16 @@ rte_eventmode_helper_validate_conf(struct
>eventmode_conf *em_conf)
> if (ret != 0)
> return ret;
>
>+ /*
>+ * See if event devs are specified. Else probe the event devices
>+ * and initialize the conf with all ports & queues available
>+ */
>+ if (em_conf->nb_eventdev == 0) {
>+ ret =
>rte_eventmode_helper_set_default_conf_eventdev(em_conf);
>+ if (ret != 0)
>+ return ret;
>+ }
>+
> return 0;
> }
>
>--
>2.7.4
@@ -179,6 +179,63 @@ rte_eventmode_validate_user_params(struct eventmode_conf *em_conf)
}
static int
+rte_eventmode_helper_set_default_conf_eventdev(struct eventmode_conf *em_conf)
+{
+ int i, ret;
+ int nb_eventdev;
+ struct eventdev_params *eventdev_config;
+ struct rte_event_dev_info dev_info;
+
+ /* Get the number of event devices */
+ nb_eventdev = rte_event_dev_count();
+
+ if (nb_eventdev == 0) {
+ RTE_EM_HLPR_LOG_ERR("No event devices detected");
+ return -1;
+ }
+
+ for (i = 0; i < nb_eventdev; i++) {
+
+ /* Get the event dev conf */
+ eventdev_config = &(em_conf->eventdev_config[i]);
+
+ /* Read event device info */
+ ret = rte_event_dev_info_get(i, &dev_info);
+
+ if (ret < 0) {
+ RTE_EM_HLPR_LOG_ERR(
+ "Failed reading event device info (err:%d)",
+ ret);
+ return ret;
+ }
+
+ /* Check if enough ports are available */
+ if (dev_info.max_event_ports < 2) {
+ RTE_EM_HLPR_LOG_ERR("Not enough ports available");
+ return -1;
+ }
+
+ /* Save number of queues & ports available */
+ eventdev_config->eventdev_id = i;
+ eventdev_config->nb_eventqueue = dev_info.max_event_queues;
+ eventdev_config->nb_eventport = dev_info.max_event_ports;
+ eventdev_config->ev_queue_mode =
+ RTE_EVENT_QUEUE_CFG_SINGLE_LINK;
+
+ /* One port is required for eth Rx adapter */
+ eventdev_config->nb_eventport -= 1;
+
+ /* One port is reserved for eth Tx adapter */
+ eventdev_config->nb_eventport -= 1;
+
+ /* Update the number of eventdevs */
+ em_conf->nb_eventdev++;
+ }
+
+ return 0;
+}
+
+static int
rte_eventmode_helper_validate_conf(struct eventmode_conf *em_conf)
{
int ret;
@@ -188,6 +245,16 @@ rte_eventmode_helper_validate_conf(struct eventmode_conf *em_conf)
if (ret != 0)
return ret;
+ /*
+ * See if event devs are specified. Else probe the event devices
+ * and initialize the conf with all ports & queues available
+ */
+ if (em_conf->nb_eventdev == 0) {
+ ret = rte_eventmode_helper_set_default_conf_eventdev(em_conf);
+ if (ret != 0)
+ return ret;
+ }
+
return 0;
}