From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) by dpdk.org (Postfix) with ESMTP id 15D978D96 for ; Fri, 25 Sep 2015 22:37:29 +0200 (CEST) Received: by pacex6 with SMTP id ex6so115086669pac.0 for ; Fri, 25 Sep 2015 13:37:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=a6Cou1owO6K5PXhjUjomg1omEg2qX7NaQXcvD6aYPB8=; b=csoXwEsEniD0FKAEnN33VKb9S0ubvNHn60O+RpswlZH1ZEwasbgR/2UiQsNg+NiNU7 ySCCVI3lt2xVQnxrvLlPhM3r0QKBLtTOyvJU/UINLkmIRLf1B6hPGeXvkGIIkwUACTM4 S1O0i0JyzqHIieON1p15LV2rPSWbADXbwYqjz6J3O3h0/wWp1QnmbpvPfbPZfmF12iTX F31pGKYaENW8Gsc9qH+FAMwfnxOSOKxItZRMrdpmBmSSIO9lHqupfCDFjZmCHTx1YOC9 u21qgZHRtpXtccSXSUP+UpLF/15wHfYEiZG1VRgNyRaQMRpfzZEIXs162dM4ORicGc/P 31Iw== X-Gm-Message-State: ALoCoQnMlBQRkSR24lFV6zvNIjB8lZaHAW0+DI+k8Wg9oOHfQLJWXl0Wf4+O9+r5wOnVAnbb1r3W X-Received: by 10.66.228.97 with SMTP id sh1mr9727882pac.91.1443213448160; Fri, 25 Sep 2015 13:37:28 -0700 (PDT) Received: from rlane-work.eng.bigswitch.com ([173.227.38.50]) by smtp.gmail.com with ESMTPSA id of1sm5472159pbc.11.2015.09.25.13.37.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 25 Sep 2015 13:37:27 -0700 (PDT) From: Rich Lane X-Google-Original-From: Rich Lane To: dev@dpdk.org Date: Fri, 25 Sep 2015 13:37:16 -0700 Message-Id: <1443213436-113824-1-git-send-email-rlane@bigswitch.com> X-Mailer: git-send-email 1.9.1 Subject: [dpdk-dev] [PATCH] default to using all cores if no -c, -l, or --lcores options given X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Sep 2015 20:37:29 -0000 This is a useful default for simple applications where the assignment of lcores to CPUs doesn't matter. It's also useful for more complex applications that automatically assign tasks to cores based on the NUMA topology. Signed-off-by: Rich Lane --- app/test/test_eal_flags.c | 9 +++++++-- doc/guides/freebsd_gsg/build_sample_apps.rst | 2 +- doc/guides/linux_gsg/build_sample_apps.rst | 2 +- lib/librte_eal/common/eal_common_lcore.c | 3 +++ lib/librte_eal/common/eal_common_options.c | 11 +---------- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c index e6f7035..e0aee2d 100644 --- a/app/test/test_eal_flags.c +++ b/app/test/test_eal_flags.c @@ -571,11 +571,16 @@ test_missing_c_flag(void) "-n", "3", "--lcores", "0-1,2@(5-7),(3-5)@(0,2),(0,6),7"}; + if (launch_proc(argv2) != 0) { + printf("Error - " + "process did not run ok when missing -c flag\n"); + return -1; + } + if (launch_proc(argv1) == 0 - || launch_proc(argv2) == 0 || launch_proc(argv3) == 0) { printf("Error - " - "process ran without error when missing -c flag\n"); + "process ran without error with invalid -c flag\n"); return -1; } if (launch_proc(argv4) != 0) { diff --git a/doc/guides/freebsd_gsg/build_sample_apps.rst b/doc/guides/freebsd_gsg/build_sample_apps.rst index acd0311..a89055f 100644 --- a/doc/guides/freebsd_gsg/build_sample_apps.rst +++ b/doc/guides/freebsd_gsg/build_sample_apps.rst @@ -114,7 +114,7 @@ The following is the list of options that can be given to the EAL: .. code-block:: console - ./rte-app -c COREMASK -n NUM [-b ] [-r NUM] [-v] [--proc-type ] + ./rte-app -n NUM [-c COREMASK] [-b ] [-r NUM] [-v] [--proc-type ] .. note:: diff --git a/doc/guides/linux_gsg/build_sample_apps.rst b/doc/guides/linux_gsg/build_sample_apps.rst index e0de2f5..07d84df 100644 --- a/doc/guides/linux_gsg/build_sample_apps.rst +++ b/doc/guides/linux_gsg/build_sample_apps.rst @@ -109,7 +109,7 @@ The following is the list of options that can be given to the EAL: .. code-block:: console - ./rte-app -c COREMASK -n NUM [-b ] [--socket-mem=MB,...] [-m MB] [-r NUM] [-v] [--file-prefix] [--proc-type ] [-- xen-dom0] + ./rte-app -n NUM [-c COREMASK] [-b ] [--socket-mem=MB,...] [-m MB] [-r NUM] [-v] [--file-prefix] [--proc-type ] [-- xen-dom0] The EAL options are as follows: diff --git a/lib/librte_eal/common/eal_common_lcore.c b/lib/librte_eal/common/eal_common_lcore.c index 845140b..a4263ba 100644 --- a/lib/librte_eal/common/eal_common_lcore.c +++ b/lib/librte_eal/common/eal_common_lcore.c @@ -63,6 +63,8 @@ rte_eal_cpu_init(void) * ones and enable them by default. */ for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) { + lcore_config[lcore_id].core_index = count; + /* init cpuset for per lcore config */ CPU_ZERO(&lcore_config[lcore_id].cpuset); @@ -70,6 +72,7 @@ rte_eal_cpu_init(void) lcore_config[lcore_id].detected = eal_cpu_detected(lcore_id); if (lcore_config[lcore_id].detected == 0) { config->lcore_role[lcore_id] = ROLE_OFF; + lcore_config[lcore_id].core_index = -1; continue; } diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c index 1f459ac..2e40857 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -93,7 +93,6 @@ eal_long_options[] = { {0, 0, NULL, 0 } }; -static int lcores_parsed; static int master_lcore_parsed; static int mem_parsed; @@ -212,7 +211,6 @@ eal_parse_coremask(const char *coremask) return -1; /* Update the count of enabled logical cores of the EAL configuration */ cfg->lcore_count = count; - lcores_parsed = 1; return 0; } @@ -279,7 +277,6 @@ eal_parse_corelist(const char *corelist) /* Update the count of enabled logical cores of the EAL configuration */ cfg->lcore_count = count; - lcores_parsed = 1; return 0; } @@ -569,7 +566,6 @@ eal_parse_lcores(const char *lcores) goto err; cfg->lcore_count = count; - lcores_parsed = 1; ret = 0; err: @@ -820,11 +816,6 @@ eal_check_common_options(struct internal_config *internal_cfg) { struct rte_config *cfg = rte_eal_get_configuration(); - if (!lcores_parsed) { - RTE_LOG(ERR, EAL, "CPU cores must be enabled with options " - "-c, -l or --lcores\n"); - return -1; - } if (cfg->lcore_role[cfg->master_lcore] != ROLE_RTE) { RTE_LOG(ERR, EAL, "Master lcore is not enabled for DPDK\n"); return -1; @@ -869,7 +860,7 @@ eal_check_common_options(struct internal_config *internal_cfg) void eal_common_usage(void) { - printf("-c COREMASK|-l CORELIST -n CHANNELS [options]\n\n" + printf("-n CHANNELS [options]\n\n" "EAL common options:\n" " -c COREMASK Hexadecimal bitmask of cores to run on\n" " -l CORELIST List of cores to run on\n" -- 1.9.1