get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 139280,
    "url": "http://patches.dpdk.org/api/patches/139280/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20240415112602.690972-1-aomeryamac@gmail.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": "<20240415112602.690972-1-aomeryamac@gmail.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240415112602.690972-1-aomeryamac@gmail.com",
    "date": "2024-04-15T11:26:02",
    "name": "[v4] lib/hash: add defer queue reclaim API",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "a60be1332c740cfb40a1491bc32163fabe4c9084",
    "submitter": {
        "id": 3080,
        "url": "http://patches.dpdk.org/api/people/3080/?format=api",
        "name": "Abdullah Ömer Yamaç",
        "email": "aomeryamac@gmail.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20240415112602.690972-1-aomeryamac@gmail.com/mbox/",
    "series": [
        {
            "id": 31739,
            "url": "http://patches.dpdk.org/api/series/31739/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=31739",
            "date": "2024-04-15T11:26:02",
            "name": "[v4] lib/hash: add defer queue reclaim API",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/31739/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/139280/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/139280/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 mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 6749A43E78;\n\tMon, 15 Apr 2024 13:26:12 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 29BB54026C;\n\tMon, 15 Apr 2024 13:26:10 +0200 (CEST)",
            "from mail-lj1-f178.google.com (mail-lj1-f178.google.com\n [209.85.208.178])\n by mails.dpdk.org (Postfix) with ESMTP id F09ED400EF\n for <dev@dpdk.org>; Mon, 15 Apr 2024 13:26:07 +0200 (CEST)",
            "by mail-lj1-f178.google.com with SMTP id\n 38308e7fff4ca-2da08b07157so33852831fa.1\n for <dev@dpdk.org>; Mon, 15 Apr 2024 04:26:07 -0700 (PDT)",
            "from dcu.otaknetworks.com ([212.156.37.190])\n by smtp.gmail.com with ESMTPSA id\n h14-20020a1709070b0e00b00a518c69c4e3sm5320495ejl.23.2024.04.15.04.26.05\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Mon, 15 Apr 2024 04:26:06 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20230601; t=1713180367; x=1713785167; darn=dpdk.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=odv6F42kK+aOw/8T5qxCf2EDRFw4pBskEirr4eD4NKs=;\n b=KoZUJIjMXDxagmqPzjSYgXdVQdbithsp+uhGsS6jds9RbyF9Z8o1RzpmOSj2K8UZiS\n JRP0oJ+V/pv75Cmee28jr4147t4wzJrezj81QfO3X8xAU5+Q0+9yJuXQ4aOKI6laPloy\n 2c8qsNpQUmd/N9L+URqtJbhyuisPHRXyBFLXuW5SmaH0MY5H85j4DE1+VpGcl0Pf4iRX\n 9NjHivG7AxWRS32LPGs5IAQWjDKcqlIAt0FcAHk7uQq0x4ev3APVZAyhaNDCal0SCekW\n XaWKwKSd9eJWFcCGSzcINTgdmOeXy0ds46IXLj7Ard2qTSL2SmiGMqPGNT8UtRXAKFjU\n ErRw==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1713180367; x=1713785167;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n :subject:date:message-id:reply-to;\n bh=odv6F42kK+aOw/8T5qxCf2EDRFw4pBskEirr4eD4NKs=;\n b=uNdwYyPc2nxvzMiNeJJ8nClAKvmg0ndAqCQYLLtFY8r4aI1iP8AZvJLTLPep6AdIiP\n PlRmYj4tYkDVgfumsHeDd34mFxHad6KRPQIwIvSec0svbTOQpeIQ+pKlK0jfG8VEdfWp\n UVDdc0DAAiboY+4ERA4NCjvJJqZDygf6EQGW/vF3OgVdQIsUJ2KRhSzQ6cFl61YaTWab\n 3VF3UTuBw7sr4+UP9TsucVNMJZir6N7kTuIWgEEa/km6RMq1VJmECh2cpjkRqMBDuhvQ\n HfopMPxZ7VQsP8l78C/cRYJmsu+TUI7buozNurV+L3xiK0kNG6eTKt3HXl5UViP15KQu\n IVpQ==",
        "X-Gm-Message-State": "AOJu0YwNuKYXGBuJGs7pFy63tBMqGwVON5OsMy9OPSwipsWR6pYJ4ZR+\n IC0txPk5NikHDfQkYoqIpLa2hfX+BrzAsMZxKTlqXjfH2e+k7X+JOCEbNA==",
        "X-Google-Smtp-Source": "\n AGHT+IErcNQ/Sx9sk2/QtxvGigfNCGcqED5APa3Nz4863wQHT3zhXIBfSrnIyyQ7hCT/4BpWvq9Ojw==",
        "X-Received": "by 2002:a2e:9d03:0:b0:2d8:bda5:c5f5 with SMTP id\n t3-20020a2e9d03000000b002d8bda5c5f5mr7467530lji.35.1713180366633;\n Mon, 15 Apr 2024 04:26:06 -0700 (PDT)",
        "From": "=?utf-8?b?QWJkdWxsYWggw5ZtZXIgWWFtYcOn?= <aomeryamac@gmail.com>",
        "To": "dev@dpdk.org",
        "Cc": "=?utf-8?b?QWJkdWxsYWggw5ZtZXIgWWFtYcOn?= <aomeryamac@gmail.com>",
        "Subject": "[PATCH v4] lib/hash: add defer queue reclaim API",
        "Date": "Mon, 15 Apr 2024 11:26:02 +0000",
        "Message-Id": "<20240415112602.690972-1-aomeryamac@gmail.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "\n <CA+sj1i9vXMtxeDnM9bzgnVyNTa-CCRyEvPP6hcbfLbuegxLRzg@mail.gmail.com>",
        "References": "\n <CA+sj1i9vXMtxeDnM9bzgnVyNTa-CCRyEvPP6hcbfLbuegxLRzg@mail.gmail.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "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"
    },
    "content": "This patch adds a new feature to the hash library to allow the user to\nreclaim the defer queue. This is useful when the user wants to force\nreclaim resources that are not being used. This API is only available\nif the RCU is enabled.\n\nSigned-off-by: Abdullah Ömer Yamaç <aomeryamac@gmail.com>\n---\n app/test/test_hash.c       | 97 ++++++++++++++++++++++++++++++++++++++\n lib/hash/rte_cuckoo_hash.c | 23 +++++++++\n lib/hash/rte_hash.h        | 24 ++++++++++\n lib/hash/version.map       |  7 +++\n 4 files changed, 151 insertions(+)",
    "diff": "diff --git a/app/test/test_hash.c b/app/test/test_hash.c\nindex d586878a22..ebeda8c322 100644\n--- a/app/test/test_hash.c\n+++ b/app/test/test_hash.c\n@@ -2183,6 +2183,100 @@ test_hash_rcu_qsbr_sync_mode(uint8_t ext_bkt)\n \n }\n \n+/*\n+ * rte_hash_rcu_qsbr_dq_reclaim unit test.\n+ */\n+static int\n+test_hash_rcu_qsbr_dq_reclaim(void)\n+{\n+\tsize_t sz;\n+\tint32_t status;\n+\tunsigned int total_entries = 8;\n+\tunsigned int freed, pending, available;\n+\tuint32_t reclaim_keys[8] = {10, 11, 12, 13, 14, 15, 16, 17};\n+\tstruct rte_hash_rcu_config rcu_cfg = {0};\n+\tstruct rte_hash_parameters hash_params = {\n+\t\t.name = \"test_hash_rcu_qsbr_dq_reclaim\",\n+\t\t.entries = total_entries,\n+\t\t.key_len = sizeof(uint32_t),\n+\t\t.hash_func = NULL,\n+\t\t.hash_func_init_val = 0,\n+\t\t.socket_id = 0,\n+\t};\n+\n+\thash_params.extra_flag = RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF;\n+\n+\tg_qsv = NULL;\n+\tg_handle = NULL;\n+\n+\tprintf(\"\\n# Running RCU QSBR DQ mode, reclaim defer queue functional test\\n\");\n+\n+\tg_handle = rte_hash_create(&hash_params);\n+\tRETURN_IF_ERROR_RCU_QSBR(g_handle == NULL, \"Hash creation failed\");\n+\n+\t/* Create RCU QSBR variable */\n+\tsz = rte_rcu_qsbr_get_memsize(RTE_MAX_LCORE);\n+\tg_qsv = (struct rte_rcu_qsbr *)rte_zmalloc_socket(NULL, sz,\n+\t\t\t\t\tRTE_CACHE_LINE_SIZE, SOCKET_ID_ANY);\n+\tRETURN_IF_ERROR_RCU_QSBR(g_qsv == NULL,\n+\t\t\t\t\t\t\t \"RCU QSBR variable creation failed\");\n+\n+\tstatus = rte_rcu_qsbr_init(g_qsv, RTE_MAX_LCORE);\n+\tRETURN_IF_ERROR_RCU_QSBR(status != 0,\n+\t\t\t\t\t\t\t \"RCU QSBR variable initialization failed\");\n+\n+\trcu_cfg.v = g_qsv;\n+\trcu_cfg.dq_size = total_entries;\n+\trcu_cfg.mode = RTE_HASH_QSBR_MODE_DQ;\n+\n+\t/* Attach RCU QSBR to hash table */\n+\tstatus = rte_hash_rcu_qsbr_add(g_handle, &rcu_cfg);\n+\tRETURN_IF_ERROR_RCU_QSBR(status != 0,\n+\t\t\t\t\t\t\t \"Attach RCU QSBR to hash table failed\");\n+\n+\t/* Register pseudo reader */\n+\tstatus = rte_rcu_qsbr_thread_register(g_qsv, 0);\n+\tRETURN_IF_ERROR_RCU_QSBR(status != 0,\n+\t\t\t\t\t\t\t \"RCU QSBR thread registration failed\");\n+\trte_rcu_qsbr_thread_online(g_qsv, 0);\n+\n+\t/* Fill half of the hash table */\n+\tfor (size_t i = 0; i < total_entries / 2; i++)\n+\t\tstatus = rte_hash_add_key(g_handle, &reclaim_keys[i]);\n+\n+\t/* Lookup inserted elements*/\n+\tfor (size_t i = 0; i < total_entries / 2; i++)\n+\t\trte_hash_lookup(g_handle, &reclaim_keys[i]);\n+\n+\t/* Try to put these elements into the defer queue*/\n+\tfor (size_t i = 0; i < total_entries / 2; i++)\n+\t\trte_hash_del_key(g_handle, &reclaim_keys[i]);\n+\n+\t/* Reader quiescent */\n+\trte_rcu_qsbr_quiescent(g_qsv, 0);\n+\n+\tstatus = rte_hash_add_key(g_handle, &reclaim_keys[0]);\n+\tRETURN_IF_ERROR_RCU_QSBR(status < 0,\n+\t\t\t\t\t\t\t \"failed to add key (pos[%u]=%d)\", 0,\n+\t\t\t\t\t\t\t status);\n+\n+\t/* This should be (total_entries / 2) + 1 (last add) */\n+\tunsigned int hash_size = rte_hash_count(g_handle);\n+\n+\t/* Freed size should be (total_entries / 2) */\n+\trte_hash_rcu_qsbr_dq_reclaim(g_handle, &freed, &pending, &available);\n+\n+\trte_hash_free(g_handle);\n+\trte_free(g_qsv);\n+\n+\tif (hash_size != (total_entries / 2 + 1) || freed != (total_entries / 2)) {\n+\t\tprintf(\"Failed to reclaim defer queue\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n /*\n  * Do all unit and performance tests.\n  */\n@@ -2261,6 +2355,9 @@ test_hash(void)\n \tif (test_hash_rcu_qsbr_sync_mode(1) < 0)\n \t\treturn -1;\n \n+\tif (test_hash_rcu_qsbr_dq_reclaim() < 0)\n+\t\treturn -1;\n+\n \treturn 0;\n }\n \ndiff --git a/lib/hash/rte_cuckoo_hash.c b/lib/hash/rte_cuckoo_hash.c\nindex 9cf94645f6..4a44aadd9a 100644\n--- a/lib/hash/rte_cuckoo_hash.c\n+++ b/lib/hash/rte_cuckoo_hash.c\n@@ -1588,6 +1588,29 @@ rte_hash_rcu_qsbr_add(struct rte_hash *h, struct rte_hash_rcu_config *cfg)\n \treturn 0;\n }\n \n+int\n+rte_hash_rcu_qsbr_dq_reclaim(struct rte_hash *h, unsigned int *freed,\n+\t\t\t\t\tunsigned int *pending, unsigned int *available)\n+{\n+\tint ret;\n+\n+\tif (h == NULL || h->hash_rcu_cfg == NULL) {\n+\t\trte_errno = EINVAL;\n+\t\treturn 1;\n+\t}\n+\n+\tret = rte_rcu_qsbr_dq_reclaim(h->dq, h->hash_rcu_cfg->max_reclaim_size,\n+\t\t\t\t\t\t\t\t  freed, pending, available);\n+\tif (ret != 0) {\n+\t\tHASH_LOG(ERR,\n+\t\t\t\t \"%s: could not reclaim the defer queue in hash table\",\n+\t\t\t\t __func__);\n+\t\treturn 1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n static inline void\n remove_entry(const struct rte_hash *h, struct rte_hash_bucket *bkt,\n \t\tunsigned int i)\ndiff --git a/lib/hash/rte_hash.h b/lib/hash/rte_hash.h\nindex 7ecc021111..edfa262aca 100644\n--- a/lib/hash/rte_hash.h\n+++ b/lib/hash/rte_hash.h\n@@ -674,6 +674,30 @@ rte_hash_iterate(const struct rte_hash *h, const void **key, void **data, uint32\n  */\n int rte_hash_rcu_qsbr_add(struct rte_hash *h, struct rte_hash_rcu_config *cfg);\n \n+/**\n+ * Reclaim resources from the defer queue.\n+ * This API reclaim the resources from the defer queue if rcu is enabled.\n+ *\n+ * @param h\n+ *   The hash object to reclaim resources.\n+ * @param freed\n+ *   Number of resources that were freed.\n+ * @param pending\n+ *   Number of resources pending on the defer queue.\n+ *   This number might not be accurate if multi-thread safety is configured.\n+ * @param available\n+ *   Number of resources that can be added to the defer queue.\n+ *   This number might not be accurate if multi-thread safety is configured.\n+ * @return\n+ *   On success - 0\n+ *   On error - 1 with error code set in rte_errno.\n+ *   Possible rte_errno codes are:\n+ *   - EINVAL - invalid pointer\n+ */\n+__rte_experimental\n+int rte_hash_rcu_qsbr_dq_reclaim(struct rte_hash *h, unsigned int *freed,\n+\t\tunsigned int *pending, unsigned int *available);\n+\n #ifdef __cplusplus\n }\n #endif\ndiff --git a/lib/hash/version.map b/lib/hash/version.map\nindex 6f4bcdb71b..d348dd9196 100644\n--- a/lib/hash/version.map\n+++ b/lib/hash/version.map\n@@ -53,3 +53,10 @@ INTERNAL {\n \trte_thash_gfni_stub;\n \trte_thash_gfni_bulk_stub;\n };\n+\n+EXPERIMENTAL {\n+\tglobal:\n+\n+\t# added in 24.07\n+\trte_hash_rcu_qsbr_dq_reclaim;\n+};\n",
    "prefixes": [
        "v4"
    ]
}