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

Function inline_outb_tun_pkt_process

dpdk/lib/ipsec/esp_outb.c:719–781  ·  view source on GitHub ↗

* process group of ESP outbound tunnel packets destined for * INLINE_CRYPTO type of device. */

Source from the content-addressed store, hash-verified

717 * INLINE_CRYPTO type of device.
718 */
719uint16_t
720inline_outb_tun_pkt_process(const struct rte_ipsec_session *ss,
721 struct rte_mbuf *mb[], uint16_t num)
722{
723 int32_t rc;
724 uint32_t i, k, nb_segs_total, n_sqn;
725 uint64_t sqn;
726 rte_be64_t sqc;
727 struct rte_ipsec_sa *sa;
728 union sym_op_data icv;
729 uint64_t iv[IPSEC_MAX_IV_QWORD];
730 uint32_t dr[num];
731 uint16_t nb_segs[num];
732
733 sa = ss->sa;
734 nb_segs_total = 0;
735 /* Calculate number of segments */
736 for (i = 0; i != num; i++) {
737 nb_segs[i] = esn_outb_nb_segments(mb[i]);
738 nb_segs_total += nb_segs[i];
739 }
740
741 n_sqn = nb_segs_total;
742 sqn = esn_outb_update_sqn(sa, &n_sqn);
743 if (n_sqn != nb_segs_total) {
744 rte_errno = EOVERFLOW;
745 /* if there are segmented packets find out how many can be
746 * sent until overflow occurs
747 */
748 if (nb_segs_total > num) /* there is at least 1 */
749 num = esn_outb_nb_valid_packets(num, n_sqn, nb_segs);
750 else
751 num = n_sqn; /* no segmented packets */
752 }
753
754 k = 0;
755 for (i = 0; i != num; i++) {
756
757 sqc = rte_cpu_to_be_64(sqn);
758 gen_iv(iv, sqc);
759 sqn += nb_segs[i];
760
761 /* try to update the packet itself */
762 rc = outb_tun_pkt_prepare(sa, sqc, iv, mb[i], &icv, 0,
763 (mb[i]->ol_flags &
764 (RTE_MBUF_F_TX_TCP_SEG | RTE_MBUF_F_TX_UDP_SEG)) != 0);
765
766 k += (rc >= 0);
767
768 /* failure, put packet into the death-row */
769 if (rc < 0) {
770 dr[i - k] = i;
771 rte_errno = -rc;
772 }
773 }
774
775 /* copy not processed mbufs beyond good ones */
776 if (k != num && k != 0)

Callers

nothing calls this directly

Calls 7

esn_outb_nb_segmentsFunction · 0.85
esn_outb_update_sqnFunction · 0.85
gen_ivFunction · 0.85
outb_tun_pkt_prepareFunction · 0.85
move_bad_mbufsFunction · 0.85
inline_outb_mbuf_prepareFunction · 0.85

Tested by

no test coverage detected