1 /* SPDX-License-Identifier: Apache-2.0
2 * Copyright(c) 2022 Cisco Systems, Inc.
7 * @brief SR Path Tracing data structures definitions
11 #ifndef included_vnet_sr_pt_h
12 #define included_vnet_sr_pt_h
14 #define IP6_HBH_PT_TYPE 50
17 #define SR_PT_ERR_NOENT -1 /* No such entry*/
18 #define SR_PT_ERR_EXIST -2 /* Entry exists */
19 #define SR_PT_ERR_IFACE_INVALID -3 /* IFACE invalid */
20 #define SR_PT_ERR_ID_INVALID -4 /* ID invalid */
21 #define SR_PT_ERR_LOAD_INVALID -5 /* LOAD invalid*/
22 #define SR_PT_ERR_TTS_TEMPLATE_INVALID -6 /* TTS Template invalid */
24 /*SR PT paramters max values*/
25 #define SR_PT_ID_MAX 4095
26 #define SR_PT_LOAD_MAX 15
27 #define SR_PT_TTS_TEMPLATE_MAX 3
29 /*SR PT TTS Templates*/
30 #define SR_PT_TTS_TEMPLATE_0 0
31 #define SR_PT_TTS_TEMPLATE_1 1
32 #define SR_PT_TTS_TEMPLATE_2 2
33 #define SR_PT_TTS_TEMPLATE_3 3
34 #define SR_PT_TTS_TEMPLATE_DEFAULT 2
36 /*SR PT TTS Template shift value*/
37 #define SR_PT_TTS_SHIFT_TEMPLATE_0 8
38 #define SR_PT_TTS_SHIFT_TEMPLATE_1 12
39 #define SR_PT_TTS_SHIFT_TEMPLATE_2 16
40 #define SR_PT_TTS_SHIFT_TEMPLATE_3 20
43 #define PT_BEHAVIOR_SRC 0
44 #define PT_BEHAVIOR_MID 1
45 #define PT_BEHAVIOR_SNK 2
49 u32 iface; /**< Interface */
50 u16 id; /**< Interface ID */
51 u8 ingress_load; /**< Interface Ingress Load */
52 u8 egress_load; /**< Interface Egress Load */
53 u8 tts_template; /**< Interface TTS Template */
60 } __clib_packed sr_pt_cmd_t;
64 sr_pt_cmd_t cmd_stack[12];
65 } __clib_packed ip6_hop_by_hop_option_pt_t;
68 * @brief SR Path Tracing main datastructure
72 /* Pool of sr_pt_iface instances */
73 sr_pt_iface_t *sr_pt_iface;
75 /* Hash table for sr_pt_iface parameters */
76 mhash_t sr_pt_iface_index_hash;
82 extern sr_pt_main_t sr_pt_main;
83 extern vlib_node_registration_t sr_pt_node;
84 extern int sr_pt_add_iface (u32 iface, u16 id, u8 ingress_load, u8 egress_load,
86 extern int sr_pt_del_iface (u32 iface);
87 extern void *sr_pt_find_iface (u32 iface);
89 #endif /* included_vnet_sr_pt_h */