Thread (82 messages) read the whole thread 82 messages, 5 authors, 2017-07-19

Re: [PATCH 2/6] service cores: coremask parsing

From: Van Haaren, Harry <hidden>
Date: 2017-06-29 11:13:38

From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]
<snip>
quoted
 #include "eal_internal_cfg.h"
 #include "eal_options.h"
@@ -61,6 +62,7 @@ const char
 eal_short_options[] =
 	"b:" /* pci-blacklist */
 	"c:" /* coremask */
+	"s:" /* service coremask */
 	"d:" /* driver */
 	"h"  /* help */
 	"l:" /* corelist */
Good to have a corelist variant for service lcore list. May be for future.
Yep agreed.

quoted
@@ -267,6 +269,75 @@ static int xdigit2val(unsigned char c)
 }

 static int
+eal_parse_service_coremask(const char *coremask)
+{
+	struct rte_config *cfg = rte_eal_get_configuration();
+	int i, j, idx = 0;
+	unsigned count = 0;
+	char c;
+	int val;
+
+	if (coremask == NULL)
+		return -1;
+	/* Remove all blank characters ahead and after .
+	 * Remove 0x/0X if exists.
+	 */
+	while (isblank(*coremask))
+		coremask++;
+	if (coremask[0] == '0' && ((coremask[1] == 'x')
+		|| (coremask[1] == 'X')))
+		coremask += 2;
+	i = strlen(coremask);
+	while ((i > 0) && isblank(coremask[i - 1]))
+		i--;
+
+	if (i == 0)
+		return -1;
+
+	printf("\n\nRemoving Service Cores from lcore roles now\n\n");
s/printf/RTE_LOG
Removed.

quoted
+	/* TODO: only scan active cores in coremask */
+	for (i = i - 1; i >= 0 && idx < RTE_MAX_LCORE; i--) {
+		c = coremask[i];
+		if (isxdigit(c) == 0) {
+			/* invalid characters */
+			return -1;
+		}
+		val = xdigit2val(c);
+		for (j = 0; j < BITS_PER_HEX && idx < RTE_MAX_LCORE;
+				j++, idx++) {
+			if ((1 << j) & val) {
+				/* TODO: enable flexible master core */
+				if (idx == 0)
+					continue;
+
+				if (!lcore_config[idx].detected) {
+					RTE_LOG(ERR, EAL,
+						"lcore %u unavailable\n", idx);
+					return -1;
+				}
+				//cfg->lcore_role[idx] = ROLE_SERVICE;
remove commented code.
Doh - thanks.

<snip>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help