git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
raw/ifpga: add APIs to get FPGA information
[dpdk.git]
/
lib
/
librte_fib
/
rte_fib.c
diff --git
a/lib/librte_fib/rte_fib.c
b/lib/librte_fib/rte_fib.c
index
4d8a771
..
b354d4b
100644
(file)
--- a/
lib/librte_fib/rte_fib.c
+++ b/
lib/librte_fib/rte_fib.c
@@
-17,6
+17,8
@@
#include <rte_rib.h>
#include <rte_fib.h>
#include <rte_rib.h>
#include <rte_fib.h>
+#include "dir24_8.h"
+
TAILQ_HEAD(rte_fib_list, rte_tailq_entry);
static struct rte_tailq_elem rte_fib_tailq = {
.name = "RTE_FIB",
TAILQ_HEAD(rte_fib_list, rte_tailq_entry);
static struct rte_tailq_elem rte_fib_tailq = {
.name = "RTE_FIB",
@@
-92,12
+94,23
@@
static int
init_dataplane(struct rte_fib *fib, __rte_unused int socket_id,
struct rte_fib_conf *conf)
{
init_dataplane(struct rte_fib *fib, __rte_unused int socket_id,
struct rte_fib_conf *conf)
{
+ char dp_name[sizeof(void *)];
+
+ snprintf(dp_name, sizeof(dp_name), "%p", fib);
switch (conf->type) {
case RTE_FIB_DUMMY:
fib->dp = fib;
fib->lookup = dummy_lookup;
fib->modify = dummy_modify;
return 0;
switch (conf->type) {
case RTE_FIB_DUMMY:
fib->dp = fib;
fib->lookup = dummy_lookup;
fib->modify = dummy_modify;
return 0;
+ case RTE_FIB_DIR24_8:
+ fib->dp = dir24_8_create(dp_name, socket_id, conf);
+ if (fib->dp == NULL)
+ return -rte_errno;
+ fib->lookup = dir24_8_get_lookup_fn(fib->dp,
+ RTE_FIB_LOOKUP_DEFAULT);
+ fib->modify = dir24_8_modify;
+ return 0;
default:
return -EINVAL;
}
default:
return -EINVAL;
}
@@
-146,7
+159,7
@@
rte_fib_create(const char *name, int socket_id, struct rte_fib_conf *conf)
/* Check user arguments. */
if ((name == NULL) || (conf == NULL) || (conf->max_routes < 0) ||
/* Check user arguments. */
if ((name == NULL) || (conf == NULL) || (conf->max_routes < 0) ||
- (conf->type >
= RTE_FIB_TYPE_MAX
)) {
+ (conf->type >
RTE_FIB_DIR24_8
)) {
rte_errno = EINVAL;
return NULL;
}
rte_errno = EINVAL;
return NULL;
}
@@
-258,6
+271,8
@@
free_dataplane(struct rte_fib *fib)
switch (fib->type) {
case RTE_FIB_DUMMY:
return;
switch (fib->type) {
case RTE_FIB_DUMMY:
return;
+ case RTE_FIB_DIR24_8:
+ dir24_8_free(fib->dp);
default:
return;
}
default:
return;
}
@@
-303,3
+318,21
@@
rte_fib_get_rib(struct rte_fib *fib)
{
return (fib == NULL) ? NULL : fib->rib;
}
{
return (fib == NULL) ? NULL : fib->rib;
}
+
+int
+rte_fib_select_lookup(struct rte_fib *fib,
+ enum rte_fib_lookup_type type)
+{
+ rte_fib_lookup_fn_t fn;
+
+ switch (fib->type) {
+ case RTE_FIB_DIR24_8:
+ fn = dir24_8_get_lookup_fn(fib->dp, type);
+ if (fn == NULL)
+ return -EINVAL;
+ fib->lookup = fn;
+ return 0;
+ default:
+ return -EINVAL;
+ }
+}