xref: /linux/include/uapi/linux/seg6_local.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1d1df6fd8SDavid Lebrun /*
2d1df6fd8SDavid Lebrun  *  SR-IPv6 implementation
3d1df6fd8SDavid Lebrun  *
4d1df6fd8SDavid Lebrun  *  Author:
5d1df6fd8SDavid Lebrun  *  David Lebrun <david.lebrun@uclouvain.be>
6d1df6fd8SDavid Lebrun  *
7d1df6fd8SDavid Lebrun  *
8d1df6fd8SDavid Lebrun  *  This program is free software; you can redistribute it and/or
9d1df6fd8SDavid Lebrun  *      modify it under the terms of the GNU General Public License
10d1df6fd8SDavid Lebrun  *      as published by the Free Software Foundation; either version
11d1df6fd8SDavid Lebrun  *      2 of the License, or (at your option) any later version.
12d1df6fd8SDavid Lebrun  */
13d1df6fd8SDavid Lebrun 
14d1df6fd8SDavid Lebrun #ifndef _UAPI_LINUX_SEG6_LOCAL_H
15d1df6fd8SDavid Lebrun #define _UAPI_LINUX_SEG6_LOCAL_H
16d1df6fd8SDavid Lebrun 
17d1df6fd8SDavid Lebrun #include <linux/seg6.h>
18d1df6fd8SDavid Lebrun 
19d1df6fd8SDavid Lebrun enum {
20d1df6fd8SDavid Lebrun 	SEG6_LOCAL_UNSPEC,
21d1df6fd8SDavid Lebrun 	SEG6_LOCAL_ACTION,
22d1df6fd8SDavid Lebrun 	SEG6_LOCAL_SRH,
23d1df6fd8SDavid Lebrun 	SEG6_LOCAL_TABLE,
24d1df6fd8SDavid Lebrun 	SEG6_LOCAL_NH4,
25d1df6fd8SDavid Lebrun 	SEG6_LOCAL_NH6,
26d1df6fd8SDavid Lebrun 	SEG6_LOCAL_IIF,
27d1df6fd8SDavid Lebrun 	SEG6_LOCAL_OIF,
28004d4b27SMathieu Xhonneux 	SEG6_LOCAL_BPF,
29664d6f86SAndrea Mayer 	SEG6_LOCAL_VRFTABLE,
3094604548SAndrea Mayer 	SEG6_LOCAL_COUNTERS,
31*848f3c0dSAndrea Mayer 	SEG6_LOCAL_FLAVORS,
32d1df6fd8SDavid Lebrun 	__SEG6_LOCAL_MAX,
33d1df6fd8SDavid Lebrun };
34d1df6fd8SDavid Lebrun #define SEG6_LOCAL_MAX (__SEG6_LOCAL_MAX - 1)
35d1df6fd8SDavid Lebrun 
36d1df6fd8SDavid Lebrun enum {
37d1df6fd8SDavid Lebrun 	SEG6_LOCAL_ACTION_UNSPEC	= 0,
38d1df6fd8SDavid Lebrun 	/* node segment */
39d1df6fd8SDavid Lebrun 	SEG6_LOCAL_ACTION_END		= 1,
40d1df6fd8SDavid Lebrun 	/* adjacency segment (IPv6 cross-connect) */
41d1df6fd8SDavid Lebrun 	SEG6_LOCAL_ACTION_END_X		= 2,
42d1df6fd8SDavid Lebrun 	/* lookup of next seg NH in table */
43d1df6fd8SDavid Lebrun 	SEG6_LOCAL_ACTION_END_T		= 3,
44d1df6fd8SDavid Lebrun 	/* decap and L2 cross-connect */
45d1df6fd8SDavid Lebrun 	SEG6_LOCAL_ACTION_END_DX2	= 4,
46d1df6fd8SDavid Lebrun 	/* decap and IPv6 cross-connect */
47d1df6fd8SDavid Lebrun 	SEG6_LOCAL_ACTION_END_DX6	= 5,
48d1df6fd8SDavid Lebrun 	/* decap and IPv4 cross-connect */
49d1df6fd8SDavid Lebrun 	SEG6_LOCAL_ACTION_END_DX4	= 6,
50d1df6fd8SDavid Lebrun 	/* decap and lookup of DA in v6 table */
51d1df6fd8SDavid Lebrun 	SEG6_LOCAL_ACTION_END_DT6	= 7,
52d1df6fd8SDavid Lebrun 	/* decap and lookup of DA in v4 table */
53d1df6fd8SDavid Lebrun 	SEG6_LOCAL_ACTION_END_DT4	= 8,
54d1df6fd8SDavid Lebrun 	/* binding segment with insertion */
55d1df6fd8SDavid Lebrun 	SEG6_LOCAL_ACTION_END_B6	= 9,
56d1df6fd8SDavid Lebrun 	/* binding segment with encapsulation */
57d1df6fd8SDavid Lebrun 	SEG6_LOCAL_ACTION_END_B6_ENCAP	= 10,
58d1df6fd8SDavid Lebrun 	/* binding segment with MPLS encap */
59d1df6fd8SDavid Lebrun 	SEG6_LOCAL_ACTION_END_BM	= 11,
60d1df6fd8SDavid Lebrun 	/* lookup last seg in table */
61d1df6fd8SDavid Lebrun 	SEG6_LOCAL_ACTION_END_S		= 12,
62d1df6fd8SDavid Lebrun 	/* forward to SR-unaware VNF with static proxy */
63d1df6fd8SDavid Lebrun 	SEG6_LOCAL_ACTION_END_AS	= 13,
64d1df6fd8SDavid Lebrun 	/* forward to SR-unaware VNF with masquerading */
65d1df6fd8SDavid Lebrun 	SEG6_LOCAL_ACTION_END_AM	= 14,
66004d4b27SMathieu Xhonneux 	/* custom BPF action */
67004d4b27SMathieu Xhonneux 	SEG6_LOCAL_ACTION_END_BPF	= 15,
688b532109SAndrea Mayer 	/* decap and lookup of DA in v4 or v6 table */
698b532109SAndrea Mayer 	SEG6_LOCAL_ACTION_END_DT46	= 16,
70d1df6fd8SDavid Lebrun 
71d1df6fd8SDavid Lebrun 	__SEG6_LOCAL_ACTION_MAX,
72d1df6fd8SDavid Lebrun };
73d1df6fd8SDavid Lebrun 
74d1df6fd8SDavid Lebrun #define SEG6_LOCAL_ACTION_MAX (__SEG6_LOCAL_ACTION_MAX - 1)
75d1df6fd8SDavid Lebrun 
76004d4b27SMathieu Xhonneux enum {
77004d4b27SMathieu Xhonneux 	SEG6_LOCAL_BPF_PROG_UNSPEC,
78004d4b27SMathieu Xhonneux 	SEG6_LOCAL_BPF_PROG,
79004d4b27SMathieu Xhonneux 	SEG6_LOCAL_BPF_PROG_NAME,
80004d4b27SMathieu Xhonneux 	__SEG6_LOCAL_BPF_PROG_MAX,
81004d4b27SMathieu Xhonneux };
82004d4b27SMathieu Xhonneux 
83004d4b27SMathieu Xhonneux #define SEG6_LOCAL_BPF_PROG_MAX (__SEG6_LOCAL_BPF_PROG_MAX - 1)
84004d4b27SMathieu Xhonneux 
8594604548SAndrea Mayer /* SRv6 Behavior counters are encoded as netlink attributes guaranteeing the
8694604548SAndrea Mayer  * correct alignment.
8794604548SAndrea Mayer  * Each counter is identified by a different attribute type (i.e.
8894604548SAndrea Mayer  * SEG6_LOCAL_CNT_PACKETS).
8994604548SAndrea Mayer  *
9094604548SAndrea Mayer  * - SEG6_LOCAL_CNT_PACKETS: identifies a counter that counts the number of
9194604548SAndrea Mayer  *   packets that have been CORRECTLY processed by an SRv6 Behavior instance
9294604548SAndrea Mayer  *   (i.e., packets that generate errors or are dropped are NOT counted).
9394604548SAndrea Mayer  *
9494604548SAndrea Mayer  * - SEG6_LOCAL_CNT_BYTES: identifies a counter that counts the total amount
9594604548SAndrea Mayer  *   of traffic in bytes of all packets that have been CORRECTLY processed by
9694604548SAndrea Mayer  *   an SRv6 Behavior instance (i.e., packets that generate errors or are
9794604548SAndrea Mayer  *   dropped are NOT counted).
9894604548SAndrea Mayer  *
9994604548SAndrea Mayer  * - SEG6_LOCAL_CNT_ERRORS: identifies a counter that counts the number of
10094604548SAndrea Mayer  *   packets that have NOT been properly processed by an SRv6 Behavior instance
10194604548SAndrea Mayer  *   (i.e., packets that generate errors or are dropped).
10294604548SAndrea Mayer  */
10394604548SAndrea Mayer enum {
10494604548SAndrea Mayer 	SEG6_LOCAL_CNT_UNSPEC,
10594604548SAndrea Mayer 	SEG6_LOCAL_CNT_PAD,		/* pad for 64 bits values */
10694604548SAndrea Mayer 	SEG6_LOCAL_CNT_PACKETS,
10794604548SAndrea Mayer 	SEG6_LOCAL_CNT_BYTES,
10894604548SAndrea Mayer 	SEG6_LOCAL_CNT_ERRORS,
10994604548SAndrea Mayer 	__SEG6_LOCAL_CNT_MAX,
11094604548SAndrea Mayer };
11194604548SAndrea Mayer 
11294604548SAndrea Mayer #define SEG6_LOCAL_CNT_MAX (__SEG6_LOCAL_CNT_MAX - 1)
11394604548SAndrea Mayer 
114*848f3c0dSAndrea Mayer /* SRv6 End* Flavor attributes */
115*848f3c0dSAndrea Mayer enum {
116*848f3c0dSAndrea Mayer 	SEG6_LOCAL_FLV_UNSPEC,
117*848f3c0dSAndrea Mayer 	SEG6_LOCAL_FLV_OPERATION,
118*848f3c0dSAndrea Mayer 	SEG6_LOCAL_FLV_LCBLOCK_BITS,
119*848f3c0dSAndrea Mayer 	SEG6_LOCAL_FLV_LCNODE_FN_BITS,
120*848f3c0dSAndrea Mayer 	__SEG6_LOCAL_FLV_MAX,
121*848f3c0dSAndrea Mayer };
122*848f3c0dSAndrea Mayer 
123*848f3c0dSAndrea Mayer #define SEG6_LOCAL_FLV_MAX (__SEG6_LOCAL_FLV_MAX - 1)
124*848f3c0dSAndrea Mayer 
125*848f3c0dSAndrea Mayer /* Designed flavor operations for SRv6 End* Behavior */
126*848f3c0dSAndrea Mayer enum {
127*848f3c0dSAndrea Mayer 	SEG6_LOCAL_FLV_OP_UNSPEC,
128*848f3c0dSAndrea Mayer 	SEG6_LOCAL_FLV_OP_PSP,
129*848f3c0dSAndrea Mayer 	SEG6_LOCAL_FLV_OP_USP,
130*848f3c0dSAndrea Mayer 	SEG6_LOCAL_FLV_OP_USD,
131*848f3c0dSAndrea Mayer 	SEG6_LOCAL_FLV_OP_NEXT_CSID,
132*848f3c0dSAndrea Mayer 	__SEG6_LOCAL_FLV_OP_MAX
133*848f3c0dSAndrea Mayer };
134*848f3c0dSAndrea Mayer 
135*848f3c0dSAndrea Mayer #define SEG6_LOCAL_FLV_OP_MAX (__SEG6_LOCAL_FLV_OP_MAX - 1)
136*848f3c0dSAndrea Mayer 
137d1df6fd8SDavid Lebrun #endif
138