blob: 7242f90b6b3bbcc78d82ada1fdab14d3e190de11 [file] [log] [blame]
Ahmed Abdelsalamc933bb72022-06-29 11:08:42 +00001/* SPDX-License-Identifier: Apache-2.0
2 * Copyright(c) 2022 Cisco Systems, Inc.
3 */
4
5/**
6 * @file
7 * @brief SR Path Tracing data structures definitions
8 *
9 */
10
11#ifndef included_vnet_sr_pt_h
12#define included_vnet_sr_pt_h
13
14/*PT error codes*/
15#define SR_PT_ERR_NOENT -1 /* No such entry*/
16#define SR_PT_ERR_EXIST -2 /* Entry exists */
17#define SR_PT_ERR_IFACE_INVALID -3 /* IFACE invalid */
18#define SR_PT_ERR_ID_INVALID -4 /* ID invalid */
19#define SR_PT_ERR_LOAD_INVALID -5 /* LOAD invalid*/
20#define SR_PT_ERR_TTS_TEMPLATE_INVALID -6 /* TTS Template invalid */
21
22/*PT paramters max values*/
23#define SR_PT_ID_MAX 4095
24#define SR_PT_LOAD_MAX 15
25#define SR_PT_TTS_TEMPLATE_MAX 3
26
27/*PT TTS Templates*/
28#define SR_PT_TTS_TEMPLATE_0 0
29#define SR_PT_TTS_TEMPLATE_1 1
30#define SR_PT_TTS_TEMPLATE_2 2
31#define SR_PT_TTS_TEMPLATE_3 3
32#define SR_PT_TTS_TEMPLATE_DEFAULT 2
33
34/*PT TTS Template shift value*/
35#define SR_PT_TTS_SHIFT_TEMPLATE_0 8
36#define SR_PT_TTS_SHIFT_TEMPLATE_1 12
37#define SR_PT_TTS_SHIFT_TEMPLATE_2 16
38#define SR_PT_TTS_SHIFT_TEMPLATE_3 20
39
40typedef struct
41{
42 u32 iface; /**< Interface */
43 u16 id; /**< Interface ID */
44 u8 ingress_load; /**< Interface Ingress Load */
45 u8 egress_load; /**< Interface Egress Load */
46 u8 tts_template; /**< Interface TTS Template */
47} sr_pt_iface_t;
48
49/**
50 * @brief Path Tracing main datastructure
51 */
52typedef struct
53{
54 /* Pool of pt_iface instances */
55 sr_pt_iface_t *sr_pt_iface;
56
57 /* Hash table for pt iface parameters */
58 mhash_t sr_pt_iface_index_hash;
59
60} sr_pt_main_t;
61
62extern sr_pt_main_t sr_pt_main;
63extern int sr_pt_add_iface (u32 iface, u16 id, u8 ingress_load, u8 egress_load,
64 u8 tts_template);
65extern int sr_pt_del_iface (u32 iface);
66extern void *sr_pt_find_iface (u32 iface);
67
68#endif /* included_vnet_sr_pt_h */