get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 40844,
    "url": "http://patchwork.dpdk.org/api/patches/40844/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20180608124155.140663-19-jasvinder.singh@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": "<20180608124155.140663-19-jasvinder.singh@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180608124155.140663-19-jasvinder.singh@intel.com",
    "date": "2018-06-08T12:41:52",
    "name": "[dpdk-dev,18/21] net/softnic: add cli for meter action",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "0d9abb4616c9b94b045f8d5df8c5f5511debca27",
    "submitter": {
        "id": 285,
        "url": "http://patchwork.dpdk.org/api/people/285/?format=api",
        "name": "Jasvinder Singh",
        "email": "jasvinder.singh@intel.com"
    },
    "delegate": {
        "id": 10018,
        "url": "http://patchwork.dpdk.org/api/users/10018/?format=api",
        "username": "cristian_dumitrescu",
        "first_name": "Cristian",
        "last_name": "Dumitrescu",
        "email": "cristian.dumitrescu@intel.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20180608124155.140663-19-jasvinder.singh@intel.com/mbox/",
    "series": [
        {
            "id": 52,
            "url": "http://patchwork.dpdk.org/api/series/52/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=52",
            "date": "2018-06-08T12:41:35",
            "name": "[dpdk-dev,01/21] net/softnic: restructuring",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/52/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/40844/comments/",
    "check": "fail",
    "checks": "http://patchwork.dpdk.org/api/patches/40844/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 1F2B87EC8;\n\tFri,  8 Jun 2018 14:42:48 +0200 (CEST)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id 93B1771B5\n\tfor <dev@dpdk.org>; Fri,  8 Jun 2018 14:42:18 +0200 (CEST)",
            "from fmsmga005.fm.intel.com ([10.253.24.32])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t08 Jun 2018 05:42:17 -0700",
            "from silpixa00381635.ir.intel.com (HELO\n\tsilpixa00381635.ger.corp.intel.com) ([10.237.222.149])\n\tby fmsmga005.fm.intel.com with ESMTP; 08 Jun 2018 05:42:16 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.49,490,1520924400\"; d=\"scan'208\";a=\"235505395\"",
        "From": "Jasvinder Singh <jasvinder.singh@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "cristian.dumitrescu@intel.com",
        "Date": "Fri,  8 Jun 2018 13:41:52 +0100",
        "Message-Id": "<20180608124155.140663-19-jasvinder.singh@intel.com>",
        "X-Mailer": "git-send-email 2.9.3",
        "In-Reply-To": "<20180608124155.140663-1-jasvinder.singh@intel.com>",
        "References": "<20180608124155.140663-1-jasvinder.singh@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 18/21] 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://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": "<https://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": "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    | 318 +++++++++++++++++-\n 3 files changed, 764 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 706097f..4d7ef92 100644\n--- a/drivers/net/softnic/rte_eth_softnic_cli.c\n+++ b/drivers/net/softnic/rte_eth_softnic_cli.c\n@@ -3397,6 +3397,386 @@ cmd_pipeline_table_rule_stats_read(struct pmd_internals *softnic __rte_unused,\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 (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 (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 (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 (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 (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 (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 (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 (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 (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 = 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 (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 (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 = 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\t(file_name == NULL) ||\n+\t\t(line_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 (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\t(n_tokens != RTE_DIM(tokens)) ||\n+\t\t\tparser_read_uint32(&tc_id, tokens[0]) ||\n+\t\t\t(tc_id >= RTE_TABLE_ACTION_TC_MAX) ||\n+\t\t\tparser_read_uint32(&tc_queue_id, tokens[1]) ||\n+\t\t\t(tc_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 (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 = 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@@ -3669,6 +4049,44 @@ 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 dad905a..97de98e 100644\n--- a/drivers/net/softnic/rte_eth_softnic_internals.h\n+++ b/drivers/net/softnic/rte_eth_softnic_internals.h\n@@ -851,6 +851,35 @@ pipeline_table_rule_stats_read(struct pmd_internals *p,\n \tstruct rte_table_action_stats_counters *stats,\n \tint clear);\n \n+int\n+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+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+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+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 13df606..eb66376 100644\n--- a/drivers/net/softnic/rte_eth_softnic_thread.c\n+++ b/drivers/net/softnic/rte_eth_softnic_thread.c\n@@ -503,7 +503,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@@ -545,6 +548,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@@ -559,6 +582,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@@ -590,6 +617,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@@ -602,6 +633,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@@ -1354,6 +1386,202 @@ pipeline_table_rule_stats_read(struct pmd_internals *softnic,\n \treturn status;\n }\n \n+int\n+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\t(profile == NULL))\n+\t\treturn -1;\n+\n+\tp = pipeline_find(softnic, pipeline_name);\n+\tif ((p == NULL) ||\n+\t\t(p->enabled == 0) ||\n+\t\t(table_id >= p->n_tables))\n+\t\treturn -1;\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+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 = pipeline_find(softnic, pipeline_name);\n+\tif ((p == NULL) ||\n+\t\t(p->enabled == 0) ||\n+\t\t(table_id >= p->n_tables))\n+\t\treturn -1;\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+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\t(data == NULL) ||\n+\t\t(stats == NULL))\n+\t\treturn -1;\n+\n+\tp = pipeline_find(softnic, pipeline_name);\n+\tif ((p == NULL) ||\n+\t\t(p->enabled == 0) ||\n+\t\t(table_id >= p->n_tables))\n+\t\treturn -1;\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+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\t(dscp_table == NULL))\n+\t\treturn -1;\n+\n+\tp = pipeline_find(softnic, pipeline_name);\n+\tif ((p == NULL) ||\n+\t\t(p->enabled == 0) ||\n+\t\t(table_id >= p->n_tables))\n+\t\treturn -1;\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@@ -2176,6 +2404,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@@ -2232,6 +2532,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": [
        "dpdk-dev",
        "18/21"
    ]
}