* Trim multi-segment packet at the specified offset, and free * all unused segments. * mb - input packet * ms - segment where to cut * ofs - offset within the *ms* * len - length to cut (from given offset to the end of the packet) * Can be used in conjunction with mbuf_get_seg_ofs(): * ofs = new_len; * ms = mbuf_get_seg_ofs(mb, &ofs); * mbuf_cut_seg_ofs(mb, ms, ofs, mb->pkt_len - new_len)
| 81 | * mbuf_cut_seg_ofs(mb, ms, ofs, mb->pkt_len - new_len); |
| 82 | */ |
| 83 | static inline void |
| 84 | mbuf_cut_seg_ofs(struct rte_mbuf *mb, struct rte_mbuf *ms, uint32_t ofs, |
| 85 | uint32_t len) |
| 86 | { |
| 87 | uint32_t n, slen; |
| 88 | struct rte_mbuf *mn; |
| 89 | |
| 90 | slen = ms->data_len; |
| 91 | ms->data_len = ofs; |
| 92 | |
| 93 | /* tail spawns through multiple segments */ |
| 94 | if (slen < ofs + len) { |
| 95 | mn = ms->next; |
| 96 | ms->next = NULL; |
| 97 | for (n = 0; mn != NULL; n++) { |
| 98 | ms = mn->next; |
| 99 | rte_pktmbuf_free_seg(mn); |
| 100 | mn = ms; |
| 101 | } |
| 102 | mb->nb_segs -= n; |
| 103 | } |
| 104 | |
| 105 | mb->pkt_len -= len; |
| 106 | } |
| 107 | |
| 108 | /* |
| 109 | * process packets using sync crypto engine. |
no test coverage detected