Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/131572/?format=api
http://patches.dpdk.org/api/patches/131572/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20230918130352.379478-4-bruce.richardson@intel.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": "<20230918130352.379478-4-bruce.richardson@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20230918130352.379478-4-bruce.richardson@intel.com", "date": "2023-09-18T13:03:50", "name": "[RFC,v2,3/5] examples/hotplug_mp: auto-generate cmdline boilerplate", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "fd9e0ffb5fc583126edb549990a4365bd1df1059", "submitter": { "id": 20, "url": "http://patches.dpdk.org/api/people/20/?format=api", "name": "Bruce Richardson", "email": "bruce.richardson@intel.com" }, "delegate": { "id": 1, "url": "http://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20230918130352.379478-4-bruce.richardson@intel.com/mbox/", "series": [ { "id": 29536, "url": "http://patches.dpdk.org/api/series/29536/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=29536", "date": "2023-09-18T13:03:47", "name": "use script to simplify use of cmdline lib", "version": 2, "mbox": "http://patches.dpdk.org/series/29536/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/131572/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/131572/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 8DA48425D1;\n\tMon, 18 Sep 2023 15:04:31 +0200 (CEST)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id DDD1E40A84;\n\tMon, 18 Sep 2023 15:04:08 +0200 (CEST)", "from mgamail.intel.com (mgamail.intel.com [134.134.136.20])\n by mails.dpdk.org (Postfix) with ESMTP id C27E8409FA\n for <dev@dpdk.org>; Mon, 18 Sep 2023 15:04:06 +0200 (CEST)", "from orsmga007.jf.intel.com ([10.7.209.58])\n by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 18 Sep 2023 06:04:06 -0700", "from silpixa00401385.ir.intel.com ([10.237.214.14])\n by orsmga007.jf.intel.com with ESMTP; 18 Sep 2023 06:04:04 -0700" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1695042247; x=1726578247;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=kXNOtVfgugGxE1ZJlf1z03ZiLUy8KLypWgjuRvJY/Jk=;\n b=ecV7uvKovIEHaBeCiTEEksQpKRBeMSVYdhz5Jpn/wAF4tcD6ObIFt66H\n 4e2GBAjKeBpRzkfWHws4Y1zM1X5jTlbWRFYHaEW5s6zlA6btPyLBZS6c+\n Mxv1o/vCjKsEL/TctuuQbw4EgyomN7rZ0/bJRO4I3PBSUukOtvcuAUVow\n YkH2lZWatdb+z9zqSJko2YcpbfkIJYOjhWk6+iZ0ICD3GnmdKX+FQdYYj\n APTv3ZWaSJ5OdamVodyaneNMjEedVndbkSnP/aqvtpDS3kXw+IpN4rFSl\n yBlSQS6nW0VBLjxHQgTfKuqlUV8C4kM8/OwuANjaApxwavQ/sbUXL7rGA A==;", "X-IronPort-AV": [ "E=McAfee;i=\"6600,9927,10837\"; a=\"369969394\"", "E=Sophos;i=\"6.02,156,1688454000\"; d=\"scan'208\";a=\"369969394\"", "E=McAfee;i=\"6600,9927,10837\"; a=\"739130639\"", "E=Sophos;i=\"6.02,156,1688454000\"; d=\"scan'208\";a=\"739130639\"" ], "X-ExtLoop1": "1", "From": "Bruce Richardson <bruce.richardson@intel.com>", "To": "dev@dpdk.org", "Cc": "Olivier Matz <olivier.matz@6wind.com>,\n Bruce Richardson <bruce.richardson@intel.com>", "Subject": "[RFC PATCH v2 3/5] examples/hotplug_mp: auto-generate cmdline\n boilerplate", "Date": "Mon, 18 Sep 2023 14:03:50 +0100", "Message-Id": "<20230918130352.379478-4-bruce.richardson@intel.com>", "X-Mailer": "git-send-email 2.39.2", "In-Reply-To": "<20230918130352.379478-1-bruce.richardson@intel.com>", "References": "<20230802170052.955323-1-bruce.richardson@intel.com>\n <20230918130352.379478-1-bruce.richardson@intel.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org" }, "content": "Use the dpdk-cmdline-gen script to autogenerate all the boilerplate\nstructs and defines for the commandline part of the app.\n\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\n---\n examples/multi_process/hotplug_mp/Makefile | 10 +-\n examples/multi_process/hotplug_mp/commands.c | 147 ++----------------\n examples/multi_process/hotplug_mp/commands.h | 10 --\n .../multi_process/hotplug_mp/commands.list | 5 +\n examples/multi_process/hotplug_mp/meson.build | 9 ++\n 5 files changed, 34 insertions(+), 147 deletions(-)\n delete mode 100644 examples/multi_process/hotplug_mp/commands.h\n create mode 100644 examples/multi_process/hotplug_mp/commands.list", "diff": "diff --git a/examples/multi_process/hotplug_mp/Makefile b/examples/multi_process/hotplug_mp/Makefile\nindex 6b20d6e49a..77e8fe2737 100644\n--- a/examples/multi_process/hotplug_mp/Makefile\n+++ b/examples/multi_process/hotplug_mp/Makefile\n@@ -6,6 +6,7 @@ APP = hotplug_mp\n \n # all source are stored in SRCS-y\n SRCS-y := main.c commands.c\n+SRC-DEPS := build/commands.h\n \n PKGCONF ?= pkg-config\n \n@@ -22,10 +23,13 @@ static: build/$(APP)-static\n \tln -sf $(APP)-static build/$(APP)\n \n PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null)\n-CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)\n+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) -I build/\n LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)\n LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)\n \n+build/commands.h: commands.list Makefile\n+\tdpdk-cmdline-gen.py -o $@ --context-name=main_ctx $<\n+\n ifeq ($(MAKECMDGOALS),static)\n # check for broken pkg-config\n ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)\n@@ -36,10 +40,10 @@ endif\n \n CFLAGS += -DALLOW_EXPERIMENTAL_API\n \n-build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build\n+build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(SRC-DEPS)\n \t$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)\n \n-build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build\n+build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build $(SRC-DEPS)\n \t$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC)\n \n build:\ndiff --git a/examples/multi_process/hotplug_mp/commands.c b/examples/multi_process/hotplug_mp/commands.c\nindex 88f44e00a0..900eb9f774 100644\n--- a/examples/multi_process/hotplug_mp/commands.c\n+++ b/examples/multi_process/hotplug_mp/commands.c\n@@ -1,24 +1,12 @@\n /* SPDX-License-Identifier: BSD-3-Clause\n- * Copyright(c) 2018 Intel Corporation.\n+ * Copyright(c) 2018-2023 Intel Corporation.\n */\n \n-#include <cmdline_rdline.h>\n-#include <cmdline_parse.h>\n-#include <cmdline_parse_ipaddr.h>\n-#include <cmdline_parse_num.h>\n-#include <cmdline_parse_string.h>\n-#include <cmdline.h>\n-\n #include <rte_bus.h>\n #include <rte_ethdev.h>\n+#include \"commands.h\"\n \n-/**********************************************************/\n-\n-struct cmd_help_result {\n-\tcmdline_fixed_string_t help;\n-};\n-\n-static void cmd_help_parsed(__rte_unused void *parsed_result,\n+void cmd_help_parsed(__rte_unused void *parsed_result,\n \t\t\t struct cmdline *cl,\n \t\t\t __rte_unused void *data)\n {\n@@ -29,52 +17,16 @@ static void cmd_help_parsed(__rte_unused void *parsed_result,\n \t\t \"- list\\n\\n\");\n }\n \n-cmdline_parse_token_string_t cmd_help_help =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_help_result, help, \"help\");\n-\n-cmdline_parse_inst_t cmd_help = {\n-\t.f = cmd_help_parsed, /* function to call */\n-\t.data = NULL, /* 2nd arg of func */\n-\t.help_str = \"show help\",\n-\t.tokens = { /* token list, NULL terminated */\n-\t\t(void *)&cmd_help_help,\n-\t\tNULL,\n-\t},\n-};\n-\n-/**********************************************************/\n-\n-struct cmd_quit_result {\n-\tcmdline_fixed_string_t quit;\n-};\n-\n-static void cmd_quit_parsed(__rte_unused void *parsed_result,\n+void\n+cmd_quit_parsed(__rte_unused void *parsed_result,\n \t\t\t struct cmdline *cl,\n \t\t\t __rte_unused void *data)\n {\n \tcmdline_quit(cl);\n }\n \n-cmdline_parse_token_string_t cmd_quit_quit =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_quit_result, quit, \"quit\");\n-\n-cmdline_parse_inst_t cmd_quit = {\n-\t.f = cmd_quit_parsed, /* function to call */\n-\t.data = NULL, /* 2nd arg of func */\n-\t.help_str = \"quit\",\n-\t.tokens = { /* token list, NULL terminated */\n-\t\t(void *)&cmd_quit_quit,\n-\t\tNULL,\n-\t},\n-};\n-\n-/**********************************************************/\n-\n-struct cmd_list_result {\n-\tcmdline_fixed_string_t list;\n-};\n-\n-static void cmd_list_parsed(__rte_unused void *parsed_result,\n+void\n+cmd_list_parsed(__rte_unused void *parsed_result,\n \t\t\t struct cmdline *cl,\n \t\t\t __rte_unused void *data)\n {\n@@ -92,31 +44,12 @@ static void cmd_list_parsed(__rte_unused void *parsed_result,\n \t}\n }\n \n-cmdline_parse_token_string_t cmd_list_list =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_list_result, list, \"list\");\n-\n-cmdline_parse_inst_t cmd_list = {\n-\t.f = cmd_list_parsed, /* function to call */\n-\t.data = NULL, /* 2nd arg of func */\n-\t.help_str = \"list all devices\",\n-\t.tokens = { /* token list, NULL terminated */\n-\t\t(void *)&cmd_list_list,\n-\t\tNULL,\n-\t},\n-};\n-\n-/**********************************************************/\n-\n-struct cmd_dev_attach_result {\n-\tcmdline_fixed_string_t attach;\n-\tcmdline_fixed_string_t devargs;\n-};\n-\n-static void cmd_dev_attach_parsed(void *parsed_result,\n+void\n+cmd_attach_parsed(void *parsed_result,\n \t\t\t\t struct cmdline *cl,\n \t\t\t\t __rte_unused void *data)\n {\n-\tstruct cmd_dev_attach_result *res = parsed_result;\n+\tstruct cmd_attach_result *res = parsed_result;\n \tstruct rte_devargs da;\n \n \tmemset(&da, 0, sizeof(da));\n@@ -134,35 +67,12 @@ static void cmd_dev_attach_parsed(void *parsed_result,\n \trte_devargs_reset(&da);\n }\n \n-cmdline_parse_token_string_t cmd_dev_attach_attach =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_dev_attach_result, attach,\n-\t\t\t\t \"attach\");\n-cmdline_parse_token_string_t cmd_dev_attach_devargs =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_dev_attach_result, devargs, NULL);\n-\n-cmdline_parse_inst_t cmd_attach_device = {\n-\t.f = cmd_dev_attach_parsed, /* function to call */\n-\t.data = NULL, /* 2nd arg of func */\n-\t.help_str = \"attach a device\",\n-\t.tokens = { /* token list, NULL terminated */\n-\t\t(void *)&cmd_dev_attach_attach,\n-\t\t(void *)&cmd_dev_attach_devargs,\n-\t\tNULL,\n-\t},\n-};\n-\n-/**********************************************************/\n-\n-struct cmd_dev_detach_result {\n-\tcmdline_fixed_string_t detach;\n-\tcmdline_fixed_string_t devargs;\n-};\n-\n-static void cmd_dev_detach_parsed(void *parsed_result,\n+void\n+cmd_detach_parsed(void *parsed_result,\n \t\t\t\t struct cmdline *cl,\n \t\t\t\t __rte_unused void *data)\n {\n-\tstruct cmd_dev_detach_result *res = parsed_result;\n+\tstruct cmd_detach_result *res = parsed_result;\n \tstruct rte_devargs da;\n \n \tmemset(&da, 0, sizeof(da));\n@@ -181,34 +91,3 @@ static void cmd_dev_detach_parsed(void *parsed_result,\n \t\t\tda.name);\n \trte_devargs_reset(&da);\n }\n-\n-cmdline_parse_token_string_t cmd_dev_detach_detach =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_dev_detach_result, detach,\n-\t\t\t\t \"detach\");\n-\n-cmdline_parse_token_string_t cmd_dev_detach_devargs =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_dev_detach_result, devargs, NULL);\n-\n-cmdline_parse_inst_t cmd_detach_device = {\n-\t.f = cmd_dev_detach_parsed, /* function to call */\n-\t.data = NULL, /* 2nd arg of func */\n-\t.help_str = \"detach a device\",\n-\t.tokens = { /* token list, NULL terminated */\n-\t\t(void *)&cmd_dev_detach_detach,\n-\t\t(void *)&cmd_dev_detach_devargs,\n-\t\tNULL,\n-\t},\n-};\n-\n-/**********************************************************/\n-/**********************************************************/\n-/****** CONTEXT (list of instruction) */\n-\n-cmdline_parse_ctx_t main_ctx[] = {\n-\t(cmdline_parse_inst_t *)&cmd_help,\n-\t(cmdline_parse_inst_t *)&cmd_quit,\n-\t(cmdline_parse_inst_t *)&cmd_list,\n-\t(cmdline_parse_inst_t *)&cmd_attach_device,\n-\t(cmdline_parse_inst_t *)&cmd_detach_device,\n-\tNULL,\n-};\ndiff --git a/examples/multi_process/hotplug_mp/commands.h b/examples/multi_process/hotplug_mp/commands.h\ndeleted file mode 100644\nindex afcf177dba..0000000000\n--- a/examples/multi_process/hotplug_mp/commands.h\n+++ /dev/null\n@@ -1,10 +0,0 @@\n-/* SPDX-License-Identifier: BSD-3-Clause\n- * Copyright(c) 2018 Intel Corporation\n- */\n-\n-#ifndef _COMMANDS_H_\n-#define _COMMANDS_H_\n-\n-extern cmdline_parse_ctx_t main_ctx[];\n-\n-#endif /* _COMMANDS_H_ */\ndiff --git a/examples/multi_process/hotplug_mp/commands.list b/examples/multi_process/hotplug_mp/commands.list\nnew file mode 100644\nindex 0000000000..683e53cb0e\n--- /dev/null\n+++ b/examples/multi_process/hotplug_mp/commands.list\n@@ -0,0 +1,5 @@\n+help\n+quit\n+list\n+attach <STRING>devargs\n+detach <STRING>devargs\n\\ No newline at end of file\ndiff --git a/examples/multi_process/hotplug_mp/meson.build b/examples/multi_process/hotplug_mp/meson.build\nindex a1ad98ca2e..7a0e9ca47a 100644\n--- a/examples/multi_process/hotplug_mp/meson.build\n+++ b/examples/multi_process/hotplug_mp/meson.build\n@@ -7,7 +7,16 @@\n # DPDK instance, use 'make'\n \n allow_experimental_apis = true\n+\n+cmd_h = custom_target('commands_hdr',\n+\toutput: 'commands.h',\n+\tinput: files('commands.list'),\n+\tcapture: true,\n+\tcommand: [cmdline_gen_cmd, '--context-name=main_ctx', '@INPUT@']\n+)\n+\n sources = files(\n 'commands.c',\n 'main.c',\n )\n+sources += cmd_h\n", "prefixes": [ "RFC", "v2", "3/5" ] }{ "id": 131572, "url": "