src/dpdk/lib/librte_ipsec/esp_inb.c
static inline uint16_t
trs_process(const struct rte_ipsec_sa *sa, struct rte_mbuf *mb[],
	uint32_t sqn[], uint32_t dr[], uint16_t num, uint8_t sqh_len)
{
	char *np;
	uint32_t i, k, l2, tl;
	uint32_t hl[num], to[num];
	struct rte_esp_tail espt[num];
	struct rte_mbuf *ml[num];

	/*
	 * remove icv, esp trailer and high-order
	 * 32 bits of esn from packet length
	 */
	const uint32_t tlen = sa->icv_len + sizeof(espt[0]) + sqh_len;
	const uint32_t cofs = sa->ctp.cipher.offset;

	/*
	 * to minimize stalls due to load latency,
	 * read mbufs metadata and esp tail first.
	 */
	for (i = 0; i != num; i++)
		process_step1(mb[i], tlen, &ml[i], &espt[i], &hl[i], &to[i]);

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

		tl = tlen + espt[i].pad_len;
		l2 = mb[i]->l2_len;

		/* check that packet is valid */
		if (trs_process_check(mb[i], &ml[i], &to[i], espt[i],
				hl[i] + cofs, tl) == 0) {

			/* modify packet's layout */
			np = trs_process_step2(mb[i], ml[i], hl[i], cofs,
				to[i], tl, sqn + k);
			update_trs_l3hdr(sa, np + l2, mb[i]->pkt_len,
				l2, hl[i] - l2, espt[i].next_proto);

			/* update mbuf's metadata */
			trs_process_step3(mb[i]);
			k++;
		} else
			dr[i - k] = i;
	}

	return k;
}
/*
 * *process* function for tunnel packets
 */
*process* function for tunnel packets
* process * function for tunnel packets
static inline uint16_t
trs_process(const struct rte_ipsec_sa *sa, struct rte_mbuf *mb[],
	uint32_t sqn[], uint32_t dr[], uint16_t num, uint8_t sqh_len)
{
	char *np;
	uint32_t i, k, l2, tl;
	uint32_t hl[num], to[num];
	struct rte_esp_tail espt[num];
	struct rte_mbuf *ml[num];
	const uint32_t tlen = sa->icv_len + sizeof(espt[0]) + sqh_len;
	const uint32_t cofs = sa->ctp.cipher.offset;
	for (i = 0; i != num; i++)
		process_step1(mb[i], tlen, &ml[i], &espt[i], &hl[i], &to[i]);
	k = 0;
	for (i = 0; i != num; i++) {
		tl = tlen + espt[i].pad_len;
		l2 = mb[i]->l2_len;
		if (trs_process_check(mb[i], &ml[i], &to[i], espt[i],
				hl[i] + cofs, tl) == 0) {
			np = trs_process_step2(mb[i], ml[i], hl[i], cofs,
				to[i], tl, sqn + k);
			update_trs_l3hdr(sa, np + l2, mb[i]->pkt_len,
				l2, hl[i] - l2, espt[i].next_proto);
			trs_process_step3(mb[i]);
			k++;
		} else
			dr[i - k] = i;
	}
	return k;
}
static inline uint16_t trs_process ( const struct rte_ipsec_sa * sa , struct rte_mbuf * mb [ ] , uint32_t sqn [ ] , uint32_t dr [ ] , uint16_t num , uint8_t sqh_len ) { char * np ; uint32_t i , k , l2 , tl ; uint32_t hl [ num ] , to [ num ] ; struct rte_esp_tail espt [ num ] ; struct rte_mbuf * ml [ num ] ; const uint32_t tlen = sa -> icv_len + sizeof ( espt [ 0 ] ) + sqh_len ; const uint32_t cofs = sa -> ctp . cipher . offset ; for ( i = 0 ; i != num ; i ++ ) process_step1 ( mb [ i ] , tlen , & ml [ i ] , & espt [ i ] , & hl [ i ] , & to [ i ] ) ; k = 0 ; for ( i = 0 ; i != num ; i ++ ) { tl = tlen + espt [ i ] . pad_len ; l2 = mb [ i ] -> l2_len ; if ( trs_process_check ( mb [ i ] , & ml [ i ] , & to [ i ] , espt [ i ] , hl [ i ] + cofs , tl ) == 0 ) { np = trs_process_step2 ( mb [ i ] , ml [ i ] , hl [ i ] , cofs , to [ i ] , tl , sqn + k ) ; update_trs_l3hdr ( sa , np + l2 , mb [ i ] -> pkt_len , l2 , hl [ i ] - l2 , espt [ i ] . next_proto ) ; trs_process_step3 ( mb [ i ] ) ; k ++ ; } else dr [ i - k ] = i ; } return k ; }
*process* function for tunnel packets
* process * function for tunnel packets
/*
	 * remove icv, esp trailer and high-order
	 * 32 bits of esn from packet length
	 */ /*
	 * to minimize stalls due to load latency,
	 * read mbufs metadata and esp tail first.
	 */ /* check that packet is valid */ /* modify packet's layout */ /* update mbuf's metadata */