get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 41211,
    "url": "http://patches.dpdk.org/api/patches/41211/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180615165224.25004-18-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": "<20180615165224.25004-18-jasvinder.singh@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180615165224.25004-18-jasvinder.singh@intel.com",
    "date": "2018-06-15T16:52:19",
    "name": "[v2,17/22] net/softnic: add cli to read pipeline port and table stats",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "7d8731437804365ea34837db74df816a1e43d041",
    "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/20180615165224.25004-18-jasvinder.singh@intel.com/mbox/",
    "series": [
        {
            "id": 147,
            "url": "http://patches.dpdk.org/api/series/147/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=147",
            "date": "2018-06-15T16:52:03",
            "name": "[v2,01/22] net/softnic: restructuring",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/147/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/41211/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/41211/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 8CFF91C0C6;\n\tFri, 15 Jun 2018 18:53:17 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id 885101C030\n\tfor <dev@dpdk.org>; Fri, 15 Jun 2018 18:52:42 +0200 (CEST)",
            "from fmsmga006.fm.intel.com ([10.253.24.20])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t15 Jun 2018 09:52:42 -0700",
            "from silpixa00381635.ir.intel.com (HELO\n\tsilpixa00381635.ger.corp.intel.com) ([10.237.222.149])\n\tby fmsmga006.fm.intel.com with ESMTP; 15 Jun 2018 09:52:41 -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,227,1526367600\"; d=\"scan'208\";a=\"237791131\"",
        "From": "Jasvinder Singh <jasvinder.singh@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "cristian.dumitrescu@intel.com",
        "Date": "Fri, 15 Jun 2018 17:52:19 +0100",
        "Message-Id": "<20180615165224.25004-18-jasvinder.singh@intel.com>",
        "X-Mailer": "git-send-email 2.9.3",
        "In-Reply-To": "<20180615165224.25004-1-jasvinder.singh@intel.com>",
        "References": "<20180608124155.140663-2-jasvinder.singh@intel.com>\n\t<20180615165224.25004-1-jasvinder.singh@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2 17/22] net/softnic: add cli to read pipeline\n\tport and table stats",
        "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 to read port and table stats of 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       | 285 ++++++++++++++++++++\n drivers/net/softnic/rte_eth_softnic_internals.h |  29 +++\n drivers/net/softnic/rte_eth_softnic_thread.c    | 328 ++++++++++++++++++++++++\n 3 files changed, 642 insertions(+)",
    "diff": "diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c\nindex be5ad19..2a43a2f 100644\n--- a/drivers/net/softnic/rte_eth_softnic_cli.c\n+++ b/drivers/net/softnic/rte_eth_softnic_cli.c\n@@ -1488,6 +1488,85 @@ cmd_pipeline_port_in_table(struct pmd_internals *softnic,\n }\n \n /**\n+ * pipeline <pipeline_name> port in <port_id> stats read [clear]\n+ */\n+\n+#define MSG_PIPELINE_PORT_IN_STATS                         \\\n+\t\"Pkts in: %\" PRIu64 \"\\n\"                           \\\n+\t\"Pkts dropped by AH: %\" PRIu64 \"\\n\"                \\\n+\t\"Pkts dropped by other: %\" PRIu64 \"\\n\"\n+\n+static void\n+cmd_pipeline_port_in_stats(struct pmd_internals *softnic,\n+\tchar **tokens,\n+\tuint32_t n_tokens,\n+\tchar *out,\n+\tsize_t out_size)\n+{\n+\tstruct rte_pipeline_port_in_stats stats;\n+\tchar *pipeline_name;\n+\tuint32_t port_id;\n+\tint clear, status;\n+\n+\tif ((n_tokens != 7) && (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], \"port\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"port\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[3], \"in\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"in\");\n+\t\treturn;\n+\t}\n+\n+\tif (softnic_parser_read_uint32(&port_id, tokens[4]) != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"port_id\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[5], \"stats\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"stats\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[6], \"read\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"read\");\n+\t\treturn;\n+\t}\n+\n+\tclear = 0;\n+\tif (n_tokens == 8) {\n+\t\tif (strcmp(tokens[7], \"clear\") != 0) {\n+\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"clear\");\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tclear = 1;\n+\t}\n+\n+\tstatus = pipeline_port_in_stats_read(softnic,\n+\t\tpipeline_name,\n+\t\tport_id,\n+\t\t&stats,\n+\t\tclear);\n+\tif (status) {\n+\t\tsnprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);\n+\t\treturn;\n+\t}\n+\n+\tsnprintf(out, out_size, MSG_PIPELINE_PORT_IN_STATS,\n+\t\tstats.stats.n_pkts_in,\n+\t\tstats.n_pkts_dropped_by_ah,\n+\t\tstats.stats.n_pkts_drop);\n+}\n+\n+/**\n  * pipeline <pipeline_name> port in <port_id> enable\n  */\n static void\n@@ -1584,6 +1663,163 @@ cmd_pipeline_port_in_disable(struct pmd_internals *softnic,\n }\n \n /**\n+ * pipeline <pipeline_name> port out <port_id> stats read [clear]\n+ */\n+#define MSG_PIPELINE_PORT_OUT_STATS                        \\\n+\t\"Pkts in: %\" PRIu64 \"\\n\"                           \\\n+\t\"Pkts dropped by AH: %\" PRIu64 \"\\n\"                \\\n+\t\"Pkts dropped by other: %\" PRIu64 \"\\n\"\n+\n+static void\n+cmd_pipeline_port_out_stats(struct pmd_internals *softnic,\n+\tchar **tokens,\n+\tuint32_t n_tokens,\n+\tchar *out,\n+\tsize_t out_size)\n+{\n+\tstruct rte_pipeline_port_out_stats stats;\n+\tchar *pipeline_name;\n+\tuint32_t port_id;\n+\tint clear, status;\n+\n+\tif ((n_tokens != 7) && (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], \"port\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"port\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[3], \"out\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"out\");\n+\t\treturn;\n+\t}\n+\n+\tif (softnic_parser_read_uint32(&port_id, tokens[4]) != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"port_id\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[5], \"stats\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"stats\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[6], \"read\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"read\");\n+\t\treturn;\n+\t}\n+\n+\tclear = 0;\n+\tif (n_tokens == 8) {\n+\t\tif (strcmp(tokens[7], \"clear\") != 0) {\n+\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"clear\");\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tclear = 1;\n+\t}\n+\n+\tstatus = pipeline_port_out_stats_read(softnic,\n+\t\tpipeline_name,\n+\t\tport_id,\n+\t\t&stats,\n+\t\tclear);\n+\tif (status) {\n+\t\tsnprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);\n+\t\treturn;\n+\t}\n+\n+\tsnprintf(out, out_size, MSG_PIPELINE_PORT_OUT_STATS,\n+\t\tstats.stats.n_pkts_in,\n+\t\tstats.n_pkts_dropped_by_ah,\n+\t\tstats.stats.n_pkts_drop);\n+}\n+\n+/**\n+ * pipeline <pipeline_name> table <table_id> stats read [clear]\n+ */\n+#define MSG_PIPELINE_TABLE_STATS                                     \\\n+\t\"Pkts in: %\" PRIu64 \"\\n\"                                     \\\n+\t\"Pkts in with lookup miss: %\" PRIu64 \"\\n\"                    \\\n+\t\"Pkts in with lookup hit dropped by AH: %\" PRIu64 \"\\n\"       \\\n+\t\"Pkts in with lookup hit dropped by others: %\" PRIu64 \"\\n\"   \\\n+\t\"Pkts in with lookup miss dropped by AH: %\" PRIu64 \"\\n\"      \\\n+\t\"Pkts in with lookup miss dropped by others: %\" PRIu64 \"\\n\"\n+\n+static void\n+cmd_pipeline_table_stats(struct pmd_internals *softnic,\n+\tchar **tokens,\n+\tuint32_t n_tokens,\n+\tchar *out,\n+\tsize_t out_size)\n+{\n+\tstruct rte_pipeline_table_stats stats;\n+\tchar *pipeline_name;\n+\tuint32_t table_id;\n+\tint clear, status;\n+\n+\tif ((n_tokens != 6) && (n_tokens != 7)) {\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], \"stats\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"stats\");\n+\t\treturn;\n+\t}\n+\n+\tif (strcmp(tokens[5], \"read\") != 0) {\n+\t\tsnprintf(out, out_size, MSG_ARG_NOT_FOUND, \"read\");\n+\t\treturn;\n+\t}\n+\n+\tclear = 0;\n+\tif (n_tokens == 7) {\n+\t\tif (strcmp(tokens[6], \"clear\") != 0) {\n+\t\t\tsnprintf(out, out_size, MSG_ARG_INVALID, \"clear\");\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tclear = 1;\n+\t}\n+\n+\tstatus = pipeline_table_stats_read(softnic,\n+\t\tpipeline_name,\n+\t\ttable_id,\n+\t\t&stats,\n+\t\tclear);\n+\tif (status) {\n+\t\tsnprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);\n+\t\treturn;\n+\t}\n+\n+\tsnprintf(out, out_size, MSG_PIPELINE_TABLE_STATS,\n+\t\tstats.stats.n_pkts_in,\n+\t\tstats.stats.n_pkts_lookup_miss,\n+\t\tstats.n_pkts_dropped_by_lkp_hit_ah,\n+\t\tstats.n_pkts_dropped_lkp_hit,\n+\t\tstats.n_pkts_dropped_by_lkp_miss_ah,\n+\t\tstats.n_pkts_dropped_lkp_miss);\n+}\n+\n+/**\n  * <match> ::=\n  *\n  * match\n@@ -3167,6 +3403,19 @@ cmd_pipeline_table_rule_delete_default(struct pmd_internals *softnic,\n }\n \n /**\n+ * pipeline <pipeline_name> table <table_id> rule read stats [clear]\n+ */\n+static void\n+cmd_pipeline_table_rule_stats_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  * thread <thread_id> pipeline <pipeline_name> enable\n  */\n static void\n@@ -3345,6 +3594,15 @@ cli_process(char *in, char *out, size_t out_size, void *arg)\n \t\tif ((n_tokens >= 6) &&\n \t\t\t(strcmp(tokens[2], \"port\") == 0) &&\n \t\t\t(strcmp(tokens[3], \"in\") == 0) &&\n+\t\t\t(strcmp(tokens[5], \"stats\") == 0)) {\n+\t\t\tcmd_pipeline_port_in_stats(softnic, tokens, n_tokens,\n+\t\t\t\tout, out_size);\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tif ((n_tokens >= 6) &&\n+\t\t\t(strcmp(tokens[2], \"port\") == 0) &&\n+\t\t\t(strcmp(tokens[3], \"in\") == 0) &&\n \t\t\t(strcmp(tokens[5], \"enable\") == 0)) {\n \t\t\tcmd_pipeline_port_in_enable(softnic, tokens, n_tokens,\n \t\t\t\tout, out_size);\n@@ -3360,6 +3618,23 @@ cli_process(char *in, char *out, size_t out_size, void *arg)\n \t\t\treturn;\n \t\t}\n \n+\t\tif ((n_tokens >= 6) &&\n+\t\t\t(strcmp(tokens[2], \"port\") == 0) &&\n+\t\t\t(strcmp(tokens[3], \"out\") == 0) &&\n+\t\t\t(strcmp(tokens[5], \"stats\") == 0)) {\n+\t\t\tcmd_pipeline_port_out_stats(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], \"stats\") == 0)) {\n+\t\t\tcmd_pipeline_table_stats(softnic, tokens, n_tokens,\n+\t\t\t\tout, 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@@ -3403,6 +3678,16 @@ 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 >= 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], \"stats\") == 0)) {\n+\t\t\tcmd_pipeline_table_rule_stats_read(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 d1dadd0..bdef7e5 100644\n--- a/drivers/net/softnic/rte_eth_softnic_internals.h\n+++ b/drivers/net/softnic/rte_eth_softnic_internals.h\n@@ -778,6 +778,13 @@ struct table_rule_action {\n };\n \n int\n+pipeline_port_in_stats_read(struct pmd_internals *p,\n+\tconst char *pipeline_name,\n+\tuint32_t port_id,\n+\tstruct rte_pipeline_port_in_stats *stats,\n+\tint clear);\n+\n+int\n pipeline_port_in_enable(struct pmd_internals *p,\n \tconst char *pipeline_name,\n \tuint32_t port_id);\n@@ -788,6 +795,20 @@ pipeline_port_in_disable(struct pmd_internals *p,\n \tuint32_t port_id);\n \n int\n+pipeline_port_out_stats_read(struct pmd_internals *p,\n+\tconst char *pipeline_name,\n+\tuint32_t port_id,\n+\tstruct rte_pipeline_port_out_stats *stats,\n+\tint clear);\n+\n+int\n+pipeline_table_stats_read(struct pmd_internals *p,\n+\tconst char *pipeline_name,\n+\tuint32_t table_id,\n+\tstruct rte_pipeline_table_stats *stats,\n+\tint clear);\n+\n+int\n pipeline_table_rule_add(struct pmd_internals *p,\n \tconst char *pipeline_name,\n \tuint32_t table_id,\n@@ -822,6 +843,14 @@ pipeline_table_rule_delete_default(struct pmd_internals *p,\n \tconst char *pipeline_name,\n \tuint32_t table_id);\n \n+int\n+pipeline_table_rule_stats_read(struct pmd_internals *p,\n+\tconst char *pipeline_name,\n+\tuint32_t table_id,\n+\tvoid *data,\n+\tstruct rte_table_action_stats_counters *stats,\n+\tint clear);\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 ff8bf39..bb63b49 100644\n--- a/drivers/net/softnic/rte_eth_softnic_thread.c\n+++ b/drivers/net/softnic/rte_eth_softnic_thread.c\n@@ -488,19 +488,37 @@ thread_msg_handle(struct thread_data *t)\n  */\n enum pipeline_req_type {\n \t/* Port IN */\n+\tPIPELINE_REQ_PORT_IN_STATS_READ,\n \tPIPELINE_REQ_PORT_IN_ENABLE,\n \tPIPELINE_REQ_PORT_IN_DISABLE,\n \n+\t/* Port OUT */\n+\tPIPELINE_REQ_PORT_OUT_STATS_READ,\n+\n \t/* Table */\n+\tPIPELINE_REQ_TABLE_STATS_READ,\n \tPIPELINE_REQ_TABLE_RULE_ADD,\n \tPIPELINE_REQ_TABLE_RULE_ADD_DEFAULT,\n \tPIPELINE_REQ_TABLE_RULE_ADD_BULK,\n \tPIPELINE_REQ_TABLE_RULE_DELETE,\n \tPIPELINE_REQ_TABLE_RULE_DELETE_DEFAULT,\n+\tPIPELINE_REQ_TABLE_RULE_STATS_READ,\n \n \tPIPELINE_REQ_MAX\n };\n \n+struct pipeline_msg_req_port_in_stats_read {\n+\tint clear;\n+};\n+\n+struct pipeline_msg_req_port_out_stats_read {\n+\tint clear;\n+};\n+\n+struct pipeline_msg_req_table_stats_read {\n+\tint clear;\n+};\n+\n struct pipeline_msg_req_table_rule_add {\n \tstruct table_rule_match match;\n \tstruct table_rule_action action;\n@@ -522,19 +540,40 @@ struct pipeline_msg_req_table_rule_delete {\n \tstruct table_rule_match match;\n };\n \n+struct pipeline_msg_req_table_rule_stats_read {\n+\tvoid *data;\n+\tint clear;\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 \n \tRTE_STD_C11\n \tunion {\n+\t\tstruct pipeline_msg_req_port_in_stats_read port_in_stats_read;\n+\t\tstruct pipeline_msg_req_port_out_stats_read port_out_stats_read;\n+\t\tstruct pipeline_msg_req_table_stats_read table_stats_read;\n \t\tstruct pipeline_msg_req_table_rule_add table_rule_add;\n \t\tstruct pipeline_msg_req_table_rule_add_default table_rule_add_default;\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};\n };\n \n+struct pipeline_msg_rsp_port_in_stats_read {\n+\tstruct rte_pipeline_port_in_stats stats;\n+};\n+\n+struct pipeline_msg_rsp_port_out_stats_read {\n+\tstruct rte_pipeline_port_out_stats stats;\n+};\n+\n+struct pipeline_msg_rsp_table_stats_read {\n+\tstruct rte_pipeline_table_stats stats;\n+};\n+\n struct pipeline_msg_rsp_table_rule_add {\n \tvoid *data;\n };\n@@ -547,14 +586,22 @@ struct pipeline_msg_rsp_table_rule_add_bulk {\n \tuint32_t n_rules;\n };\n \n+struct pipeline_msg_rsp_table_rule_stats_read {\n+\tstruct rte_table_action_stats_counters stats;\n+};\n+\n struct pipeline_msg_rsp {\n \tint status;\n \n \tRTE_STD_C11\n \tunion {\n+\t\tstruct pipeline_msg_rsp_port_in_stats_read port_in_stats_read;\n+\t\tstruct pipeline_msg_rsp_port_out_stats_read port_out_stats_read;\n+\t\tstruct pipeline_msg_rsp_table_stats_read table_stats_read;\n \t\tstruct pipeline_msg_rsp_table_rule_add table_rule_add;\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};\n };\n \n@@ -599,6 +646,55 @@ pipeline_msg_send_recv(struct pipeline *p,\n }\n \n int\n+pipeline_port_in_stats_read(struct pmd_internals *softnic,\n+\tconst char *pipeline_name,\n+\tuint32_t port_id,\n+\tstruct rte_pipeline_port_in_stats *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(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(port_id >= p->n_ports_in))\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_PORT_IN_STATS_READ;\n+\treq->id = port_id;\n+\treq->port_in_stats_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->port_in_stats_read.stats, sizeof(*stats));\n+\n+\t/* Free response */\n+\tpipeline_msg_free(rsp);\n+\n+\treturn status;\n+}\n+\n+int\n pipeline_port_in_enable(struct pmd_internals *softnic,\n \tconst char *pipeline_name,\n \tuint32_t port_id)\n@@ -684,6 +780,104 @@ pipeline_port_in_disable(struct pmd_internals *softnic,\n \treturn status;\n }\n \n+int\n+pipeline_port_out_stats_read(struct pmd_internals *softnic,\n+\tconst char *pipeline_name,\n+\tuint32_t port_id,\n+\tstruct rte_pipeline_port_out_stats *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(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(port_id >= p->n_ports_out))\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_PORT_OUT_STATS_READ;\n+\treq->id = port_id;\n+\treq->port_out_stats_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->port_out_stats_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_stats_read(struct pmd_internals *softnic,\n+\tconst char *pipeline_name,\n+\tuint32_t table_id,\n+\tstruct rte_pipeline_table_stats *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(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_STATS_READ;\n+\treq->id = table_id;\n+\treq->table_stats_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_stats_read.stats, sizeof(*stats));\n+\n+\t/* Free response */\n+\tpipeline_msg_free(rsp);\n+\n+\treturn status;\n+}\n+\n static int\n match_check(struct table_rule_match *match,\n \tstruct pipeline *p,\n@@ -1108,6 +1302,58 @@ pipeline_table_rule_delete_default(struct pmd_internals *softnic,\n \treturn status;\n }\n \n+int\n+pipeline_table_rule_stats_read(struct pmd_internals *softnic,\n+\tconst char *pipeline_name,\n+\tuint32_t table_id,\n+\tvoid *data,\n+\tstruct rte_table_action_stats_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_STATS_READ;\n+\treq->id = table_id;\n+\treq->table_rule_stats_read.data = data;\n+\treq->table_rule_stats_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_stats_read.stats, sizeof(*stats));\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@@ -1136,6 +1382,22 @@ pipeline_msg_send(struct rte_ring *msgq_rsp,\n }\n \n static struct pipeline_msg_rsp *\n+pipeline_msg_handle_port_in_stats_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 port_id = req->id;\n+\tint clear = req->port_in_stats_read.clear;\n+\n+\trsp->status = rte_pipeline_port_in_stats_read(p->p,\n+\t\tport_id,\n+\t\t&rsp->port_in_stats_read.stats,\n+\t\tclear);\n+\n+\treturn rsp;\n+}\n+\n+static struct pipeline_msg_rsp *\n pipeline_msg_handle_port_in_enable(struct pipeline_data *p,\n \tstruct pipeline_msg_req *req)\n {\n@@ -1161,6 +1423,38 @@ pipeline_msg_handle_port_in_disable(struct pipeline_data *p,\n \treturn rsp;\n }\n \n+static struct pipeline_msg_rsp *\n+pipeline_msg_handle_port_out_stats_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 port_id = req->id;\n+\tint clear = req->port_out_stats_read.clear;\n+\n+\trsp->status = rte_pipeline_port_out_stats_read(p->p,\n+\t\tport_id,\n+\t\t&rsp->port_out_stats_read.stats,\n+\t\tclear);\n+\n+\treturn rsp;\n+}\n+\n+static struct pipeline_msg_rsp *\n+pipeline_msg_handle_table_stats_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 port_id = req->id;\n+\tint clear = req->table_stats_read.clear;\n+\n+\trsp->status = rte_pipeline_table_stats_read(p->p,\n+\t\tport_id,\n+\t\t&rsp->table_stats_read.stats,\n+\t\tclear);\n+\n+\treturn rsp;\n+}\n+\n union table_rule_match_low_level {\n \tstruct rte_table_acl_rule_add_params acl_add;\n \tstruct rte_table_acl_rule_delete_params acl_delete;\n@@ -1865,6 +2159,24 @@ pipeline_msg_handle_table_rule_delete_default(struct pipeline_data *p,\n \treturn rsp;\n }\n \n+static struct pipeline_msg_rsp *\n+pipeline_msg_handle_table_rule_stats_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_stats_read.data;\n+\tint clear = req->table_rule_stats_read.clear;\n+\tstruct rte_table_action *a = p->table_data[table_id].a;\n+\n+\trsp->status = rte_table_action_stats_read(a,\n+\t\tdata,\n+\t\t&rsp->table_rule_stats_read.stats,\n+\t\tclear);\n+\n+\treturn rsp;\n+}\n+\n static void\n pipeline_msg_handle(struct pipeline_data *p)\n {\n@@ -1877,6 +2189,10 @@ pipeline_msg_handle(struct pipeline_data *p)\n \t\t\tbreak;\n \n \t\tswitch (req->type) {\n+\t\tcase PIPELINE_REQ_PORT_IN_STATS_READ:\n+\t\t\trsp = pipeline_msg_handle_port_in_stats_read(p, req);\n+\t\t\tbreak;\n+\n \t\tcase PIPELINE_REQ_PORT_IN_ENABLE:\n \t\t\trsp = pipeline_msg_handle_port_in_enable(p, req);\n \t\t\tbreak;\n@@ -1885,6 +2201,14 @@ pipeline_msg_handle(struct pipeline_data *p)\n \t\t\trsp = pipeline_msg_handle_port_in_disable(p, req);\n \t\t\tbreak;\n \n+\t\tcase PIPELINE_REQ_PORT_OUT_STATS_READ:\n+\t\t\trsp = pipeline_msg_handle_port_out_stats_read(p, req);\n+\t\t\tbreak;\n+\n+\t\tcase PIPELINE_REQ_TABLE_STATS_READ:\n+\t\t\trsp = pipeline_msg_handle_table_stats_read(p, req);\n+\t\t\tbreak;\n+\n \t\tcase PIPELINE_REQ_TABLE_RULE_ADD:\n \t\t\trsp = pipeline_msg_handle_table_rule_add(p, req);\n \t\t\tbreak;\n@@ -1905,6 +2229,10 @@ pipeline_msg_handle(struct pipeline_data *p)\n \t\t\trsp = pipeline_msg_handle_table_rule_delete_default(p, req);\n \t\t\tbreak;\n \n+\t\tcase PIPELINE_REQ_TABLE_RULE_STATS_READ:\n+\t\t\trsp = pipeline_msg_handle_table_rule_stats_read(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": [
        "v2",
        "17/22"
    ]
}