16 #ifndef __HICN_STRATEGY_DPO_CTX_H__
17 #define __HICN_STRATEGY_DPO_CTX_H__
19 #include <vnet/dpo/dpo.h>
20 #include <vnet/fib/fib_table.h>
41 #define HICN_FIB_TABLE 10
43 #define NEXT_HOP_INVALID ~0
47 typedef struct __attribute__ ((packed)) hicn_dpo_ctx_s
49 CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
51 hicn_face_id_t next_hops[HICN_PARAM_FIB_ENTRY_NHOPS_MAX];
71 CLIB_CACHE_LINE_ALIGN_MARK (cacheline1);
73 fib_node_index_t fib_entry_index;
83 u8 data[CLIB_CACHE_LINE_BYTES - 12];
87 extern hicn_dpo_ctx_t *hicn_strategy_dpo_ctx_pool;
98 init_dpo_ctx (hicn_dpo_ctx_t *dpo_ctx,
const hicn_face_id_t *next_hop,
99 int nh_len, dpo_type_t dpo_type, dpo_proto_t proto)
101 hicn_face_id_t invalid = NEXT_HOP_INVALID;
103 dpo_ctx->entry_count = 0;
106 dpo_ctx->tfib_entry_count = 0;
108 dpo_ctx->seq = INIT_SEQ;
109 dpo_ctx->dpo_type = dpo_type;
111 dpo_ctx->proto = proto;
113 for (
int i = 0; i < HICN_PARAM_FIB_ENTRY_NHOPS_MAX && i < nh_len; i++)
115 dpo_ctx->next_hops[i] = next_hop[i];
116 dpo_ctx->entry_count++;
119 for (
int i = nh_len; i < HICN_PARAM_FIB_ENTRY_NHOPS_MAX; i++)
121 dpo_ctx->next_hops[i] = invalid;
184 hicn_dpo_ctx_t *dpo_ctx);
186 STATIC_ASSERT (
sizeof (hicn_dpo_ctx_t) <= 2 * CLIB_CACHE_LINE_BYTES,
187 "sizeof hicn_dpo_ctx_t is greater than 128B");