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

Function mbuf_cut_seg_ofs

dpdk/lib/ipsec/misc.h:83–106  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

81 * mbuf_cut_seg_ofs(mb, ms, ofs, mb->pkt_len - new_len);
82 */
83static inline void
84mbuf_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.

Callers 1

tun_process_step2Function · 0.85

Calls 1

rte_pktmbuf_free_segFunction · 0.85

Tested by

no test coverage detected