* Find packet's segment for the specified offset. * ofs - at input should contain required offset, at output would contain * offset value within the segment. */
| 44 | * offset value within the segment. |
| 45 | */ |
| 46 | static inline struct rte_mbuf * |
| 47 | mbuf_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 |
no test coverage detected