Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/44875/?format=api
http://patches.dpdk.org/api/patches/44875/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180918165835.107593-10-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": "<20180918165835.107593-10-jasvinder.singh@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20180918165835.107593-10-jasvinder.singh@intel.com", "date": "2018-09-18T16:58:34", "name": "[v4,09/10] net/softnic: meter stats read", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "8ab35b8e32f7a0d4a0c9cb2ec19599a89cd39f4b", "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/20180918165835.107593-10-jasvinder.singh@intel.com/mbox/", "series": [ { "id": 1374, "url": "http://patches.dpdk.org/api/series/1374/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=1374", "date": "2018-09-18T16:58:25", "name": "net/softnic: implement metering and policing API", "version": 4, "mbox": "http://patches.dpdk.org/series/1374/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/44875/comments/", "check": "fail", "checks": "http://patches.dpdk.org/api/patches/44875/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 C8CBC5F35;\n\tTue, 18 Sep 2018 18:59:03 +0200 (CEST)", "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id 8016E5B16\n\tfor <dev@dpdk.org>; Tue, 18 Sep 2018 18:58:49 +0200 (CEST)", "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t18 Sep 2018 09:58:46 -0700", "from silpixa00381635.ir.intel.com (HELO\n\tsilpixa00381635.ger.corp.intel.com) ([10.237.222.149])\n\tby fmsmga002.fm.intel.com with ESMTP; 18 Sep 2018 09:58:44 -0700" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.53,390,1531810800\"; d=\"scan'208\";a=\"87194004\"", "From": "Jasvinder Singh <jasvinder.singh@intel.com>", "To": "dev@dpdk.org", "Cc": "cristian.dumitrescu@intel.com", "Date": "Tue, 18 Sep 2018 17:58:34 +0100", "Message-Id": "<20180918165835.107593-10-jasvinder.singh@intel.com>", "X-Mailer": "git-send-email 2.9.3", "In-Reply-To": "<20180918165835.107593-1-jasvinder.singh@intel.com>", "References": "<20180914174554.90135-2-jasvinder.singh@intel.com>\n\t<20180918165835.107593-1-jasvinder.singh@intel.com>", "Subject": "[dpdk-dev] [PATCH v4 09/10] net/softnic: meter stats read", "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": "Implement meter object stats read function.\n\nSigned-off-by: Jasvinder Singh <jasvinder.singh@intel.com>\n---\n drivers/net/softnic/rte_eth_softnic_meter.c | 136 +++++++++++++++++++++++++++-\n 1 file changed, 135 insertions(+), 1 deletion(-)", "diff": "diff --git a/drivers/net/softnic/rte_eth_softnic_meter.c b/drivers/net/softnic/rte_eth_softnic_meter.c\nindex 05d54d4..73ecf3b 100644\n--- a/drivers/net/softnic/rte_eth_softnic_meter.c\n+++ b/drivers/net/softnic/rte_eth_softnic_meter.c\n@@ -574,6 +574,140 @@ pmd_mtr_policer_actions_update(struct rte_eth_dev *dev,\n \treturn 0;\n }\n \n+#define MTR_STATS_PKTS_DEFAULT (RTE_MTR_STATS_N_PKTS_GREEN | \\\n+\t\t\t\tRTE_MTR_STATS_N_PKTS_YELLOW | \\\n+\t\t\t\tRTE_MTR_STATS_N_PKTS_RED | \\\n+\t\t\t\tRTE_MTR_STATS_N_PKTS_DROPPED)\n+\n+#define MTR_STATS_BYTES_DEFAULT (RTE_MTR_STATS_N_BYTES_GREEN | \\\n+\t\t\t\tRTE_MTR_STATS_N_BYTES_YELLOW | \\\n+\t\t\t\tRTE_MTR_STATS_N_BYTES_RED | \\\n+\t\t\t\tRTE_MTR_STATS_N_BYTES_DROPPED)\n+\n+/* MTR object stats read */\n+static void\n+mtr_stats_convert(struct softnic_mtr *m,\n+\tstruct rte_table_action_mtr_counters_tc *in,\n+\tstruct rte_mtr_stats *out,\n+\tuint64_t *out_mask)\n+{\n+\tmemset(&out, 0, sizeof(out));\n+\t*out_mask = 0;\n+\n+\tif (in->n_packets_valid) {\n+\t\tuint32_t i;\n+\n+\t\tfor (i = 0; i < RTE_MTR_COLORS; i++) {\n+\t\t\tif (m->params.action[i] == MTR_POLICER_ACTION_COLOR_GREEN)\n+\t\t\t\tout->n_pkts[RTE_MTR_GREEN] += in->n_packets[i];\n+\n+\t\t\tif (m->params.action[i] == MTR_POLICER_ACTION_COLOR_YELLOW)\n+\t\t\t\tout->n_pkts[RTE_MTR_YELLOW] += in->n_packets[i];\n+\n+\t\t\tif (m->params.action[i] == MTR_POLICER_ACTION_COLOR_RED)\n+\t\t\t\tout->n_pkts[RTE_MTR_RED] += in->n_packets[i];\n+\n+\t\t\tif (m->params.action[i] == MTR_POLICER_ACTION_DROP)\n+\t\t\t\tout->n_pkts_dropped += in->n_packets[i];\n+\t\t}\n+\n+\t\t*out_mask |= MTR_STATS_PKTS_DEFAULT;\n+\t}\n+\n+\tif (in->n_bytes_valid) {\n+\t\tuint32_t i;\n+\n+\t\tfor (i = 0; i < RTE_MTR_COLORS; i++) {\n+\t\t\tif (m->params.action[i] == MTR_POLICER_ACTION_COLOR_GREEN)\n+\t\t\t\tout->n_bytes[RTE_MTR_GREEN] += in->n_bytes[i];\n+\n+\t\t\tif (m->params.action[i] == MTR_POLICER_ACTION_COLOR_YELLOW)\n+\t\t\t\tout->n_bytes[RTE_MTR_YELLOW] += in->n_bytes[i];\n+\n+\t\t\tif (m->params.action[i] == MTR_POLICER_ACTION_COLOR_RED)\n+\t\t\t\tout->n_bytes[RTE_MTR_RED] += in->n_bytes[i];\n+\n+\t\t\tif (m->params.action[i] == MTR_POLICER_ACTION_DROP)\n+\t\t\t\tout->n_bytes_dropped += in->n_bytes[i];\n+\t\t}\n+\n+\t\t*out_mask |= MTR_STATS_BYTES_DEFAULT;\n+\t}\n+}\n+\n+/* MTR object stats read */\n+static int\n+pmd_mtr_stats_read(struct rte_eth_dev *dev,\n+\tuint32_t mtr_id,\n+\tstruct rte_mtr_stats *stats,\n+\tuint64_t *stats_mask,\n+\tint clear,\n+\tstruct rte_mtr_error *error)\n+{\n+\tstruct pmd_internals *p = dev->data->dev_private;\n+\tstruct rte_table_action_mtr_counters counters;\n+\tstruct pipeline *pipeline;\n+\tstruct softnic_table *table;\n+\tstruct softnic_mtr *m;\n+\tint status;\n+\n+\t/* MTR object id must be valid */\n+\tm = softnic_mtr_find(p, mtr_id);\n+\tif (m == NULL)\n+\t\treturn -rte_mtr_error_set(error,\n+\t\t\tEEXIST,\n+\t\t\tRTE_MTR_ERROR_TYPE_MTR_ID,\n+\t\t\tNULL,\n+\t\t\t\"MTR object id not valid\");\n+\n+\t/* MTR meter object owner valid? */\n+\tif (m->flow == NULL) {\n+\t\tif (stats != NULL)\n+\t\t\tmemset(stats, 0, sizeof(*stats));\n+\n+\t\tif (stats_mask)\n+\t\t\t*stats_mask = MTR_STATS_PKTS_DEFAULT |\n+\t\t\t\tMTR_STATS_BYTES_DEFAULT;\n+\n+\t\treturn 0;\n+\t}\n+\n+\tpipeline = m->flow->pipeline;\n+\ttable = &pipeline->table[m->flow->table_id];\n+\n+\t/* Meter stats read. */\n+\tstatus = rte_table_action_meter_read(table->a,\n+\t\tm->flow->data,\n+\t\t1,\n+\t\t&counters,\n+\t\tclear);\n+\tif (status)\n+\t\treturn -rte_mtr_error_set(error,\n+\t\t\tEINVAL,\n+\t\t\tRTE_MTR_ERROR_TYPE_UNSPECIFIED,\n+\t\t\tNULL,\n+\t\t\t\"Meter stats read failed\");\n+\n+\t/* Stats format conversion. */\n+\tif (stats || stats_mask) {\n+\t\tstruct rte_mtr_stats s;\n+\t\tuint64_t s_mask = 0;\n+\n+\t\tmtr_stats_convert(m,\n+\t\t\t&counters.stats[0],\n+\t\t\t&s,\n+\t\t\t&s_mask);\n+\n+\t\tif (stats)\n+\t\t\tmemcpy(stats, &s, sizeof(*stats));\n+\n+\t\tif (stats_mask)\n+\t\t\t*stats_mask = s_mask;\n+\t}\n+\n+\treturn 0;\n+}\n+\n const struct rte_mtr_ops pmd_mtr_ops = {\n \t.capabilities_get = NULL,\n \n@@ -590,5 +724,5 @@ const struct rte_mtr_ops pmd_mtr_ops = {\n \t.policer_actions_update = pmd_mtr_policer_actions_update,\n \t.stats_update = NULL,\n \n-\t.stats_read = NULL,\n+\t.stats_read = pmd_mtr_stats_read,\n };\n", "prefixes": [ "v4", "09/10" ] }{ "id": 44875, "url": "