Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/132556/?format=api
http://patchwork.dpdk.org/api/patches/132556/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20231011133357.111058-4-bruce.richardson@intel.com/", "project": { "id": 1, "url": "http://patchwork.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": "<20231011133357.111058-4-bruce.richardson@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20231011133357.111058-4-bruce.richardson@intel.com", "date": "2023-10-11T13:33:55", "name": "[v3,3/5] examples/simple_mp: auto-generate cmdline boilerplate", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "7eda188e1184f2bb7ed019fb09b525206720c880", "submitter": { "id": 20, "url": "http://patchwork.dpdk.org/api/people/20/?format=api", "name": "Bruce Richardson", "email": "bruce.richardson@intel.com" }, "delegate": { "id": 1, "url": "http://patchwork.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20231011133357.111058-4-bruce.richardson@intel.com/mbox/", "series": [ { "id": 29820, "url": "http://patchwork.dpdk.org/api/series/29820/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=29820", "date": "2023-10-11T13:33:52", "name": "document and simplify use of cmdline", "version": 3, "mbox": "http://patchwork.dpdk.org/series/29820/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/132556/comments/", "check": "warning", "checks": "http://patchwork.dpdk.org/api/patches/132556/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 DBE7C42361;\n\tWed, 11 Oct 2023 15:34:33 +0200 (CEST)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 2E19440A8A;\n\tWed, 11 Oct 2023 15:34:15 +0200 (CEST)", "from mgamail.intel.com (mgamail.intel.com [192.55.52.136])\n by mails.dpdk.org (Postfix) with ESMTP id A9EAB406B4\n for <dev@dpdk.org>; Wed, 11 Oct 2023 15:34:13 +0200 (CEST)", "from fmsmga006.fm.intel.com ([10.253.24.20])\n by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 11 Oct 2023 06:34:13 -0700", "from unknown (HELO silpixa00401385.ir.intel.com) ([10.237.214.46])\n by fmsmga006.fm.intel.com with ESMTP; 11 Oct 2023 06:34:12 -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=1697031253; x=1728567253;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=AW56G/IYSfPHaAJnXp20C322BHIJo0FWAQ6wc3RIWrA=;\n b=cIn6A8vobk4Q8lELl5drw/yt+uivnsx00iVXcvcX0zQjksegOmJGMZsd\n xEBIN2aplMqYthAvcqEfW4USlVTQ02m9nUoCgc9D8yuGZ1hWpfIMyXAJc\n 0EcxerBQV4gbMjH0r1pfkcDvj86G0PqyWq18F0Q67xz+Df2chLcIdfZIr\n lXn8MvGxL9b0p//zJH1eYfExWW0YG2qNeoWlXDfmlAQ1SKLs8FHRpRDUn\n X0itdm+2EcSUq7pYjKDBiaDDomJApeHAKa4MpB8GXymh7HYDm4p789PnE\n woCQGUo1fe7qyvdCCG1QrsEeKNCuMbDyR744IquuDoo2MxOOYfj6HE5U9 Q==;", "X-IronPort-AV": [ "E=McAfee;i=\"6600,9927,10860\"; a=\"364025729\"", "E=Sophos;i=\"6.03,216,1694761200\"; d=\"scan'208\";a=\"364025729\"", "E=McAfee;i=\"6600,9927,10860\"; a=\"1001111892\"", "E=Sophos;i=\"6.03,216,1694761200\"; d=\"scan'208\";a=\"1001111892\"" ], "X-ExtLoop1": "1", "From": "Bruce Richardson <bruce.richardson@intel.com>", "To": "dev@dpdk.org", "Cc": "Bruce Richardson <bruce.richardson@intel.com>,\n Anatoly Burakov <anatoly.burakov@intel.com>", "Subject": "[PATCH v3 3/5] examples/simple_mp: auto-generate cmdline boilerplate", "Date": "Wed, 11 Oct 2023 14:33:55 +0100", "Message-Id": "<20231011133357.111058-4-bruce.richardson@intel.com>", "X-Mailer": "git-send-email 2.39.2", "In-Reply-To": "<20231011133357.111058-1-bruce.richardson@intel.com>", "References": "<20230802170052.955323-1-bruce.richardson@intel.com>\n <20231011133357.111058-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/simple_mp/Makefile | 12 +-\n examples/multi_process/simple_mp/meson.build | 9 ++\n .../multi_process/simple_mp/mp_commands.c | 106 ++----------------\n .../multi_process/simple_mp/mp_commands.h | 14 ---\n .../multi_process/simple_mp/mp_commands.list | 3 +\n 5 files changed, 30 insertions(+), 114 deletions(-)\n delete mode 100644 examples/multi_process/simple_mp/mp_commands.h\n create mode 100644 examples/multi_process/simple_mp/mp_commands.list", "diff": "diff --git a/examples/multi_process/simple_mp/Makefile b/examples/multi_process/simple_mp/Makefile\nindex 1d0a260e64..890b6b7e62 100644\n--- a/examples/multi_process/simple_mp/Makefile\n+++ b/examples/multi_process/simple_mp/Makefile\n@@ -6,6 +6,7 @@ APP = simple_mp\n \n # all source are stored in SRCS-y\n SRCS-y := main.c mp_commands.c\n+SRC-DEPS := build/mp_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/mp_commands.h: mp_commands.list Makefile\n+\tdpdk-cmdline-gen.py -o $@ --context-name=simple_mp_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:\n@@ -47,5 +51,5 @@ build:\n \n .PHONY: clean\n clean:\n-\trm -f build/$(APP) build/$(APP)-static build/$(APP)-shared\n+\trm -f build/$(APP) build/$(APP)-static build/$(APP)-shared build/mp_commands.h\n \ttest -d build && rmdir -p build || true\ndiff --git a/examples/multi_process/simple_mp/meson.build b/examples/multi_process/simple_mp/meson.build\nindex 359af4384d..e99b7a3f6f 100644\n--- a/examples/multi_process/simple_mp/meson.build\n+++ b/examples/multi_process/simple_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: 'mp_commands.h',\n+\tinput: files('mp_commands.list'),\n+\tcapture: true,\n+\tcommand: [cmdline_gen_cmd, '--context-name=simple_mp_ctx', '@INPUT@']\n+)\n+\n sources = files(\n 'mp_commands.c',\n 'main.c',\n )\n+sources += cmd_h\ndiff --git a/examples/multi_process/simple_mp/mp_commands.c b/examples/multi_process/simple_mp/mp_commands.c\nindex a5f91b00be..df9fa94208 100644\n--- a/examples/multi_process/simple_mp/mp_commands.c\n+++ b/examples/multi_process/simple_mp/mp_commands.c\n@@ -1,44 +1,18 @@\n /* SPDX-License-Identifier: BSD-3-Clause\n- * Copyright(c) 2010-2014 Intel Corporation\n+ * Copyright(c) 2010-2023 Intel Corporation\n */\n-#include <stdint.h>\n-#include <string.h>\n-#include <stdlib.h>\n-#include <stdarg.h>\n-#include <inttypes.h>\n-#include <stdio.h>\n-#include <termios.h>\n-#include <errno.h>\n-#include <sys/queue.h>\n-\n-#include <rte_common.h>\n-#include <rte_memory.h>\n-#include <rte_eal.h>\n-#include <rte_branch_prediction.h>\n-#include <rte_launch.h>\n-#include <rte_log.h>\n-#include <rte_per_lcore.h>\n-#include <rte_lcore.h>\n #include <rte_ring.h>\n-#include <rte_debug.h>\n #include <rte_mempool.h>\n #include <rte_string_fns.h>\n \n-#include <cmdline_rdline.h>\n-#include <cmdline_parse.h>\n-#include <cmdline_parse_string.h>\n-#include <cmdline_socket.h>\n-#include <cmdline.h>\n #include \"mp_commands.h\"\n \n-/**********************************************************/\n-\n-struct cmd_send_result {\n-\tcmdline_fixed_string_t action;\n-\tcmdline_fixed_string_t message;\n-};\n+extern struct rte_ring *send_ring, *recv_ring;\n+extern struct rte_mempool *message_pool;\n+extern volatile int quit;\n \n-static void cmd_send_parsed(void *parsed_result,\n+void\n+cmd_send_parsed(void *parsed_result,\n \t\t__rte_unused struct cmdline *cl,\n \t\t__rte_unused void *data)\n {\n@@ -54,29 +28,8 @@ static void cmd_send_parsed(void *parsed_result,\n \t}\n }\n \n-cmdline_parse_token_string_t cmd_send_action =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_send_result, action, \"send\");\n-cmdline_parse_token_string_t cmd_send_message =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_send_result, message, NULL);\n-\n-cmdline_parse_inst_t cmd_send = {\n-\t.f = cmd_send_parsed, /* function to call */\n-\t.data = NULL, /* 2nd arg of func */\n-\t.help_str = \"send a string to another process\",\n-\t.tokens = { /* token list, NULL terminated */\n-\t\t\t(void *)&cmd_send_action,\n-\t\t\t(void *)&cmd_send_message,\n-\t\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@@ -84,26 +37,8 @@ static void cmd_quit_parsed(__rte_unused void *parsed_result,\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 = \"close the application\",\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_help_result {\n-\tcmdline_fixed_string_t help;\n-};\n-\n-static void cmd_help_parsed(__rte_unused void *parsed_result,\n+void\n+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@@ -112,24 +47,3 @@ static void cmd_help_parsed(__rte_unused void *parsed_result,\n \t\t\t\"send commands to the simple app. Commands supported are:\\n\\n\"\n \t\t\t\"- send [string]\\n\" \"- help\\n\" \"- quit\\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-/****** CONTEXT (list of instruction) */\n-cmdline_parse_ctx_t simple_mp_ctx[] = {\n-\t\t(cmdline_parse_inst_t *)&cmd_send,\n-\t\t(cmdline_parse_inst_t *)&cmd_quit,\n-\t\t(cmdline_parse_inst_t *)&cmd_help,\n-\tNULL,\n-};\ndiff --git a/examples/multi_process/simple_mp/mp_commands.h b/examples/multi_process/simple_mp/mp_commands.h\ndeleted file mode 100644\nindex 5d67413e7c..0000000000\n--- a/examples/multi_process/simple_mp/mp_commands.h\n+++ /dev/null\n@@ -1,14 +0,0 @@\n-/* SPDX-License-Identifier: BSD-3-Clause\n- * Copyright(c) 2010-2014 Intel Corporation\n- */\n-\n-#ifndef _SIMPLE_MP_COMMANDS_H_\n-#define _SIMPLE_MP_COMMANDS_H_\n-\n-extern struct rte_ring *send_ring;\n-extern struct rte_mempool *message_pool;\n-extern volatile int quit;\n-\n-extern cmdline_parse_ctx_t simple_mp_ctx[];\n-\n-#endif /* _SIMPLE_MP_COMMANDS_H_ */\ndiff --git a/examples/multi_process/simple_mp/mp_commands.list b/examples/multi_process/simple_mp/mp_commands.list\nnew file mode 100644\nindex 0000000000..c8890cb071\n--- /dev/null\n+++ b/examples/multi_process/simple_mp/mp_commands.list\n@@ -0,0 +1,3 @@\n+send <STRING>message # send a string to another process\n+help # show help\n+quit # close the application\n", "prefixes": [ "v3", "3/5" ] }{ "id": 132556, "url": "