get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 40848,
    "url": "https://patches.dpdk.org/api/patches/40848/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20180608135751.23516-1-xuemingl@mellanox.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<20180608135751.23516-1-xuemingl@mellanox.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180608135751.23516-1-xuemingl@mellanox.com",
    "date": "2018-06-08T13:57:51",
    "name": "[dpdk-dev,RFC,v1] net/mlx5: support multiple flow priorities",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "ea45f124dae2cad4e20539cfdfc5431e69931a5d",
    "submitter": {
        "id": 814,
        "url": "https://patches.dpdk.org/api/people/814/?format=api",
        "name": "Xueming Li",
        "email": "xuemingl@mellanox.com"
    },
    "delegate": {
        "id": 6624,
        "url": "https://patches.dpdk.org/api/users/6624/?format=api",
        "username": "shahafs",
        "first_name": "Shahaf",
        "last_name": "Shuler",
        "email": "shahafs@mellanox.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20180608135751.23516-1-xuemingl@mellanox.com/mbox/",
    "series": [
        {
            "id": 53,
            "url": "https://patches.dpdk.org/api/series/53/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=53",
            "date": "2018-06-08T13:57:51",
            "name": "[dpdk-dev,RFC,v1] net/mlx5: support multiple flow priorities",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/53/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/40848/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/40848/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 D81B95F6E;\n\tFri,  8 Jun 2018 15:58:19 +0200 (CEST)",
            "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n\tby dpdk.org (Postfix) with ESMTP id 32E735F3B\n\tfor <dev@dpdk.org>; Fri,  8 Jun 2018 15:58:18 +0200 (CEST)",
            "from Internal Mail-Server by MTLPINE1 (envelope-from\n\txuemingl@mellanox.com)\n\twith ESMTPS (AES256-SHA encrypted); 8 Jun 2018 17:00:35 +0300",
            "from dev-r630-06.mtbc.labs.mlnx (dev-r630-06.mtbc.labs.mlnx\n\t[10.12.205.180])\n\tby labmailer.mlnx (8.13.8/8.13.8) with ESMTP id w58DwGiD000396;\n\tFri, 8 Jun 2018 16:58:16 +0300",
            "from dev-r630-06.mtbc.labs.mlnx (localhost [127.0.0.1])\n\tby dev-r630-06.mtbc.labs.mlnx (8.14.7/8.14.7) with ESMTP id\n\tw58DwFHj023620; Fri, 8 Jun 2018 21:58:15 +0800",
            "(from xuemingl@localhost)\n\tby dev-r630-06.mtbc.labs.mlnx (8.14.7/8.14.7/Submit) id\n\tw58DwCKQ023618; Fri, 8 Jun 2018 21:58:12 +0800"
        ],
        "From": "Xueming Li <xuemingl@mellanox.com>",
        "To": "Shahaf Shuler <shahafs@mellanox.com>,\n\tNelio Laranjeiro <nelio.laranjeiro@6wind.com>",
        "Cc": "Xueming Li <xuemingl@mellanox.com>, dev@dpdk.org",
        "Date": "Fri,  8 Jun 2018 21:57:51 +0800",
        "Message-Id": "<20180608135751.23516-1-xuemingl@mellanox.com>",
        "X-Mailer": "git-send-email 2.13.3",
        "Subject": "[dpdk-dev] [RFC v1] net/mlx5: support multiple flow priorities",
        "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://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "This patch supports multiple rte_flow priorities on NICs that support 16\nor more Verbs priorities. Control flow always consume 3 Verbs priorities\neven in isolated mode.\n\nFor NICs that support 16 or more Verbs priorities, each rte_flow\npriority consumes 6 Verbs priorities, higher 3 for tunnels, lower 3 for\nnon-tunnels.\n\nNICs that have 8 Verbs priorities only support 1 user prioirty:\n\tUser tunnel Verbs flows:\t0 - 2\n\tUser non-tunnel Verbs flows:\t2 - 4\n\tcontrol Verbs flows:\t\t5 - 8\n\nSigned-off-by: Xueming Li <xuemingl@mellanox.com>\n---\n drivers/net/mlx5/mlx5.c      |  8 +++++-\n drivers/net/mlx5/mlx5.h      | 10 +++++--\n drivers/net/mlx5/mlx5_flow.c | 67 ++++++++++++++++++++++++++------------------\n 3 files changed, 54 insertions(+), 31 deletions(-)",
    "diff": "diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c\nindex c933e274f..6897cc546 100644\n--- a/drivers/net/mlx5/mlx5.c\n+++ b/drivers/net/mlx5/mlx5.c\n@@ -1189,12 +1189,18 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \t\t/* Supported Verbs flow priority number detection. */\n \t\tif (verb_priorities == 0)\n \t\t\tverb_priorities = mlx5_get_max_verbs_prio(eth_dev);\n-\t\tif (verb_priorities < MLX5_VERBS_FLOW_PRIO_8) {\n+\t\tif (verb_priorities < MLX5_VERBS_FLOW_MIN_PRIOS) {\n \t\t\tDRV_LOG(ERR, \"port %u wrong Verbs flow priorities: %u\",\n \t\t\t\teth_dev->data->port_id, verb_priorities);\n \t\t\tgoto port_error;\n \t\t}\n \t\tpriv->config.max_verbs_prio = verb_priorities;\n+\t\tif (verb_priorities == MLX5_VERBS_FLOW_MIN_PRIOS)\n+\t\t\tpriv->config.ctrl_flow_prio = 1;\n+\t\telse\n+\t\t\tpriv->config.ctrl_flow_prio =\n+\t\t\t\t(verb_priorities - MLX5_VERBS_FLOW_CTRL_PRIOS) /\n+\t\t\t\tMLX5_VERBS_FLOW_USER_PRIOS;\n \t\t/*\n \t\t * Once the device is added to the list of memory event\n \t\t * callback, its global MR cache table cannot be expanded\ndiff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h\nindex 997b04a33..514501cc3 100644\n--- a/drivers/net/mlx5/mlx5.h\n+++ b/drivers/net/mlx5/mlx5.h\n@@ -115,6 +115,7 @@ struct mlx5_dev_config {\n \t\t/* Rx queue count threshold to enable MPRQ. */\n \t} mprq; /* Configurations for Multi-Packet RQ. */\n \tunsigned int max_verbs_prio; /* Number of Verb flow priorities. */\n+\tunsigned int ctrl_flow_prio; /* Control flow priority. */\n \tunsigned int tso_max_payload_sz; /* Maximum TCP payload for TSO. */\n \tunsigned int ind_table_max_size; /* Maximum indirection table size. */\n \tint txq_inline; /* Maximum packet size for inlining. */\n@@ -131,8 +132,13 @@ enum mlx5_verbs_alloc_type {\n \tMLX5_VERBS_ALLOC_TYPE_RX_QUEUE,\n };\n \n-/* 8 Verbs priorities. */\n-#define MLX5_VERBS_FLOW_PRIO_8 8\n+/* Minimal hardware Verbs priorities. */\n+#define MLX5_VERBS_FLOW_MIN_PRIOS 8\n+/* Verbs priorities used by control flow. */\n+#define MLX5_VERBS_FLOW_CTRL_PRIOS 3\n+/* Verbs priorities used by each user flow. */\n+#define MLX5_VERBS_FLOW_USER_PRIOS 6\n+\n \n /**\n  * Verbs allocator needs a context to know in the callback which kind of\ndiff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c\nindex 994be05be..0e4b6f179 100644\n--- a/drivers/net/mlx5/mlx5_flow.c\n+++ b/drivers/net/mlx5/mlx5_flow.c\n@@ -31,9 +31,6 @@\n #include \"mlx5_prm.h\"\n #include \"mlx5_glue.h\"\n \n-/* Flow priority for control plane flows. */\n-#define MLX5_CTRL_FLOW_PRIORITY 1\n-\n /* Internet Protocol versions. */\n #define MLX5_IPV4 4\n #define MLX5_IPV6 6\n@@ -619,6 +616,8 @@ mlx5_flow_item_validate(const struct rte_flow_item *item,\n /**\n  * Extract attribute to the parser.\n  *\n+ * @param dev\n+ *   Pointer to Ethernet device.\n  * @param[in] attr\n  *   Flow rule attributes.\n  * @param[out] error\n@@ -628,9 +627,12 @@ mlx5_flow_item_validate(const struct rte_flow_item *item,\n  *   0 on success, a negative errno value otherwise and rte_errno is set.\n  */\n static int\n-mlx5_flow_convert_attributes(const struct rte_flow_attr *attr,\n+mlx5_flow_convert_attributes(struct rte_eth_dev *dev,\n+\t\t\t     const struct rte_flow_attr *attr,\n \t\t\t     struct rte_flow_error *error)\n {\n+\tstruct priv *priv = dev->data->dev_private;\n+\n \tif (attr->group) {\n \t\trte_flow_error_set(error, ENOTSUP,\n \t\t\t\t   RTE_FLOW_ERROR_TYPE_ATTR_GROUP,\n@@ -638,11 +640,11 @@ mlx5_flow_convert_attributes(const struct rte_flow_attr *attr,\n \t\t\t\t   \"groups are not supported\");\n \t\treturn -rte_errno;\n \t}\n-\tif (attr->priority && attr->priority != MLX5_CTRL_FLOW_PRIORITY) {\n+\tif (attr->priority > priv->config.ctrl_flow_prio) {\n \t\trte_flow_error_set(error, ENOTSUP,\n \t\t\t\t   RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY,\n \t\t\t\t   NULL,\n-\t\t\t\t   \"priorities are not supported\");\n+\t\t\t\t   \"priority not supported\");\n \t\treturn -rte_errno;\n \t}\n \tif (attr->egress) {\n@@ -1039,23 +1041,33 @@ mlx5_flow_update_priority(struct rte_eth_dev *dev,\n \tunsigned int i;\n \tuint16_t priority;\n \n-\t/*\t\t\t8 priorities\t>= 16 priorities\n-\t * Control flow:\t4-7\t\t8-15\n-\t * User normal flow:\t1-3\t\t4-7\n-\t * User tunnel flow:\t0-2\t\t0-3\n-\t */\n-\tpriority = attr->priority * MLX5_VERBS_FLOW_PRIO_8;\n-\tif (priv->config.max_verbs_prio == MLX5_VERBS_FLOW_PRIO_8)\n-\t\tpriority /= 2;\n-\t/*\n-\t * Lower non-tunnel flow Verbs priority 1 if only support 8 Verbs\n-\t * priorities, lower 4 otherwise.\n-\t */\n-\tif (!parser->inner) {\n-\t\tif (priv->config.max_verbs_prio == MLX5_VERBS_FLOW_PRIO_8)\n-\t\t\tpriority += 1;\n+\tif (priv->config.max_verbs_prio == MLX5_VERBS_FLOW_MIN_PRIOS) {\n+\t\t/*\n+\t\t * Verbs priority mapping:\n+\t\t *    user tunnel flows:\t0 - 2\n+\t\t *    user non-tunnel flows:\t2 - 4\n+\t\t *    control flows:\t\t5 - 8\n+\t\t */\n+\t\tif (attr->priority >= priv->config.ctrl_flow_prio)\n+\t\t\tpriority = MLX5_VERBS_FLOW_MIN_PRIOS -\n+\t\t\t\t   MLX5_VERBS_FLOW_CTRL_PRIOS;\n+\t\telse if (!parser->inner)\n+\t\t\tpriority = (MLX5_VERBS_FLOW_MIN_PRIOS -\n+\t\t\t\t     MLX5_VERBS_FLOW_CTRL_PRIOS -\n+\t\t\t\t     MLX5_VERBS_FLOW_USER_PRIOS / 2);\n \t\telse\n-\t\t\tpriority += MLX5_VERBS_FLOW_PRIO_8 / 2;\n+\t\t\tpriority = 0;\n+\t} else {\n+\t\t/*\n+\t\t * Verbs priority mapping:\n+\t\t *    user flows * 6, control flows 3.\n+\t\t * User flow mapping:\n+\t\t *    tunnel 3, non-tunnel 3.\n+\t\t */\n+\t\tpriority = attr->priority * MLX5_VERBS_FLOW_USER_PRIOS;\n+\t\tif (attr->priority != priv->config.ctrl_flow_prio &&\n+\t\t    !parser->inner)\n+\t\t\tpriority += MLX5_VERBS_FLOW_USER_PRIOS / 2;\n \t}\n \tif (parser->drop) {\n \t\tparser->queue[HASH_RXQ_ETH].ibv_attr->priority = priority +\n@@ -1285,7 +1297,7 @@ mlx5_flow_convert(struct rte_eth_dev *dev,\n \t\t.layer = HASH_RXQ_ETH,\n \t\t.mark_id = MLX5_FLOW_MARK_DEFAULT,\n \t};\n-\tret = mlx5_flow_convert_attributes(attr, error);\n+\tret = mlx5_flow_convert_attributes(dev, attr, error);\n \tif (ret)\n \t\treturn ret;\n \tret = mlx5_flow_convert_actions(dev, actions, error, parser);\n@@ -3019,7 +3031,7 @@ mlx5_ctrl_flow_vlan(struct rte_eth_dev *dev,\n \tstruct priv *priv = dev->data->dev_private;\n \tconst struct rte_flow_attr attr = {\n \t\t.ingress = 1,\n-\t\t.priority = MLX5_CTRL_FLOW_PRIORITY,\n+\t\t.priority = priv->config.ctrl_flow_prio,\n \t};\n \tstruct rte_flow_item items[] = {\n \t\t{\n@@ -3739,7 +3751,7 @@ unsigned int\n mlx5_get_max_verbs_prio(struct rte_eth_dev *dev)\n {\n \tstruct priv *priv = dev->data->dev_private;\n-\tunsigned int verb_priorities = MLX5_VERBS_FLOW_PRIO_8;\n+\tunsigned int verb_priorities = MLX5_VERBS_FLOW_MIN_PRIOS;\n \tstruct {\n \t\tstruct ibv_flow_attr attr;\n \t\tstruct ibv_flow_spec_eth eth;\n@@ -3773,8 +3785,7 @@ mlx5_get_max_verbs_prio(struct rte_eth_dev *dev)\n \t\t\tbreak;\n \t\t}\n \t} while (1);\n-\tDRV_LOG(DEBUG, \"port %u Verbs flow priorities: %d,\"\n-\t\t\" user flow priorities: %d\",\n-\t\tdev->data->port_id, verb_priorities, MLX5_CTRL_FLOW_PRIORITY);\n+\tDRV_LOG(DEBUG, \"port %u Verbs flow priorities: %d\",\n+\t\tdev->data->port_id, verb_priorities);\n \treturn verb_priorities;\n }\n",
    "prefixes": [
        "dpdk-dev",
        "RFC",
        "v1"
    ]
}