get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 68475,
    "url": "http://patchwork.dpdk.org/api/patches/68475/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/1586932797-99533-6-git-send-email-suanmingm@mellanox.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<1586932797-99533-6-git-send-email-suanmingm@mellanox.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1586932797-99533-6-git-send-email-suanmingm@mellanox.com",
    "date": "2020-04-15T06:39:52",
    "name": "[05/10] net/mlx5: allocate rte flow from indexed pool",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "0357c642f8a1ad1014a98690c17947f7e3488c5f",
    "submitter": {
        "id": 1358,
        "url": "http://patchwork.dpdk.org/api/people/1358/?format=api",
        "name": "Suanming Mou",
        "email": "suanmingm@mellanox.com"
    },
    "delegate": {
        "id": 3268,
        "url": "http://patchwork.dpdk.org/api/users/3268/?format=api",
        "username": "rasland",
        "first_name": "Raslan",
        "last_name": "Darawsheh",
        "email": "rasland@nvidia.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/1586932797-99533-6-git-send-email-suanmingm@mellanox.com/mbox/",
    "series": [
        {
            "id": 9383,
            "url": "http://patchwork.dpdk.org/api/series/9383/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=9383",
            "date": "2020-04-15T06:39:47",
            "name": "net/mlx5: optimize flow structure",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/9383/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/68475/comments/",
    "check": "fail",
    "checks": "http://patchwork.dpdk.org/api/patches/68475/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 6D367A0577;\n\tWed, 15 Apr 2020 08:40:54 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id E1B371D17A;\n\tWed, 15 Apr 2020 08:40:16 +0200 (CEST)",
            "from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130])\n by dpdk.org (Postfix) with ESMTP id 46D171D17E\n for <dev@dpdk.org>; Wed, 15 Apr 2020 08:40:13 +0200 (CEST)"
        ],
        "From": "Suanming Mou <suanmingm@mellanox.com>",
        "To": "Matan Azrad <matan@mellanox.com>, Shahaf Shuler <shahafs@mellanox.com>,\n Viacheslav Ovsiienko <viacheslavo@mellanox.com>",
        "Cc": "wentaoc@mellanox.com,\n\trasland@mellanox.com,\n\tdev@dpdk.org",
        "Date": "Wed, 15 Apr 2020 14:39:52 +0800",
        "Message-Id": "<1586932797-99533-6-git-send-email-suanmingm@mellanox.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1586932797-99533-1-git-send-email-suanmingm@mellanox.com>",
        "References": "<1586932797-99533-1-git-send-email-suanmingm@mellanox.com>",
        "Subject": "[dpdk-dev] [PATCH 05/10] net/mlx5: allocate rte flow from indexed\n\tpool",
        "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": "Currently, rte flow with RSS action may have different queue number. The\nindexed memory pool is not suitable for the flow with RSS action.\n\nFor flows without RSS action, the size are fixed. Allocate the none RSS\nrte flow memory from indexed memory pool helps save MALLOC_ELEM_OVERHEAD\nwhich is more than 64 bytes for rte flow.\n\nSigned-off-by: Suanming Mou <suanmingm@mellanox.com>\n---\n drivers/net/mlx5/mlx5.c      | 10 ++++++++++\n drivers/net/mlx5/mlx5.h      |  1 +\n drivers/net/mlx5/mlx5_flow.c | 24 ++++++++++++++++++------\n drivers/net/mlx5/mlx5_flow.h |  1 +\n 4 files changed, 30 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c\nindex 3ca2ed0..1493d25 100644\n--- a/drivers/net/mlx5/mlx5.c\n+++ b/drivers/net/mlx5/mlx5.c\n@@ -277,6 +277,16 @@ struct mlx5_dev_spawn_data {\n \t\t.free = rte_free,\n \t\t.type = \"mlx5_flow_handle_ipool\",\n \t},\n+\t{\n+\t\t.size = (sizeof(struct rte_flow) +\n+\t\t\tRTE_ALIGN_CEIL(sizeof(uint16_t), sizeof(void *))),\n+\t\t.trunk_size = 4096,\n+\t\t.need_lock = 1,\n+\t\t.release_mem_en = 1,\n+\t\t.malloc = rte_malloc_socket,\n+\t\t.free = rte_free,\n+\t\t.type = \"rte_flow_ipool\",\n+\t},\n };\n \n \ndiff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h\nindex 41c87ec..378a13f 100644\n--- a/drivers/net/mlx5/mlx5.h\n+++ b/drivers/net/mlx5/mlx5.h\n@@ -61,6 +61,7 @@ enum mlx5_ipool_index {\n #endif\n \tMLX5_IPOOL_HRXQ, /* Pool for hrxq resource. */\n \tMLX5_IPOOL_MLX5_FLOW, /* Pool for mlx5 flow handle. */\n+\tMLX5_IPOOL_RTE_FLOW, /* Pool for rte_flow. */\n \tMLX5_IPOOL_MAX,\n };\n \ndiff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c\nindex 9f79031..cc2b207 100644\n--- a/drivers/net/mlx5/mlx5_flow.c\n+++ b/drivers/net/mlx5/mlx5_flow.c\n@@ -4225,6 +4225,7 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,\n \tstruct mlx5_flow_rss_meta *rss_meta = priv->rss_meta;\n \tconst struct rte_flow_action *p_actions_rx = actions;\n \tuint32_t i;\n+\tuint32_t idx = 0;\n \tuint32_t flow_size;\n \tint hairpin_flow = 0;\n \tuint32_t hairpin_id = 0;\n@@ -4247,17 +4248,21 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,\n \t}\n \tflow_size = sizeof(struct rte_flow);\n \trss = flow_get_rss_action(p_actions_rx);\n-\tif (rss)\n+\tif (rss) {\n \t\tflow_size += RTE_ALIGN_CEIL(rss->queue_num * sizeof(uint16_t),\n \t\t\t\t\t    sizeof(void *));\n-\telse\n-\t\tflow_size += RTE_ALIGN_CEIL(sizeof(uint16_t), sizeof(void *));\n-\tflow = rte_calloc(__func__, 1, flow_size, 0);\n+\t\tflow = rte_calloc(__func__, 1, flow_size, 0);\n+\t} else {\n+\t\tflow = mlx5_ipool_zmalloc(priv->sh->ipool[MLX5_IPOOL_RTE_FLOW],\n+\t\t       &idx);\n+\t}\n \tif (!flow) {\n \t\trte_errno = ENOMEM;\n \t\tgoto error_before_flow;\n \t}\n \tflow->drv_type = flow_get_drv_type(dev, attr);\n+\tif (idx)\n+\t\tflow->idx = idx;\n \tif (hairpin_id != 0)\n \t\tflow->hairpin_flow_id = hairpin_id;\n \tMLX5_ASSERT(flow->drv_type > MLX5_FLOW_TYPE_MIN &&\n@@ -4368,7 +4373,10 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,\n \tret = rte_errno; /* Save rte_errno before cleanup. */\n \tflow_mreg_del_copy_action(dev, flow);\n \tflow_drv_destroy(dev, flow);\n-\trte_free(flow);\n+\tif (idx)\n+\t\tmlx5_ipool_free(priv->sh->ipool[MLX5_IPOOL_RTE_FLOW], idx);\n+\telse\n+\t\trte_free(flow);\n \trte_errno = ret; /* Restore rte_errno. */\n error_before_flow:\n \tret = rte_errno;\n@@ -4492,7 +4500,11 @@ struct rte_flow *\n \t\tTAILQ_REMOVE(list, flow, next);\n \tflow_mreg_del_copy_action(dev, flow);\n \trte_free(flow->fdir);\n-\trte_free(flow);\n+\tif (flow->idx)\n+\t\tmlx5_ipool_free(priv->sh->ipool[MLX5_IPOOL_RTE_FLOW],\n+\t\t\t\tflow->idx);\n+\telse\n+\t\trte_free(flow);\n }\n \n /**\ndiff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h\nindex 4516b51..e220647 100644\n--- a/drivers/net/mlx5/mlx5_flow.h\n+++ b/drivers/net/mlx5/mlx5_flow.h\n@@ -765,6 +765,7 @@ struct rte_flow {\n \tstruct mlx5_fdir *fdir; /**< Pointer to associated FDIR if any. */\n \tuint32_t hairpin_flow_id; /**< The flow id used for hairpin. */\n \tuint32_t copy_applied:1; /**< The MARK copy Flow os applied. */\n+\tuint32_t idx; /**< Index to the rte flow allocated from indexed pool. */\n };\n \n typedef int (*mlx5_flow_validate_t)(struct rte_eth_dev *dev,\n",
    "prefixes": [
        "05/10"
    ]
}