Skip to contentSkip to conversation

eal: make eal_parse_coremask external

PATCH In review Timothy McDaniel 4 participants 4 messages Aug 19, 2022 – Sep 23, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 eal: make eal_parse_coremask external

DLB2 has a need to parse a user supplied coremask as part of an optimization that associates optimal core/resource pairs. Therefore eal_parse_coremask has been renamed to rte_eal_parse_coremask and exported.

---
 lib/eal/common/eal_common_options.c | 6 +++---
 lib/eal/common/eal_options.h        | 2 ++
 lib/eal/version.map                 | 3 +++
 3 files changed, 8 insertions(+), 3 deletions(-)
lib/eal/common/eal_common_options.c +3 -3
index 4c2def0155..2d6535781b 100644
@@ -742,8 +742,8 @@ check_core_list(int *lcores, unsigned int count)
 	return -1;
 }
 
-static int
-eal_parse_coremask(const char *coremask, int *cores)
+int
+rte_eal_parse_coremask(const char *coremask, int *cores)
 {
 	const char *coremask_orig = coremask;
 	int lcores[RTE_MAX_LCORE];
@@ -1649,7 +1649,7 @@ eal_parse_common_option(int opt, const char *optarg,
 		if (eal_service_cores_parsed())
 			RTE_LOG(WARNING, EAL,
 				"Service cores parsed before dataplane cores. Please ensure -c is before -s or -S\n");
-		if (eal_parse_coremask(optarg, lcore_indexes) < 0) {
+		if (rte_eal_parse_coremask(optarg, lcore_indexes) < 0) {
 			RTE_LOG(ERR, EAL, "invalid coremask syntax\n");
 			return -1;
 		}
lib/eal/common/eal_options.h +2 -0
index 3cc9cb6412..21df6886f8 100644
@@ -108,5 +108,7 @@ int eal_plugins_init(void);
 int eal_save_args(int argc, char **argv);
 int handle_eal_info_request(const char *cmd, const char *params __rte_unused,
 		struct rte_tel_data *d);
+__rte_experimental
+int rte_eal_parse_coremask(const char *coremask, int *cores);
 
 #endif /* EAL_OPTIONS_H */
lib/eal/version.map +3 -0
index 1f293e768b..3780853443 100644
@@ -424,6 +424,9 @@ EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
+
+	#added in 22.11
+	rte_eal_parse_coremask;
 };
 
 INTERNAL {
Signature · 1 line
2.25.1
#1 lore raw

2022-08-19 17:33 (UTC-0500), Timothy McDaniel:

Quoted 4 lines

DLB2 has a need to parse a user supplied coremask as part of an optimization that associates optimal core/resource pairs. Therefore eal_parse_coremask has been renamed to rte_eal_parse_coremask and exported.

INTERNAL would be sufficient since the function is only used within DPDK. EXPERIMENTAL is for symbols that would be used by consumer apps.

#2 lore raw

PATCH 1/1 eal: make eal_parse_coremask external

In reply to Timothy McDaniel

DLB2 has a need to parse a user supplied coremask as part of an optimization that associates optimal core/resource pairs. Therefore eal_parse_coremask has been renamed to rte_eal_parse_coremask and exported.

---
 lib/eal/common/eal_common_options.c | 6 +++---
 lib/eal/common/eal_options.h        | 2 ++
 lib/eal/version.map                 | 1 +
 3 files changed, 6 insertions(+), 3 deletions(-)
lib/eal/common/eal_common_options.c +3 -3
index 4c2def0155..2d6535781b 100644
@@ -742,8 +742,8 @@ check_core_list(int *lcores, unsigned int count)
 	return -1;
 }
 
-static int
-eal_parse_coremask(const char *coremask, int *cores)
+int
+rte_eal_parse_coremask(const char *coremask, int *cores)
 {
 	const char *coremask_orig = coremask;
 	int lcores[RTE_MAX_LCORE];
@@ -1649,7 +1649,7 @@ eal_parse_common_option(int opt, const char *optarg,
 		if (eal_service_cores_parsed())
 			RTE_LOG(WARNING, EAL,
 				"Service cores parsed before dataplane cores. Please ensure -c is before -s or -S\n");
-		if (eal_parse_coremask(optarg, lcore_indexes) < 0) {
+		if (rte_eal_parse_coremask(optarg, lcore_indexes) < 0) {
 			RTE_LOG(ERR, EAL, "invalid coremask syntax\n");
 			return -1;
 		}
lib/eal/common/eal_options.h +2 -0
index 3cc9cb6412..0cfb57cd1f 100644
@@ -108,5 +108,7 @@ int eal_plugins_init(void);
 int eal_save_args(int argc, char **argv);
 int handle_eal_info_request(const char *cmd, const char *params __rte_unused,
 		struct rte_tel_data *d);
+__rte_internal
+int rte_eal_parse_coremask(const char *coremask, int *cores);
 
 #endif /* EAL_OPTIONS_H */
lib/eal/version.map +1 -0
index 1f293e768b..c643bc1612 100644
@@ -464,4 +464,5 @@ INTERNAL {
 	rte_mem_map;
 	rte_mem_page_size;
 	rte_mem_unmap;
+	rte_eal_parse_coremask;
 };
Signature · 1 line
2.25.1
#3 lore raw

Hello Abdullah,

Quoted 5 lines · Abdullah Sevincer

DLB2 has a need to parse a user supplied coremask as part of an optimization that associates optimal core/resource pairs. Therefore eal_parse_coremask has been renamed to rte_eal_parse_coremask and exported.

Please version new revisions of a patch for your next contributions.

Quoted 37 lines
---
 lib/eal/common/eal_common_options.c | 6 +++---
 lib/eal/common/eal_options.h        | 2 ++
 lib/eal/version.map                 | 1 +
 3 files changed, 6 insertions(+), 3 deletions(-)
lib/eal/common/eal_common_options.c +3 -3
index 4c2def0155..2d6535781b 100644
@@ -742,8 +742,8 @@ check_core_list(int *lcores, unsigned int count)
        return -1;
 }
 
-static int
-eal_parse_coremask(const char *coremask, int *cores)
+int
+rte_eal_parse_coremask(const char *coremask, int *cores)
 {
        const char *coremask_orig = coremask;
        int lcores[RTE_MAX_LCORE];
@@ -1649,7 +1649,7 @@ eal_parse_common_option(int opt, const char *optarg,
                if (eal_service_cores_parsed())
                        RTE_LOG(WARNING, EAL,
                                "Service cores parsed before dataplane cores. Please ensure -c is before -s or -S\n");
-               if (eal_parse_coremask(optarg, lcore_indexes) < 0) {
+               if (rte_eal_parse_coremask(optarg, lcore_indexes) < 0) {
                        RTE_LOG(ERR, EAL, "invalid coremask syntax\n");
                        return -1;
                }
lib/eal/common/eal_options.h +0 -0
index 3cc9cb6412..0cfb57cd1f 100644

lib/eal/common/eal_options.h int eal_plugins_init(void); · line 112

Quoted 5 lines
lib/eal/common/eal_options.h +2 -0
@@ -108,5 +108,7 @@ int eal_plugins_init(void);
 int eal_save_args(int argc, char **argv);
 int handle_eal_info_request(const char *cmd, const char *params __rte_unused,
                struct rte_tel_data *d);
+__rte_internal
+int rte_eal_parse_coremask(const char *coremask, int *cores);

I moved this to rte_eal.h and added a (doxygen) description of what this helper does.

lib/eal/version.map INTERNAL { · line 467

Quoted 11 lines
lib/eal/common/eal_options.h +0 -0
 #endif /* EAL_OPTIONS_H */
lib/eal/version.map +1 -0
index 1f293e768b..c643bc1612 100644
@@ -464,4 +464,5 @@ INTERNAL {
        rte_mem_map;
        rte_mem_page_size;
        rte_mem_unmap;
+       rte_eal_parse_coremask;

Fixed to alphabetical order.

Applied, thanks.

Signature · 1 line
David Marchand