aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src/strategy.h
diff options
context:
space:
mode:
Diffstat (limited to 'hicn-plugin/src/strategy.h')
-rw-r--r--hicn-plugin/src/strategy.h50
1 files changed, 22 insertions, 28 deletions
diff --git a/hicn-plugin/src/strategy.h b/hicn-plugin/src/strategy.h
index 19eee72c5..c18ae4eea 100644
--- a/hicn-plugin/src/strategy.h
+++ b/hicn-plugin/src/strategy.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:
@@ -24,10 +24,13 @@
/**
* @File
*
- * A strategy is defined as a vpp node and a set of function that will be called
- * during the packet processing. Having one vpp node per strategy allows to
- * easily process multiple interests in the same node (x2 or x4) and call the
- * same function for choosing the next hop.
+ * A strategy is defined as a dpo and a set of function (vft) that will be called
+ * during the packet processing. A strategy is associated to an entry in the fib by
+ * assigning the corresponding dpo to the fib entry. The dpo points to a hICN dpo
+ * context (ctx) which contains the information needed by the strategy to compute
+ * the next hop. Each strategy hash its own dpo type, which means that the dpo_type
+ * uniquely identify a strategy and its vft. The strategy node will use the dpo_type
+ * to retrieve the corresponding vft.
* Here we provide:
* - a template for the callbacks to implement in order to create a new strategy
* (hicn_fwd_strategy_t)
@@ -36,6 +39,15 @@
* interest and calling hicn_select_next_hop)
*/
+/* Trace context struct */
+typedef struct
+{
+ u32 next_index;
+ u32 sw_if_index;
+ u8 pkt_type;
+ dpo_type_t dpo_type;
+} hicn_strategy_trace_t;
+
typedef struct hicn_strategy_vft_s
{
void (*hicn_receive_data) (index_t dpo_idx, int nh_idx);
@@ -43,39 +55,21 @@ typedef struct hicn_strategy_vft_s
void (*hicn_add_interest) (index_t dpo_idx, hicn_hash_entry_t * pit_entry);
u32 (*hicn_select_next_hop) (index_t dpo_idx, int *nh_idx,
dpo_id_t ** outface);
- u32 (*get_strategy_node_index) (void);
- /**< Return the vlib node index implementing the strategy */
+ u8 *(*hicn_format_strategy_trace) (u8 *, hicn_strategy_trace_t *);
+ u8 *(*hicn_format_strategy) (u8 * s, va_list * ap);
+ /**< Format an hICN dpo*/
} hicn_strategy_vft_t;
-hicn_face_vft_t *hicn_strategy_get_face_vft (u16 index);
-
-/* Strategy node API */
-/* Basic interest processing function. To be called in all the strategy nodes */
-uword
-hicn_forward_interest_fn (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame,
- hicn_strategy_vft_t * strategy,
- dpo_type_t dpo_type,
- vlib_node_registration_t * hicn_strategy_node);
-
-/* Trace context struct */
-typedef struct
-{
- u32 next_index;
- u32 sw_if_index;
- u8 pkt_type;
-} hicn_strategy_trace_t;
-
typedef enum
{
HICN_STRATEGY_NEXT_INTEREST_HITPIT,
HICN_STRATEGY_NEXT_INTEREST_HITCS,
HICN_STRATEGY_NEXT_ERROR_DROP,
- HICN_STRATEGY_NEXT_EMPTY,
HICN_STRATEGY_N_NEXT,
} hicn_strategy_next_t;
+extern vlib_node_registration_t hicn_strategy_node;
+
#endif /* //__HICN_STRATEGY__ */
/*