get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 62712,
    "url": "http://patches.dpdk.org/api/patches/62712/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1573184965-49691-3-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": "<1573184965-49691-3-git-send-email-suanmingm@mellanox.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1573184965-49691-3-git-send-email-suanmingm@mellanox.com",
    "date": "2019-11-08T03:49:08",
    "name": "[v2,02/19] net/mlx5: fill meter capabilities using DevX",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "5d670c9ffd2209f738a340321fd7e19167412b2b",
    "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/1573184965-49691-3-git-send-email-suanmingm@mellanox.com/mbox/",
    "series": [
        {
            "id": 7343,
            "url": "http://patches.dpdk.org/api/series/7343/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=7343",
            "date": "2019-11-08T03:49:07",
            "name": "net/mlx5: support meter",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/7343/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/62712/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/62712/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 4DC79A04AB;\n\tFri,  8 Nov 2019 04:49:42 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 1F2971BF5D;\n\tFri,  8 Nov 2019 04:49:37 +0100 (CET)",
            "from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130])\n by dpdk.org (Postfix) with ESMTP id AB7C31BF4C\n for <dev@dpdk.org>; Fri,  8 Nov 2019 04:49:32 +0100 (CET)"
        ],
        "From": "Suanming Mou <suanmingm@mellanox.com>",
        "To": "viacheslavo@mellanox.com,\n\tmatan@mellanox.com",
        "Cc": "orika@mellanox.com,\n\trasland@mellanox.com,\n\tdev@dpdk.org",
        "Date": "Fri,  8 Nov 2019 05:49:08 +0200",
        "Message-Id": "<1573184965-49691-3-git-send-email-suanmingm@mellanox.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1573184965-49691-1-git-send-email-suanmingm@mellanox.com>",
        "References": "<1573053090-179521-1-git-send-email-suanmingm@mellanox.com>\n <1573184965-49691-1-git-send-email-suanmingm@mellanox.com>",
        "Subject": "[dpdk-dev] [PATCH v2 02/19] net/mlx5: fill meter capabilities using\n\tDevX",
        "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": "This commit add the support of fill and get the meter capabilities\nfrom DevX.\n\nSupport items:\n1. The srTCM color bind mode.\n2. Meter share with multiple flows.\n3. Action drop.\n\nThe color aware mode and multiple meter chaining in a flow are not\nsupported.\n\nNew internal function in rte_mtr_ops callback:\n1. capabilities_get()\n\nSigned-off-by: Suanming Mou <suanmingm@mellanox.com>\n---\n drivers/net/mlx5/mlx5.c            |  6 ++++++\n drivers/net/mlx5/mlx5.h            | 13 +++++++++++\n drivers/net/mlx5/mlx5_devx_cmds.c  | 23 ++++++++++++++++++++\n drivers/net/mlx5/mlx5_flow_meter.c | 44 +++++++++++++++++++++++++++++++++++++-\n 4 files changed, 85 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c\nindex 062666c..1adef85 100644\n--- a/drivers/net/mlx5/mlx5.c\n+++ b/drivers/net/mlx5/mlx5.c\n@@ -2290,6 +2290,12 @@ struct mlx5_flow_id_pool *\n \t\t\tDRV_LOG(DEBUG, \"LRO session timeout set to %d usec\",\n \t\t\t\tconfig.lro.timeout);\n \t\t}\n+#if defined(HAVE_MLX5DV_DR) && defined(HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER)\n+\t\tif (config.hca_attr.qos.sup && config.hca_attr.qos.srtcm_sup &&\n+\t\t    config.dv_flow_en) {\n+\t\t\tpriv->mtr_en = 1;\n+\t\t}\n+#endif\n \t}\n \tif (config.mprq.enabled && mprq) {\n \t\tif (config.mprq.stride_num_n > mprq_max_stride_num_n ||\ndiff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h\nindex ea8bcff..be2f23d 100644\n--- a/drivers/net/mlx5/mlx5.h\n+++ b/drivers/net/mlx5/mlx5.h\n@@ -169,6 +169,17 @@ struct mlx5_devx_mkey_attr {\n \tuint32_t pd;\n };\n \n+/* HCA qos attributes. */\n+struct mlx5_hca_qos_attr {\n+\tuint32_t sup:1;\t/* Whether QOS is supported. */\n+\tuint32_t srtcm_sup:1; /* Whether srTCM mode is supported. */\n+\tuint8_t log_max_flow_meter;\n+\t/* Power of the maximum supported meters. */\n+\tuint8_t flow_meter_reg_c_ids;\n+\t/* Bitmap of the reg_Cs available for flow meter to use. */\n+\n+};\n+\n /* HCA supports this number of time periods for LRO. */\n #define MLX5_LRO_NUM_SUPP_PERIODS 4\n \n@@ -195,6 +206,7 @@ struct mlx5_hca_attr {\n \tuint32_t log_max_hairpin_wq_data_sz:5;\n \tuint32_t log_max_hairpin_num_packets:5;\n \tuint32_t vhca_id:16;\n+\tstruct mlx5_hca_qos_attr qos;\n };\n \n /* Flow list . */\n@@ -692,6 +704,7 @@ struct mlx5_priv {\n \tunsigned int master:1; /* Device is a E-Switch master. */\n \tunsigned int dr_shared:1; /* DV/DR data is shared. */\n \tunsigned int counter_fallback:1; /* Use counter fallback management. */\n+\tunsigned int mtr_en:1; /* Whether support meter. */\n \tuint16_t domain_id; /* Switch domain identifier. */\n \tuint16_t vport_id; /* Associated VF vport index (if any). */\n \tuint32_t vport_meta_tag; /* Used for vport index match ove VF LAG. */\ndiff --git a/drivers/net/mlx5/mlx5_devx_cmds.c b/drivers/net/mlx5/mlx5_devx_cmds.c\nindex d6e89b6..dcb7609 100644\n--- a/drivers/net/mlx5/mlx5_devx_cmds.c\n+++ b/drivers/net/mlx5/mlx5_devx_cmds.c\n@@ -335,6 +335,29 @@ struct mlx5_devx_obj *\n \tattr->log_max_hairpin_num_packets = MLX5_GET\n \t\t(cmd_hca_cap, hcattr, log_min_hairpin_wq_data_sz);\n \tattr->vhca_id = MLX5_GET(cmd_hca_cap, hcattr, vhca_id);\n+\tattr->qos.sup = MLX5_GET(cmd_hca_cap, hcattr, qos);\n+\tif (attr->qos.sup) {\n+\t\tMLX5_SET(query_hca_cap_in, in, op_mod,\n+\t\t\t MLX5_GET_HCA_CAP_OP_MOD_QOS_CAP |\n+\t\t\t MLX5_HCA_CAP_OPMOD_GET_CUR);\n+\t\trc = mlx5_glue->devx_general_cmd(ctx, in, sizeof(in),\n+\t\t\t\t\t\t out, sizeof(out));\n+\t\tif (rc)\n+\t\t\tgoto error;\n+\t\tif (status) {\n+\t\t\tDRV_LOG(DEBUG, \"Failed to query devx QOS capabilities,\"\n+\t\t\t\t\" status %x, syndrome = %x\",\n+\t\t\t\tstatus, syndrome);\n+\t\t\treturn -1;\n+\t\t}\n+\t\thcattr = MLX5_ADDR_OF(query_hca_cap_out, out, capability);\n+\t\tattr->qos.srtcm_sup =\n+\t\t\t\tMLX5_GET(qos_cap, hcattr, flow_meter_srtcm);\n+\t\tattr->qos.log_max_flow_meter =\n+\t\t\t\tMLX5_GET(qos_cap, hcattr, log_max_flow_meter);\n+\t\tattr->qos.flow_meter_reg_c_ids =\n+\t\t\tMLX5_GET(qos_cap, hcattr, flow_meter_reg_id);\n+\t}\n \tattr->eth_net_offloads = MLX5_GET(cmd_hca_cap, hcattr,\n \t\t\t\t\t  eth_net_offloads);\n \tattr->eth_virt = MLX5_GET(cmd_hca_cap, hcattr, eth_virt);\ndiff --git a/drivers/net/mlx5/mlx5_flow_meter.c b/drivers/net/mlx5/mlx5_flow_meter.c\nindex 6c7a005..9103b6d 100644\n--- a/drivers/net/mlx5/mlx5_flow_meter.c\n+++ b/drivers/net/mlx5/mlx5_flow_meter.c\n@@ -8,9 +8,51 @@\n #include <rte_mtr_driver.h>\n \n #include \"mlx5.h\"\n+#include \"mlx5_flow.h\"\n+\n+/**\n+ * Callback to get MTR capabilities.\n+ *\n+ * @param[in] dev\n+ *   Pointer to Ethernet device.\n+ * @param[out] cap\n+ *   Pointer to save MTR capabilities.\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_mtr_cap_get(struct rte_eth_dev *dev,\n+\t\t struct rte_mtr_capabilities *cap,\n+\t\t struct rte_mtr_error *error __rte_unused)\n+{\n+\tstruct mlx5_priv *priv = dev->data->dev_private;\n+\tstruct mlx5_hca_qos_attr *qattr = &priv->config.hca_attr.qos;\n+\n+\tif (!priv->mtr_en)\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+\tmemset(cap, 0, sizeof(*cap));\n+\tcap->n_max = 1 << qattr->log_max_flow_meter;\n+\tcap->n_shared_max = cap->n_max;\n+\tcap->identical = 1;\n+\tcap->shared_identical = 1;\n+\tcap->shared_n_flows_per_mtr_max = 4 << 20;\n+\t/* 2M flows can share the same meter. */\n+\tcap->chaining_n_mtrs_per_flow_max = 1; /* Chaining is not supported. */\n+\tcap->meter_srtcm_rfc2697_n_max = qattr->srtcm_sup ? cap->n_max : 0;\n+\tcap->meter_rate_max = 1ULL << 40; /* 1 Tera tokens per sec. */\n+\tcap->policer_action_drop_supported = 1;\n+\tcap->stats_mask = RTE_MTR_STATS_N_BYTES_DROPPED |\n+\t\t\t  RTE_MTR_STATS_N_PKTS_DROPPED;\n+\treturn 0;\n+}\n \n static const struct rte_mtr_ops mlx5_flow_mtr_ops = {\n-\t.capabilities_get = NULL,\n+\t.capabilities_get = mlx5_flow_mtr_cap_get,\n \t.meter_profile_add = NULL,\n \t.meter_profile_delete = NULL,\n \t.create = NULL,\n",
    "prefixes": [
        "v2",
        "02/19"
    ]
}