From: Pavan Nikhilesh <pbhagavatula@marvell.com>
To: <jerinj@marvell.com>,
Harry van Haaren <harry.van.haaren@intel.com>,
"Radu Nicolau" <radu.nicolau@intel.com>,
Akhil Goyal <gakhil@marvell.com>,
"Sunil Kumar Kori" <skori@marvell.com>,
Pavan Nikhilesh <pbhagavatula@marvell.com>
Cc: <dev@dpdk.org>
Subject: [PATCH 2/3 v2] eventdev: update examples to use port quiesce
Date: Wed, 27 Apr 2022 17:07:14 +0530 [thread overview]
Message-ID: <20220427113715.15509-2-pbhagavatula@marvell.com> (raw)
In-Reply-To: <20220427113715.15509-1-pbhagavatula@marvell.com>
Quiesce event ports used by the workers core on exit to free up
any outstanding resources.
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
Depends-on: Series-22677
app/test-eventdev/test_perf_common.c | 8 ++++++++
app/test-eventdev/test_pipeline_common.c | 12 ++++++++++++
examples/eventdev_pipeline/pipeline_common.h | 9 +++++++++
examples/ipsec-secgw/ipsec_worker.c | 13 +++++++++++++
examples/l2fwd-event/l2fwd_common.c | 13 +++++++++++++
examples/l3fwd/l3fwd_event.c | 13 +++++++++++++
6 files changed, 68 insertions(+)
diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c
index f673a9fddd..2016583979 100644
--- a/app/test-eventdev/test_perf_common.c
+++ b/app/test-eventdev/test_perf_common.c
@@ -985,6 +985,13 @@ perf_opt_dump(struct evt_options *opt, uint8_t nb_queues)
evt_dump("prod_enq_burst_sz", "%d", opt->prod_enq_burst_sz);
}
+static void
+perf_event_port_flush(uint8_t dev_id __rte_unused, struct rte_event ev,
+ void *args)
+{
+ rte_mempool_put(args, ev.event_ptr);
+}
+
void
perf_worker_cleanup(struct rte_mempool *const pool, uint8_t dev_id,
uint8_t port_id, struct rte_event events[], uint16_t nb_enq,
@@ -1000,6 +1007,7 @@ perf_worker_cleanup(struct rte_mempool *const pool, uint8_t dev_id,
events[i].op = RTE_EVENT_OP_RELEASE;
rte_event_enqueue_burst(dev_id, port_id, events, nb_deq);
}
+ rte_event_port_quiesce(dev_id, port_id, perf_event_port_flush, pool);
}
void
diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c
index a8dd070000..82e5745071 100644
--- a/app/test-eventdev/test_pipeline_common.c
+++ b/app/test-eventdev/test_pipeline_common.c
@@ -518,6 +518,16 @@ pipeline_vector_array_free(struct rte_event events[], uint16_t num)
}
}
+static void
+pipeline_event_port_flush(uint8_t dev_id __rte_unused, struct rte_event ev,
+ void *args __rte_unused)
+{
+ if (ev.event_type & RTE_EVENT_TYPE_VECTOR)
+ pipeline_vector_array_free(&ev, 1);
+ else
+ rte_pktmbuf_free(ev.mbuf);
+}
+
void
pipeline_worker_cleanup(uint8_t dev, uint8_t port, struct rte_event ev[],
uint16_t enq, uint16_t deq)
@@ -542,6 +552,8 @@ pipeline_worker_cleanup(uint8_t dev, uint8_t port, struct rte_event ev[],
rte_event_enqueue_burst(dev, port, ev, deq);
}
+
+ rte_event_port_quiesce(dev, port, pipeline_event_port_flush, NULL);
}
void
diff --git a/examples/eventdev_pipeline/pipeline_common.h b/examples/eventdev_pipeline/pipeline_common.h
index 9899b257b0..28b6ab85ff 100644
--- a/examples/eventdev_pipeline/pipeline_common.h
+++ b/examples/eventdev_pipeline/pipeline_common.h
@@ -140,6 +140,13 @@ schedule_devices(unsigned int lcore_id)
}
}
+static void
+event_port_flush(uint8_t dev_id __rte_unused, struct rte_event ev,
+ void *args __rte_unused)
+{
+ rte_mempool_put(args, ev.event_ptr);
+}
+
static inline void
worker_cleanup(uint8_t dev_id, uint8_t port_id, struct rte_event events[],
uint16_t nb_enq, uint16_t nb_deq)
@@ -160,6 +167,8 @@ worker_cleanup(uint8_t dev_id, uint8_t port_id, struct rte_event events[],
events[i].op = RTE_EVENT_OP_RELEASE;
rte_event_enqueue_burst(dev_id, port_id, events, nb_deq);
}
+
+ rte_event_port_quiesce(dev_id, port_id, event_port_flush, NULL);
}
void set_worker_generic_setup_data(struct setup_data *caps, bool burst);
diff --git a/examples/ipsec-secgw/ipsec_worker.c b/examples/ipsec-secgw/ipsec_worker.c
index 3df5acf384..7f259e4cf3 100644
--- a/examples/ipsec-secgw/ipsec_worker.c
+++ b/examples/ipsec-secgw/ipsec_worker.c
@@ -737,6 +737,13 @@ ipsec_ev_vector_drv_mode_process(struct eh_event_link_info *links,
* selected.
*/
+static void
+ipsec_event_port_flush(uint8_t eventdev_id __rte_unused, struct rte_event ev,
+ void *args __rte_unused)
+{
+ rte_pktmbuf_free(ev.mbuf);
+}
+
/* Workers registered */
#define IPSEC_EVENTMODE_WORKERS 2
@@ -861,6 +868,9 @@ ipsec_wrkr_non_burst_int_port_drv_mode(struct eh_event_link_info *links,
rte_event_enqueue_burst(links[0].eventdev_id,
links[0].event_port_id, &ev, 1);
}
+
+ rte_event_port_quiesce(links[0].eventdev_id, links[0].event_port_id,
+ ipsec_event_port_flush, NULL);
}
/*
@@ -974,6 +984,9 @@ ipsec_wrkr_non_burst_int_port_app_mode(struct eh_event_link_info *links,
rte_event_enqueue_burst(links[0].eventdev_id,
links[0].event_port_id, &ev, 1);
}
+
+ rte_event_port_quiesce(links[0].eventdev_id, links[0].event_port_id,
+ ipsec_event_port_flush, NULL);
}
static uint8_t
diff --git a/examples/l2fwd-event/l2fwd_common.c b/examples/l2fwd-event/l2fwd_common.c
index 15bfe790a0..41a0d3f22f 100644
--- a/examples/l2fwd-event/l2fwd_common.c
+++ b/examples/l2fwd-event/l2fwd_common.c
@@ -128,6 +128,16 @@ l2fwd_event_vector_array_free(struct rte_event events[], uint16_t num)
}
}
+static void
+l2fwd_event_port_flush(uint8_t event_d_id __rte_unused, struct rte_event ev,
+ void *args __rte_unused)
+{
+ if (ev.event_type & RTE_EVENT_TYPE_VECTOR)
+ l2fwd_event_vector_array_free(&ev, 1);
+ else
+ rte_pktmbuf_free(ev.mbuf);
+}
+
void
l2fwd_event_worker_cleanup(uint8_t event_d_id, uint8_t port_id,
struct rte_event events[], uint16_t nb_enq,
@@ -147,4 +157,7 @@ l2fwd_event_worker_cleanup(uint8_t event_d_id, uint8_t port_id,
events[i].op = RTE_EVENT_OP_RELEASE;
rte_event_enqueue_burst(event_d_id, port_id, events, nb_deq);
}
+
+ rte_event_port_quiesce(event_d_id, port_id, l2fwd_event_port_flush,
+ NULL);
}
diff --git a/examples/l3fwd/l3fwd_event.c b/examples/l3fwd/l3fwd_event.c
index a14a21b414..0b58475c85 100644
--- a/examples/l3fwd/l3fwd_event.c
+++ b/examples/l3fwd/l3fwd_event.c
@@ -301,6 +301,16 @@ l3fwd_event_vector_array_free(struct rte_event events[], uint16_t num)
}
}
+static void
+l3fwd_event_port_flush(uint8_t event_d_id __rte_unused, struct rte_event ev,
+ void *args __rte_unused)
+{
+ if (ev.event_type & RTE_EVENT_TYPE_VECTOR)
+ l3fwd_event_vector_array_free(&ev, 1);
+ else
+ rte_pktmbuf_free(ev.mbuf);
+}
+
void
l3fwd_event_worker_cleanup(uint8_t event_d_id, uint8_t event_p_id,
struct rte_event events[], uint16_t nb_enq,
@@ -320,4 +330,7 @@ l3fwd_event_worker_cleanup(uint8_t event_d_id, uint8_t event_p_id,
events[i].op = RTE_EVENT_OP_RELEASE;
rte_event_enqueue_burst(event_d_id, event_p_id, events, nb_deq);
}
+
+ rte_event_port_quiesce(event_d_id, event_p_id, l3fwd_event_port_flush,
+ NULL);
}
--
2.35.1
next prev parent reply other threads:[~2022-04-27 11:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-27 11:32 [PATCH 1/3] eventdev: add function to quiesce an event port Pavan Nikhilesh
2022-04-27 11:32 ` [PATCH 2/3] eventdev: update examples to use port quiesce Pavan Nikhilesh
2022-04-27 11:32 ` [PATCH 3/3] event/cnxk: implement event port quiesce function Pavan Nikhilesh
2022-04-27 11:37 ` [PATCH 1/3 v2] eventdev: add function to quiesce an event port Pavan Nikhilesh
2022-04-27 11:37 ` Pavan Nikhilesh [this message]
2022-04-27 11:37 ` [PATCH 3/3 v2] event/cnxk: implement event port quiesce function Pavan Nikhilesh
2022-05-13 17:58 ` [PATCH v3 1/3] eventdev: add function to quiesce an event port pbhagavatula
2022-05-13 17:58 ` [PATCH v3 2/3] eventdev: update examples to use port quiesce pbhagavatula
2022-05-13 17:58 ` [PATCH v3 3/3] event/cnxk: implement event port quiesce function pbhagavatula
2022-05-17 10:04 ` [PATCH v3 1/3] eventdev: add function to quiesce an event port Jerin Jacob
2022-05-04 9:02 ` [PATCH " Ray Kinsella
2022-05-09 17:29 ` Jerin Jacob
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=20220427113715.15509-2-pbhagavatula@marvell.com \
--to=pbhagavatula@marvell.com \
--cc=dev@dpdk.org \
--cc=gakhil@marvell.com \
--cc=harry.van.haaren@intel.com \
--cc=jerinj@marvell.com \
--cc=radu.nicolau@intel.com \
--cc=skori@marvell.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).