aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src/pcs.h
diff options
context:
space:
mode:
authorAlberto Compagno <acompagn+fdio@cisco.com>2019-10-21 18:03:16 +0200
committerAlberto Compagno <acompagn+fdio@cisco.com>2019-10-22 18:01:19 +0200
commit0afc64ba6ca5a522202c948fc56ae42344a51e76 (patch)
treeafe1b99d0ffc97122b3fcb1b6e7efbd247cc49c4 /hicn-plugin/src/pcs.h
parenta9a7f4c36804d0a5acc5788cf2ef9f39954cccb4 (diff)
[HICN-342] No need to take a lock on the hash entry if the lookup for
a data hit the CS. Data packets coming from the network are dropped, data packets coming from an application face are either dropped or sent to the push node (which does not require a lock on the hash entry) Change-Id: Icf662dffa33b9dda2e2a69fc2104a69a82ef19fd Signed-off-by: Alberto Compagno <acompagn+fdio@cisco.com>
Diffstat (limited to 'hicn-plugin/src/pcs.h')
-rw-r--r--hicn-plugin/src/pcs.h28
1 files changed, 22 insertions, 6 deletions
diff --git a/hicn-plugin/src/pcs.h b/hicn-plugin/src/pcs.h
index c7e8a4b59..d9c48954e 100644
--- a/hicn-plugin/src/pcs.h
+++ b/hicn-plugin/src/pcs.h
@@ -499,8 +499,16 @@ hicn_pcs_cs_update (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
policy_vft->hicn_cs_delete_get (pitcs, policy_state,
&node, &pcs_entry, &hash_entry);
- hicn_pcs_cs_delete (vm, pitcs, &pcs_entry, &node, hash_entry, NULL,
- NULL);
+ /*
+ * We don't have to decrease the lock (therefore we cannot
+ * use hicn_pcs_cs_delete function)
+ */
+ policy_vft->hicn_cs_dequeue (pitcs, node, pcs_entry, policy_state);
+
+ hicn_cs_delete_trimmed (pitcs, &pcs_entry, hash_entry, &node, vm);
+
+ /* Update the global CS counter */
+ pitcs->pcs_cs_count--;
}
}
else
@@ -541,14 +549,14 @@ hicn_pcs_cs_delete (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
}
/* A data could have been inserted in the CS through a push. In this case locks == 0 */
- if (hash_entry->locks == 0 || hash_entry->locks == 1)
+ hash_entry->locks--;
+ if (hash_entry->locks == 0)
{
hicn_pcs_delete_internal
(pitcs, pcs_entryp, hash_entry, nodep, vm, dpo_vft, hicn_dpo_id);
}
else
{
- hash_entry->locks--;
hash_entry->he_flags |= HICN_HASH_ENTRY_FLAG_DELETED;
}
}
@@ -603,8 +611,16 @@ hicn_pcs_cs_insert (vlib_main_t * vm, hicn_pit_cs_t * pitcs,
policy_vft->hicn_cs_delete_get (pitcs, policy_state,
&node, &pcs_entry, &hash_entry);
- hicn_pcs_cs_delete (vm, pitcs, &pcs_entry, &node, hash_entry, NULL,
- NULL);
+ /*
+ * We don't have to decrease the lock (therefore we cannot
+ * use hicn_pcs_cs_delete function)
+ */
+ policy_vft->hicn_cs_dequeue (pitcs, node, pcs_entry, policy_state);
+
+ hicn_cs_delete_trimmed (pitcs, &pcs_entry, hash_entry, &node, vm);
+
+ /* Update the global CS counter */
+ pitcs->pcs_cs_count--;
}
}
return ret;