From: <pbhagavatula@marvell.com>
To: <jerinj@marvell.com>, <bruce.richardson@intel.com>,
<akhil.goyal@nxp.com>,
Marko Kovacevic <marko.kovacevic@intel.com>,
Ori Kam <orika@mellanox.com>,
Radu Nicolau <radu.nicolau@intel.com>,
Tomasz Kantecki <tomasz.kantecki@intel.com>,
Sunil Kumar Kori <skori@marvell.com>,
"Pavan Nikhilesh" <pbhagavatula@marvell.com>
Cc: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH v5 07/10] examples/l2fwd-event: add service core setup
Date: Thu, 3 Oct 2019 02:27:51 +0530 [thread overview]
Message-ID: <20191002205754.11746-8-pbhagavatula@marvell.com> (raw)
In-Reply-To: <20191002205754.11746-1-pbhagavatula@marvell.com>
From: Pavan Nikhilesh <pbhagavatula@marvell.com>
Setup service cores for eventdev and Rx/Tx adapter when they don't have
internal port capability.
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
examples/l2fwd-event/l2fwd_event.c | 87 ++++++++++++++++++++++++++++++
examples/l2fwd-event/l2fwd_event.h | 1 +
examples/l2fwd-event/main.c | 3 ++
3 files changed, 91 insertions(+)
diff --git a/examples/l2fwd-event/l2fwd_event.c b/examples/l2fwd-event/l2fwd_event.c
index 293ecc129..adba40069 100644
--- a/examples/l2fwd-event/l2fwd_event.c
+++ b/examples/l2fwd-event/l2fwd_event.c
@@ -17,6 +17,93 @@
#include "l2fwd_event.h"
+static inline int
+l2fwd_event_service_enable(uint32_t service_id)
+{
+ uint8_t min_service_count = UINT8_MAX;
+ uint32_t slcore_array[RTE_MAX_LCORE];
+ unsigned int slcore = 0;
+ uint8_t service_count;
+ int32_t slcore_count;
+
+ if (!rte_service_lcore_count())
+ return -ENOENT;
+
+ slcore_count = rte_service_lcore_list(slcore_array, RTE_MAX_LCORE);
+ if (slcore_count < 0)
+ return -ENOENT;
+ /* Get the core which has least number of services running. */
+ while (slcore_count--) {
+ /* Reset default mapping */
+ rte_service_map_lcore_set(service_id,
+ slcore_array[slcore_count], 0);
+ service_count = rte_service_lcore_count_services(
+ slcore_array[slcore_count]);
+ if (service_count < min_service_count) {
+ slcore = slcore_array[slcore_count];
+ min_service_count = service_count;
+ }
+ }
+ if (rte_service_map_lcore_set(service_id, slcore, 1))
+ return -ENOENT;
+ rte_service_lcore_start(slcore);
+
+ return 0;
+}
+
+void
+l2fwd_event_service_setup(struct l2fwd_resources *l2fwd_rsrc)
+{
+ struct l2fwd_event_resources *event_rsrc = l2fwd_rsrc->event_rsrc;
+ struct rte_event_dev_info evdev_info;
+ uint32_t service_id, caps;
+ int ret, i;
+
+ rte_event_dev_info_get(event_rsrc->event_d_id, &evdev_info);
+ if (evdev_info.event_dev_cap & RTE_EVENT_DEV_CAP_DISTRIBUTED_SCHED) {
+ ret = rte_event_dev_service_id_get(event_rsrc->event_d_id,
+ &service_id);
+ if (ret != -ESRCH && ret != 0)
+ rte_exit(EXIT_FAILURE,
+ "Error in starting eventdev service\n");
+ l2fwd_event_service_enable(service_id);
+ }
+
+ for (i = 0; i < event_rsrc->rx_adptr.nb_rx_adptr; i++) {
+ ret = rte_event_eth_rx_adapter_caps_get(event_rsrc->event_d_id,
+ event_rsrc->rx_adptr.rx_adptr[i], &caps);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "Failed to get Rx adapter[%d] caps\n",
+ event_rsrc->rx_adptr.rx_adptr[i]);
+ ret = rte_event_eth_rx_adapter_service_id_get(
+ event_rsrc->event_d_id,
+ &service_id);
+ if (ret != -ESRCH && ret != 0)
+ rte_exit(EXIT_FAILURE,
+ "Error in starting Rx adapter[%d] service\n",
+ event_rsrc->rx_adptr.rx_adptr[i]);
+ l2fwd_event_service_enable(service_id);
+ }
+
+ for (i = 0; i < event_rsrc->tx_adptr.nb_tx_adptr; i++) {
+ ret = rte_event_eth_tx_adapter_caps_get(event_rsrc->event_d_id,
+ event_rsrc->tx_adptr.tx_adptr[i], &caps);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "Failed to get Rx adapter[%d] caps\n",
+ event_rsrc->tx_adptr.tx_adptr[i]);
+ ret = rte_event_eth_tx_adapter_service_id_get(
+ event_rsrc->event_d_id,
+ &service_id);
+ if (ret != -ESRCH && ret != 0)
+ rte_exit(EXIT_FAILURE,
+ "Error in starting Rx adapter[%d] service\n",
+ event_rsrc->tx_adptr.tx_adptr[i]);
+ l2fwd_event_service_enable(service_id);
+ }
+}
+
static void
l2fwd_event_capability_setup(struct l2fwd_event_resources *event_rsrc)
{
diff --git a/examples/l2fwd-event/l2fwd_event.h b/examples/l2fwd-event/l2fwd_event.h
index e0cfee8b8..e0c589f93 100644
--- a/examples/l2fwd-event/l2fwd_event.h
+++ b/examples/l2fwd-event/l2fwd_event.h
@@ -66,5 +66,6 @@ struct l2fwd_event_resources {
void l2fwd_event_resource_setup(struct l2fwd_resources *l2fwd_rsrc);
void l2fwd_event_set_generic_ops(struct event_setup_ops *ops);
void l2fwd_event_set_internal_port_ops(struct event_setup_ops *ops);
+void l2fwd_event_service_setup(struct l2fwd_resources *l2fwd_rsrc);
#endif /* __L2FWD_EVENT_H__ */
diff --git a/examples/l2fwd-event/main.c b/examples/l2fwd-event/main.c
index 01b1d531d..3c27bfb4f 100644
--- a/examples/l2fwd-event/main.c
+++ b/examples/l2fwd-event/main.c
@@ -398,6 +398,9 @@ main(int argc, char **argv)
port_id);
}
+ if (l2fwd_rsrc->event_mode)
+ l2fwd_event_service_setup(l2fwd_rsrc);
+
check_all_ports_link_status(l2fwd_rsrc, l2fwd_rsrc->enabled_port_mask);
/* launch per-lcore init on every lcore */
--
2.17.1
next prev parent reply other threads:[~2019-10-02 20:59 UTC|newest]
Thread overview: 107+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-19 9:25 [dpdk-dev] [PATCH v2 00/10] example/l2fwd-event: introduce l2fwd-event example pbhagavatula
2019-09-19 9:25 ` [dpdk-dev] [PATCH v2 01/10] examples/l2fwd-event: add default poll mode routines pbhagavatula
2019-09-19 9:43 ` Sunil Kumar Kori
2019-09-19 10:13 ` [dpdk-dev] [PATCH v3 00/10] example/l2fwd-event: introduce l2fwd-event example pbhagavatula
2019-09-19 10:13 ` [dpdk-dev] [PATCH v3 01/10] examples/l2fwd-event: add default poll mode routines pbhagavatula
2019-09-19 10:13 ` [dpdk-dev] [PATCH v3 02/10] examples/l2fwd-event: add infra for eventdev pbhagavatula
2019-09-19 10:13 ` [dpdk-dev] [PATCH v3 03/10] examples/l2fwd-event: add infra to split eventdev framework pbhagavatula
2019-09-19 10:13 ` [dpdk-dev] [PATCH v3 04/10] examples/l2fwd-event: add eth port setup for eventdev pbhagavatula
2019-09-19 10:13 ` [dpdk-dev] [PATCH v3 05/10] examples/l2fwd-event: add eventdev queue and port setup pbhagavatula
2019-09-19 10:35 ` Sunil Kumar Kori
2019-09-19 10:13 ` [dpdk-dev] [PATCH v3 06/10] examples/l2fwd-event: add event Rx/Tx adapter setup pbhagavatula
2019-09-19 10:13 ` [dpdk-dev] [PATCH v3 07/10] examples/l2fwd-event: add service core setup pbhagavatula
2019-09-19 10:13 ` [dpdk-dev] [PATCH v3 08/10] examples/l2fwd-event: add eventdev main loop pbhagavatula
2019-09-19 10:13 ` [dpdk-dev] [PATCH v3 09/10] examples/l2fwd-event: add graceful teardown pbhagavatula
2019-09-19 10:13 ` [dpdk-dev] [PATCH v3 10/10] doc: add application usage guide for l2fwd-event pbhagavatula
2019-09-24 9:41 ` [dpdk-dev] [PATCH v4 00/10] example/l2fwd-event: introduce l2fwd-event example pbhagavatula
2019-09-24 9:42 ` [dpdk-dev] [PATCH v4 01/10] examples/l2fwd-event: add default poll mode routines pbhagavatula
2019-09-26 17:28 ` Jerin Jacob
2019-09-24 9:42 ` [dpdk-dev] [PATCH v4 02/10] examples/l2fwd-event: add infra for eventdev pbhagavatula
2019-09-26 17:33 ` Jerin Jacob
2019-09-27 13:08 ` Nipun Gupta
2019-09-24 9:42 ` [dpdk-dev] [PATCH v4 03/10] examples/l2fwd-event: add infra to split eventdev framework pbhagavatula
2019-09-24 9:42 ` [dpdk-dev] [PATCH v4 04/10] examples/l2fwd-event: add eth port setup for eventdev pbhagavatula
2019-09-27 13:15 ` Nipun Gupta
2019-09-27 14:45 ` Pavan Nikhilesh Bhagavatula
2019-09-24 9:42 ` [dpdk-dev] [PATCH v4 05/10] examples/l2fwd-event: add eventdev queue and port setup pbhagavatula
2019-09-27 13:22 ` Nipun Gupta
2019-09-27 14:43 ` Pavan Nikhilesh Bhagavatula
2019-09-24 9:42 ` [dpdk-dev] [PATCH v4 06/10] examples/l2fwd-event: add event Rx/Tx adapter setup pbhagavatula
2019-09-24 9:42 ` [dpdk-dev] [PATCH v4 07/10] examples/l2fwd-event: add service core setup pbhagavatula
2019-09-24 9:42 ` [dpdk-dev] [PATCH v4 08/10] examples/l2fwd-event: add eventdev main loop pbhagavatula
2019-09-27 13:28 ` Nipun Gupta
2019-09-27 14:35 ` Pavan Nikhilesh Bhagavatula
2019-09-30 5:38 ` Nipun Gupta
2019-09-30 6:38 ` Jerin Jacob
2019-09-30 7:46 ` Nipun Gupta
2019-09-30 8:09 ` Pavan Nikhilesh Bhagavatula
2019-09-30 17:50 ` Nipun Gupta
2019-10-01 5:59 ` Pavan Nikhilesh Bhagavatula
2019-09-24 9:42 ` [dpdk-dev] [PATCH v4 09/10] examples/l2fwd-event: add graceful teardown pbhagavatula
2019-09-24 9:42 ` [dpdk-dev] [PATCH v4 10/10] doc: add application usage guide for l2fwd-event pbhagavatula
2019-09-26 17:42 ` Jerin Jacob
2019-10-02 20:57 ` [dpdk-dev] [PATCH v5 00/10] example/l2fwd-event: introduce l2fwd-event example pbhagavatula
2019-10-02 20:57 ` [dpdk-dev] [PATCH v5 01/10] examples/l2fwd-event: add default poll mode routines pbhagavatula
2019-10-11 14:41 ` Jerin Jacob
2019-10-02 20:57 ` [dpdk-dev] [PATCH v5 02/10] examples/l2fwd-event: add infra for eventdev pbhagavatula
2019-10-04 12:30 ` Nipun Gupta
2019-10-02 20:57 ` [dpdk-dev] [PATCH v5 03/10] examples/l2fwd-event: add infra to split eventdev framework pbhagavatula
2019-10-02 20:57 ` [dpdk-dev] [PATCH v5 04/10] examples/l2fwd-event: add event device setup pbhagavatula
2019-10-02 20:57 ` [dpdk-dev] [PATCH v5 05/10] examples/l2fwd-event: add eventdev queue and port setup pbhagavatula
2019-10-02 20:57 ` [dpdk-dev] [PATCH v5 06/10] examples/l2fwd-event: add event Rx/Tx adapter setup pbhagavatula
2019-10-02 20:57 ` pbhagavatula [this message]
2019-10-02 20:57 ` [dpdk-dev] [PATCH v5 08/10] examples/l2fwd-event: add eventdev main loop pbhagavatula
2019-10-11 14:52 ` Jerin Jacob
2019-10-02 20:57 ` [dpdk-dev] [PATCH v5 09/10] examples/l2fwd-event: add graceful teardown pbhagavatula
2019-10-02 20:57 ` [dpdk-dev] [PATCH v5 10/10] doc: add application usage guide for l2fwd-event pbhagavatula
2019-10-11 14:11 ` Jerin Jacob
2019-10-03 10:33 ` [dpdk-dev] [PATCH v5 00/10] example/l2fwd-event: introduce l2fwd-event example Jerin Jacob
2019-10-03 12:40 ` Hemant Agrawal
2019-10-03 12:47 ` Jerin Jacob
2019-10-09 7:50 ` Nipun Gupta
2019-10-14 18:22 ` [dpdk-dev] [PATCH v6 " pbhagavatula
2019-10-14 18:22 ` [dpdk-dev] [PATCH v6 01/10] examples/l2fwd-event: add default poll mode routines pbhagavatula
2019-10-16 19:07 ` Stephen Hemminger
2019-10-21 3:29 ` Varghese, Vipin
2019-10-14 18:22 ` [dpdk-dev] [PATCH v6 02/10] examples/l2fwd-event: add infra for eventdev pbhagavatula
2019-10-14 18:22 ` [dpdk-dev] [PATCH v6 03/10] examples/l2fwd-event: add infra to split eventdev framework pbhagavatula
2019-10-14 18:22 ` [dpdk-dev] [PATCH v6 04/10] examples/l2fwd-event: add event device setup pbhagavatula
2019-10-14 18:22 ` [dpdk-dev] [PATCH v6 05/10] examples/l2fwd-event: add eventdev queue and port setup pbhagavatula
2019-10-14 18:22 ` [dpdk-dev] [PATCH v6 06/10] examples/l2fwd-event: add event Rx/Tx adapter setup pbhagavatula
2019-10-14 18:22 ` [dpdk-dev] [PATCH v6 07/10] examples/l2fwd-event: add service core setup pbhagavatula
2019-10-14 18:22 ` [dpdk-dev] [PATCH v6 08/10] examples/l2fwd-event: add eventdev main loop pbhagavatula
2019-10-21 3:19 ` Varghese, Vipin
2019-10-21 16:53 ` Pavan Nikhilesh Bhagavatula
2019-10-22 3:13 ` Varghese, Vipin
2019-10-22 17:02 ` Pavan Nikhilesh Bhagavatula
2019-10-14 18:22 ` [dpdk-dev] [PATCH v6 09/10] examples/l2fwd-event: add graceful teardown pbhagavatula
2019-10-21 3:12 ` Varghese, Vipin
2019-10-21 16:56 ` Pavan Nikhilesh Bhagavatula
2019-10-22 2:48 ` Varghese, Vipin
2019-10-14 18:22 ` [dpdk-dev] [PATCH v6 10/10] doc: add application usage guide for l2fwd-event pbhagavatula
2019-10-16 12:38 ` [dpdk-dev] [PATCH v6 00/10] example/l2fwd-event: introduce l2fwd-event example Jerin Jacob
2019-10-21 3:25 ` Varghese, Vipin
2019-10-21 17:02 ` Pavan Nikhilesh Bhagavatula
2019-10-22 2:57 ` Varghese, Vipin
2019-10-22 15:55 ` Pavan Nikhilesh Bhagavatula
2019-10-26 11:10 ` [dpdk-dev] [PATCH v7 " pbhagavatula
2019-10-26 11:10 ` [dpdk-dev] [PATCH v7 01/10] examples/l2fwd-event: add default poll mode routines pbhagavatula
2019-10-26 11:10 ` [dpdk-dev] [PATCH v7 02/10] examples/l2fwd-event: add infra for eventdev pbhagavatula
2019-10-26 11:10 ` [dpdk-dev] [PATCH v7 03/10] examples/l2fwd-event: add infra to split eventdev framework pbhagavatula
2019-10-26 11:10 ` [dpdk-dev] [PATCH v7 04/10] examples/l2fwd-event: add event device setup pbhagavatula
2019-10-26 11:10 ` [dpdk-dev] [PATCH v7 05/10] examples/l2fwd-event: add eventdev queue and port setup pbhagavatula
2019-10-26 11:10 ` [dpdk-dev] [PATCH v7 06/10] examples/l2fwd-event: add event Rx/Tx adapter setup pbhagavatula
2019-10-26 11:10 ` [dpdk-dev] [PATCH v7 07/10] examples/l2fwd-event: add service core setup pbhagavatula
2019-10-26 11:10 ` [dpdk-dev] [PATCH v7 08/10] examples/l2fwd-event: add eventdev main loop pbhagavatula
2019-10-26 11:10 ` [dpdk-dev] [PATCH v7 09/10] examples/l2fwd-event: add graceful teardown pbhagavatula
2019-10-26 11:10 ` [dpdk-dev] [PATCH v7 10/10] doc: add application usage guide for l2fwd-event pbhagavatula
2019-10-30 13:19 ` Jerin Jacob
2019-10-30 12:58 ` [dpdk-dev] [PATCH v7 00/10] example/l2fwd-event: introduce l2fwd-event example Jerin Jacob
2019-09-19 9:25 ` [dpdk-dev] [PATCH v2 02/10] examples/l2fwd-event: add infra for eventdev pbhagavatula
2019-09-19 9:25 ` [dpdk-dev] [PATCH v2 03/10] examples/l2fwd-event: add infra to split eventdev framework pbhagavatula
2019-09-19 9:25 ` [dpdk-dev] [PATCH v2 04/10] examples/l2fwd-event: add eth port setup for eventdev pbhagavatula
2019-09-19 9:25 ` [dpdk-dev] [PATCH v2 05/10] examples/l2fwd-event: add eventdev queue and port setup pbhagavatula
2019-09-19 9:26 ` [dpdk-dev] [PATCH v2 06/10] examples/l2fwd-event: add event Rx/Tx adapter setup pbhagavatula
2019-09-19 9:26 ` [dpdk-dev] [PATCH v2 07/10] examples/l2fwd-event: add service core setup pbhagavatula
2019-09-19 9:26 ` [dpdk-dev] [PATCH v2 08/10] examples/l2fwd-event: add eventdev main loop pbhagavatula
2019-09-19 9:26 ` [dpdk-dev] [PATCH v2 09/10] examples/l2fwd-event: add graceful teardown pbhagavatula
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=20191002205754.11746-8-pbhagavatula@marvell.com \
--to=pbhagavatula@marvell.com \
--cc=akhil.goyal@nxp.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=marko.kovacevic@intel.com \
--cc=orika@mellanox.com \
--cc=radu.nicolau@intel.com \
--cc=skori@marvell.com \
--cc=tomasz.kantecki@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).