get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 68471,
    "url": "https://patches.dpdk.org/api/patches/68471/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1586932797-99533-2-git-send-email-suanmingm@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": "<1586932797-99533-2-git-send-email-suanmingm@mellanox.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1586932797-99533-2-git-send-email-suanmingm@mellanox.com",
    "date": "2020-04-15T06:39:48",
    "name": "[01/10] net/mlx5: reorganize fate actions as union",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "624143e2025611f0f5b86ba261ddcbfc756a1496",
    "submitter": {
        "id": 1358,
        "url": "https://patches.dpdk.org/api/people/1358/?format=api",
        "name": "Suanming Mou",
        "email": "suanmingm@mellanox.com"
    },
    "delegate": {
        "id": 3268,
        "url": "https://patches.dpdk.org/api/users/3268/?format=api",
        "username": "rasland",
        "first_name": "Raslan",
        "last_name": "Darawsheh",
        "email": "rasland@nvidia.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1586932797-99533-2-git-send-email-suanmingm@mellanox.com/mbox/",
    "series": [
        {
            "id": 9383,
            "url": "https://patches.dpdk.org/api/series/9383/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=9383",
            "date": "2020-04-15T06:39:47",
            "name": "net/mlx5: optimize flow structure",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/9383/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/68471/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/68471/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 8B415A0577;\n\tWed, 15 Apr 2020 08:40:13 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 070751C437;\n\tWed, 15 Apr 2020 08:40:08 +0200 (CEST)",
            "from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130])\n by dpdk.org (Postfix) with ESMTP id 4DFE41BDAE\n for <dev@dpdk.org>; Wed, 15 Apr 2020 08:40:05 +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:48 +0800",
        "Message-Id": "<1586932797-99533-2-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 01/10] net/mlx5: reorganize fate actions as union",
        "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, one flow only has one fate action, the fate actions members\nin the flow struct can be reorganized as union to save the memory for\nflow struct.\n\nThis commit reorganizes the fate actions as union, the act_flags helps\nto identify the fate action type when flow destroys.\n\nSigned-off-by: Suanming Mou <suanmingm@mellanox.com>\n---\n drivers/net/mlx5/mlx5_flow.h       | 11 +++++----\n drivers/net/mlx5/mlx5_flow_dv.c    | 48 +++++++++++++++++++++++++-------------\n drivers/net/mlx5/mlx5_flow_verbs.c | 22 ++++++++++++-----\n 3 files changed, 54 insertions(+), 27 deletions(-)",
    "diff": "diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h\nindex e828af3..e89a092 100644\n--- a/drivers/net/mlx5/mlx5_flow.h\n+++ b/drivers/net/mlx5/mlx5_flow.h\n@@ -488,10 +488,6 @@ struct mlx5_flow_handle_dv {\n \t/**< Index to encap/decap resource in cache. */\n \tstruct mlx5_flow_dv_modify_hdr_resource *modify_hdr;\n \t/**< Pointer to modify header resource in cache. */\n-\tuint32_t jump;\n-\t/**< Index to the jump action resource. */\n-\tuint32_t port_id_action;\n-\t/**< Index to port ID action resource. */\n \tstruct mlx5_vf_vlan vf_vlan;\n \t/**< Structure for VF VLAN workaround. */\n \tuint32_t push_vlan_res;\n@@ -509,12 +505,17 @@ struct mlx5_flow_handle {\n \tuint64_t act_flags;\n \t/**< Bit-fields of detected actions, see MLX5_FLOW_ACTION_*. */\n \tvoid *ib_flow; /**< Verbs flow pointer. */\n-\tuint32_t hrxq; /**< Hash Rx queue object index. */\n \tstruct mlx5_vf_vlan vf_vlan; /**< Structure for VF VLAN workaround. */\n \tunion {\n \t\tuint32_t qrss_id; /**< Uniqie Q/RSS suffix subflow tag. */\n \t\tuint32_t mtr_flow_id; /**< Unique meter match flow id. */\n \t};\n+\tunion {\n+\t\tuint32_t hrxq; /**< Hash Rx queue object index. */\n+\t\tuint32_t jump; /**< Index to the jump action resource. */\n+\t\tuint32_t port_id_action;\n+\t\t/**< Index to port ID action resource. */\n+\t};\n #ifdef HAVE_IBV_FLOW_DV_SUPPORT\n \tstruct mlx5_flow_handle_dv dvh;\n #endif\ndiff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c\nindex 0162c66..54bd3fd 100644\n--- a/drivers/net/mlx5/mlx5_flow_dv.c\n+++ b/drivers/net/mlx5/mlx5_flow_dv.c\n@@ -2540,7 +2540,7 @@ struct field_modify_info modify_tcp[] = {\n \t\t\t(void *)&tbl_data->jump, cnt);\n \t}\n \trte_atomic32_inc(&tbl_data->jump.refcnt);\n-\tdev_flow->handle->dvh.jump = tbl_data->idx;\n+\tdev_flow->handle->jump = tbl_data->idx;\n \tdev_flow->dv.jump = &tbl_data->jump;\n \treturn 0;\n }\n@@ -2581,14 +2581,14 @@ struct field_modify_info modify_tcp[] = {\n \t\t\t\t(void *)cache_resource,\n \t\t\t\trte_atomic32_read(&cache_resource->refcnt));\n \t\t\trte_atomic32_inc(&cache_resource->refcnt);\n-\t\t\tdev_flow->handle->dvh.port_id_action = idx;\n+\t\t\tdev_flow->handle->port_id_action = idx;\n \t\t\tdev_flow->dv.port_id_action = cache_resource;\n \t\t\treturn 0;\n \t\t}\n \t}\n \t/* Register new port id action resource. */\n \tcache_resource = mlx5_ipool_zmalloc(sh->ipool[MLX5_IPOOL_PORT_ID],\n-\t\t\t\t       &dev_flow->handle->dvh.port_id_action);\n+\t\t\t\t       &dev_flow->handle->port_id_action);\n \tif (!cache_resource)\n \t\treturn rte_flow_error_set(error, ENOMEM,\n \t\t\t\t\t  RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,\n@@ -2611,8 +2611,7 @@ struct field_modify_info modify_tcp[] = {\n \trte_atomic32_init(&cache_resource->refcnt);\n \trte_atomic32_inc(&cache_resource->refcnt);\n \tILIST_INSERT(sh->ipool[MLX5_IPOOL_PORT_ID], &sh->port_id_action_list,\n-\t\t     dev_flow->handle->dvh.port_id_action, cache_resource,\n-\t\t     next);\n+\t\t     dev_flow->handle->port_id_action, cache_resource, next);\n \tdev_flow->dv.port_id_action = cache_resource;\n \tDRV_LOG(DEBUG, \"new port id action resource %p: refcnt %d++\",\n \t\t(void *)cache_resource,\n@@ -7406,7 +7405,7 @@ struct field_modify_info modify_tcp[] = {\n \t\t\tif (flow_dv_port_id_action_resource_register\n \t\t\t    (dev, &port_id_resource, dev_flow, error))\n \t\t\t\treturn -rte_errno;\n-\t\t\tMLX5_ASSERT(!handle->dvh.port_id_action);\n+\t\t\tMLX5_ASSERT(!handle->port_id_action);\n \t\t\tdev_flow->dv.actions[actions_n++] =\n \t\t\t\t\tdev_flow->dv.port_id_action->action;\n \t\t\taction_flags |= MLX5_FLOW_ACTION_PORT_ID;\n@@ -8077,6 +8076,13 @@ struct field_modify_info modify_tcp[] = {\n \t\t\t\t\t\t \"cannot get drop hash queue\");\n \t\t\t\t\tgoto error;\n \t\t\t\t}\n+\t\t\t\t/*\n+\t\t\t\t * Drop queues will be released by the specify\n+\t\t\t\t * mlx5_hrxq_drop_release() function. Assign\n+\t\t\t\t * the special index to hrxq to mark the queue\n+\t\t\t\t * has been allocated.\n+\t\t\t\t */\n+\t\t\t\tdh->hrxq = UINT32_MAX;\n \t\t\t\tdv->actions[n++] = drop_hrxq->action;\n \t\t\t}\n \t\t} else if (dh->act_flags &\n@@ -8139,12 +8145,17 @@ struct field_modify_info modify_tcp[] = {\n \terr = rte_errno; /* Save rte_errno before cleanup. */\n \tSILIST_FOREACH(priv->sh->ipool[MLX5_IPOOL_MLX5_FLOW], flow->dev_handles,\n \t\t       handle_idx, dh, next) {\n+\t\t/* hrxq is union, don't clear it if the flag is not set. */\n \t\tif (dh->hrxq) {\n-\t\t\tif (dh->act_flags & MLX5_FLOW_ACTION_DROP)\n+\t\t\tif (dh->act_flags & MLX5_FLOW_ACTION_DROP) {\n \t\t\t\tmlx5_hrxq_drop_release(dev);\n-\t\t\telse\n+\t\t\t\tdh->hrxq = 0;\n+\t\t\t} else if (dh->act_flags &\n+\t\t\t\t  (MLX5_FLOW_ACTION_QUEUE |\n+\t\t\t\t  MLX5_FLOW_ACTION_RSS)) {\n \t\t\t\tmlx5_hrxq_release(dev, dh->hrxq);\n-\t\t\tdh->hrxq = 0;\n+\t\t\t\tdh->hrxq = 0;\n+\t\t\t}\n \t\t}\n \t\tif (dh->vf_vlan.tag && dh->vf_vlan.created)\n \t\t\tmlx5_vlan_vmwa_release(dev, &dh->vf_vlan);\n@@ -8249,7 +8260,7 @@ struct field_modify_info modify_tcp[] = {\n \tstruct mlx5_flow_tbl_data_entry *tbl_data;\n \n \ttbl_data = mlx5_ipool_get(priv->sh->ipool[MLX5_IPOOL_JUMP],\n-\t\t\t     handle->dvh.jump);\n+\t\t\t     handle->jump);\n \tif (!tbl_data)\n \t\treturn 0;\n \tcache_resource = &tbl_data->jump;\n@@ -8317,7 +8328,7 @@ struct field_modify_info modify_tcp[] = {\n {\n \tstruct mlx5_priv *priv = dev->data->dev_private;\n \tstruct mlx5_flow_dv_port_id_action_resource *cache_resource;\n-\tuint32_t idx = handle->dvh.port_id_action;\n+\tuint32_t idx = handle->port_id_action;\n \n \tcache_resource = mlx5_ipool_get(priv->sh->ipool[MLX5_IPOOL_PORT_ID],\n \t\t\t\t\tidx);\n@@ -8410,12 +8421,17 @@ struct field_modify_info modify_tcp[] = {\n \t\t\tclaim_zero(mlx5_glue->dv_destroy_flow(dh->ib_flow));\n \t\t\tdh->ib_flow = NULL;\n \t\t}\n+\t\t/* hrxq is union, don't touch it only the flag is set. */\n \t\tif (dh->hrxq) {\n-\t\t\tif (dh->act_flags & MLX5_FLOW_ACTION_DROP)\n+\t\t\tif (dh->act_flags & MLX5_FLOW_ACTION_DROP) {\n \t\t\t\tmlx5_hrxq_drop_release(dev);\n-\t\t\telse\n+\t\t\t\tdh->hrxq = 0;\n+\t\t\t} else if (dh->act_flags &\n+\t\t\t\t  (MLX5_FLOW_ACTION_QUEUE |\n+\t\t\t\t  MLX5_FLOW_ACTION_RSS)) {\n \t\t\t\tmlx5_hrxq_release(dev, dh->hrxq);\n-\t\t\tdh->hrxq = 0;\n+\t\t\t\tdh->hrxq = 0;\n+\t\t\t}\n \t\t}\n \t\tif (dh->vf_vlan.tag && dh->vf_vlan.created)\n \t\t\tmlx5_vlan_vmwa_release(dev, &dh->vf_vlan);\n@@ -8463,9 +8479,9 @@ struct field_modify_info modify_tcp[] = {\n \t\t\tflow_dv_encap_decap_resource_release(dev, dev_handle);\n \t\tif (dev_handle->dvh.modify_hdr)\n \t\t\tflow_dv_modify_hdr_resource_release(dev_handle);\n-\t\tif (dev_handle->dvh.jump)\n+\t\tif (dev_handle->act_flags & MLX5_FLOW_ACTION_JUMP)\n \t\t\tflow_dv_jump_tbl_resource_release(dev, dev_handle);\n-\t\tif (dev_handle->dvh.port_id_action)\n+\t\tif (dev_handle->act_flags & MLX5_FLOW_ACTION_PORT_ID)\n \t\t\tflow_dv_port_id_action_resource_release(dev,\n \t\t\t\t\t\t\t\tdev_handle);\n \t\tif (dev_handle->dvh.push_vlan_res)\ndiff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c\nindex 9525fd4..931d547 100644\n--- a/drivers/net/mlx5/mlx5_flow_verbs.c\n+++ b/drivers/net/mlx5/mlx5_flow_verbs.c\n@@ -1754,12 +1754,17 @@\n \t\t\tclaim_zero(mlx5_glue->destroy_flow(handle->ib_flow));\n \t\t\thandle->ib_flow = NULL;\n \t\t}\n+\t\t/* hrxq is union, don't touch it only the flag is set. */\n \t\tif (handle->hrxq) {\n-\t\t\tif (handle->act_flags & MLX5_FLOW_ACTION_DROP)\n+\t\t\tif (handle->act_flags & MLX5_FLOW_ACTION_DROP) {\n \t\t\t\tmlx5_hrxq_drop_release(dev);\n-\t\t\telse\n+\t\t\t\thandle->hrxq = 0;\n+\t\t\t} else if (handle->act_flags &\n+\t\t\t\t  (MLX5_FLOW_ACTION_QUEUE |\n+\t\t\t\t  MLX5_FLOW_ACTION_RSS)) {\n \t\t\t\tmlx5_hrxq_release(dev, handle->hrxq);\n-\t\t\thandle->hrxq = 0;\n+\t\t\t\thandle->hrxq = 0;\n+\t\t\t}\n \t\t}\n \t\tif (handle->vf_vlan.tag && handle->vf_vlan.created)\n \t\t\tmlx5_vlan_vmwa_release(dev, &handle->vf_vlan);\n@@ -1891,12 +1896,17 @@\n \terr = rte_errno; /* Save rte_errno before cleanup. */\n \tSILIST_FOREACH(priv->sh->ipool[MLX5_IPOOL_MLX5_FLOW], flow->dev_handles,\n \t\t       dev_handles, handle, next) {\n+\t\t/* hrxq is union, don't touch it only the flag is set. */\n \t\tif (handle->hrxq) {\n-\t\t\tif (handle->act_flags & MLX5_FLOW_ACTION_DROP)\n+\t\t\tif (handle->act_flags & MLX5_FLOW_ACTION_DROP) {\n \t\t\t\tmlx5_hrxq_drop_release(dev);\n-\t\t\telse\n+\t\t\t\thandle->hrxq = 0;\n+\t\t\t} else if (handle->act_flags &\n+\t\t\t\t  (MLX5_FLOW_ACTION_QUEUE |\n+\t\t\t\t  MLX5_FLOW_ACTION_RSS)) {\n \t\t\t\tmlx5_hrxq_release(dev, handle->hrxq);\n-\t\t\thandle->hrxq = 0;\n+\t\t\t\thandle->hrxq = 0;\n+\t\t\t}\n \t\t}\n \t\tif (handle->vf_vlan.tag && handle->vf_vlan.created)\n \t\t\tmlx5_vlan_vmwa_release(dev, &handle->vf_vlan);\n",
    "prefixes": [
        "01/10"
    ]
}