get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 44869,
    "url": "http://patches.dpdk.org/api/patches/44869/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180918165835.107593-3-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-3-jasvinder.singh@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180918165835.107593-3-jasvinder.singh@intel.com",
    "date": "2018-09-18T16:58:27",
    "name": "[v4,02/10] net/softnic: add meter profile",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "4e45cd74e99d88d12e44cf67c3b18c5960e49769",
    "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-3-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/44869/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/44869/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 7D1CA5A6A;\n\tTue, 18 Sep 2018 18:58:51 +0200 (CEST)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id 7A18B568A\n\tfor <dev@dpdk.org>; Tue, 18 Sep 2018 18:58:47 +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: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.53,390,1531810800\"; d=\"scan'208\";a=\"87193988\"",
        "From": "Jasvinder Singh <jasvinder.singh@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "cristian.dumitrescu@intel.com",
        "Date": "Tue, 18 Sep 2018 17:58:27 +0100",
        "Message-Id": "<20180918165835.107593-3-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 02/10] net/softnic: add meter profile",
        "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 profile add function.\n\nSigned-off-by: Jasvinder Singh <jasvinder.singh@intel.com>\n---\n drivers/net/softnic/rte_eth_softnic.c           |   3 +\n drivers/net/softnic/rte_eth_softnic_internals.h |  31 ++++++\n drivers/net/softnic/rte_eth_softnic_meter.c     | 122 +++++++++++++++++++++++-\n 3 files changed, 155 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c\nindex 659a1b4..b7b2383 100644\n--- a/drivers/net/softnic/rte_eth_softnic.c\n+++ b/drivers/net/softnic/rte_eth_softnic.c\n@@ -191,6 +191,7 @@ pmd_dev_stop(struct rte_eth_dev *dev)\n \tsoftnic_mempool_free(p);\n \n \ttm_hierarchy_free(p);\n+\tsoftnic_mtr_free(p);\n }\n \n static void\n@@ -291,6 +292,7 @@ pmd_init(struct pmd_params *params)\n \n \t/* Resources */\n \ttm_hierarchy_init(p);\n+\tsoftnic_mtr_init(p);\n \n \tsoftnic_mempool_init(p);\n \tsoftnic_swq_init(p);\n@@ -345,6 +347,7 @@ pmd_free(struct pmd_internals *p)\n \tsoftnic_mempool_free(p);\n \n \ttm_hierarchy_free(p);\n+\tsoftnic_mtr_free(p);\n \n \trte_free(p);\n }\ndiff --git a/drivers/net/softnic/rte_eth_softnic_internals.h b/drivers/net/softnic/rte_eth_softnic_internals.h\nindex 92be4e8..1db9310 100644\n--- a/drivers/net/softnic/rte_eth_softnic_internals.h\n+++ b/drivers/net/softnic/rte_eth_softnic_internals.h\n@@ -22,6 +22,7 @@\n #include <rte_ethdev_driver.h>\n #include <rte_tm_driver.h>\n #include <rte_flow_driver.h>\n+#include <rte_mtr_driver.h>\n \n #include \"rte_eth_softnic.h\"\n #include \"conn.h\"\n@@ -68,6 +69,24 @@ struct flow_internals {\n };\n \n /**\n+ * Meter\n+ */\n+\n+/* MTR meter profile */\n+struct softnic_mtr_meter_profile {\n+\tTAILQ_ENTRY(softnic_mtr_meter_profile) node;\n+\tuint32_t meter_profile_id;\n+\tstruct rte_mtr_meter_profile params;\n+\tuint32_t n_users;\n+};\n+\n+TAILQ_HEAD(softnic_mtr_meter_profile_list, softnic_mtr_meter_profile);\n+\n+struct mtr_internals {\n+\tstruct softnic_mtr_meter_profile_list meter_profiles;\n+};\n+\n+/**\n  * MEMPOOL\n  */\n struct softnic_mempool_params {\n@@ -525,6 +544,8 @@ struct pmd_internals {\n \t} soft;\n \n \tstruct flow_internals flow;\n+\tstruct mtr_internals mtr;\n+\n \tstruct softnic_conn *conn;\n \tstruct softnic_mempool_list mempool_list;\n \tstruct softnic_swq_list swq_list;\n@@ -574,6 +595,16 @@ extern const struct rte_flow_ops pmd_flow_ops;\n /**\n  * Meter\n  */\n+int\n+softnic_mtr_init(struct pmd_internals *p);\n+\n+void\n+softnic_mtr_free(struct pmd_internals *p);\n+\n+struct softnic_mtr_meter_profile *\n+softnic_mtr_meter_profile_find(struct pmd_internals *p,\n+\tuint32_t meter_profile_id);\n+\n extern const struct rte_mtr_ops pmd_mtr_ops;\n \n /**\ndiff --git a/drivers/net/softnic/rte_eth_softnic_meter.c b/drivers/net/softnic/rte_eth_softnic_meter.c\nindex 0a5409b..1222866 100644\n--- a/drivers/net/softnic/rte_eth_softnic_meter.c\n+++ b/drivers/net/softnic/rte_eth_softnic_meter.c\n@@ -11,10 +11,130 @@\n \n #include \"rte_eth_softnic_internals.h\"\n \n+int\n+softnic_mtr_init(struct pmd_internals *p)\n+{\n+\t/* Initialize meter profiles list */\n+\tTAILQ_INIT(&p->mtr.meter_profiles);\n+\n+\treturn 0;\n+}\n+\n+void\n+softnic_mtr_free(struct pmd_internals *p)\n+{\n+\t/* Remove meter profiles */\n+\tfor ( ; ; ) {\n+\t\tstruct softnic_mtr_meter_profile *mp;\n+\n+\t\tmp = TAILQ_FIRST(&p->mtr.meter_profiles);\n+\t\tif (mp == NULL)\n+\t\t\tbreak;\n+\n+\t\tTAILQ_REMOVE(&p->mtr.meter_profiles, mp, node);\n+\t\tfree(mp);\n+\t}\n+}\n+\n+struct softnic_mtr_meter_profile *\n+softnic_mtr_meter_profile_find(struct pmd_internals *p,\n+\tuint32_t meter_profile_id)\n+{\n+\tstruct softnic_mtr_meter_profile_list *mpl = &p->mtr.meter_profiles;\n+\tstruct softnic_mtr_meter_profile *mp;\n+\n+\tTAILQ_FOREACH(mp, mpl, node)\n+\t\tif (meter_profile_id == mp->meter_profile_id)\n+\t\t\treturn mp;\n+\n+\treturn NULL;\n+}\n+\n+static int\n+meter_profile_check(struct rte_eth_dev *dev,\n+\tuint32_t meter_profile_id,\n+\tstruct rte_mtr_meter_profile *profile,\n+\tstruct rte_mtr_error *error)\n+{\n+\tstruct pmd_internals *p = dev->data->dev_private;\n+\tstruct softnic_mtr_meter_profile *mp;\n+\n+\t/* Meter profile ID must be valid. */\n+\tif (meter_profile_id == UINT32_MAX)\n+\t\treturn -rte_mtr_error_set(error,\n+\t\t\tEINVAL,\n+\t\t\tRTE_MTR_ERROR_TYPE_METER_PROFILE_ID,\n+\t\t\tNULL,\n+\t\t\t\"Meter profile id not valid\");\n+\n+\t/* Meter profile must not exist. */\n+\tmp = softnic_mtr_meter_profile_find(p, meter_profile_id);\n+\tif (mp)\n+\t\treturn -rte_mtr_error_set(error,\n+\t\t\tEEXIST,\n+\t\t\tRTE_MTR_ERROR_TYPE_METER_PROFILE_ID,\n+\t\t\tNULL,\n+\t\t\t\"Meter prfile already exists\");\n+\n+\t/* Profile must not be NULL. */\n+\tif (profile == NULL)\n+\t\treturn -rte_mtr_error_set(error,\n+\t\t\tEINVAL,\n+\t\t\tRTE_MTR_ERROR_TYPE_METER_PROFILE,\n+\t\t\tNULL,\n+\t\t\t\"profile null\");\n+\n+\t/* Traffic metering algorithm : TRTCM_RFC2698 */\n+\tif (profile->alg != RTE_MTR_TRTCM_RFC2698)\n+\t\treturn -rte_mtr_error_set(error,\n+\t\t\tEINVAL,\n+\t\t\tRTE_MTR_ERROR_TYPE_METER_PROFILE,\n+\t\t\tNULL,\n+\t\t\t\"Metering alg not supported\");\n+\n+\treturn 0;\n+}\n+\n+/* MTR meter profile add */\n+static int\n+pmd_mtr_meter_profile_add(struct rte_eth_dev *dev,\n+\tuint32_t meter_profile_id,\n+\tstruct rte_mtr_meter_profile *profile,\n+\tstruct rte_mtr_error *error)\n+{\n+\tstruct pmd_internals *p = dev->data->dev_private;\n+\tstruct softnic_mtr_meter_profile_list *mpl = &p->mtr.meter_profiles;\n+\tstruct softnic_mtr_meter_profile *mp;\n+\tint status;\n+\n+\t/* Check input params */\n+\tstatus = meter_profile_check(dev, meter_profile_id, profile, error);\n+\tif (status)\n+\t\treturn status;\n+\n+\t/* Memory allocation */\n+\tmp = calloc(1, sizeof(struct softnic_mtr_meter_profile));\n+\tif (mp == NULL)\n+\t\treturn -rte_mtr_error_set(error,\n+\t\t\tENOMEM,\n+\t\t\tRTE_MTR_ERROR_TYPE_UNSPECIFIED,\n+\t\t\tNULL,\n+\t\t\t\"Memory alloc failed\");\n+\n+\t/* Fill in */\n+\tmp->meter_profile_id = meter_profile_id;\n+\tmemcpy(&mp->params, profile, sizeof(mp->params));\n+\n+\t/* Add to list */\n+\tTAILQ_INSERT_TAIL(mpl, mp, node);\n+\n+\treturn 0;\n+}\n+\n const struct rte_mtr_ops pmd_mtr_ops = {\n \t.capabilities_get = NULL,\n \n-\t.meter_profile_add = NULL,\n+\t.meter_profile_add = pmd_mtr_meter_profile_add,\n \t.meter_profile_delete = NULL,\n \n \t.create = NULL,\n",
    "prefixes": [
        "v4",
        "02/10"
    ]
}