Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/290/?format=api
http://patches.dpdk.org/api/patches/290/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1409567080-27083-18-git-send-email-david.marchand@6wind.com/", "project": { "id": 1, "url": "http://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<1409567080-27083-18-git-send-email-david.marchand@6wind.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1409567080-27083-18-git-send-email-david.marchand@6wind.com", "date": "2014-09-01T10:24:40", "name": "[dpdk-dev,v2,17/17] eal: set log level from command line", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "39eb3de8e47590b79e6594ff774f5f4876ce5393", "submitter": { "id": 3, "url": "http://patches.dpdk.org/api/people/3/?format=api", "name": "David Marchand", "email": "david.marchand@6wind.com" }, "delegate": null, "mbox": "http://patches.dpdk.org/project/dpdk/patch/1409567080-27083-18-git-send-email-david.marchand@6wind.com/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/290/comments/", "check": "pending", "checks": "http://patches.dpdk.org/api/patches/290/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<david.marchand@6wind.com>", "Received": [ "from mail-wi0-f182.google.com (mail-wi0-f182.google.com\n\t[209.85.212.182]) by dpdk.org (Postfix) with ESMTP id 1A5F9B3F1\n\tfor <dev@dpdk.org>; Mon, 1 Sep 2014 12:20:51 +0200 (CEST)", "by mail-wi0-f182.google.com with SMTP id z2so5812487wiv.15\n\tfor <dev@dpdk.org>; Mon, 01 Sep 2014 03:25:18 -0700 (PDT)", "from alcyon.dev.6wind.com (guy78-3-82-239-227-177.fbx.proxad.net.\n\t[82.239.227.177]) by mx.google.com with ESMTPSA id\n\tlm18sm24287018wic.22.2014.09.01.03.25.16 for <dev@dpdk.org>\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 01 Sep 2014 03:25:17 -0700 (PDT)" ], "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:from:to:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=LPe7EIm4pAhwgT2Gt8oItMB05d8MN68ObjVjyaoC+SE=;\n\tb=FJd/9ccIQAqIdgXeptYevbMwz7iP4dbRKSSI/0Z1cPxxTe/FPjqBlqqLni7N5jfr8u\n\t8Ld/nAjKNqhY0ZHW6TcVGQVIkXBKf4R4xtS6Ia0HK1P20ZWFi2af9aE/DxS8LXxmzaoE\n\tpd+2OMULFRA/OWNmxKIjdUbwD2RgLNXQAT6BZ09p4hUdknn1nyub6eaLBUISshraCVjk\n\td5ZaRFGdDbzoxWjsRSyGxSothllf5rDAHZtmDz5p73sxv5WW0XCHkEeSS4y5ddt/DB4r\n\teA0iPmueE92BvHED4LSdL1+DIYvra15vFoqzNvUohJNJRlL6sBsKjnkPkTwaie78KFvy\n\tnTHQ==", "X-Gm-Message-State": "ALoCoQnkCnGA9ZjBxcQBJLIQCvKxEkPX938W2erBq6cEqzCzvCiuKsxuCHcMcpegzfngAq2PV5cR", "X-Received": "by 10.194.87.102 with SMTP id w6mr30723024wjz.24.1409567117989; \n\tMon, 01 Sep 2014 03:25:17 -0700 (PDT)", "From": "David Marchand <david.marchand@6wind.com>", "To": "dev@dpdk.org", "Date": "Mon, 1 Sep 2014 12:24:40 +0200", "Message-Id": "<1409567080-27083-18-git-send-email-david.marchand@6wind.com>", "X-Mailer": "git-send-email 1.7.10.4", "In-Reply-To": "<1409567080-27083-1-git-send-email-david.marchand@6wind.com>", "References": "<1409567080-27083-1-git-send-email-david.marchand@6wind.com>", "Subject": "[dpdk-dev] [PATCH v2 17/17] eal: set log level from command line", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "patches and discussions about DPDK <dev.dpdk.org>", "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "X-List-Received-Date": "Mon, 01 Sep 2014 10:20:51 -0000" }, "content": "Add a --log-level option to set the default eal log level.\n\nSigned-off-by: David Marchand <david.marchand@6wind.com>\n---\n lib/librte_eal/bsdapp/eal/eal.c | 42 +++++++++++++++++++\n .../bsdapp/eal/include/eal_internal_cfg.h | 1 +\n lib/librte_eal/linuxapp/eal/eal.c | 44 +++++++++++++++++++-\n .../linuxapp/eal/include/eal_internal_cfg.h | 1 +\n 4 files changed, 87 insertions(+), 1 deletion(-)", "diff": "diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c\nindex 71f93e0..2f84742 100644\n--- a/lib/librte_eal/bsdapp/eal/eal.c\n+++ b/lib/librte_eal/bsdapp/eal/eal.c\n@@ -94,6 +94,7 @@\n #define OPT_PCI_BLACKLIST \"pci-blacklist\"\n #define OPT_VDEV \"vdev\"\n #define OPT_SYSLOG \"syslog\"\n+#define OPT_LOG_LEVEL \"log-level\"\n \n #define MEMSIZE_IF_NO_HUGE_PAGE (64ULL * 1024ULL * 1024ULL)\n \n@@ -293,6 +294,7 @@ eal_usage(const char *prgname)\n \t \" -v : Display version information on startup\\n\"\n \t \" -m MB : memory to allocate\\n\"\n \t \" -r NUM : force number of memory ranks (don't detect)\\n\"\n+\t \" --\"OPT_LOG_LEVEL\" : set default log level\\n\"\n \t \" --\"OPT_PROC_TYPE\" : type of this process\\n\"\n \t \" --\"OPT_PCI_BLACKLIST\", -b: add a PCI device in black list.\\n\"\n \t \" Prevent EAL from using this PCI device. The argument\\n\"\n@@ -440,6 +442,28 @@ eal_parse_syslog(const char *facility)\n \treturn -1;\n }\n \n+static int\n+eal_parse_log_level(const char *level, uint32_t *log_level)\n+{\n+\tchar *end;\n+\tunsigned long tmp;\n+\n+\terrno = 0;\n+\ttmp = strtoul(level, &end, 0);\n+\n+\t/* check for errors */\n+\tif ((errno != 0) || (level[0] == '\\0') ||\n+\t end == NULL || (*end != '\\0'))\n+\t\treturn -1;\n+\n+\t/* log_level is a uint32_t */\n+\tif (tmp >= UINT32_MAX)\n+\t\treturn -1;\n+\n+\t*log_level = tmp;\n+\treturn 0;\n+}\n+\n static inline size_t\n eal_get_hugepage_mem_size(void)\n {\n@@ -494,6 +518,7 @@ eal_parse_args(int argc, char **argv)\n \t\t{OPT_PCI_BLACKLIST, 1, 0, 0},\n \t\t{OPT_VDEV, 1, 0, 0},\n \t\t{OPT_SYSLOG, 1, NULL, 0},\n+\t\t{OPT_LOG_LEVEL, 1, NULL, 0},\n \t\t{0, 0, 0, 0}\n \t};\n \n@@ -506,6 +531,8 @@ eal_parse_args(int argc, char **argv)\n \tinternal_config.hugepage_dir = NULL;\n \tinternal_config.force_sockets = 0;\n \tinternal_config.syslog_facility = LOG_DAEMON;\n+\t/* default value from build option */\n+\tinternal_config.log_level = RTE_LOG_LEVEL;\n #ifdef RTE_LIBEAL_USE_HPET\n \tinternal_config.no_hpet = 0;\n #else\n@@ -652,6 +679,18 @@ eal_parse_args(int argc, char **argv)\n \t\t\t\t\teal_usage(prgname);\n \t\t\t\t\treturn -1;\n \t\t\t\t}\n+\t\t\t} else if (!strcmp(lgopts[option_index].name,\n+\t\t\t\t\t OPT_LOG_LEVEL)) {\n+\t\t\t\tuint32_t log;\n+\n+\t\t\t\tif (eal_parse_log_level(optarg, &log) < 0) {\n+\t\t\t\t\tRTE_LOG(ERR, EAL,\n+\t\t\t\t\t\t\"invalid parameters for --\"\n+\t\t\t\t\t\tOPT_LOG_LEVEL \"\\n\");\n+\t\t\t\t\teal_usage(prgname);\n+\t\t\t\t\treturn -1;\n+\t\t\t\t}\n+\t\t\t\tinternal_config.log_level = log;\n \t\t\t}\n \t\t\tbreak;\n \n@@ -793,6 +832,9 @@ rte_eal_init(int argc, char **argv)\n \tif (fctret < 0)\n \t\texit(1);\n \n+\t/* set log level as early as possible */\n+\trte_set_log_level(internal_config.log_level);\n+\n \tif (internal_config.no_hugetlbfs == 0 &&\n \t\t\tinternal_config.process_type != RTE_PROC_SECONDARY &&\n \t\t\teal_hugepage_info_init() < 0)\ndiff --git a/lib/librte_eal/bsdapp/eal/include/eal_internal_cfg.h b/lib/librte_eal/bsdapp/eal/include/eal_internal_cfg.h\nindex 2d06c7f..24cefc2 100644\n--- a/lib/librte_eal/bsdapp/eal/include/eal_internal_cfg.h\n+++ b/lib/librte_eal/bsdapp/eal/include/eal_internal_cfg.h\n@@ -75,6 +75,7 @@ struct internal_config {\n \tvolatile uint64_t socket_mem[RTE_MAX_NUMA_NODES]; /**< amount of memory per socket */\n \tuintptr_t base_virtaddr; /**< base address to try and reserve memory from */\n \tvolatile int syslog_facility;\t /**< facility passed to openlog() */\n+\tvolatile uint32_t log_level;\t /**< default log level */\n \tconst char *hugefile_prefix; /**< the base filename of hugetlbfs files */\n \tconst char *hugepage_dir; /**< specific hugetlbfs directory to use */\n \ndiff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c\nindex 4869e7c..38cace6 100644\n--- a/lib/librte_eal/linuxapp/eal/eal.c\n+++ b/lib/librte_eal/linuxapp/eal/eal.c\n@@ -97,6 +97,7 @@\n #define OPT_PCI_BLACKLIST \"pci-blacklist\"\n #define OPT_VDEV \"vdev\"\n #define OPT_SYSLOG \"syslog\"\n+#define OPT_LOG_LEVEL \"log-level\"\n #define OPT_BASE_VIRTADDR \"base-virtaddr\"\n #define OPT_XEN_DOM0 \"xen-dom0\"\n #define OPT_CREATE_UIO_DEV \"create-uio-dev\"\n@@ -384,7 +385,8 @@ eal_usage(const char *prgname)\n \t \" --\"OPT_XEN_DOM0\" : support application running on Xen Domain0 \"\n \t\t\t \"without hugetlbfs\\n\"\n \t \" --\"OPT_SYSLOG\" : set syslog facility\\n\"\n-\t \" --\"OPT_SOCKET_MEM\" : memory to allocate on specific \\n\"\n+\t \" --\"OPT_LOG_LEVEL\" : set default log level\\n\"\n+\t \" --\"OPT_SOCKET_MEM\" : memory to allocate on specific\\n\"\n \t\t \" sockets (use comma separated values)\\n\"\n \t \" --\"OPT_HUGE_DIR\" : directory where hugetlbfs is mounted\\n\"\n \t \" --\"OPT_PROC_TYPE\" : type of this process\\n\"\n@@ -548,6 +550,28 @@ eal_parse_syslog(const char *facility)\n }\n \n static int\n+eal_parse_log_level(const char *level, uint32_t *log_level)\n+{\n+\tchar *end;\n+\tunsigned long tmp;\n+\n+\terrno = 0;\n+\ttmp = strtoul(level, &end, 0);\n+\n+\t/* check for errors */\n+\tif ((errno != 0) || (level[0] == '\\0') ||\n+\t end == NULL || (*end != '\\0'))\n+\t\treturn -1;\n+\n+\t/* log_level is a uint32_t */\n+\tif (tmp >= UINT32_MAX)\n+\t\treturn -1;\n+\n+\t*log_level = tmp;\n+\treturn 0;\n+}\n+\n+static int\n eal_parse_socket_mem(char *socket_mem)\n {\n \tchar * arg[RTE_MAX_NUMA_NODES];\n@@ -699,6 +723,7 @@ eal_parse_args(int argc, char **argv)\n \t\t{OPT_PCI_BLACKLIST, 1, 0, 0},\n \t\t{OPT_VDEV, 1, 0, 0},\n \t\t{OPT_SYSLOG, 1, NULL, 0},\n+\t\t{OPT_LOG_LEVEL, 1, NULL, 0},\n \t\t{OPT_VFIO_INTR, 1, NULL, 0},\n \t\t{OPT_BASE_VIRTADDR, 1, 0, 0},\n \t\t{OPT_XEN_DOM0, 0, 0, 0},\n@@ -716,6 +741,8 @@ eal_parse_args(int argc, char **argv)\n \tinternal_config.hugepage_dir = NULL;\n \tinternal_config.force_sockets = 0;\n \tinternal_config.syslog_facility = LOG_DAEMON;\n+\t/* default value from build option */\n+\tinternal_config.log_level = RTE_LOG_LEVEL;\n \tinternal_config.xen_dom0_support = 0;\n \t/* if set to NONE, interrupt mode is determined automatically */\n \tinternal_config.vfio_intr_mode = RTE_INTR_MODE_NONE;\n@@ -887,6 +914,18 @@ eal_parse_args(int argc, char **argv)\n \t\t\t\t\teal_usage(prgname);\n \t\t\t\t\treturn -1;\n \t\t\t\t}\n+\t\t\t} else if (!strcmp(lgopts[option_index].name,\n+\t\t\t\t\t OPT_LOG_LEVEL)) {\n+\t\t\t\tuint32_t log;\n+\n+\t\t\t\tif (eal_parse_log_level(optarg, &log) < 0) {\n+\t\t\t\t\tRTE_LOG(ERR, EAL,\n+\t\t\t\t\t\t\"invalid parameters for --\"\n+\t\t\t\t\t\tOPT_LOG_LEVEL \"\\n\");\n+\t\t\t\t\teal_usage(prgname);\n+\t\t\t\t\treturn -1;\n+\t\t\t\t}\n+\t\t\t\tinternal_config.log_level = log;\n \t\t\t}\n \t\t\telse if (!strcmp(lgopts[option_index].name, OPT_BASE_VIRTADDR)) {\n \t\t\t\tif (eal_parse_base_virtaddr(optarg) < 0) {\n@@ -1054,6 +1093,9 @@ rte_eal_init(int argc, char **argv)\n \tif (fctret < 0)\n \t\texit(1);\n \n+\t/* set log level as early as possible */\n+\trte_set_log_level(internal_config.log_level);\n+\n \tif (internal_config.no_hugetlbfs == 0 &&\n \t\t\tinternal_config.process_type != RTE_PROC_SECONDARY &&\n \t\t\tinternal_config.xen_dom0_support == 0 &&\ndiff --git a/lib/librte_eal/linuxapp/eal/include/eal_internal_cfg.h b/lib/librte_eal/linuxapp/eal/include/eal_internal_cfg.h\nindex 498ade2..8749390 100644\n--- a/lib/librte_eal/linuxapp/eal/include/eal_internal_cfg.h\n+++ b/lib/librte_eal/linuxapp/eal/include/eal_internal_cfg.h\n@@ -77,6 +77,7 @@ struct internal_config {\n \tvolatile uint64_t socket_mem[RTE_MAX_NUMA_NODES]; /**< amount of memory per socket */\n \tuintptr_t base_virtaddr; /**< base address to try and reserve memory from */\n \tvolatile int syslog_facility;\t /**< facility passed to openlog() */\n+\tvolatile uint32_t log_level;\t /**< default log level */\n \t/** default interrupt mode for VFIO */\n \tvolatile enum rte_intr_mode vfio_intr_mode;\n \tconst char *hugefile_prefix; /**< the base filename of hugetlbfs files */\n", "prefixes": [ "dpdk-dev", "v2", "17/17" ] }{ "id": 290, "url": "