Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet optimize mbuf allocation for ip/tcp/tcpopt part.
details: https://anonhg.NetBSD.org/src/rev/e60a6862e744
branches: trunk
changeset: 481903:e60a6862e744
user: itojun <itojun%NetBSD.org@localhost>
date: Wed Feb 09 00:50:40 2000 +0000
description:
optimize mbuf allocation for ip/tcp/tcpopt part.
diffstat:
sys/netinet/tcp_output.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diffs (38 lines):
diff -r 378877a3aa16 -r e60a6862e744 sys/netinet/tcp_output.c
--- a/sys/netinet/tcp_output.c Wed Feb 09 00:33:03 2000 +0000
+++ b/sys/netinet/tcp_output.c Wed Feb 09 00:50:40 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_output.c,v 1.53 1999/12/13 15:17:20 itojun Exp $ */
+/* $NetBSD: tcp_output.c,v 1.54 2000/02/09 00:50:40 itojun Exp $ */
/*
%%% portions-copyright-nrl-95
@@ -682,7 +682,9 @@
m->m_data -= hdrlen;
#else
MGETHDR(m, M_DONTWAIT, MT_HEADER);
- if (m != NULL) {
+ if (m != NULL &&
+ (max_linkhdr + hdrlen > MHLEN ||
+ max_linkhdr + hdrlen + len <= MCLBYTES)) {
MCLGET(m, M_DONTWAIT);
if ((m->m_flags & M_EXT) == 0) {
m_freem(m);
@@ -695,7 +697,7 @@
}
m->m_data += max_linkhdr;
m->m_len = hdrlen;
- if (len <= MCLBYTES - hdrlen - max_linkhdr) {
+ if (len <= M_TRAILINGSPACE(m)) {
m_copydata(so->so_snd.sb_mb, off, (int) len,
mtod(m, caddr_t) + hdrlen);
m->m_len += len;
@@ -727,7 +729,7 @@
tcpstat.tcps_sndwinup++;
MGETHDR(m, M_DONTWAIT, MT_HEADER);
- if (m != NULL) {
+ if (m != NULL && max_linkhdr + hdrlen > MHLEN) {
MCLGET(m, M_DONTWAIT);
if ((m->m_flags & M_EXT) == 0) {
m_freem(m);
Home |
Main Index |
Thread Index |
Old Index