aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2023-02-09 16:02:33 +0000
committerMauro Sardara <msardara@cisco.com>2023-02-09 16:07:01 +0000
commit6186945f88556619bdd9eec9f49e3c0fd3aedaf1 (patch)
tree624173068d6866d1743833ab5ebedb5a19bf9f10 /hicn-plugin/src
parent95fb62e1aacca53c750c40845aee4b10963d7c57 (diff)
feat(hicn-plugin): specify the dpo_proto when creating a new face
Ticket: HICN-841 Change-Id: I4c5684db936835a0748715680cfbbc22ada642ff Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'hicn-plugin/src')
-rw-r--r--hicn-plugin/src/faces/face.c11
-rw-r--r--hicn-plugin/src/faces/face.h19
-rw-r--r--hicn-plugin/src/route.c16
-rw-r--r--hicn-plugin/src/route.h2
4 files changed, 27 insertions, 21 deletions
diff --git a/hicn-plugin/src/faces/face.c b/hicn-plugin/src/faces/face.c
index 84fd5e6ee..ce3001ac7 100644
--- a/hicn-plugin/src/faces/face.c
+++ b/hicn-plugin/src/faces/face.c
@@ -266,10 +266,12 @@ hicn_face_del (hicn_face_id_t face_id)
}
static void
-hicn_iface_to_face (hicn_face_t *face, const dpo_id_t *dpo)
+hicn_iface_to_face (hicn_face_t *face, const dpo_id_t *dpo,
+ dpo_proto_t dpo_proto)
{
- dpo_stack (hicn_face_type, dpo->dpoi_proto, &face->dpo, dpo);
+ dpo_stack (hicn_face_type, dpo_proto, &face->dpo, dpo);
+ face->dpo.dpoi_proto = dpo_proto;
face->flags &= ~HICN_FACE_FLAGS_IFACE;
face->flags |= HICN_FACE_FLAGS_FACE;
@@ -305,7 +307,7 @@ hicn_iface_to_face (hicn_face_t *face, const dpo_id_t *dpo)
*/
int
hicn_face_add (const dpo_id_t *dpo_nh, ip46_address_t *nat_address, int sw_if,
- hicn_face_id_t *pfaceid)
+ hicn_face_id_t *pfaceid, dpo_proto_t dpo_proto)
{
hicn_face_t *face;
@@ -329,7 +331,6 @@ hicn_face_add (const dpo_id_t *dpo_nh, ip46_address_t *nat_address, int sw_if,
if (face == NULL)
{
-
hicn_iface_add (nat_address, sw_if, pfaceid, dpo_nh->dpoi_index, 0);
face = hicn_dpoi_get_from_idx (*pfaceid);
@@ -345,7 +346,7 @@ hicn_face_add (const dpo_id_t *dpo_nh, ip46_address_t *nat_address, int sw_if,
mhash_set_mem (&hicn_face_hashtb, &key, (uword *) pfaceid, 0);
}
- hicn_iface_to_face (face, dpo_nh);
+ hicn_iface_to_face (face, dpo_nh, dpo_proto);
temp_dpo.dpoi_index = ~0;
diff --git a/hicn-plugin/src/faces/face.h b/hicn-plugin/src/faces/face.h
index b23cb9b12..2c0a09a28 100644
--- a/hicn-plugin/src/faces/face.h
+++ b/hicn-plugin/src/faces/face.h
@@ -453,7 +453,7 @@ hicn_face_get_with_dpo (const ip46_address_t *addr, u32 sw_if,
* reachable ip address, otherwise HICN_ERROR_NONE
*/
int hicn_face_add (const dpo_id_t *dpo_nh, ip46_address_t *nat_address,
- int sw_if, hicn_face_id_t *pfaceid);
+ int sw_if, hicn_face_id_t *pfaceid, dpo_proto_t dpo_proto);
/**
* @brief Create a new incomplete face ip. (Meant to be used by the data plane)
@@ -524,6 +524,7 @@ hicn_face_ip4_find (hicn_face_id_t *index, u8 *hicnb_flags,
u32 node_index)
{
int ret = HICN_ERROR_FACE_NOT_FOUND;
+ hicn_face_id_t face_id;
/*All (complete) faces are indexed by remote addess as well */
/* if the face exists, it adds a lock */
@@ -533,11 +534,13 @@ hicn_face_ip4_find (hicn_face_id_t *index, u8 *hicnb_flags,
if (face != NULL)
{
/* unlock the face. We don't take a lock on each interest we receive */
- hicn_face_id_t face_id = hicn_dpoi_get_index (face);
+ face_id = hicn_dpoi_get_index (face);
hicn_face_unlock_with_id (face_id);
- ret = HICN_ERROR_FACE_ALREADY_CREATED;
+
*hicnb_flags = HICN_BUFFER_FLAGS_DEFAULT;
- *index = hicn_dpoi_get_index (face);
+ *index = face_id;
+
+ ret = HICN_ERROR_FACE_ALREADY_CREATED;
}
return ret;
@@ -621,6 +624,7 @@ hicn_face_ip6_find (hicn_face_id_t *index, u8 *hicnb_flags,
u32 node_index)
{
int ret = HICN_ERROR_FACE_NOT_FOUND;
+ hicn_face_id_t face_id;
hicn_face_t *face = hicn_face_get ((const ip46_address_t *) nat_addr, sw_if,
&hicn_face_hashtb, adj_index);
@@ -628,11 +632,12 @@ hicn_face_ip6_find (hicn_face_id_t *index, u8 *hicnb_flags,
if (face != NULL)
{
/* unlock the face. We don't take a lock on each interest we receive */
- hicn_face_id_t face_id = hicn_dpoi_get_index (face);
+ face_id = hicn_dpoi_get_index (face);
hicn_face_unlock_with_id (face_id);
- ret = HICN_ERROR_FACE_ALREADY_CREATED;
*hicnb_flags = HICN_BUFFER_FLAGS_DEFAULT;
- *index = hicn_dpoi_get_index (face);
+ *index = face_id;
+
+ ret = HICN_ERROR_FACE_ALREADY_CREATED;
}
return ret;
diff --git a/hicn-plugin/src/route.c b/hicn-plugin/src/route.c
index ff96e5cd7..2509628d9 100644
--- a/hicn-plugin/src/route.c
+++ b/hicn-plugin/src/route.c
@@ -231,11 +231,11 @@ sync_hicn_fib_entry (hicn_dpo_ctx_t *fib_entry, hicn_face_id_t **pvec_faces)
const dpo_id_t *former_dpo = &temp;
int index = 0;
-#define ADD_FACE(nh) \
+#define ADD_FACE(nh, dpo_proto) \
do \
{ \
/* Careful, this adds a lock on the face if it exists */ \
- hicn_face_add (dpo, nh, sw_if, &face_id); \
+ hicn_face_add (dpo, nh, sw_if, &face_id, dpo_proto); \
ASSERT (face_id != HICN_FACE_NULL); \
vec_validate (vec_faces, index); \
vec_faces[index] = face_id; \
@@ -272,7 +272,7 @@ sync_hicn_fib_entry (hicn_dpo_ctx_t *fib_entry, hicn_face_id_t **pvec_faces)
sw_if = adj->rewrite_header.sw_if_index;
nh = get_address (&(adj->sub_type.nbr.next_hop), sw_if,
fib_entry->proto);
- ADD_FACE (nh);
+ ADD_FACE (nh, dpo->dpoi_proto);
HICN_DEBUG ("Added new HICN face: %d because of route prefix %U",
face_id, format_fib_prefix, &_fib_entry->fe_prefix);
}
@@ -285,11 +285,11 @@ sync_hicn_fib_entry (hicn_dpo_ctx_t *fib_entry, hicn_face_id_t **pvec_faces)
{
case FIB_PROTOCOL_IP6:
ip46_address_set_ip6 (nh, &localhost6);
- ADD_FACE (nh);
+ ADD_FACE (nh, DPO_PROTO_IP6);
break;
case FIB_PROTOCOL_IP4:
ip46_address_set_ip4 (nh, &localhost4);
- ADD_FACE (nh);
+ ADD_FACE (nh, DPO_PROTO_IP4);
break;
default:
continue;
@@ -302,7 +302,7 @@ sync_hicn_fib_entry (hicn_dpo_ctx_t *fib_entry, hicn_face_id_t **pvec_faces)
else if (dpo_is_pgserver (dpo))
{
hicnpg_server_t *pg_server = hicnpg_server_get (dpo->dpoi_index);
- ADD_FACE (&pg_server->hicn_locator);
+ ADD_FACE (&pg_server->hicn_locator, dpo->dpoi_proto);
}
}
@@ -370,7 +370,7 @@ disable_data_receiving_rm_fib_entry (vnet_main_t *vnm, vnet_sw_interface_t *si,
}
int
-hicn_route_enable (fib_prefix_t *prefix, hicn_face_id_t **pvec_faces)
+hicn_route_enable (const fib_prefix_t *prefix, hicn_face_id_t **pvec_faces)
{
int ret = HICN_ERROR_NONE;
@@ -464,7 +464,7 @@ hicn_route_enable (fib_prefix_t *prefix, hicn_face_id_t **pvec_faces)
*/
vnet_main_t *vnm = vnet_get_main ();
vnet_sw_interface_walk (vnm, enable_data_receiving_new_fib_entry,
- &(prefix->fp_proto));
+ (void *) (&prefix->fp_proto));
dpo_unlock (&dpo);
}
diff --git a/hicn-plugin/src/route.h b/hicn-plugin/src/route.h
index 072926498..46204dd4c 100644
--- a/hicn-plugin/src/route.h
+++ b/hicn-plugin/src/route.h
@@ -109,7 +109,7 @@ int ip_nh_udp_tunnel_add_del_helper (fib_protocol_t fib_proto,
* loadbalancer in the vrf HICN already contains a dpo which is not an hICN one
* HICN_ERROR_ROUTE_MLT_LD if there are more than a dpo in the vpp loadbalancer
*/
-int hicn_route_enable (fib_prefix_t *prefix, hicn_face_id_t **vec_faces);
+int hicn_route_enable (const fib_prefix_t *prefix, hicn_face_id_t **vec_faces);
/**
* @Brief Disable an hICN for an ip prefix. If hICN wasn't enable on the prefix