Changeset View
Changeset View
Standalone View
Standalone View
sys/net/route/nhop_var.h
Show First 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | |||||
/* Control plane-only nhop data */ | /* Control plane-only nhop data */ | ||||
struct nhop_object; | struct nhop_object; | ||||
struct nhop_priv { | struct nhop_priv { | ||||
/* nhop lookup comparison start */ | /* nhop lookup comparison start */ | ||||
uint8_t nh_upper_family;/* address family of the lookup */ | uint8_t nh_upper_family;/* address family of the lookup */ | ||||
uint8_t nh_neigh_family;/* neighbor address family */ | uint8_t nh_neigh_family;/* neighbor address family */ | ||||
uint16_t nh_type; /* nexthop type */ | uint16_t nh_type; /* nexthop type */ | ||||
uint32_t rt_flags; /* routing flags for the control plane */ | uint32_t rt_flags; /* routing flags for the control plane */ | ||||
uint32_t nh_expire; /* path expiration time */ | |||||
/* nhop lookup comparison end */ | /* nhop lookup comparison end */ | ||||
uint32_t nh_idx; /* nexthop index */ | uint32_t nh_idx; /* nexthop index */ | ||||
uint32_t nh_fibnum; /* nexthop fib */ | uint32_t nh_fibnum; /* nexthop fib */ | ||||
void *cb_func; /* function handling additional rewrite caps */ | void *cb_func; /* function handling additional rewrite caps */ | ||||
u_int nh_refcnt; /* number of references, refcount(9) */ | u_int nh_refcnt; /* number of references, refcount(9) */ | ||||
u_int nh_linked; /* refcount(9), == 2 if linked to the list */ | u_int nh_linked; /* refcount(9), == 2 if linked to the list */ | ||||
struct nhop_object *nh; /* backreference to the dataplane nhop */ | struct nhop_object *nh; /* backreference to the dataplane nhop */ | ||||
struct nh_control *nh_control; /* backreference to the rnh */ | struct nh_control *nh_control; /* backreference to the rnh */ | ||||
struct nhop_priv *nh_next; /* hash table membership */ | struct nhop_priv *nh_next; /* hash table membership */ | ||||
struct vnet *nh_vnet; /* vnet nhop belongs to */ | struct vnet *nh_vnet; /* vnet nhop belongs to */ | ||||
struct epoch_context nh_epoch_ctx; /* epoch data for nhop */ | struct epoch_context nh_epoch_ctx; /* epoch data for nhop */ | ||||
}; | }; | ||||
#define NH_PRIV_END_CMP (__offsetof(struct nhop_priv, nh_idx)) | #define NH_PRIV_END_CMP (__offsetof(struct nhop_priv, nh_idx)) | ||||
#define NH_IS_PINNED(_nh) ((!NH_IS_NHGRP(_nh)) && \ | #define NH_IS_PINNED(_nh) ((!NH_IS_NHGRP(_nh)) && \ | ||||
((_nh)->nh_priv->rt_flags & RTF_PINNED)) | ((_nh)->nh_priv->rt_flags & RTF_PINNED)) | ||||
#define NH_IS_LINKED(_nh) ((_nh)->nh_priv->nh_idx != 0) | |||||
/* nhop.c */ | /* nhop.c */ | ||||
struct nhop_priv *find_nhop(struct nh_control *ctl, | struct nhop_priv *find_nhop(struct nh_control *ctl, | ||||
const struct nhop_priv *nh_priv); | const struct nhop_priv *nh_priv); | ||||
int link_nhop(struct nh_control *ctl, struct nhop_priv *nh_priv); | int link_nhop(struct nh_control *ctl, struct nhop_priv *nh_priv); | ||||
struct nhop_priv *unlink_nhop(struct nh_control *ctl, struct nhop_priv *nh_priv); | struct nhop_priv *unlink_nhop(struct nh_control *ctl, struct nhop_priv *nh_priv); | ||||
/* nhop_ctl.c */ | /* nhop_ctl.c */ | ||||
int cmp_priv(const struct nhop_priv *_one, const struct nhop_priv *_two); | int cmp_priv(const struct nhop_priv *_one, const struct nhop_priv *_two); | ||||
#endif | #endif |