aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src/faces/ip
diff options
context:
space:
mode:
authorAlberto Compagno <acompagn+fdio@cisco.com>2019-11-21 11:59:54 +0000
committerAlberto Compagno <acompagn+fdio@cisco.com>2019-11-22 12:47:14 +0000
commit62f7b46d4c49d6e5bfb5b3b537bfcaf6503e7bac (patch)
tree35e206900cf6a1535df2b3439a55e0fdd9091a7f /hicn-plugin/src/faces/ip
parentae6f3b8e1f55fc4bb7807c293850d3cb46cab1fd (diff)
[HICN-405] Added application face delete
Added two new messages in the binary api: - hicn_api_face_cons_del to delete a consumer face - hicn_api_face_prod_del to delete a producer face Added the corresponding commands in the vpp_api_test for debugging and testing Reworked the cache policy structure to add a new function that flash the content store from the content coming from the destroyed producer face. This is required since the CS while each producer face has its own lru list. Removing only the producer face without flushing the CS from the content coming from the producer face will lead to a segfault in case there is a hit in the CS as the lru no longer exists and it won't be possible to update the head of the lru. Signed-off-by: Alberto Compagno <acompagn+fdio@cisco.com> Change-Id: I8776c86952d50900aa504dd22aec521ed25c1dae
Diffstat (limited to 'hicn-plugin/src/faces/ip')
-rw-r--r--hicn-plugin/src/faces/ip/dpo_ip.h28
-rw-r--r--hicn-plugin/src/faces/ip/face_ip.h16
2 files changed, 27 insertions, 17 deletions
diff --git a/hicn-plugin/src/faces/ip/dpo_ip.h b/hicn-plugin/src/faces/ip/dpo_ip.h
index d6b4f5f7e..c893c8be4 100644
--- a/hicn-plugin/src/faces/ip/dpo_ip.h
+++ b/hicn-plugin/src/faces/ip/dpo_ip.h
@@ -41,11 +41,15 @@ void hicn_dpo_ip_module_init (void);
*/
always_inline int
hicn_dpo_ip4_lock_from_local (dpo_id_t * dpo,
- u32 * in_faces_vec_id,
+ u32 * in_faces_vec_id,
u8 * hicnb_flags,
const ip4_address_t * local_addr, u32 sw_if)
{
- hicn_face_ip_input_faces_t * in_faces_vec =
+ dpo->dpoi_type = DPO_FIRST;
+ dpo->dpoi_proto = DPO_PROTO_NONE;
+ dpo->dpoi_index = INDEX_INVALID;
+ dpo->dpoi_next_node = 0;
+ hicn_face_ip_input_faces_t *in_faces_vec =
hicn_face_ip4_get_vec (local_addr, sw_if, &hicn_face_ip_local_hashtb);
if (PREDICT_FALSE (in_faces_vec == NULL))
@@ -61,7 +65,7 @@ hicn_dpo_ip4_lock_from_local (dpo_id_t * dpo,
dpo_set (dpo, hicn_face_ip_type, DPO_PROTO_IP4, in_faces_vec->face_id);
dpo->dpoi_next_node = ~0;
- dpo_lock (dpo);
+ dpo_unlock (dpo);
return HICN_ERROR_NONE;
}
@@ -80,11 +84,15 @@ hicn_dpo_ip4_lock_from_local (dpo_id_t * dpo,
*/
always_inline int
hicn_dpo_ip6_lock_from_local (dpo_id_t * dpo,
- u32 * in_faces_vec_id,
+ u32 * in_faces_vec_id,
u8 * hicnb_flags,
const ip6_address_t * local_addr, u32 sw_if)
{
- hicn_face_ip_input_faces_t * in_faces_vec =
+ dpo->dpoi_type = DPO_FIRST;
+ dpo->dpoi_proto = DPO_PROTO_NONE;
+ dpo->dpoi_index = INDEX_INVALID;
+ dpo->dpoi_next_node = 0;
+ hicn_face_ip_input_faces_t *in_faces_vec =
hicn_face_ip6_get_vec (local_addr, sw_if, &hicn_face_ip_local_hashtb);
if (PREDICT_FALSE (in_faces_vec == NULL))
@@ -100,7 +108,7 @@ hicn_dpo_ip6_lock_from_local (dpo_id_t * dpo,
dpo_set (dpo, hicn_face_ip_type, DPO_PROTO_IP6, in_faces_vec->face_id);
dpo->dpoi_next_node = ~0;
- dpo_lock (dpo);
+ dpo_unlock (dpo);
return HICN_ERROR_NONE;
}
@@ -144,7 +152,7 @@ hicn_dpo_ip4_add_and_lock_from_remote (dpo_id_t * dpo,
dpo_set (dpo, hicn_face_ip_type, DPO_PROTO_IP4, dpoi_index);
dpo->dpoi_next_node = node_index;
- dpo_lock (dpo);
+ dpo_unlock (dpo);
return;
}
@@ -158,7 +166,7 @@ hicn_dpo_ip4_add_and_lock_from_remote (dpo_id_t * dpo,
hicn_face_id_t dpoi_index = hicn_dpoi_get_index (face);
dpo_set (dpo, hicn_face_ip_type, DPO_PROTO_IP4, dpoi_index);
dpo->dpoi_next_node = node_index;
- dpo_lock (dpo);
+ dpo_unlock (dpo);
}
/**
@@ -198,7 +206,7 @@ hicn_dpo_ip6_add_and_lock_from_remote (dpo_id_t * dpo,
dpo_set (dpo, hicn_face_ip_type, DPO_PROTO_IP4, dpoi_index);
dpo->dpoi_next_node = node_index;
- dpo_lock (dpo);
+ dpo_unlock (dpo);
return;
}
@@ -211,7 +219,7 @@ hicn_dpo_ip6_add_and_lock_from_remote (dpo_id_t * dpo,
index_t dpoi_index = hicn_dpoi_get_index (face);
dpo_set (dpo, hicn_face_ip_type, DPO_PROTO_IP6, dpoi_index);
dpo->dpoi_next_node = node_index;
- dpo_lock (dpo);
+ dpo_unlock (dpo);
}
diff --git a/hicn-plugin/src/faces/ip/face_ip.h b/hicn-plugin/src/faces/ip/face_ip.h
index 0491af506..74f3a83dc 100644
--- a/hicn-plugin/src/faces/ip/face_ip.h
+++ b/hicn-plugin/src/faces/ip/face_ip.h
@@ -47,7 +47,7 @@ typedef struct hicn_ip_face_t_
* @bried vector of faces used to collect faces having the same local address
*
*/
-typedef hicn_face_id_t * hicn_face_ip_vec_t;
+typedef hicn_face_id_t *hicn_face_ip_vec_t;
typedef struct hicn_ip_input_faces_s_
{
@@ -77,7 +77,7 @@ extern mhash_t hicn_face_ip_remote_hashtb;
/**
* Pool containing the vector of possible incoming faces.
*/
-extern hicn_face_ip_vec_t * hicn_vec_pool;
+extern hicn_face_ip_vec_t *hicn_vec_pool;
/**
* Key definition for the mhash table. An ip face is uniquely identified by ip
@@ -161,12 +161,13 @@ hicn_face_ip4_get (const ip4_address_t * addr, u32 sw_if, mhash_t * hashtb)
* @result Pointer to the face.
*/
always_inline hicn_face_ip_input_faces_t *
-hicn_face_ip4_get_vec (const ip4_address_t * addr, u32 sw_if, mhash_t * hashtb)
+hicn_face_ip4_get_vec (const ip4_address_t * addr, u32 sw_if,
+ mhash_t * hashtb)
{
hicn_face_ip_key_t key;
hicn_face_ip4_get_key (addr, sw_if, &key);
- return (hicn_face_ip_input_faces_t *) mhash_get (hashtb,&key);
+ return (hicn_face_ip_input_faces_t *) mhash_get (hashtb, &key);
}
/**
@@ -179,12 +180,13 @@ hicn_face_ip4_get_vec (const ip4_address_t * addr, u32 sw_if, mhash_t * hashtb)
* @result Pointer to the face.
*/
always_inline hicn_face_ip_input_faces_t *
-hicn_face_ip6_get_vec (const ip6_address_t * addr, u32 sw_if, mhash_t * hashtb)
+hicn_face_ip6_get_vec (const ip6_address_t * addr, u32 sw_if,
+ mhash_t * hashtb)
{
hicn_face_ip_key_t key;
hicn_face_ip6_get_key (addr, sw_if, &key);
- return (hicn_face_ip_input_faces_t *) mhash_get (hashtb,&key);
+ return (hicn_face_ip_input_faces_t *) mhash_get (hashtb, &key);
}
/**
@@ -255,7 +257,7 @@ hicn_iface_ip_add (const ip46_address_t * local_addr,
face->shared.pl_id = (u16) 0;
face->shared.face_type = hicn_face_ip_type;
face->shared.flags = HICN_FACE_FLAGS_IFACE;
- face->shared.locks = 0;
+ face->shared.locks = 1;
hicn_face_ip_key_t key;
hicn_face_ip6_get_key (&(remote_addr->ip6), sw_if, &key);