get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 42558,
    "url": "http://patches.dpdk.org/api/patches/42558/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180706172116.50951-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": "<20180706172116.50951-18-jasvinder.singh@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180706172116.50951-18-jasvinder.singh@intel.com",
    "date": "2018-07-06T17:21:10",
    "name": "[v5,17/23] net/softnic: add cli to read stats",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "87c542d1e321bda84a1ef6e2acbdfa4f509645bd",
    "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-18-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/42558/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/42558/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 8C9A61BFEB;\n\tFri,  6 Jul 2018 19:22:14 +0200 (CEST)",
            "from mga05.intel.com (mga05.intel.com [192.55.52.43])\n\tby dpdk.org (Postfix) with ESMTP id 7BE141BFCE\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:38 -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=\"64955378\"",
        "From": "Jasvinder Singh <jasvinder.singh@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "cristian.dumitrescu@intel.com",
        "Date": "Fri,  6 Jul 2018 18:21:10 +0100",
        "Message-Id": "<20180706172116.50951-18-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 17/23] net/softnic: add cli to read 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://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 to read port and table stats of\nsoftnic 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       | 288 +++++++++++++++++++\n drivers/net/softnic/rte_eth_softnic_internals.h |  29 ++\n drivers/net/softnic/rte_eth_softnic_thread.c    | 362 ++++++++++++++++++++++++\n 3 files changed, 679 insertions(+)",
    "diff": "diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c\nindex 59688ff..2b445b6 100644\n--- a/drivers/net/softnic/rte_eth_softnic_cli.c\n+++ b/drivers/net/softnic/rte_eth_softnic_cli.c\n@@ -1500,6 +1500,86 @@ 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+\t\tn_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 = softnic_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@@ -1596,6 +1676,165 @@ cmd_softnic_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+\t\tn_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 = softnic_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+\t\tn_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 = softnic_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@@ -3189,6 +3428,19 @@ cmd_softnic_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_softnic_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@@ -3367,6 +3619,15 @@ softnic_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_softnic_pipeline_port_in_enable(softnic, tokens, n_tokens,\n \t\t\t\tout, out_size);\n@@ -3382,6 +3643,23 @@ softnic_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@@ -3425,6 +3703,16 @@ 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 >= 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_softnic_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 6593b30..d4d9612 100644\n--- a/drivers/net/softnic/rte_eth_softnic_internals.h\n+++ b/drivers/net/softnic/rte_eth_softnic_internals.h\n@@ -765,6 +765,13 @@ struct softnic_table_rule_action {\n };\n \n int\n+softnic_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 softnic_pipeline_port_in_enable(struct pmd_internals *p,\n \tconst char *pipeline_name,\n \tuint32_t port_id);\n@@ -775,6 +782,20 @@ softnic_pipeline_port_in_disable(struct pmd_internals *p,\n \tuint32_t port_id);\n \n int\n+softnic_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+softnic_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 softnic_pipeline_table_rule_add(struct pmd_internals *p,\n \tconst char *pipeline_name,\n \tuint32_t table_id,\n@@ -809,6 +830,14 @@ softnic_pipeline_table_rule_delete_default(struct pmd_internals *p,\n \tconst char *pipeline_name,\n \tuint32_t table_id);\n \n+int\n+softnic_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 07cbf97..f0754fd 100644\n--- a/drivers/net/softnic/rte_eth_softnic_thread.c\n+++ b/drivers/net/softnic/rte_eth_softnic_thread.c\n@@ -507,19 +507,37 @@ thread_msg_handle(struct softnic_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 softnic_table_rule_match match;\n \tstruct softnic_table_rule_action action;\n@@ -541,19 +559,40 @@ struct pipeline_msg_req_table_rule_delete {\n \tstruct softnic_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@@ -566,14 +605,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@@ -618,6 +665,63 @@ pipeline_msg_send_recv(struct pipeline *p,\n }\n \n int\n+softnic_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\tstats == NULL)\n+\t\treturn -1;\n+\n+\tp = softnic_pipeline_find(softnic, pipeline_name);\n+\tif (p == NULL ||\n+\t\tport_id >= p->n_ports_in)\n+\t\treturn -1;\n+\n+\tif (!pipeline_is_running(p)) {\n+\t\tstatus = rte_pipeline_port_in_stats_read(p->p,\n+\t\t\tport_id,\n+\t\t\tstats,\n+\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_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 softnic_pipeline_port_in_enable(struct pmd_internals *softnic,\n \tconst char *pipeline_name,\n \tuint32_t port_id)\n@@ -711,6 +815,120 @@ softnic_pipeline_port_in_disable(struct pmd_internals *softnic,\n \treturn status;\n }\n \n+int\n+softnic_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\tstats == NULL)\n+\t\treturn -1;\n+\n+\tp = softnic_pipeline_find(softnic, pipeline_name);\n+\tif (p == NULL ||\n+\t\tport_id >= p->n_ports_out)\n+\t\treturn -1;\n+\n+\tif (!pipeline_is_running(p)) {\n+\t\tstatus = rte_pipeline_port_out_stats_read(p->p,\n+\t\t\tport_id,\n+\t\t\tstats,\n+\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_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+softnic_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\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\tstatus = rte_pipeline_table_stats_read(p->p,\n+\t\t\ttable_id,\n+\t\t\tstats,\n+\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_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 softnic_table_rule_match *match,\n \tstruct pipeline *p,\n@@ -1346,6 +1564,68 @@ softnic_pipeline_table_rule_delete_default(struct pmd_internals *softnic,\n \treturn status;\n }\n \n+int\n+softnic_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\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_stats_read(a,\n+\t\t\tdata,\n+\t\t\tstats,\n+\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_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@@ -1374,6 +1654,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@@ -1399,6 +1695,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 static int\n match_convert_ipv6_depth(uint32_t depth, uint32_t *depth32)\n {\n@@ -1999,6 +2327,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@@ -2011,6 +2357,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@@ -2019,6 +2369,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@@ -2039,6 +2397,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": [
        "v5",
        "17/23"
    ]
}