Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause
2 : : * Copyright(C) 2022 Marvell.
3 : : */
4 : :
5 : : #ifndef __ROC_IE_OT_H__
6 : : #define __ROC_IE_OT_H__
7 : :
8 : : #include "roc_platform.h"
9 : :
10 : : /* CN10K IPSEC opcodes */
11 : : #define ROC_IE_OT_MAJOR_OP_PROCESS_OUTBOUND_IPSEC 0x28UL
12 : : #define ROC_IE_OT_MAJOR_OP_PROCESS_INBOUND_IPSEC 0x29UL
13 : :
14 : : #define ROC_IE_OT_MAJOR_OP_WRITE_SA 0x01UL
15 : : #define ROC_IE_OT_MINOR_OP_WRITE_SA 0x09UL
16 : :
17 : : #define ROC_IE_OT_CTX_ILEN 2
18 : : /* PKIND to be used for CPT Meta parsing */
19 : : #define ROC_IE_OT_CPT_PKIND 58
20 : : #define ROC_IE_OT_CPT_TS_PKIND 54
21 : : #define ROC_IE_OT_SA_CTX_HDR_SIZE 1
22 : :
23 : : #define ROC_IE_OT_INPLACE_BIT BIT(6)
24 : :
25 : : enum roc_ie_ot_ucc_ipsec {
26 : : ROC_IE_OT_UCC_SUCCESS = 0x00,
27 : : ROC_IE_OT_UCC_ERR_SA_INVAL = 0xb0,
28 : : ROC_IE_OT_UCC_ERR_SA_EXPIRED = 0xb1,
29 : : ROC_IE_OT_UCC_ERR_SA_OVERFLOW = 0xb2,
30 : : ROC_IE_OT_UCC_ERR_SA_ESP_BAD_ALGO = 0xb3,
31 : : ROC_IE_OT_UCC_ERR_SA_AH_BAD_ALGO = 0xb4,
32 : : ROC_IE_OT_UCC_ERR_SA_BAD_CTX = 0xb5,
33 : : ROC_IE_OT_UCC_SA_CTX_FLAG_MISMATCH = 0xb6,
34 : : ROC_IE_OT_UCC_ERR_AOP_IPSEC = 0xb7,
35 : : ROC_IE_OT_UCC_ERR_PKT_IP = 0xb8,
36 : : ROC_IE_OT_UCC_ERR_PKT_IP6_BAD_EXT = 0xb9,
37 : : ROC_IE_OT_UCC_ERR_PKT_IP6_HBH = 0xba,
38 : : ROC_IE_OT_UCC_ERR_PKT_IP6_BIGEXT = 0xbb,
39 : : ROC_IE_OT_UCC_ERR_PKT_IP_ULP = 0xbc,
40 : : ROC_IE_OT_UCC_ERR_PKT_SA_MISMATCH = 0xbd,
41 : : ROC_IE_OT_UCC_ERR_PKT_SPI_MISMATCH = 0xbe,
42 : : ROC_IE_OT_UCC_ERR_PKT_ESP_BADPAD = 0xbf,
43 : : ROC_IE_OT_UCC_ERR_PKT_BADICV = 0xc0,
44 : : ROC_IE_OT_UCC_ERR_PKT_REPLAY_SEQ = 0xc1,
45 : : ROC_IE_OT_UCC_ERR_PKT_BADNH = 0xc2,
46 : : ROC_IE_OT_UCC_ERR_PKT_SA_PORT_MISMATCH = 0xc3,
47 : : ROC_IE_OT_UCC_ERR_PKT_BAD_DLEN = 0xc4,
48 : : ROC_IE_OT_UCC_ERR_SA_ESP_BAD_KEYS = 0xc5,
49 : : ROC_IE_OT_UCC_ERR_SA_AH_BAD_KEYS = 0xc6,
50 : : ROC_IE_OT_UCC_ERR_SA_BAD_IP = 0xc7,
51 : : ROC_IE_OT_UCC_ERR_PKT_IP_FRAG = 0xc8,
52 : : ROC_IE_OT_UCC_ERR_PKT_REPLAY_WINDOW = 0xc9,
53 : : ROC_IE_OT_UCC_SUCCESS_PKT_IP_BADCSUM = 0xed,
54 : : ROC_IE_OT_UCC_SUCCESS_PKT_L4_GOODCSUM = 0xee,
55 : : ROC_IE_OT_UCC_SUCCESS_PKT_L4_BADCSUM = 0xef,
56 : : ROC_IE_OT_UCC_SUCCESS_SA_SOFTEXP_FIRST = 0xf0,
57 : : ROC_IE_OT_UCC_SUCCESS_PKT_UDPESP_NZCSUM = 0xf1,
58 : : ROC_IE_OT_UCC_SUCCESS_SA_SOFTEXP_AGAIN = 0xf2,
59 : : ROC_IE_OT_UCC_SUCCESS_PKT_UDP_ZEROCSUM = 0xf3,
60 : : ROC_IE_OT_UCC_SUCCESS_PKT_IP_GOODCSUM = 0x0,
61 : : };
62 : :
63 : : enum {
64 : : ROC_IE_OT_SA_AR_WIN_DISABLED = 0,
65 : : ROC_IE_OT_SA_AR_WIN_64 = 1,
66 : : ROC_IE_OT_SA_AR_WIN_128 = 2,
67 : : ROC_IE_OT_SA_AR_WIN_256 = 3,
68 : : ROC_IE_OT_SA_AR_WIN_512 = 4,
69 : : ROC_IE_OT_SA_AR_WIN_1024 = 5,
70 : : ROC_IE_OT_SA_AR_WIN_2048 = 6,
71 : : ROC_IE_OT_SA_AR_WIN_4096 = 7,
72 : : };
73 : :
74 : : enum {
75 : : ROC_IE_OT_SA_PKT_FMT_FULL = 0,
76 : : ROC_IE_OT_SA_PKT_FMT_META = 1,
77 : : };
78 : :
79 : : enum {
80 : : ROC_IE_OT_SA_PKT_OUTPUT_DECRYPTED = 0,
81 : : ROC_IE_OT_SA_PKT_OUTPUT_NO_FRAG = 1,
82 : : ROC_IE_OT_SA_PKT_OUTPUT_HW_BASED_DEFRAG = 2,
83 : : ROC_IE_OT_SA_PKT_OUTPUT_UCODE_BASED_DEFRAG = 3,
84 : : };
85 : :
86 : : enum {
87 : : ROC_IE_OT_SA_DEFRAG_ALL = 0,
88 : : ROC_IE_OT_SA_DEFRAG_IN_ORDER = 1,
89 : : ROC_IE_OT_SA_DEFRAG_IN_REV_ORDER = 2,
90 : : };
91 : :
92 : : enum {
93 : : ROC_IE_OT_SA_IV_SRC_DEFAULT = 0,
94 : : ROC_IE_OT_SA_IV_SRC_ENC_CTR = 1,
95 : : ROC_IE_OT_SA_IV_SRC_FROM_SA = 2,
96 : : };
97 : :
98 : : enum {
99 : : ROC_IE_OT_SA_COPY_FROM_SA = 0,
100 : : ROC_IE_OT_SA_COPY_FROM_INNER_IP_HDR = 1,
101 : : };
102 : :
103 : : enum {
104 : : ROC_IE_OT_SA_INNER_PKT_IP_CSUM_ENABLE = 0,
105 : : ROC_IE_OT_SA_INNER_PKT_IP_CSUM_DISABLE = 1,
106 : : };
107 : :
108 : : enum {
109 : : ROC_IE_OT_SA_INNER_PKT_L4_CSUM_ENABLE = 0,
110 : : ROC_IE_OT_SA_INNER_PKT_L4_CSUM_DISABLE = 1,
111 : : };
112 : :
113 : : enum {
114 : : ROC_IE_OT_SA_ENC_NULL = 0,
115 : : ROC_IE_OT_SA_ENC_3DES_CBC = 2,
116 : : ROC_IE_OT_SA_ENC_AES_CBC = 3,
117 : : ROC_IE_OT_SA_ENC_AES_CTR = 4,
118 : : ROC_IE_OT_SA_ENC_AES_GCM = 5,
119 : : ROC_IE_OT_SA_ENC_AES_CCM = 6,
120 : : };
121 : :
122 : : enum {
123 : : ROC_IE_OT_SA_AUTH_NULL = 0,
124 : : ROC_IE_OT_SA_AUTH_SHA1 = 2,
125 : : ROC_IE_OT_SA_AUTH_SHA2_256 = 4,
126 : : ROC_IE_OT_SA_AUTH_SHA2_384 = 5,
127 : : ROC_IE_OT_SA_AUTH_SHA2_512 = 6,
128 : : ROC_IE_OT_SA_AUTH_AES_GMAC = 7,
129 : : ROC_IE_OT_SA_AUTH_AES_XCBC_128 = 8,
130 : : };
131 : :
132 : : enum {
133 : : ROC_IE_OT_SA_ENCAP_NONE = 0,
134 : : ROC_IE_OT_SA_ENCAP_UDP = 1,
135 : : ROC_IE_OT_SA_ENCAP_TCP = 2,
136 : : };
137 : :
138 : : enum {
139 : : ROC_IE_OT_SA_LIFE_UNIT_OCTETS = 0,
140 : : ROC_IE_OT_SA_LIFE_UNIT_PKTS = 1,
141 : : };
142 : :
143 : : enum {
144 : : ROC_IE_OT_SA_IP_HDR_VERIFY_DISABLED = 0,
145 : : ROC_IE_OT_SA_IP_HDR_VERIFY_DST_ADDR = 1,
146 : : ROC_IE_OT_SA_IP_HDR_VERIFY_SRC_DST_ADDR = 2,
147 : : };
148 : :
149 : : enum {
150 : : ROC_IE_OT_REAS_STS_SUCCESS = 0,
151 : : ROC_IE_OT_REAS_STS_TIMEOUT = 1,
152 : : ROC_IE_OT_REAS_STS_EVICT = 2,
153 : : ROC_IE_OT_REAS_STS_BAD_ORDER = 3,
154 : : ROC_IE_OT_REAS_STS_TOO_MANY = 4,
155 : : ROC_IE_OT_REAS_STS_HSH_EVICT = 5,
156 : : ROC_IE_OT_REAS_STS_OVERLAP = 6,
157 : : ROC_IE_OT_REAS_STS_ZOMBIE = 7,
158 : : ROC_IE_OT_REAS_STS_L3P_ERR = 8,
159 : : ROC_IE_OT_REAS_STS_MAX = 9
160 : : };
161 : :
162 : : enum {
163 : : ROC_IE_OT_ERR_CTL_MODE_NONE = 0,
164 : : ROC_IE_OT_ERR_CTL_MODE_CLEAR = 1,
165 : : ROC_IE_OT_ERR_CTL_MODE_RING = 2,
166 : : };
167 : :
168 : : static __plt_always_inline bool
169 : : roc_ie_ot_ucc_is_success(uint8_t ucc)
170 : : {
171 : : uint8_t uc_base = (uint8_t)ROC_IE_OT_UCC_SUCCESS_PKT_IP_BADCSUM - 1u;
172 : :
173 [ # # # # : 0 : ucc--;
# # # # #
# # # ]
174 : : return (ucc >= uc_base);
175 : : }
176 : :
177 : : /* Context units in bytes */
178 : : #define ROC_CTX_UNIT_8B 8
179 : : #define ROC_CTX_UNIT_128B 128
180 : : #define ROC_CTX_MAX_CKEY_LEN 32
181 : : #define ROC_CTX_MAX_OPAD_IPAD_LEN 128
182 : :
183 : : /* Anti reply window size supported */
184 : : #define ROC_AR_WIN_SIZE_MIN 64
185 : : #define ROC_AR_WIN_SIZE_MAX 4096
186 : : #define ROC_LOG_MIN_AR_WIN_SIZE_M1 5
187 : :
188 : : /* u64 array size to fit anti replay window bits */
189 : : #define ROC_AR_WINBITS_SZ \
190 : : (PLT_ALIGN_CEIL(ROC_AR_WIN_SIZE_MAX, BITS_PER_LONG_LONG) / \
191 : : BITS_PER_LONG_LONG)
192 : :
193 : : #define ROC_IPSEC_ERR_RING_MAX_ENTRY 65536
194 : :
195 : : union roc_ot_ipsec_err_ring_head {
196 : : uint64_t u64;
197 : : struct {
198 : : uint16_t tail_pos;
199 : : uint16_t tail_gen;
200 : : uint16_t head_pos;
201 : : uint16_t head_gen;
202 : : } s;
203 : : };
204 : :
205 : : union roc_ot_ipsec_err_ring_entry {
206 : : uint64_t u64;
207 : : struct {
208 : : uint64_t data0 : 44;
209 : : uint64_t data1 : 9;
210 : : uint64_t rsvd : 3;
211 : : uint64_t comp_code : 8;
212 : : } s;
213 : : };
214 : :
215 : : /* Common bit fields between inbound and outbound SA */
216 : : union roc_ot_ipsec_sa_word2 {
217 : : struct {
218 : : uint64_t valid : 1;
219 : : uint64_t dir : 1;
220 : : uint64_t outer_ip_ver : 1;
221 : : uint64_t rsvd0 : 1;
222 : : uint64_t mode : 1;
223 : : uint64_t protocol : 1;
224 : : uint64_t aes_key_len : 2;
225 : :
226 : : uint64_t enc_type : 3;
227 : : uint64_t life_unit : 1;
228 : : uint64_t auth_type : 4;
229 : :
230 : : uint64_t encap_type : 2;
231 : : uint64_t et_ovrwr_ddr_en : 1;
232 : : uint64_t esn_en : 1;
233 : : uint64_t tport_l4_incr_csum : 1;
234 : : uint64_t ip_hdr_verify : 2;
235 : : uint64_t udp_ports_verify : 1;
236 : :
237 : : uint64_t rsvd2 : 7;
238 : : uint64_t async_mode : 1;
239 : :
240 : : uint64_t spi : 32;
241 : : } s;
242 : : uint64_t u64;
243 : : };
244 : :
245 : : PLT_STATIC_ASSERT(sizeof(union roc_ot_ipsec_sa_word2) == 1 * sizeof(uint64_t));
246 : :
247 : : union roc_ot_ipsec_outer_ip_hdr {
248 : : struct {
249 : : uint32_t dst_addr;
250 : : uint32_t src_addr;
251 : : } ipv4;
252 : : struct {
253 : : uint8_t src_addr[16];
254 : : uint8_t dst_addr[16];
255 : : } ipv6;
256 : : };
257 : :
258 : : struct roc_ot_ipsec_inb_ctx_update_reg {
259 : : uint64_t ar_base;
260 : : uint64_t ar_valid_mask;
261 : : uint64_t hard_life;
262 : : uint64_t soft_life;
263 : : uint64_t mib_octs;
264 : : uint64_t mib_pkts;
265 : : uint64_t ar_winbits[ROC_AR_WINBITS_SZ];
266 : : };
267 : :
268 : : union roc_ot_ipsec_outb_iv {
269 : : uint64_t u64[2];
270 : : uint8_t iv_dbg[16];
271 : : struct {
272 : : uint8_t iv_dbg1[4];
273 : : uint8_t salt[4];
274 : :
275 : : uint32_t rsvd;
276 : : uint8_t iv_dbg2[4];
277 : : } s;
278 : : };
279 : :
280 : : struct roc_ot_ipsec_outb_ctx_update_reg {
281 : : union {
282 : : struct {
283 : : uint64_t reserved_0_2 : 3;
284 : : uint64_t address : 57;
285 : : uint64_t mode : 4;
286 : : } s;
287 : : uint64_t u64;
288 : : } err_ctl;
289 : :
290 : : uint64_t esn_val;
291 : : uint64_t hard_life;
292 : : uint64_t soft_life;
293 : : uint64_t mib_octs;
294 : : uint64_t mib_pkts;
295 : : };
296 : :
297 : : union roc_ot_ipsec_outb_param1 {
298 : : uint16_t u16;
299 : : struct {
300 : : uint16_t l4_csum_disable : 1;
301 : : uint16_t ip_csum_disable : 1;
302 : : uint16_t ttl_or_hop_limit : 1;
303 : : uint16_t dummy_pkt : 1;
304 : : uint16_t rfc_or_override_mode : 1;
305 : : uint16_t reserved_5_15 : 11;
306 : : } s;
307 : : };
308 : :
309 : : union roc_ot_ipsec_inb_param1 {
310 : : uint16_t u16;
311 : : struct {
312 : : uint16_t l4_csum_disable : 1;
313 : : uint16_t ip_csum_disable : 1;
314 : : uint16_t esp_trailer_disable : 1;
315 : : uint16_t reserved_3_15 : 13;
316 : : } s;
317 : : };
318 : :
319 : : struct roc_ot_ipsec_inb_sa {
320 : : /* Word0 */
321 : : union {
322 : : struct {
323 : : uint64_t ar_win : 3;
324 : : uint64_t hard_life_dec : 1;
325 : : uint64_t soft_life_dec : 1;
326 : : uint64_t count_glb_octets : 1;
327 : : uint64_t count_glb_pkts : 1;
328 : : uint64_t count_mib_bytes : 1;
329 : :
330 : : uint64_t count_mib_pkts : 1;
331 : : uint64_t hw_ctx_off : 7;
332 : :
333 : : uint64_t ctx_id : 16;
334 : :
335 : : uint64_t orig_pkt_fabs : 1;
336 : : uint64_t orig_pkt_free : 1;
337 : : uint64_t pkind : 6;
338 : :
339 : : uint64_t rsvd0 : 1;
340 : : uint64_t et_ovrwr : 1;
341 : : uint64_t pkt_output : 2;
342 : : uint64_t pkt_format : 1;
343 : : uint64_t defrag_opt : 2;
344 : : uint64_t x2p_dst : 1;
345 : :
346 : : uint64_t ctx_push_size : 7;
347 : : uint64_t rsvd1 : 1;
348 : :
349 : : uint64_t ctx_hdr_size : 2;
350 : : uint64_t aop_valid : 1;
351 : : uint64_t rsvd2 : 1;
352 : : uint64_t ctx_size : 4;
353 : : } s;
354 : : uint64_t u64;
355 : : } w0;
356 : :
357 : : /* Word1 */
358 : : union {
359 : : struct {
360 : : uint64_t orig_pkt_aura : 20;
361 : : uint64_t rsvd3 : 4;
362 : : uint64_t orig_pkt_foff : 8;
363 : : uint64_t cookie : 32;
364 : : } s;
365 : : uint64_t u64;
366 : : } w1;
367 : :
368 : : /* Word 2 */
369 : : union {
370 : : struct {
371 : : uint64_t valid : 1;
372 : : uint64_t dir : 1;
373 : : uint64_t outer_ip_ver : 1;
374 : : uint64_t rsvd4 : 1;
375 : : uint64_t ipsec_mode : 1;
376 : : uint64_t ipsec_protocol : 1;
377 : : uint64_t aes_key_len : 2;
378 : :
379 : : uint64_t enc_type : 3;
380 : : uint64_t life_unit : 1;
381 : : uint64_t auth_type : 4;
382 : :
383 : : uint64_t encap_type : 2;
384 : : uint64_t et_ovrwr_ddr_en : 1;
385 : : uint64_t esn_en : 1;
386 : : uint64_t tport_l4_incr_csum : 1;
387 : : uint64_t ip_hdr_verify : 2;
388 : : uint64_t udp_ports_verify : 1;
389 : :
390 : : uint64_t l3hdr_on_err : 1;
391 : : uint64_t rsvd6 : 6;
392 : : uint64_t async_mode : 1;
393 : :
394 : : uint64_t spi : 32;
395 : : } s;
396 : : uint64_t u64;
397 : : } w2;
398 : :
399 : : /* Word3 */
400 : : uint64_t rsvd7;
401 : :
402 : : /* Word4 - Word7 */
403 : : uint8_t cipher_key[ROC_CTX_MAX_CKEY_LEN];
404 : :
405 : : /* Word8 - Word9 */
406 : : union {
407 : : struct {
408 : : uint32_t rsvd8;
409 : : uint8_t salt[4];
410 : : } s;
411 : : uint64_t u64;
412 : : } w8;
413 : : uint64_t rsvd9;
414 : :
415 : : /* Word10 */
416 : : union {
417 : : struct {
418 : : uint64_t rsvd10 : 32;
419 : : uint64_t udp_src_port : 16;
420 : : uint64_t udp_dst_port : 16;
421 : : } s;
422 : : uint64_t u64;
423 : : } w10;
424 : :
425 : : /* Word11 - Word14 */
426 : : union roc_ot_ipsec_outer_ip_hdr outer_hdr;
427 : :
428 : : /* Word15 - Word30 */
429 : : uint8_t hmac_opad_ipad[ROC_CTX_MAX_OPAD_IPAD_LEN];
430 : :
431 : : /* Word31 - Word100 */
432 : : struct roc_ot_ipsec_inb_ctx_update_reg ctx;
433 : : };
434 : :
435 : : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_inb_sa, w1) ==
436 : : 1 * sizeof(uint64_t));
437 : : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_inb_sa, w2) ==
438 : : 2 * sizeof(uint64_t));
439 : : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_inb_sa, cipher_key) ==
440 : : 4 * sizeof(uint64_t));
441 : : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_inb_sa, w8) ==
442 : : 8 * sizeof(uint64_t));
443 : : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_inb_sa, w10) ==
444 : : 10 * sizeof(uint64_t));
445 : : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_inb_sa, outer_hdr) ==
446 : : 11 * sizeof(uint64_t));
447 : : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_inb_sa, hmac_opad_ipad) ==
448 : : 15 * sizeof(uint64_t));
449 : : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_inb_sa, ctx) ==
450 : : 31 * sizeof(uint64_t));
451 : :
452 : : struct roc_ot_ipsec_outb_sa {
453 : : /* Word0 */
454 : : union {
455 : : struct {
456 : : uint64_t esn_en : 1;
457 : : uint64_t ip_id : 1;
458 : : uint64_t rsvd0 : 1;
459 : : uint64_t hard_life_dec : 1;
460 : : uint64_t soft_life_dec : 1;
461 : : uint64_t count_glb_octets : 1;
462 : : uint64_t count_glb_pkts : 1;
463 : : uint64_t count_mib_bytes : 1;
464 : :
465 : : uint64_t count_mib_pkts : 1;
466 : : uint64_t hw_ctx_off : 7;
467 : :
468 : : uint64_t ctx_id : 16;
469 : : uint64_t rsvd1 : 16;
470 : :
471 : : uint64_t ctx_push_size : 7;
472 : : uint64_t rsvd2 : 1;
473 : :
474 : : uint64_t ctx_hdr_size : 2;
475 : : uint64_t aop_valid : 1;
476 : : uint64_t rsvd3 : 1;
477 : : uint64_t ctx_size : 4;
478 : : } s;
479 : : uint64_t u64;
480 : : } w0;
481 : :
482 : : /* Word1 */
483 : : union {
484 : : struct {
485 : : uint64_t rsvd4 : 32;
486 : : uint64_t cookie : 32;
487 : : } s;
488 : : uint64_t u64;
489 : : } w1;
490 : :
491 : : /* Word 2 */
492 : : union {
493 : : struct {
494 : : uint64_t valid : 1;
495 : : uint64_t dir : 1;
496 : : uint64_t outer_ip_ver : 1;
497 : : uint64_t rsvd5 : 1;
498 : : uint64_t ipsec_mode : 1;
499 : : uint64_t ipsec_protocol : 1;
500 : : uint64_t aes_key_len : 2;
501 : :
502 : : uint64_t enc_type : 3;
503 : : uint64_t life_unit : 1;
504 : : uint64_t auth_type : 4;
505 : :
506 : : uint64_t encap_type : 2;
507 : : uint64_t ipv4_df_src_or_ipv6_flw_lbl_src : 1;
508 : : uint64_t dscp_src : 1;
509 : : uint64_t iv_src : 2;
510 : : uint64_t ipid_gen : 1;
511 : : uint64_t rsvd6 : 1;
512 : :
513 : : uint64_t rsvd7 : 7;
514 : : uint64_t async_mode : 1;
515 : :
516 : : uint64_t spi : 32;
517 : : } s;
518 : : uint64_t u64;
519 : : } w2;
520 : :
521 : : /* Word3 */
522 : : uint64_t rsvd8;
523 : :
524 : : /* Word4 - Word7 */
525 : : uint8_t cipher_key[ROC_CTX_MAX_CKEY_LEN];
526 : :
527 : : /* Word8 - Word9 */
528 : : union roc_ot_ipsec_outb_iv iv;
529 : :
530 : : /* Word10 */
531 : : union {
532 : : struct {
533 : : uint64_t rsvd9 : 4;
534 : : uint64_t ipv4_df_or_ipv6_flw_lbl : 20;
535 : :
536 : : uint64_t dscp : 6;
537 : : uint64_t rsvd10 : 2;
538 : :
539 : : uint64_t udp_dst_port : 16;
540 : :
541 : : uint64_t udp_src_port : 16;
542 : : } s;
543 : : uint64_t u64;
544 : : } w10;
545 : :
546 : : /* Word11 - Word14 */
547 : : union roc_ot_ipsec_outer_ip_hdr outer_hdr;
548 : :
549 : : /* Word15 - Word30 */
550 : : uint8_t hmac_opad_ipad[ROC_CTX_MAX_OPAD_IPAD_LEN];
551 : :
552 : : /* Word31 - Word36 */
553 : : struct roc_ot_ipsec_outb_ctx_update_reg ctx;
554 : : };
555 : :
556 : : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_outb_sa, w1) ==
557 : : 1 * sizeof(uint64_t));
558 : : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_outb_sa, w2) ==
559 : : 2 * sizeof(uint64_t));
560 : : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_outb_sa, cipher_key) ==
561 : : 4 * sizeof(uint64_t));
562 : : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_outb_sa, iv) ==
563 : : 8 * sizeof(uint64_t));
564 : : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_outb_sa, w10) ==
565 : : 10 * sizeof(uint64_t));
566 : : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_outb_sa, outer_hdr) ==
567 : : 11 * sizeof(uint64_t));
568 : : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_outb_sa, hmac_opad_ipad) ==
569 : : 15 * sizeof(uint64_t));
570 : : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_outb_sa, ctx) ==
571 : : 31 * sizeof(uint64_t));
572 : :
573 : : #define ROC_OT_IPSEC_SA_SZ_MAX \
574 : : (PLT_MAX(sizeof(struct roc_ot_ipsec_inb_sa), sizeof(struct roc_ot_ipsec_outb_sa)))
575 : :
576 : : void __roc_api roc_ot_ipsec_inb_sa_init(struct roc_ot_ipsec_inb_sa *sa,
577 : : bool is_inline);
578 : : void __roc_api roc_ot_ipsec_outb_sa_init(struct roc_ot_ipsec_outb_sa *sa);
579 : : #endif /* __ROC_IE_OT_H__ */
|