Lines Matching +full:0 +full:m
74 static void sbcompress_ktls_rx(struct sockbuf *sb, struct mbuf *m,
84 sbm_clrprotoflags(struct mbuf *m, int flags) in sbm_clrprotoflags() argument
91 while (m) { in sbm_clrprotoflags()
92 m->m_flags &= mask; in sbm_clrprotoflags()
93 m = m->m_next; in sbm_clrprotoflags()
109 struct mbuf *m, *n; in sbready_compress() local
114 if ((sb->sb_flags & SB_NOCOALESCE) != 0) in sbready_compress()
117 for (m = m0; m != end; m = m->m_next) { in sbready_compress()
118 MPASS((m->m_flags & M_NOTREADY) == 0); in sbready_compress()
121 * socket buffer and 'm' is the new mbuf being copied in sbready_compress()
123 * are reversed and 'n' is the next mbuf after 'm' in sbready_compress()
125 * 'm'. in sbready_compress()
127 n = m->m_next; in sbready_compress()
130 if ((n != NULL) && (n != end) && (m->m_flags & M_EOR) == 0 && in sbready_compress()
131 (m->m_flags & M_EXTPG) && in sbready_compress()
133 !mbuf_has_tls_session(m) && in sbready_compress()
138 trail_len = m->m_epg_trllen; in sbready_compress()
139 if (trail_len != 0 && hdr_len != 0 && in sbready_compress()
141 /* copy n's header to m's trailer */ in sbready_compress()
142 memcpy(&m->m_epg_trail[trail_len], in sbready_compress()
144 m->m_epg_trllen += hdr_len; in sbready_compress()
145 m->m_len += hdr_len; in sbready_compress()
146 n->m_epg_hdrlen = 0; in sbready_compress()
153 if ((m->m_flags & M_EXTPG) && m->m_len <= MLEN && in sbready_compress()
154 !mbuf_has_tls_session(m)) { in sbready_compress()
155 ext_size = m->m_ext.ext_size; in sbready_compress()
156 if (mb_unmapped_compress(m) == 0) in sbready_compress()
160 while ((n != NULL) && (n != end) && (m->m_flags & M_EOR) == 0 && in sbready_compress()
161 M_WRITABLE(m) && in sbready_compress()
162 (m->m_flags & M_EXTPG) == 0 && in sbready_compress()
164 !mbuf_has_tls_session(m) && in sbready_compress()
166 n->m_len <= M_TRAILINGSPACE(m) && in sbready_compress()
167 m->m_type == n->m_type) { in sbready_compress()
170 __func__, n, m)); in sbready_compress()
171 m_copydata(n, 0, n->m_len, mtodo(m, m->m_len)); in sbready_compress()
172 m->m_len += n->m_len; in sbready_compress()
173 m->m_next = n->m_next; in sbready_compress()
174 m->m_flags |= n->m_flags & M_EOR; in sbready_compress()
176 sb->sb_mbtail = m; in sbready_compress()
182 n = m->m_next; in sbready_compress()
190 * Mark ready "count" units of I/O starting with "m". Most mbufs
197 struct mbuf *m; in sbready() local
202 KASSERT(count > 0, ("%s: invalid count %d", __func__, count)); in sbready()
204 m = m0; in sbready()
205 blocker = (sb->sb_fnrdy == m) ? M_BLOCKED : 0; in sbready()
207 while (count > 0) { in sbready()
208 KASSERT(m->m_flags & M_NOTREADY, in sbready()
209 ("%s: m %p !M_NOTREADY", __func__, m)); in sbready()
210 if ((m->m_flags & M_EXTPG) != 0 && m->m_epg_npgs != 0) { in sbready()
211 if (count < m->m_epg_nrdy) { in sbready()
212 m->m_epg_nrdy -= count; in sbready()
213 count = 0; in sbready()
216 count -= m->m_epg_nrdy; in sbready()
217 m->m_epg_nrdy = 0; in sbready()
221 m->m_flags &= ~(M_NOTREADY | blocker); in sbready()
223 sb->sb_acc += m->m_len; in sbready()
224 m = m->m_next; in sbready()
232 if (m0 == m) { in sbready()
233 MPASS(m->m_flags & M_NOTREADY); in sbready()
238 sbready_compress(sb, m0, m); in sbready()
243 for (; m && (m->m_flags & M_NOTREADY) == 0; m = m->m_next) { in sbready()
244 KASSERT(m->m_flags & M_BLOCKED, in sbready()
245 ("%s: m %p !M_BLOCKED", __func__, m)); in sbready()
246 m->m_flags &= ~M_BLOCKED; in sbready()
247 sb->sb_acc += m->m_len; in sbready()
250 sb->sb_fnrdy = m; in sbready()
251 sbready_compress(sb, m0, m); in sbready()
253 return (0); in sbready()
257 * Adjust sockbuf state reflecting allocation of m.
260 sballoc(struct sockbuf *sb, struct mbuf *m) in sballoc() argument
265 sb->sb_ccc += m->m_len; in sballoc()
268 if (m->m_flags & M_NOTREADY) in sballoc()
269 sb->sb_fnrdy = m; in sballoc()
271 sb->sb_acc += m->m_len; in sballoc()
273 m->m_flags |= M_BLOCKED; in sballoc()
275 if (m->m_type != MT_DATA && m->m_type != MT_OOBDATA) in sballoc()
276 sb->sb_ctl += m->m_len; in sballoc()
280 if (m->m_flags & M_EXT) in sballoc()
281 sb->sb_mbcnt += m->m_ext.ext_size; in sballoc()
285 * Adjust sockbuf state reflecting freeing of m.
288 sbfree(struct sockbuf *sb, struct mbuf *m) in sbfree() argument
291 #if 0 /* XXX: not yet: soclose() call path comes here w/o lock. */ in sbfree()
295 sb->sb_ccc -= m->m_len; in sbfree()
297 if (!(m->m_flags & M_NOTAVAIL)) in sbfree()
298 sb->sb_acc -= m->m_len; in sbfree()
300 if (m == sb->sb_fnrdy) { in sbfree()
303 KASSERT(m->m_flags & M_NOTREADY, in sbfree()
304 ("%s: m %p !M_NOTREADY", __func__, m)); in sbfree()
306 n = m->m_next; in sbfree()
315 if (m->m_type != MT_DATA && m->m_type != MT_OOBDATA) in sbfree()
316 sb->sb_ctl -= m->m_len; in sbfree()
319 if (m->m_flags & M_EXT) in sbfree()
320 sb->sb_mbcnt -= m->m_ext.ext_size; in sbfree()
322 if (sb->sb_sndptr == m) { in sbfree()
324 sb->sb_sndptroff = 0; in sbfree()
326 if (sb->sb_sndptroff != 0) in sbfree()
327 sb->sb_sndptroff -= m->m_len; in sbfree()
337 sballoc_ktls_rx(struct sockbuf *sb, struct mbuf *m) in sballoc_ktls_rx() argument
342 sb->sb_ccc += m->m_len; in sballoc_ktls_rx()
343 sb->sb_tlscc += m->m_len; in sballoc_ktls_rx()
347 if (m->m_flags & M_EXT) in sballoc_ktls_rx()
348 sb->sb_mbcnt += m->m_ext.ext_size; in sballoc_ktls_rx()
352 sbfree_ktls_rx(struct sockbuf *sb, struct mbuf *m) in sbfree_ktls_rx() argument
355 #if 0 /* XXX: not yet: soclose() call path comes here w/o lock. */ in sbfree_ktls_rx()
359 sb->sb_ccc -= m->m_len; in sbfree_ktls_rx()
360 sb->sb_tlscc -= m->m_len; in sbfree_ktls_rx()
364 if (m->m_flags & M_EXT) in sbfree_ktls_rx()
365 sb->sb_mbcnt -= m->m_ext.ext_size; in sbfree_ktls_rx()
460 sb->sb_timeo, 0, 0)); in sbwait()
491 KNOTE_LOCKED(&sb->sb_sel->si_note, 0); in sowakeup()
507 pgsigio(&so->so_sigio, SIGIO, 0); in sowakeup()
544 SB_UPCALL | SB_AIO | SB_KNOTE)) != 0); in sb_notify()
609 if (sbreserve_locked(so, SO_SND, sndcc, td) == 0) in soreserve()
611 if (sbreserve_locked(so, SO_RCV, rcvcc, td) == 0) in soreserve()
613 if (so->so_rcv.sb_lowat == 0) in soreserve()
615 if (so->so_snd.sb_lowat == 0) in soreserve()
621 return (0); in soreserve()
633 int error = 0; in sysctl_handle_sb_max()
643 return (0); in sysctl_handle_sb_max()
698 if (error != 0) in sbsetopt()
745 error = 0; in sbsetopt()
761 if (error == 0) in sbsetopt()
789 (void)chgsbsize(so->so_cred->cr_uidinfo, &sb->sb_hiwat, 0, in sbrelease_internal()
791 sb->sb_mbmax = 0; in sbrelease_internal()
851 struct mbuf *m = sb->sb_mb; in sblastrecordchk() local
855 while (m && m->m_nextpkt) in sblastrecordchk()
856 m = m->m_nextpkt; in sblastrecordchk()
858 if (m != sb->sb_lastrecord) { in sblastrecordchk()
860 __func__, sb->sb_mb, sb->sb_lastrecord, m); in sblastrecordchk()
862 for (m = sb->sb_mb; m != NULL; m = m->m_nextpkt) in sblastrecordchk()
863 printf("\t%p\n", m); in sblastrecordchk()
871 struct mbuf *m = sb->sb_mb; in sblastmbufchk() local
876 while (m && m->m_nextpkt) in sblastmbufchk()
877 m = m->m_nextpkt; in sblastmbufchk()
879 while (m && m->m_next) in sblastmbufchk()
880 m = m->m_next; in sblastmbufchk()
882 if (m != sb->sb_mbtail) { in sblastmbufchk()
884 __func__, sb->sb_mb, sb->sb_mbtail, m); in sblastmbufchk()
886 for (m = sb->sb_mb; m != NULL; m = m->m_nextpkt) { in sblastmbufchk()
888 for (n = m; n != NULL; n = n->m_next) in sblastmbufchk()
896 m = sb->sb_mtls; in sblastmbufchk()
897 while (m && m->m_next) in sblastmbufchk()
898 m = m->m_next; in sblastmbufchk()
900 if (m != sb->sb_mtlstail) { in sblastmbufchk()
902 __func__, sb->sb_mtls, sb->sb_mtlstail, m); in sblastmbufchk()
905 for (m = sb->sb_mtls; m != NULL; m = m->m_next) { in sblastmbufchk()
906 printf("%p ", m); in sblastmbufchk()
922 } while (/*CONSTCOND*/0)
925 * Append mbuf chain m to the last record in the socket buffer sb. The
930 sbappend_locked(struct sockbuf *sb, struct mbuf *m, int flags) in sbappend_locked() argument
936 if (m == NULL) in sbappend_locked()
938 kmsan_check_mbuf(m, "sbappend"); in sbappend_locked()
939 sbm_clrprotoflags(m, flags); in sbappend_locked()
947 sbappendrecord_locked(sb, m); /* XXXXXX!!!! */ in sbappend_locked()
960 sbappendrecord_locked(sb, m); /* XXXXXX!!!! */ in sbappend_locked()
969 sb->sb_lastrecord = m; in sbappend_locked()
972 sbcompress(sb, m, n); in sbappend_locked()
977 * Append mbuf chain m to the last record in the socket buffer sb. The
982 sbappend(struct sockbuf *sb, struct mbuf *m, int flags) in sbappend() argument
986 sbappend_locked(sb, m, flags); in sbappend()
997 sbappend_ktls_rx(struct sockbuf *sb, struct mbuf *m) in sbappend_ktls_rx() argument
1009 MPASS((m->m_flags & M_PKTHDR) != 0); in sbappend_ktls_rx()
1012 for (n = m; n != NULL; n = n->m_next) { in sbappend_ktls_rx()
1014 ifp = m->m_pkthdr.leaf_rcvif; in sbappend_ktls_rx()
1028 MPASS((n->m_flags & M_NOTREADY) != 0); in sbappend_ktls_rx()
1031 sbcompress_ktls_rx(sb, m, sb->sb_mtlstail); in sbappend_ktls_rx()
1047 sbappendstream_locked(struct sockbuf *sb, struct mbuf *m, int flags) in sbappendstream_locked() argument
1051 KASSERT(m->m_nextpkt == NULL,("sbappendstream 0")); in sbappendstream_locked()
1053 kmsan_check_mbuf(m, "sbappend"); in sbappendstream_locked()
1062 sbappend_ktls_rx(sb, m); in sbappendstream_locked()
1073 ktls_seq(sb, m); in sbappendstream_locked()
1077 m_demote(m, 1, flags & PRUS_NOTREADY ? M_NOTREADY : 0); in sbappendstream_locked()
1079 sbcompress(sb, m, sb->sb_mbtail); in sbappendstream_locked()
1091 sbappendstream(struct sockbuf *sb, struct mbuf *m, int flags) in sbappendstream() argument
1095 sbappendstream_locked(sb, m, flags); in sbappendstream()
1103 struct mbuf *m, *n, *fnrdy; in sbcheck() local
1111 acc = ccc = mbcnt = 0; in sbcheck()
1114 for (m = sb->sb_mb; m; m = n) { in sbcheck()
1115 n = m->m_nextpkt; in sbcheck()
1116 for (; m; m = m->m_next) { in sbcheck()
1117 if (m->m_len == 0) { in sbcheck()
1118 printf("sb %p empty mbuf %p\n", sb, m); in sbcheck()
1121 if ((m->m_flags & M_NOTREADY) && fnrdy == NULL) { in sbcheck()
1122 if (m != sb->sb_fnrdy) { in sbcheck()
1123 printf("sb %p: fnrdy %p != m %p\n", in sbcheck()
1124 sb, sb->sb_fnrdy, m); in sbcheck()
1127 fnrdy = m; in sbcheck()
1130 if (!(m->m_flags & M_NOTAVAIL)) { in sbcheck()
1131 printf("sb %p: fnrdy %p, m %p is avail\n", in sbcheck()
1132 sb, sb->sb_fnrdy, m); in sbcheck()
1136 acc += m->m_len; in sbcheck()
1137 ccc += m->m_len; in sbcheck()
1139 if (m->m_flags & M_EXT) /*XXX*/ /* pretty sure this is bogus */ in sbcheck()
1140 mbcnt += m->m_ext.ext_size; in sbcheck()
1153 tlscc = 0; in sbcheck()
1154 for (m = sb->sb_mtls; m; m = m->m_next) { in sbcheck()
1155 if (m->m_nextpkt != NULL) { in sbcheck()
1156 printf("sb %p TLS mbuf %p with nextpkt\n", sb, m); in sbcheck()
1159 if ((m->m_flags & M_NOTREADY) == 0) { in sbcheck()
1160 printf("sb %p TLS mbuf %p ready\n", sb, m); in sbcheck()
1163 tlscc += m->m_len; in sbcheck()
1164 ccc += m->m_len; in sbcheck()
1166 if (m->m_flags & M_EXT) /*XXX*/ /* pretty sure this is bogus */ in sbcheck()
1167 mbcnt += m->m_ext.ext_size; in sbcheck()
1197 struct mbuf *m; in sbappendrecord_locked() local
1215 m = m0->m_next; in sbappendrecord_locked()
1216 m0->m_next = 0; in sbappendrecord_locked()
1217 if (m && (m0->m_flags & M_EOR)) { in sbappendrecord_locked()
1219 m->m_flags |= M_EOR; in sbappendrecord_locked()
1222 sbcompress(sb, m, m0); in sbappendrecord_locked()
1242 struct mbuf *m, *n, *nlast; in sbappendaddr_locked_internal() local
1251 return (0); in sbappendaddr_locked_internal()
1253 m = m_get(M_NOWAIT, MT_SONAME); in sbappendaddr_locked_internal()
1254 if (m == NULL) in sbappendaddr_locked_internal()
1255 return (0); in sbappendaddr_locked_internal()
1256 m->m_len = asa->sa_len; in sbappendaddr_locked_internal()
1257 bcopy(asa, mtod(m, caddr_t), asa->sa_len); in sbappendaddr_locked_internal()
1268 m0->m_pkthdr.flowid = 0; in sbappendaddr_locked_internal()
1269 m0->m_pkthdr.csum_flags = 0; in sbappendaddr_locked_internal()
1270 m0->m_pkthdr.fibnum = 0; in sbappendaddr_locked_internal()
1271 m0->m_pkthdr.rsstype = 0; in sbappendaddr_locked_internal()
1277 m->m_next = control; in sbappendaddr_locked_internal()
1278 for (n = m; n->m_next != NULL; n = n->m_next) in sbappendaddr_locked_internal()
1282 SBLINKRECORD(sb, m); in sbappendaddr_locked_internal()
1294 * with total length. Returns 0 if no space in sockbuf or insufficient
1306 if (m0 && (m0->m_flags & M_PKTHDR) == 0) in sbappendaddr_locked()
1313 return (0); in sbappendaddr_locked()
1320 * with total length. Returns 0 if insufficient mbufs. Does not validate space
1338 * with total length. Returns 0 if no space in sockbuf or insufficient
1357 struct mbuf *m, *mlast; in sbappendcontrol_locked() local
1368 for (m = control; m->m_next; m = m->m_next) in sbappendcontrol_locked()
1369 sballoc(sb, m); in sbappendcontrol_locked()
1370 sballoc(sb, m); in sbappendcontrol_locked()
1371 mlast = m; in sbappendcontrol_locked()
1391 * Append the data in mbuf chain (m) into the socket buffer sb following mbuf
1411 sbcompress(struct sockbuf *sb, struct mbuf *m, struct mbuf *n) in sbcompress() argument
1413 int eor = 0; in sbcompress()
1418 while (m) { in sbcompress()
1419 eor |= m->m_flags & M_EOR; in sbcompress()
1420 if (m->m_len == 0 && in sbcompress()
1421 (eor == 0 || in sbcompress()
1422 (((o = m->m_next) || (o = n)) && in sbcompress()
1423 o->m_type == m->m_type))) { in sbcompress()
1424 if (sb->sb_lastrecord == m) in sbcompress()
1425 sb->sb_lastrecord = m->m_next; in sbcompress()
1426 m = m_free(m); in sbcompress()
1429 if (n && (n->m_flags & M_EOR) == 0 && in sbcompress()
1431 ((sb->sb_flags & SB_NOCOALESCE) == 0) && in sbcompress()
1432 !(m->m_flags & M_NOTREADY) && in sbcompress()
1434 !mbuf_has_tls_session(m) && in sbcompress()
1436 m->m_len <= MCLBYTES / 4 && /* XXX: Don't copy too much */ in sbcompress()
1437 m->m_len <= M_TRAILINGSPACE(n) && in sbcompress()
1438 n->m_type == m->m_type) { in sbcompress()
1439 m_copydata(m, 0, m->m_len, mtodo(n, n->m_len)); in sbcompress()
1440 n->m_len += m->m_len; in sbcompress()
1441 sb->sb_ccc += m->m_len; in sbcompress()
1443 sb->sb_acc += m->m_len; in sbcompress()
1444 if (m->m_type != MT_DATA && m->m_type != MT_OOBDATA) in sbcompress()
1446 sb->sb_ctl += m->m_len; in sbcompress()
1447 m = m_free(m); in sbcompress()
1450 if (m->m_len <= MLEN && (m->m_flags & M_EXTPG) && in sbcompress()
1451 (m->m_flags & M_NOTREADY) == 0 && in sbcompress()
1452 !mbuf_has_tls_session(m)) in sbcompress()
1453 (void)mb_unmapped_compress(m); in sbcompress()
1455 n->m_next = m; in sbcompress()
1457 sb->sb_mb = m; in sbcompress()
1458 sb->sb_mbtail = m; in sbcompress()
1459 sballoc(sb, m); in sbcompress()
1460 n = m; in sbcompress()
1461 m->m_flags &= ~M_EOR; in sbcompress()
1462 m = m->m_next; in sbcompress()
1463 n->m_next = 0; in sbcompress()
1479 sbcompress_ktls_rx(struct sockbuf *sb, struct mbuf *m, struct mbuf *n) in sbcompress_ktls_rx() argument
1484 while (m) { in sbcompress_ktls_rx()
1485 KASSERT((m->m_flags & M_EOR) == 0, in sbcompress_ktls_rx()
1486 ("TLS RX mbuf %p with EOR", m)); in sbcompress_ktls_rx()
1487 KASSERT(m->m_type == MT_DATA, in sbcompress_ktls_rx()
1488 ("TLS RX mbuf %p is not MT_DATA", m)); in sbcompress_ktls_rx()
1489 KASSERT((m->m_flags & M_NOTREADY) != 0, in sbcompress_ktls_rx()
1490 ("TLS RX mbuf %p ready", m)); in sbcompress_ktls_rx()
1491 KASSERT((m->m_flags & M_EXTPG) == 0, in sbcompress_ktls_rx()
1492 ("TLS RX mbuf %p unmapped", m)); in sbcompress_ktls_rx()
1494 if (m->m_len == 0) { in sbcompress_ktls_rx()
1495 m = m_free(m); in sbcompress_ktls_rx()
1500 * Even though both 'n' and 'm' are NOTREADY, it's ok in sbcompress_ktls_rx()
1505 ((sb->sb_flags & SB_NOCOALESCE) == 0) && in sbcompress_ktls_rx()
1506 !((m->m_flags ^ n->m_flags) & M_DECRYPTED) && in sbcompress_ktls_rx()
1508 m->m_len <= MCLBYTES / 4 && /* XXX: Don't copy too much */ in sbcompress_ktls_rx()
1509 m->m_len <= M_TRAILINGSPACE(n)) { in sbcompress_ktls_rx()
1510 m_copydata(m, 0, m->m_len, mtodo(n, n->m_len)); in sbcompress_ktls_rx()
1511 n->m_len += m->m_len; in sbcompress_ktls_rx()
1512 sb->sb_ccc += m->m_len; in sbcompress_ktls_rx()
1513 sb->sb_tlscc += m->m_len; in sbcompress_ktls_rx()
1514 m = m_free(m); in sbcompress_ktls_rx()
1518 n->m_next = m; in sbcompress_ktls_rx()
1520 sb->sb_mtls = m; in sbcompress_ktls_rx()
1521 sb->sb_mtlstail = m; in sbcompress_ktls_rx()
1522 sballoc_ktls_rx(sb, m); in sbcompress_ktls_rx()
1523 n = m; in sbcompress_ktls_rx()
1524 m = m->m_next; in sbcompress_ktls_rx()
1540 * Don't call sbcut(sb, 0) if the leading mbuf is non-empty: in sbflush_internal()
1543 if (sb->sb_ccc == 0 && (sb->sb_mb == NULL || sb->sb_mb->m_len)) in sbflush_internal()
1547 KASSERT(sb->sb_ccc == 0 && sb->sb_mb == 0 && sb->sb_mbcnt == 0, in sbflush_internal()
1575 struct mbuf *m, *next, *mfree; in sbcut_internal() local
1578 KASSERT(len >= 0, ("%s: len is %d but it is supposed to be >= 0", in sbcut_internal()
1583 next = (m = sb->sb_mb) ? m->m_nextpkt : 0; in sbcut_internal()
1587 while (len > 0) { in sbcut_internal()
1588 if (m == NULL) { in sbcut_internal()
1591 if (sb->sb_tlsdcc != 0) { in sbcut_internal()
1595 sb->sb_tlsdcc = 0; in sbcut_internal()
1596 if (len == 0) in sbcut_internal()
1604 m = next; in sbcut_internal()
1605 next = m->m_nextpkt; in sbcut_internal()
1607 if (m->m_len > len) { in sbcut_internal()
1608 KASSERT(!(m->m_flags & M_NOTAVAIL), in sbcut_internal()
1609 ("%s: m %p M_NOTAVAIL", __func__, m)); in sbcut_internal()
1610 m->m_len -= len; in sbcut_internal()
1611 m->m_data += len; in sbcut_internal()
1614 if (sb->sb_sndptroff != 0) in sbcut_internal()
1616 if (m->m_type != MT_DATA && m->m_type != MT_OOBDATA) in sbcut_internal()
1620 len -= m->m_len; in sbcut_internal()
1623 sbfree_ktls_rx(sb, m); in sbcut_internal()
1626 sbfree(sb, m); in sbcut_internal()
1631 if (m->m_flags & M_NOTREADY && !is_tls) in sbcut_internal()
1632 m = m->m_next; in sbcut_internal()
1636 n = m->m_next; in sbcut_internal()
1637 m->m_next = mfree; in sbcut_internal()
1638 mfree = m; in sbcut_internal()
1639 m = n; in sbcut_internal()
1648 while (m && m->m_len == 0) { in sbcut_internal()
1651 sbfree(sb, m); in sbcut_internal()
1652 n = m->m_next; in sbcut_internal()
1653 m->m_next = mfree; in sbcut_internal()
1654 mfree = m; in sbcut_internal()
1655 m = n; in sbcut_internal()
1660 sb->sb_mtls = m; in sbcut_internal()
1661 if (m == NULL) in sbcut_internal()
1665 if (m) { in sbcut_internal()
1666 sb->sb_mb = m; in sbcut_internal()
1667 m->m_nextpkt = next; in sbcut_internal()
1674 m = sb->sb_mb; in sbcut_internal()
1675 if (m == NULL) { in sbcut_internal()
1678 } else if (m->m_nextpkt == NULL) { in sbcut_internal()
1679 sb->sb_lastrecord = m; in sbcut_internal()
1723 struct mbuf *m; in sbsndptr_noadv() local
1730 sb->sb_sndptroff = 0; in sbsndptr_noadv()
1734 m = sb->sb_sndptr; in sbsndptr_noadv()
1738 return (m); in sbsndptr_noadv()
1748 struct mbuf *m; in sbsndptr_adv() local
1754 m = mb; in sbsndptr_adv()
1755 while (m && (len > 0)) { in sbsndptr_adv()
1756 if (len >= m->m_len) { in sbsndptr_adv()
1757 len -= m->m_len; in sbsndptr_adv()
1758 if (m->m_next) { in sbsndptr_adv()
1759 sb->sb_sndptroff += m->m_len; in sbsndptr_adv()
1760 sb->sb_sndptr = m->m_next; in sbsndptr_adv()
1762 m = m->m_next; in sbsndptr_adv()
1764 len = 0; in sbsndptr_adv()
1776 struct mbuf *m; in sbsndmbuf() local
1785 m = sb->sb_mb; in sbsndmbuf()
1787 m = sb->sb_sndptr; in sbsndmbuf()
1790 while (off > 0 && m != NULL) { in sbsndmbuf()
1791 if (off < m->m_len) in sbsndmbuf()
1793 off -= m->m_len; in sbsndmbuf()
1794 m = m->m_next; in sbsndmbuf()
1797 return (m); in sbsndmbuf()
1807 struct mbuf *m; in sbdroprecord_locked() local
1811 m = sb->sb_mb; in sbdroprecord_locked()
1812 if (m) { in sbdroprecord_locked()
1813 sb->sb_mb = m->m_nextpkt; in sbdroprecord_locked()
1815 sbfree(sb, m); in sbdroprecord_locked()
1816 m = m_free(m); in sbdroprecord_locked()
1817 } while (m); in sbdroprecord_locked()
1843 struct mbuf *m; in sbcreatecontrol() local
1855 m = m_getcl(wait, MT_CONTROL, 0); in sbcreatecontrol()
1857 m = m_get(wait, MT_CONTROL); in sbcreatecontrol()
1858 if (m == NULL) in sbcreatecontrol()
1861 KASSERT(CMSG_SPACE(size) <= M_TRAILINGSPACE(m), in sbcreatecontrol()
1867 cp = mtod(m, struct cmsghdr *); in sbcreatecontrol()
1871 m->m_len = CMSG_SPACE(size); in sbcreatecontrol()
1875 return (m); in sbcreatecontrol()
1900 SYSCTL_INT(_kern, KERN_DUMMY, dummy, CTLFLAG_RW | CTLFLAG_SKIP, &dummy, 0, "");
1902 CTLTYPE_ULONG | CTLFLAG_RW | CTLFLAG_MPSAFE, &sb_max, 0,
1906 &sb_efficiency, 0, "Socket buffer size waste factor");