src/dpdk/lib/librte_ipsec/esp_outb.c
uint16_t
inline_outb_tun_pkt_process(const struct rte_ipsec_session *ss,
	struct rte_mbuf *mb[], uint16_t num)
{
	int32_t rc;
	uint32_t i, k, n;
	uint64_t sqn;
	rte_be64_t sqc;
	struct rte_ipsec_sa *sa;
	union sym_op_data icv;
	uint64_t iv[IPSEC_MAX_IV_QWORD];
	uint32_t dr[num];

	sa = ss->sa;

	n = num;
	sqn = esn_outb_update_sqn(sa, &n);
	if (n != num)
		rte_errno = EOVERFLOW;

	k = 0;
	for (i = 0; i != n; i++) {

		sqc = rte_cpu_to_be_64(sqn + i);
		gen_iv(iv, sqc);

		/* try to update the packet itself */
		rc = outb_tun_pkt_prepare(sa, sqc, iv, mb[i], &icv, 0);

		k += (rc >= 0);

		/* failure, put packet into the death-row */
		if (rc < 0) {
			dr[i - k] = i;
			rte_errno = -rc;
		}
	}

	/* copy not processed mbufs beyond good ones */
	if (k != n && k != 0)
		move_bad_mbufs(mb, dr, n, n - k);

	inline_outb_mbuf_prepare(ss, mb, k);
	return k;
}
/*
 * process group of ESP outbound tunnel packets destined for
 * INLINE_CRYPTO type of device.
 */
process group of ESP outbound tunnel packets destined for
INLINE_CRYPTO type of device.
process group of ESP outbound tunnel packets destined for INLINE_CRYPTO type of device .
uint16_t
inline_outb_tun_pkt_process(const struct rte_ipsec_session *ss,
	struct rte_mbuf *mb[], uint16_t num)
{
	int32_t rc;
	uint32_t i, k, n;
	uint64_t sqn;
	rte_be64_t sqc;
	struct rte_ipsec_sa *sa;
	union sym_op_data icv;
	uint64_t iv[IPSEC_MAX_IV_QWORD];
	uint32_t dr[num];
	sa = ss->sa;
	n = num;
	sqn = esn_outb_update_sqn(sa, &n);
	if (n != num)
		rte_errno = EOVERFLOW;
	k = 0;
	for (i = 0; i != n; i++) {
		sqc = rte_cpu_to_be_64(sqn + i);
		gen_iv(iv, sqc);
		rc = outb_tun_pkt_prepare(sa, sqc, iv, mb[i], &icv, 0);
		k += (rc >= 0);
		if (rc < 0) {
			dr[i - k] = i;
			rte_errno = -rc;
		}
	}
	if (k != n && k != 0)
		move_bad_mbufs(mb, dr, n, n - k);
	inline_outb_mbuf_prepare(ss, mb, k);
	return k;
}
uint16_t inline_outb_tun_pkt_process ( const struct rte_ipsec_session * ss , struct rte_mbuf * mb [ ] , uint16_t num ) { int32_t rc ; uint32_t i , k , n ; uint64_t sqn ; rte_be64_t sqc ; struct rte_ipsec_sa * sa ; union sym_op_data icv ; uint64_t iv [ IPSEC_MAX_IV_QWORD ] ; uint32_t dr [ num ] ; sa = ss -> sa ; n = num ; sqn = esn_outb_update_sqn ( sa , & n ) ; if ( n != num ) rte_errno = EOVERFLOW ; k = 0 ; for ( i = 0 ; i != n ; i ++ ) { sqc = rte_cpu_to_be_64 ( sqn + i ) ; gen_iv ( iv , sqc ) ; rc = outb_tun_pkt_prepare ( sa , sqc , iv , mb [ i ] , & icv , 0 ) ; k += ( rc >= 0 ) ; if ( rc < 0 ) { dr [ i - k ] = i ; rte_errno = - rc ; } } if ( k != n && k != 0 ) move_bad_mbufs ( mb , dr , n , n - k ) ; inline_outb_mbuf_prepare ( ss , mb , k ) ; return k ; }
process group of ESP outbound tunnel packets destined for
 INLINE_CRYPTO type of device.
process group of ESP outbound tunnel packets destined for INLINE_CRYPTO type of device .
/* try to update the packet itself */ /* failure, put packet into the death-row */ /* copy not processed mbufs beyond good ones */