Print this page
Version bump SVP to 2
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/lib/varpd/svp/common/libvarpd_svp_prot.h
+++ new/usr/src/lib/varpd/svp/common/libvarpd_svp_prot.h
1 1 /*
2 2 * This file and its contents are supplied under the terms of the
3 3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 4 * You may only use this file in accordance with the terms of version
5 5 * 1.0 of the CDDL.
6 6 *
7 7 * A full copy of the text of the CDDL should have accompanied this
8 8 * source. A copy of the CDDL is also available via the Internet at
9 9 * http://www.illumos.org/license/CDDL.
10 10 */
11 11
12 12 /*
13 13 * Copyright 2018 Joyent, Inc.
14 14 */
15 15
16 16 #ifndef _LIBVARPD_SVP_PROT_H
17 17 #define _LIBVARPD_SVP_PROT_H
18 18
19 19 /*
20 20 * SVP protocol Definitions
21 21 */
22 22
23 23 #include <sys/types.h>
24 24 #include <inttypes.h>
25 25 #include <sys/ethernet.h>
26 26 #include <netinet/in.h>
27 27
|
↓ open down ↓ |
27 lines elided |
↑ open up ↑ |
28 28 #ifdef __cplusplus
29 29 extern "C" {
30 30 #endif
31 31
32 32 /*
33 33 * SDC VXLAN Protocol Definitions
34 34 */
35 35
36 36 #define SVP_VERSION_ONE 1
37 37 #define SVP_VERSION_TWO 2
38 -/* XXX KEBE SAYS -- we are not yet ready to bump this. */
39 -#define SVP_CURRENT_VERSION SVP_VERSION_ONE
38 +/*
39 + * Bump this to 2. Version 1 SVP is a subset of version 2, and can be
40 + * determined using an SVP_R_PING as part of connection establishment.
41 + * Version-2 specific changes will be highlighed (look for "v2").
42 + */
43 +#define SVP_CURRENT_VERSION SVP_VERSION_TWO
40 44
41 45 typedef struct svp_req {
42 46 uint16_t svp_ver;
43 47 uint16_t svp_op;
44 48 uint32_t svp_size;
45 49 uint32_t svp_id;
46 50 uint32_t svp_crc32;
47 51 } svp_req_t;
48 52
53 +/*
54 + * Unless specified, all message types function identically between v1 and v2
55 + * of SVP.
56 + */
49 57 typedef enum svp_op {
50 58 SVP_R_UNKNOWN = 0x00,
51 59 SVP_R_PING = 0x01,
52 60 SVP_R_PONG = 0x02,
53 61 SVP_R_VL2_REQ = 0x03,
54 62 SVP_R_VL2_ACK = 0x04,
55 63 SVP_R_VL3_REQ = 0x05,
56 64 SVP_R_VL3_ACK = 0x06,
57 65 SVP_R_BULK_REQ = 0x07,
58 66 SVP_R_BULK_ACK = 0x08,
59 67 SVP_R_LOG_REQ = 0x09,
60 68 SVP_R_LOG_ACK = 0x0A,
61 - SVP_R_LOG_RM = 0x0B,
62 - SVP_R_LOG_RM_ACK = 0x0C,
69 + SVP_R_LOG_RM = 0x0B, /* v2 introduces new log type */
70 + SVP_R_LOG_RM_ACK = 0x0C, /* See svp_log_route_t */
63 71 SVP_R_SHOOTDOWN = 0x0D,
64 - SVP_R_ROUTE_REQ = 0x0E,
65 - SVP_R_ROUTE_ACK = 0x0F
72 + SVP_R_ROUTE_REQ = 0x0E, /* v2 only */
73 + SVP_R_ROUTE_ACK = 0x0F /* v2 only */
66 74 } svp_op_t;
67 75
68 76 typedef enum svp_status {
69 77 SVP_S_OK = 0x00, /* Everything OK */
70 78 SVP_S_FATAL = 0x01, /* Fatal error, close connection */
71 79 SVP_S_NOTFOUND = 0x02, /* Entry not found */
72 80 SVP_S_BADL3TYPE = 0x03, /* Unknown svp_vl3_type_t */
73 81 SVP_S_BADBULK = 0x04 /* Unknown svp_bulk_type_t */
74 82 } svp_status_t;
75 83
76 84 /*
77 85 * A client issues the SVP_R_VL2_REQ whenever it needs to perform a VL2->UL3
78 86 * lookup. Requests have the following structure:
79 87 */
80 88 typedef struct svp_vl2_req {
81 89 uint8_t sl2r_mac[ETHERADDRL];
82 90 uint8_t sl2r_pad[2];
83 91 uint32_t sl2r_vnetid;
84 92 } svp_vl2_req_t;
85 93
86 94 /*
87 95 * This is the message a server uses to reply to the SVP_R_VL2_REQ. If the
88 96 * destination on the underlay is an IPv4 address, it should be encoded as an
89 97 * IPv4-mapped IPv6 address.
90 98 */
91 99 typedef struct svp_vl2_ack {
92 100 uint16_t sl2a_status;
93 101 uint16_t sl2a_port;
94 102 uint8_t sl2a_addr[16];
95 103 } svp_vl2_ack_t;
96 104
97 105
98 106 /*
99 107 * A client issues the SVP_R_VL3_REQ request whenever it needs to perform a
100 108 * VL3->VL2 lookup. Note, that this also implicitly performs a VL2->UL3 lookup
101 109 * as well. The sl3r_type member is used to indicate the kind of lookup type
102 110 * that we're performing, eg. is it a L3 or L2.
103 111 */
104 112 typedef enum svp_vl3_type {
105 113 SVP_VL3_IP = 0x01,
106 114 SVP_VL3_IPV6 = 0x02
107 115 } svp_vl3_type_t;
108 116
109 117 typedef struct svp_vl3_req {
110 118 uint8_t sl3r_ip[16];
111 119 uint32_t sl3r_type;
112 120 uint32_t sl3r_vnetid;
113 121 } svp_vl3_req_t;
114 122
115 123 /*
116 124 * This response, corresponding to the SVP_R_VL3_ACK, includes an answer to both
117 125 * the VL3->VL2 and the VL2->UL3 requests.
118 126 */
119 127 typedef struct svp_vl3_ack {
120 128 uint32_t sl3a_status;
121 129 uint8_t sl3a_mac[ETHERADDRL];
122 130 uint16_t sl3a_uport;
123 131 uint8_t sl3a_uip[16];
124 132 } svp_vl3_ack_t;
125 133
126 134 /*
127 135 * SVP_R_BULK_REQ requests a bulk dump of data. Currently we have two kinds of
128 136 * data tables that we need to dump: VL3->VL2 mappings and VL2->UL3 mappings.
129 137 * The kind that we want is indicated using the svbr_type member.
130 138 */
131 139 typedef enum svp_bulk_type {
132 140 SVP_BULK_VL2 = 0x01,
133 141 SVP_BULK_VL3 = 0x02
134 142 } svp_bulk_type_t;
135 143
136 144 typedef struct svp_bulk_req {
137 145 uint32_t svbr_type;
138 146 } svp_bulk_req_t;
139 147
140 148 /*
141 149 * When replying to a bulk request (SVP_R_BULK_ACK), data is streamed back
142 150 * across. The format of the data is currently undefined and as we work on the
143 151 * system, we'll get a better understanding of what this should look like. A
144 152 * client may need to stream such a request to disk, or the format will need to
145 153 * be in a streamable format that allows the client to construct data.
146 154 */
147 155 typedef struct svp_bulk_ack {
148 156 uint32_t svba_status;
149 157 uint32_t svba_type;
150 158 uint8_t svba_data[];
151 159 } svp_bulk_ack_t;
152 160
153 161 /*
154 162 * SVP_R_LOG_REQ requests a log entries from the specified log from the server.
155 163 * The total number of bytes that the user is ready to receive is in svlr_count.
156 164 * However, the server should not block for data if none is available and thus
157 165 * may return less than svlr_count bytes back. We identify the IP address of the
158 166 * underlay to use here explicitly.
159 167 */
160 168 typedef struct svp_log_req {
161 169 uint32_t svlr_count;
162 170 uint8_t svlr_ip[16];
163 171 } svp_log_req_t;
164 172
165 173 /*
166 174 * The server replies to a log request by sending a series of log entries.
|
↓ open down ↓ |
91 lines elided |
↑ open up ↑ |
167 175 * These log entries may be a mixture of both vl2 and vl3 records. The reply is
168 176 * a stream of bytes after the status message whose length is determined baseed
169 177 * on the header itself. Each entry begins with a uint32_t that describes its
170 178 * type and then is followed by the remaining data payload. The next entry
171 179 * follows immediately which again begins with the uint32_t word that describes
172 180 * what it should be.
173 181 */
174 182 typedef enum svp_log_type {
175 183 SVP_LOG_VL2 = 0x01,
176 184 SVP_LOG_VL3 = 0x02,
177 - SVP_LOG_ROUTE = 0x03
185 + SVP_LOG_ROUTE = 0x03 /* v2 only */
178 186 } svp_log_type_t;
179 187
180 188 typedef struct svp_log_vl2 {
181 189 uint32_t svl2_type; /* Should be SVP_LOG_VL2 */
182 190 uint8_t svl2_id[16]; /* 16-byte UUID */
183 191 uint8_t svl2_mac[ETHERADDRL];
184 192 uint8_t svl2_pad[2];
185 193 uint32_t svl2_vnetid;
186 194 } svp_log_vl2_t;
187 195
188 196 typedef struct svp_log_vl3 {
189 197 uint32_t svl3_type; /* Should be SVP_LOG_VL3 */
190 198 uint8_t svl3_id[16]; /* 16-byte UUID */
191 199 uint8_t svl3_ip[16];
192 200 uint8_t svl3_pad[2];
193 201 uint16_t svl3_vlan;
194 202 uint32_t svl3_vnetid;
195 203 } svp_log_vl3_t;
196 204
205 +/*
206 + * This log entry only appears on v2 connections.
207 + */
197 208 typedef struct svp_log_route {
198 209 uint32_t svlr_type; /* Should be SVP_LOG_ROUTE */
199 210 uint8_t svlr_id[16]; /* 16-byte UUID */
200 211 uint32_t svlr_src_vnetid; /* Source VXLAN vnetid. */
201 212 uint32_t svlr_dst_vnetid; /* Dest. VXLAN vnetid. */
202 213 uint32_t svlr_dcid; /* Remote/dest Data Center ID. */
203 214 uint8_t svlr_srcip[16]; /* Source IP address base. */
204 215 uint8_t svlr_dstip[16]; /* Destination IP address base. */
205 216 uint16_t svlr_dst_vlan; /* Source VLAN id. */
206 217 uint16_t svlr_src_vlan; /* Destination VLAN id. */
207 218 uint8_t svlr_src_prefixlen; /* Source IP prefix length. */
208 219 uint8_t svlr_dst_prefixlen; /* Dest. IP prefix length. */
209 220 uint16_t svlr_pad; /* So we can be aligned... */
210 221 } svp_log_route_t;
211 222
212 223 typedef struct svp_log_ack {
213 224 uint32_t svla_status;
214 225 uint8_t svla_data[];
215 226 } svp_log_ack_t;
216 227
217 228 /*
218 229 * SVP_R_LOG_RM is used after the client successfully processes a series of the
219 230 * log stream. It replies to tell the server that it can remove those IDs from
220 231 * processing. The IDs used are the same IDs that were in the individual
221 232 * SVP_R_LOG_ACK entries.
222 233 */
223 234 typedef struct svp_lrm_req {
224 235 uint32_t svrr_count;
225 236 uint8_t svrr_ids[];
226 237 } svp_lrm_req_t;
227 238
228 239 /*
229 240 * SVP_R_LOG_RM_ACK is used to indicate that a log entry has been successfully
230 241 * deleted and at this point it makes sense to go and ask for another
231 242 * SVP_R_LOG_REQ.
232 243 */
233 244 typedef struct svp_lrm_ack {
234 245 uint32_t svra_status;
235 246 } svp_lrm_ack_t;
236 247
237 248 /*
238 249 * A shootdown (SVP_R_SHOOTDOWN) is used by a CN to reply to another CN that it
239 250 * sent an invalid entry that could not be processed. This should be a
240 251 * relatively infrequent occurrence. Unlike the rest of the messages, there is
241 252 * no reply to it. It's a single request to try and help get us out there. When
242 253 * a node receives this, it will issue a conditional revocation ioctl, that
243 254 * removes the entry if and only if, it matches the IP. That way if we've
244 255 * already gotten an updated entry for this, we don't remove it again.
245 256 */
246 257 typedef struct svp_shootdown {
247 258 uint8_t svsd_mac[ETHERADDRL];
|
↓ open down ↓ |
41 lines elided |
↑ open up ↑ |
248 259 uint8_t svsd_pad[2];
249 260 uint32_t svsd_vnetid;
250 261 } svp_shootdown_t;
251 262
252 263 /*
253 264 * A route-request (SVP_R_ROUTE_REQ) queries the local SVP server to get a
254 265 * far-remote (i.e. another Triton Data Center, nee. SDC) SVP server for
255 266 * far-remote networks. Modern overlay modules will request IP destinations
256 267 * for remote-Triton networks, but they must know how to reach the
257 268 * remote-Triton SVP server.
269 + *
270 + * NOTE: SVP_R_ROUTE_{REQ,ACK} are only present in SVP v2.
258 271 */
259 272 typedef struct svp_route_req {
260 273 uint32_t srr_vnetid; /* Requester's vnet ID. */
261 274 uint16_t srr_vlan; /* Requester's VLAN ID. */
262 275 uint16_t srr_pad; /* Zero on xmit, ignore on receipt. */
263 276 uint8_t srr_srcip[16]; /* VL3 Source IP. */
264 277 uint8_t srr_dstip[16]; /* VL3 Destination IP. */
265 278 } svp_route_req_t;
266 279
267 280 /*
268 281 * The far-remote Triton Data Center will answer with the requisite information
269 282 * to send overlay packets to the appropriate far-remote CNs.
270 283 */
271 284 typedef struct svp_route_ack {
272 285 uint32_t sra_status; /* Status. */
273 286 uint32_t sra_dcid; /* Far-remote Data Center ID. */
274 287 uint32_t sra_vnetid; /* Far-remote vnet ID. */
275 288 uint16_t sra_vlan; /* Far-remote VLAN ID. */
276 289 uint16_t sra_port; /* Destination UL3 port. */
277 290 uint8_t sra_ip[16]; /* Destination UL3 address. */
278 291 uint8_t sra_srcmac[ETHERADDRL]; /* Far-remote VL2 source. */
279 292 uint8_t sra_dstmac[ETHERADDRL]; /* Far-remote VL2 dest. */
280 293 uint8_t sra_src_pfx; /* Far-remote VL3 source prefix */
281 294 uint8_t sra_dst_pfx; /* Far-remote VL3 dest. prefix */
282 295 } svp_route_ack_t;
283 296
284 297 #ifdef __cplusplus
285 298 }
286 299 #endif
287 300
288 301 #endif /* _LIBVARPD_SVP_PROT_H */
|
↓ open down ↓ |
21 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX