DPDK patches and discussions
 help / color / mirror / Atom feed
From: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
To: dev@dpdk.org
Cc: Kamalakannan R <kamalakannan.r@intel.com>
Subject: [PATCH V6 03/11] examples/pipeline: streamline ring support
Date: Thu, 26 Jan 2023 14:12:48 +0000	[thread overview]
Message-ID: <20230126141256.380415-4-cristian.dumitrescu@intel.com> (raw)
In-Reply-To: <20230126141256.380415-1-cristian.dumitrescu@intel.com>

Remove redundant ring related code.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Kamalakannan R <kamalakannan.r@intel.com>
---
 examples/pipeline/cli.c | 24 ++++++++++------
 examples/pipeline/obj.c | 63 -----------------------------------------
 examples/pipeline/obj.h | 21 --------------
 3 files changed, 15 insertions(+), 93 deletions(-)

diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c
index 14f1cfa47e..517682f7c9 100644
--- a/examples/pipeline/cli.c
+++ b/examples/pipeline/cli.c
@@ -11,6 +11,7 @@
 
 #include <rte_common.h>
 #include <rte_ethdev.h>
+#include <rte_ring.h>
 #include <rte_swx_port_ethdev.h>
 #include <rte_swx_port_ring.h>
 #include <rte_swx_port_source_sink.h>
