47 #define INDEX_INVALID ((index_t)(~0)) 71 } __attribute__((packed)) dpo_proto_t;
73 #define DPO_PROTO_NUM ((dpo_proto_t)(DPO_PROTO_NSH+1)) 74 #define DPO_PROTO_NONE ((dpo_proto_t)(DPO_PROTO_NUM+1)) 76 #define DPO_PROTOS { \ 77 [DPO_PROTO_IP4] = "ip4", \ 78 [DPO_PROTO_IP6] = "ip6", \ 79 [DPO_PROTO_ETHERNET] = "ethernet", \ 80 [DPO_PROTO_MPLS] = "mpls", \ 81 [DPO_PROTO_NSH] = "nsh", \ 84 #define FOR_EACH_DPO_PROTO(_proto) \ 85 for (_proto = DPO_PROTO_IP4; \ 86 _proto <= DPO_PROTO_NSH; \ 118 } __attribute__((packed)) dpo_type_t;
120 #define DPO_TYPE_NUM DPO_LAST 122 #define DPO_TYPES { \ 123 [DPO_FIRST] = "dpo-invalid", \ 124 [DPO_DROP] = "dpo-drop", \ 125 [DPO_IP_NULL] = "dpo-ip-null", \ 126 [DPO_PUNT] = "dpo-punt", \ 127 [DPO_ADJACENCY] = "dpo-adjacency", \ 128 [DPO_ADJACENCY_INCOMPLETE] = "dpo-adjacency-incomplete", \ 129 [DPO_ADJACENCY_MIDCHAIN] = "dpo-adjacency-midcahin", \ 130 [DPO_ADJACENCY_GLEAN] = "dpo-glean", \ 131 [DPO_ADJACENCY_MCAST] = "dpo-adj-mcast", \ 132 [DPO_RECEIVE] = "dpo-receive", \ 133 [DPO_LOOKUP] = "dpo-lookup", \ 134 [DPO_LOAD_BALANCE] = "dpo-load-balance", \ 135 [DPO_REPLICATE] = "dpo-replicate", \ 136 [DPO_LISP_CP] = "dpo-lisp-cp", \ 137 [DPO_CLASSIFY] = "dpo-classify", \ 138 [DPO_MPLS_LABEL] = "dpo-mpls-label", \ 139 [DPO_MFIB_ENTRY] = "dpo-mfib_entry" \ 163 } __attribute__ ((aligned(
sizeof(u64)))) dpo_id_t;
166 "DPO ID is greater than sizeof u64 "
167 "atomic updates need to be revisited");
173 #define DPO_INVALID \ 175 .dpoi_type = DPO_FIRST, \ 176 .dpoi_proto = DPO_PROTO_NONE, \ 177 .dpoi_index = INDEX_INVALID, \ 178 .dpoi_next_node = 0, \ 197 extern void dpo_lock(dpo_id_t *dpo);
221 extern void dpo_set(dpo_id_t *dpo,
238 extern int dpo_cmp(
const dpo_id_t *dpo1,
239 const dpo_id_t *dpo2);
247 const dpo_id_t *src);
288 extern void dpo_stack(dpo_type_t child_type,
289 dpo_proto_t child_proto,
291 const dpo_id_t *parent_dpo);
310 const dpo_id_t *parent);
370 const char *
const *
const * nodes);
387 const char *
const *
const * nodes);
dpo_lock_fn_t dv_lock
A reference counting lock function.
void(* dpo_lock_fn_t)(dpo_id_t *dpo)
A lock function registered for a DPO type.
A virtual function table regisitered for a DPO type.
dpo_proto_t_
Data path protocol.
static int dpo_id_is_valid(const dpo_id_t *dpoi)
Return true if the DPO object is valid, i.e.
dpo_proto_t dpoi_proto
the data-path protocol of the type.
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
dpo_type_t_
Common types of data-path objects New types can be dynamically added using dpo_register_new_type() ...
void dpo_unlock(dpo_id_t *dpo)
Release a reference counting lock on the DPO.
STATIC_ASSERT(sizeof(dpo_id_t)<=sizeof(u64),"DPO ID is greater than sizeof u64 ""atomic updates need to be revisited")
u8 * format_dpo_proto(u8 *s, va_list *args)
format a DPO protocol
u8 * format_dpo_id(u8 *s, va_list *args)
Format a DPO_id_t oject
void dpo_set(dpo_id_t *dpo, dpo_type_t type, dpo_proto_t proto, index_t index)
Set/create a DPO ID The DPO will be locked.
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
void dpo_stack(dpo_type_t child_type, dpo_proto_t child_proto, dpo_id_t *dpo, const dpo_id_t *parent_dpo)
Set and stack a DPO.
void(* dpo_mem_show_t)(void)
An memory usage show command.
dpo_type_t dpoi_type
the type
load-balancing over a choice of [un]equal cost paths
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
int dpo_cmp(const dpo_id_t *dpo1, const dpo_id_t *dpo2)
compare two DPOs for equality
void dpo_register(dpo_type_t type, const dpo_vft_t *vft, const char *const *const *nodes)
For a given DPO type Register:
void dpo_copy(dpo_id_t *dst, const dpo_id_t *src)
atomic copy a data-plane object.
u8 * format_dpo_type(u8 *s, va_list *args)
format a DPO type
int dpo_is_adj(const dpo_id_t *dpo)
Return TRUE is the DPO is any type of adjacency.
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
A non-zero value first so we can spot unitialisation errors.
void dpo_lock(dpo_id_t *dpo)
Take a reference counting lock on the DPO.
void(* dpo_unlock_fn_t)(dpo_id_t *dpo)
An unlock function registered for a DPO type.
dpo_mem_show_t dv_mem_show
A show memory usage function.
dpo_type_t dpo_register_new_type(const dpo_vft_t *vft, const char *const *const *nodes)
Create and register a new DPO type.
index_t dpoi_index
the index of objects of that type
format_function_t * dv_format
A format function.
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
dpo_lock_fn_t dv_unlock
A reference counting unlock function.
void dpo_stack_from_node(u32 child_node, dpo_id_t *dpo, const dpo_id_t *parent)
Set and stack a DPO.
dpo_proto_t vnet_link_to_dpo_proto(vnet_link_t linkt)
u16 dpoi_next_node
The next VLIB node to follow.
struct dpo_vft_t_ dpo_vft_t
A virtual function table regisitered for a DPO type.