net/ice: clean input set macro definition
[dpdk.git] / lib / librte_fib / rte_fib6.c
index 354227d..44cc0c9 100644 (file)
@@ -107,7 +107,7 @@ init_dataplane(struct rte_fib6 *fib, __rte_unused int socket_id,
                fib->dp = trie_create(dp_name, socket_id, conf);
                if (fib->dp == NULL)
                        return -rte_errno;
-               fib->lookup = rte_trie_get_lookup_fn(conf);
+               fib->lookup = trie_get_lookup_fn(fib->dp, RTE_FIB6_LOOKUP_DEFAULT);
                fib->modify = trie_modify;
                return 0;
        default:
@@ -160,7 +160,7 @@ rte_fib6_create(const char *name, int socket_id, struct rte_fib6_conf *conf)
 
        /* Check user arguments. */
        if ((name == NULL) || (conf == NULL) || (conf->max_routes < 0) ||
-                       (conf->type >= RTE_FIB6_TYPE_MAX)) {
+                       (conf->type > RTE_FIB6_TRIE)) {
                rte_errno = EINVAL;
                return NULL;
        }
@@ -320,3 +320,20 @@ rte_fib6_get_rib(struct rte_fib6 *fib)
        return (fib == NULL) ? NULL : fib->rib;
 }
 
+int
+rte_fib6_select_lookup(struct rte_fib6 *fib,
+       enum rte_fib6_lookup_type type)
+{
+       rte_fib6_lookup_fn_t fn;
+
+       switch (fib->type) {
+       case RTE_FIB6_TRIE:
+               fn = trie_get_lookup_fn(fib->dp, type);
+               if (fn == NULL)
+                       return -EINVAL;
+               fib->lookup = fn;
+               return 0;
+       default:
+               return -EINVAL;
+       }
+}