diff options
author | Alberto Compagno <acompagn+fdio@cisco.com> | 2019-08-09 16:11:33 +0200 |
---|---|---|
committer | Alberto Compagno <acompagn+fdio@cisco.com> | 2019-10-07 09:07:07 +0200 |
commit | 9f0aa8c27ee927b5c74b75fac72eaa782ff23a53 (patch) | |
tree | 09245b82718991417dcd8ca1b6e9de3b3b9c8ec8 /hicn-plugin/src/faces/ip/dpo_ip.h | |
parent | 85a791ac2cdd35d79c00141e748b4c68fbdafb0d (diff) |
[HICN-226]
Reworked incoming face identification on receiving a data packet. The output is now a list of possible incoming faces, plus a preferred one which cover the case in which the face is a local producer face. In that case we can identify the face uniquely as we are sure that we have one face for memif.
Change-Id: Ic48475a36e37a28cec8cc1448b4b4ee6c001efc0
Signed-off-by: Alberto Compagno <acompagn+fdio@cisco.com>
Diffstat (limited to 'hicn-plugin/src/faces/ip/dpo_ip.h')
-rw-r--r-- | hicn-plugin/src/faces/ip/dpo_ip.h | 117 |
1 files changed, 61 insertions, 56 deletions
diff --git a/hicn-plugin/src/faces/ip/dpo_ip.h b/hicn-plugin/src/faces/ip/dpo_ip.h index 164931a06..d6b4f5f7e 100644 --- a/hicn-plugin/src/faces/ip/dpo_ip.h +++ b/hicn-plugin/src/faces/ip/dpo_ip.h @@ -29,10 +29,9 @@ void hicn_dpo_ip_module_init (void); /** - * @brief Retrieve a face from the ip4 local address and returns its dpo. This - * method adds a lock on the face state. + * @brief Retrieve a vector of faces from the ip4 local address and returns its index. * - * @param dpo: Result of the lookup. If the face doesn't exist dpo = NULL + * @param vec: Result of the lookup. If no face exists for the local address vec = NULL * @param hicnb_flags: Flags that indicate whether the face is an application * face or not * @param local_addr: Ip v4 local address of the face @@ -42,22 +41,25 @@ 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, u8 * hicnb_flags, const ip4_address_t * local_addr, u32 sw_if) { - hicn_face_t *face = - hicn_face_ip4_get (local_addr, sw_if, &hicn_face_ip_local_hashtb); + 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 (face == NULL)) + if (PREDICT_FALSE (in_faces_vec == NULL)) return HICN_ERROR_FACE_NOT_FOUND; + *in_faces_vec_id = in_faces_vec->vec_id; + hicn_face_t *face = hicn_dpoi_get_from_idx (in_faces_vec->face_id); + *hicnb_flags = HICN_BUFFER_FLAGS_DEFAULT; *hicnb_flags |= (face->shared.flags & HICN_FACE_FLAGS_APPFACE_PROD) >> HICN_FACE_FLAGS_APPFACE_PROD_BIT; - hicn_face_id_t dpoi_index = hicn_dpoi_get_index (face); - dpo_set (dpo, hicn_face_ip_type, DPO_PROTO_IP4, dpoi_index); + dpo_set (dpo, hicn_face_ip_type, DPO_PROTO_IP4, in_faces_vec->face_id); dpo->dpoi_next_node = ~0; dpo_lock (dpo); @@ -78,22 +80,25 @@ 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, u8 * hicnb_flags, const ip6_address_t * local_addr, u32 sw_if) { - hicn_face_t *face = - hicn_face_ip6_get (local_addr, sw_if, &hicn_face_ip_local_hashtb); + 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 (face == NULL)) + if (PREDICT_FALSE (in_faces_vec == NULL)) return HICN_ERROR_FACE_NOT_FOUND; + *in_faces_vec_id = in_faces_vec->vec_id; + hicn_face_t *face = hicn_dpoi_get_from_idx (in_faces_vec->face_id); + *hicnb_flags = HICN_BUFFER_FLAGS_DEFAULT; *hicnb_flags |= (face->shared.flags & HICN_FACE_FLAGS_APPFACE_PROD) >> HICN_FACE_FLAGS_APPFACE_PROD_BIT; - hicn_face_id_t dpoi_index = hicn_dpoi_get_index (face); - dpo_set (dpo, hicn_face_ip_type, DPO_PROTO_IP6, dpoi_index); + dpo_set (dpo, hicn_face_ip_type, DPO_PROTO_IP6, in_faces_vec->face_id); dpo->dpoi_next_node = ~0; dpo_lock (dpo); @@ -210,49 +215,49 @@ hicn_dpo_ip6_add_and_lock_from_remote (dpo_id_t * dpo, } -/** - * @brief Create an ip face and its corresponding dpo. Meant to be used for the - * control plane. - * - * @param dpo: Data plane object that point to the face created. - * @param local_addr: Ip v4 local address of the face - * @param remote_addr: Ip v4 remote address of the face - * @param sw_if: software interface id of the face - * @param adj: Ip adjacency corresponding to the remote address in the face - * @param node_index: vlib edge index to use in the packet processing - * @param flags: Flags of the face - * @param face_id: Identifier for the face (dpoi_index) - * @return HICN_ERROR_FACE_ALREADY_CREATED if the face exists, otherwise HICN_ERROR_NONE - */ -int hicn_dpo_ip4_create (dpo_id_t * dpo, - const ip4_address_t * local_addr, - const ip4_address_t * remote_addr, - u32 sw_if, - adj_index_t adj, - u32 node_index, - hicn_face_flags_t flags, hicn_face_id_t * face_id); - -/** - * @brief Create an ip face and its corresponding dpo. Meant to be used for the - * control plane. - * - * @param dpo: Data plane object that point to the face created. - * @param local_addr: Ip v6 local address of the face - * @param remote_addr: Ip v6 remote address of the face - * @param sw_if: software interface id of the face - * @param adj: Ip adjacency corresponding to the remote address in the face - * @param node_index: vlib edge index to use in the packet processing - * @param flags: Flags of the face - * @param face_id: Identifier for the face (dpoi_index) - * @return HICN_ERROR_FACE_ALREADY_CREATED if the face exists, otherwise HICN_ERROR_NONE - */ -int hicn_dpo_ip6_create (dpo_id_t * dpo, - const ip6_address_t * local_addr, - const ip6_address_t * remote_addr, - u32 sw_if, - adj_index_t adj, - u32 node_index, - hicn_face_flags_t flags, hicn_face_id_t * face_id); +/* /\** */ +/* * @brief Create an ip face and its corresponding dpo. Meant to be used for the */ +/* * control plane. */ +/* * */ +/* * @param dpo: Data plane object that point to the face created. */ +/* * @param local_addr: Ip v4 local address of the face */ +/* * @param remote_addr: Ip v4 remote address of the face */ +/* * @param sw_if: software interface id of the face */ +/* * @param adj: Ip adjacency corresponding to the remote address in the face */ +/* * @param node_index: vlib edge index to use in the packet processing */ +/* * @param flags: Flags of the face */ +/* * @param face_id: Identifier for the face (dpoi_index) */ +/* * @return HICN_ERROR_FACE_ALREADY_CREATED if the face exists, otherwise HICN_ERROR_NONE */ +/* *\/ */ +/* int hicn_dpo_ip4_create (dpo_id_t * dpo, */ +/* const ip4_address_t * local_addr, */ +/* const ip4_address_t * remote_addr, */ +/* u32 sw_if, */ +/* adj_index_t adj, */ +/* u32 node_index, */ +/* hicn_face_flags_t flags, hicn_face_id_t * face_id); */ + +/* /\** */ +/* * @brief Create an ip face and its corresponding dpo. Meant to be used for the */ +/* * control plane. */ +/* * */ +/* * @param dpo: Data plane object that point to the face created. */ +/* * @param local_addr: Ip v6 local address of the face */ +/* * @param remote_addr: Ip v6 remote address of the face */ +/* * @param sw_if: software interface id of the face */ +/* * @param adj: Ip adjacency corresponding to the remote address in the face */ +/* * @param node_index: vlib edge index to use in the packet processing */ +/* * @param flags: Flags of the face */ +/* * @param face_id: Identifier for the face (dpoi_index) */ +/* * @return HICN_ERROR_FACE_ALREADY_CREATED if the face exists, otherwise HICN_ERROR_NONE */ +/* *\/ */ +/* int hicn_dpo_ip6_create (dpo_id_t * dpo, */ +/* const ip6_address_t * local_addr, */ +/* const ip6_address_t * remote_addr, */ +/* u32 sw_if, */ +/* adj_index_t adj, */ +/* u32 node_index, */ +/* hicn_face_flags_t flags, hicn_face_id_t * face_id); */ /** * @brief Create a dpo from an ip face |