get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 62553,
    "url": "http://patches.dpdk.org/api/patches/62553/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1573053090-179521-6-git-send-email-suanmingm@mellanox.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": "<1573053090-179521-6-git-send-email-suanmingm@mellanox.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1573053090-179521-6-git-send-email-suanmingm@mellanox.com",
    "date": "2019-11-06T15:11:14",
    "name": "[05/19] net/mlx5: validate meter profile",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "be6bca1de6f4a139bc134130bad53be88a2c111a",
    "submitter": {
        "id": 1358,
        "url": "http://patches.dpdk.org/api/people/1358/?format=api",
        "name": "Suanming Mou",
        "email": "suanmingm@mellanox.com"
    },
    "delegate": {
        "id": 3268,
        "url": "http://patches.dpdk.org/api/users/3268/?format=api",
        "username": "rasland",
        "first_name": "Raslan",
        "last_name": "Darawsheh",
        "email": "rasland@nvidia.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1573053090-179521-6-git-send-email-suanmingm@mellanox.com/mbox/",
    "series": [
        {
            "id": 7297,
            "url": "http://patches.dpdk.org/api/series/7297/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=7297",
            "date": "2019-11-06T15:11:09",
            "name": "net/mlx5: support meter",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/7297/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/62553/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/62553/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id C89DAA04AB;\n\tWed,  6 Nov 2019 16:12:35 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 9D5ED1C20E;\n\tWed,  6 Nov 2019 16:12:07 +0100 (CET)",
            "from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130])\n by dpdk.org (Postfix) with ESMTP id 711791C18F\n for <dev@dpdk.org>; Wed,  6 Nov 2019 16:11:57 +0100 (CET)"
        ],
        "From": "Suanming Mou <suanmingm@mellanox.com>",
        "To": "Matan Azrad <matan@mellanox.com>, Shahaf Shuler <shahafs@mellanox.com>,\n Viacheslav Ovsiienko <viacheslavo@mellanox.com>",
        "Cc": "dev@dpdk.org",
        "Date": "Wed,  6 Nov 2019 17:11:14 +0200",
        "Message-Id": "<1573053090-179521-6-git-send-email-suanmingm@mellanox.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1573053090-179521-1-git-send-email-suanmingm@mellanox.com>",
        "References": "<1573053090-179521-1-git-send-email-suanmingm@mellanox.com>",
        "Subject": "[dpdk-dev] [PATCH 05/19] net/mlx5: validate 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 <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 <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "The add meter profile should be validated if it is valid or has been add\nto the list. Invalid and exist profile should not be add to the list.\n\nSigned-off-by: Suanming Mou <suanmingm@mellanox.com>\n---\n drivers/net/mlx5/mlx5_flow_meter.c | 70 ++++++++++++++++++++++++++++++++++++++\n drivers/net/mlx5/mlx5_prm.h        |  5 +++\n 2 files changed, 75 insertions(+)",
    "diff": "diff --git a/drivers/net/mlx5/mlx5_flow_meter.c b/drivers/net/mlx5/mlx5_flow_meter.c\nindex b11962f..5ad5e14 100644\n--- a/drivers/net/mlx5/mlx5_flow_meter.c\n+++ b/drivers/net/mlx5/mlx5_flow_meter.c\n@@ -35,6 +35,71 @@\n }\n \n /**\n+ * Validate the MTR profile.\n+ *\n+ * @param[in] dev\n+ *   Pointer to Ethernet device.\n+ * @param[in] meter_profile_id\n+ *   Meter profile id.\n+ * @param[in] profile\n+ *   Pointer to meter profile detail.\n+ * @param[out] error\n+ *   Pointer to the error structure.\n+ *\n+ * @return\n+ *   0 on success, a negative errno value otherwise and rte_errno is set.\n+ */\n+static int\n+mlx5_flow_meter_profile_validate(struct rte_eth_dev *dev,\n+\t\t\t\t uint32_t meter_profile_id,\n+\t\t\t\t struct rte_mtr_meter_profile *profile,\n+\t\t\t\t struct rte_mtr_error *error)\n+{\n+\tstruct mlx5_priv *priv = dev->data->dev_private;\n+\tstruct mlx5_flow_meter_profile *fmp;\n+\n+\t/* Profile must not be NULL. */\n+\tif (profile == NULL)\n+\t\treturn -rte_mtr_error_set(error, EINVAL,\n+\t\t\t\t\t  RTE_MTR_ERROR_TYPE_METER_PROFILE,\n+\t\t\t\t\t  NULL, \"Meter profile is null.\");\n+\t/* Meter profile ID must be valid. */\n+\tif (meter_profile_id == UINT32_MAX)\n+\t\treturn -rte_mtr_error_set(error, EINVAL,\n+\t\t\t\t\t  RTE_MTR_ERROR_TYPE_METER_PROFILE_ID,\n+\t\t\t\t\t  NULL, \"Meter profile id not valid.\");\n+\t/* Meter profile must not exist. */\n+\tfmp = mlx5_flow_meter_profile_find(priv, meter_profile_id);\n+\tif (fmp)\n+\t\treturn -rte_mtr_error_set(error, EEXIST,\n+\t\t\t\t\t  RTE_MTR_ERROR_TYPE_METER_PROFILE_ID,\n+\t\t\t\t\t  NULL,\n+\t\t\t\t\t  \"Meter profile already exists.\");\n+\tif (profile->alg == RTE_MTR_SRTCM_RFC2697) {\n+\t\tif (priv->config.hca_attr.qos.srtcm_sup) {\n+\t\t\t/* Verify support for flow meter parameters. */\n+\t\t\tif (profile->srtcm_rfc2697.cir > 0 &&\n+\t\t\t    profile->srtcm_rfc2697.cir <= MLX5_SRTCM_CIR_MAX &&\n+\t\t\t    profile->srtcm_rfc2697.cbs > 0 &&\n+\t\t\t    profile->srtcm_rfc2697.cbs <= MLX5_SRTCM_CBS_MAX &&\n+\t\t\t    profile->srtcm_rfc2697.ebs <= MLX5_SRTCM_EBS_MAX)\n+\t\t\t\treturn 0;\n+\t\t\telse\n+\t\t\t\treturn -rte_mtr_error_set\n+\t\t\t\t\t     (error, ENOTSUP,\n+\t\t\t\t\t      RTE_MTR_ERROR_TYPE_MTR_PARAMS,\n+\t\t\t\t\t      NULL,\n+\t\t\t\t\t      profile->srtcm_rfc2697.ebs ?\n+\t\t\t\t\t      \"Metering value ebs must be 0.\" :\n+\t\t\t\t\t      \"Invalid metering parameters.\");\n+\t\t}\n+\t}\n+\treturn -rte_mtr_error_set(error, ENOTSUP,\n+\t\t\t\t  RTE_MTR_ERROR_TYPE_METER_PROFILE,\n+\t\t\t\t  NULL, \"Metering algorithm not supported.\");\n+}\n+\n+/**\n  * Calculate mantissa and exponent for cir.\n  *\n  * @param[in] cir\n@@ -226,6 +291,11 @@\n \t\treturn -rte_mtr_error_set(error, ENOTSUP,\n \t\t\t\t\t  RTE_MTR_ERROR_TYPE_UNSPECIFIED, NULL,\n \t\t\t\t\t  \"Meter is not support\");\n+\t/* Check input params. */\n+\tret = mlx5_flow_meter_profile_validate(dev, meter_profile_id,\n+\t\t\t\t\t       profile, error);\n+\tif (ret)\n+\t\treturn ret;\n \t/* Meter profile memory allocation. */\n \tfmp = rte_calloc(__func__, 1, sizeof(struct mlx5_flow_meter_profile),\n \t\t\t RTE_CACHE_LINE_SIZE);\ndiff --git a/drivers/net/mlx5/mlx5_prm.h b/drivers/net/mlx5/mlx5_prm.h\nindex a0c37c8..3ebf191 100644\n--- a/drivers/net/mlx5/mlx5_prm.h\n+++ b/drivers/net/mlx5/mlx5_prm.h\n@@ -1768,6 +1768,11 @@ struct mlx5_mini_cqe8 {\n \tuint32_t byte_cnt;\n };\n \n+/* Maximum value of srTCM metering parameters. */\n+#define MLX5_SRTCM_CBS_MAX (0xFF * (1ULL << 0x1F))\n+#define MLX5_SRTCM_CIR_MAX (8 * (1ULL << 30) * 0xFF)\n+#define MLX5_SRTCM_EBS_MAX 0\n+\n /**\n  * Convert a user mark to flow mark.\n  *\n",
    "prefixes": [
        "05/19"
    ]
}