xref: /openbmc/linux/include/uapi/linux/seg6_local.h (revision aa0dc6a7)
1 /*
2  *  SR-IPv6 implementation
3  *
4  *  Author:
5  *  David Lebrun <david.lebrun@uclouvain.be>
6  *
7  *
8  *  This program is free software; you can redistribute it and/or
9  *      modify it under the terms of the GNU General Public License
10  *      as published by the Free Software Foundation; either version
11  *      2 of the License, or (at your option) any later version.
12  */
13 
14 #ifndef _UAPI_LINUX_SEG6_LOCAL_H
15 #define _UAPI_LINUX_SEG6_LOCAL_H
16 
17 #include <linux/seg6.h>
18 
19 enum {
20 	SEG6_LOCAL_UNSPEC,
21 	SEG6_LOCAL_ACTION,
22 	SEG6_LOCAL_SRH,
23 	SEG6_LOCAL_TABLE,
24 	SEG6_LOCAL_NH4,
25 	SEG6_LOCAL_NH6,
26 	SEG6_LOCAL_IIF,
27 	SEG6_LOCAL_OIF,
28 	SEG6_LOCAL_BPF,
29 	SEG6_LOCAL_VRFTABLE,
30 	SEG6_LOCAL_COUNTERS,
31 	__SEG6_LOCAL_MAX,
32 };
33 #define SEG6_LOCAL_MAX (__SEG6_LOCAL_MAX - 1)
34 
35 enum {
36 	SEG6_LOCAL_ACTION_UNSPEC	= 0,
37 	/* node segment */
38 	SEG6_LOCAL_ACTION_END		= 1,
39 	/* adjacency segment (IPv6 cross-connect) */
40 	SEG6_LOCAL_ACTION_END_X		= 2,
41 	/* lookup of next seg NH in table */
42 	SEG6_LOCAL_ACTION_END_T		= 3,
43 	/* decap and L2 cross-connect */
44 	SEG6_LOCAL_ACTION_END_DX2	= 4,
45 	/* decap and IPv6 cross-connect */
46 	SEG6_LOCAL_ACTION_END_DX6	= 5,
47 	/* decap and IPv4 cross-connect */
48 	SEG6_LOCAL_ACTION_END_DX4	= 6,
49 	/* decap and lookup of DA in v6 table */
50 	SEG6_LOCAL_ACTION_END_DT6	= 7,
51 	/* decap and lookup of DA in v4 table */
52 	SEG6_LOCAL_ACTION_END_DT4	= 8,
53 	/* binding segment with insertion */
54 	SEG6_LOCAL_ACTION_END_B6	= 9,
55 	/* binding segment with encapsulation */
56 	SEG6_LOCAL_ACTION_END_B6_ENCAP	= 10,
57 	/* binding segment with MPLS encap */
58 	SEG6_LOCAL_ACTION_END_BM	= 11,
59 	/* lookup last seg in table */
60 	SEG6_LOCAL_ACTION_END_S		= 12,
61 	/* forward to SR-unaware VNF with static proxy */
62 	SEG6_LOCAL_ACTION_END_AS	= 13,
63 	/* forward to SR-unaware VNF with masquerading */
64 	SEG6_LOCAL_ACTION_END_AM	= 14,
65 	/* custom BPF action */
66 	SEG6_LOCAL_ACTION_END_BPF	= 15,
67 	/* decap and lookup of DA in v4 or v6 table */
68 	SEG6_LOCAL_ACTION_END_DT46	= 16,
69 
70 	__SEG6_LOCAL_ACTION_MAX,
71 };
72 
73 #define SEG6_LOCAL_ACTION_MAX (__SEG6_LOCAL_ACTION_MAX - 1)
74 
75 enum {
76 	SEG6_LOCAL_BPF_PROG_UNSPEC,
77 	SEG6_LOCAL_BPF_PROG,
78 	SEG6_LOCAL_BPF_PROG_NAME,
79 	__SEG6_LOCAL_BPF_PROG_MAX,
80 };
81 
82 #define SEG6_LOCAL_BPF_PROG_MAX (__SEG6_LOCAL_BPF_PROG_MAX - 1)
83 
84 /* SRv6 Behavior counters are encoded as netlink attributes guaranteeing the
85  * correct alignment.
86  * Each counter is identified by a different attribute type (i.e.
87  * SEG6_LOCAL_CNT_PACKETS).
88  *
89  * - SEG6_LOCAL_CNT_PACKETS: identifies a counter that counts the number of
90  *   packets that have been CORRECTLY processed by an SRv6 Behavior instance
91  *   (i.e., packets that generate errors or are dropped are NOT counted).
92  *
93  * - SEG6_LOCAL_CNT_BYTES: identifies a counter that counts the total amount
94  *   of traffic in bytes of all packets that have been CORRECTLY processed by
95  *   an SRv6 Behavior instance (i.e., packets that generate errors or are
96  *   dropped are NOT counted).
97  *
98  * - SEG6_LOCAL_CNT_ERRORS: identifies a counter that counts the number of
99  *   packets that have NOT been properly processed by an SRv6 Behavior instance
100  *   (i.e., packets that generate errors or are dropped).
101  */
102 enum {
103 	SEG6_LOCAL_CNT_UNSPEC,
104 	SEG6_LOCAL_CNT_PAD,		/* pad for 64 bits values */
105 	SEG6_LOCAL_CNT_PACKETS,
106 	SEG6_LOCAL_CNT_BYTES,
107 	SEG6_LOCAL_CNT_ERRORS,
108 	__SEG6_LOCAL_CNT_MAX,
109 };
110 
111 #define SEG6_LOCAL_CNT_MAX (__SEG6_LOCAL_CNT_MAX - 1)
112 
113 #endif
114