diff mbox series

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

Message ID 1528478659-15859-6-git-send-email-anoob.joseph@caviumnetworks.com (mailing list archive)
State Changes Requested, archived
Delegated to: Jerin Jacob
Headers show
Series add eventmode helper functions | expand

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply issues

Commit Message

Anoob Joseph June 8, 2018, 5:24 p.m. UTC
Adding eventmode conf which would have all required configuration for
the event mode.

Signed-off-by: Anoob Joseph <anoob.joseph@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 mbox series

Patch

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_ */