Show a patch.

GET /api/patches/73594/
Content-Type: application/json
Vary: Accept

    "id": 73594,
    "url": "",
    "web_url": "",
    "project": {
        "id": 1,
        "url": "",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "",
        "list_email": "",
        "web_url": "",
        "scm_url": "git://",
        "webscm_url": ""
    "msgid": "<>",
    "date": "2020-07-09T08:02:47",
    "name": "[v8,1/3] lib/lpm: integrate RCU QSBR",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "0fdefee6267388f5026bb5b2bd2ec40124dfffd3",
    "submitter": {
        "id": 1198,
        "url": "",
        "name": "Ruifeng Wang",
        "email": ""
    "delegate": {
        "id": 24651,
        "url": "",
        "username": "dmarchand",
        "first_name": "David",
        "last_name": "Marchand",
        "email": ""
    "mbox": "",
    "series": [
            "id": 10914,
            "url": "",
            "web_url": "",
            "date": "2020-07-09T08:02:46",
            "name": "RCU integration with LPM library",
            "version": 8,
            "mbox": ""
    "comments": "",
    "check": "warning",
    "checks": "",
    "tags": {},
    "headers": {
        "X-Mailer": "git-send-email 2.17.1",
        "List-Id": "DPDK patches and discussions <>",
        "From": "Ruifeng Wang <>",
        "List-Help": "<>",
        "Date": "Thu,  9 Jul 2020 16:02:47 +0800",
        "X-Mailman-Version": "2.1.15",
        "Delivered-To": "",
        "List-Subscribe": "<>,\n <>",
        "Cc": ",,,\n, Ruifeng Wang <>",
        "To": "Bruce Richardson <>,\n Vladimir Medvedkin <>,\n John McNamara <>,\n Marko Kovacevic <>, Ray Kinsella <>,\n Neil Horman <>",
        "Errors-To": "",
        "References": "<>\n <>",
        "Sender": "\"dev\" <>",
        "Return-Path": "<>",
        "X-BeenThere": "",
        "List-Post": "<>",
        "Received": [
            "from ( [])\n\tby (Postfix) with ESMTP id 00AB9A0526;\n\tThu,  9 Jul 2020 10:03:14 +0200 (CEST)",
            "from [] (localhost [])\n\tby (Postfix) with ESMTP id D02581DDA9;\n\tThu,  9 Jul 2020 10:03:13 +0200 (CEST)",
            "from ( [])\n by (Postfix) with ESMTP id 47E121DD94\n for <>; Thu,  9 Jul 2020 10:03:12 +0200 (CEST)",
            "from (unknown [])\n by (Postfix) with ESMTP id BB87031B;\n Thu,  9 Jul 2020 01:03:11 -0700 (PDT)",
            "from\n ( [])\n by (Postfix) with ESMTPA id 1CDD73F887;\n Thu,  9 Jul 2020 01:03:07 -0700 (PDT)"
        "List-Archive": "<>",
        "Subject": "[dpdk-dev] [PATCH v8 1/3] lib/lpm: integrate RCU QSBR",
        "In-Reply-To": "<>",
        "Message-Id": "<>",
        "Precedence": "list",
        "List-Unsubscribe": "<>,\n <>",
        "X-Original-To": ""
    "content": "Currently, the tbl8 group is freed even though the readers might be\nusing the tbl8 group entries. The freed tbl8 group can be reallocated\nquickly. This results in incorrect lookup results.\n\nRCU QSBR process is integrated for safe tbl8 group reclaim.\nRefer to RCU documentation to understand various aspects of\nintegrating RCU library into other libraries.\n\nTo avoid ABI breakage, a struct __rte_lpm is created for lpm library\ninternal use. This struct warps rte_lpm that has been exposed and\nalso includes members that don't need to be exposed such as RCU related\nconfig.\n\nSigned-off-by: Ruifeng Wang <>\nReviewed-by: Honnappa Nagarahalli <>\n---\n doc/guides/prog_guide/lpm_lib.rst  |  32 ++++++\n lib/librte_lpm/Makefile            |   2 +-\n lib/librte_lpm/         |   1 +\n lib/librte_lpm/rte_lpm.c           | 167 +++++++++++++++++++++++++----\n lib/librte_lpm/rte_lpm.h           |  53 +++++++++\n lib/librte_lpm/ |   6 ++\n 6 files changed, 237 insertions(+), 24 deletions(-)",
    "diff": "diff --git a/doc/guides/prog_guide/lpm_lib.rst b/doc/guides/prog_guide/lpm_lib.rst\nindex 1609a57d0..03945904b 100644\n--- a/doc/guides/prog_guide/lpm_lib.rst\n+++ b/doc/guides/prog_guide/lpm_lib.rst\n@@ -145,6 +145,38 @@ depending on whether we need to move to the next table or not.\n Prefix expansion is one of the keys of this algorithm,\n since it improves the speed dramatically by adding redundancy.\n \n+Deletion\n+~~~~~~~~\n+\n+When deleting a rule, a replacement rule is searched for. Replacement rule is an existing rule that has\n+the longest prefix match with the rule to be deleted, but has shorter prefix.\n+\n+If a replacement rule is found, target tbl24 and tbl8 entries are updated to have the same depth and next hop\n+value with the replacement rule.\n+\n+If no replacement rule can be found, target tbl24 and tbl8 entries will be cleared.\n+\n+Prefix expansion is performed if the rule's depth is not exactly 24 bits or 32 bits.\n+\n+After deleting a rule, a group of tbl8s that belongs to the same tbl24 entry are freed in following cases:\n+\n+*   All tbl8s in the group are empty .\n+\n+*   All tbl8s in the group have the same values and with depth no greater than 24.\n+\n+Free of tbl8s have different behaviors:\n+\n+*   If RCU is not used, tbl8s are cleared and reclaimed immediately.\n+\n+*   If RCU is used, tbl8s are reclaimed when readers are in quiescent state.\n+\n+When the LPM is not using RCU, tbl8 group can be freed immediately even though the readers might be using\n+the tbl8 group entries. This might result in incorrect lookup results.\n+\n+RCU QSBR process is integrated for safe tbl8 group reclamation. Application has certain responsibilities\n+while using this feature. Please refer to resource reclamation framework of :ref:`RCU library <RCU_Library>`\n+for more details.\n+\n Lookup\n ~~~~~~\n \ndiff --git a/lib/librte_lpm/Makefile b/lib/librte_lpm/Makefile\nindex d682785b6..6f06c5c03 100644\n--- a/lib/librte_lpm/Makefile\n+++ b/lib/librte_lpm/Makefile\n@@ -8,7 +8,7 @@ LIB = librte_lpm.a\n \n CFLAGS += -O3\n CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)\n-LDLIBS += -lrte_eal -lrte_hash\n+LDLIBS += -lrte_eal -lrte_hash -lrte_rcu\n \n EXPORT_MAP :=\n \ndiff --git a/lib/librte_lpm/ b/lib/librte_lpm/\nindex 021ac6d8d..6cfc083c5 100644\n--- a/lib/librte_lpm/\n+++ b/lib/librte_lpm/\n@@ -7,3 +7,4 @@ headers = files('rte_lpm.h', 'rte_lpm6.h')\n # without worrying about which architecture we actually need\n headers += files('rte_lpm_altivec.h', 'rte_lpm_neon.h', 'rte_lpm_sse.h')\n deps += ['hash']\n+deps += ['rcu']\ndiff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c\nindex 38ab512a4..4fbf5b6df 100644\n--- a/lib/librte_lpm/rte_lpm.c\n+++ b/lib/librte_lpm/rte_lpm.c\n@@ -1,5 +1,6 @@\n /* SPDX-License-Identifier: BSD-3-Clause\n  * Copyright(c) 2010-2014 Intel Corporation\n+ * Copyright(c) 2020 Arm Limited\n  */\n \n #include <string.h>\n@@ -39,6 +40,17 @@ enum valid_flag {\n \tVALID\n };\n \n+/** @internal LPM structure. */\n+struct __rte_lpm {\n+\t/* LPM metadata. */\n+\tstruct rte_lpm lpm;\n+\n+\t/* RCU config. */\n+\tstruct rte_rcu_qsbr *v;\t\t/* RCU QSBR variable. */\n+\tenum rte_lpm_qsbr_mode rcu_mode;/* Blocking, defer queue. */\n+\tstruct rte_rcu_qsbr_dq *dq;\t/* RCU QSBR defer queue. */\n+};\n+\n /* Macro to enable/disable run-time checks. */\n #if defined(RTE_LIBRTE_LPM_DEBUG)\n #include <rte_debug.h>\n@@ -122,6 +134,7 @@ rte_lpm_create(const char *name, int socket_id,\n \t\tconst struct rte_lpm_config *config)\n {\n \tchar mem_name[RTE_LPM_NAMESIZE];\n+\tstruct __rte_lpm *internal_lpm = NULL;\n \tstruct rte_lpm *lpm = NULL;\n \tstruct rte_tailq_entry *te;\n \tuint32_t mem_size, rules_size, tbl8s_size;\n@@ -140,12 +153,6 @@ rte_lpm_create(const char *name, int socket_id,\n \n \tsnprintf(mem_name, sizeof(mem_name), \"LPM_%s\", name);\n \n-\t/* Determine the amount of memory to allocate. */\n-\tmem_size = sizeof(*lpm);\n-\trules_size = sizeof(struct rte_lpm_rule) * config->max_rules;\n-\ttbl8s_size = (sizeof(struct rte_lpm_tbl_entry) *\n-\t\t\tRTE_LPM_TBL8_GROUP_NUM_ENTRIES * config->number_tbl8s);\n-\n \trte_mcfg_tailq_write_lock();\n \n \t/* guarantee there's no existing */\n@@ -161,6 +168,12 @@ rte_lpm_create(const char *name, int socket_id,\n \t\tgoto exit;\n \t}\n \n+\t/* Determine the amount of memory to allocate. */\n+\tmem_size = sizeof(*internal_lpm);\n+\trules_size = sizeof(struct rte_lpm_rule) * config->max_rules;\n+\ttbl8s_size = (sizeof(struct rte_lpm_tbl_entry) *\n+\t\t\tRTE_LPM_TBL8_GROUP_NUM_ENTRIES * config->number_tbl8s);\n+\n \t/* allocate tailq entry */\n \tte = rte_zmalloc(\"LPM_TAILQ_ENTRY\", sizeof(*te), 0);\n \tif (te == NULL) {\n@@ -170,22 +183,23 @@ rte_lpm_create(const char *name, int socket_id,\n \t}\n \n \t/* Allocate memory to store the LPM data structures. */\n-\tlpm = rte_zmalloc_socket(mem_name, mem_size,\n+\tinternal_lpm = rte_zmalloc_socket(mem_name, mem_size,\n \t\t\tRTE_CACHE_LINE_SIZE, socket_id);\n-\tif (lpm == NULL) {\n+\tif (internal_lpm == NULL) {\n \t\tRTE_LOG(ERR, LPM, \"LPM memory allocation failed\\n\");\n \t\trte_free(te);\n \t\trte_errno = ENOMEM;\n \t\tgoto exit;\n \t}\n \n+\tlpm = &internal_lpm->lpm;\n \tlpm->rules_tbl = rte_zmalloc_socket(NULL,\n \t\t\t(size_t)rules_size, RTE_CACHE_LINE_SIZE, socket_id);\n \n \tif (lpm->rules_tbl == NULL) {\n \t\tRTE_LOG(ERR, LPM, \"LPM rules_tbl memory allocation failed\\n\");\n-\t\trte_free(lpm);\n-\t\tlpm = NULL;\n+\t\trte_free(internal_lpm);\n+\t\tinternal_lpm = NULL;\n \t\trte_free(te);\n \t\trte_errno = ENOMEM;\n \t\tgoto exit;\n@@ -197,8 +211,8 @@ rte_lpm_create(const char *name, int socket_id,\n \tif (lpm->tbl8 == NULL) {\n \t\tRTE_LOG(ERR, LPM, \"LPM tbl8 memory allocation failed\\n\");\n \t\trte_free(lpm->rules_tbl);\n-\t\trte_free(lpm);\n-\t\tlpm = NULL;\n+\t\trte_free(internal_lpm);\n+\t\tinternal_lpm = NULL;\n \t\trte_free(te);\n \t\trte_errno = ENOMEM;\n \t\tgoto exit;\n@@ -225,6 +239,7 @@ rte_lpm_create(const char *name, int socket_id,\n void\n rte_lpm_free(struct rte_lpm *lpm)\n {\n+\tstruct __rte_lpm *internal_lpm;\n \tstruct rte_lpm_list *lpm_list;\n \tstruct rte_tailq_entry *te;\n \n@@ -246,12 +261,84 @@ rte_lpm_free(struct rte_lpm *lpm)\n \n \trte_mcfg_tailq_write_unlock();\n \n+\tinternal_lpm = container_of(lpm, struct __rte_lpm, lpm);\n+\tif (internal_lpm->dq)\n+\t\trte_rcu_qsbr_dq_delete(internal_lpm->dq);\n \trte_free(lpm->tbl8);\n \trte_free(lpm->rules_tbl);\n \trte_free(lpm);\n \trte_free(te);\n }\n \n+static void\n+__lpm_rcu_qsbr_free_resource(void *p, void *data, unsigned int n)\n+{\n+\tstruct rte_lpm_tbl_entry zero_tbl8_entry = {0};\n+\tuint32_t tbl8_group_index = *(uint32_t *)data;\n+\tstruct rte_lpm_tbl_entry *tbl8 = ((struct rte_lpm *)p)->tbl8;\n+\n+\tRTE_SET_USED(n);\n+\t/* Set tbl8 group invalid */\n+\t__atomic_store(&tbl8[tbl8_group_index], &zero_tbl8_entry,\n+\t\t__ATOMIC_RELAXED);\n+}\n+\n+/* Associate QSBR variable with an LPM object.\n+ */\n+int\n+rte_lpm_rcu_qsbr_add(struct rte_lpm *lpm, struct rte_lpm_rcu_config *cfg,\n+\tstruct rte_rcu_qsbr_dq **dq)\n+{\n+\tstruct __rte_lpm *internal_lpm;\n+\tchar rcu_dq_name[RTE_RCU_QSBR_DQ_NAMESIZE];\n+\tstruct rte_rcu_qsbr_dq_parameters params = {0};\n+\n+\tif (lpm == NULL || cfg == NULL) {\n+\t\trte_errno = EINVAL;\n+\t\treturn 1;\n+\t}\n+\n+\tinternal_lpm = container_of(lpm, struct __rte_lpm, lpm);\n+\tif (internal_lpm->v != NULL) {\n+\t\trte_errno = EEXIST;\n+\t\treturn 1;\n+\t}\n+\n+\tif (cfg->mode == RTE_LPM_QSBR_MODE_SYNC) {\n+\t\t/* No other things to do. */\n+\t} else if (cfg->mode == RTE_LPM_QSBR_MODE_DQ) {\n+\t\t/* Init QSBR defer queue. */\n+\t\tsnprintf(rcu_dq_name, sizeof(rcu_dq_name),\n+\t\t\t\t\"LPM_RCU_%s\", lpm->name);\n+\t\ = rcu_dq_name;\n+\t\tparams.size = cfg->dq_size;\n+\t\tif (params.size == 0)\n+\t\t\tparams.size = lpm->number_tbl8s;\n+\t\tparams.trigger_reclaim_limit = cfg->reclaim_thd;\n+\t\tparams.max_reclaim_size = cfg->reclaim_max;\n+\t\tif (params.max_reclaim_size == 0)\n+\t\t\tparams.max_reclaim_size = RTE_LPM_RCU_DQ_RECLAIM_MAX;\n+\t\tparams.esize = sizeof(uint32_t);\t/* tbl8 group index */\n+\t\tparams.free_fn = __lpm_rcu_qsbr_free_resource;\n+\t\tparams.p = lpm;\n+\t\tparams.v = cfg->v;\n+\t\tinternal_lpm->dq = rte_rcu_qsbr_dq_create(&params);\n+\t\tif (internal_lpm->dq == NULL) {\n+\t\t\tRTE_LOG(ERR, LPM, \"LPM defer queue creation failed\\n\");\n+\t\t\treturn 1;\n+\t\t}\n+\t\tif (dq)\n+\t\t\t*dq = internal_lpm->dq;\n+\t} else {\n+\t\trte_errno = EINVAL;\n+\t\treturn 1;\n+\t}\n+\tinternal_lpm->rcu_mode = cfg->mode;\n+\tinternal_lpm->v = cfg->v;\n+\n+\treturn 0;\n+}\n+\n /*\n  * Adds a rule to the rule table.\n  *\n@@ -394,14 +481,15 @@ rule_find(struct rte_lpm *lpm, uint32_t ip_masked, uint8_t depth)\n  * Find, clean and allocate a tbl8.\n  */\n static int32_t\n-tbl8_alloc(struct rte_lpm_tbl_entry *tbl8, uint32_t number_tbl8s)\n+_tbl8_alloc(struct rte_lpm *lpm)\n {\n \tuint32_t group_idx; /* tbl8 group index. */\n \tstruct rte_lpm_tbl_entry *tbl8_entry;\n \n \t/* Scan through tbl8 to find a free (i.e. INVALID) tbl8 group. */\n-\tfor (group_idx = 0; group_idx < number_tbl8s; group_idx++) {\n-\t\ttbl8_entry = &tbl8[group_idx * RTE_LPM_TBL8_GROUP_NUM_ENTRIES];\n+\tfor (group_idx = 0; group_idx < lpm->number_tbl8s; group_idx++) {\n+\t\ttbl8_entry = &lpm->tbl8[group_idx *\n+\t\t\t\t\tRTE_LPM_TBL8_GROUP_NUM_ENTRIES];\n \t\t/* If a free tbl8 group is found clean it and set as VALID. */\n \t\tif (!tbl8_entry->valid_group) {\n \t\t\tstruct rte_lpm_tbl_entry new_tbl8_entry = {\n@@ -427,14 +515,47 @@ tbl8_alloc(struct rte_lpm_tbl_entry *tbl8, uint32_t number_tbl8s)\n \treturn -ENOSPC;\n }\n \n+static int32_t\n+tbl8_alloc(struct rte_lpm *lpm)\n+{\n+\tstruct __rte_lpm *internal_lpm = container_of(lpm,\n+\t\t\t\t\t\tstruct __rte_lpm, lpm);\n+\tint32_t group_idx; /* tbl8 group index. */\n+\n+\tgroup_idx = _tbl8_alloc(lpm);\n+\tif (group_idx == -ENOSPC && internal_lpm->dq != NULL) {\n+\t\t/* If there are no tbl8 groups try to reclaim one. */\n+\t\tif (rte_rcu_qsbr_dq_reclaim(internal_lpm->dq, 1,\n+\t\t\t\tNULL, NULL, NULL) == 0)\n+\t\t\tgroup_idx = _tbl8_alloc(lpm);\n+\t}\n+\n+\treturn group_idx;\n+}\n+\n static void\n-tbl8_free(struct rte_lpm_tbl_entry *tbl8, uint32_t tbl8_group_start)\n+tbl8_free(struct rte_lpm *lpm, uint32_t tbl8_group_start)\n {\n-\t/* Set tbl8 group invalid*/\n+\tstruct __rte_lpm *internal_lpm = container_of(lpm,\n+\t\t\t\t\t\tstruct __rte_lpm, lpm);\n \tstruct rte_lpm_tbl_entry zero_tbl8_entry = {0};\n \n-\t__atomic_store(&tbl8[tbl8_group_start], &zero_tbl8_entry,\n-\t\t\t__ATOMIC_RELAXED);\n+\tif (internal_lpm->v == NULL) {\n+\t\t/* Set tbl8 group invalid*/\n+\t\t__atomic_store(&lpm->tbl8[tbl8_group_start], &zero_tbl8_entry,\n+\t\t\t\t__ATOMIC_RELAXED);\n+\t} else if (internal_lpm->rcu_mode == RTE_LPM_QSBR_MODE_SYNC) {\n+\t\t/* Wait for quiescent state change. */\n+\t\trte_rcu_qsbr_synchronize(internal_lpm->v,\n+\t\t\tRTE_QSBR_THRID_INVALID);\n+\t\t/* Set tbl8 group invalid*/\n+\t\t__atomic_store(&lpm->tbl8[tbl8_group_start], &zero_tbl8_entry,\n+\t\t\t\t__ATOMIC_RELAXED);\n+\t} else if (internal_lpm->rcu_mode == RTE_LPM_QSBR_MODE_DQ) {\n+\t\t/* Push into QSBR defer queue. */\n+\t\trte_rcu_qsbr_dq_enqueue(internal_lpm->dq,\n+\t\t\t\t(void *)&tbl8_group_start);\n+\t}\n }\n \n static __rte_noinline int32_t\n@@ -523,7 +644,7 @@ add_depth_big(struct rte_lpm *lpm, uint32_t ip_masked, uint8_t depth,\n \n \tif (!lpm->tbl24[tbl24_index].valid) {\n \t\t/* Search for a free tbl8 group. */\n-\t\ttbl8_group_index = tbl8_alloc(lpm->tbl8, lpm->number_tbl8s);\n+\t\ttbl8_group_index = tbl8_alloc(lpm);\n \n \t\t/* Check tbl8 allocation was successful. */\n \t\tif (tbl8_group_index < 0) {\n@@ -569,7 +690,7 @@ add_depth_big(struct rte_lpm *lpm, uint32_t ip_masked, uint8_t depth,\n \t} /* If valid entry but not extended calculate the index into Table8. */\n \telse if (lpm->tbl24[tbl24_index].valid_group == 0) {\n \t\t/* Search for free tbl8 group. */\n-\t\ttbl8_group_index = tbl8_alloc(lpm->tbl8, lpm->number_tbl8s);\n+\t\ttbl8_group_index = tbl8_alloc(lpm);\n \n \t\tif (tbl8_group_index < 0) {\n \t\t\treturn tbl8_group_index;\n@@ -977,7 +1098,7 @@ delete_depth_big(struct rte_lpm *lpm, uint32_t ip_masked,\n \t\t */\n \t\tlpm->tbl24[tbl24_index].valid = 0;\n \t\t__atomic_thread_fence(__ATOMIC_RELEASE);\n-\t\ttbl8_free(lpm->tbl8, tbl8_group_start);\n+\t\ttbl8_free(lpm, tbl8_group_start);\n \t} else if (tbl8_recycle_index > -1) {\n \t\t/* Update tbl24 entry. */\n \t\tstruct rte_lpm_tbl_entry new_tbl24_entry = {\n@@ -993,7 +1114,7 @@ delete_depth_big(struct rte_lpm *lpm, uint32_t ip_masked,\n \t\t__atomic_store(&lpm->tbl24[tbl24_index], &new_tbl24_entry,\n \t\t\t\t__ATOMIC_RELAXED);\n \t\t__atomic_thread_fence(__ATOMIC_RELEASE);\n-\t\ttbl8_free(lpm->tbl8, tbl8_group_start);\n+\t\ttbl8_free(lpm, tbl8_group_start);\n \t}\n #undef group_idx\n \treturn 0;\ndiff --git a/lib/librte_lpm/rte_lpm.h b/lib/librte_lpm/rte_lpm.h\nindex b9d49ac87..a9568fcdd 100644\n--- a/lib/librte_lpm/rte_lpm.h\n+++ b/lib/librte_lpm/rte_lpm.h\n@@ -1,5 +1,6 @@\n /* SPDX-License-Identifier: BSD-3-Clause\n  * Copyright(c) 2010-2014 Intel Corporation\n+ * Copyright(c) 2020 Arm Limited\n  */\n \n #ifndef _RTE_LPM_H_\n@@ -20,6 +21,7 @@\n #include <rte_memory.h>\n #include <rte_common.h>\n #include <rte_vect.h>\n+#include <rte_rcu_qsbr.h>\n \n #ifdef __cplusplus\n extern \"C\" {\n@@ -62,6 +64,17 @@ extern \"C\" {\n /** Bitmask used to indicate successful lookup */\n #define RTE_LPM_LOOKUP_SUCCESS          0x01000000\n \n+/** @internal Default RCU defer queue entries to reclaim in one go. */\n+#define RTE_LPM_RCU_DQ_RECLAIM_MAX\t16\n+\n+/** RCU reclamation modes */\n+enum rte_lpm_qsbr_mode {\n+\t/** Create defer queue for reclaim. */\n+\tRTE_LPM_QSBR_MODE_DQ = 0,\n+\t/** Use blocking mode reclaim. No defer queue created. */\n+\tRTE_LPM_QSBR_MODE_SYNC\n+};\n+\n #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN\n /** @internal Tbl24 entry structure. */\n __extension__\n@@ -132,6 +145,22 @@ struct rte_lpm {\n \tstruct rte_lpm_rule *rules_tbl; /**< LPM rules. */\n };\n \n+/** LPM RCU QSBR configuration structure. */\n+struct rte_lpm_rcu_config {\n+\tstruct rte_rcu_qsbr *v;\t/* RCU QSBR variable. */\n+\t/* Mode of RCU QSBR. RTE_LPM_QSBR_MODE_xxx\n+\t * '0' for default: create defer queue for reclaim.\n+\t */\n+\tenum rte_lpm_qsbr_mode mode;\n+\tuint32_t dq_size;\t/* RCU defer queue size.\n+\t\t\t\t * default: lpm->number_tbl8s.\n+\t\t\t\t */\n+\tuint32_t reclaim_thd;\t/* Threshold to trigger auto reclaim. */\n+\tuint32_t reclaim_max;\t/* Max entries to reclaim in one go.\n+\t\t\t\t * default: RTE_LPM_RCU_DQ_RECLAIM_MAX.\n+\t\t\t\t */\n+};\n+\n /**\n  * Create an LPM object.\n  *\n@@ -179,6 +208,30 @@ rte_lpm_find_existing(const char *name);\n void\n rte_lpm_free(struct rte_lpm *lpm);\n \n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice\n+ *\n+ * Associate RCU QSBR variable with an LPM object.\n+ *\n+ * @param lpm\n+ *   the lpm object to add RCU QSBR\n+ * @param cfg\n+ *   RCU QSBR configuration\n+ * @param dq\n+ *   handler of created RCU QSBR defer queue\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+ *   - EEXIST - already added QSBR\n+ *   - ENOMEM - memory allocation failure\n+ */\n+__rte_experimental\n+int rte_lpm_rcu_qsbr_add(struct rte_lpm *lpm, struct rte_lpm_rcu_config *cfg,\n+\tstruct rte_rcu_qsbr_dq **dq);\n+\n /**\n  * Add a rule to the LPM table.\n  *\ndiff --git a/lib/librte_lpm/ b/lib/librte_lpm/\nindex 500f58b80..bfccd7eac 100644\n--- a/lib/librte_lpm/\n+++ b/lib/librte_lpm/\n@@ -21,3 +21,9 @@ DPDK_20.0 {\n \n \tlocal: *;\n };\n+\n+EXPERIMENTAL {\n+\tglobal:\n+\n+\trte_lpm_rcu_qsbr_add;\n+};\n",
    "prefixes": [