src/dpdk/lib/librte_ipsec/rte_ipsec_group.h
static inline uint16_t
rte_ipsec_pkt_crypto_group(const struct rte_crypto_op *cop[],
	struct rte_mbuf *mb[], struct rte_ipsec_group grp[], uint16_t num)
{
	uint32_t i, j, k, n;
	void *ns, *ps;
	struct rte_mbuf *m, *dr[num];

	j = 0;
	k = 0;
	n = 0;
	ps = NULL;

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

		m = cop[i]->sym[0].m_src;
		ns = cop[i]->sym[0].session;

		m->ol_flags |= PKT_RX_SEC_OFFLOAD;
		if (cop[i]->status != RTE_CRYPTO_OP_STATUS_SUCCESS)
			m->ol_flags |= PKT_RX_SEC_OFFLOAD_FAILED;

		/* no valid session found */
		if (ns == NULL) {
			dr[k++] = m;
			continue;
		}

		/* different SA */
		if (ps != ns) {

			/*
			 * we already have an open group - finalize it,
			 * then open a new one.
			 */
			if (ps != NULL) {
				grp[n].id.ptr =
					rte_ipsec_ses_from_crypto(cop[i - 1]);
				grp[n].cnt = mb + j - grp[n].m;
				n++;
			}

			/* start new group */
			grp[n].m = mb + j;
			ps = ns;
		}

		mb[j++] = m;
	}

	/* finalise last group */
	if (ps != NULL) {
		grp[n].id.ptr = rte_ipsec_ses_from_crypto(cop[i - 1]);
		grp[n].cnt = mb + j - grp[n].m;
		n++;
	}

	/* copy mbufs with unknown session beyond recognised ones */
	if (k != 0 && k != num) {
		for (i = 0; i != k; i++)
			mb[j + i] = dr[i];
	}

	return n;
}
/**
 * Take as input completed crypto ops, extract related mbufs
 * and group them by rte_ipsec_session they belong to.
 * For mbuf which crypto-op wasn't completed successfully
 * PKT_RX_SEC_OFFLOAD_FAILED will be raised in ol_flags.
 * Note that mbufs with undetermined SA (session-less) are not freed
 * by the function, but are placed beyond mbufs for the last valid group.
 * It is a user responsibility to handle them further.
 * @param cop
 *   The address of an array of *num* pointers to the input *rte_crypto_op*
 *   structures.
 * @param mb
 *   The address of an array of *num* pointers to output *rte_mbuf* structures.
 * @param grp
 *   The address of an array of *num* to output *rte_ipsec_group* structures.
 * @param num
 *   The maximum number of crypto-ops to process.
 * @return
 *   Number of filled elements in *grp* array.
 */
