[dpdk-dev] [PATCH 05/20] eventdev: add framework for eventmode conf

Anoob Joseph anoob.joseph at caviumnetworks.com
Fri Jun 8 19:24:04 CEST 2018


Adding eventmode conf which would have all required configuration for
the event mode.

Signed-off-by: Anoob Joseph <anoob.joseph at caviumnetworks.com>
---
 lib/librte_eventdev/rte_eventmode_helper.c          | 16 ++++++++++++++++
 lib/librte_eventdev/rte_eventmode_helper_internal.h |  5 +++++
 2 files changed, 21 insertions(+)

diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c
index 9282682..ec014a6 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.c
+++ b/lib/librte_eventdev/rte_eventmode_helper.c
@@ -97,6 +97,7 @@ rte_eventmode_helper_parse_args(int argc, char **argv)
 {
 	int32_t opt, ret;
 	struct rte_eventmode_helper_conf *conf = NULL;
+	struct eventmode_conf *em_conf = NULL;
 
 	/* Allocate memory for conf */
 	conf = rte_zmalloc("eventmode-helper-conf",
@@ -108,9 +109,21 @@ rte_eventmode_helper_parse_args(int argc, char **argv)
 			goto err;
 	}
 
+	/* Allocate memory for event mode params */
+	conf->mode_params = rte_zmalloc("eventmode-helper-mode-params",
+			sizeof(struct eventmode_conf),
+			RTE_CACHE_LINE_SIZE);
+	if (conf->mode_params == NULL) {
+		RTE_EM_HLPR_LOG_ERR(
+			"Failed allocating memory for event mode params");
+		goto err;
+	}
+
 	/* Initialize conf with default values */
 	em_initialize_helper_conf(conf);
 
+	em_conf = (struct eventmode_conf *)(conf->mode_params);
+
 	while ((opt = getopt_long(argc, argv, short_options,
 				lgopts, NULL)) != EOF) {
 		switch (opt) {
@@ -131,6 +144,9 @@ rte_eventmode_helper_parse_args(int argc, char **argv)
 	return conf;
 
 err:
+	if (em_conf != NULL)
+		rte_free(em_conf);
+
 	if (conf != NULL)
 		rte_free(conf);
 
diff --git a/lib/librte_eventdev/rte_eventmode_helper_internal.h b/lib/librte_eventdev/rte_eventmode_helper_internal.h
index e946f11..134ddd3 100644
--- a/lib/librte_eventdev/rte_eventmode_helper_internal.h
+++ b/lib/librte_eventdev/rte_eventmode_helper_internal.h
@@ -27,4 +27,9 @@
 #define RTE_EM_HLPR_LOG_DEBUG(...) (void)0
 #endif
 
+/* Eventmode conf data */
+struct eventmode_conf {
+	uint64_t dummy;
+};
+
 #endif /* _RTE_EVENTMODE_HELPER_INTERNAL_H_ */
-- 
2.7.4



More information about the dev mailing list