summaryrefslogtreecommitdiffstats
path: root/src/vnet/srv6/sr_pt.h
diff options
context:
space:
mode:
authorAhmed Abdelsalam <ahabdels@cisco.com>2022-06-29 11:08:42 +0000
committerDamjan Marion <dmarion@0xa5.net>2022-06-29 15:28:43 +0000
commitc933bb7e37a209c8f29c8a376d274c01ce460079 (patch)
treecf2f75e5f0fe5770f887ecb90df903158bd90b32 /src/vnet/srv6/sr_pt.h
parent0c3ca59e3f4a0596a361bca0b1e1ea096d98650c (diff)
sr: Add support for SRv6 Path Tracing Infrastructure
This patch adds support for the infrastructure required to support SRv6 Path Tracing defined in https://datatracker.ietf.org/doc/draft-filsfils-spring-path-tracing/ Type: feature Change-Id: If3b09d6216490a60dd5a816577477b6399abc124 Signed-off-by: Ahmed Abdelsalam <ahabdels@cisco.com>
Diffstat (limited to 'src/vnet/srv6/sr_pt.h')
-rw-r--r--src/vnet/srv6/sr_pt.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/vnet/srv6/sr_pt.h b/src/vnet/srv6/sr_pt.h
new file mode 100644
index 00000000000..7242f90b6b3
--- /dev/null
+++ b/src/vnet/srv6/sr_pt.h
@@ -0,0 +1,68 @@
+/* SPDX-License-Identifier: Apache-2.0
+ * Copyright(c) 2022 Cisco Systems, Inc.
+ */
+
+/**
+ * @file
+ * @brief SR Path Tracing data structures definitions
+ *
+ */
+
+#ifndef included_vnet_sr_pt_h
+#define included_vnet_sr_pt_h
+
+/*PT error codes*/
+#define SR_PT_ERR_NOENT -1 /* No such entry*/
+#define SR_PT_ERR_EXIST -2 /* Entry exists */
+#define SR_PT_ERR_IFACE_INVALID -3 /* IFACE invalid */
+#define SR_PT_ERR_ID_INVALID -4 /* ID invalid */
+#define SR_PT_ERR_LOAD_INVALID -5 /* LOAD invalid*/
+#define SR_PT_ERR_TTS_TEMPLATE_INVALID -6 /* TTS Template invalid */
+
+/*PT paramters max values*/
+#define SR_PT_ID_MAX 4095
+#define SR_PT_LOAD_MAX 15
+#define SR_PT_TTS_TEMPLATE_MAX 3
+
+/*PT TTS Templates*/
+#define SR_PT_TTS_TEMPLATE_0 0
+#define SR_PT_TTS_TEMPLATE_1 1
+#define SR_PT_TTS_TEMPLATE_2 2
+#define SR_PT_TTS_TEMPLATE_3 3
+#define SR_PT_TTS_TEMPLATE_DEFAULT 2
+
+/*PT TTS Template shift value*/
+#define SR_PT_TTS_SHIFT_TEMPLATE_0 8
+#define SR_PT_TTS_SHIFT_TEMPLATE_1 12
+#define SR_PT_TTS_SHIFT_TEMPLATE_2 16
+#define SR_PT_TTS_SHIFT_TEMPLATE_3 20
+
+typedef struct
+{
+ u32 iface; /**< Interface */
+ u16 id; /**< Interface ID */
+ u8 ingress_load; /**< Interface Ingress Load */
+ u8 egress_load; /**< Interface Egress Load */
+ u8 tts_template; /**< Interface TTS Template */
+} sr_pt_iface_t;
+
+/**
+ * @brief Path Tracing main datastructure
+ */
+typedef struct
+{
+ /* Pool of pt_iface instances */
+ sr_pt_iface_t *sr_pt_iface;
+
+ /* Hash table for pt iface parameters */
+ mhash_t sr_pt_iface_index_hash;
+
+} sr_pt_main_t;
+
+extern sr_pt_main_t sr_pt_main;
+extern int sr_pt_add_iface (u32 iface, u16 id, u8 ingress_load, u8 egress_load,
+ u8 tts_template);
+extern int sr_pt_del_iface (u32 iface);
+extern void *sr_pt_find_iface (u32 iface);
+
+#endif /* included_vnet_sr_pt_h */