From: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
To: dev@dpdk.org
Cc: yogesh.jangra@intel.com
Subject: [PATCH 3/4] pipeline: move table type registration to library
Date: Fri, 26 Nov 2021 23:51:28 +0000 [thread overview]
Message-ID: <20211126235129.35781-3-cristian.dumitrescu@intel.com> (raw)
In-Reply-To: <20211126235129.35781-1-cristian.dumitrescu@intel.com>
Move the table type registration for the well known table types from
the application to the pipeline library.
Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Yogesh Jangra <yogesh.jangra@intel.com>
---
examples/pipeline/obj.c | 16 ----------------
lib/pipeline/rte_swx_pipeline.c | 29 +++++++++++++++++++++++++++++
2 files changed, 29 insertions(+), 16 deletions(-)
diff --git a/examples/pipeline/obj.c b/examples/pipeline/obj.c
index 4b2db66c46..b79f044ac7 100644
--- a/examples/pipeline/obj.c
+++ b/examples/pipeline/obj.c
@@ -16,8 +16,6 @@
#include <rte_mempool.h>
#include <rte_mbuf.h>
#include <rte_ethdev.h>
-#include <rte_swx_table_em.h>
-#include <rte_swx_table_wm.h>
#include <rte_swx_pipeline.h>
#include <rte_swx_ctl.h>
@@ -539,20 +537,6 @@ pipeline_create(struct obj *obj, const char *name, int numa_node)
if (status)
goto error;
- status = rte_swx_pipeline_table_type_register(p,
- "exact",
- RTE_SWX_TABLE_MATCH_EXACT,
- &rte_swx_table_exact_match_ops);
- if (status)
- goto error;
-
- status = rte_swx_pipeline_table_type_register(p,
- "wildcard",
- RTE_SWX_TABLE_MATCH_WILDCARD,
- &rte_swx_table_wildcard_match_ops);
- if (status)
- goto error;
-
/* Node allocation */
pipeline = calloc(1, sizeof(struct pipeline));
if (pipeline == NULL)
diff --git a/lib/pipeline/rte_swx_pipeline.c b/lib/pipeline/rte_swx_pipeline.c
index bebad98e99..a05a4edc7d 100644
--- a/lib/pipeline/rte_swx_pipeline.c
+++ b/lib/pipeline/rte_swx_pipeline.c
@@ -12,6 +12,9 @@
#include <rte_swx_port_ring.h>
#include "rte_swx_port_source_sink.h"
+#include <rte_swx_table_em.h>
+#include <rte_swx_table_wm.h>
+
#include "rte_swx_pipeline_internal.h"
#define CHECK(condition, err_code) \
@@ -9088,6 +9091,28 @@ port_out_types_register(struct rte_swx_pipeline *p)
return 0;
}
+static int
+table_types_register(struct rte_swx_pipeline *p)
+{
+ int status;
+
+ status = rte_swx_pipeline_table_type_register(p,
+ "exact",
+ RTE_SWX_TABLE_MATCH_EXACT,
+ &rte_swx_table_exact_match_ops);
+ if (status)
+ return status;
+
+ status = rte_swx_pipeline_table_type_register(p,
+ "wildcard",
+ RTE_SWX_TABLE_MATCH_WILDCARD,
+ &rte_swx_table_wildcard_match_ops);
+ if (status)
+ return status;
+
+ return 0;
+}
+
int
rte_swx_pipeline_config(struct rte_swx_pipeline **p, int numa_node)
{
@@ -9134,6 +9159,10 @@ rte_swx_pipeline_config(struct rte_swx_pipeline **p, int numa_node)
if (status)
goto error;
+ status = table_types_register(pipeline);
+ if (status)
+ goto error;
+
*p = pipeline;
return 0;
--
2.17.1
next prev parent reply other threads:[~2021-11-26 23:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-26 23:51 [PATCH 1/4] pipeline: improve the drop instruction Cristian Dumitrescu
2021-11-26 23:51 ` [PATCH 2/4] pipeline: move port type registration to library Cristian Dumitrescu
2021-11-26 23:51 ` Cristian Dumitrescu [this message]
2021-11-26 23:51 ` [PATCH 4/4] pipeline: add drop port for each pipeline Cristian Dumitrescu
2021-11-27 0:02 ` [PATCH V2 1/4] pipeline: improve the drop instruction Cristian Dumitrescu
2021-11-27 0:02 ` [PATCH V2 2/4] pipeline: move port type registration to library Cristian Dumitrescu
2021-11-27 0:02 ` [PATCH V2 3/4] pipeline: move table " Cristian Dumitrescu
2021-11-27 0:02 ` [PATCH V2 4/4] pipeline: add drop port for each pipeline Cristian Dumitrescu
2022-02-13 19:48 ` 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=20211126235129.35781-3-cristian.dumitrescu@intel.com \
--to=cristian.dumitrescu@intel.com \
--cc=dev@dpdk.org \
--cc=yogesh.jangra@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).