get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 75089,
    "url": "http://patches.dpdk.org/api/patches/75089/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1596166458-150683-2-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": "<1596166458-150683-2-git-send-email-suanmingm@mellanox.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1596166458-150683-2-git-send-email-suanmingm@mellanox.com",
    "date": "2020-07-31T03:34:17",
    "name": "[1/2] net/mlx5: add hash list extended lookup and insert",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "18c6ba61cb293db0c77ef5695794e845b7d3b7ae",
    "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/1596166458-150683-2-git-send-email-suanmingm@mellanox.com/mbox/",
    "series": [
        {
            "id": 11428,
            "url": "http://patches.dpdk.org/api/series/11428/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=11428",
            "date": "2020-07-31T03:34:16",
            "name": "net/mlx5: manage modify actions with hashed list",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/11428/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/75089/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/75089/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 3C17FA052B;\n\tFri, 31 Jul 2020 05:34:35 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 8FE211C010;\n\tFri, 31 Jul 2020 05:34:28 +0200 (CEST)",
            "from git-send-mailer.rdmz.labs.mlnx (unknown [94.188.199.2])\n by dpdk.org (Postfix) with ESMTP id 9F5D42862\n for <dev@dpdk.org>; Fri, 31 Jul 2020 05:34:25 +0200 (CEST)"
        ],
        "From": "Suanming Mou <suanmingm@mellanox.com>",
        "To": "viacheslavo@mellanox.com,\n\tmatan@mellanox.com",
        "Cc": "rasland@mellanox.com,\n\tdev@dpdk.org",
        "Date": "Fri, 31 Jul 2020 11:34:17 +0800",
        "Message-Id": "<1596166458-150683-2-git-send-email-suanmingm@mellanox.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1596166458-150683-1-git-send-email-suanmingm@mellanox.com>",
        "References": "<1596166458-150683-1-git-send-email-suanmingm@mellanox.com>",
        "Subject": "[dpdk-dev] [PATCH 1/2] net/mlx5: add hash list extended lookup and\n\tinsert",
        "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 mlx5 PMD hashed list was designed in approach to contain the items\nwith unique keys only. Now there is the need to store the objects with\npossible key collisions. It is not expected to have many collisions\n(very likely to have a few ones), but keys become not unique.\n\nThis commit adds the hash list extended functions in order to support\ninsertion and lookup for the lists with non-unique keys.\n\nSigned-off-by: Suanming Mou <suanmingm@mellanox.com>\nAcked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>\n---\n drivers/net/mlx5/mlx5_utils.c | 38 +++++++++++++++++++++++++++++\n drivers/net/mlx5/mlx5_utils.h | 57 +++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 95 insertions(+)",
    "diff": "diff --git a/drivers/net/mlx5/mlx5_utils.c b/drivers/net/mlx5/mlx5_utils.c\nindex 25e8b27..fefe833 100644\n--- a/drivers/net/mlx5/mlx5_utils.c\n+++ b/drivers/net/mlx5/mlx5_utils.c\n@@ -81,6 +81,44 @@ struct mlx5_hlist_entry *\n \treturn 0;\n }\n \n+struct mlx5_hlist_entry *\n+mlx5_hlist_lookup_ex(struct mlx5_hlist *h, uint64_t key,\n+\t\t     mlx5_hlist_match_callback_fn cb, void *ctx)\n+{\n+\tuint32_t idx;\n+\tstruct mlx5_hlist_head *first;\n+\tstruct mlx5_hlist_entry *node;\n+\n+\tMLX5_ASSERT(h && cb && ctx);\n+\tidx = rte_hash_crc_8byte(key, 0) & h->mask;\n+\tfirst = &h->heads[idx];\n+\tLIST_FOREACH(node, first, next) {\n+\t\tif (!cb(node, ctx))\n+\t\t\treturn node;\n+\t}\n+\treturn NULL;\n+}\n+\n+int\n+mlx5_hlist_insert_ex(struct mlx5_hlist *h, struct mlx5_hlist_entry *entry,\n+\t\t     mlx5_hlist_match_callback_fn cb, void *ctx)\n+{\n+\tuint32_t idx;\n+\tstruct mlx5_hlist_head *first;\n+\tstruct mlx5_hlist_entry *node;\n+\n+\tMLX5_ASSERT(h && entry && cb && ctx);\n+\tidx = rte_hash_crc_8byte(entry->key, 0) & h->mask;\n+\tfirst = &h->heads[idx];\n+\t/* No need to reuse the lookup function. */\n+\tLIST_FOREACH(node, first, next) {\n+\t\tif (!cb(node, ctx))\n+\t\t\treturn -EEXIST;\n+\t}\n+\tLIST_INSERT_HEAD(first, entry, next);\n+\treturn 0;\n+}\n+\n void\n mlx5_hlist_remove(struct mlx5_hlist *h __rte_unused,\n \t\t  struct mlx5_hlist_entry *entry)\ndiff --git a/drivers/net/mlx5/mlx5_utils.h b/drivers/net/mlx5/mlx5_utils.h\nindex 562b9b1..97d931f 100644\n--- a/drivers/net/mlx5/mlx5_utils.h\n+++ b/drivers/net/mlx5/mlx5_utils.h\n@@ -265,6 +265,20 @@ struct mlx5_hlist_entry {\n /** Type of function that is used to handle the data before freeing. */\n typedef void (*mlx5_hlist_destroy_callback_fn)(void *p, void *ctx);\n \n+/**\n+ * Type of function for user defined matching.\n+ *\n+ * @param entry\n+ *   The entry in the list.\n+ * @param ctx\n+ *   The pointer to new entry context.\n+ *\n+ * @return\n+ *   0 if matching, -1 otherwise.\n+ */\n+typedef int (*mlx5_hlist_match_callback_fn)(struct mlx5_hlist_entry *entry,\n+\t\t\t\t\t     void *ctx);\n+\n /** hash list table structure */\n struct mlx5_hlist {\n \tchar name[MLX5_HLIST_NAMESIZE]; /**< Name of the hash list. */\n@@ -323,6 +337,49 @@ struct mlx5_hlist {\n int mlx5_hlist_insert(struct mlx5_hlist *h, struct mlx5_hlist_entry *entry);\n \n /**\n+ * Extended routine to search an entry matching the context with\n+ * user defined match function.\n+ *\n+ * @param h\n+ *   Pointer to the hast list table.\n+ * @param key\n+ *   Key for the searching entry.\n+ * @param cb\n+ *   Callback function to match the node with context.\n+ * @param ctx\n+ *   Common context parameter used by callback function.\n+ *\n+ * @return\n+ *   Pointer of the hlist entry if found, NULL otherwise.\n+ */\n+struct mlx5_hlist_entry *mlx5_hlist_lookup_ex(struct mlx5_hlist *h,\n+\t\t\t\t\t      uint64_t key,\n+\t\t\t\t\t      mlx5_hlist_match_callback_fn cb,\n+\t\t\t\t\t      void *ctx);\n+\n+/**\n+ * Extended routine to insert an entry to the list with key collisions.\n+ *\n+ * For the list have key collision, the extra user defined match function\n+ * allows node with same key will be inserted.\n+ *\n+ * @param h\n+ *   Pointer to the hast list table.\n+ * @param entry\n+ *   Entry to be inserted into the hash list table.\n+ * @param cb\n+ *   Callback function to match the node with context.\n+ * @param ctx\n+ *   Common context parameter used by callback function.\n+ *\n+ * @return\n+ *   - zero for success.\n+ *   - -EEXIST if the entry is already inserted.\n+ */\n+int mlx5_hlist_insert_ex(struct mlx5_hlist *h, struct mlx5_hlist_entry *entry,\n+\t\t\t mlx5_hlist_match_callback_fn cb, void *ctx);\n+\n+/**\n  * Remove an entry from the hash list table. User should guarantee the validity\n  * of the entry.\n  *\n",
    "prefixes": [
        "1/2"
    ]
}