src/dpdk/lib/librte_ipsec/esp_inb.c
uint16_t
esp_inb_pkt_prepare(const struct rte_ipsec_session *ss, struct rte_mbuf *mb[],
	struct rte_crypto_op *cop[], uint16_t num)
{
	int32_t rc;
	uint32_t i, k, hl;
	struct rte_ipsec_sa *sa;
	struct rte_cryptodev_sym_session *cs;
	struct replay_sqn *rsn;
	union sym_op_data icv;
	uint32_t dr[num];

	sa = ss->sa;
	cs = ss->crypto.ses;
	rsn = rsn_acquire(sa);

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

		hl = mb[i]->l2_len + mb[i]->l3_len;
		rc = inb_pkt_prepare(sa, rsn, mb[i], hl, &icv);
		if (rc >= 0) {
			lksd_none_cop_prepare(cop[k], cs, mb[i]);
			inb_cop_prepare(cop[k], sa, mb[i], &icv, hl, rc);
			k++;
		} else {
			dr[i - k] = i;
			rte_errno = -rc;
		}
	}

	rsn_release(sa, rsn);

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

	return k;
}
/*
 * setup/update packets and crypto ops for ESP inbound case.
 */
setup/update packets and crypto ops for ESP inbound case.
setup / update packets and crypto ops for ESP inbound case .
uint16_t
esp_inb_pkt_prepare(const struct rte_ipsec_session *ss, struct rte_mbuf *mb[],
	struct rte_crypto_op *cop[], uint16_t num)
{
	int32_t rc;
	uint32_t i, k, hl;
	struct rte_ipsec_sa *sa;
	struct rte_cryptodev_sym_session *cs;
	struct replay_sqn *rsn;
	union sym_op_data icv;
	uint32_t dr[num];
	sa = ss->sa;
	cs = ss->crypto.ses;
	rsn = rsn_acquire(sa);
	k = 0;
	for (i = 0; i != num; i++) {
		hl = mb[i]->l2_len + mb[i]->l3_len;
		rc = inb_pkt_prepare(sa, rsn, mb[i], hl, &icv);
		if (rc >= 0) {
			lksd_none_cop_prepare(cop[k], cs, mb[i]);
			inb_cop_prepare(cop[k], sa, mb[i], &icv, hl, rc);
			k++;
		} else {
			dr[i - k] = i;
			rte_errno = -rc;
		}
	}
	rsn_release(sa, rsn);
	if (k != num && k != 0)
		move_bad_mbufs(mb, dr, num, num - k);
	return k;
}
uint16_t esp_inb_pkt_prepare ( const struct rte_ipsec_session * ss , struct rte_mbuf * mb [ ] , struct rte_crypto_op * cop [ ] , uint16_t num ) { int32_t rc ; uint32_t i , k , hl ; struct rte_ipsec_sa * sa ; struct rte_cryptodev_sym_session * cs ; struct replay_sqn * rsn ; union sym_op_data icv ; uint32_t dr [ num ] ; sa = ss -> sa ; cs = ss -> crypto . ses ; rsn = rsn_acquire ( sa ) ; k = 0 ; for ( i = 0 ; i != num ; i ++ ) { hl = mb [ i ] -> l2_len + mb [ i ] -> l3_len ; rc = inb_pkt_prepare ( sa , rsn , mb [ i ] , hl , & icv ) ; if ( rc >= 0 ) { lksd_none_cop_prepare ( cop [ k ] , cs , mb [ i ] ) ; inb_cop_prepare ( cop [ k ] , sa , mb [ i ] , & icv , hl , rc ) ; k ++ ; } else { dr [ i - k ] = i ; rte_errno = - rc ; } } rsn_release ( sa , rsn ) ; if ( k != num && k != 0 ) move_bad_mbufs ( mb , dr , num , num - k ) ; return k ; }
setup/update packets and crypto ops for ESP inbound case.
setup / update packets and crypto ops for ESP inbound case .
/* copy not prepared mbufs beyond good ones */