MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mbuf_get_seg_ofs

Function mbuf_get_seg_ofs

dpdk/lib/ipsec/misc.h:46–69  ·  view source on GitHub ↗

* Find packet's segment for the specified offset. * ofs - at input should contain required offset, at output would contain * offset value within the segment. */

Source from the content-addressed store, hash-verified

44 * offset value within the segment.
45 */
46static inline struct rte_mbuf *
47mbuf_get_seg_ofs(struct rte_mbuf *mb, uint32_t *ofs)
48{
49 uint32_t k, n, plen;
50 struct rte_mbuf *ms;
51
52 plen = mb->pkt_len;
53 n = *ofs;
54
55 if (n == plen) {
56 ms = rte_pktmbuf_lastseg(mb);
57 n = n + rte_pktmbuf_data_len(ms) - plen;
58 } else {
59 ms = mb;
60 for (k = rte_pktmbuf_data_len(ms); n >= k;
61 k = rte_pktmbuf_data_len(ms)) {
62 ms = ms->next;
63 n -= k;
64 }
65 }
66
67 *ofs = n;
68 return ms;
69}
70
71/*
72 * Trim multi-segment packet at the specified offset, and free

Callers 3

inb_prepareFunction · 0.85
process_step1Function · 0.85
trs_process_checkFunction · 0.85

Calls 1

rte_pktmbuf_lastsegFunction · 0.85

Tested by

no test coverage detected