MCPcopy Create free account
hub / github.com/F-Stack/f-stack / esp_outb_trs_prepare

Function esp_outb_trs_prepare

dpdk/lib/ipsec/esp_outb.c:441–493  ·  view source on GitHub ↗

* setup/update packets and crypto ops for ESP outbound transport case. */

Source from the content-addressed store, hash-verified

439 * setup/update packets and crypto ops for ESP outbound transport case.
440 */
441uint16_t
442esp_outb_trs_prepare(const struct rte_ipsec_session *ss, struct rte_mbuf *mb[],
443 struct rte_crypto_op *cop[], uint16_t num)
444{
445 int32_t rc;
446 uint32_t i, k, n, l2, l3;
447 uint64_t sqn;
448 rte_be64_t sqc;
449 struct rte_ipsec_sa *sa;
450 struct rte_cryptodev_sym_session *cs;
451 union sym_op_data icv;
452 uint64_t iv[IPSEC_MAX_IV_QWORD];
453 uint32_t dr[num];
454
455 sa = ss->sa;
456 cs = ss->crypto.ses;
457
458 n = num;
459 sqn = esn_outb_update_sqn(sa, &n);
460 if (n != num)
461 rte_errno = EOVERFLOW;
462
463 k = 0;
464 for (i = 0; i != n; i++) {
465
466 l2 = mb[i]->l2_len;
467 l3 = mb[i]->l3_len;
468
469 sqc = rte_cpu_to_be_64(sqn + i);
470 gen_iv(iv, sqc);
471
472 /* try to update the packet itself */
473 rc = outb_trs_pkt_prepare(sa, sqc, iv, mb[i], &icv,
474 sa->sqh_len, 0);
475 /* success, setup crypto op */
476 if (rc >= 0) {
477 outb_pkt_xprepare(sa, sqc, &icv);
478 lksd_none_cop_prepare(cop[k], cs, mb[i]);
479 outb_cop_prepare(cop[k], sa, iv, &icv, l2 + l3, rc);
480 k++;
481 /* failure, put packet into the death-row */
482 } else {
483 dr[i - k] = i;
484 rte_errno = -rc;
485 }
486 }
487
488 /* copy not prepared mbufs beyond good ones */
489 if (k != n && k != 0)
490 move_bad_mbufs(mb, dr, n, n - k);
491
492 return k;
493}
494
495
496static inline uint32_t

Callers

nothing calls this directly

Calls 7

esn_outb_update_sqnFunction · 0.85
gen_ivFunction · 0.85
outb_trs_pkt_prepareFunction · 0.85
outb_pkt_xprepareFunction · 0.85
lksd_none_cop_prepareFunction · 0.85
outb_cop_prepareFunction · 0.85
move_bad_mbufsFunction · 0.85

Tested by

no test coverage detected