get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 42560,
    "url": "http://patches.dpdk.org/api/patches/42560/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180706172116.50951-19-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": "<20180706172116.50951-19-jasvinder.singh@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180706172116.50951-19-jasvinder.singh@intel.com",
    "date": "2018-07-06T17:21:11",
    "name": "[v5,18/23] net/softnic: add cli for meter action",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "8309853b396d081cb76d8cb2406f7458dde59e9e",
    "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/20180706172116.50951-19-jasvinder.singh@intel.com/mbox/",
    "series": [
        {
            "id": 460,
            "url": "http://patches.dpdk.org/api/series/460/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=460",
            "date": "2018-07-06T17:20:53",
            "name": "net/softnic: refactoring",
            "version": 5,
            "mbox": "http://patches.dpdk.org/series/460/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/42560/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/42560/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 380471BFFA;\n\tFri,  6 Jul 2018 19:22:17 +0200 (CEST)",
            "from mga05.intel.com (mga05.intel.com [192.55.52.43])\n\tby dpdk.org (Postfix) with ESMTP id 5ED7E1BEE6\n\tfor <dev@dpdk.org>; Fri,  6 Jul 2018 19:22:05 +0200 (CEST)",
            "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t06 Jul 2018 10:22:03 -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; 06 Jul 2018 10:21:39 -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,317,1526367600\"; d=\"scan'208\";a=\"64955384\"",
        "From": "Jasvinder Singh <jasvinder.singh@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "cristian.dumitrescu@intel.com",
        "Date": "Fri,  6 Jul 2018 18:21:11 +0100",
        "Message-Id": "<20180706172116.50951-19-jasvinder.singh@intel.com>",
        "X-Mailer": "git-send-email 2.9.3",
        "In-Reply-To": "<20180706172116.50951-1-jasvinder.singh@intel.com>",
        "References": "<20180705154754.147420-2-jasvinder.singh@intel.com>\n\t<20180706172116.50951-1-jasvinder.singh@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v5 18/23] net/softnic: add cli for meter action",
        "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": "Add cli commands for meter action in softnic pipeline objects.\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       | 418 ++++++++++++++++++++++++\n drivers/net/softnic/rte_eth_softnic_internals.h |  29 ++\n drivers/net/softnic/rte_eth_softnic_thread.c    | 355 +++++++++++++++++++-\n 3 files changed, 801 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c\nindex 2b445b6..c13f4d8 100644\n--- a/drivers/net/softnic/rte_eth_softnic_cli.c\n+++ b/drivers/net/softnic/rte_eth_softnic_cli.c\n@@ -3441,6 +3441,386 @@ cmd_softnic_pipeline_table_rule_stats_read(struct pmd_internals *softnic __rte_u\n }\n \n /**\n+ * pipeline <pipeline_name> table <table_id> meter profile <meter_profile_id>\n+ *  add srtcm cir <cir> cbs <cbs> ebs <ebs>\n+ *  | trtcm cir <cir> pir <pir> cbs <cbs> pbs <pbs>\n+ */\n+static void\n+cmd_pipeline_table_meter_profile_add(struct pmd_internals *softnic,\n+\tchar **tokens,\n+\tuint32_t n_tokens,\n+\tchar *out,\n+\tsize_t out_size)\n+{\n+\tstruct rte_table_action_meter_profile p;\n+\tchar *pipeline_name;\n+\tuint32_t table_id, meter_profile_id;\n+\tint status;\n+\n+\tif (n_tokens < 9) {\n+\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);\n+\t\treturn;\n+\t}\n+\n+\tpipeline_name = tokens[1];\n+\n+\tif (strcmp(tokens[2], \"table\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"port\");\n+\t\treturn;\n+\t}\n+\n+\tif (softnic_parser_read_uint32(&table_id, tokens[3]) != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"table_id\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[4], \"meter\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"meter\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[5], \"profile\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"profile\");\n+\t\treturn;\n+\t}\n+\n+\tif (softnic_parser_read_uint32(&meter_profile_id, tokens[6]) != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"meter_profile_id\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[7], \"add\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"add\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[8], \"srtcm\") == 0) {\n+\t\tif (n_tokens != 15) {\n+\t\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH,\n+\t\t\t\ttokens[0]);\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tp.alg = RTE_TABLE_ACTION_METER_SRTCM;\n+\n+\t\tif (strcmp(tokens[9], \"cir\") != 0) {\n+\t\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"cir\");\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tif (softnic_parser_read_uint64(&p.srtcm.cir, tokens[10]) != 0) {\n+\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"cir\");\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tif (strcmp(tokens[11], \"cbs\") != 0) {\n+\t\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"cbs\");\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tif (softnic_parser_read_uint64(&p.srtcm.cbs, tokens[12]) != 0) {\n+\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"cbs\");\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tif (strcmp(tokens[13], \"ebs\") != 0) {\n+\t\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"ebs\");\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tif (softnic_parser_read_uint64(&p.srtcm.ebs, tokens[14]) != 0) {\n+\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"ebs\");\n+\t\t\treturn;\n+\t\t}\n+\t} else if (strcmp(tokens[8], \"trtcm\") == 0) {\n+\t\tif (n_tokens != 17) {\n+\t\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tp.alg = RTE_TABLE_ACTION_METER_TRTCM;\n+\n+\t\tif (strcmp(tokens[9], \"cir\") != 0) {\n+\t\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"cir\");\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tif (softnic_parser_read_uint64(&p.trtcm.cir, tokens[10]) != 0) {\n+\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"cir\");\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tif (strcmp(tokens[11], \"pir\") != 0) {\n+\t\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"pir\");\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tif (softnic_parser_read_uint64(&p.trtcm.pir, tokens[12]) != 0) {\n+\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"pir\");\n+\t\t\treturn;\n+\t\t}\n+\t\tif (strcmp(tokens[13], \"cbs\") != 0) {\n+\t\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"cbs\");\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tif (softnic_parser_read_uint64(&p.trtcm.cbs, tokens[14]) != 0) {\n+\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"cbs\");\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tif (strcmp(tokens[15], \"pbs\") != 0) {\n+\t\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"pbs\");\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tif (softnic_parser_read_uint64(&p.trtcm.pbs, tokens[16]) != 0) {\n+\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"pbs\");\n+\t\t\treturn;\n+\t\t}\n+\t} else {\n+\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);\n+\t\treturn;\n+\t}\n+\n+\tstatus = softnic_pipeline_table_mtr_profile_add(softnic,\n+\t\tpipeline_name,\n+\t\ttable_id,\n+\t\tmeter_profile_id,\n+\t\t&p);\n+\tif (status) {\n+\t\tsnprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);\n+\t\treturn;\n+\t}\n+}\n+\n+/**\n+ * pipeline <pipeline_name> table <table_id>\n+ *  meter profile <meter_profile_id> delete\n+ */\n+static void\n+cmd_pipeline_table_meter_profile_delete(struct pmd_internals *softnic,\n+\tchar **tokens,\n+\tuint32_t n_tokens,\n+\tchar *out,\n+\tsize_t out_size)\n+{\n+\tchar *pipeline_name;\n+\tuint32_t table_id, meter_profile_id;\n+\tint status;\n+\n+\tif (n_tokens != 8) {\n+\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);\n+\t\treturn;\n+\t}\n+\n+\tpipeline_name = tokens[1];\n+\n+\tif (strcmp(tokens[2], \"table\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"port\");\n+\t\treturn;\n+\t}\n+\n+\tif (softnic_parser_read_uint32(&table_id, tokens[3]) != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"table_id\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[4], \"meter\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"meter\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[5], \"profile\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"profile\");\n+\t\treturn;\n+\t}\n+\n+\tif (softnic_parser_read_uint32(&meter_profile_id, tokens[6]) != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"meter_profile_id\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[7], \"delete\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"delete\");\n+\t\treturn;\n+\t}\n+\n+\tstatus = softnic_pipeline_table_mtr_profile_delete(softnic,\n+\t\tpipeline_name,\n+\t\ttable_id,\n+\t\tmeter_profile_id);\n+\tif (status) {\n+\t\tsnprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);\n+\t\treturn;\n+\t}\n+}\n+\n+/**\n+ * pipeline <pipeline_name> table <table_id> rule read meter [clear]\n+ */\n+static void\n+cmd_pipeline_table_rule_meter_read(struct pmd_internals *softnic __rte_unused,\n+\tchar **tokens,\n+\tuint32_t n_tokens __rte_unused,\n+\tchar *out,\n+\tsize_t out_size)\n+{\n+\tsnprintf(out, out_size, MSG_CMD_UNIMPLEM, tokens[0]);\n+}\n+\n+/**\n+ * pipeline <pipeline_name> table <table_id> dscp <file_name>\n+ *\n+ * File <file_name>:\n+ *  - exactly 64 lines\n+ *  - line format: <tc_id> <tc_queue_id> <color>, with <color> as: g | y | r\n+ */\n+static int\n+load_dscp_table(struct rte_table_action_dscp_table *dscp_table,\n+\tconst char *file_name,\n+\tuint32_t *line_number)\n+{\n+\tFILE *f = NULL;\n+\tuint32_t dscp, l;\n+\n+\t/* Check input arguments */\n+\tif (dscp_table == NULL ||\n+\t\tfile_name == NULL ||\n+\t\tline_number == NULL) {\n+\t\tif (line_number)\n+\t\t\t*line_number = 0;\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/* Open input file */\n+\tf = fopen(file_name, \"r\");\n+\tif (f == NULL) {\n+\t\t*line_number = 0;\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/* Read file */\n+\tfor (dscp = 0, l = 1; ; l++) {\n+\t\tchar line[64];\n+\t\tchar *tokens[3];\n+\t\tenum rte_meter_color color;\n+\t\tuint32_t tc_id, tc_queue_id, n_tokens = RTE_DIM(tokens);\n+\n+\t\tif (fgets(line, sizeof(line), f) == NULL)\n+\t\t\tbreak;\n+\n+\t\tif (is_comment(line))\n+\t\t\tcontinue;\n+\n+\t\tif (softnic_parse_tokenize_string(line, tokens, &n_tokens)) {\n+\t\t\t*line_number = l;\n+\t\t\tfclose(f);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tif (n_tokens == 0)\n+\t\t\tcontinue;\n+\n+\t\tif (dscp >= RTE_DIM(dscp_table->entry) ||\n+\t\t\tn_tokens != RTE_DIM(tokens) ||\n+\t\t\tsoftnic_parser_read_uint32(&tc_id, tokens[0]) ||\n+\t\t\ttc_id >= RTE_TABLE_ACTION_TC_MAX ||\n+\t\t\tsoftnic_parser_read_uint32(&tc_queue_id, tokens[1]) ||\n+\t\t\ttc_queue_id >= RTE_TABLE_ACTION_TC_QUEUE_MAX ||\n+\t\t\t(strlen(tokens[2]) != 1)) {\n+\t\t\t*line_number = l;\n+\t\t\tfclose(f);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tswitch (tokens[2][0]) {\n+\t\tcase 'g':\n+\t\tcase 'G':\n+\t\t\tcolor = e_RTE_METER_GREEN;\n+\t\t\tbreak;\n+\n+\t\tcase 'y':\n+\t\tcase 'Y':\n+\t\t\tcolor = e_RTE_METER_YELLOW;\n+\t\t\tbreak;\n+\n+\t\tcase 'r':\n+\t\tcase 'R':\n+\t\t\tcolor = e_RTE_METER_RED;\n+\t\t\tbreak;\n+\n+\t\tdefault:\n+\t\t\t*line_number = l;\n+\t\t\tfclose(f);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tdscp_table->entry[dscp].tc_id = tc_id;\n+\t\tdscp_table->entry[dscp].tc_queue_id = tc_queue_id;\n+\t\tdscp_table->entry[dscp].color = color;\n+\t\tdscp++;\n+\t}\n+\n+\t/* Close file */\n+\tfclose(f);\n+\treturn 0;\n+}\n+\n+static void\n+cmd_pipeline_table_dscp(struct pmd_internals *softnic,\n+\tchar **tokens,\n+\tuint32_t n_tokens,\n+\tchar *out,\n+\tsize_t out_size)\n+{\n+\tstruct rte_table_action_dscp_table dscp_table;\n+\tchar *pipeline_name, *file_name;\n+\tuint32_t table_id, line_number;\n+\tint status;\n+\n+\tif (n_tokens != 6) {\n+\t\tsnprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);\n+\t\treturn;\n+\t}\n+\n+\tpipeline_name = tokens[1];\n+\n+\tif (strcmp(tokens[2], \"table\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"port\");\n+\t\treturn;\n+\t}\n+\n+\tif (softnic_parser_read_uint32(&table_id, tokens[3]) != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"table_id\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[4], \"dscp\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"dscp\");\n+\t\treturn;\n+\t}\n+\n+\tfile_name = tokens[5];\n+\n+\tstatus = load_dscp_table(&dscp_table, file_name, &line_number);\n+\tif (status) {\n+\t\tsnprintf(out, out_size, MSG_FILE_ERR, file_name, line_number);\n+\t\treturn;\n+\t}\n+\n+\tstatus = softnic_pipeline_table_dscp_table_update(softnic,\n+\t\tpipeline_name,\n+\t\ttable_id,\n+\t\tUINT64_MAX,\n+\t\t&dscp_table);\n+\tif (status) {\n+\t\tsnprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);\n+\t\treturn;\n+\t}\n+}\n+\n+/**\n  * thread <thread_id> pipeline <pipeline_name> enable\n  */\n static void\n@@ -3713,6 +4093,44 @@ softnic_cli_process(char *in, char *out, size_t out_size, void *arg)\n \t\t\t\tout, out_size);\n \t\t\treturn;\n \t\t}\n+\n+\t\tif (n_tokens >= 8 &&\n+\t\t\t(strcmp(tokens[2], \"table\") == 0) &&\n+\t\t\t(strcmp(tokens[4], \"meter\") == 0) &&\n+\t\t\t(strcmp(tokens[5], \"profile\") == 0) &&\n+\t\t\t(strcmp(tokens[7], \"add\") == 0)) {\n+\t\t\tcmd_pipeline_table_meter_profile_add(softnic, tokens, n_tokens,\n+\t\t\t\tout, out_size);\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tif (n_tokens >= 8 &&\n+\t\t\t(strcmp(tokens[2], \"table\") == 0) &&\n+\t\t\t(strcmp(tokens[4], \"meter\") == 0) &&\n+\t\t\t(strcmp(tokens[5], \"profile\") == 0) &&\n+\t\t\t(strcmp(tokens[7], \"delete\") == 0)) {\n+\t\t\tcmd_pipeline_table_meter_profile_delete(softnic, tokens,\n+\t\t\t\tn_tokens, out, out_size);\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tif (n_tokens >= 7 &&\n+\t\t\t(strcmp(tokens[2], \"table\") == 0) &&\n+\t\t\t(strcmp(tokens[4], \"rule\") == 0) &&\n+\t\t\t(strcmp(tokens[5], \"read\") == 0) &&\n+\t\t\t(strcmp(tokens[6], \"meter\") == 0)) {\n+\t\t\tcmd_pipeline_table_rule_meter_read(softnic, tokens, n_tokens,\n+\t\t\t\tout, out_size);\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tif (n_tokens >= 5 &&\n+\t\t\t(strcmp(tokens[2], \"table\") == 0) &&\n+\t\t\t(strcmp(tokens[4], \"dscp\") == 0)) {\n+\t\t\tcmd_pipeline_table_dscp(softnic, tokens, n_tokens,\n+\t\t\t\tout, out_size);\n+\t\t\treturn;\n+\t\t}\n \t}\n \n \tif (strcmp(tokens[0], \"thread\") == 0) {\ndiff --git a/drivers/net/softnic/rte_eth_softnic_internals.h b/drivers/net/softnic/rte_eth_softnic_internals.h\nindex d4d9612..8d83eeb 100644\n--- a/drivers/net/softnic/rte_eth_softnic_internals.h\n+++ b/drivers/net/softnic/rte_eth_softnic_internals.h\n@@ -838,6 +838,35 @@ softnic_pipeline_table_rule_stats_read(struct pmd_internals *p,\n \tstruct rte_table_action_stats_counters *stats,\n \tint clear);\n \n+int\n+softnic_pipeline_table_mtr_profile_add(struct pmd_internals *p,\n+\tconst char *pipeline_name,\n+\tuint32_t table_id,\n+\tuint32_t meter_profile_id,\n+\tstruct rte_table_action_meter_profile *profile);\n+\n+int\n+softnic_pipeline_table_mtr_profile_delete(struct pmd_internals *p,\n+\tconst char *pipeline_name,\n+\tuint32_t table_id,\n+\tuint32_t meter_profile_id);\n+\n+int\n+softnic_pipeline_table_rule_mtr_read(struct pmd_internals *p,\n+\tconst char *pipeline_name,\n+\tuint32_t table_id,\n+\tvoid *data,\n+\tuint32_t tc_mask,\n+\tstruct rte_table_action_mtr_counters *stats,\n+\tint clear);\n+\n+int\n+softnic_pipeline_table_dscp_table_update(struct pmd_internals *p,\n+\tconst char *pipeline_name,\n+\tuint32_t table_id,\n+\tuint64_t dscp_mask,\n+\tstruct rte_table_action_dscp_table *dscp_table);\n+\n /**\n  * Thread\n  */\ndiff --git a/drivers/net/softnic/rte_eth_softnic_thread.c b/drivers/net/softnic/rte_eth_softnic_thread.c\nindex f0754fd..c626b99 100644\n--- a/drivers/net/softnic/rte_eth_softnic_thread.c\n+++ b/drivers/net/softnic/rte_eth_softnic_thread.c\n@@ -522,7 +522,10 @@ enum pipeline_req_type {\n \tPIPELINE_REQ_TABLE_RULE_DELETE,\n \tPIPELINE_REQ_TABLE_RULE_DELETE_DEFAULT,\n \tPIPELINE_REQ_TABLE_RULE_STATS_READ,\n-\n+\tPIPELINE_REQ_TABLE_MTR_PROFILE_ADD,\n+\tPIPELINE_REQ_TABLE_MTR_PROFILE_DELETE,\n+\tPIPELINE_REQ_TABLE_RULE_MTR_READ,\n+\tPIPELINE_REQ_TABLE_DSCP_TABLE_UPDATE,\n \tPIPELINE_REQ_MAX\n };\n \n@@ -564,6 +567,26 @@ struct pipeline_msg_req_table_rule_stats_read {\n \tint clear;\n };\n \n+struct pipeline_msg_req_table_mtr_profile_add {\n+\tuint32_t meter_profile_id;\n+\tstruct rte_table_action_meter_profile profile;\n+};\n+\n+struct pipeline_msg_req_table_mtr_profile_delete {\n+\tuint32_t meter_profile_id;\n+};\n+\n+struct pipeline_msg_req_table_rule_mtr_read {\n+\tvoid *data;\n+\tuint32_t tc_mask;\n+\tint clear;\n+};\n+\n+struct pipeline_msg_req_table_dscp_table_update {\n+\tuint64_t dscp_mask;\n+\tstruct rte_table_action_dscp_table dscp_table;\n+};\n+\n struct pipeline_msg_req {\n \tenum pipeline_req_type type;\n \tuint32_t id; /* Port IN, port OUT or table ID */\n@@ -578,6 +601,10 @@ struct pipeline_msg_req {\n \t\tstruct pipeline_msg_req_table_rule_add_bulk table_rule_add_bulk;\n \t\tstruct pipeline_msg_req_table_rule_delete table_rule_delete;\n \t\tstruct pipeline_msg_req_table_rule_stats_read table_rule_stats_read;\n+\t\tstruct pipeline_msg_req_table_mtr_profile_add table_mtr_profile_add;\n+\t\tstruct pipeline_msg_req_table_mtr_profile_delete table_mtr_profile_delete;\n+\t\tstruct pipeline_msg_req_table_rule_mtr_read table_rule_mtr_read;\n+\t\tstruct pipeline_msg_req_table_dscp_table_update table_dscp_table_update;\n \t};\n };\n \n@@ -609,6 +636,10 @@ struct pipeline_msg_rsp_table_rule_stats_read {\n \tstruct rte_table_action_stats_counters stats;\n };\n \n+struct pipeline_msg_rsp_table_rule_mtr_read {\n+\tstruct rte_table_action_mtr_counters stats;\n+};\n+\n struct pipeline_msg_rsp {\n \tint status;\n \n@@ -621,6 +652,7 @@ struct pipeline_msg_rsp {\n \t\tstruct pipeline_msg_rsp_table_rule_add_default table_rule_add_default;\n \t\tstruct pipeline_msg_rsp_table_rule_add_bulk table_rule_add_bulk;\n \t\tstruct pipeline_msg_rsp_table_rule_stats_read table_rule_stats_read;\n+\t\tstruct pipeline_msg_rsp_table_rule_mtr_read table_rule_mtr_read;\n \t};\n };\n \n@@ -1626,6 +1658,239 @@ softnic_pipeline_table_rule_stats_read(struct pmd_internals *softnic,\n \treturn status;\n }\n \n+int\n+softnic_pipeline_table_mtr_profile_add(struct pmd_internals *softnic,\n+\tconst char *pipeline_name,\n+\tuint32_t table_id,\n+\tuint32_t meter_profile_id,\n+\tstruct rte_table_action_meter_profile *profile)\n+{\n+\tstruct pipeline *p;\n+\tstruct pipeline_msg_req *req;\n+\tstruct pipeline_msg_rsp *rsp;\n+\tint status;\n+\n+\t/* Check input params */\n+\tif (pipeline_name == NULL ||\n+\t\tprofile == NULL)\n+\t\treturn -1;\n+\n+\tp = softnic_pipeline_find(softnic, pipeline_name);\n+\tif (p == NULL ||\n+\t\ttable_id >= p->n_tables)\n+\t\treturn -1;\n+\n+\tif (!pipeline_is_running(p)) {\n+\t\tstruct rte_table_action *a = p->table[table_id].a;\n+\n+\t\tstatus = rte_table_action_meter_profile_add(a,\n+\t\t\tmeter_profile_id,\n+\t\t\tprofile);\n+\n+\t\treturn status;\n+\t}\n+\n+\t/* Allocate request */\n+\treq = pipeline_msg_alloc();\n+\tif (req == NULL)\n+\t\treturn -1;\n+\n+\t/* Write request */\n+\treq->type = PIPELINE_REQ_TABLE_MTR_PROFILE_ADD;\n+\treq->id = table_id;\n+\treq->table_mtr_profile_add.meter_profile_id = meter_profile_id;\n+\tmemcpy(&req->table_mtr_profile_add.profile, profile, sizeof(*profile));\n+\n+\t/* Send request and wait for response */\n+\trsp = pipeline_msg_send_recv(p, req);\n+\tif (rsp == NULL)\n+\t\treturn -1;\n+\n+\t/* Read response */\n+\tstatus = rsp->status;\n+\n+\t/* Free response */\n+\tpipeline_msg_free(rsp);\n+\n+\treturn status;\n+}\n+\n+int\n+softnic_pipeline_table_mtr_profile_delete(struct pmd_internals *softnic,\n+\tconst char *pipeline_name,\n+\tuint32_t table_id,\n+\tuint32_t meter_profile_id)\n+{\n+\tstruct pipeline *p;\n+\tstruct pipeline_msg_req *req;\n+\tstruct pipeline_msg_rsp *rsp;\n+\tint status;\n+\n+\t/* Check input params */\n+\tif (pipeline_name == NULL)\n+\t\treturn -1;\n+\n+\tp = softnic_pipeline_find(softnic, pipeline_name);\n+\tif (p == NULL ||\n+\t\ttable_id >= p->n_tables)\n+\t\treturn -1;\n+\n+\tif (!pipeline_is_running(p)) {\n+\t\tstruct rte_table_action *a = p->table[table_id].a;\n+\n+\t\tstatus = rte_table_action_meter_profile_delete(a,\n+\t\t\t\tmeter_profile_id);\n+\n+\t\treturn status;\n+\t}\n+\n+\t/* Allocate request */\n+\treq = pipeline_msg_alloc();\n+\tif (req == NULL)\n+\t\treturn -1;\n+\n+\t/* Write request */\n+\treq->type = PIPELINE_REQ_TABLE_MTR_PROFILE_DELETE;\n+\treq->id = table_id;\n+\treq->table_mtr_profile_delete.meter_profile_id = meter_profile_id;\n+\n+\t/* Send request and wait for response */\n+\trsp = pipeline_msg_send_recv(p, req);\n+\tif (rsp == NULL)\n+\t\treturn -1;\n+\n+\t/* Read response */\n+\tstatus = rsp->status;\n+\n+\t/* Free response */\n+\tpipeline_msg_free(rsp);\n+\n+\treturn status;\n+}\n+\n+int\n+softnic_pipeline_table_rule_mtr_read(struct pmd_internals *softnic,\n+\tconst char *pipeline_name,\n+\tuint32_t table_id,\n+\tvoid *data,\n+\tuint32_t tc_mask,\n+\tstruct rte_table_action_mtr_counters *stats,\n+\tint clear)\n+{\n+\tstruct pipeline *p;\n+\tstruct pipeline_msg_req *req;\n+\tstruct pipeline_msg_rsp *rsp;\n+\tint status;\n+\n+\t/* Check input params */\n+\tif (pipeline_name == NULL ||\n+\t\tdata == NULL ||\n+\t\tstats == NULL)\n+\t\treturn -1;\n+\n+\tp = softnic_pipeline_find(softnic, pipeline_name);\n+\tif (p == NULL ||\n+\t\ttable_id >= p->n_tables)\n+\t\treturn -1;\n+\n+\tif (!pipeline_is_running(p)) {\n+\t\tstruct rte_table_action *a = p->table[table_id].a;\n+\n+\t\tstatus = rte_table_action_meter_read(a,\n+\t\t\t\tdata,\n+\t\t\t\ttc_mask,\n+\t\t\t\tstats,\n+\t\t\t\tclear);\n+\n+\t\treturn status;\n+\t}\n+\n+\t/* Allocate request */\n+\treq = pipeline_msg_alloc();\n+\tif (req == NULL)\n+\t\treturn -1;\n+\n+\t/* Write request */\n+\treq->type = PIPELINE_REQ_TABLE_RULE_MTR_READ;\n+\treq->id = table_id;\n+\treq->table_rule_mtr_read.data = data;\n+\treq->table_rule_mtr_read.tc_mask = tc_mask;\n+\treq->table_rule_mtr_read.clear = clear;\n+\n+\t/* Send request and wait for response */\n+\trsp = pipeline_msg_send_recv(p, req);\n+\tif (rsp == NULL)\n+\t\treturn -1;\n+\n+\t/* Read response */\n+\tstatus = rsp->status;\n+\tif (status)\n+\t\tmemcpy(stats, &rsp->table_rule_mtr_read.stats, sizeof(*stats));\n+\n+\t/* Free response */\n+\tpipeline_msg_free(rsp);\n+\n+\treturn status;\n+}\n+\n+int\n+softnic_pipeline_table_dscp_table_update(struct pmd_internals *softnic,\n+\tconst char *pipeline_name,\n+\tuint32_t table_id,\n+\tuint64_t dscp_mask,\n+\tstruct rte_table_action_dscp_table *dscp_table)\n+{\n+\tstruct pipeline *p;\n+\tstruct pipeline_msg_req *req;\n+\tstruct pipeline_msg_rsp *rsp;\n+\tint status;\n+\n+\t/* Check input params */\n+\tif (pipeline_name == NULL ||\n+\t\tdscp_table == NULL)\n+\t\treturn -1;\n+\n+\tp = softnic_pipeline_find(softnic, pipeline_name);\n+\tif (p == NULL ||\n+\t\ttable_id >= p->n_tables)\n+\t\treturn -1;\n+\n+\tif (!pipeline_is_running(p)) {\n+\t\tstruct rte_table_action *a = p->table[table_id].a;\n+\n+\t\tstatus = rte_table_action_dscp_table_update(a,\n+\t\t\t\tdscp_mask,\n+\t\t\t\tdscp_table);\n+\n+\t\treturn status;\n+\t}\n+\n+\t/* Allocate request */\n+\treq = pipeline_msg_alloc();\n+\tif (req == NULL)\n+\t\treturn -1;\n+\n+\t/* Write request */\n+\treq->type = PIPELINE_REQ_TABLE_DSCP_TABLE_UPDATE;\n+\treq->id = table_id;\n+\treq->table_dscp_table_update.dscp_mask = dscp_mask;\n+\tmemcpy(&req->table_dscp_table_update.dscp_table,\n+\t\tdscp_table, sizeof(*dscp_table));\n+\n+\t/* Send request and wait for response */\n+\trsp = pipeline_msg_send_recv(p, req);\n+\tif (rsp == NULL)\n+\t\treturn -1;\n+\n+\t/* Read response */\n+\tstatus = rsp->status;\n+\n+\t/* Free response */\n+\tpipeline_msg_free(rsp);\n+\n+\treturn status;\n+}\n+\n /**\n  * Data plane threads: message handling\n  */\n@@ -2345,6 +2610,78 @@ pipeline_msg_handle_table_rule_stats_read(struct pipeline_data *p,\n \treturn rsp;\n }\n \n+static struct pipeline_msg_rsp *\n+pipeline_msg_handle_table_mtr_profile_add(struct pipeline_data *p,\n+\tstruct pipeline_msg_req *req)\n+{\n+\tstruct pipeline_msg_rsp *rsp = (struct pipeline_msg_rsp *)req;\n+\tuint32_t table_id = req->id;\n+\tuint32_t meter_profile_id = req->table_mtr_profile_add.meter_profile_id;\n+\tstruct rte_table_action_meter_profile *profile =\n+\t\t&req->table_mtr_profile_add.profile;\n+\tstruct rte_table_action *a = p->table_data[table_id].a;\n+\n+\trsp->status = rte_table_action_meter_profile_add(a,\n+\t\tmeter_profile_id,\n+\t\tprofile);\n+\n+\treturn rsp;\n+}\n+\n+static struct pipeline_msg_rsp *\n+pipeline_msg_handle_table_mtr_profile_delete(struct pipeline_data *p,\n+\tstruct pipeline_msg_req *req)\n+{\n+\tstruct pipeline_msg_rsp *rsp = (struct pipeline_msg_rsp *)req;\n+\tuint32_t table_id = req->id;\n+\tuint32_t meter_profile_id =\n+\t\treq->table_mtr_profile_delete.meter_profile_id;\n+\tstruct rte_table_action *a = p->table_data[table_id].a;\n+\n+\trsp->status = rte_table_action_meter_profile_delete(a,\n+\t\tmeter_profile_id);\n+\n+\treturn rsp;\n+}\n+\n+static struct pipeline_msg_rsp *\n+pipeline_msg_handle_table_rule_mtr_read(struct pipeline_data *p,\n+\tstruct pipeline_msg_req *req)\n+{\n+\tstruct pipeline_msg_rsp *rsp = (struct pipeline_msg_rsp *)req;\n+\tuint32_t table_id = req->id;\n+\tvoid *data = req->table_rule_mtr_read.data;\n+\tuint32_t tc_mask = req->table_rule_mtr_read.tc_mask;\n+\tint clear = req->table_rule_mtr_read.clear;\n+\tstruct rte_table_action *a = p->table_data[table_id].a;\n+\n+\trsp->status = rte_table_action_meter_read(a,\n+\t\tdata,\n+\t\ttc_mask,\n+\t\t&rsp->table_rule_mtr_read.stats,\n+\t\tclear);\n+\n+\treturn rsp;\n+}\n+\n+static struct pipeline_msg_rsp *\n+pipeline_msg_handle_table_dscp_table_update(struct pipeline_data *p,\n+\tstruct pipeline_msg_req *req)\n+{\n+\tstruct pipeline_msg_rsp *rsp = (struct pipeline_msg_rsp *)req;\n+\tuint32_t table_id = req->id;\n+\tuint64_t dscp_mask = req->table_dscp_table_update.dscp_mask;\n+\tstruct rte_table_action_dscp_table *dscp_table =\n+\t\t&req->table_dscp_table_update.dscp_table;\n+\tstruct rte_table_action *a = p->table_data[table_id].a;\n+\n+\trsp->status = rte_table_action_dscp_table_update(a,\n+\t\tdscp_mask,\n+\t\tdscp_table);\n+\n+\treturn rsp;\n+}\n+\n static void\n pipeline_msg_handle(struct pipeline_data *p)\n {\n@@ -2401,6 +2738,22 @@ pipeline_msg_handle(struct pipeline_data *p)\n \t\t\trsp = pipeline_msg_handle_table_rule_stats_read(p, req);\n \t\t\tbreak;\n \n+\t\tcase PIPELINE_REQ_TABLE_MTR_PROFILE_ADD:\n+\t\t\trsp = pipeline_msg_handle_table_mtr_profile_add(p, req);\n+\t\t\tbreak;\n+\n+\t\tcase PIPELINE_REQ_TABLE_MTR_PROFILE_DELETE:\n+\t\t\trsp = pipeline_msg_handle_table_mtr_profile_delete(p, req);\n+\t\t\tbreak;\n+\n+\t\tcase PIPELINE_REQ_TABLE_RULE_MTR_READ:\n+\t\t\trsp = pipeline_msg_handle_table_rule_mtr_read(p, req);\n+\t\t\tbreak;\n+\n+\t\tcase PIPELINE_REQ_TABLE_DSCP_TABLE_UPDATE:\n+\t\t\trsp = pipeline_msg_handle_table_dscp_table_update(p, req);\n+\t\t\tbreak;\n+\n \t\tdefault:\n \t\t\trsp = (struct pipeline_msg_rsp *)req;\n \t\t\trsp->status = -1;\n",
    "prefixes": [
        "v5",
        "18/23"
    ]
}