Hybrid ICN (hICN) plugin  v21.06-rc0-4-g18fa668
Macros | Functions | Variables
strategy_dpo_ctx.h File Reference
#include <vnet/dpo/dpo.h>
#include <vnet/fib/fib_table.h>
#include "params.h"
#include "faces/face.h"
Include dependency graph for strategy_dpo_ctx.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define HICN_FIB_TABLE   10
 
#define NEXT_HOP_INVALID   ~0
 
#define INIT_SEQ   0
 

Functions

struct __attribute__ ((packed)) hicn_dpo_ctx_s
 Structure representing a face. It containes the fields shared among all the types of faces as well it leaves some space for storing additional information specific to each type. More...
 
always_inline void init_dpo_ctx (hicn_dpo_ctx_t *dpo_ctx, const hicn_face_id_t *next_hop, int nh_len, dpo_type_t dpo_type, dpo_proto_t proto)
 Initialize the hICN dpo ctx. More...
 
void hicn_strategy_init_dpo_ctx_pool (void)
 Initialize the pool containing the hICN dpo ctx. More...
 
hicn_dpo_ctx_t * hicn_strategy_dpo_ctx_alloc ()
 Allocate a new hICN dpo ctx from the pool.
 
hicn_dpo_ctx_t * hicn_strategy_dpo_ctx_get (index_t index)
 Retrieve an existing hICN dpo ctx from the pool.
 
index_t hicn_strategy_dpo_ctx_get_index (hicn_dpo_ctx_t *cd)
 Retrieve the index of the hICN dpo ctx.
 
void hicn_strategy_dpo_ctx_lock (dpo_id_t *dpo)
 Lock the dpo of a strategy ctx. More...
 
void hicn_strategy_dpo_ctx_unlock (dpo_id_t *dpo)
 Unlock the dpo of a strategy ctx. More...
 
int hicn_strategy_dpo_ctx_add_nh (hicn_face_id_t nh, hicn_dpo_ctx_t *dpo_ctx, u8 *pos)
 Add or update a next hop in the dpo ctx. More...
 
int hicn_strategy_dpo_ctx_del_nh (hicn_face_id_t face_id, hicn_dpo_ctx_t *dpo_ctx)
 Delete a next hop in the dpo ctx. More...
 
 STATIC_ASSERT (sizeof(hicn_dpo_ctx_t)<=2 *CLIB_CACHE_LINE_BYTES, "sizeof hicn_dpo_ctx_t is greater than 128B")
 

Variables

 hicn_dpo_ctx_t
 
hicn_dpo_ctx_t * hicn_strategy_dpo_ctx_pool
 

Detailed Description

This file implements the general hICN DPO ctx (shared among all the strategies).

An hICN DPO ctx contains the list of next hops, auxiliaries fields to maintain the dpo, map-me specifics (tfib_entry_count and seq), the dpo_type and 64B to let each strategy to store additional information. Each next hop is an hicn_face_id_t that refers to an index for an hICN face. The dpo_type is used to identify the strategy and to retrieve the vft corresponding to the strategy (see strategy.h) and to the dpo ctx (see strategy_dpo_manager.h)

Function Documentation

◆ __attribute__()

struct __attribute__ ( (packed)  )

Structure representing a face. It containes the fields shared among all the types of faces as well it leaves some space for storing additional information specific to each type.

Key definition for the mhash table. An face is uniquely identified by ip address, the interface id and a dpo pointing to the next node in the vlib graph. The ip address can correspond to the remote ip address of the next hicn hop, or to the local address of the receiving interface. The former is used to retrieve the incoming face when an interest is received, the latter when the arring packet is a data. If the face is a regular face In case of iface, the following structure can be filled in different ways:

  • dpo equal to DPO_INVALID when the iface is a regular hICN iface
  • in case of udp_tunnel dpo = { .dpoi_index = tunnel_id, .dpoi_type = DPO_FIRST, //We don't need the type, we leave it invalid .dpoi_proto = DPO_PROTO_IP4 or DPO_PROTO_IP6, .dpoi_next_node = HICN6_IFACE_OUTPUT_NEXT_UDP4_ENCAP or HICN6_IFACE_OUTPUT_NEXT_UDP6_ENCAP or HICN4_IFACE_OUTPUT_NEXT_UDP4_ENCAP or HICN4_IFACE_OUTPUT_NEXT_UDP6_ENCAP }

◆ hicn_strategy_dpo_ctx_add_nh()

int hicn_strategy_dpo_ctx_add_nh ( hicn_face_id_t  nh,
hicn_dpo_ctx_t *  dpo_ctx,
u8 *  pos 
)

Add or update a next hop in the dpo ctx.

This function is meant to be used in the control plane and not in the data plane, as it is not optimized for the latter.

Parameters
nhNext hop to insert in the dpo ctx
dpo_ctxDpo ctx to update with the new or updated next hop
posReturn the position of the nh that has been added
Returns
HICN_ERROR_NONE if the update or insert was fine, otherwise HICN_ERROR_DPO_CTX_NOT_FOUND

◆ hicn_strategy_dpo_ctx_del_nh()

int hicn_strategy_dpo_ctx_del_nh ( hicn_face_id_t  face_id,
hicn_dpo_ctx_t *  dpo_ctx 
)

Delete a next hop in the dpo ctx.

Parameters
face_idFace identifier of the next hop
dpo_ctxDpo ctx to update by removing the face
Returns
HICN_ERROR_NONE if the update or insert was fine, otherwise HICN_ERROR_DPO_CTS_NOT_FOUND

◆ hicn_strategy_dpo_ctx_lock()

void hicn_strategy_dpo_ctx_lock ( dpo_id_t *  dpo)

Lock the dpo of a strategy ctx.

Parameters
dpoIdentifier of the dpo of the strategy ctx

◆ hicn_strategy_dpo_ctx_unlock()

void hicn_strategy_dpo_ctx_unlock ( dpo_id_t *  dpo)

Unlock the dpo of a strategy ctx.

Parameters
dpoIdentifier of the dpo of the strategy ctx

◆ hicn_strategy_init_dpo_ctx_pool()

void hicn_strategy_init_dpo_ctx_pool ( void  )

Initialize the pool containing the hICN dpo ctx.

◆ init_dpo_ctx()

always_inline void init_dpo_ctx ( hicn_dpo_ctx_t *  dpo_ctx,
const hicn_face_id_t *  next_hop,
int  nh_len,
dpo_type_t  dpo_type,
dpo_proto_t  proto 
)

Initialize the hICN dpo ctx.

Parameters
dpo_ctxPointer to the hICN dpo ctx to initialize
next_hopList of netx hops to store in the dpo ctx
nh_lenNumber of elements in the list of next hops
dpo_typeType of dpo. It identifies the strategy.