get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 43374,
    "url": "http://patches.dpdk.org/api/patches/43374/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180725171007.94198-5-jasvinder.singh@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": "<20180725171007.94198-5-jasvinder.singh@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180725171007.94198-5-jasvinder.singh@intel.com",
    "date": "2018-07-25T17:10:05",
    "name": "[4/6] net/softnic: add CLI command for tmgr node addition",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "03a14f0b289c4b63e060e8d336cf7a0eb7024dd3",
    "submitter": {
        "id": 285,
        "url": "http://patches.dpdk.org/api/people/285/?format=api",
        "name": "Jasvinder Singh",
        "email": "jasvinder.singh@intel.com"
    },
    "delegate": {
        "id": 10018,
        "url": "http://patches.dpdk.org/api/users/10018/?format=api",
        "username": "cristian_dumitrescu",
        "first_name": "Cristian",
        "last_name": "Dumitrescu",
        "email": "cristian.dumitrescu@intel.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20180725171007.94198-5-jasvinder.singh@intel.com/mbox/",
    "series": [
        {
            "id": 775,
            "url": "http://patches.dpdk.org/api/series/775/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=775",
            "date": "2018-07-25T17:10:01",
            "name": "net/softnic: expose tmgr through firmware",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/775/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/43374/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/43374/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 [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 5C596343C;\n\tWed, 25 Jul 2018 19:10:21 +0200 (CEST)",
            "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n\tby dpdk.org (Postfix) with ESMTP id 13204324B\n\tfor <dev@dpdk.org>; Wed, 25 Jul 2018 19:10:14 +0200 (CEST)",
            "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t25 Jul 2018 10:10:14 -0700",
            "from silpixa00381635.ir.intel.com (HELO\n\tsilpixa00381635.ger.corp.intel.com) ([10.237.222.149])\n\tby orsmga003.jf.intel.com with ESMTP; 25 Jul 2018 10:10:13 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,401,1526367600\"; d=\"scan'208\";a=\"69856154\"",
        "From": "Jasvinder Singh <jasvinder.singh@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "cristian.dumitrescu@intel.com",
        "Date": "Wed, 25 Jul 2018 18:10:05 +0100",
        "Message-Id": "<20180725171007.94198-5-jasvinder.singh@intel.com>",
        "X-Mailer": "git-send-email 2.9.3",
        "In-Reply-To": "<20180725171007.94198-1-jasvinder.singh@intel.com>",
        "References": "<20180725171007.94198-1-jasvinder.singh@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 4/6] net/softnic: add CLI command for tmgr node\n\taddition",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\n\nAdd support for adding Traffic Manager (TMGR) hierarchy node through\nfirmware CLI script.\n\nSigned-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\nSigned-off-by: Jasvinder Singh <jasvinder.singh@intel.com>\n---\n drivers/net/softnic/rte_eth_softnic_cli.c | 171 ++++++++++++++++++++++++++++++\n 1 file changed, 171 insertions(+)",
    "diff": "diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c\nindex 73ea7bd..d5485b5 100644\n--- a/drivers/net/softnic/rte_eth_softnic_cli.c\n+++ b/drivers/net/softnic/rte_eth_softnic_cli.c\n@@ -338,6 +338,171 @@ cmd_tmgr_shared_shaper(struct pmd_internals *softnic,\n }\n \n /**\n+ * tmgr node\n+ *   id <node_id>\n+ *   parent <parent_node_id | none>\n+ *   priority <priority>\n+ *   weight <weight>\n+ *   [shaper profile <shaper_profile_id>]\n+ *   [shared shaper <shared_shaper_id>]\n+ *   [nonleaf sp <n_sp_priorities>]\n+ */\n+static void\n+cmd_tmgr_node(struct pmd_internals *softnic,\n+\tchar **tokens,\n+\tuint32_t n_tokens,\n+\tchar *out,\n+\tsize_t out_size)\n+{\n+\tstruct rte_tm_error error;\n+\tstruct rte_tm_node_params np;\n+\tuint32_t node_id, parent_node_id, priority, weight, shared_shaper_id;\n+\tuint16_t port_id;\n+\tint status;\n+\n+\tmemset(&np, 0, sizeof(struct rte_tm_node_params));\n+\tnp.shaper_profile_id = RTE_TM_SHAPER_PROFILE_ID_NONE;\n+\tnp.nonleaf.n_sp_priorities = 1;\n+\n+\tif (n_tokens < 10) {\n+\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[1], \"node\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"node\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[2], \"id\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"id\");\n+\t\treturn;\n+\t}\n+\n+\tif (softnic_parser_read_uint32(&node_id, tokens[3]) != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"node_id\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[4], \"parent\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"parent\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[5], \"none\") == 0)\n+\t\tparent_node_id = RTE_TM_NODE_ID_NULL;\n+\telse {\n+\t\tif (softnic_parser_read_uint32(&parent_node_id, tokens[5]) != 0) {\n+\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"parent_node_id\");\n+\t\t\treturn;\n+\t\t}\n+\t}\n+\n+\tif (strcmp(tokens[6], \"priority\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"priority\");\n+\t\treturn;\n+\t}\n+\n+\tif (softnic_parser_read_uint32(&priority, tokens[7]) != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"priority\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[8], \"weight\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"weight\");\n+\t\treturn;\n+\t}\n+\n+\tif (softnic_parser_read_uint32(&weight, tokens[9]) != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"weight\");\n+\t\treturn;\n+\t}\n+\n+\ttokens += 10;\n+\tn_tokens -= 10;\n+\n+\tif (n_tokens >= 2 &&\n+\t\t(strcmp(tokens[0], \"shaper\") == 0) &&\n+\t\t(strcmp(tokens[1], \"profile\") == 0)) {\n+\t\tif (n_tokens < 3) {\n+\t\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, \"tmgr node\");\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tif (strcmp(tokens[2], \"none\") == 0) {\n+\t\t\tnp.shaper_profile_id = RTE_TM_SHAPER_PROFILE_ID_NONE;\n+\t\t} else {\n+\t\t\tif (softnic_parser_read_uint32(&np.shaper_profile_id, tokens[2]) != 0) {\n+\t\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"shaper_profile_id\");\n+\t\t\t\treturn;\n+\t\t\t}\n+\t\t}\n+\n+\t\ttokens += 3;\n+\t\tn_tokens -= 3;\n+\t} /* shaper profile */\n+\n+\tif (n_tokens >= 2 &&\n+\t\t(strcmp(tokens[0], \"shared\") == 0) &&\n+\t\t(strcmp(tokens[1], \"shaper\") == 0)) {\n+\t\tif (n_tokens < 3) {\n+\t\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, \"tmgr node\");\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tif (softnic_parser_read_uint32(&shared_shaper_id, tokens[2]) != 0) {\n+\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"shared_shaper_id\");\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tnp.shared_shaper_id = &shared_shaper_id;\n+\t\tnp.n_shared_shapers = 1;\n+\n+\t\ttokens += 3;\n+\t\tn_tokens -= 3;\n+\t} /* shared shaper */\n+\n+\tif (n_tokens >= 2 &&\n+\t\t(strcmp(tokens[0], \"nonleaf\") == 0) &&\n+\t\t(strcmp(tokens[1], \"sp\") == 0)) {\n+\t\tif (n_tokens < 3) {\n+\t\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, \"tmgr node\");\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tif (softnic_parser_read_uint32(&np.nonleaf.n_sp_priorities, tokens[2]) != 0) {\n+\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"n_sp_priorities\");\n+\t\t\treturn;\n+\t\t}\n+\n+\t\ttokens += 3;\n+\t\tn_tokens -= 3;\n+\t} /* nonleaf sp <n_sp_priorities> */\n+\n+\tif (n_tokens) {\n+\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);\n+\t\treturn;\n+\t}\n+\n+\tstatus = rte_eth_dev_get_port_by_name(softnic->params.name, &port_id);\n+\tif (status != 0)\n+\t\treturn;\n+\n+\tstatus = rte_tm_node_add(port_id,\n+\t\tnode_id,\n+\t\tparent_node_id,\n+\t\tpriority,\n+\t\tweight,\n+\t\tRTE_TM_NODE_LEVEL_ID_ANY,\n+\t\t&np,\n+\t\t&error);\n+\tif (status != 0) {\n+\t\tsnprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);\n+\t\treturn;\n+\t}\n+}\n+\n+/**\n  * tmgr <tmgr_name>\n  */\n static void\n@@ -4154,6 +4319,12 @@ softnic_cli_process(char *in, char *out, size_t out_size, void *arg)\n \t\t\tcmd_tmgr_shared_shaper(softnic, tokens, n_tokens, out, out_size);\n \t\t\treturn;\n \t\t}\n+\n+\t\tif (n_tokens >= 2 &&\n+\t\t\t(strcmp(tokens[1], \"node\") == 0)) {\n+\t\t\tcmd_tmgr_node(softnic, tokens, n_tokens, out, out_size);\n+\t\t\treturn;\n+\t\t}\n \t}\n \n \tif (strcmp(tokens[0], \"tap\") == 0) {\n",
    "prefixes": [
        "4/6"
    ]
}