Show a patch.

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

{
    "id": 73545,
    "url": "https://patches.dpdk.org/api/patches/73545/",
    "web_url": "https://patches.dpdk.org/patch/73545/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/",
        "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"
    },
    "msgid": "<1eea307b02b279082248665604d8ddb7d4b1d943.1594238610.git.vladimir.medvedkin@intel.com>",
    "date": "2020-07-08T20:16:11",
    "name": "[v4,6/8] fib6: move lookup definition into the header file",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "494d9b474d6a0ecc5760ae87be39dcf588290fe8",
    "submitter": {
        "id": 1216,
        "url": "https://patches.dpdk.org/api/people/1216/",
        "name": "Vladimir Medvedkin",
        "email": "vladimir.medvedkin@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/patch/73545/mbox/",
    "series": [
        {
            "id": 10896,
            "url": "https://patches.dpdk.org/api/series/10896/",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=10896",
            "date": "2020-07-08T20:16:05",
            "name": "fib: implement AVX512 vector lookup",
            "version": 4,
            "mbox": "https://patches.dpdk.org/series/10896/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/73545/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/73545/checks/",
    "tags": {},
    "headers": {
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "Message-Id": "\n <1eea307b02b279082248665604d8ddb7d4b1d943.1594238610.git.vladimir.medvedkin@intel.com>",
        "IronPort-SDR": [
            "\n YaGGq2FV8URiwQnJ8KRDRhj9f5z/l8/U4GPg3yL2RKAG3cjCBE/vAyIb+X6GF3PlrMIjBlI19p\n tXOyspv9ncxw==",
            "\n TPIgHMdEtvgtiA/yr5bcoBuQ5ZwSz0ldQFcdYqEEZXFdJ9CNDLWxTPj8RWECeqE4xkNzcxA8LH\n sMTlKHg3fi5Q=="
        ],
        "X-Mailer": "git-send-email 2.17.1",
        "To": "dev@dpdk.org",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id D80C7A0526;\n\tWed,  8 Jul 2020 22:17:44 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 0DA821DEB6;\n\tWed,  8 Jul 2020 22:17:02 +0200 (CEST)",
            "from mga18.intel.com (mga18.intel.com [134.134.136.126])\n by dpdk.org (Postfix) with ESMTP id D02C61DCDD\n for <dev@dpdk.org>; Wed,  8 Jul 2020 22:16:56 +0200 (CEST)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 08 Jul 2020 13:16:56 -0700",
            "from silpixa00400322.ir.intel.com ([10.237.214.86])\n by fmsmga002.fm.intel.com with ESMTP; 08 Jul 2020 13:16:55 -0700"
        ],
        "X-BeenThere": "dev@dpdk.org",
        "X-Amp-File-Uploaded": "False",
        "Subject": "[dpdk-dev] [PATCH v4 6/8] fib6: move lookup definition into the\n\theader file",
        "Cc": "konstantin.ananyev@intel.com,\n\tbruce.richardson@intel.com",
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "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-Post": "<mailto:dev@dpdk.org>",
        "In-Reply-To": [
            "<cover.1594238609.git.vladimir.medvedkin@intel.com>",
            "<cover.1594238609.git.vladimir.medvedkin@intel.com>"
        ],
        "Precedence": "list",
        "X-ExtLoop1": "1",
        "From": "Vladimir Medvedkin <vladimir.medvedkin@intel.com>",
        "Content-Transfer-Encoding": "8bit",
        "MIME-Version": "1.0",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9676\"; a=\"135346089\"",
            "E=Sophos;i=\"5.75,329,1589266800\"; d=\"scan'208\";a=\"135346089\"",
            "E=Sophos;i=\"5.75,329,1589266800\"; d=\"scan'208\";a=\"315988616\""
        ],
        "References": [
            "<cover.1594238609.git.vladimir.medvedkin@intel.com>",
            "<cover.1589890262.git.vladimir.medvedkin@intel.com>\n <cover.1594238609.git.vladimir.medvedkin@intel.com>"
        ],
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "Errors-To": "dev-bounces@dpdk.org",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "Content-Type": "text/plain; charset=UTF-8",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Date": "Wed,  8 Jul 2020 21:16:11 +0100",
        "X-Mailman-Version": "2.1.15"
    },
    "content": "Move trie table layout and lookup defenition into the\nprivate header file. This is necessary for implementing a\nvectorized lookup function in a separate .с file.\n\nSigned-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>\nAcked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>\n---\n lib/librte_fib/trie.c | 121 ------------------------------------------\n lib/librte_fib/trie.h | 117 ++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 117 insertions(+), 121 deletions(-)",
    "diff": "diff --git a/lib/librte_fib/trie.c b/lib/librte_fib/trie.c\nindex 63c519a09..136e938df 100644\n--- a/lib/librte_fib/trie.c\n+++ b/lib/librte_fib/trie.c\n@@ -11,141 +11,20 @@\n \n #include <rte_debug.h>\n #include <rte_malloc.h>\n-#include <rte_prefetch.h>\n #include <rte_errno.h>\n #include <rte_memory.h>\n-#include <rte_branch_prediction.h>\n \n #include <rte_rib6.h>\n #include <rte_fib6.h>\n #include \"trie.h\"\n \n-/* @internal Total number of tbl24 entries. */\n-#define TRIE_TBL24_NUM_ENT\t(1 << 24)\n-\n-/* Maximum depth value possible for IPv6 LPM. */\n-#define TRIE_MAX_DEPTH\t\t128\n-\n-/* @internal Number of entries in a tbl8 group. */\n-#define TRIE_TBL8_GRP_NUM_ENT\t256ULL\n-\n-/* @internal Total number of tbl8 groups in the tbl8. */\n-#define TRIE_TBL8_NUM_GROUPS\t65536\n-\n-/* @internal bitmask with valid and valid_group fields set */\n-#define TRIE_EXT_ENT\t\t1\n-\n #define TRIE_NAMESIZE\t\t64\n \n-#define BITMAP_SLAB_BIT_SIZE_LOG2\t6\n-#define BITMAP_SLAB_BIT_SIZE\t\t(1ULL << BITMAP_SLAB_BIT_SIZE_LOG2)\n-#define BITMAP_SLAB_BITMASK\t\t(BITMAP_SLAB_BIT_SIZE - 1)\n-\n-struct rte_trie_tbl {\n-\tuint32_t\tnumber_tbl8s;\t/**< Total number of tbl8s */\n-\tuint32_t\trsvd_tbl8s;\t/**< Number of reserved tbl8s */\n-\tuint32_t\tcur_tbl8s;\t/**< Current cumber of tbl8s */\n-\tuint64_t\tdef_nh;\t\t/**< Default next hop */\n-\tenum rte_fib_trie_nh_sz\tnh_sz;\t/**< Size of nexthop entry */\n-\tuint64_t\t*tbl8;\t\t/**< tbl8 table. */\n-\tuint32_t\t*tbl8_pool;\t/**< bitmap containing free tbl8 idxes*/\n-\tuint32_t\ttbl8_pool_pos;\n-\t/* tbl24 table. */\n-\t__extension__ uint64_t\ttbl24[0] __rte_cache_aligned;\n-};\n-\n enum edge {\n \tLEDGE,\n \tREDGE\n };\n \n-static inline uint32_t\n-get_tbl24_idx(const uint8_t *ip)\n-{\n-\treturn ip[0] << 16|ip[1] << 8|ip[2];\n-}\n-\n-static inline void *\n-get_tbl24_p(struct rte_trie_tbl *dp, const uint8_t *ip, uint8_t nh_sz)\n-{\n-\tuint32_t tbl24_idx;\n-\n-\ttbl24_idx = get_tbl24_idx(ip);\n-\treturn (void *)&((uint8_t *)dp->tbl24)[tbl24_idx << nh_sz];\n-}\n-\n-static inline uint8_t\n-bits_in_nh(uint8_t nh_sz)\n-{\n-\treturn 8 * (1 << nh_sz);\n-}\n-\n-static inline uint64_t\n-get_max_nh(uint8_t nh_sz)\n-{\n-\treturn ((1ULL << (bits_in_nh(nh_sz) - 1)) - 1);\n-}\n-\n-static inline uint64_t\n-lookup_msk(uint8_t nh_sz)\n-{\n-\treturn ((1ULL << ((1 << (nh_sz + 3)) - 1)) << 1) - 1;\n-}\n-\n-static inline uint8_t\n-get_psd_idx(uint32_t val, uint8_t nh_sz)\n-{\n-\treturn val & ((1 << (3 - nh_sz)) - 1);\n-}\n-\n-static inline uint32_t\n-get_tbl_pos(uint32_t val, uint8_t nh_sz)\n-{\n-\treturn val >> (3 - nh_sz);\n-}\n-\n-static inline uint64_t\n-get_tbl_val_by_idx(uint64_t *tbl, uint32_t idx, uint8_t nh_sz)\n-{\n-\treturn ((tbl[get_tbl_pos(idx, nh_sz)] >> (get_psd_idx(idx, nh_sz) *\n-\t\tbits_in_nh(nh_sz))) & lookup_msk(nh_sz));\n-}\n-\n-static inline void *\n-get_tbl_p_by_idx(uint64_t *tbl, uint64_t idx, uint8_t nh_sz)\n-{\n-\treturn (uint8_t *)tbl + (idx << nh_sz);\n-}\n-\n-static inline int\n-is_entry_extended(uint64_t ent)\n-{\n-\treturn (ent & TRIE_EXT_ENT) == TRIE_EXT_ENT;\n-}\n-\n-#define LOOKUP_FUNC(suffix, type, nh_sz)\t\t\t\t\\\n-static void rte_trie_lookup_bulk_##suffix(void *p,\t\t\t\\\n-\tuint8_t ips[][RTE_FIB6_IPV6_ADDR_SIZE],\t\t\t\\\n-\tuint64_t *next_hops, const unsigned int n)\t\t\t\\\n-{\t\t\t\t\t\t\t\t\t\\\n-\tstruct rte_trie_tbl *dp = (struct rte_trie_tbl *)p;\t\t\\\n-\tuint64_t tmp;\t\t\t\t\t\t\t\\\n-\tuint32_t i, j;\t\t\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\t\t\\\n-\tfor (i = 0; i < n; i++) {\t\t\t\t\t\\\n-\t\ttmp = ((type *)dp->tbl24)[get_tbl24_idx(&ips[i][0])];\t\\\n-\t\tj = 3;\t\t\t\t\t\t\t\\\n-\t\twhile (is_entry_extended(tmp)) {\t\t\t\\\n-\t\t\ttmp = ((type *)dp->tbl8)[ips[i][j++] +\t\t\\\n-\t\t\t\t((tmp >> 1) * TRIE_TBL8_GRP_NUM_ENT)];\t\\\n-\t\t}\t\t\t\t\t\t\t\\\n-\t\tnext_hops[i] = tmp >> 1;\t\t\t\t\\\n-\t}\t\t\t\t\t\t\t\t\\\n-}\n-LOOKUP_FUNC(2b, uint16_t, 1)\n-LOOKUP_FUNC(4b, uint32_t, 2)\n-LOOKUP_FUNC(8b, uint64_t, 3)\n-\n rte_fib6_lookup_fn_t\n trie_get_lookup_fn(void *p, enum rte_fib_trie_lookup_type type)\n {\ndiff --git a/lib/librte_fib/trie.h b/lib/librte_fib/trie.h\nindex 0d5ef9a9f..663c7a90f 100644\n--- a/lib/librte_fib/trie.h\n+++ b/lib/librte_fib/trie.h\n@@ -10,11 +10,128 @@\n  * @file\n  * RTE IPv6 Longest Prefix Match (LPM)\n  */\n+#include <rte_prefetch.h>\n+#include <rte_branch_prediction.h>\n \n #ifdef __cplusplus\n extern \"C\" {\n #endif\n \n+/* @internal Total number of tbl24 entries. */\n+#define TRIE_TBL24_NUM_ENT\t(1 << 24)\n+/* Maximum depth value possible for IPv6 LPM. */\n+#define TRIE_MAX_DEPTH\t\t128\n+/* @internal Number of entries in a tbl8 group. */\n+#define TRIE_TBL8_GRP_NUM_ENT\t256ULL\n+/* @internal Total number of tbl8 groups in the tbl8. */\n+#define TRIE_TBL8_NUM_GROUPS\t65536\n+/* @internal bitmask with valid and valid_group fields set */\n+#define TRIE_EXT_ENT\t\t1\n+\n+#define BITMAP_SLAB_BIT_SIZE_LOG2\t6\n+#define BITMAP_SLAB_BIT_SIZE\t\t(1ULL << BITMAP_SLAB_BIT_SIZE_LOG2)\n+#define BITMAP_SLAB_BITMASK\t\t(BITMAP_SLAB_BIT_SIZE - 1)\n+\n+struct rte_trie_tbl {\n+\tuint32_t\tnumber_tbl8s;\t/**< Total number of tbl8s */\n+\tuint32_t\trsvd_tbl8s;\t/**< Number of reserved tbl8s */\n+\tuint32_t\tcur_tbl8s;\t/**< Current cumber of tbl8s */\n+\tuint64_t\tdef_nh;\t\t/**< Default next hop */\n+\tenum rte_fib_trie_nh_sz\tnh_sz;\t/**< Size of nexthop entry */\n+\tuint64_t\t*tbl8;\t\t/**< tbl8 table. */\n+\tuint32_t\t*tbl8_pool;\t/**< bitmap containing free tbl8 idxes*/\n+\tuint32_t\ttbl8_pool_pos;\n+\t/* tbl24 table. */\n+\t__extension__ uint64_t\ttbl24[0] __rte_cache_aligned;\n+};\n+\n+static inline uint32_t\n+get_tbl24_idx(const uint8_t *ip)\n+{\n+\treturn ip[0] << 16|ip[1] << 8|ip[2];\n+}\n+\n+static inline void *\n+get_tbl24_p(struct rte_trie_tbl *dp, const uint8_t *ip, uint8_t nh_sz)\n+{\n+\tuint32_t tbl24_idx;\n+\n+\ttbl24_idx = get_tbl24_idx(ip);\n+\treturn (void *)&((uint8_t *)dp->tbl24)[tbl24_idx << nh_sz];\n+}\n+\n+static inline uint8_t\n+bits_in_nh(uint8_t nh_sz)\n+{\n+\treturn 8 * (1 << nh_sz);\n+}\n+\n+static inline uint64_t\n+get_max_nh(uint8_t nh_sz)\n+{\n+\treturn ((1ULL << (bits_in_nh(nh_sz) - 1)) - 1);\n+}\n+\n+static inline uint64_t\n+lookup_msk(uint8_t nh_sz)\n+{\n+\treturn ((1ULL << ((1 << (nh_sz + 3)) - 1)) << 1) - 1;\n+}\n+\n+static inline uint8_t\n+get_psd_idx(uint32_t val, uint8_t nh_sz)\n+{\n+\treturn val & ((1 << (3 - nh_sz)) - 1);\n+}\n+\n+static inline uint32_t\n+get_tbl_pos(uint32_t val, uint8_t nh_sz)\n+{\n+\treturn val >> (3 - nh_sz);\n+}\n+\n+static inline uint64_t\n+get_tbl_val_by_idx(uint64_t *tbl, uint32_t idx, uint8_t nh_sz)\n+{\n+\treturn ((tbl[get_tbl_pos(idx, nh_sz)] >> (get_psd_idx(idx, nh_sz) *\n+\t\tbits_in_nh(nh_sz))) & lookup_msk(nh_sz));\n+}\n+\n+static inline void *\n+get_tbl_p_by_idx(uint64_t *tbl, uint64_t idx, uint8_t nh_sz)\n+{\n+\treturn (uint8_t *)tbl + (idx << nh_sz);\n+}\n+\n+static inline int\n+is_entry_extended(uint64_t ent)\n+{\n+\treturn (ent & TRIE_EXT_ENT) == TRIE_EXT_ENT;\n+}\n+\n+#define LOOKUP_FUNC(suffix, type, nh_sz)\t\t\t\t\\\n+static inline void rte_trie_lookup_bulk_##suffix(void *p,\t\t\\\n+\tuint8_t ips[][RTE_FIB6_IPV6_ADDR_SIZE],\t\t\t\t\\\n+\tuint64_t *next_hops, const unsigned int n)\t\t\t\\\n+{\t\t\t\t\t\t\t\t\t\\\n+\tstruct rte_trie_tbl *dp = (struct rte_trie_tbl *)p;\t\t\\\n+\tuint64_t tmp;\t\t\t\t\t\t\t\\\n+\tuint32_t i, j;\t\t\t\t\t\t\t\\\n+\t\t\t\t\t\t\t\t\t\\\n+\tfor (i = 0; i < n; i++) {\t\t\t\t\t\\\n+\t\ttmp = ((type *)dp->tbl24)[get_tbl24_idx(&ips[i][0])];\t\\\n+\t\tj = 3;\t\t\t\t\t\t\t\\\n+\t\twhile (is_entry_extended(tmp)) {\t\t\t\\\n+\t\t\ttmp = ((type *)dp->tbl8)[ips[i][j++] +\t\t\\\n+\t\t\t\t((tmp >> 1) * TRIE_TBL8_GRP_NUM_ENT)];\t\\\n+\t\t}\t\t\t\t\t\t\t\\\n+\t\tnext_hops[i] = tmp >> 1;\t\t\t\t\\\n+\t}\t\t\t\t\t\t\t\t\\\n+}\n+LOOKUP_FUNC(2b, uint16_t, 1)\n+LOOKUP_FUNC(4b, uint32_t, 2)\n+LOOKUP_FUNC(8b, uint64_t, 3)\n+\n void *\n trie_create(const char *name, int socket_id, struct rte_fib6_conf *conf);\n \n",
    "prefixes": [
        "v4",
        "6/8"
    ]
}