From: Vipin Varghese <vipin.varghese@intel.com>
To: olivier.matz@6wind.com, reshma.pattan@intel.com,
keith.wiles@intel.com, dev@dpdk.org
Cc: sanjay.padubidri@intel.com, Vipin Varghese <vipin.varghese@intel.com>
Subject: [dpdk-dev] [PATCH v1 2/2] examples/packet_ordering: add ring callback
Date: Fri, 7 Jun 2019 00:03:55 +0530 [thread overview]
Message-ID: <20190606183355.56734-2-vipin.varghese@intel.com> (raw)
In-Reply-To: <20190606183355.56734-1-vipin.varghese@intel.com>
update example with ring register-unregister for
enqueue-dequeue callabck.
Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
---
examples/packet_ordering/Makefile | 1 +
examples/packet_ordering/main.c | 40 ++++++++++++++++++++++++++++
examples/packet_ordering/meson.build | 1 +
3 files changed, 42 insertions(+)
diff --git a/examples/packet_ordering/Makefile b/examples/packet_ordering/Makefile
index 2c3187a41..3322b4024 100644
--- a/examples/packet_ordering/Makefile
+++ b/examples/packet_ordering/Makefile
@@ -50,6 +50,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -DALLOW_EXPERIMENTAL_API
include $(RTE_SDK)/mk/rte.extapp.mk
endif
diff --git a/examples/packet_ordering/main.c b/examples/packet_ordering/main.c
index ca312029e..98d4a7a77 100644
--- a/examples/packet_ordering/main.c
+++ b/examples/packet_ordering/main.c
@@ -71,6 +71,28 @@ volatile struct app_stats {
} tx __rte_cache_aligned;
} app_stats;
+#ifdef RTE_RING_ENQDEQ_CALLBACKS
+unsigned int dump_ring(__rte_unused struct rte_ring *r,
+ __rte_unused void *obj_table,
+ __rte_unused unsigned int n,
+ __rte_unused void *cb_arg);
+
+unsigned int dump_ring(__rte_unused struct rte_ring *r,
+ __rte_unused void *obj_table,
+ __rte_unused unsigned int n,
+ __rte_unused void *cb_arg)
+{
+
+#if 0
+ if (likely(n))
+ printf(" ring (%p) obj (%p) n (%u)\n",
+ r, obj_table, n);
+#endif
+
+ return n;
+}
+#endif
+
/**
* Get the last enabled lcore ID
*
@@ -699,6 +721,15 @@ main(int argc, char **argv)
worker_args.ring_in = rx_to_workers;
worker_args.ring_out = workers_to_tx;
+#ifdef RTE_RING_ENQDEQ_CALLBACKS
+ if (rte_ring_preenq_callback_register(rte_ring_lookup("rx_to_workers"),
+ dump_ring, NULL))
+ printf("failed preenq_callback_register - rx_to_workers\n");
+ if (rte_ring_pstdeq_callback_register(rte_ring_lookup("workers_to_tx"),
+ dump_ring, NULL))
+ printf("failed pstdeq_callback_register - rx_to_workers\n");
+#endif
+
/* Start worker_thread() on all the available slave cores but the last 1 */
for (lcore_id = 0; lcore_id <= get_previous_lcore_id(last_lcore_id); lcore_id++)
if (rte_lcore_is_enabled(lcore_id) && lcore_id != master_lcore_id)
@@ -724,6 +755,15 @@ main(int argc, char **argv)
return -1;
}
+#ifdef RTE_RING_ENQDEQ_CALLBACKS
+ if (rte_ring_preenq_callback_unregister(
+ rte_ring_lookup("rx_to_workers"), dump_ring, NULL))
+ printf("failed preenq_callback_unregister - rx_to_workers\n");
+ if (rte_ring_pstdeq_callback_unregister(
+ rte_ring_lookup("workers_to_tx"), dump_ring, NULL))
+ printf("failed pstdeq_callback_unregister - rx_to_workers\n");
+#endif
+
print_stats();
return 0;
}
diff --git a/examples/packet_ordering/meson.build b/examples/packet_ordering/meson.build
index 6c2fccdcb..a3776946f 100644
--- a/examples/packet_ordering/meson.build
+++ b/examples/packet_ordering/meson.build
@@ -7,6 +7,7 @@
# DPDK instance, use 'make'
deps += 'reorder'
+allow_experimental_apis = true
sources = files(
'main.c'
)
--
2.17.1
next prev parent reply other threads:[~2019-06-06 18:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-06 18:33 [dpdk-dev] [PATCH v1 1/2] lib/ring: add enqueue-dequeue callabck Vipin Varghese
2019-06-06 18:33 ` Vipin Varghese [this message]
2019-06-06 19:49 ` Stephen Hemminger
2019-06-07 9:30 ` Bruce Richardson
2019-06-10 5:14 ` Varghese, Vipin
2019-06-07 10:45 ` Ananyev, Konstantin
2019-06-10 5:16 ` Varghese, Vipin
2019-06-10 5:07 ` Varghese, Vipin
2019-06-07 6:03 ` Honnappa Nagarahalli
2019-06-10 5:12 ` Varghese, Vipin
2019-06-11 4:17 ` Honnappa Nagarahalli
2019-07-04 5:04 ` Varghese, Vipin
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=20190606183355.56734-2-vipin.varghese@intel.com \
--to=vipin.varghese@intel.com \
--cc=dev@dpdk.org \
--cc=keith.wiles@intel.com \
--cc=olivier.matz@6wind.com \
--cc=reshma.pattan@intel.com \
--cc=sanjay.padubidri@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).