blob: 87fdb68a36eb4863a4fa82f1fcf02e891c6e836d [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
Ahmed Abdelsalamb0057282022-06-29 16:30:21 +000014/*SR PT error codes*/
Ahmed Abdelsalamc933bb72022-06-29 11:08:42 +000015#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
Ahmed Abdelsalamb0057282022-06-29 16:30:21 +000022/*SR PT paramters max values*/
Ahmed Abdelsalamc933bb72022-06-29 11:08:42 +000023#define SR_PT_ID_MAX 4095
24#define SR_PT_LOAD_MAX 15
25#define SR_PT_TTS_TEMPLATE_MAX 3
26
Ahmed Abdelsalamb0057282022-06-29 16:30:21 +000027/*SR PT TTS Templates*/
Ahmed Abdelsalamc933bb72022-06-29 11:08:42 +000028#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
Ahmed Abdelsalamb0057282022-06-29 16:30:21 +000034/*SR PT TTS Template shift value*/
Ahmed Abdelsalamc933bb72022-06-29 11:08:42 +000035#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/**
Ahmed Abdelsalamb0057282022-06-29 16:30:21 +000050 * @brief SR Path Tracing main datastructure
Ahmed Abdelsalamc933bb72022-06-29 11:08:42 +000051 */
52typedef struct
53{
Ahmed Abdelsalamb0057282022-06-29 16:30:21 +000054 /* Pool of sr_pt_iface instances */
Ahmed Abdelsalamc933bb72022-06-29 11:08:42 +000055 sr_pt_iface_t *sr_pt_iface;
56
Ahmed Abdelsalamb0057282022-06-29 16:30:21 +000057 /* Hash table for sr_pt_iface parameters */
Ahmed Abdelsalamc933bb72022-06-29 11:08:42 +000058 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
Ahmed Abdelsalamb0057282022-06-29 16:30:21 +000068#endif /* included_vnet_sr_pt_h */