Skip to content

Commit

Permalink
fib: add RIB extension size parameter
Browse files Browse the repository at this point in the history
This patch adds a new parameter to the FIB configuration to specify
the size of the extension for internal RIB structure.

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Tested-by: Conor Walsh <conor.walsh@intel.com>
  • Loading branch information
vmedvedk authored and tmonjalo committed Nov 4, 2021
1 parent fc38202 commit 11c5b9b
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/test-fib/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,7 @@ run_v4(void)
conf.type = get_fib_type();
conf.default_nh = def_nh;
conf.max_routes = config.nb_routes * 2;
conf.rib_ext_sz = 0;
if (conf.type == RTE_FIB_DIR24_8) {
conf.dir24_8.nh_sz = __builtin_ctz(config.ent_sz);
conf.dir24_8.num_tbl8 = RTE_MIN(config.tbl8,
Expand Down Expand Up @@ -1057,6 +1058,7 @@ run_v6(void)
conf.type = get_fib_type();
conf.default_nh = def_nh;
conf.max_routes = config.nb_routes * 2;
conf.rib_ext_sz = 0;
if (conf.type == RTE_FIB6_TRIE) {
conf.trie.nh_sz = __builtin_ctz(config.ent_sz);
conf.trie.num_tbl8 = RTE_MIN(config.tbl8,
Expand Down
5 changes: 5 additions & 0 deletions app/test/test_fib.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ test_create_invalid(void)
struct rte_fib_conf config;

config.max_routes = MAX_ROUTES;
config.rib_ext_sz = 0;
config.default_nh = 0;
config.type = RTE_FIB_DUMMY;

Expand Down Expand Up @@ -94,6 +95,7 @@ test_multiple_create(void)
struct rte_fib_conf config;
int32_t i;

config.rib_ext_sz = 0;
config.default_nh = 0;
config.type = RTE_FIB_DUMMY;

Expand All @@ -120,6 +122,7 @@ test_free_null(void)
struct rte_fib_conf config;

config.max_routes = MAX_ROUTES;
config.rib_ext_sz = 0;
config.default_nh = 0;
config.type = RTE_FIB_DUMMY;

Expand All @@ -146,6 +149,7 @@ test_add_del_invalid(void)
uint8_t depth = 24;

config.max_routes = MAX_ROUTES;
config.rib_ext_sz = 0;
config.default_nh = 0;
config.type = RTE_FIB_DUMMY;

Expand Down Expand Up @@ -320,6 +324,7 @@ test_lookup(void)
int ret;

config.max_routes = MAX_ROUTES;
config.rib_ext_sz = 0;
config.default_nh = def_nh;
config.type = RTE_FIB_DUMMY;

Expand Down
5 changes: 5 additions & 0 deletions app/test/test_fib6.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ test_create_invalid(void)
struct rte_fib6_conf config;

config.max_routes = MAX_ROUTES;
config.rib_ext_sz = 0;
config.default_nh = 0;
config.type = RTE_FIB6_DUMMY;

Expand Down Expand Up @@ -96,6 +97,7 @@ test_multiple_create(void)
struct rte_fib6_conf config;
int32_t i;

config.rib_ext_sz = 0;
config.default_nh = 0;
config.type = RTE_FIB6_DUMMY;

Expand All @@ -122,6 +124,7 @@ test_free_null(void)
struct rte_fib6_conf config;

config.max_routes = MAX_ROUTES;
config.rib_ext_sz = 0;
config.default_nh = 0;
config.type = RTE_FIB6_DUMMY;

Expand Down Expand Up @@ -149,6 +152,7 @@ test_add_del_invalid(void)
uint8_t depth = 24;

config.max_routes = MAX_ROUTES;
config.rib_ext_sz = 0;
config.default_nh = 0;
config.type = RTE_FIB6_DUMMY;

Expand Down Expand Up @@ -338,6 +342,7 @@ test_lookup(void)
int ret;

config.max_routes = MAX_ROUTES;
config.rib_ext_sz = 0;
config.default_nh = def_nh;
config.type = RTE_FIB6_DUMMY;

Expand Down
1 change: 1 addition & 0 deletions app/test/test_fib6_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ test_fib6_perf(void)
conf.type = RTE_FIB6_TRIE;
conf.default_nh = 0;
conf.max_routes = 1000000;
conf.rib_ext_sz = 0;
conf.trie.nh_sz = RTE_FIB6_TRIE_4B;
conf.trie.num_tbl8 = RTE_MIN(get_max_nh(conf.trie.nh_sz), 1000000U);

Expand Down
1 change: 1 addition & 0 deletions app/test/test_fib_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ test_fib_perf(void)
struct rte_fib_conf config;

config.max_routes = 2000000;
config.rib_ext_sz = 0;
config.type = RTE_FIB_DIR24_8;
config.default_nh = 0;
config.dir24_8.nh_sz = RTE_FIB_DIR24_8_4B;
Expand Down
3 changes: 3 additions & 0 deletions doc/guides/rel_notes/release_21_11.rst
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,9 @@ API Changes
* eventdev: Moved memory used by timer adapters to hugepage. This will prevent
TLB misses if any and aligns to memory structure of other subsystems.

* fib: Added the ``rib_ext_sz`` field to ``rte_fib_conf`` and ``rte_fib6_conf``
so that user can specify the size of the RIB extension inside the FIB.


ABI Changes
-----------
Expand Down
2 changes: 2 additions & 0 deletions examples/l3fwd/l3fwd_fib.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ setup_fib(const int socketid)
/* Create the fib IPv4 table. */
config_ipv4.type = RTE_FIB_DIR24_8;
config_ipv4.max_routes = (1 << 16);
config_ipv4.rib_ext_sz = 0;
config_ipv4.default_nh = FIB_DEFAULT_HOP;
config_ipv4.dir24_8.nh_sz = RTE_FIB_DIR24_8_4B;
config_ipv4.dir24_8.num_tbl8 = (1 << 15);
Expand Down Expand Up @@ -639,6 +640,7 @@ setup_fib(const int socketid)

config.type = RTE_FIB6_TRIE;
config.max_routes = (1 << 16) - 1;
config.rib_ext_sz = 0;
config.default_nh = FIB_DEFAULT_HOP;
config.trie.nh_sz = RTE_FIB6_TRIE_4B;
config.trie.num_tbl8 = (1 << 15);
Expand Down
2 changes: 1 addition & 1 deletion lib/fib/rte_fib.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ rte_fib_create(const char *name, int socket_id, struct rte_fib_conf *conf)
return NULL;
}

rib_conf.ext_sz = 0;
rib_conf.ext_sz = conf->rib_ext_sz;
rib_conf.max_nodes = conf->max_routes * 2;

rib = rte_rib_create(name, socket_id, &rib_conf);
Expand Down
2 changes: 2 additions & 0 deletions lib/fib/rte_fib.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ struct rte_fib_conf {
/** Default value returned on lookup if there is no route */
uint64_t default_nh;
int max_routes;
/** Size of the node extension in the internal RIB struct */
unsigned int rib_ext_sz;
union {
struct {
enum rte_fib_dir24_8_nh_sz nh_sz;
Expand Down
2 changes: 1 addition & 1 deletion lib/fib/rte_fib6.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ rte_fib6_create(const char *name, int socket_id, struct rte_fib6_conf *conf)
return NULL;
}

rib_conf.ext_sz = 0;
rib_conf.ext_sz = conf->rib_ext_sz;
rib_conf.max_nodes = conf->max_routes * 2;

rib = rte_rib6_create(name, socket_id, &rib_conf);
Expand Down
2 changes: 2 additions & 0 deletions lib/fib/rte_fib6.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ struct rte_fib6_conf {
/** Default value returned on lookup if there is no route */
uint64_t default_nh;
int max_routes;
/** Size of the node extension in the internal RIB struct */
unsigned int rib_ext_sz;
union {
struct {
enum rte_fib_trie_nh_sz nh_sz;
Expand Down

0 comments on commit 11c5b9b

Please sign in to comment.