get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/91443/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 91443,
    "url": "https://patches.dpdk.org/api/patches/91443/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1618395600-215396-3-git-send-email-haifeil@nvidia.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<1618395600-215396-3-git-send-email-haifeil@nvidia.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1618395600-215396-3-git-send-email-haifeil@nvidia.com",
    "date": "2021-04-14T10:20:00",
    "name": "[v6,2/2] app/testpmd: add CLIs for single flow dump feature",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "8ceecdca592475171a0e9f2d89fd57d4746c4d5c",
    "submitter": {
        "id": 2131,
        "url": "https://patches.dpdk.org/api/people/2131/?format=api",
        "name": "Haifei Luo",
        "email": "haifeil@nvidia.com"
    },
    "delegate": {
        "id": 319,
        "url": "https://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1618395600-215396-3-git-send-email-haifeil@nvidia.com/mbox/",
    "series": [
        {
            "id": 16367,
            "url": "https://patches.dpdk.org/api/series/16367/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=16367",
            "date": "2021-04-14T10:19:58",
            "name": "single flow dump",
            "version": 6,
            "mbox": "https://patches.dpdk.org/series/16367/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/91443/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/91443/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 AEEFAA0562;\n\tWed, 14 Apr 2021 12:20:15 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 5D597161969;\n\tWed, 14 Apr 2021 12:20:08 +0200 (CEST)",
            "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n by mails.dpdk.org (Postfix) with ESMTP id EF4E316195B\n for <dev@dpdk.org>; Wed, 14 Apr 2021 12:20:04 +0200 (CEST)",
            "from Internal Mail-Server by MTLPINE1 (envelope-from\n haifeil@nvidia.com) with SMTP; 14 Apr 2021 13:20:03 +0300",
            "from nvidia.com (gen-l-vrt-173.mtl.labs.mlnx [10.234.173.1])\n by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 13EAK2aG029750;\n Wed, 14 Apr 2021 13:20:03 +0300"
        ],
        "From": "Haifei Luo <haifeil@nvidia.com>",
        "To": "dev@dpdk.org",
        "Cc": "orika@nvidia.com, viacheslavo@nvidia.com, rasland@nvidia.com,\n xuemingl@nvidia.com, haifeil@nvidia.com, ajit.khaparde@broadcom.com,\n Xiaoyun Li <xiaoyun.li@intel.com>",
        "Date": "Wed, 14 Apr 2021 13:20:00 +0300",
        "Message-Id": "<1618395600-215396-3-git-send-email-haifeil@nvidia.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1618395600-215396-1-git-send-email-haifeil@nvidia.com>",
        "References": "<1615277716-64404-1-git-send-email-haifeil@nvidia.com>\n <1618395600-215396-1-git-send-email-haifeil@nvidia.com>",
        "Subject": "[dpdk-dev] [PATCH v6 2/2] app/testpmd: add CLIs for single flow\n dump feature",
        "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",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Add support for single flow dump.\nThe CLIs to dump one rule: flow dump PORT rule ID\nto dump all: flow dump PORT all\nExamples:\ntestpmd> flow dump 0 all\ntestpmd> flow dump 0 rule 0\n\nSigned-off-by: Haifei Luo <haifeil@nvidia.com>\nAcked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>\n---\n app/test-pmd/cmdline_flow.c                 | 55 +++++++++++++++++++++++++----\n app/test-pmd/config.c                       | 38 ++++++++++++++++++--\n app/test-pmd/testpmd.h                      |  3 +-\n doc/guides/rel_notes/release_21_05.rst      |  2 ++\n doc/guides/testpmd_app_ug/testpmd_funcs.rst |  6 +++-\n 5 files changed, 92 insertions(+), 12 deletions(-)",
    "diff": "diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c\nindex fb7a3a8..0127d9e 100644\n--- a/app/test-pmd/cmdline_flow.c\n+++ b/app/test-pmd/cmdline_flow.c\n@@ -108,6 +108,10 @@ enum index {\n \tTUNNEL_SET,\n \tTUNNEL_MATCH,\n \n+\t/* Dump arguments */\n+\tDUMP_ALL,\n+\tDUMP_ONE,\n+\n \t/* Shared action arguments */\n \tSHARED_ACTION_CREATE,\n \tSHARED_ACTION_UPDATE,\n@@ -793,6 +797,8 @@ struct buffer {\n \t\t} destroy; /**< Destroy arguments. */\n \t\tstruct {\n \t\t\tchar file[128];\n+\t\t\tbool mode;\n+\t\t\tuint32_t rule;\n \t\t} dump; /**< Dump arguments. */\n \t\tstruct {\n \t\t\tuint32_t rule;\n@@ -844,6 +850,12 @@ struct parse_action_priv {\n \tZERO,\n };\n \n+static const enum index next_dump_subcmd[] = {\n+\tDUMP_ALL,\n+\tDUMP_ONE,\n+\tZERO,\n+};\n+\n static const enum index next_sa_subcmd[] = {\n \tSHARED_ACTION_CREATE,\n \tSHARED_ACTION_UPDATE,\n@@ -2032,10 +2044,9 @@ static int comp_set_modify_field_id(struct context *, const struct token *,\n \t},\n \t[DUMP] = {\n \t\t.name = \"dump\",\n-\t\t.help = \"dump all flow rules to file\",\n-\t\t.next = NEXT(next_dump_attr, NEXT_ENTRY(PORT_ID)),\n-\t\t.args = ARGS(ARGS_ENTRY(struct buffer, args.dump.file),\n-\t\t\t     ARGS_ENTRY(struct buffer, port)),\n+\t\t.help = \"dump single/all flow rules to file\",\n+\t\t.next = NEXT(next_dump_subcmd, NEXT_ENTRY(PORT_ID)),\n+\t\t.args = ARGS(ARGS_ENTRY(struct buffer, port)),\n \t\t.call = parse_dump,\n \t},\n \t[QUERY] = {\n@@ -2125,6 +2136,22 @@ static int comp_set_modify_field_id(struct context *, const struct token *,\n \t\t.args = ARGS(ARGS_ENTRY_PTR(struct buffer, args.destroy.rule)),\n \t\t.call = parse_destroy,\n \t},\n+\t/* Dump arguments. */\n+\t[DUMP_ALL] = {\n+\t\t.name = \"all\",\n+\t\t.help = \"dump all\",\n+\t\t.next = NEXT(next_dump_attr),\n+\t\t.args = ARGS(ARGS_ENTRY(struct buffer, args.dump.file)),\n+\t\t.call = parse_dump,\n+\t},\n+\t[DUMP_ONE] = {\n+\t\t.name = \"rule\",\n+\t\t.help = \"dump one rule\",\n+\t\t.next = NEXT(next_dump_attr, NEXT_ENTRY(RULE_ID)),\n+\t\t.args = ARGS(ARGS_ENTRY(struct buffer, args.dump.file),\n+\t\t\t\tARGS_ENTRY(struct buffer, args.dump.rule)),\n+\t\t.call = parse_dump,\n+\t},\n \t/* Query arguments. */\n \t[QUERY_ACTION] = {\n \t\t.name = \"{action}\",\n@@ -6364,8 +6391,20 @@ static int comp_set_modify_field_id(struct context *, const struct token *,\n \t\tctx->objdata = 0;\n \t\tctx->object = out;\n \t\tctx->objmask = NULL;\n+\t\treturn len;\n+\t}\n+\tswitch (ctx->curr) {\n+\tcase DUMP_ALL:\n+\tcase DUMP_ONE:\n+\t\tout->args.dump.mode = (ctx->curr == DUMP_ALL) ? true : false;\n+\t\tout->command = ctx->curr;\n+\t\tctx->objdata = 0;\n+\t\tctx->object = out;\n+\t\tctx->objmask = NULL;\n+\t\treturn len;\n+\tdefault:\n+\t\treturn -1;\n \t}\n-\treturn len;\n }\n \n /** Parse tokens for query command. */\n@@ -7659,8 +7698,10 @@ static int comp_set_modify_field_id(struct context *, const struct token *,\n \tcase FLUSH:\n \t\tport_flow_flush(in->port);\n \t\tbreak;\n-\tcase DUMP:\n-\t\tport_flow_dump(in->port, in->args.dump.file);\n+\tcase DUMP_ONE:\n+\tcase DUMP_ALL:\n+\t\tport_flow_dump(in->port, in->args.dump.mode,\n+\t\t\t\tin->args.dump.rule, in->args.dump.file);\n \t\tbreak;\n \tcase QUERY:\n \t\tport_flow_query(in->port, in->args.query.rule,\ndiff --git a/app/test-pmd/config.c b/app/test-pmd/config.c\nindex ca34a63..40b2b29 100644\n--- a/app/test-pmd/config.c\n+++ b/app/test-pmd/config.c\n@@ -1916,13 +1916,41 @@ struct rte_flow_shared_action *\n \treturn ret;\n }\n \n-/** Dump all flow rules. */\n+/** Dump flow rules. */\n int\n-port_flow_dump(portid_t port_id, const char *file_name)\n+port_flow_dump(portid_t port_id, bool dump_all, uint32_t rule_id,\n+\t\tconst char *file_name)\n {\n \tint ret = 0;\n \tFILE *file = stdout;\n \tstruct rte_flow_error error;\n+\tstruct rte_port *port;\n+\tstruct port_flow *pflow;\n+\tstruct rte_flow *tmpFlow = NULL;\n+\tbool found = false;\n+\n+\tif (port_id_is_invalid(port_id, ENABLED_WARN) ||\n+\t\tport_id == (portid_t)RTE_PORT_ALL)\n+\t\treturn -EINVAL;\n+\n+\tif (!dump_all) {\n+\t\tport = &ports[port_id];\n+\t\tpflow = port->flow_list;\n+\t\twhile (pflow) {\n+\t\t\tif (rule_id != pflow->id) {\n+\t\t\t\tpflow = pflow->next;\n+\t\t\t} else {\n+\t\t\t\ttmpFlow = pflow->flow;\n+\t\t\t\tif (tmpFlow)\n+\t\t\t\t\tfound = true;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t}\n+\t\tif (found == false) {\n+\t\t\tprintf(\"Failed to dump to flow %d\\n\", rule_id);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t}\n \n \tif (file_name && strlen(file_name)) {\n \t\tfile = fopen(file_name, \"w\");\n@@ -1932,7 +1960,11 @@ struct rte_flow_shared_action *\n \t\t\treturn -errno;\n \t\t}\n \t}\n-\tret = rte_flow_dev_dump(port_id, NULL, file, &error);\n+\n+\tif (!dump_all)\n+\t\tret = rte_flow_dev_dump(port_id, tmpFlow, file, &error);\n+\telse\n+\t\tret = rte_flow_dev_dump(port_id, NULL, file, &error);\n \tif (ret) {\n \t\tport_flow_complain(&error);\n \t\tprintf(\"Failed to dump flow: %s\\n\", strerror(-ret));\ndiff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h\nindex a87ccb0..36d8535 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -825,7 +825,8 @@ void update_age_action_context(const struct rte_flow_action *actions,\n \t\t     struct port_flow *pf);\n int port_flow_destroy(portid_t port_id, uint32_t n, const uint32_t *rule);\n int port_flow_flush(portid_t port_id);\n-int port_flow_dump(portid_t port_id, const char *file_name);\n+int port_flow_dump(portid_t port_id, bool dump_all,\n+\t\t\tuint32_t rule, const char *file_name);\n int port_flow_query(portid_t port_id, uint32_t rule,\n \t\t    const struct rte_flow_action *action);\n void port_flow_list(portid_t port_id, uint32_t n, const uint32_t *group);\ndiff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst\nindex 6d209a2..e3ae470 100644\n--- a/doc/guides/rel_notes/release_21_05.rst\n+++ b/doc/guides/rel_notes/release_21_05.rst\n@@ -174,6 +174,8 @@ New Features\n     ``dpdk-testpmd -- --eth-link-speed N``\n   * Added command to display Rx queue used descriptor count.\n     ``show port (port_id) rxq (queue_id) desc used count``\n+  * Added command to dump internal representation information of single flow.\n+    ``flow dump (port_id) rule (rule_id)``\n \n \n Removed Items\ndiff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst\nindex 36f0a32..5454524 100644\n--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst\n+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst\n@@ -3332,7 +3332,11 @@ following sections.\n \n - Dump internal representation information of all flows in hardware::\n \n-   flow dump {port_id} {output_file}\n+   flow dump {port_id} all {output_file}\n+\n+   for one flow :\n+\n+   flow dump {port_id} rule {rule_id} {output_file}\n \n - List and destroy aged flow rules::\n \n",
    "prefixes": [
        "v6",
        "2/2"
    ]
}