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

Function esp_outb_sqh_process

dpdk/lib/ipsec/esp_outb.c:624–664  ·  view source on GitHub ↗

* process outbound packets for SA with ESN support, * for algorithms that require SQN.hibits to be implicitly included * into digest computation. * In that case we have to move ICV bytes back to their proper place. */

Source from the content-addressed store, hash-verified

622 * In that case we have to move ICV bytes back to their proper place.
623 */
624uint16_t
625esp_outb_sqh_process(const struct rte_ipsec_session *ss, struct rte_mbuf *mb[],
626 uint16_t num)
627{
628 uint32_t i, k, icv_len, *icv, bytes;
629 struct rte_mbuf *ml;
630 struct rte_ipsec_sa *sa;
631 uint32_t dr[num];
632
633 sa = ss->sa;
634
635 k = 0;
636 icv_len = sa->icv_len;
637 bytes = 0;
638
639 for (i = 0; i != num; i++) {
640 if ((mb[i]->ol_flags & RTE_MBUF_F_RX_SEC_OFFLOAD_FAILED) == 0) {
641 ml = rte_pktmbuf_lastseg(mb[i]);
642 /* remove high-order 32 bits of esn from packet len */
643 mb[i]->pkt_len -= sa->sqh_len;
644 ml->data_len -= sa->sqh_len;
645 icv = rte_pktmbuf_mtod_offset(ml, void *,
646 ml->data_len - icv_len);
647 remove_sqh(icv, icv_len);
648 bytes += mb[i]->pkt_len;
649 k++;
650 } else
651 dr[i - k] = i;
652 }
653 sa->statistics.count += k;
654 sa->statistics.bytes += bytes;
655
656 /* handle unprocessed mbufs */
657 if (k != num) {
658 rte_errno = EBADMSG;
659 if (k != 0)
660 move_bad_mbufs(mb, dr, num, num - k);
661 }
662
663 return k;
664}
665
666/*
667 * prepare packets for inline ipsec processing:

Callers

nothing calls this directly

Calls 3

rte_pktmbuf_lastsegFunction · 0.85
remove_sqhFunction · 0.85
move_bad_mbufsFunction · 0.85

Tested by

no test coverage detected