Changeset View
Changeset View
Standalone View
Standalone View
sys/net/route/fib_algo.c
Show First 20 Lines • Show All 1,520 Lines • ▼ Show 20 Lines | set_algo_inet6_sysctl_handler(SYSCTL_HANDLER_ARGS) | ||||
return (set_fib_algo(curthread->td_proc->p_fibnum, AF_INET6, oidp, req)); | return (set_fib_algo(curthread->td_proc->p_fibnum, AF_INET6, oidp, req)); | ||||
} | } | ||||
SYSCTL_PROC(_net_route_algo_inet6, OID_AUTO, algo, | SYSCTL_PROC(_net_route_algo_inet6, OID_AUTO, algo, | ||||
CTLFLAG_VNET | CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, 0, | CTLFLAG_VNET | CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, 0, | ||||
set_algo_inet6_sysctl_handler, "A", "Set IPv6 lookup algo"); | set_algo_inet6_sysctl_handler, "A", "Set IPv6 lookup algo"); | ||||
#endif | #endif | ||||
static struct nhop_object * | |||||
dummy_lookup(void *algo_data, const struct flm_lookup_key key, uint32_t scopeid) | |||||
{ | |||||
return (NULL); | |||||
} | |||||
static void | static void | ||||
destroy_fdh_epoch(epoch_context_t ctx) | destroy_fdh_epoch(epoch_context_t ctx) | ||||
{ | { | ||||
struct fib_dp_header *fdh; | struct fib_dp_header *fdh; | ||||
fdh = __containerof(ctx, struct fib_dp_header, fdh_epoch_ctx); | fdh = __containerof(ctx, struct fib_dp_header, fdh_epoch_ctx); | ||||
free(fdh, M_RTABLE); | free(fdh, M_RTABLE); | ||||
} | } | ||||
static struct fib_dp_header * | static struct fib_dp_header * | ||||
alloc_fib_dp_array(uint32_t num_tables, bool waitok) | alloc_fib_dp_array(uint32_t num_tables, bool waitok) | ||||
{ | { | ||||
size_t sz; | size_t sz; | ||||
struct fib_dp_header *fdh; | struct fib_dp_header *fdh; | ||||
sz = sizeof(struct fib_dp_header); | sz = sizeof(struct fib_dp_header); | ||||
sz += sizeof(struct fib_dp) * num_tables; | sz += sizeof(struct fib_dp) * num_tables; | ||||
fdh = malloc(sz, M_RTABLE, (waitok ? M_WAITOK : M_NOWAIT) | M_ZERO); | fdh = malloc(sz, M_RTABLE, (waitok ? M_WAITOK : M_NOWAIT) | M_ZERO); | ||||
if (fdh != NULL) | if (fdh != NULL) { | ||||
fdh->fdh_num_tables = num_tables; | fdh->fdh_num_tables = num_tables; | ||||
/* | |||||
* Set dummy lookup function ptr always returning NULL, so | |||||
* we can delay algo init. | |||||
*/ | |||||
for (uint32_t i = 0; i < num_tables; i++) | |||||
fdh->fdh_idx[i].f = dummy_lookup; | |||||
} | |||||
return (fdh); | return (fdh); | ||||
} | } | ||||
static struct fib_dp_header * | static struct fib_dp_header * | ||||
get_fib_dp_header(struct fib_dp *dp) | get_fib_dp_header(struct fib_dp *dp) | ||||
{ | { | ||||
return (__containerof((void *)dp, struct fib_dp_header, fdh_idx)); | return (__containerof((void *)dp, struct fib_dp_header, fdh_idx)); | ||||
▲ Show 20 Lines • Show All 466 Lines • Show Last 20 Lines |