Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/17179/?format=api
http://patches.dpdk.org/api/patches/17179/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1479822736-32399-3-git-send-email-olivier.matz@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": "<1479822736-32399-3-git-send-email-olivier.matz@6wind.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1479822736-32399-3-git-send-email-olivier.matz@6wind.com", "date": "2016-11-22T13:52:16", "name": "[dpdk-dev,2/2] l2fwd: rework long options parsing", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "d399c7080410b5625db2a6f968e153524a15b564", "submitter": { "id": 8, "url": "http://patches.dpdk.org/api/people/8/?format=api", "name": "Olivier Matz", "email": "olivier.matz@6wind.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/1479822736-32399-3-git-send-email-olivier.matz@6wind.com/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/17179/comments/", "check": "warning", "checks": "http://patches.dpdk.org/api/patches/17179/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id F38085686;\n\tTue, 22 Nov 2016 14:53:04 +0100 (CET)", "from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com\n\t[62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 1058B5582\n\tfor <dev@dpdk.org>; Tue, 22 Nov 2016 14:52:41 +0100 (CET)", "from glumotte.dev.6wind.com (unknown [10.16.0.195])\n\tby proxy.6wind.com (Postfix) with ESMTP id 05C4A24BA7;\n\tTue, 22 Nov 2016 14:52:37 +0100 (CET)" ], "From": "Olivier Matz <olivier.matz@6wind.com>", "To": "dev@dpdk.org, bruce.richardson@intel.com, pablo.de.lara.guarch@intel.com", "Date": "Tue, 22 Nov 2016 14:52:16 +0100", "Message-Id": "<1479822736-32399-3-git-send-email-olivier.matz@6wind.com>", "X-Mailer": "git-send-email 2.8.1", "In-Reply-To": "<1479822736-32399-1-git-send-email-olivier.matz@6wind.com>", "References": "<1479822736-32399-1-git-send-email-olivier.matz@6wind.com>", "Subject": "[dpdk-dev] [PATCH 2/2] l2fwd: rework long options parsing", "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>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Do the same than in l3fwd to avoid strcmp() for long options.\n\nFor l2fwd, there is no long option that take advantage of this new\nmechanism as --mac-updating and --no-mac-updating are directly setting a\nflag without needing an entry in the switch/case.\n\nSo this patch just prepares the framework in case a new long option is\nadded in the future.\n\nSigned-off-by: Olivier Matz <olivier.matz@6wind.com>\n---\n examples/l2fwd/main.c | 30 ++++++++++++++++++++++++------\n 1 file changed, 24 insertions(+), 6 deletions(-)", "diff": "diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c\nindex b2f5851..97d6454 100644\n--- a/examples/l2fwd/main.c\n+++ b/examples/l2fwd/main.c\n@@ -392,6 +392,29 @@ l2fwd_parse_timer_period(const char *q_arg)\n \treturn n;\n }\n \n+static const char short_options[] =\n+\t\"p:\" /* portmask */\n+\t\"q:\" /* number of queues */\n+\t\"T:\" /* timer period */\n+\t;\n+\n+#define CMD_LINE_OPT_MAC_UPDATING \"mac-updating\"\n+#define CMD_LINE_OPT_NO_MAC_UPDATING \"no-mac-updating\"\n+\n+enum {\n+\t/* long options mapped to a short option */\n+\n+\t/* first long only option value must be >= 256, so that we won't\n+\t * conflict with short options */\n+\tCMD_LINE_OPT_MIN_NUM = 256,\n+};\n+\n+static const struct option lgopts[] = {\n+\t{ CMD_LINE_OPT_MAC_UPDATING, no_argument, &mac_updating, 1},\n+\t{ CMD_LINE_OPT_NO_MAC_UPDATING, no_argument, &mac_updating, 0},\n+\t{NULL, 0, 0, 0}\n+};\n+\n /* Parse the argument given in the command line of the application */\n static int\n l2fwd_parse_args(int argc, char **argv)\n@@ -400,15 +423,10 @@ l2fwd_parse_args(int argc, char **argv)\n \tchar **argvopt;\n \tint option_index;\n \tchar *prgname = argv[0];\n-\tstatic struct option lgopts[] = {\n-\t\t{ \"mac-updating\", no_argument, &mac_updating, 1},\n-\t\t{ \"no-mac-updating\", no_argument, &mac_updating, 0},\n-\t\t{NULL, 0, 0, 0}\n-\t};\n \n \targvopt = argv;\n \n-\twhile ((opt = getopt_long(argc, argvopt, \"p:q:T:\",\n+\twhile ((opt = getopt_long(argc, argvopt, short_options,\n \t\t\t\t lgopts, &option_index)) != EOF) {\n \n \t\tswitch (opt) {\n", "prefixes": [ "dpdk-dev", "2/2" ] }{ "id": 17179, "url": "