aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src/interest_pcslookup_node.c
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2023-01-20 20:19:01 +0000
committerMauro Sardara <msardara@cisco.com>2023-01-23 16:56:15 +0000
commitc33cdb0fe6a1b97e16e9a3a92d9b084115e1b278 (patch)
tree068c6ba4baee93e8dbf9827f37333d00a1adbc08 /hicn-plugin/src/interest_pcslookup_node.c
parent5a86b5436c369547360ec8206d1f07261b9562f3 (diff)
feat(hicn-plugin): reuse strategy node to forward interests
Before the interest forwarding was duplicated in 2 different nodes, the strategy_node and the interest_hitpit_node. Reuse the strategy node so that the nexthop selection via the strategy is done only in one place - teh strategy node. Change-Id: I2c72ec35b1df4e6ed8ce0877e9f3e6f5c1ae68f8 Signed-off-by: Mauro Sardara <msardara@cisco.com> (cherry picked from commit 4ec2784197db60e4f287a88b7944ecb1067bfc08)
Diffstat (limited to 'hicn-plugin/src/interest_pcslookup_node.c')
-rw-r--r--hicn-plugin/src/interest_pcslookup_node.c82
1 files changed, 53 insertions, 29 deletions
diff --git a/hicn-plugin/src/interest_pcslookup_node.c b/hicn-plugin/src/interest_pcslookup_node.c
index a0b2ee3f0..e8aad4a83 100644
--- a/hicn-plugin/src/interest_pcslookup_node.c
+++ b/hicn-plugin/src/interest_pcslookup_node.c
@@ -80,6 +80,7 @@ hicn_interest_pcslookup_node_inline (vlib_main_t *vm,
hicn_pcs_entry_t *pcs_entry = NULL;
f64 tnow;
hicn_buffer_t *hicnb0;
+ const hicn_strategy_vft_t *strategy;
rt = vlib_node_get_runtime_data (vm, hicn_interest_pcslookup_node.index);
@@ -132,49 +133,72 @@ hicn_interest_pcslookup_node_inline (vlib_main_t *vm,
if (ret == HICN_ERROR_NONE)
{
- // We found an entry in the PCS. Next stage for this packet is
- // one of hitpit/cs nodes
- next0 = HICN_INTEREST_PCSLOOKUP_NEXT_INTEREST_HITPIT +
- hicn_pcs_entry_is_cs (pcs_entry);
-
+ // We found an entry in the PCS.
ret = hicn_store_internal_state (
b0, hicn_pcs_entry_get_index (rt->pitcs, pcs_entry),
vnet_buffer (b0)->ip.adj_index[VLIB_TX]);
- if (PREDICT_FALSE (ret != HICN_ERROR_NONE))
- next0 = HICN_INTEREST_PCSLOOKUP_NEXT_ERROR_DROP;
- }
- else
- {
- // No entry in PCS. Let's create one now
- pcs_entry = hicn_pcs_entry_pit_get (
- rt->pitcs, tnow, hicn_buffer_get_lifetime (b0));
+ // Make sure the entry is not expired first
+ if (tnow > hicn_pcs_entry_get_expire_time (pcs_entry))
+ {
+ // Notify strategy
+ strategy = hicn_dpo_get_strategy_vft (hicnb0->vft_id);
+ strategy->hicn_on_interest_timeout (
+ vnet_buffer (b0)->ip.adj_index[VLIB_TX]);
- ret = hicn_pcs_pit_insert (rt->pitcs, pcs_entry, &name);
+ // Release lock on entry - this MUST delete the entry
+ hicn_pcs_entry_remove_lock (rt->pitcs, pcs_entry);
- if (PREDICT_FALSE (ret != HICN_ERROR_NONE))
+ stats.pit_expired_count++;
+
+ // Forward to strategy node
+ // TODO this can be simplified by checking directly in the
+ // pcslookup node!
+ next0 = HICN_INTEREST_PCSLOOKUP_NEXT_STRATEGY;
+
+ goto newentry;
+ }
+ else
{
- next0 = HICN_INTEREST_PCSLOOKUP_NEXT_ERROR_DROP;
+ // Next stage for this packet is one of hitpit/cs nodes
+ next0 = HICN_INTEREST_PCSLOOKUP_NEXT_INTEREST_HITPIT +
+ hicn_pcs_entry_is_cs (pcs_entry);
+
+ if (PREDICT_FALSE (ret != HICN_ERROR_NONE))
+ next0 = HICN_INTEREST_PCSLOOKUP_NEXT_ERROR_DROP;
+
goto end;
}
+ }
+ newentry:
+ // No entry in PCS. Let's create one now
+ pcs_entry = hicn_pcs_entry_pit_get (rt->pitcs, tnow,
+ hicn_buffer_get_lifetime (b0));
- // Store internal state
- ret = hicn_store_internal_state (
- b0, hicn_pcs_entry_get_index (rt->pitcs, pcs_entry),
- vnet_buffer (b0)->ip.adj_index[VLIB_TX]);
+ ret = hicn_pcs_pit_insert (rt->pitcs, pcs_entry, &name);
- if (PREDICT_FALSE (ret != HICN_ERROR_NONE))
- {
- hicn_pcs_entry_remove_lock (rt->pitcs, pcs_entry);
- drop_packet (vm, bi0, &n_left_from, &next0, &to_next,
- &next_index, node);
- continue;
- }
+ if (PREDICT_FALSE (ret != HICN_ERROR_NONE))
+ {
+ next0 = HICN_INTEREST_PCSLOOKUP_NEXT_ERROR_DROP;
+ goto end;
+ }
- // Add face
- hicn_pcs_entry_pit_add_face (pcs_entry, hicnb0->face_id);
+ // Store internal state
+ ret = hicn_store_internal_state (
+ b0, hicn_pcs_entry_get_index (rt->pitcs, pcs_entry),
+ vnet_buffer (b0)->ip.adj_index[VLIB_TX]);
+
+ if (PREDICT_FALSE (ret != HICN_ERROR_NONE))
+ {
+ hicn_pcs_entry_remove_lock (rt->pitcs, pcs_entry);
+ drop_packet (vm, bi0, &n_left_from, &next0, &to_next,
+ &next_index, node);
+ continue;
}
+ // Add face
+ hicn_pcs_entry_pit_add_face (pcs_entry, hicnb0->face_id);
+
end:
stats.pkts_interest_count++;