Lines Matching +full:- +full:m1

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
30 * IPsec-specific mbuf routines.
62 for (m = m0; m && skip > m->m_len; m = m->m_next) in m_makespace()
63 skip -= m->m_len; in m_makespace()
74 remain = m->m_len - skip; /* data to move */ in m_makespace()
79 * XXX: which operation is the most heavy - copying of in m_makespace()
85 m->m_data -= hlen; in m_makespace()
87 m->m_len += hlen; in m_makespace()
99 n = m_getcl(M_NOWAIT, m->m_type, 0); in m_makespace()
103 n = m_get(M_NOWAIT, m->m_type); in m_makespace()
111 np = &n->m_next; in m_makespace()
113 memcpy(n->m_data, mtod(m, char *) + skip + done, len); in m_makespace()
114 n->m_len = len; in m_makespace()
116 todo -= len; in m_makespace()
120 m->m_len = skip + hlen; in m_makespace()
123 *np = m->m_next; in m_makespace()
124 m->m_next = n0; in m_makespace()
128 n = m_get(M_NOWAIT, m->m_type); in m_makespace()
134 if ((n->m_next = n0) == NULL) in m_makespace()
135 np = &n->m_next; in m_makespace()
138 *np = m->m_next; in m_makespace()
139 m->m_next = n0; in m_makespace()
141 n->m_len = hlen; in m_makespace()
142 m->m_len = skip; in m_makespace()
155 m->m_len += hlen; in m_makespace()
158 m0->m_pkthdr.len += hlen; /* adjust packet length */ in m_makespace()
170 struct mbuf *m0, *m1; in m_pad() local
180 len = m->m_pkthdr.len; in m_pad()
184 while (m0->m_len < len) { in m_pad()
185 len -= m0->m_len; in m_pad()
186 m0 = m0->m_next; in m_pad()
189 if (m0->m_len != len) { in m_pad()
191 __func__, m->m_pkthdr.len, in m_pad()
192 m->m_pkthdr.len + m0->m_len - len)); in m_pad()
198 /* Check for zero-length trailing mbufs, and find the last one. */ in m_pad()
199 for (m1 = m0; m1->m_next; m1 = m1->m_next) { in m_pad()
200 if (m1->m_next->m_len != 0) { in m_pad()
203 m->m_pkthdr.len, in m_pad()
204 m->m_pkthdr.len + m1->m_next->m_len)); in m_pad()
210 m0 = m1->m_next; in m_pad()
215 MGET(m1, M_NOWAIT, MT_DATA); in m_pad()
216 if (m1 == NULL) { in m_pad()
222 m0->m_next = m1; in m_pad()
223 m0 = m1; in m_pad()
224 m0->m_len = 0; in m_pad()
227 retval = m0->m_data + m0->m_len; in m_pad()
228 m0->m_len += pad; in m_pad()
229 m->m_pkthdr.len += pad; in m_pad()
242 struct mbuf *m1; in m_striphdr() local
246 m1 = m_getptr(m, skip, &roff); in m_striphdr()
247 if (m1 == NULL) in m_striphdr()
254 m_adj(m1, hlen); in m_striphdr()
255 if (m1 != m) in m_striphdr()
256 m->m_pkthdr.len -= hlen; in m_striphdr()
257 } else if (roff + hlen >= m1->m_len) { in m_striphdr()
267 if (roff + hlen > m1->m_len) { in m_striphdr()
268 adjlen = roff + hlen - m1->m_len; in m_striphdr()
271 m_adj(m1->m_next, adjlen); in m_striphdr()
274 m->m_pkthdr.len -= adjlen; in m_striphdr()
278 mo = m1->m_next; in m_striphdr()
279 m1->m_next = NULL; in m_striphdr()
282 adjlen = m1->m_len - roff; in m_striphdr()
283 m_adj(m1, -adjlen); in m_striphdr()
284 if (m1 != m) in m_striphdr()
285 m->m_pkthdr.len -= adjlen; in m_striphdr()
288 m1->m_next = mo; in m_striphdr()
295 bcopy(mtod(m1, u_char *) + roff + hlen, in m_striphdr()
296 mtod(m1, u_char *) + roff, in m_striphdr()
297 m1->m_len - (roff + hlen)); in m_striphdr()
298 m1->m_len -= hlen; in m_striphdr()
299 m->m_pkthdr.len -= hlen; in m_striphdr()
326 mlen = m->m_len; in m_checkalignment()
329 len -= mlen; in m_checkalignment()
334 m = m->m_next; in m_checkalignment()
337 for (m = m0; m; m = m->m_next) in m_checkalignment()
338 printf(" [%p:%u]", mtod(m, caddr_t), m->m_len); in m_checkalignment()