get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 139715,
    "url": "http://patchwork.dpdk.org/api/patches/139715/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20240427195418.1034591-1-aomeryamac@gmail.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": "<20240427195418.1034591-1-aomeryamac@gmail.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240427195418.1034591-1-aomeryamac@gmail.com",
    "date": "2024-04-27T19:54:18",
    "name": "[v5] lib/hash: add defer queue reclaim API",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "e3129033145cb7e45463ccb811c34923414a2f7c",
    "submitter": {
        "id": 3080,
        "url": "http://patchwork.dpdk.org/api/people/3080/?format=api",
        "name": "Abdullah Ömer Yamaç",
        "email": "aomeryamac@gmail.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patchwork.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20240427195418.1034591-1-aomeryamac@gmail.com/mbox/",
    "series": [
        {
            "id": 31835,
            "url": "http://patchwork.dpdk.org/api/series/31835/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=31835",
            "date": "2024-04-27T19:54:18",
            "name": "[v5] lib/hash: add defer queue reclaim API",
            "version": 5,
            "mbox": "http://patchwork.dpdk.org/series/31835/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/139715/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/139715/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 A913D43EDE;\n\tSat, 27 Apr 2024 21:54:26 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 0791940151;\n\tSat, 27 Apr 2024 21:54:26 +0200 (CEST)",
            "from mail-lf1-f52.google.com (mail-lf1-f52.google.com\n [209.85.167.52]) by mails.dpdk.org (Postfix) with ESMTP id 96858400D7\n for <dev@dpdk.org>; Sat, 27 Apr 2024 21:54:24 +0200 (CEST)",
            "by mail-lf1-f52.google.com with SMTP id\n 2adb3069b0e04-51acb95b892so4041353e87.2\n for <dev@dpdk.org>; Sat, 27 Apr 2024 12:54:24 -0700 (PDT)",
            "from dcu.otaknetworks.com ([212.156.37.190])\n by smtp.gmail.com with ESMTPSA id\n c27-20020a170906d19b00b00a5557bc8920sm11980482ejz.54.2024.04.27.12.54.22\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Sat, 27 Apr 2024 12:54:22 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20230601; t=1714247664; x=1714852464; 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=cUPp4htGY/guHSYMkkZM21kwHQzaH8OBz4wwJ+ODHh8=;\n b=CiooP6yCFGE1yJCCM8/xDa0+IYu1hjWvSL4YYBmD074zVC1IYY+Bg7gUkwcesz2Bjl\n n+6MGdfOVt5X63IDscTTrbTPkOBzY/YRLu7pgPHFTEs3dsLZm72YJISZQ4WAqmlfRl9L\n Wqr9UMCGiBzcKc938pwsCRjDm5bF5FNdRqRuNIMdyNVeythRS9upKg389rfDoFNWMp8Z\n +DsFl8yHKs8oFG3ehMW5qm1I13xiCrudzgsxySlLZLXu3s+m7SvjVBXFXGdAuHPlQuDE\n 2gtqQlf79HpnMK7ZUupVNARjHla1mjtfBNt8ULpspJWDPsiAUG4P8prO5Eq4ovJJVh6r\n 9RAQ==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1714247664; x=1714852464;\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=cUPp4htGY/guHSYMkkZM21kwHQzaH8OBz4wwJ+ODHh8=;\n b=rwq93luf+c4aGn01YPGFE8lznu/joSKYeeex0Kk858vX9XieJk2enu3/gEOeQoU5Z5\n 5XySo4CussIeLiSJMCQUdiTrMg5K1Jk268rNDQctnjgM/oZabJCti07Q7xwaYxAYA6yE\n k2uTbtESxMP9TsjQHlCV3EtsF4ypjXWBRCQy1Fpho9x/WD0aKy8V3jHjdV95RsphvGvj\n Vz/ZXzZsxO29bKDPLcW+ek53ym2W0B+p+pC5UTN1apqsaIeT79pfolVXBZKDxI1gQXZm\n tAPA4AUHuuulGKX67UdICcfMYj/adUDSnfQhj+zc35PDy/Kll/QV0iJjNtcLbI3VP2p6\n I0HQ==",
        "X-Gm-Message-State": "AOJu0Yzls0zwgHh5qS81hXD1z+kvabHFljqvfZ2JZ5V3pH0BH6du9EBj\n 5hf/MpJpSPzgzyeKdUE+dxPDwMnD9nCPPPH504uP8bGMTLF99E+LTYVi9A==",
        "X-Google-Smtp-Source": "\n AGHT+IEJl5qDMnmszokkhZR70Xe/gwChKqEs1v7bwLXG9kS/5IqYIBWFFLPsyH2BVTnjiStFIdjWKA==",
        "X-Received": "by 2002:a05:6512:3af:b0:51a:a65b:ae14 with SMTP id\n v15-20020a05651203af00b0051aa65bae14mr4544933lfp.25.1714247663435;\n Sat, 27 Apr 2024 12:54:23 -0700 (PDT)",
        "From": "=?utf-8?b?QWJkdWxsYWggw5ZtZXIgWWFtYcOn?= <aomeryamac@gmail.com>",
        "To": "dev@dpdk.org",
        "Cc": "stephen@networkplumber.org,\n =?utf-8?b?QWJkdWxsYWggw5ZtZXIgWWFtYcOn?= <aomeryamac@gmail.com>",
        "Subject": "[PATCH v5] lib/hash: add defer queue reclaim API",
        "Date": "Sat, 27 Apr 2024 19:54:18 +0000",
        "Message-Id": "<20240427195418.1034591-1-aomeryamac@gmail.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "\n <CA+sj1i9s4XdnP-NQbDAfLjhbyDTc6Bkfj3JrrvNqsobxNmT4Qg@mail.gmail.com>",
        "References": "\n <CA+sj1i9s4XdnP-NQbDAfLjhbyDTc6Bkfj3JrrvNqsobxNmT4Qg@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       | 90 ++++++++++++++++++++++++++++++++++++++\n lib/hash/rte_cuckoo_hash.c | 21 +++++++++\n lib/hash/rte_hash.h        | 25 +++++++++++\n lib/hash/version.map       |  7 +++\n 4 files changed, 143 insertions(+)",
    "diff": "diff --git a/app/test/test_hash.c b/app/test/test_hash.c\nindex d586878a22..e763d0503f 100644\n--- a/app/test/test_hash.c\n+++ b/app/test/test_hash.c\n@@ -2183,6 +2183,93 @@ 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 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    .name = \"test_hash_rcu_qsbr_dq_reclaim\",\n+\t    .entries = total_entries,\n+\t    .key_len = sizeof(uint32_t),\n+\t    .hash_func = NULL,\n+\t    .hash_func_init_val = 0,\n+\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, RTE_CACHE_LINE_SIZE,\n+\t\t\t\t\t\t\t  SOCKET_ID_ANY);\n+\tRETURN_IF_ERROR_RCU_QSBR(g_qsv == NULL, \"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, \"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, \"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, \"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, \"failed to add key (pos[%u]=%d)\", 0, 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 +2348,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..52ccada12a 100644\n--- a/lib/hash/rte_cuckoo_hash.c\n+++ b/lib/hash/rte_cuckoo_hash.c\n@@ -1588,6 +1588,27 @@ rte_hash_rcu_qsbr_add(struct rte_hash *h, struct rte_hash_rcu_config *cfg)\n \treturn 0;\n }\n \n+int rte_hash_rcu_qsbr_dq_reclaim(struct rte_hash *h, unsigned int *freed, unsigned int *pending,\n+\t\t\t\t unsigned int *available)\n+{\n+\tint ret;\n+\n+\tif (h == NULL || h->hash_rcu_cfg == NULL) {\n+\t\tHASH_LOG(ERR, \"Invalid input parameter\");\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, freed, pending,\n+\t\t\t\t      available);\n+\tif (ret != 0) {\n+\t\tHASH_LOG(ERR, \"%s: could not reclaim the defer queue in hash table\", __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..e1e0375fd5 100644\n--- a/lib/hash/rte_hash.h\n+++ b/lib/hash/rte_hash.h\n@@ -674,6 +674,31 @@ 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\t\t\t\t\t    unsigned int *pending,\n+\t\t\t\t\t\t    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": [
        "v5"
    ]
}