summaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src/mapme.h
diff options
context:
space:
mode:
Diffstat (limited to 'hicn-plugin/src/mapme.h')
-rw-r--r--hicn-plugin/src/mapme.h23
1 files changed, 13 insertions, 10 deletions
diff --git a/hicn-plugin/src/mapme.h b/hicn-plugin/src/mapme.h
index 071590ede..7ed0af88b 100644
--- a/hicn-plugin/src/mapme.h
+++ b/hicn-plugin/src/mapme.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019 Cisco and/or its affiliates.
+ * Copyright (c) 2017-2020 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -34,6 +34,9 @@
#define INVALID_SEQ 0
+STATIC_ASSERT (sizeof(u32) == sizeof(seq_t),
+ "seq_t is not 4 bytes");
+
typedef struct hicn_mapme_conf_s
{
hicn_mapme_conf_t conf;
@@ -86,12 +89,12 @@ hicn_mapme_nh_set (hicn_mapme_tfib_t * tfib, dpo_id_t * face_id)
* @brief Add a next hop iif it is not already a next hops
*/
static_always_inline int
-hicn_mapme_nh_add (hicn_mapme_tfib_t * tfib, dpo_id_t * face_id)
+hicn_mapme_nh_add (hicn_mapme_tfib_t * tfib, hicn_face_id_t face_id)
{
for (u8 pos = 0; pos < tfib->entry_count; pos++)
- if (dpo_cmp (&tfib->next_hops[pos], face_id) == 0)
+ if (tfib->next_hops[pos] == face_id)
return 0;
- tfib->next_hops[tfib->entry_count++] = *face_id;
+ tfib->next_hops[tfib->entry_count++] = face_id;
return 0;
}
@@ -133,7 +136,7 @@ hicn_mapme_tfib_clear (hicn_mapme_tfib_t * tfib)
u8 pos = ~0;
for (pos = start_pos; pos < HICN_PARAM_FIB_ENTRY_NHOPS_MAX; pos++)
{
- hicn_face_unlock (&tfib->next_hops[pos]);
+ hicn_face_unlock_with_id (&tfib->next_hops[pos]);
tfib->next_hops[pos] = invalid;
break;
}
@@ -144,9 +147,9 @@ hicn_mapme_tfib_clear (hicn_mapme_tfib_t * tfib)
}
static_always_inline int
-hicn_mapme_tfib_del (hicn_mapme_tfib_t * tfib, dpo_id_t * face_id)
+hicn_mapme_tfib_del (hicn_mapme_tfib_t * tfib, hicn_face_id_t face_id)
{
- dpo_id_t invalid = NEXT_HOP_INVALID;
+ hicn_face_id_t invalid = NEXT_HOP_INVALID;
/*
* We need to do a linear scan of TFIB entries to find the one to
* remove
@@ -154,9 +157,9 @@ hicn_mapme_tfib_del (hicn_mapme_tfib_t * tfib, dpo_id_t * face_id)
u8 start_pos = HICN_PARAM_FIB_ENTRY_NHOPS_MAX - tfib->tfib_entry_count;
u8 pos = ~0;
for (pos = start_pos; pos < HICN_PARAM_FIB_ENTRY_NHOPS_MAX; pos++)
- if (dpo_cmp (&tfib->next_hops[pos], face_id) == 0)
+ if (tfib->next_hops[pos] == face_id)
{
- hicn_face_unlock (&tfib->next_hops[pos]);
+ hicn_face_unlock_with_id (&tfib->next_hops[pos]);
tfib->next_hops[pos] = invalid;
break;
}
@@ -169,7 +172,7 @@ hicn_mapme_tfib_del (hicn_mapme_tfib_t * tfib, dpo_id_t * face_id)
/* Likely we won't receive a new IU twice from the same face */
if (PREDICT_TRUE (pos > start_pos))
memmove (tfib->next_hops + start_pos, tfib->next_hops + start_pos + 1,
- (pos - start_pos) * sizeof (dpo_id_t));
+ (pos - start_pos) * sizeof (hicn_face_id_t));
return 0;
}