@@ -491,11 +492,11 @@ cmd_ring(char **tokens,
 	uint32_t n_tokens,
 	char *out,
 	size_t out_size,
-	void *obj)
+	void *obj __rte_unused)
 {
-	struct ring_params p;
+	struct rte_ring *r;
 	char *name;
-	struct ring *ring;
+	uint32_t size, numa_node;
 
 	if (n_tokens != 6) {
 		snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
@@ -504,28 +505,32 @@ cmd_ring(char **tokens,
 
 	name = tokens[1];
 
-	if (strcmp(tokens[2], "size") != 0) {
+	if (strcmp(tokens[2], "size")) {
 		snprintf(out, out_size, MSG_ARG_NOT_FOUND, "size");
 		return;
 	}
 
-	if (parser_read_uint32(&p.size, tokens[3]) != 0) {
+	if (parser_read_uint32(&size, tokens[3])) {
 		snprintf(out, out_size, MSG_ARG_INVALID, "size");
 		return;
 	}
 
-	if (strcmp(tokens[4], "numa") != 0) {
+	if (strcmp(tokens[4], "numa")) {
 		snprintf(out, out_size, MSG_ARG_NOT_FOUND, "numa");
 		return;
 	}
 
-	if (parser_read_uint32(&p.numa_node, tokens[5]) != 0) {
+	if (parser_read_uint32(&numa_node, tokens[5])) {
 		snprintf(out, out_size, MSG_ARG_INVALID, "numa_node");
 		return;
 	}
 
-	ring = ring_create(obj, name, &p);
-	if (!ring) {
+	r = rte_ring_create(
+		name,
+		size,
+		(int)numa_node,
+		RING_F_SP_ENQ | RING_F_SC_DEQ);
+	if (!r) {
 		snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);
 		return;
 	}
@@ -2999,6 +3004,7 @@ cmd_help(char **tokens,
 			"List of commands:\n"
 			"\tmempool\n"
 			"\tethdev\n"
+			"\tring\n"
 			"\tpipeline codegen\n"
 			"\tpipeline libbuild\n"
 			"\tpipeline build\n"
diff --git a/examples/pipeline/obj.c b/examples/pipeline/obj.c
index 697d14a901..3614b99d28 100644
--- a/examples/pipeline/obj.c
+++ b/examples/pipeline/obj.c
@@ -24,17 +24,11 @@
  */
 TAILQ_HEAD(link_list, link);
 
-/*
- * ring
- */
-TAILQ_HEAD(ring_list, ring);
-
 /*
  * obj
  */
 struct obj {
 	struct link_list link_list;
-	struct ring_list ring_list;
 };
 
 /*
@@ -282,62 +276,6 @@ link_next(struct obj *obj, struct link *link)
 		TAILQ_FIRST(&obj->link_list) : TAILQ_NEXT(link, node);
 }
 
-/*
- * ring
- */
-struct ring *
-ring_create(struct obj *obj, const char *name, struct ring_params *params)
-{
-	struct ring *ring;
-	struct rte_ring *r;
-	unsigned int flags = RING_F_SP_ENQ | RING_F_SC_DEQ;
-
-	/* Check input params */
-	if (!name || ring_find(obj, name) || !params || !params->size)
-		return NULL;
-
-	/**
-	 * Resource create
-	 */
-	r = rte_ring_create(
-		name,
-		params->size,
-		params->numa_node,
-		flags);
-	if (!r)
-		return NULL;
-
-	/* Node allocation */
-	ring = calloc(1, sizeof(struct ring));
-	if (!ring) {
-		rte_ring_free(r);
-		return NULL;
-	}
-
-	/* Node fill in */
-	strlcpy(ring->name, name, sizeof(ring->name));
-
-	/* Node add to list */
-	TAILQ_INSERT_TAIL(&obj->ring_list, ring, node);
-
-	return ring;
-}
-
-struct ring *
-ring_find(struct obj *obj, const char *name)
-{
-	struct ring *ring;
-
-	if (!obj || !name)
-		return NULL;
-
-	TAILQ_FOREACH(ring, &obj->ring_list, node)
-		if (strcmp(ring->name, name) == 0)
-			return ring;
-
-	return NULL;
-}
-
 /*
  * obj
  */
@@ -351,7 +289,6 @@ obj_init(void)
 		return NULL;
 
 	TAILQ_INIT(&obj->link_list);
-	TAILQ_INIT(&obj->ring_list);
 
 	return obj;
 }
diff --git a/examples/pipeline/obj.h b/examples/pipeline/obj.h
index 4ea610ceed..dbbc6d39a0 100644
--- a/examples/pipeline/obj.h
+++ b/examples/pipeline/obj.h
@@ -73,25 +73,4 @@ link_find(struct obj *obj, const char *name);
 struct link *
 link_next(struct obj *obj, struct link *link);
 
-/*
- * ring
- */
-struct ring_params {
-	uint32_t size;
-	uint32_t numa_node;
-};
-
-struct ring {
-	TAILQ_ENTRY(ring) node;
-	char name[NAME_SIZE];
-};
-
-struct ring *
-ring_create(struct obj *obj,
-	   const char *name,
-	   struct ring_params *params);
-
-struct ring *
-ring_find(struct obj *obj, const char *name);
-
 #endif /* _INCLUDE_OBJ_H_ */
-- 
2.34.1


  parent reply	other threads:[~2023-01-26 14:34 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-11 20:55 [PATCH 00/11] pipeline: add IPsec support Cristian Dumitrescu
2023-01-11 20:55 ` [PATCH 01/11] " Cristian Dumitrescu
2023-01-11 20:55 ` [PATCH 02/11] examples/pipeline: rework memory pool support Cristian Dumitrescu
2023-01-11 20:56 ` [PATCH 03/11] examples/pipeline: streamline ring support Cristian Dumitrescu
2023-01-11 20:56 ` [PATCH 04/11] examples/pipeline: streamline the Ethernet device support Cristian Dumitrescu
2023-01-11 20:56 ` [PATCH 05/11] examples/pipeline: support crypto devices Cristian Dumitrescu
2023-01-11 20:56 ` [PATCH 06/11] examples/pipeline: add CLI command for crypto device Cristian Dumitrescu
2023-01-11 20:56 ` [PATCH 07/11] examples/pipeline: add IPsec CLI commands Cristian Dumitrescu
2023-01-11 20:56 ` [PATCH 08/11] examples/pipeline: rework the thread configuration updates Cristian Dumitrescu
2023-01-11 20:56 ` [PATCH 09/11] examples/pipeline: support blocks other than pipelines Cristian Dumitrescu
2023-01-11 20:56 ` [PATCH 10/11] examples/pipeline: add block enable/disable CLI commands Cristian Dumitrescu
2023-01-11 20:56 ` [PATCH 11/11] examples/pipeline: add IPsec example Cristian Dumitrescu
2023-01-11 23:43 ` [PATCH V2 00/11] pipeline: add IPsec support Cristian Dumitrescu
2023-01-11 23:43   ` [PATCH V2 01/11] " Cristian Dumitrescu
2023-01-11 23:43   ` [PATCH V2 02/11] examples/pipeline: rework memory pool support Cristian Dumitrescu
2023-01-11 23:43   ` [PATCH V2 03/11] examples/pipeline: streamline ring support Cristian Dumitrescu
2023-01-11 23:43   ` [PATCH V2 04/11] examples/pipeline: streamline the Ethernet device support Cristian Dumitrescu
2023-01-11 23:43   ` [PATCH V2 05/11] examples/pipeline: support crypto devices Cristian Dumitrescu
2023-01-11 23:43   ` [PATCH V2 06/11] examples/pipeline: add CLI command for crypto device Cristian Dumitrescu
2023-01-11 23:43   ` [PATCH V2 07/11] examples/pipeline: add IPsec CLI commands Cristian Dumitrescu
2023-01-11 23:43   ` [PATCH V2 08/11] examples/pipeline: rework the thread configuration updates Cristian Dumitrescu
2023-01-11 23:43   ` [PATCH V2 09/11] examples/pipeline: support blocks other than pipelines Cristian Dumitrescu
2023-01-11 23:43   ` [PATCH V2 10/11] examples/pipeline: add block enable/disable CLI commands Cristian Dumitrescu
2023-01-11 23:43   ` [PATCH V2 11/11] examples/pipeline: add IPsec example Cristian Dumitrescu
2023-01-12 15:45 ` [PATCH V3 00/11] pipeline: add IPsec support Cristian Dumitrescu
2023-01-12 15:45   ` [PATCH V3 01/11] " Cristian Dumitrescu
2023-01-12 15:45   ` [PATCH V3 02/11] examples/pipeline: rework memory pool support Cristian Dumitrescu
2023-01-12 15:45   ` [PATCH V3 03/11] examples/pipeline: streamline ring support Cristian Dumitrescu
2023-01-12 15:45   ` [PATCH V3 04/11] examples/pipeline: streamline the Ethernet device support Cristian Dumitrescu
2023-01-12 15:45   ` [PATCH V3 05/11] examples/pipeline: support crypto devices Cristian Dumitrescu
2023-01-12 15:45   ` [PATCH V3 06/11] examples/pipeline: add CLI command for crypto device Cristian Dumitrescu
2023-01-12 15:45   ` [PATCH V3 07/11] examples/pipeline: add IPsec CLI commands Cristian Dumitrescu
2023-01-12 15:45   ` [PATCH V3 08/11] examples/pipeline: rework the thread configuration updates Cristian Dumitrescu
2023-01-12 15:45   ` [PATCH V3 09/11] examples/pipeline: support blocks other than pipelines Cristian Dumitrescu
2023-01-12 15:45   ` [PATCH V3 10/11] examples/pipeline: add block enable/disable CLI commands Cristian Dumitrescu
2023-01-12 15:45   ` [PATCH V3 11/11] examples/pipeline: add IPsec example Cristian Dumitrescu
2023-01-12 15:49 ` [PATCH V3 00/11] pipeline: add IPsec support Cristian Dumitrescu
2023-01-12 15:49   ` [PATCH V3 01/11] " Cristian Dumitrescu
2023-01-12 15:49   ` [PATCH V3 02/11] examples/pipeline: rework memory pool support Cristian Dumitrescu
2023-01-12 15:49   ` [PATCH V3 03/11] examples/pipeline: streamline ring support Cristian Dumitrescu
2023-01-12 15:49   ` [PATCH V3 04/11] examples/pipeline: streamline the Ethernet device support Cristian Dumitrescu
2023-01-12 15:49   ` [PATCH V3 05/11] examples/pipeline: support crypto devices Cristian Dumitrescu
2023-01-12 15:49   ` [PATCH V3 06/11] examples/pipeline: add CLI command for crypto device Cristian Dumitrescu
2023-01-12 15:49   ` [PATCH V3 07/11] examples/pipeline: add IPsec CLI commands Cristian Dumitrescu
2023-01-12 15:49   ` [PATCH V3 08/11] examples/pipeline: rework the thread configuration updates Cristian Dumitrescu
2023-01-12 15:49   ` [PATCH V3 09/11] examples/pipeline: support blocks other than pipelines Cristian Dumitrescu
2023-01-12 15:49   ` [PATCH V3 10/11] examples/pipeline: add block enable/disable CLI commands Cristian Dumitrescu
2023-01-12 15:49   ` [PATCH V3 11/11] examples/pipeline: add IPsec example Cristian Dumitrescu
2023-01-12 18:53 ` [PATCH V4 00/11] pipeline: add IPsec support Cristian Dumitrescu
2023-01-12 18:53   ` [PATCH V4 01/11] " Cristian Dumitrescu
2023-01-12 18:53   ` [PATCH V4 02/11] examples/pipeline: rework memory pool support Cristian Dumitrescu
2023-01-12 18:53   ` [PATCH V4 03/11] examples/pipeline: streamline ring support Cristian Dumitrescu
2023-01-12 18:53   ` [PATCH V4 04/11] examples/pipeline: streamline the Ethernet device support Cristian Dumitrescu
2023-01-12 18:53   ` [PATCH V4 05/11] examples/pipeline: support crypto devices Cristian Dumitrescu
2023-01-12 18:53   ` [PATCH V4 06/11] examples/pipeline: add CLI command for crypto device Cristian Dumitrescu
2023-01-12 18:53   ` [PATCH V4 07/11] examples/pipeline: add IPsec CLI commands Cristian Dumitrescu
2023-01-12 18:53   ` [PATCH V4 08/11] examples/pipeline: rework the thread configuration updates Cristian Dumitrescu
2023-01-12 18:53   ` [PATCH V4 09/11] examples/pipeline: support blocks other than pipelines Cristian Dumitrescu
2023-01-12 18:53   ` [PATCH V4 10/11] examples/pipeline: add block enable/disable CLI commands Cristian Dumitrescu
2023-01-12 18:53   ` [PATCH V4 11/11] examples/pipeline: add IPsec example Cristian Dumitrescu
2023-01-26  9:17   ` [PATCH V4 00/11] pipeline: add IPsec support Thomas Monjalon
2023-01-26 13:11     ` Dumitrescu, Cristian
2023-01-26 13:34 ` [PATCH V5 " Cristian Dumitrescu
2023-01-26 13:34   ` [PATCH V5 01/11] " Cristian Dumitrescu
2023-01-26 13:34   ` [PATCH V5 02/11] examples/pipeline: rework memory pool support Cristian Dumitrescu
2023-01-26 13:34   ` [PATCH V5 03/11] examples/pipeline: streamline ring support Cristian Dumitrescu
2023-01-26 13:34   ` [PATCH V5 04/11] examples/pipeline: streamline the Ethernet device support Cristian Dumitrescu
2023-01-26 13:34   ` [PATCH V5 05/11] examples/pipeline: support crypto devices Cristian Dumitrescu
2023-01-26 13:34   ` [PATCH V5 06/11] examples/pipeline: add CLI command for crypto device Cristian Dumitrescu
2023-01-26 13:34   ` [PATCH V5 07/11] examples/pipeline: add IPsec CLI commands Cristian Dumitrescu
2023-01-26 13:34   ` [PATCH V5 08/11] examples/pipeline: rework the thread configuration updates Cristian Dumitrescu
2023-01-26 13:34   ` [PATCH V5 09/11] examples/pipeline: support blocks other than pipelines Cristian Dumitrescu
2023-01-26 13:34   ` [PATCH V5 10/11] examples/pipeline: add block enable/disable CLI commands Cristian Dumitrescu
2023-01-26 13:34   ` [PATCH V5 11/11] examples/pipeline: add IPsec example Cristian Dumitrescu
2023-01-26 14:12 ` [PATCH V6 00/11] pipeline: add IPsec support Cristian Dumitrescu
2023-01-26 14:12   ` [PATCH V6 01/11] " Cristian Dumitrescu
2023-01-26 14:12   ` [PATCH V6 02/11] examples/pipeline: rework memory pool support Cristian Dumitrescu
2023-01-26 14:12   ` Cristian Dumitrescu [this message]
2023-01-26 14:12   ` [PATCH V6 04/11] examples/pipeline: streamline the Ethernet device support Cristian Dumitrescu
2023-01-26 14:12   ` [PATCH V6 05/11] examples/pipeline: support crypto devices Cristian Dumitrescu
2023-01-26 14:12   ` [PATCH V6 06/11] examples/pipeline: add CLI command for crypto device Cristian Dumitrescu
2023-01-26 14:12   ` [PATCH V6 07/11] examples/pipeline: add IPsec CLI commands Cristian Dumitrescu
2023-01-26 14:12   ` [PATCH V6 08/11] examples/pipeline: rework the thread configuration updates Cristian Dumitrescu
2023-01-26 14:12   ` [PATCH V6 09/11] examples/pipeline: support blocks other than pipelines Cristian Dumitrescu
2023-01-26 14:12   ` [PATCH V6 10/11] examples/pipeline: add block enable/disable CLI commands Cristian Dumitrescu
2023-01-26 14:12   ` [PATCH V6 11/11] examples/pipeline: add IPsec example Cristian Dumitrescu
2023-02-05 16:13   ` [PATCH V6 00/11] pipeline: add IPsec support Thomas Monjalon

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=20230126141256.380415-4-cristian.dumitrescu@intel.com \
    --to=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=kamalakannan.r@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).