Take as input completed crypto ops, extract related mbufs
and group them by rte_ipsec_session they belong to.
For mbuf which crypto-op wasn't completed successfully
PKT_RX_SEC_OFFLOAD_FAILED will be raised in ol_flags.
Note that mbufs with undetermined SA (session-less) are not freed
by the function, but are placed beyond mbufs for the last valid group.
It is a user responsibility to handle them further.
@param cop
The address of an array of *num* pointers to the input *rte_crypto_op
structures.
@param mb
The address of an array of *num* pointers to output *rte_mbuf* structures.
@param grp
The address of an array of *num* to output *rte_ipsec_group* structures.
@param num
The maximum number of crypto-ops to process.
@return
Number of filled elements in *grp* array.
Take as input completed crypto ops extract related mbufs and group them by rte_ipsec_session they belong to . For mbuf which crypto - op wasn ' t completed successfully PKT_RX_SEC_OFFLOAD_FAILED will be raised in ol_flags . Note that mbufs with undetermined SA ( session - less ) are not freed by the function but are placed beyond mbufs for the last valid group . It is a user responsibility to handle them further . @param cop The address of an array of * num * pointers to the input * rte_crypto_op structures . @param mb The address of an array of * num * pointers to output * rte_mbuf * structures . @param grp The address of an array of * num * to output * rte_ipsec_group * structures . @param num The maximum number of crypto - ops to process . @return Number of filled elements in * grp * array .
static inline uint16_t
rte_ipsec_pkt_crypto_group(const struct rte_crypto_op *cop[],
	struct rte_mbuf *mb[], struct rte_ipsec_group grp[], uint16_t num)
{
	uint32_t i, j, k, n;
	void *ns, *ps;
	struct rte_mbuf *m, *dr[num];
	j = 0;
	k = 0;
	n = 0;
	ps = NULL;
	for (i = 0; i != num; i++) {
		m = cop[i]->sym[0].m_src;
		ns = cop[i]->sym[0].session;
		m->ol_flags |= PKT_RX_SEC_OFFLOAD;
		if (cop[i]->status != RTE_CRYPTO_OP_STATUS_SUCCESS)
			m->ol_flags |= PKT_RX_SEC_OFFLOAD_FAILED;
		if (ns == NULL) {
			dr[k++] = m;
			continue;
		}
		if (ps != ns) {
			if (ps != NULL) {
				grp[n].id.ptr =
					rte_ipsec_ses_from_crypto(cop[i - 1]);
				grp[n].cnt = mb + j - grp[n].m;
				n++;
			}
			grp[n].m = mb + j;
			ps = ns;
		}
		mb[j++] = m;
	}
	if (ps != NULL) {
		grp[n].id.ptr = rte_ipsec_ses_from_crypto(cop[i - 1]);
		grp[n].cnt = mb + j - grp[n].m;
		n++;
	}
	if (k != 0 && k != num) {
		for (i = 0; i != k; i++)
			mb[j + i] = dr[i];
	}
	return n;
}
static inline uint16_t rte_ipsec_pkt_crypto_group ( const struct rte_crypto_op * cop [ ] , struct rte_mbuf * mb [ ] , struct rte_ipsec_group grp [ ] , uint16_t num ) { uint32_t i , j , k , n ; void * ns , * ps ; struct rte_mbuf * m , * dr [ num ] ; j = 0 ; k = 0 ; n = 0 ; ps = NULL ; for ( i = 0 ; i != num ; i ++ ) { m = cop [ i ] -> sym [ 0 ] . m_src ; ns = cop [ i ] -> sym [ 0 ] . session ; m -> ol_flags |= PKT_RX_SEC_OFFLOAD ; if ( cop [ i ] -> status != RTE_CRYPTO_OP_STATUS_SUCCESS ) m -> ol_flags |= PKT_RX_SEC_OFFLOAD_FAILED ; if ( ns == NULL ) { dr [ k ++ ] = m ; continue ; } if ( ps != ns ) { if ( ps != NULL ) { grp [ n ] . id . ptr = rte_ipsec_ses_from_crypto ( cop [ i - 1 ] ) ; grp [ n ] . cnt = mb + j - grp [ n ] . m ; n ++ ; } grp [ n ] . m = mb + j ; ps = ns ; } mb [ j ++ ] = m ; } if ( ps != NULL ) { grp [ n ] . id . ptr = rte_ipsec_ses_from_crypto ( cop [ i - 1 ] ) ; grp [ n ] . cnt = mb + j - grp [ n ] . m ; n ++ ; } if ( k != 0 && k != num ) { for ( i = 0 ; i != k ; i ++ ) mb [ j + i ] = dr [ i ] ; } return n ; }
Take as input completed crypto ops, extract related mbufs
 and group them by rte_ipsec_session they belong to.
Take as input completed crypto ops extract related mbufs and group them by rte_ipsec_session they belong to .
/* no valid session found */ /* different SA */ /*
			 * we already have an open group - finalize it,
			 * then open a new one.
			 */ /* start new group */ /* finalise last group */ /* copy mbufs with unknown session beyond recognised ones */