Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause
2 : : * Copyright(C) 2021 Marvell.
3 : : */
4 : :
5 : : #include <rte_cryptodev.h>
6 : : #include <rte_eventdev.h>
7 : : #include <rte_security.h>
8 : : #include <rte_security_driver.h>
9 : : #include <rte_pmd_cnxk.h>
10 : :
11 : : #include <cn10k_ethdev.h>
12 : : #include <cn10k_rx.h>
13 : : #include <cnxk_ethdev_mcs.h>
14 : : #include <cnxk_security.h>
15 : : #include <roc_priv.h>
16 : :
17 : : PLT_STATIC_ASSERT(offsetof(struct rte_pmd_cnxk_ipsec_inb_sa, ctx.ar_winbits) ==
18 : : offsetof(struct roc_ot_ipsec_inb_sa, ctx.ar_winbits));
19 : :
20 : : PLT_STATIC_ASSERT(offsetof(struct rte_pmd_cnxk_ipsec_outb_sa, ctx.mib_pkts) ==
21 : : offsetof(struct roc_ot_ipsec_outb_sa, ctx.mib_pkts));
22 : :
23 : : PLT_STATIC_ASSERT(RTE_PMD_CNXK_CTX_MAX_CKEY_LEN == ROC_CTX_MAX_CKEY_LEN);
24 : : PLT_STATIC_ASSERT(RTE_PMD_CNXK_CTX_MAX_OPAD_IPAD_LEN == RTE_PMD_CNXK_CTX_MAX_OPAD_IPAD_LEN);
25 : :
26 : : PLT_STATIC_ASSERT(RTE_PMD_CNXK_AR_WIN_SIZE_MIN == ROC_AR_WIN_SIZE_MIN);
27 : : PLT_STATIC_ASSERT(RTE_PMD_CNXK_AR_WIN_SIZE_MAX == ROC_AR_WIN_SIZE_MAX);
28 : : PLT_STATIC_ASSERT(RTE_PMD_CNXK_LOG_MIN_AR_WIN_SIZE_M1 == ROC_LOG_MIN_AR_WIN_SIZE_M1);
29 : : PLT_STATIC_ASSERT(RTE_PMD_CNXK_AR_WINBITS_SZ == ROC_AR_WINBITS_SZ);
30 : :
31 : : static struct rte_cryptodev_capabilities cn10k_eth_sec_crypto_caps[] = {
32 : : { /* AES GCM */
33 : : .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
34 : : {.sym = {
35 : : .xform_type = RTE_CRYPTO_SYM_XFORM_AEAD,
36 : : {.aead = {
37 : : .algo = RTE_CRYPTO_AEAD_AES_GCM,
38 : : .block_size = 16,
39 : : .key_size = {
40 : : .min = 16,
41 : : .max = 32,
42 : : .increment = 8
43 : : },
44 : : .digest_size = {
45 : : .min = 16,
46 : : .max = 16,
47 : : .increment = 0
48 : : },
49 : : .aad_size = {
50 : : .min = 8,
51 : : .max = 12,
52 : : .increment = 4
53 : : },
54 : : .iv_size = {
55 : : .min = 12,
56 : : .max = 12,
57 : : .increment = 0
58 : : }
59 : : }, }
60 : : }, }
61 : : },
62 : : { /* AES CBC */
63 : : .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
64 : : {.sym = {
65 : : .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
66 : : {.cipher = {
67 : : .algo = RTE_CRYPTO_CIPHER_AES_CBC,
68 : : .block_size = 16,
69 : : .key_size = {
70 : : .min = 16,
71 : : .max = 32,
72 : : .increment = 8
73 : : },
74 : : .iv_size = {
75 : : .min = 16,
76 : : .max = 16,
77 : : .increment = 0
78 : : }
79 : : }, }
80 : : }, }
81 : : },
82 : : { /* AES CTR */
83 : : .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
84 : : {.sym = {
85 : : .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
86 : : {.cipher = {
87 : : .algo = RTE_CRYPTO_CIPHER_AES_CTR,
88 : : .block_size = 16,
89 : : .key_size = {
90 : : .min = 16,
91 : : .max = 32,
92 : : .increment = 8
93 : : },
94 : : .iv_size = {
95 : : .min = 12,
96 : : .max = 16,
97 : : .increment = 4
98 : : }
99 : : }, }
100 : : }, }
101 : : },
102 : : { /* 3DES CBC */
103 : : .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
104 : : {.sym = {
105 : : .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
106 : : {.cipher = {
107 : : .algo = RTE_CRYPTO_CIPHER_3DES_CBC,
108 : : .block_size = 8,
109 : : .key_size = {
110 : : .min = 24,
111 : : .max = 24,
112 : : .increment = 0
113 : : },
114 : : .iv_size = {
115 : : .min = 8,
116 : : .max = 16,
117 : : .increment = 8
118 : : }
119 : : }, }
120 : : }, }
121 : : },
122 : : { /* AES-XCBC */
123 : : .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
124 : : { .sym = {
125 : : .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
126 : : {.auth = {
127 : : .algo = RTE_CRYPTO_AUTH_AES_XCBC_MAC,
128 : : .block_size = 16,
129 : : .key_size = {
130 : : .min = 16,
131 : : .max = 16,
132 : : .increment = 0
133 : : },
134 : : .digest_size = {
135 : : .min = 12,
136 : : .max = 12,
137 : : .increment = 0,
138 : : },
139 : : }, }
140 : : }, }
141 : : },
142 : : { /* SHA1 HMAC */
143 : : .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
144 : : {.sym = {
145 : : .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
146 : : {.auth = {
147 : : .algo = RTE_CRYPTO_AUTH_SHA1_HMAC,
148 : : .block_size = 64,
149 : : .key_size = {
150 : : .min = 20,
151 : : .max = 64,
152 : : .increment = 1
153 : : },
154 : : .digest_size = {
155 : : .min = 12,
156 : : .max = 12,
157 : : .increment = 0
158 : : },
159 : : }, }
160 : : }, }
161 : : },
162 : : { /* SHA256 HMAC */
163 : : .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
164 : : {.sym = {
165 : : .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
166 : : {.auth = {
167 : : .algo = RTE_CRYPTO_AUTH_SHA256_HMAC,
168 : : .block_size = 64,
169 : : .key_size = {
170 : : .min = 1,
171 : : .max = 1024,
172 : : .increment = 1
173 : : },
174 : : .digest_size = {
175 : : .min = 16,
176 : : .max = 32,
177 : : .increment = 16
178 : : },
179 : : }, }
180 : : }, }
181 : : },
182 : : { /* SHA384 HMAC */
183 : : .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
184 : : {.sym = {
185 : : .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
186 : : {.auth = {
187 : : .algo = RTE_CRYPTO_AUTH_SHA384_HMAC,
188 : : .block_size = 64,
189 : : .key_size = {
190 : : .min = 1,
191 : : .max = 1024,
192 : : .increment = 1
193 : : },
194 : : .digest_size = {
195 : : .min = 24,
196 : : .max = 48,
197 : : .increment = 24
198 : : },
199 : : }, }
200 : : }, }
201 : : },
202 : : { /* SHA512 HMAC */
203 : : .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
204 : : {.sym = {
205 : : .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
206 : : {.auth = {
207 : : .algo = RTE_CRYPTO_AUTH_SHA512_HMAC,
208 : : .block_size = 128,
209 : : .key_size = {
210 : : .min = 1,
211 : : .max = 1024,
212 : : .increment = 1
213 : : },
214 : : .digest_size = {
215 : : .min = 32,
216 : : .max = 64,
217 : : .increment = 32
218 : : },
219 : : }, }
220 : : }, }
221 : : },
222 : : { /* AES GMAC (AUTH) */
223 : : .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
224 : : {.sym = {
225 : : .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
226 : : {.auth = {
227 : : .algo = RTE_CRYPTO_AUTH_AES_GMAC,
228 : : .block_size = 16,
229 : : .key_size = {
230 : : .min = 16,
231 : : .max = 32,
232 : : .increment = 8
233 : : },
234 : : .digest_size = {
235 : : .min = 8,
236 : : .max = 16,
237 : : .increment = 4
238 : : },
239 : : .iv_size = {
240 : : .min = 12,
241 : : .max = 12,
242 : : .increment = 0
243 : : }
244 : : }, }
245 : : }, }
246 : : },
247 : : { /* AES CCM */
248 : : .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
249 : : {.sym = {
250 : : .xform_type = RTE_CRYPTO_SYM_XFORM_AEAD,
251 : : {.aead = {
252 : : .algo = RTE_CRYPTO_AEAD_AES_CCM,
253 : : .block_size = 16,
254 : : .key_size = {
255 : : .min = 16,
256 : : .max = 32,
257 : : .increment = 8
258 : : },
259 : : .digest_size = {
260 : : .min = 16,
261 : : .max = 16,
262 : : .increment = 0
263 : : },
264 : : .aad_size = {
265 : : .min = 8,
266 : : .max = 12,
267 : : .increment = 4
268 : : },
269 : : .iv_size = {
270 : : .min = 11,
271 : : .max = 13,
272 : : .increment = 1
273 : : }
274 : : }, }
275 : : }, }
276 : : },
277 : : { /* NULL (AUTH) */
278 : : .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
279 : : {.sym = {
280 : : .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
281 : : {.auth = {
282 : : .algo = RTE_CRYPTO_AUTH_NULL,
283 : : .block_size = 1,
284 : : .key_size = {
285 : : .min = 0,
286 : : .max = 0,
287 : : .increment = 0
288 : : },
289 : : .digest_size = {
290 : : .min = 0,
291 : : .max = 0,
292 : : .increment = 0
293 : : },
294 : : }, },
295 : : }, },
296 : : },
297 : : { /* NULL (CIPHER) */
298 : : .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
299 : : {.sym = {
300 : : .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
301 : : {.cipher = {
302 : : .algo = RTE_CRYPTO_CIPHER_NULL,
303 : : .block_size = 1,
304 : : .key_size = {
305 : : .min = 0,
306 : : .max = 0,
307 : : .increment = 0
308 : : },
309 : : .iv_size = {
310 : : .min = 0,
311 : : .max = 0,
312 : : .increment = 0
313 : : }
314 : : }, },
315 : : }, }
316 : : },
317 : :
318 : : RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
319 : : };
320 : :
321 : : static const struct rte_security_capability cn10k_eth_sec_ipsec_capabilities[] = {
322 : : { /* IPsec Inline Protocol ESP Tunnel Ingress */
323 : : .action = RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL,
324 : : .protocol = RTE_SECURITY_PROTOCOL_IPSEC,
325 : : .ipsec = {
326 : : .proto = RTE_SECURITY_IPSEC_SA_PROTO_ESP,
327 : : .mode = RTE_SECURITY_IPSEC_SA_MODE_TUNNEL,
328 : : .direction = RTE_SECURITY_IPSEC_SA_DIR_INGRESS,
329 : : .replay_win_sz_max = ROC_AR_WIN_SIZE_MAX,
330 : : .options = {
331 : : .udp_encap = 1,
332 : : .udp_ports_verify = 1,
333 : : .copy_df = 1,
334 : : .copy_dscp = 1,
335 : : .copy_flabel = 1,
336 : : .tunnel_hdr_verify = RTE_SECURITY_IPSEC_TUNNEL_VERIFY_SRC_DST_ADDR,
337 : : .dec_ttl = 1,
338 : : .ip_csum_enable = 1,
339 : : .l4_csum_enable = 1,
340 : : .stats = 1,
341 : : .esn = 1,
342 : : .ingress_oop = 1,
343 : : },
344 : : },
345 : : .crypto_capabilities = cn10k_eth_sec_crypto_caps,
346 : : .ol_flags = RTE_SECURITY_TX_OLOAD_NEED_MDATA
347 : : },
348 : : { /* IPsec Inline Protocol ESP Tunnel Egress */
349 : : .action = RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL,
350 : : .protocol = RTE_SECURITY_PROTOCOL_IPSEC,
351 : : .ipsec = {
352 : : .proto = RTE_SECURITY_IPSEC_SA_PROTO_ESP,
353 : : .mode = RTE_SECURITY_IPSEC_SA_MODE_TUNNEL,
354 : : .direction = RTE_SECURITY_IPSEC_SA_DIR_EGRESS,
355 : : .replay_win_sz_max = ROC_AR_WIN_SIZE_MAX,
356 : : .options = {
357 : : .iv_gen_disable = 1,
358 : : .udp_encap = 1,
359 : : .udp_ports_verify = 1,
360 : : .copy_df = 1,
361 : : .copy_dscp = 1,
362 : : .copy_flabel = 1,
363 : : .dec_ttl = 1,
364 : : .ip_csum_enable = 1,
365 : : .l4_csum_enable = 1,
366 : : .stats = 1,
367 : : .esn = 1,
368 : : },
369 : : },
370 : : .crypto_capabilities = cn10k_eth_sec_crypto_caps,
371 : : .ol_flags = RTE_SECURITY_TX_OLOAD_NEED_MDATA
372 : : },
373 : : { /* IPsec Inline Protocol ESP Transport Egress */
374 : : .action = RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL,
375 : : .protocol = RTE_SECURITY_PROTOCOL_IPSEC,
376 : : .ipsec = {
377 : : .proto = RTE_SECURITY_IPSEC_SA_PROTO_ESP,
378 : : .mode = RTE_SECURITY_IPSEC_SA_MODE_TRANSPORT,
379 : : .direction = RTE_SECURITY_IPSEC_SA_DIR_EGRESS,
380 : : .replay_win_sz_max = ROC_AR_WIN_SIZE_MAX,
381 : : .options = {
382 : : .iv_gen_disable = 1,
383 : : .udp_encap = 1,
384 : : .udp_ports_verify = 1,
385 : : .copy_df = 1,
386 : : .copy_dscp = 1,
387 : : .dec_ttl = 1,
388 : : .ip_csum_enable = 1,
389 : : .l4_csum_enable = 1,
390 : : .stats = 1,
391 : : .esn = 1,
392 : : .ingress_oop = 1,
393 : : },
394 : : },
395 : : .crypto_capabilities = cn10k_eth_sec_crypto_caps,
396 : : .ol_flags = RTE_SECURITY_TX_OLOAD_NEED_MDATA
397 : : },
398 : : { /* IPsec Inline Protocol ESP Transport Ingress */
399 : : .action = RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL,
400 : : .protocol = RTE_SECURITY_PROTOCOL_IPSEC,
401 : : .ipsec = {
402 : : .proto = RTE_SECURITY_IPSEC_SA_PROTO_ESP,
403 : : .mode = RTE_SECURITY_IPSEC_SA_MODE_TRANSPORT,
404 : : .direction = RTE_SECURITY_IPSEC_SA_DIR_INGRESS,
405 : : .replay_win_sz_max = ROC_AR_WIN_SIZE_MAX,
406 : : .options = {
407 : : .udp_encap = 1,
408 : : .udp_ports_verify = 1,
409 : : .copy_df = 1,
410 : : .copy_dscp = 1,
411 : : .dec_ttl = 1,
412 : : .ip_csum_enable = 1,
413 : : .l4_csum_enable = 1,
414 : : .stats = 1,
415 : : .esn = 1,
416 : : .ingress_oop = 1,
417 : : },
418 : : },
419 : : .crypto_capabilities = cn10k_eth_sec_crypto_caps,
420 : : .ol_flags = RTE_SECURITY_TX_OLOAD_NEED_MDATA
421 : : },
422 : : };
423 : :
424 : : static const struct rte_security_capability cn10k_eth_sec_macsec_capabilities[] = {
425 : : { /* MACsec Inline Protocol, AES-GCM-128 algo */
426 : : .action = RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL,
427 : : .protocol = RTE_SECURITY_PROTOCOL_MACSEC,
428 : : .macsec = {
429 : : .mtu = ROC_MCS_MAX_MTU,
430 : : .alg = RTE_SECURITY_MACSEC_ALG_GCM_128,
431 : : .max_nb_sc = 128,
432 : : .max_nb_sa = 256,
433 : : .max_nb_sess = 256,
434 : : .replay_win_sz = ROC_MCS_MAX_AR_WINSZ,
435 : : .relative_sectag_insert = 1,
436 : : .fixed_sectag_insert = 1,
437 : : .icv_include_da_sa = 1,
438 : : .ctrl_port_enable = 1,
439 : : .preserve_sectag = 1,
440 : : .preserve_icv = 1,
441 : : .validate_frames = 1,
442 : : .re_key = 1,
443 : : .anti_replay = 1,
444 : : },
445 : : },
446 : : { /* MACsec Inline Protocol, AES-GCM-256 algo */
447 : : .action = RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL,
448 : : .protocol = RTE_SECURITY_PROTOCOL_MACSEC,
449 : : .macsec = {
450 : : .mtu = ROC_MCS_MAX_MTU,
451 : : .alg = RTE_SECURITY_MACSEC_ALG_GCM_256,
452 : : .max_nb_sc = 128,
453 : : .max_nb_sa = 256,
454 : : .max_nb_sess = 256,
455 : : .replay_win_sz = ROC_MCS_MAX_AR_WINSZ,
456 : : .relative_sectag_insert = 1,
457 : : .fixed_sectag_insert = 1,
458 : : .icv_include_da_sa = 1,
459 : : .ctrl_port_enable = 1,
460 : : .preserve_sectag = 1,
461 : : .preserve_icv = 1,
462 : : .validate_frames = 1,
463 : : .re_key = 1,
464 : : .anti_replay = 1,
465 : : },
466 : : },
467 : : { /* MACsec Inline Protocol, AES-GCM-XPN-128 algo */
468 : : .action = RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL,
469 : : .protocol = RTE_SECURITY_PROTOCOL_MACSEC,
470 : : .macsec = {
471 : : .mtu = ROC_MCS_MAX_MTU,
472 : : .alg = RTE_SECURITY_MACSEC_ALG_GCM_XPN_128,
473 : : .max_nb_sc = 128,
474 : : .max_nb_sa = 256,
475 : : .max_nb_sess = 256,
476 : : .replay_win_sz = ROC_MCS_MAX_AR_WINSZ,
477 : : .relative_sectag_insert = 1,
478 : : .fixed_sectag_insert = 1,
479 : : .icv_include_da_sa = 1,
480 : : .ctrl_port_enable = 1,
481 : : .preserve_sectag = 1,
482 : : .preserve_icv = 1,
483 : : .validate_frames = 1,
484 : : .re_key = 1,
485 : : .anti_replay = 1,
486 : : },
487 : : },
488 : : { /* MACsec Inline Protocol, AES-GCM-XPN-256 algo */
489 : : .action = RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL,
490 : : .protocol = RTE_SECURITY_PROTOCOL_MACSEC,
491 : : .macsec = {
492 : : .mtu = ROC_MCS_MAX_MTU,
493 : : .alg = RTE_SECURITY_MACSEC_ALG_GCM_XPN_256,
494 : : .max_nb_sc = 128,
495 : : .max_nb_sa = 256,
496 : : .max_nb_sess = 256,
497 : : .replay_win_sz = ROC_MCS_MAX_AR_WINSZ,
498 : : .relative_sectag_insert = 1,
499 : : .fixed_sectag_insert = 1,
500 : : .icv_include_da_sa = 1,
501 : : .ctrl_port_enable = 1,
502 : : .preserve_sectag = 1,
503 : : .preserve_icv = 1,
504 : : .validate_frames = 1,
505 : : .re_key = 1,
506 : : .anti_replay = 1,
507 : : },
508 : : },
509 : : };
510 : :
511 : : #define SEC_CAPS_LEN (RTE_DIM(cn10k_eth_sec_ipsec_capabilities) + \
512 : : RTE_DIM(cn10k_eth_sec_macsec_capabilities) + 1)
513 : :
514 : : static struct rte_security_capability cn10k_eth_sec_capabilities[SEC_CAPS_LEN];
515 : :
516 : : static inline void
517 : : cnxk_pktmbuf_free_no_cache(struct rte_mbuf *mbuf)
518 : : {
519 : : struct rte_mbuf *next;
520 : :
521 [ # # # # ]: 0 : if (!mbuf)
522 : : return;
523 : : do {
524 : 0 : next = mbuf->next;
525 [ # # # # ]: 0 : roc_npa_aura_op_free(mbuf->pool->pool_id, 1, (rte_iova_t)mbuf);
526 : : mbuf = next;
527 [ # # # # ]: 0 : } while (mbuf != NULL);
528 : : }
529 : :
530 : : void
531 : 0 : cn10k_eth_sec_sso_work_cb(uint64_t *gw, void *args, enum nix_inl_event_type type, void *cq_s,
532 : : uint32_t port_id)
533 : : {
534 : : struct rte_eth_event_ipsec_desc desc;
535 : : struct cn10k_sec_sess_priv sess_priv;
536 : : struct cn10k_outb_priv_data *priv;
537 : : struct roc_ot_ipsec_outb_sa *sa;
538 : : struct cpt_cn10k_res_s *res;
539 : : struct rte_eth_dev *eth_dev;
540 : : struct cnxk_eth_dev *dev;
541 : : static uint64_t warn_cnt;
542 : : uint16_t dlen_adj, rlen;
543 : : struct rte_mbuf *mbuf;
544 : : uintptr_t sa_base;
545 : : uintptr_t nixtx;
546 : : uint8_t port;
547 : :
548 : : RTE_SET_USED(args);
549 : : RTE_SET_USED(cq_s);
550 : :
551 [ # # # ]: 0 : switch ((gw[0] >> 28) & 0xF) {
552 : 0 : case RTE_EVENT_TYPE_ETHDEV:
553 : : /* Event from inbound inline dev due to IPSEC packet bad L4 */
554 : 0 : mbuf = (struct rte_mbuf *)(gw[1] - sizeof(struct rte_mbuf));
555 : 0 : plt_nix_dbg("Received mbuf %p from inline dev inbound", mbuf);
556 : : cnxk_pktmbuf_free_no_cache(mbuf);
557 : 0 : return;
558 : 0 : case RTE_EVENT_TYPE_CPU:
559 : : /* Check for subtype */
560 [ # # ]: 0 : if (((gw[0] >> 20) & 0xFF) == CNXK_ETHDEV_SEC_OUTB_EV_SUB) {
561 : : /* Event from outbound inline error */
562 : 0 : mbuf = (struct rte_mbuf *)gw[1];
563 : : break;
564 : : }
565 : : /* Fall through */
566 : : default:
567 [ # # ]: 0 : if (type == NIX_INL_SOFT_EXPIRY_THRD) {
568 : : sa = (struct roc_ot_ipsec_outb_sa *)args;
569 : : priv = roc_nix_inl_ot_ipsec_outb_sa_sw_rsvd(sa);
570 : 0 : desc.metadata = (uint64_t)priv->userdata;
571 [ # # ]: 0 : if (sa->w2.s.life_unit == ROC_IE_OT_SA_LIFE_UNIT_PKTS)
572 : 0 : desc.subtype =
573 : : RTE_ETH_EVENT_IPSEC_SA_PKT_EXPIRY;
574 : : else
575 : 0 : desc.subtype =
576 : : RTE_ETH_EVENT_IPSEC_SA_BYTE_EXPIRY;
577 : 0 : eth_dev = &rte_eth_devices[port_id];
578 : 0 : rte_eth_dev_callback_process(eth_dev,
579 : : RTE_ETH_EVENT_IPSEC, &desc);
580 : : } else {
581 : 0 : plt_err("Unknown event gw[0] = 0x%016lx, gw[1] = 0x%016lx",
582 : : gw[0], gw[1]);
583 : : }
584 : : return;
585 : : }
586 : :
587 : : /* Get ethdev port from tag */
588 : 0 : port = gw[0] & 0xFF;
589 : 0 : eth_dev = &rte_eth_devices[port];
590 : : dev = cnxk_eth_pmd_priv(eth_dev);
591 : :
592 : 0 : sess_priv.u64 = *rte_security_dynfield(mbuf);
593 : : /* Calculate dlen adj */
594 : 0 : dlen_adj = mbuf->pkt_len - mbuf->l2_len;
595 : 0 : rlen = (dlen_adj + sess_priv.roundup_len) +
596 : 0 : (sess_priv.roundup_byte - 1);
597 : 0 : rlen &= ~(uint64_t)(sess_priv.roundup_byte - 1);
598 : 0 : rlen += sess_priv.partial_len;
599 : 0 : dlen_adj = rlen - dlen_adj;
600 : :
601 : : /* Find the res area residing on next cacheline after end of data */
602 : 0 : nixtx = rte_pktmbuf_mtod(mbuf, uintptr_t) + mbuf->pkt_len + dlen_adj;
603 : : nixtx += BIT_ULL(7);
604 : 0 : nixtx = (nixtx - 1) & ~(BIT_ULL(7) - 1);
605 : 0 : res = (struct cpt_cn10k_res_s *)nixtx;
606 : :
607 : 0 : plt_nix_dbg("Outbound error, mbuf %p, sa_index %u, compcode %x uc %x",
608 : : mbuf, sess_priv.sa_idx, res->compcode, res->uc_compcode);
609 : :
610 : 0 : sess_priv.u64 = *rte_security_dynfield(mbuf);
611 : :
612 : 0 : sa_base = dev->outb.sa_base;
613 [ # # # # ]: 0 : sa = roc_nix_inl_ot_ipsec_outb_sa(sa_base, sess_priv.sa_idx);
614 : : priv = roc_nix_inl_ot_ipsec_outb_sa_sw_rsvd(sa);
615 : :
616 : : memset(&desc, 0, sizeof(desc));
617 : :
618 [ # # # # ]: 0 : switch (res->uc_compcode) {
619 : 0 : case ROC_IE_OT_UCC_ERR_SA_OVERFLOW:
620 : 0 : desc.subtype = RTE_ETH_EVENT_IPSEC_ESN_OVERFLOW;
621 : 0 : break;
622 : 0 : case ROC_IE_OT_UCC_ERR_SA_EXPIRED:
623 [ # # ]: 0 : if (sa->w2.s.life_unit == ROC_IE_OT_SA_LIFE_UNIT_PKTS)
624 : 0 : desc.subtype = RTE_ETH_EVENT_IPSEC_SA_PKT_HARD_EXPIRY;
625 : : else
626 : 0 : desc.subtype = RTE_ETH_EVENT_IPSEC_SA_BYTE_HARD_EXPIRY;
627 : : break;
628 : 0 : case ROC_IE_OT_UCC_ERR_PKT_IP:
629 : 0 : warn_cnt++;
630 [ # # ]: 0 : if (warn_cnt % 10000 == 0)
631 : 0 : plt_warn("Outbound error, bad ip pkt, mbuf %p,"
632 : : " sa_index %u (total warnings %" PRIu64 ")",
633 : : mbuf, sess_priv.sa_idx, warn_cnt);
634 : 0 : desc.subtype = -res->uc_compcode;
635 : 0 : break;
636 : 0 : default:
637 : 0 : warn_cnt++;
638 [ # # ]: 0 : if (warn_cnt % 10000 == 0)
639 : 0 : plt_warn("Outbound error, mbuf %p, sa_index %u,"
640 : : " compcode %x uc %x,"
641 : : " (total warnings %" PRIu64 ")",
642 : : mbuf, sess_priv.sa_idx, res->compcode,
643 : : res->uc_compcode, warn_cnt);
644 : 0 : desc.subtype = -res->uc_compcode;
645 : 0 : break;
646 : : }
647 : :
648 : 0 : desc.metadata = (uint64_t)priv->userdata;
649 : 0 : rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_IPSEC, &desc);
650 : : cnxk_pktmbuf_free_no_cache(mbuf);
651 : : }
652 : :
653 : : static void
654 : 0 : outb_dbg_iv_update(struct roc_ot_ipsec_outb_sa *outb_sa, const char *__iv_str)
655 : : {
656 : 0 : uint8_t *iv_dbg = outb_sa->iv.iv_dbg;
657 : 0 : char *iv_str = strdup(__iv_str);
658 : : char *iv_b = NULL, len = 16;
659 : : char *save;
660 : : int i;
661 : :
662 [ # # ]: 0 : if (!iv_str)
663 : 0 : return;
664 : :
665 [ # # ]: 0 : if (outb_sa->w2.s.enc_type == ROC_IE_SA_ENC_AES_GCM ||
666 : 0 : outb_sa->w2.s.enc_type == ROC_IE_SA_ENC_AES_CTR ||
667 [ # # ]: 0 : outb_sa->w2.s.enc_type == ROC_IE_SA_ENC_AES_CCM ||
668 [ # # ]: 0 : outb_sa->w2.s.auth_type == ROC_IE_SA_AUTH_AES_GMAC) {
669 : 0 : memset(outb_sa->iv.s.iv_dbg1, 0, sizeof(outb_sa->iv.s.iv_dbg1));
670 : 0 : memset(outb_sa->iv.s.iv_dbg2, 0, sizeof(outb_sa->iv.s.iv_dbg2));
671 : :
672 : : iv_dbg = outb_sa->iv.s.iv_dbg1;
673 [ # # ]: 0 : for (i = 0; i < 4; i++) {
674 [ # # ]: 0 : iv_b = strtok_r(i ? NULL : iv_str, ",", &save);
675 [ # # ]: 0 : if (!iv_b)
676 : : break;
677 : 0 : iv_dbg[i] = strtoul(iv_b, NULL, 0);
678 : : }
679 [ # # ]: 0 : *(uint32_t *)iv_dbg = rte_be_to_cpu_32(*(uint32_t *)iv_dbg);
680 : :
681 : : iv_dbg = outb_sa->iv.s.iv_dbg2;
682 [ # # ]: 0 : for (i = 0; i < 4; i++) {
683 : 0 : iv_b = strtok_r(NULL, ",", &save);
684 [ # # ]: 0 : if (!iv_b)
685 : : break;
686 : 0 : iv_dbg[i] = strtoul(iv_b, NULL, 0);
687 : : }
688 [ # # ]: 0 : *(uint32_t *)iv_dbg = rte_be_to_cpu_32(*(uint32_t *)iv_dbg);
689 : :
690 : : } else {
691 : : iv_dbg = outb_sa->iv.iv_dbg;
692 : : memset(iv_dbg, 0, sizeof(outb_sa->iv.iv_dbg));
693 : :
694 [ # # ]: 0 : for (i = 0; i < len; i++) {
695 [ # # ]: 0 : iv_b = strtok_r(i ? NULL : iv_str, ",", &save);
696 [ # # ]: 0 : if (!iv_b)
697 : : break;
698 : 0 : iv_dbg[i] = strtoul(iv_b, NULL, 0);
699 : : }
700 [ # # ]: 0 : *(uint64_t *)iv_dbg = rte_be_to_cpu_64(*(uint64_t *)iv_dbg);
701 : 0 : *(uint64_t *)&iv_dbg[8] =
702 [ # # ]: 0 : rte_be_to_cpu_64(*(uint64_t *)&iv_dbg[8]);
703 : : }
704 : :
705 : : /* Update source of IV */
706 : 0 : outb_sa->w2.s.iv_src = ROC_IE_OT_SA_IV_SRC_FROM_SA;
707 : 0 : free(iv_str);
708 : : }
709 : :
710 : : static int
711 : 0 : cn10k_eth_sec_outb_sa_misc_fill(struct roc_nix *roc_nix,
712 : : struct roc_ot_ipsec_outb_sa *sa, void *sa_cptr,
713 : : struct rte_security_ipsec_xform *ipsec_xfrm,
714 : : uint32_t sa_idx)
715 : : {
716 : : uint64_t *ring_base, ring_addr;
717 : :
718 : 0 : if (ipsec_xfrm->life.bytes_soft_limit |
719 [ # # ]: 0 : ipsec_xfrm->life.packets_soft_limit) {
720 : 0 : ring_base = roc_nix_inl_outb_ring_base_get(roc_nix);
721 [ # # ]: 0 : if (ring_base == NULL)
722 : : return -ENOTSUP;
723 : :
724 : 0 : ring_addr = ring_base[sa_idx >>
725 : : ROC_NIX_SOFT_EXP_ERR_RING_MAX_ENTRY_LOG2];
726 : 0 : sa->ctx.err_ctl.s.mode = ROC_IE_OT_ERR_CTL_MODE_RING;
727 : 0 : sa->ctx.err_ctl.s.address = ring_addr >> 3;
728 : 0 : sa->w0.s.ctx_id = ((uintptr_t)sa_cptr >> 51) & 0x1ff;
729 : : }
730 : :
731 : : return 0;
732 : : }
733 : :
734 : : static int
735 [ # # ]: 0 : cn10k_eth_sec_session_create(void *device,
736 : : struct rte_security_session_conf *conf,
737 : : struct rte_security_session *sess)
738 : : {
739 : : struct rte_eth_dev *eth_dev = (struct rte_eth_dev *)device;
740 : : struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
741 : : struct rte_security_ipsec_xform *ipsec;
742 : : struct cn10k_sec_sess_priv sess_priv;
743 : : struct rte_crypto_sym_xform *crypto;
744 : 0 : struct cnxk_eth_sec_sess *eth_sec = SECURITY_GET_SESS_PRIV(sess);
745 : 0 : struct roc_nix *nix = &dev->nix;
746 : : bool inbound, inl_dev;
747 : : rte_spinlock_t *lock;
748 : 0 : char tbuf[128] = {0};
749 : : int rc = 0;
750 : :
751 [ # # ]: 0 : if (conf->action_type != RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL)
752 : : return -ENOTSUP;
753 : :
754 [ # # ]: 0 : if (conf->protocol == RTE_SECURITY_PROTOCOL_MACSEC)
755 : 0 : return cnxk_eth_macsec_session_create(dev, conf, sess);
756 [ # # ]: 0 : else if (conf->protocol != RTE_SECURITY_PROTOCOL_IPSEC)
757 : : return -ENOTSUP;
758 : :
759 [ # # ]: 0 : if (nix->custom_inb_sa)
760 : : return -ENOTSUP;
761 : :
762 [ # # ]: 0 : if (rte_security_dynfield_register() < 0)
763 : : return -ENOTSUP;
764 : :
765 [ # # ]: 0 : if (conf->ipsec.options.ip_reassembly_en &&
766 [ # # ]: 0 : dev->reass_dynfield_off < 0) {
767 [ # # ]: 0 : if (rte_eth_ip_reassembly_dynfield_register(&dev->reass_dynfield_off,
768 : : &dev->reass_dynflag_bit) < 0)
769 : 0 : return -rte_errno;
770 : : }
771 : :
772 [ # # ]: 0 : if (conf->ipsec.options.ingress_oop &&
773 [ # # ]: 0 : rte_security_oop_dynfield_offset < 0) {
774 : : /* Register for security OOP dynfield if required */
775 [ # # ]: 0 : if (rte_security_oop_dynfield_register() < 0)
776 : 0 : return -rte_errno;
777 : : }
778 : :
779 : : /* We cannot support inbound reassembly and OOP together */
780 [ # # ]: 0 : if (conf->ipsec.options.ip_reassembly_en &&
781 : : conf->ipsec.options.ingress_oop) {
782 : 0 : plt_err("Cannot support Inbound reassembly and OOP together");
783 : 0 : return -ENOTSUP;
784 : : }
785 : :
786 : 0 : ipsec = &conf->ipsec;
787 : 0 : crypto = conf->crypto_xform;
788 : 0 : inbound = !!(ipsec->direction == RTE_SECURITY_IPSEC_SA_DIR_INGRESS);
789 : 0 : inl_dev = !!dev->inb.inl_dev;
790 : :
791 : 0 : sess_priv.u64 = 0;
792 : :
793 [ # # ]: 0 : lock = inbound ? &dev->inb.lock : &dev->outb.lock;
794 : : rte_spinlock_lock(lock);
795 : :
796 : : /* Acquire lock on inline dev for inbound */
797 [ # # ]: 0 : if (inbound && inl_dev)
798 : 0 : roc_nix_inl_dev_lock();
799 : :
800 : : memset(eth_sec, 0, sizeof(struct cnxk_eth_sec_sess));
801 : :
802 [ # # ]: 0 : if (inbound) {
803 : : struct roc_ot_ipsec_inb_sa *inb_sa, *inb_sa_dptr;
804 : : struct cn10k_inb_priv_data *inb_priv;
805 : : uint32_t spi_mask;
806 : : uintptr_t sa;
807 : :
808 : : PLT_STATIC_ASSERT(sizeof(struct cn10k_inb_priv_data) <
809 : : ROC_NIX_INL_OT_IPSEC_INB_SW_RSVD);
810 : :
811 : 0 : spi_mask = roc_nix_inl_inb_spi_range(nix, inl_dev, NULL, NULL);
812 : :
813 : : /* Search if a session already exits */
814 [ # # ]: 0 : if (cnxk_eth_sec_sess_get_by_sa_idx(dev, ipsec->spi & spi_mask, true)) {
815 : 0 : plt_err("Inbound SA with SPI/SA index %u already in use", ipsec->spi);
816 : : rc = -EEXIST;
817 : 0 : goto err;
818 : : }
819 : :
820 : : /* Get Inbound SA from NIX_RX_IPSEC_SA_BASE */
821 : 0 : sa = roc_nix_inl_inb_sa_get(nix, inl_dev, ipsec->spi);
822 [ # # # # ]: 0 : if (!sa && dev->inb.inl_dev) {
823 : : snprintf(tbuf, sizeof(tbuf),
824 : : "Failed to create ingress sa, inline dev "
825 : : "not found or spi not in range");
826 : : rc = -ENOTSUP;
827 : 0 : goto err;
828 [ # # ]: 0 : } else if (!sa) {
829 : : snprintf(tbuf, sizeof(tbuf),
830 : : "Failed to create ingress sa");
831 : : rc = -EFAULT;
832 : 0 : goto err;
833 : : }
834 : :
835 : 0 : inb_sa = (struct roc_ot_ipsec_inb_sa *)sa;
836 : :
837 : : /* Check if SA is already in use */
838 [ # # ]: 0 : if (inb_sa->w2.s.valid) {
839 : 0 : snprintf(tbuf, sizeof(tbuf),
840 : : "Inbound SA with SPI %u already in use",
841 : : ipsec->spi);
842 : : rc = -EBUSY;
843 : 0 : goto err;
844 : : }
845 : :
846 : 0 : inb_sa_dptr = (struct roc_ot_ipsec_inb_sa *)dev->inb.sa_dptr;
847 : : memset(inb_sa_dptr, 0, sizeof(struct roc_ot_ipsec_inb_sa));
848 : :
849 : : /* Fill inbound sa params */
850 : 0 : rc = cnxk_ot_ipsec_inb_sa_fill(inb_sa_dptr, ipsec, crypto, 0);
851 [ # # ]: 0 : if (rc) {
852 : : snprintf(tbuf, sizeof(tbuf), "Failed to init inbound sa, rc=%d", rc);
853 : 0 : goto err;
854 : : }
855 : :
856 : : inb_priv = roc_nix_inl_ot_ipsec_inb_sa_sw_rsvd(inb_sa);
857 : : /* Back pointer to get eth_sec */
858 : 0 : inb_priv->eth_sec = eth_sec;
859 : : /* Save userdata in inb private area */
860 : 0 : inb_priv->userdata = conf->userdata;
861 : :
862 : : /* Save SA index/SPI in cookie for now */
863 : 0 : inb_sa_dptr->w1.s.cookie =
864 [ # # ]: 0 : rte_cpu_to_be_32(ipsec->spi & spi_mask);
865 : :
866 [ # # ]: 0 : if (ipsec->options.stats == 1) {
867 : : /* Enable mib counters */
868 : 0 : inb_sa_dptr->w0.s.count_mib_bytes = 1;
869 : 0 : inb_sa_dptr->w0.s.count_mib_pkts = 1;
870 : : }
871 : :
872 : : /* Enable out-of-place processing */
873 [ # # ]: 0 : if (ipsec->options.ingress_oop)
874 : 0 : inb_sa_dptr->w0.s.pkt_format =
875 : : ROC_IE_OT_SA_PKT_FMT_FULL;
876 : :
877 : : /* Prepare session priv */
878 : 0 : sess_priv.inb_sa = 1;
879 : 0 : sess_priv.sa_idx = ipsec->spi & spi_mask;
880 : :
881 : : /* Pointer from eth_sec -> inb_sa */
882 : 0 : eth_sec->sa = inb_sa;
883 : 0 : eth_sec->sess = sess;
884 : 0 : eth_sec->sa_idx = ipsec->spi & spi_mask;
885 : 0 : eth_sec->spi = ipsec->spi;
886 : 0 : eth_sec->inl_dev = !!dev->inb.inl_dev;
887 : 0 : eth_sec->inb = true;
888 : 0 : eth_sec->inb_oop = !!ipsec->options.ingress_oop;
889 : :
890 : 0 : TAILQ_INSERT_TAIL(&dev->inb.list, eth_sec, entry);
891 : 0 : dev->inb.nb_sess++;
892 : : /* Sync session in context cache */
893 : 0 : rc = roc_nix_inl_ctx_write(&dev->nix, inb_sa_dptr, eth_sec->sa,
894 : : eth_sec->inb,
895 : : sizeof(struct roc_ot_ipsec_inb_sa));
896 [ # # ]: 0 : if (rc)
897 : 0 : goto err;
898 : :
899 [ # # ]: 0 : if (conf->ipsec.options.ip_reassembly_en) {
900 : 0 : inb_priv->reass_dynfield_off = dev->reass_dynfield_off;
901 : 0 : inb_priv->reass_dynflag_bit = dev->reass_dynflag_bit;
902 : : }
903 : :
904 [ # # ]: 0 : if (ipsec->options.ingress_oop)
905 : 0 : dev->inb.nb_oop++;
906 : :
907 : : /* Update function pointer to handle OOP sessions */
908 [ # # ]: 0 : if (dev->inb.nb_oop &&
909 [ # # ]: 0 : !(dev->rx_offload_flags & NIX_RX_REAS_F)) {
910 : 0 : dev->rx_offload_flags |= NIX_RX_REAS_F;
911 : 0 : cn10k_eth_set_rx_function(eth_dev);
912 [ # # ]: 0 : if (cnxk_ethdev_rx_offload_cb)
913 : 0 : cnxk_ethdev_rx_offload_cb(eth_dev->data->port_id,
914 : : NIX_RX_REAS_F);
915 : : }
916 : : } else {
917 : : struct roc_ot_ipsec_outb_sa *outb_sa, *outb_sa_dptr;
918 : : struct cn10k_outb_priv_data *outb_priv;
919 : : struct cnxk_ipsec_outb_rlens *rlens;
920 : 0 : uint64_t sa_base = dev->outb.sa_base;
921 : : const char *iv_str;
922 : : uint32_t sa_idx;
923 : :
924 : : PLT_STATIC_ASSERT(sizeof(struct cn10k_outb_priv_data) <
925 : : ROC_NIX_INL_OT_IPSEC_OUTB_SW_RSVD);
926 : :
927 : : /* Alloc an sa index */
928 : 0 : rc = cnxk_eth_outb_sa_idx_get(dev, &sa_idx, ipsec->spi);
929 [ # # ]: 0 : if (rc)
930 : 0 : goto err;
931 : :
932 : 0 : outb_sa = roc_nix_inl_ot_ipsec_outb_sa(sa_base, sa_idx);
933 : : outb_priv = roc_nix_inl_ot_ipsec_outb_sa_sw_rsvd(outb_sa);
934 : 0 : rlens = &outb_priv->rlens;
935 : :
936 : 0 : outb_sa_dptr = (struct roc_ot_ipsec_outb_sa *)dev->outb.sa_dptr;
937 : : memset(outb_sa_dptr, 0, sizeof(struct roc_ot_ipsec_outb_sa));
938 : :
939 : : /* Fill outbound sa params */
940 : 0 : rc = cnxk_ot_ipsec_outb_sa_fill(outb_sa_dptr, ipsec, crypto, 0);
941 [ # # ]: 0 : if (rc) {
942 : : snprintf(tbuf, sizeof(tbuf), "Failed to init outbound sa, rc=%d", rc);
943 : 0 : rc |= cnxk_eth_outb_sa_idx_put(dev, sa_idx);
944 : 0 : goto err;
945 : : }
946 : :
947 [ # # ]: 0 : if (conf->ipsec.options.iv_gen_disable == 1) {
948 : 0 : iv_str = getenv("ETH_SEC_IV_OVR");
949 [ # # ]: 0 : if (iv_str)
950 : 0 : outb_dbg_iv_update(outb_sa_dptr, iv_str);
951 : : }
952 : : /* Fill outbound sa misc params */
953 : 0 : rc = cn10k_eth_sec_outb_sa_misc_fill(&dev->nix, outb_sa_dptr,
954 : : outb_sa, ipsec, sa_idx);
955 [ # # ]: 0 : if (rc) {
956 : : snprintf(tbuf, sizeof(tbuf),
957 : : "Failed to init outb sa misc params, rc=%d",
958 : : rc);
959 : 0 : rc |= cnxk_eth_outb_sa_idx_put(dev, sa_idx);
960 : 0 : goto err;
961 : : }
962 : :
963 : : /* Save userdata */
964 : 0 : outb_priv->userdata = conf->userdata;
965 : 0 : outb_priv->sa_idx = sa_idx;
966 : 0 : outb_priv->eth_sec = eth_sec;
967 : :
968 : : /* Save rlen info */
969 : 0 : cnxk_ipsec_outb_rlens_get(rlens, ipsec, crypto);
970 : :
971 [ # # ]: 0 : if (ipsec->options.stats == 1) {
972 : : /* Enable mib counters */
973 : 0 : outb_sa_dptr->w0.s.count_mib_bytes = 1;
974 : 0 : outb_sa_dptr->w0.s.count_mib_pkts = 1;
975 : : }
976 : :
977 : : /* Prepare session priv */
978 : 0 : sess_priv.sa_idx = outb_priv->sa_idx;
979 : 0 : sess_priv.roundup_byte = rlens->roundup_byte;
980 : 0 : sess_priv.roundup_len = rlens->roundup_len;
981 : 0 : sess_priv.partial_len = rlens->partial_len;
982 : 0 : sess_priv.mode = outb_sa_dptr->w2.s.ipsec_mode;
983 : 0 : sess_priv.outer_ip_ver = outb_sa_dptr->w2.s.outer_ip_ver;
984 : : /* Propagate inner checksum enable from SA to fast path */
985 [ # # ]: 0 : sess_priv.chksum = (!ipsec->options.ip_csum_enable << 1 |
986 : 0 : !ipsec->options.l4_csum_enable);
987 [ # # ]: 0 : sess_priv.dec_ttl = ipsec->options.dec_ttl;
988 [ # # ]: 0 : if (roc_feature_nix_has_inl_ipsec_mseg() &&
989 [ # # ]: 0 : dev->outb.cpt_eng_caps & BIT_ULL(35))
990 : 0 : sess_priv.nixtx_off = 1;
991 : :
992 : : /* Pointer from eth_sec -> outb_sa */
993 : 0 : eth_sec->sa = outb_sa;
994 : 0 : eth_sec->sess = sess;
995 : 0 : eth_sec->sa_idx = sa_idx;
996 : 0 : eth_sec->spi = ipsec->spi;
997 : :
998 : 0 : TAILQ_INSERT_TAIL(&dev->outb.list, eth_sec, entry);
999 : 0 : dev->outb.nb_sess++;
1000 : : /* Sync session in context cache */
1001 : 0 : rc = roc_nix_inl_ctx_write(&dev->nix, outb_sa_dptr, eth_sec->sa,
1002 : 0 : eth_sec->inb,
1003 : : sizeof(struct roc_ot_ipsec_outb_sa));
1004 [ # # ]: 0 : if (rc)
1005 : 0 : goto err;
1006 : : }
1007 [ # # ]: 0 : if (inbound && inl_dev)
1008 : 0 : roc_nix_inl_dev_unlock();
1009 : : rte_spinlock_unlock(lock);
1010 : :
1011 [ # # ]: 0 : plt_nix_dbg("Created %s session with spi=0x%x, sa_idx=0x%x inl_dev=%u",
1012 : : inbound ? "inbound" : "outbound", eth_sec->spi,
1013 : : eth_sec->sa_idx, eth_sec->inl_dev);
1014 : : /*
1015 : : * Update fast path info in priv area.
1016 : : */
1017 : 0 : sess->fast_mdata = sess_priv.u64;
1018 : :
1019 : 0 : return 0;
1020 : 0 : err:
1021 [ # # ]: 0 : if (inbound && inl_dev)
1022 : 0 : roc_nix_inl_dev_unlock();
1023 : : rte_spinlock_unlock(lock);
1024 : :
1025 [ # # ]: 0 : if (rc)
1026 : 0 : plt_err("%s", tbuf);
1027 : : return rc;
1028 : : }
1029 : :
1030 : : static int
1031 : 0 : cn10k_eth_sec_session_destroy(void *device, struct rte_security_session *sess)
1032 : : {
1033 : : struct rte_eth_dev *eth_dev = (struct rte_eth_dev *)device;
1034 : : struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
1035 : : struct cnxk_macsec_sess *macsec_sess;
1036 : : struct cnxk_eth_sec_sess *eth_sec;
1037 : : rte_spinlock_t *lock;
1038 : : void *sa_dptr;
1039 : :
1040 : 0 : eth_sec = cnxk_eth_sec_sess_get_by_sess(dev, sess);
1041 [ # # ]: 0 : if (!eth_sec) {
1042 : 0 : macsec_sess = cnxk_eth_macsec_sess_get_by_sess(dev, sess);
1043 [ # # ]: 0 : if (macsec_sess)
1044 : 0 : return cnxk_eth_macsec_session_destroy(dev, sess);
1045 : : return -ENOENT;
1046 : : }
1047 [ # # ]: 0 : if (dev->nix.custom_inb_sa)
1048 : : return -ENOTSUP;
1049 : :
1050 [ # # ]: 0 : lock = eth_sec->inb ? &dev->inb.lock : &dev->outb.lock;
1051 : : rte_spinlock_lock(lock);
1052 : :
1053 [ # # ]: 0 : if (eth_sec->inl_dev)
1054 : 0 : roc_nix_inl_dev_lock();
1055 : :
1056 [ # # ]: 0 : if (eth_sec->inb) {
1057 : : /* Disable SA */
1058 : 0 : sa_dptr = dev->inb.sa_dptr;
1059 : 0 : roc_ot_ipsec_inb_sa_init(sa_dptr);
1060 : :
1061 : 0 : roc_nix_inl_ctx_write(&dev->nix, sa_dptr, eth_sec->sa,
1062 : 0 : eth_sec->inb,
1063 : : sizeof(struct roc_ot_ipsec_inb_sa));
1064 [ # # ]: 0 : TAILQ_REMOVE(&dev->inb.list, eth_sec, entry);
1065 : 0 : dev->inb.nb_sess--;
1066 [ # # ]: 0 : if (eth_sec->inb_oop)
1067 : 0 : dev->inb.nb_oop--;
1068 : :
1069 : : /* Clear offload flags if was used by OOP */
1070 [ # # # # ]: 0 : if (!dev->inb.nb_oop && !dev->inb.reass_en &&
1071 [ # # ]: 0 : dev->rx_offload_flags & NIX_RX_REAS_F) {
1072 : 0 : dev->rx_offload_flags &= ~NIX_RX_REAS_F;
1073 : 0 : cn10k_eth_set_rx_function(eth_dev);
1074 : : }
1075 : : } else {
1076 : : /* Disable SA */
1077 : 0 : sa_dptr = dev->outb.sa_dptr;
1078 : 0 : roc_ot_ipsec_outb_sa_init(sa_dptr);
1079 : :
1080 : 0 : roc_nix_inl_ctx_write(&dev->nix, sa_dptr, eth_sec->sa,
1081 : 0 : eth_sec->inb,
1082 : : sizeof(struct roc_ot_ipsec_outb_sa));
1083 : : /* Release Outbound SA index */
1084 : 0 : cnxk_eth_outb_sa_idx_put(dev, eth_sec->sa_idx);
1085 [ # # ]: 0 : TAILQ_REMOVE(&dev->outb.list, eth_sec, entry);
1086 : 0 : dev->outb.nb_sess--;
1087 : : }
1088 [ # # ]: 0 : if (eth_sec->inl_dev)
1089 : 0 : roc_nix_inl_dev_unlock();
1090 : :
1091 : : rte_spinlock_unlock(lock);
1092 : :
1093 [ # # ]: 0 : plt_nix_dbg("Destroyed %s session with spi=0x%x, sa_idx=0x%x, inl_dev=%u",
1094 : : eth_sec->inb ? "inbound" : "outbound", eth_sec->spi,
1095 : : eth_sec->sa_idx, eth_sec->inl_dev);
1096 : :
1097 : 0 : return 0;
1098 : : }
1099 : :
1100 : : static const struct rte_security_capability *
1101 : 0 : cn10k_eth_sec_capabilities_get(void *device __rte_unused)
1102 : : {
1103 : 0 : return cn10k_eth_sec_capabilities;
1104 : : }
1105 : :
1106 : : static int
1107 [ # # ]: 0 : cn10k_eth_sec_session_update(void *device, struct rte_security_session *sess,
1108 : : struct rte_security_session_conf *conf)
1109 : : {
1110 : : struct rte_eth_dev *eth_dev = (struct rte_eth_dev *)device;
1111 : : struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
1112 : : struct rte_security_ipsec_xform *ipsec;
1113 : : struct cn10k_sec_sess_priv sess_priv;
1114 : : struct rte_crypto_sym_xform *crypto;
1115 : : struct cnxk_eth_sec_sess *eth_sec;
1116 : : bool inbound, inl_dev;
1117 : : rte_spinlock_t *lock;
1118 : : int rc;
1119 : :
1120 [ # # ]: 0 : if (conf->action_type != RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL ||
1121 : : conf->protocol != RTE_SECURITY_PROTOCOL_IPSEC)
1122 : : return -ENOENT;
1123 : :
1124 : 0 : ipsec = &conf->ipsec;
1125 : 0 : crypto = conf->crypto_xform;
1126 : 0 : inbound = !!(ipsec->direction == RTE_SECURITY_IPSEC_SA_DIR_INGRESS);
1127 : :
1128 : 0 : eth_sec = cnxk_eth_sec_sess_get_by_sess(dev, sess);
1129 [ # # ]: 0 : if (!eth_sec)
1130 : : return -ENOENT;
1131 : :
1132 : 0 : inl_dev = !!dev->inb.inl_dev;
1133 [ # # ]: 0 : lock = inbound ? &dev->inb.lock : &dev->outb.lock;
1134 : : rte_spinlock_lock(lock);
1135 : :
1136 : : /* Acquire lock on inline dev for inbound */
1137 [ # # ]: 0 : if (inbound && inl_dev)
1138 : 0 : roc_nix_inl_dev_lock();
1139 : :
1140 : 0 : eth_sec->spi = conf->ipsec.spi;
1141 : :
1142 [ # # ]: 0 : if (inbound) {
1143 : : struct roc_ot_ipsec_inb_sa *inb_sa_dptr, *inb_sa;
1144 : : struct cn10k_inb_priv_data *inb_priv;
1145 : :
1146 : 0 : inb_sa = eth_sec->sa;
1147 : : inb_priv = roc_nix_inl_ot_ipsec_inb_sa_sw_rsvd(inb_sa);
1148 : 0 : inb_sa_dptr = (struct roc_ot_ipsec_inb_sa *)dev->inb.sa_dptr;
1149 : : memset(inb_sa_dptr, 0, sizeof(struct roc_ot_ipsec_inb_sa));
1150 : :
1151 : 0 : rc = cnxk_ot_ipsec_inb_sa_fill(inb_sa_dptr, ipsec, crypto, 0);
1152 [ # # ]: 0 : if (rc)
1153 : 0 : goto err;
1154 : : /* Use cookie for original data */
1155 : 0 : inb_sa_dptr->w1.s.cookie = inb_sa->w1.s.cookie;
1156 : :
1157 [ # # ]: 0 : if (ipsec->options.stats == 1) {
1158 : : /* Enable mib counters */
1159 : 0 : inb_sa_dptr->w0.s.count_mib_bytes = 1;
1160 : 0 : inb_sa_dptr->w0.s.count_mib_pkts = 1;
1161 : : }
1162 : :
1163 : : /* Enable out-of-place processing */
1164 [ # # ]: 0 : if (ipsec->options.ingress_oop)
1165 : 0 : inb_sa_dptr->w0.s.pkt_format = ROC_IE_OT_SA_PKT_FMT_FULL;
1166 : :
1167 : 0 : rc = roc_nix_inl_ctx_write(&dev->nix, inb_sa_dptr, eth_sec->sa,
1168 : 0 : eth_sec->inb,
1169 : : sizeof(struct roc_ot_ipsec_inb_sa));
1170 [ # # ]: 0 : if (rc)
1171 : 0 : goto err;
1172 : :
1173 : : /* Save userdata in inb private area */
1174 : 0 : inb_priv->userdata = conf->userdata;
1175 : : } else {
1176 : : struct roc_ot_ipsec_outb_sa *outb_sa_dptr, *outb_sa;
1177 : : struct cn10k_outb_priv_data *outb_priv;
1178 : : struct cnxk_ipsec_outb_rlens *rlens;
1179 : :
1180 : 0 : outb_sa = eth_sec->sa;
1181 : : outb_priv = roc_nix_inl_ot_ipsec_outb_sa_sw_rsvd(outb_sa);
1182 : 0 : rlens = &outb_priv->rlens;
1183 : 0 : outb_sa_dptr = (struct roc_ot_ipsec_outb_sa *)dev->outb.sa_dptr;
1184 : : memset(outb_sa_dptr, 0, sizeof(struct roc_ot_ipsec_outb_sa));
1185 : :
1186 : 0 : rc = cnxk_ot_ipsec_outb_sa_fill(outb_sa_dptr, ipsec, crypto, 0);
1187 [ # # ]: 0 : if (rc)
1188 : 0 : goto err;
1189 : :
1190 : : /* Save rlen info */
1191 : 0 : cnxk_ipsec_outb_rlens_get(rlens, ipsec, crypto);
1192 : :
1193 [ # # ]: 0 : if (ipsec->options.stats == 1) {
1194 : : /* Enable mib counters */
1195 : 0 : outb_sa_dptr->w0.s.count_mib_bytes = 1;
1196 : 0 : outb_sa_dptr->w0.s.count_mib_pkts = 1;
1197 : : }
1198 : :
1199 : 0 : sess_priv.u64 = 0;
1200 : 0 : sess_priv.sa_idx = outb_priv->sa_idx;
1201 : 0 : sess_priv.roundup_byte = rlens->roundup_byte;
1202 : 0 : sess_priv.roundup_len = rlens->roundup_len;
1203 : 0 : sess_priv.partial_len = rlens->partial_len;
1204 : 0 : sess_priv.mode = outb_sa_dptr->w2.s.ipsec_mode;
1205 : 0 : sess_priv.outer_ip_ver = outb_sa_dptr->w2.s.outer_ip_ver;
1206 : : /* Propagate inner checksum enable from SA to fast path */
1207 : 0 : sess_priv.chksum =
1208 [ # # ]: 0 : (!ipsec->options.ip_csum_enable << 1 | !ipsec->options.l4_csum_enable);
1209 [ # # ]: 0 : sess_priv.dec_ttl = ipsec->options.dec_ttl;
1210 [ # # # # ]: 0 : if (roc_feature_nix_has_inl_ipsec_mseg() && dev->outb.cpt_eng_caps & BIT_ULL(35))
1211 : 0 : sess_priv.nixtx_off = 1;
1212 : :
1213 : 0 : rc = roc_nix_inl_ctx_write(&dev->nix, outb_sa_dptr, eth_sec->sa,
1214 : 0 : eth_sec->inb,
1215 : : sizeof(struct roc_ot_ipsec_outb_sa));
1216 [ # # ]: 0 : if (rc)
1217 : 0 : goto err;
1218 : :
1219 : : /* Save userdata */
1220 : 0 : outb_priv->userdata = conf->userdata;
1221 : 0 : sess->fast_mdata = sess_priv.u64;
1222 : : }
1223 : :
1224 [ # # ]: 0 : if (inbound && inl_dev)
1225 : 0 : roc_nix_inl_dev_unlock();
1226 : : rte_spinlock_unlock(lock);
1227 : :
1228 [ # # ]: 0 : plt_nix_dbg("Updated %s session with spi=0x%x, sa_idx=0x%x inl_dev=%u",
1229 : : inbound ? "inbound" : "outbound", eth_sec->spi, eth_sec->sa_idx,
1230 : : eth_sec->inl_dev);
1231 : 0 : return 0;
1232 : :
1233 : 0 : err:
1234 [ # # ]: 0 : if (inbound && inl_dev)
1235 : 0 : roc_nix_inl_dev_unlock();
1236 : : rte_spinlock_unlock(lock);
1237 : :
1238 : 0 : return rc;
1239 : : }
1240 : :
1241 : : static int
1242 : 0 : cn10k_eth_sec_session_stats_get(void *device, struct rte_security_session *sess,
1243 : : struct rte_security_stats *stats)
1244 : : {
1245 : : struct rte_eth_dev *eth_dev = (struct rte_eth_dev *)device;
1246 : : struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
1247 : : struct cnxk_macsec_sess *macsec_sess;
1248 : : struct cnxk_eth_sec_sess *eth_sec;
1249 : : rte_spinlock_t *lock;
1250 : : bool inl_dev, inb;
1251 : : int rc;
1252 : :
1253 : 0 : eth_sec = cnxk_eth_sec_sess_get_by_sess(dev, sess);
1254 [ # # ]: 0 : if (eth_sec == NULL) {
1255 : 0 : macsec_sess = cnxk_eth_macsec_sess_get_by_sess(dev, sess);
1256 [ # # ]: 0 : if (macsec_sess)
1257 : 0 : return cnxk_eth_macsec_session_stats_get(dev, macsec_sess, stats);
1258 : : return -EINVAL;
1259 : : }
1260 : :
1261 : 0 : inl_dev = !!dev->inb.inl_dev;
1262 : 0 : inb = eth_sec->inb;
1263 [ # # ]: 0 : lock = inb ? &dev->inb.lock : &dev->outb.lock;
1264 : : rte_spinlock_lock(lock);
1265 : :
1266 : : /* Acquire lock on inline dev for inbound */
1267 [ # # ]: 0 : if (inb && inl_dev)
1268 : 0 : roc_nix_inl_dev_lock();
1269 : :
1270 : 0 : rc = roc_nix_inl_sa_sync(&dev->nix, eth_sec->sa, eth_sec->inb, ROC_NIX_INL_SA_OP_FLUSH);
1271 [ # # ]: 0 : if (rc)
1272 : 0 : goto err;
1273 : :
1274 : 0 : stats->protocol = RTE_SECURITY_PROTOCOL_IPSEC;
1275 : :
1276 [ # # ]: 0 : if (eth_sec->inb) {
1277 : 0 : stats->ipsec.ipackets =
1278 : 0 : ((struct roc_ot_ipsec_inb_sa *)eth_sec->sa)->ctx.mib_pkts;
1279 : 0 : stats->ipsec.ibytes =
1280 : 0 : ((struct roc_ot_ipsec_inb_sa *)eth_sec->sa)->ctx.mib_octs;
1281 : : } else {
1282 : 0 : stats->ipsec.opackets =
1283 : 0 : ((struct roc_ot_ipsec_outb_sa *)eth_sec->sa)->ctx.mib_pkts;
1284 : 0 : stats->ipsec.obytes =
1285 : 0 : ((struct roc_ot_ipsec_outb_sa *)eth_sec->sa)->ctx.mib_octs;
1286 : : }
1287 : :
1288 : 0 : err:
1289 [ # # ]: 0 : if (inb && inl_dev)
1290 : 0 : roc_nix_inl_dev_unlock();
1291 : : rte_spinlock_unlock(lock);
1292 : :
1293 : 0 : return rc;
1294 : : }
1295 : :
1296 : : static void
1297 : 0 : eth_sec_caps_add(struct rte_security_capability eth_sec_caps[], uint32_t *idx,
1298 : : const struct rte_security_capability *caps, uint32_t nb_caps)
1299 : : {
1300 [ # # ]: 0 : PLT_VERIFY(*idx + nb_caps < SEC_CAPS_LEN);
1301 : :
1302 [ # # ]: 0 : rte_memcpy(ð_sec_caps[*idx], caps, nb_caps * sizeof(caps[0]));
1303 : 0 : *idx += nb_caps;
1304 : 0 : }
1305 : :
1306 : : static uint16_t __rte_hot
1307 : 0 : cn10k_eth_sec_inb_rx_inject(void *device, struct rte_mbuf **pkts,
1308 : : struct rte_security_session **sess, uint16_t nb_pkts)
1309 : : {
1310 : : struct rte_eth_dev *eth_dev = (struct rte_eth_dev *)device;
1311 : : struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
1312 : :
1313 : 0 : return cn10k_nix_inj_pkts(sess, &dev->inj_cfg, pkts, nb_pkts);
1314 : : }
1315 : :
1316 : : static int
1317 : 0 : cn10k_eth_sec_rx_inject_config(void *device, uint16_t port_id, bool enable)
1318 : : {
1319 : : struct rte_eth_dev *eth_dev = (struct rte_eth_dev *)device;
1320 : : struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
1321 : : uint64_t channel, pf_func, inj_match_id = 0xFFFFUL;
1322 : : struct cnxk_ethdev_inj_cfg *inj_cfg;
1323 : 0 : struct roc_nix *nix = &dev->nix;
1324 : : struct roc_cpt_lf *inl_lf;
1325 : : uint64_t sa_base;
1326 : :
1327 [ # # ]: 0 : if (!rte_eth_dev_is_valid_port(port_id))
1328 : : return -EINVAL;
1329 : :
1330 [ # # ]: 0 : if (eth_dev->data->dev_started || !eth_dev->data->dev_configured)
1331 : : return -EBUSY;
1332 : :
1333 [ # # ]: 0 : if (!roc_nix_inl_inb_rx_inject_enable(nix, dev->inb.inl_dev))
1334 : : return -ENOTSUP;
1335 : :
1336 : 0 : roc_idev_nix_rx_inject_set(port_id, enable);
1337 : :
1338 : 0 : inl_lf = roc_nix_inl_inb_inj_lf_get(nix);
1339 [ # # ]: 0 : if (!inl_lf)
1340 : : return -ENOTSUP;
1341 : 0 : sa_base = roc_nix_inl_inb_sa_base_get(nix, dev->inb.inl_dev);
1342 : :
1343 : : inj_cfg = &dev->inj_cfg;
1344 : 0 : inj_cfg->sa_base = sa_base | eth_dev->data->port_id;
1345 : 0 : inj_cfg->io_addr = inl_lf->io_addr;
1346 : 0 : inj_cfg->lmt_base = nix->lmt_base;
1347 : 0 : channel = roc_nix_get_base_chan(nix);
1348 : 0 : pf_func = roc_idev_nix_inl_dev_pffunc_get();
1349 : 0 : inj_cfg->cmd_w0 = pf_func << 48 | inj_match_id << 32 | channel << 4;
1350 : :
1351 : 0 : return 0;
1352 : : }
1353 : :
1354 : : #define CPT_LMTST_BURST 32
1355 : : static uint16_t
1356 : 0 : cn10k_inl_dev_submit(struct roc_nix_inl_dev_q *q, void *inst, uint16_t nb_inst)
1357 : : {
1358 : 0 : uintptr_t lbase = q->lmt_base;
1359 : : uint8_t lnum, shft, loff;
1360 : : uint16_t left, burst;
1361 : : rte_iova_t io_addr;
1362 : : uint16_t lmt_id;
1363 : :
1364 : : /* Check the flow control to avoid the queue overflow */
1365 [ # # ]: 0 : if (cnxk_nix_inl_fc_check(q->fc_addr, &q->fc_addr_sw, q->nb_desc, nb_inst))
1366 : : return 0;
1367 : :
1368 : : io_addr = q->io_addr;
1369 : : ROC_LMT_CPT_BASE_ID_GET(lbase, lmt_id);
1370 : :
1371 : : left = nb_inst;
1372 : 0 : again:
1373 : 0 : burst = left > CPT_LMTST_BURST ? CPT_LMTST_BURST : left;
1374 : :
1375 : : lnum = 0;
1376 : : loff = 0;
1377 : : shft = 16;
1378 : 0 : memcpy(PLT_PTR_CAST(lbase), inst, burst * sizeof(struct cpt_inst_s));
1379 : : loff = (burst % 2) ? 1 : 0;
1380 : : lnum = (burst / 2);
1381 : : shft = shft + (lnum * 3);
1382 : :
1383 : 0 : left -= burst;
1384 : : cn10k_nix_sec_steorl(io_addr, lmt_id, lnum, loff, shft);
1385 : 0 : rte_io_wmb();
1386 [ # # ]: 0 : if (left) {
1387 : 0 : inst = RTE_PTR_ADD(inst, burst * sizeof(struct cpt_inst_s));
1388 : 0 : goto again;
1389 : : }
1390 : : return nb_inst;
1391 : : }
1392 : :
1393 : : void
1394 : 0 : cn10k_eth_sec_ops_override(void)
1395 : : {
1396 : : static int init_once;
1397 : 0 : uint32_t idx = 0;
1398 : :
1399 [ # # ]: 0 : if (init_once)
1400 : 0 : return;
1401 [ # # ]: 0 : init_once = 1;
1402 : :
1403 [ # # ]: 0 : if (roc_feature_nix_has_inl_ipsec())
1404 : 0 : eth_sec_caps_add(cn10k_eth_sec_capabilities, &idx,
1405 : : cn10k_eth_sec_ipsec_capabilities,
1406 : : RTE_DIM(cn10k_eth_sec_ipsec_capabilities));
1407 : :
1408 [ # # ]: 0 : if (roc_feature_nix_has_macsec())
1409 : 0 : eth_sec_caps_add(cn10k_eth_sec_capabilities, &idx,
1410 : : cn10k_eth_sec_macsec_capabilities,
1411 : : RTE_DIM(cn10k_eth_sec_macsec_capabilities));
1412 : :
1413 : 0 : cn10k_eth_sec_capabilities[idx].action = RTE_SECURITY_ACTION_TYPE_NONE;
1414 : :
1415 : : /* Update platform specific ops */
1416 : 0 : cnxk_eth_sec_ops.macsec_sa_create = cnxk_eth_macsec_sa_create;
1417 : 0 : cnxk_eth_sec_ops.macsec_sc_create = cnxk_eth_macsec_sc_create;
1418 : 0 : cnxk_eth_sec_ops.macsec_sa_destroy = cnxk_eth_macsec_sa_destroy;
1419 : 0 : cnxk_eth_sec_ops.macsec_sc_destroy = cnxk_eth_macsec_sc_destroy;
1420 : 0 : cnxk_eth_sec_ops.session_create = cn10k_eth_sec_session_create;
1421 : 0 : cnxk_eth_sec_ops.session_destroy = cn10k_eth_sec_session_destroy;
1422 : 0 : cnxk_eth_sec_ops.capabilities_get = cn10k_eth_sec_capabilities_get;
1423 : 0 : cnxk_eth_sec_ops.session_update = cn10k_eth_sec_session_update;
1424 : 0 : cnxk_eth_sec_ops.session_stats_get = cn10k_eth_sec_session_stats_get;
1425 : 0 : cnxk_eth_sec_ops.macsec_sc_stats_get = cnxk_eth_macsec_sc_stats_get;
1426 : 0 : cnxk_eth_sec_ops.macsec_sa_stats_get = cnxk_eth_macsec_sa_stats_get;
1427 : 0 : cnxk_eth_sec_ops.rx_inject_configure = cn10k_eth_sec_rx_inject_config;
1428 : 0 : cnxk_eth_sec_ops.inb_pkt_rx_inject = cn10k_eth_sec_inb_rx_inject;
1429 : :
1430 : : /* Update platform specific rte_pmd_cnxk ops */
1431 : 0 : cnxk_pmd_ops.inl_dev_submit = cn10k_inl_dev_submit;
1432 : : }
|