From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
To: Harry van Haaren <harry.van.haaren@intel.com>
Cc: dev@dpdk.org, thomas@monjalon.net, keith.wiles@intel.com,
bruce.richardson@intel.com
Subject: Re: [dpdk-dev] [PATCH 2/6] service cores: coremask parsing
Date: Mon, 26 Jun 2017 18:19:51 +0530 [thread overview]
Message-ID: <20170626124950.GB5612@jerin> (raw)
In-Reply-To: <1498208779-166205-2-git-send-email-harry.van.haaren@intel.com>
-----Original Message-----
> Date: Fri, 23 Jun 2017 10:06:15 +0100
> From: Harry van Haaren <harry.van.haaren@intel.com>
> To: dev@dpdk.org
> CC: thomas@monjalon.net, jerin.jacob@caviumnetworks.com,
> keith.wiles@intel.com, bruce.richardson@intel.com, Harry van Haaren
> <harry.van.haaren@intel.com>
> Subject: [PATCH 2/6] service cores: coremask parsing
> X-Mailer: git-send-email 2.7.4
>
> Add logic for parsing a coremask from EAL, which allows
> the application to be unaware of the cores being taken from
> its coremask.
>
> Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
> ---
> lib/librte_eal/common/eal_common_options.c | 78 ++++++++++++++++++++++++++++++
> 1 file changed, 78 insertions(+)
>
> diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
> index f470195..3599784 100644
> --- a/lib/librte_eal/common/eal_common_options.c
> +++ b/lib/librte_eal/common/eal_common_options.c
> @@ -50,6 +50,7 @@
> #include <rte_version.h>
> #include <rte_devargs.h>
> #include <rte_memcpy.h>
> +#include <rte_service.h>
>
> #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.
> @@ -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
> +
> + /* 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.
> + rte_service_core_add(idx);
> + count++;
> + }
> + }
> + }
> +
> + for (; i >= 0; i--)
> + if (coremask[i] != '0')
> + return -1;
> +
> + for (; idx < RTE_MAX_LCORE; idx++)
> + lcore_config[idx].core_index = -1;
> +
> + if (count == 0)
> + return -1;
> +
> + cfg->score_count = count;
> + return 0;
> +}
> +
> +static int
> eal_parse_coremask(const char *coremask)
> {
> struct rte_config *cfg = rte_eal_get_configuration();
> @@ -826,6 +897,13 @@ eal_parse_common_option(int opt, const char *optarg,
> }
> core_parsed = 1;
> break;
> + /* service coremask */
> + case 's':
> + if (eal_parse_service_coremask(optarg) < 0) {
> + RTE_LOG(ERR, EAL, "invalid service coremask\n");
> + return -1;
> + }
> + break;
> /* size of memory */
> case 'm':
> conf->memory = atoi(optarg);
> --
With above change:
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
next prev parent reply other threads:[~2017-06-26 12:50 UTC|newest]
Thread overview: 82+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-23 9:06 [dpdk-dev] [PATCH 1/6] service cores: header and implementation Harry van Haaren
2017-06-23 9:06 ` [dpdk-dev] [PATCH 2/6] service cores: coremask parsing Harry van Haaren
2017-06-26 12:49 ` Jerin Jacob [this message]
2017-06-29 11:13 ` Van Haaren, Harry
2017-06-23 9:06 ` [dpdk-dev] [PATCH 3/6] service cores: EAL init changes Harry van Haaren
2017-06-26 12:55 ` Jerin Jacob
2017-06-29 11:13 ` Van Haaren, Harry
2017-06-23 9:06 ` [dpdk-dev] [PATCH 4/6] service cores: mark cores in lcore config as RTE Harry van Haaren
2017-06-23 9:06 ` [dpdk-dev] [PATCH 5/6] service core: add unit tests Harry van Haaren
2017-06-26 13:06 ` Jerin Jacob
2017-06-29 11:14 ` Van Haaren, Harry
2017-06-23 9:06 ` [dpdk-dev] [PATCH 6/6] service cores: enable event/sw with service Harry van Haaren
2017-06-26 13:46 ` Jerin Jacob
2017-06-29 11:15 ` Van Haaren, Harry
2017-06-26 11:59 ` [dpdk-dev] [PATCH 1/6] service cores: header and implementation Jerin Jacob
2017-06-29 11:13 ` Van Haaren, Harry
2017-06-29 11:23 ` [dpdk-dev] [PATCH v2 0/5] service cores: cover letter Harry van Haaren
2017-06-29 11:23 ` [dpdk-dev] [PATCH v2 1/5] service cores: header and implementation Harry van Haaren
2017-06-29 11:23 ` [dpdk-dev] [PATCH v2 2/5] service cores: EAL init changes Harry van Haaren
2017-06-29 11:23 ` [dpdk-dev] [PATCH v2 3/5] service cores: coremask parsing Harry van Haaren
2017-06-29 11:23 ` [dpdk-dev] [PATCH v2 4/5] service cores: add unit tests Harry van Haaren
2017-06-29 11:23 ` [dpdk-dev] [PATCH v2 5/5] service cores: enable event/sw with service Harry van Haaren
2017-07-02 21:35 ` [dpdk-dev] [PATCH v3 0/7] service cores: cover letter Harry van Haaren
2017-07-02 21:35 ` [dpdk-dev] [PATCH v3 1/7] service cores: header and implementation Harry van Haaren
2017-07-04 17:16 ` Jerin Jacob
2017-07-02 21:35 ` [dpdk-dev] [PATCH v3 2/7] service cores: EAL init changes Harry van Haaren
2017-07-04 11:35 ` Jerin Jacob
2017-07-07 16:28 ` Van Haaren, Harry
2017-07-02 21:35 ` [dpdk-dev] [PATCH v3 3/7] service cores: coremask parsing Harry van Haaren
2017-07-04 12:45 ` Jerin Jacob
2017-07-06 14:47 ` Van Haaren, Harry
2017-07-07 10:45 ` Jerin Jacob
2017-07-07 10:57 ` Van Haaren, Harry
2017-07-02 21:35 ` [dpdk-dev] [PATCH v3 4/7] service cores: add unit tests Harry van Haaren
2017-07-04 11:14 ` Jerin Jacob
2017-07-02 21:35 ` [dpdk-dev] [PATCH v3 5/7] service cores: enable event/sw with service Harry van Haaren
2017-07-04 10:52 ` Jerin Jacob
2017-07-07 16:28 ` Van Haaren, Harry
2017-07-02 21:35 ` [dpdk-dev] [PATCH v3 6/7] maintainers: claim service cores Harry van Haaren
2017-07-04 10:53 ` Jerin Jacob
2017-07-02 21:35 ` [dpdk-dev] [PATCH v3 7/7] doc: add service cores to doc and release notes Harry van Haaren
2017-07-02 22:16 ` Mcnamara, John
2017-07-04 10:56 ` Jerin Jacob
2017-07-07 16:41 ` [dpdk-dev] [PATCH v4 0/7] service cores: cover letter Harry van Haaren
2017-07-07 16:41 ` [dpdk-dev] [PATCH v4 1/7] service cores: header and implementation Harry van Haaren
2017-07-11 8:29 ` Jerin Jacob
2017-07-11 9:54 ` Thomas Monjalon
2017-07-11 12:32 ` Van Haaren, Harry
2017-07-11 12:44 ` Jerin Jacob
2017-07-11 12:49 ` Van Haaren, Harry
2017-07-11 14:10 ` Van Haaren, Harry
2017-07-07 16:41 ` [dpdk-dev] [PATCH v4 2/7] service cores: EAL init changes Harry van Haaren
2017-07-11 7:42 ` Jerin Jacob
2017-07-11 14:11 ` Van Haaren, Harry
2017-07-07 16:41 ` [dpdk-dev] [PATCH v4 3/7] service cores: coremask parsing Harry van Haaren
2017-07-07 16:41 ` [dpdk-dev] [PATCH v4 4/7] service cores: add unit tests Harry van Haaren
2017-07-11 8:12 ` Jerin Jacob
2017-07-07 16:41 ` [dpdk-dev] [PATCH v4 5/7] event/sw: enable SW PMD with service capability Harry van Haaren
2017-07-07 16:41 ` [dpdk-dev] [PATCH v4 6/7] doc: add service cores to doc and release notes Harry van Haaren
2017-07-07 16:41 ` [dpdk-dev] [PATCH v4 7/7] maintainers: claim service cores Harry van Haaren
2017-07-11 7:53 ` Jerin Jacob
2017-07-09 22:08 ` [dpdk-dev] [PATCH v4 0/7] service cores: cover letter Thomas Monjalon
2017-07-10 8:18 ` Van Haaren, Harry
2017-07-10 11:41 ` Jerin Jacob
2017-07-11 14:19 ` [dpdk-dev] [PATCH v5 " Harry van Haaren
2017-07-11 14:19 ` [dpdk-dev] [PATCH v5 1/7] service cores: header and implementation Harry van Haaren
2017-07-12 16:35 ` Jerin Jacob
2017-07-11 14:19 ` [dpdk-dev] [PATCH v5 2/7] service cores: EAL init changes Harry van Haaren
2017-07-11 14:19 ` [dpdk-dev] [PATCH v5 3/7] service cores: coremask parsing Harry van Haaren
2017-07-11 14:19 ` [dpdk-dev] [PATCH v5 4/7] service cores: add unit tests Harry van Haaren
2017-07-11 14:19 ` [dpdk-dev] [PATCH v5 5/7] event/sw: enable SW PMD with service capability Harry van Haaren
2017-07-11 14:19 ` [dpdk-dev] [PATCH v5 6/7] doc: add service cores to doc and release notes Harry van Haaren
2017-07-11 14:19 ` [dpdk-dev] [PATCH v5 7/7] maintainers: claim service cores Harry van Haaren
2017-07-12 16:49 ` [dpdk-dev] [PATCH v5 0/7] service cores: cover letter Jerin Jacob
2017-07-16 19:25 ` Thomas Monjalon
2017-07-17 8:07 ` Van Haaren, Harry
2017-07-17 15:21 ` [dpdk-dev] [PATCH] service: add corelist to EAL arguments Harry van Haaren
2017-07-17 15:53 ` Ananyev, Konstantin
2017-07-17 15:58 ` Van Haaren, Harry
2017-07-17 16:10 ` Ananyev, Konstantin
2017-07-17 16:16 ` Van Haaren, Harry
2017-07-19 5:42 ` 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=20170626124950.GB5612@jerin \
--to=jerin.jacob@caviumnetworks.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=harry.van.haaren@intel.com \
--cc=keith.wiles@intel.com \
--cc=thomas@monjalon.net \
/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).