Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/62324/?format=api
http://patches.dpdk.org/api/patches/62324/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/dc1f955c6b11043c86bae64ea2a5672195b61864.1572621163.git.vladimir.medvedkin@intel.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": "<dc1f955c6b11043c86bae64ea2a5672195b61864.1572621163.git.vladimir.medvedkin@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/dc1f955c6b11043c86bae64ea2a5672195b61864.1572621163.git.vladimir.medvedkin@intel.com", "date": "2019-11-01T15:21:42", "name": "[v6,09/12] test/fib: add FIB library autotests", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "70b4adee2bebc4a4c2104d1be831d9c76cad6265", "submitter": { "id": 1216, "url": "http://patches.dpdk.org/api/people/1216/?format=api", "name": "Vladimir Medvedkin", "email": "vladimir.medvedkin@intel.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/dc1f955c6b11043c86bae64ea2a5672195b61864.1572621163.git.vladimir.medvedkin@intel.com/mbox/", "series": [ { "id": 7198, "url": "http://patches.dpdk.org/api/series/7198/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=7198", "date": "2019-11-01T15:21:33", "name": "lib: add RIB and FIB liraries", "version": 6, "mbox": "http://patches.dpdk.org/series/7198/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/62324/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/62324/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 C024FA00BE;\n\tFri, 1 Nov 2019 16:23:46 +0100 (CET)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id F390E1E892;\n\tFri, 1 Nov 2019 16:22:10 +0100 (CET)", "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n by dpdk.org (Postfix) with ESMTP id 9575C1E86F\n for <dev@dpdk.org>; Fri, 1 Nov 2019 16:22:08 +0100 (CET)", "from orsmga004.jf.intel.com ([10.7.209.38])\n by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n 01 Nov 2019 08:22:08 -0700", "from silpixa00400072.ir.intel.com ([10.237.222.213])\n by orsmga004.jf.intel.com with ESMTP; 01 Nov 2019 08:22:06 -0700" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.68,256,1569308400\"; d=\"scan'208\";a=\"351979141\"", "From": "Vladimir Medvedkin <vladimir.medvedkin@intel.com>", "To": "dev@dpdk.org", "Cc": "bruce.richardson@intel.com, konstantin.ananyev@intel.com,\n thomas@monjalon.net, aconole@redhat.com", "Date": "Fri, 1 Nov 2019 15:21:42 +0000", "Message-Id": "\n <dc1f955c6b11043c86bae64ea2a5672195b61864.1572621163.git.vladimir.medvedkin@intel.com>", "X-Mailer": "git-send-email 2.7.4", "In-Reply-To": [ "<cover.1572621162.git.vladimir.medvedkin@intel.com>", "<cover.1572621162.git.vladimir.medvedkin@intel.com>" ], "References": [ "<cover.1572621162.git.vladimir.medvedkin@intel.com>", "<cover.1568221361.git.vladimir.medvedkin@intel.com>\n <cover.1572621162.git.vladimir.medvedkin@intel.com>" ], "Subject": "[dpdk-dev] [PATCH v6 09/12] test/fib: add FIB library autotests", "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": "Functional tests for the new FIB library.\n\nSigned-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>\n---\n app/test/Makefile | 1 +\n app/test/autotest_data.py | 12 ++\n app/test/meson.build | 4 +\n app/test/test_fib.c | 414 ++++++++++++++++++++++++++++++++++++++++++++++\n 4 files changed, 431 insertions(+)\n create mode 100644 app/test/test_fib.c", "diff": "diff --git a/app/test/Makefile b/app/test/Makefile\nindex 4638426..b67ca16 100644\n--- a/app/test/Makefile\n+++ b/app/test/Makefile\n@@ -126,6 +126,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_HASH) += test_hash_readwrite_lf.c\n \n SRCS-$(CONFIG_RTE_LIBRTE_RIB) += test_rib.c\n SRCS-$(CONFIG_RTE_LIBRTE_RIB) += test_rib6.c\n+SRCS-$(CONFIG_RTE_LIBRTE_FIB) += test_fib.c\n \n SRCS-$(CONFIG_RTE_LIBRTE_LPM) += test_lpm.c\n SRCS-$(CONFIG_RTE_LIBRTE_LPM) += test_lpm_perf.c\ndiff --git a/app/test/autotest_data.py b/app/test/autotest_data.py\nindex f35b3cc..18a8595 100644\n--- a/app/test/autotest_data.py\n+++ b/app/test/autotest_data.py\n@@ -123,6 +123,18 @@\n \"Report\": None,\n },\n {\n+ \"Name\": \"FIB autotest\",\n+ \"Command\": \"fib_autotest\",\n+ \"Func\": default_autotest,\n+ \"Report\": None,\n+ },\n+ {\n+ \"Name\": \"FIB slow autotest\",\n+ \"Command\": \"fib_slow_autotest\",\n+ \"Func\": default_autotest,\n+ \"Report\": None,\n+ },\n+ {\n \"Name\": \"Memcpy autotest\",\n \"Command\": \"memcpy_autotest\",\n \"Func\": default_autotest,\ndiff --git a/app/test/meson.build b/app/test/meson.build\nindex 49c1de0..c5d62de 100644\n--- a/app/test/meson.build\n+++ b/app/test/meson.build\n@@ -47,6 +47,7 @@ test_sources = files('commands.c',\n \t'test_eventdev.c',\n \t'test_external_mem.c',\n \t'test_fbarray.c',\n+\t'test_fib.c',\n \t'test_func_reentrancy.c',\n \t'test_flow_classify.c',\n \t'test_hash.c',\n@@ -137,6 +138,7 @@ test_deps = ['acl',\n \t'efd',\n \t'ethdev',\n \t'eventdev',\n+\t'fib',\n \t'flow_classify',\n \t'hash',\n \t'ipsec',\n@@ -180,6 +182,7 @@ fast_test_names = [\n 'eal_fs_autotest',\n 'errno_autotest',\n 'event_ring_autotest',\n+ 'fib_autotest',\n 'func_reentrancy_autotest',\n 'flow_classify_autotest',\n 'hash_autotest',\n@@ -250,6 +253,7 @@ perf_test_names = [\n 'reciprocal_division',\n 'reciprocal_division_perf',\n 'lpm_perf_autotest',\n+ 'fib_slow_autotest',\n 'red_all',\n 'barrier_autotest',\n 'hash_multiwriter_autotest',\ndiff --git a/app/test/test_fib.c b/app/test/test_fib.c\nnew file mode 100644\nindex 0000000..ca80a5d\n--- /dev/null\n+++ b/app/test/test_fib.c\n@@ -0,0 +1,414 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2018 Vladimir Medvedkin <medvedkinv@gmail.com>\n+ * Copyright(c) 2019 Intel Corporation\n+ */\n+\n+#include <stdio.h>\n+#include <stdint.h>\n+#include <stdlib.h>\n+\n+#include <rte_ip.h>\n+#include <rte_log.h>\n+#include <rte_fib.h>\n+\n+#include \"test.h\"\n+\n+typedef int32_t (*rte_fib_test)(void);\n+\n+static int32_t test_create_invalid(void);\n+static int32_t test_multiple_create(void);\n+static int32_t test_free_null(void);\n+static int32_t test_add_del_invalid(void);\n+static int32_t test_get_invalid(void);\n+static int32_t test_lookup(void);\n+\n+#define MAX_ROUTES\t(1 << 16)\n+#define MAX_TBL8\t(1 << 15)\n+\n+/*\n+ * Check that rte_fib_create fails gracefully for incorrect user input\n+ * arguments\n+ */\n+int32_t\n+test_create_invalid(void)\n+{\n+\tstruct rte_fib *fib = NULL;\n+\tstruct rte_fib_conf config;\n+\n+\tconfig.max_routes = MAX_ROUTES;\n+\tconfig.default_nh = 0;\n+\tconfig.type = RTE_FIB_DUMMY;\n+\n+\t/* rte_fib_create: fib name == NULL */\n+\tfib = rte_fib_create(NULL, SOCKET_ID_ANY, &config);\n+\tRTE_TEST_ASSERT(fib == NULL,\n+\t\t\"Call succeeded with invalid parameters\\n\");\n+\n+\t/* rte_fib_create: config == NULL */\n+\tfib = rte_fib_create(__func__, SOCKET_ID_ANY, NULL);\n+\tRTE_TEST_ASSERT(fib == NULL,\n+\t\t\"Call succeeded with invalid parameters\\n\");\n+\n+\t/* socket_id < -1 is invalid */\n+\tfib = rte_fib_create(__func__, -2, &config);\n+\tRTE_TEST_ASSERT(fib == NULL,\n+\t\t\"Call succeeded with invalid parameters\\n\");\n+\n+\t/* rte_fib_create: max_routes = 0 */\n+\tconfig.max_routes = 0;\n+\tfib = rte_fib_create(__func__, SOCKET_ID_ANY, &config);\n+\tRTE_TEST_ASSERT(fib == NULL,\n+\t\t\"Call succeeded with invalid parameters\\n\");\n+\tconfig.max_routes = MAX_ROUTES;\n+\n+\tconfig.type = RTE_FIB_TYPE_MAX;\n+\tfib = rte_fib_create(__func__, SOCKET_ID_ANY, &config);\n+\tRTE_TEST_ASSERT(fib == NULL,\n+\t\t\"Call succeeded with invalid parameters\\n\");\n+\n+\tconfig.type = RTE_FIB_DIR24_8;\n+\tconfig.dir24_8.num_tbl8 = MAX_TBL8;\n+\n+\tconfig.dir24_8.nh_sz = RTE_FIB_DIR24_8_8B + 1;\n+\tfib = rte_fib_create(__func__, SOCKET_ID_ANY, &config);\n+\tRTE_TEST_ASSERT(fib == NULL,\n+\t\t\"Call succeeded with invalid parameters\\n\");\n+\tconfig.dir24_8.nh_sz = RTE_FIB_DIR24_8_8B;\n+\n+\tconfig.dir24_8.num_tbl8 = 0;\n+\tfib = rte_fib_create(__func__, SOCKET_ID_ANY, &config);\n+\tRTE_TEST_ASSERT(fib == NULL,\n+\t\t\"Call succeeded with invalid parameters\\n\");\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+/*\n+ * Create fib table then delete fib table 10 times\n+ * Use a slightly different rules size each time\n+ */\n+int32_t\n+test_multiple_create(void)\n+{\n+\tstruct rte_fib *fib = NULL;\n+\tstruct rte_fib_conf config;\n+\tint32_t i;\n+\n+\tconfig.default_nh = 0;\n+\tconfig.type = RTE_FIB_DUMMY;\n+\n+\tfor (i = 0; i < 100; i++) {\n+\t\tconfig.max_routes = MAX_ROUTES - i;\n+\t\tfib = rte_fib_create(__func__, SOCKET_ID_ANY, &config);\n+\t\tRTE_TEST_ASSERT(fib != NULL, \"Failed to create FIB\\n\");\n+\t\trte_fib_free(fib);\n+\t}\n+\t/* Can not test free so return success */\n+\treturn TEST_SUCCESS;\n+}\n+\n+/*\n+ * Call rte_fib_free for NULL pointer user input. Note: free has no return and\n+ * therefore it is impossible to check for failure but this test is added to\n+ * increase function coverage metrics and to validate that freeing null does\n+ * not crash.\n+ */\n+int32_t\n+test_free_null(void)\n+{\n+\tstruct rte_fib *fib = NULL;\n+\tstruct rte_fib_conf config;\n+\n+\tconfig.max_routes = MAX_ROUTES;\n+\tconfig.default_nh = 0;\n+\tconfig.type = RTE_FIB_DUMMY;\n+\n+\tfib = rte_fib_create(__func__, SOCKET_ID_ANY, &config);\n+\tRTE_TEST_ASSERT(fib != NULL, \"Failed to create FIB\\n\");\n+\n+\trte_fib_free(fib);\n+\trte_fib_free(NULL);\n+\treturn TEST_SUCCESS;\n+}\n+\n+/*\n+ * Check that rte_fib_add and rte_fib_delete fails gracefully\n+ * for incorrect user input arguments\n+ */\n+int32_t\n+test_add_del_invalid(void)\n+{\n+\tstruct rte_fib *fib = NULL;\n+\tstruct rte_fib_conf config;\n+\tuint64_t nh = 100;\n+\tuint32_t ip = RTE_IPV4(0, 0, 0, 0);\n+\tint ret;\n+\tuint8_t depth = 24;\n+\n+\tconfig.max_routes = MAX_ROUTES;\n+\tconfig.default_nh = 0;\n+\tconfig.type = RTE_FIB_DUMMY;\n+\n+\t/* rte_fib_add: fib == NULL */\n+\tret = rte_fib_add(NULL, ip, depth, nh);\n+\tRTE_TEST_ASSERT(ret < 0,\n+\t\t\"Call succeeded with invalid parameters\\n\");\n+\n+\t/* rte_fib_delete: fib == NULL */\n+\tret = rte_fib_delete(NULL, ip, depth);\n+\tRTE_TEST_ASSERT(ret < 0,\n+\t\t\"Call succeeded with invalid parameters\\n\");\n+\n+\t/*Create valid fib to use in rest of test. */\n+\tfib = rte_fib_create(__func__, SOCKET_ID_ANY, &config);\n+\tRTE_TEST_ASSERT(fib != NULL, \"Failed to create FIB\\n\");\n+\n+\t/* rte_fib_add: depth > RTE_FIB_MAXDEPTH */\n+\tret = rte_fib_add(fib, ip, RTE_FIB_MAXDEPTH + 1, nh);\n+\tRTE_TEST_ASSERT(ret < 0,\n+\t\t\"Call succeeded with invalid parameters\\n\");\n+\n+\t/* rte_fib_delete: depth > RTE_FIB_MAXDEPTH */\n+\tret = rte_fib_delete(fib, ip, RTE_FIB_MAXDEPTH + 1);\n+\tRTE_TEST_ASSERT(ret < 0,\n+\t\t\"Call succeeded with invalid parameters\\n\");\n+\n+\trte_fib_free(fib);\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+/*\n+ * Check that rte_fib_get_dp and rte_fib_get_rib fails gracefully\n+ * for incorrect user input arguments\n+ */\n+int32_t\n+test_get_invalid(void)\n+{\n+\tvoid *p;\n+\n+\tp = rte_fib_get_dp(NULL);\n+\tRTE_TEST_ASSERT(p == NULL,\n+\t\t\"Call succeeded with invalid parameters\\n\");\n+\n+\tp = rte_fib_get_rib(NULL);\n+\tRTE_TEST_ASSERT(p == NULL,\n+\t\t\"Call succeeded with invalid parameters\\n\");\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+/*\n+ * Add routes for one supernet with all possible depths and do lookup\n+ * on each step\n+ * After delete routes with doing lookup on each step\n+ */\n+static int\n+lookup_and_check_asc(struct rte_fib *fib, uint32_t ip_arr[RTE_FIB_MAXDEPTH],\n+\tuint32_t ip_missing, uint64_t def_nh, uint32_t n)\n+{\n+\tuint64_t nh_arr[RTE_FIB_MAXDEPTH];\n+\tint ret;\n+\tuint32_t i = 0;\n+\n+\tret = rte_fib_lookup_bulk(fib, ip_arr, nh_arr, RTE_FIB_MAXDEPTH);\n+\tRTE_TEST_ASSERT(ret == 0, \"Failed to lookup\\n\");\n+\n+\tfor (; i <= RTE_FIB_MAXDEPTH - n; i++)\n+\t\tRTE_TEST_ASSERT(nh_arr[i] == n,\n+\t\t\t\"Failed to get proper nexthop\\n\");\n+\n+\tfor (; i < RTE_FIB_MAXDEPTH; i++)\n+\t\tRTE_TEST_ASSERT(nh_arr[i] == --n,\n+\t\t\t\"Failed to get proper nexthop\\n\");\n+\n+\tret = rte_fib_lookup_bulk(fib, &ip_missing, nh_arr, 1);\n+\tRTE_TEST_ASSERT((ret == 0) && (nh_arr[0] == def_nh),\n+\t\t\"Failed to get proper nexthop\\n\");\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+static int\n+lookup_and_check_desc(struct rte_fib *fib, uint32_t ip_arr[RTE_FIB_MAXDEPTH],\n+\tuint32_t ip_missing, uint64_t def_nh, uint32_t n)\n+{\n+\tuint64_t nh_arr[RTE_FIB_MAXDEPTH];\n+\tint ret;\n+\tuint32_t i = 0;\n+\n+\tret = rte_fib_lookup_bulk(fib, ip_arr, nh_arr, RTE_FIB_MAXDEPTH);\n+\tRTE_TEST_ASSERT(ret == 0, \"Failed to lookup\\n\");\n+\n+\tfor (; i < n; i++)\n+\t\tRTE_TEST_ASSERT(nh_arr[i] == RTE_FIB_MAXDEPTH - i,\n+\t\t\t\"Failed to get proper nexthop\\n\");\n+\n+\tfor (; i < RTE_FIB_MAXDEPTH; i++)\n+\t\tRTE_TEST_ASSERT(nh_arr[i] == def_nh,\n+\t\t\t\"Failed to get proper nexthop\\n\");\n+\n+\tret = rte_fib_lookup_bulk(fib, &ip_missing, nh_arr, 1);\n+\tRTE_TEST_ASSERT((ret == 0) && (nh_arr[0] == def_nh),\n+\t\t\"Failed to get proper nexthop\\n\");\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+static int\n+check_fib(struct rte_fib *fib)\n+{\n+\tuint64_t def_nh = 100;\n+\tuint32_t ip_arr[RTE_FIB_MAXDEPTH];\n+\tuint32_t ip_add = RTE_IPV4(128, 0, 0, 0);\n+\tuint32_t i, ip_missing = RTE_IPV4(127, 255, 255, 255);\n+\tint ret;\n+\n+\tfor (i = 0; i < RTE_FIB_MAXDEPTH; i++)\n+\t\tip_arr[i] = ip_add + (1ULL << i) - 1;\n+\n+\tret = lookup_and_check_desc(fib, ip_arr, ip_missing, def_nh, 0);\n+\tRTE_TEST_ASSERT(ret == TEST_SUCCESS, \"Lookup and check fails\\n\");\n+\n+\tfor (i = 1; i <= RTE_FIB_MAXDEPTH; i++) {\n+\t\tret = rte_fib_add(fib, ip_add, i, i);\n+\t\tRTE_TEST_ASSERT(ret == 0, \"Failed to add a route\\n\");\n+\t\tret = lookup_and_check_asc(fib, ip_arr, ip_missing,\n+\t\t\t\tdef_nh, i);\n+\t\tRTE_TEST_ASSERT(ret == TEST_SUCCESS, \"Lookup and check fails\\n\");\n+\t}\n+\n+\tfor (i = RTE_FIB_MAXDEPTH; i > 1; i--) {\n+\t\tret = rte_fib_delete(fib, ip_add, i);\n+\t\tRTE_TEST_ASSERT(ret == 0, \"Failed to delete a route\\n\");\n+\t\tret = lookup_and_check_asc(fib, ip_arr, ip_missing,\n+\t\t\tdef_nh, i - 1);\n+\n+\t\tRTE_TEST_ASSERT(ret == TEST_SUCCESS, \"Lookup and check fails\\n\");\n+\t}\n+\tret = rte_fib_delete(fib, ip_add, i);\n+\tRTE_TEST_ASSERT(ret == 0, \"Failed to delete a route\\n\");\n+\tret = lookup_and_check_desc(fib, ip_arr, ip_missing, def_nh, 0);\n+\tRTE_TEST_ASSERT(ret == TEST_SUCCESS, \"Lookup and check fails\\n\");\n+\n+\tfor (i = 0; i < RTE_FIB_MAXDEPTH; i++) {\n+\t\tret = rte_fib_add(fib, ip_add, RTE_FIB_MAXDEPTH - i,\n+\t\t\tRTE_FIB_MAXDEPTH - i);\n+\t\tRTE_TEST_ASSERT(ret == 0, \"Failed to add a route\\n\");\n+\t\tret = lookup_and_check_desc(fib, ip_arr, ip_missing,\n+\t\t\tdef_nh, i + 1);\n+\t\tRTE_TEST_ASSERT(ret == TEST_SUCCESS, \"Lookup and check fails\\n\");\n+\t}\n+\n+\tfor (i = 1; i <= RTE_FIB_MAXDEPTH; i++) {\n+\t\tret = rte_fib_delete(fib, ip_add, i);\n+\t\tRTE_TEST_ASSERT(ret == 0, \"Failed to delete a route\\n\");\n+\t\tret = lookup_and_check_desc(fib, ip_arr, ip_missing, def_nh,\n+\t\t\tRTE_FIB_MAXDEPTH - i);\n+\t\tRTE_TEST_ASSERT(ret == TEST_SUCCESS, \"Lookup and check fails\\n\");\n+\t}\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+int32_t\n+test_lookup(void)\n+{\n+\tstruct rte_fib *fib = NULL;\n+\tstruct rte_fib_conf config;\n+\tuint64_t def_nh = 100;\n+\tint ret;\n+\n+\tconfig.max_routes = MAX_ROUTES;\n+\tconfig.default_nh = def_nh;\n+\tconfig.type = RTE_FIB_DUMMY;\n+\n+\tfib = rte_fib_create(__func__, SOCKET_ID_ANY, &config);\n+\tRTE_TEST_ASSERT(fib != NULL, \"Failed to create FIB\\n\");\n+\tret = check_fib(fib);\n+\tRTE_TEST_ASSERT(ret == TEST_SUCCESS,\n+\t\t\"Check_fib fails for DUMMY type\\n\");\n+\trte_fib_free(fib);\n+\n+\tconfig.type = RTE_FIB_DIR24_8;\n+\n+\tconfig.dir24_8.nh_sz = RTE_FIB_DIR24_8_1B;\n+\tconfig.dir24_8.num_tbl8 = 127;\n+\tfib = rte_fib_create(__func__, SOCKET_ID_ANY, &config);\n+\tRTE_TEST_ASSERT(fib != NULL, \"Failed to create FIB\\n\");\n+\tret = check_fib(fib);\n+\tRTE_TEST_ASSERT(ret == TEST_SUCCESS,\n+\t\t\"Check_fib fails for DIR24_8_1B type\\n\");\n+\trte_fib_free(fib);\n+\n+\tconfig.dir24_8.nh_sz = RTE_FIB_DIR24_8_2B;\n+\tconfig.dir24_8.num_tbl8 = MAX_TBL8 - 1;\n+\tfib = rte_fib_create(__func__, SOCKET_ID_ANY, &config);\n+\tRTE_TEST_ASSERT(fib != NULL, \"Failed to create FIB\\n\");\n+\tret = check_fib(fib);\n+\tRTE_TEST_ASSERT(ret == TEST_SUCCESS,\n+\t\t\"Check_fib fails for DIR24_8_2B type\\n\");\n+\trte_fib_free(fib);\n+\n+\tconfig.dir24_8.nh_sz = RTE_FIB_DIR24_8_4B;\n+\tconfig.dir24_8.num_tbl8 = MAX_TBL8;\n+\tfib = rte_fib_create(__func__, SOCKET_ID_ANY, &config);\n+\tRTE_TEST_ASSERT(fib != NULL, \"Failed to create FIB\\n\");\n+\tret = check_fib(fib);\n+\tRTE_TEST_ASSERT(ret == TEST_SUCCESS,\n+\t\t\"Check_fib fails for DIR24_8_4B type\\n\");\n+\trte_fib_free(fib);\n+\n+\tconfig.dir24_8.nh_sz = RTE_FIB_DIR24_8_8B;\n+\tconfig.dir24_8.num_tbl8 = MAX_TBL8;\n+\tfib = rte_fib_create(__func__, SOCKET_ID_ANY, &config);\n+\tRTE_TEST_ASSERT(fib != NULL, \"Failed to create FIB\\n\");\n+\tret = check_fib(fib);\n+\tRTE_TEST_ASSERT(ret == TEST_SUCCESS,\n+\t\t\"Check_fib fails for DIR24_8_8B type\\n\");\n+\trte_fib_free(fib);\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+static struct unit_test_suite fib_fast_tests = {\n+\t.suite_name = \"fib autotest\",\n+\t.setup = NULL,\n+\t.teardown = NULL,\n+\t.unit_test_cases = {\n+\tTEST_CASE(test_create_invalid),\n+\tTEST_CASE(test_free_null),\n+\tTEST_CASE(test_add_del_invalid),\n+\tTEST_CASE(test_get_invalid),\n+\tTEST_CASE(test_lookup),\n+\tTEST_CASES_END()\n+\t}\n+};\n+\n+static struct unit_test_suite fib_slow_tests = {\n+\t.suite_name = \"fib slow autotest\",\n+\t.setup = NULL,\n+\t.teardown = NULL,\n+\t.unit_test_cases = {\n+\tTEST_CASE(test_multiple_create),\n+\tTEST_CASES_END()\n+\t}\n+};\n+\n+/*\n+ * Do all unit tests.\n+ */\n+static int\n+test_fib(void)\n+{\n+\treturn unit_test_suite_runner(&fib_fast_tests);\n+}\n+\n+static int\n+test_slow_fib(void)\n+{\n+\treturn unit_test_suite_runner(&fib_slow_tests);\n+}\n+\n+REGISTER_TEST_COMMAND(fib_autotest, test_fib);\n+REGISTER_TEST_COMMAND(fib_slow_autotest, test_slow_fib);\n", "prefixes": [ "v6", "09/12" ] }{ "id": 62324, "url": "