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

Function inline_outb_trs_pkt_process

dpdk/lib/ipsec/esp_outb.c:787–849  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

785 * INLINE_CRYPTO type of device.
786 */
787uint16_t
788inline_outb_trs_pkt_process(const struct rte_ipsec_session *ss,
789 struct rte_mbuf *mb[], uint16_t num)
790{
791 int32_t rc;
792 uint32_t i, k, nb_segs_total, n_sqn;
793 uint64_t sqn;
794 rte_be64_t sqc;
795 struct rte_ipsec_sa *sa;
796 union sym_op_data icv;
797 uint64_t iv[IPSEC_MAX_IV_QWORD];
798 uint32_t dr[num];
799 uint16_t nb_segs[num];
800
801 sa = ss->sa;
802 nb_segs_total = 0;
803 /* Calculate number of segments */
804 for (i = 0; i != num; i++) {
805 nb_segs[i] = esn_outb_nb_segments(mb[i]);
806 nb_segs_total += nb_segs[i];
807 }
808
809 n_sqn = nb_segs_total;
810 sqn = esn_outb_update_sqn(sa, &n_sqn);
811 if (n_sqn != nb_segs_total) {
812 rte_errno = EOVERFLOW;
813 /* if there are segmented packets find out how many can be
814 * sent until overflow occurs
815 */
816 if (nb_segs_total > num) /* there is at least 1 */
817 num = esn_outb_nb_valid_packets(num, n_sqn, nb_segs);
818 else
819 num = n_sqn; /* no segmented packets */
820 }
821
822 k = 0;
823 for (i = 0; i != num; i++) {
824
825 sqc = rte_cpu_to_be_64(sqn);
826 gen_iv(iv, sqc);
827 sqn += nb_segs[i];
828
829 /* try to update the packet itself */
830 rc = outb_trs_pkt_prepare(sa, sqc, iv, mb[i], &icv, 0,
831 (mb[i]->ol_flags &
832 (RTE_MBUF_F_TX_TCP_SEG | RTE_MBUF_F_TX_UDP_SEG)) != 0);
833
834 k += (rc >= 0);
835
836 /* failure, put packet into the death-row */
837 if (rc < 0) {
838 dr[i - k] = i;
839 rte_errno = -rc;
840 }
841 }
842
843 /* copy not processed mbufs beyond good ones */
844 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_trs_pkt_prepareFunction · 0.85
move_bad_mbufsFunction · 0.85
inline_outb_mbuf_prepareFunction · 0.85

Tested by

no test coverage detected