src/dpdk/lib/librte_ipsec/misc.h
static inline struct rte_mbuf *
mbuf_get_seg_ofs(struct rte_mbuf *mb, uint32_t *ofs)
{
	uint32_t k, n, plen;
	struct rte_mbuf *ms;

	plen = mb->pkt_len;
	n = *ofs;

	if (n == plen) {
		ms = rte_pktmbuf_lastseg(mb);
		n = n + rte_pktmbuf_data_len(ms) - plen;
	} else {
		ms = mb;
		for (k = rte_pktmbuf_data_len(ms); n >= k;
				k = rte_pktmbuf_data_len(ms)) {
			ms = ms->next;
			n -= k;
		}
	}

	*ofs = n;
	return ms;
}
/*
 * Find packet's segment for the specified offset.
 * ofs - at input should contain required offset, at output would contain
 * offset value within the segment.
 */
Find packet's segment for the specified offset.
ofs - at input should contain required offset, at output would contain
offset value within the segment.
Find packet ' s segment for the specified offset . ofs - at input should contain required offset at output would contain offset value within the segment .
static inline struct rte_mbuf *
mbuf_get_seg_ofs(struct rte_mbuf *mb, uint32_t *ofs)
{
	uint32_t k, n, plen;
	struct rte_mbuf *ms;
	plen = mb->pkt_len;
	n = *ofs;
	if (n == plen) {
		ms = rte_pktmbuf_lastseg(mb);
		n = n + rte_pktmbuf_data_len(ms) - plen;
	} else {
		ms = mb;
		for (k = rte_pktmbuf_data_len(ms); n >= k;
				k = rte_pktmbuf_data_len(ms)) {
			ms = ms->next;
			n -= k;
		}
	}
	*ofs = n;
	return ms;
}
static inline struct rte_mbuf * mbuf_get_seg_ofs ( struct rte_mbuf * mb , uint32_t * ofs ) { uint32_t k , n , plen ; struct rte_mbuf * ms ; plen = mb -> pkt_len ; n = * ofs ; if ( n == plen ) { ms = rte_pktmbuf_lastseg ( mb ) ; n = n + rte_pktmbuf_data_len ( ms ) - plen ; } else { ms = mb ; for ( k = rte_pktmbuf_data_len ( ms ) ; n >= k ; k = rte_pktmbuf_data_len ( ms ) ) { ms = ms -> next ; n -= k ; } } * ofs = n ; return ms ; }
Find packet's segment for the specified offset.
Find packet ' s segment for the specified offset .