diff options
author | andre <andre@FreeBSD.org> | 2005-11-02 13:46:32 +0000 |
---|---|---|
committer | andre <andre@FreeBSD.org> | 2005-11-02 13:46:32 +0000 |
commit | 0df84f5a83def3e1548e39bb43b0c177d50265fa (patch) | |
tree | 7cfb57b5672b497ffd3064153c31cb0a738e8f19 /sys | |
parent | 728b935c7f99f10947da6d54873e625c1a7a69c7 (diff) | |
download | FreeBSD-src-0df84f5a83def3e1548e39bb43b0c177d50265fa.zip FreeBSD-src-0df84f5a83def3e1548e39bb43b0c177d50265fa.tar.gz |
Retire MT_HEADER mbuf type and change its users to use MT_DATA.
Having an additional MT_HEADER mbuf type is superfluous and redundant
as nothing depends on it. It only adds a layer of confusion. The
distinction between header mbuf's and data mbuf's is solely done
through the m->m_flags M_PKTHDR flag.
Non-native code is not changed in this commit. For compatibility
MT_HEADER is mapped to MT_DATA.
Sponsored by: TCP/IP Optimization Fundraise 2005
Diffstat (limited to 'sys')
-rw-r--r-- | sys/compat/ndis/kern_ndis.c | 2 | ||||
-rw-r--r-- | sys/kern/uipc_sockbuf.c | 6 | ||||
-rw-r--r-- | sys/kern/uipc_socket.c | 2 | ||||
-rw-r--r-- | sys/kern/uipc_socket2.c | 6 | ||||
-rw-r--r-- | sys/net/if_gre.c | 2 | ||||
-rw-r--r-- | sys/net80211/ieee80211_freebsd.c | 4 | ||||
-rw-r--r-- | sys/net80211/ieee80211_output.c | 2 | ||||
-rw-r--r-- | sys/netinet/igmp.c | 2 | ||||
-rw-r--r-- | sys/netinet/ip_fw2.c | 2 | ||||
-rw-r--r-- | sys/netinet/ip_icmp.c | 4 | ||||
-rw-r--r-- | sys/netinet/ip_mroute.c | 8 | ||||
-rw-r--r-- | sys/netinet/ip_output.c | 4 | ||||
-rw-r--r-- | sys/netinet/tcp_output.c | 4 | ||||
-rw-r--r-- | sys/netinet/tcp_subr.c | 4 | ||||
-rw-r--r-- | sys/netinet/tcp_syncache.c | 2 | ||||
-rw-r--r-- | sys/netinet/tcp_timewait.c | 4 | ||||
-rw-r--r-- | sys/netipsec/ipsec_output.c | 2 | ||||
-rw-r--r-- | sys/netipx/ipx_ip.c | 2 | ||||
-rw-r--r-- | sys/netipx/spx_usrreq.c | 6 | ||||
-rw-r--r-- | sys/sys/mbuf.h | 2 | ||||
-rw-r--r-- | sys/sys/socketvar.h | 6 |
21 files changed, 35 insertions, 41 deletions
diff --git a/sys/compat/ndis/kern_ndis.c b/sys/compat/ndis/kern_ndis.c index 6e8b347..8baa011 100644 --- a/sys/compat/ndis/kern_ndis.c +++ b/sys/compat/ndis/kern_ndis.c @@ -717,7 +717,7 @@ ndis_ptom(m0, p) for (buf = priv->npp_head; buf != NULL; buf = buf->mdl_next) { if (buf == priv->npp_head) - MGETHDR(m, M_DONTWAIT, MT_HEADER); + MGETHDR(m, M_DONTWAIT, MT_DATA); else MGET(m, M_DONTWAIT, MT_DATA); if (m == NULL) { diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c index 9ce6f27..017dc88 100644 --- a/sys/kern/uipc_sockbuf.c +++ b/sys/kern/uipc_sockbuf.c @@ -1076,8 +1076,7 @@ sbcompress(sb, m, n) (unsigned)m->m_len); n->m_len += m->m_len; sb->sb_cc += m->m_len; - if (m->m_type != MT_DATA && m->m_type != MT_HEADER && - m->m_type != MT_OOBDATA) + if (m->m_type != MT_DATA && m->m_type != MT_OOBDATA) /* XXX: Probably don't need.*/ sb->sb_ctl += m->m_len; m = m_free(m); @@ -1163,8 +1162,7 @@ sbdrop_locked(sb, len) m->m_len -= len; m->m_data += len; sb->sb_cc -= len; - if (m->m_type != MT_DATA && m->m_type != MT_HEADER && - m->m_type != MT_OOBDATA) + if (m->m_type != MT_DATA && m->m_type != MT_OOBDATA) sb->sb_ctl -= len; break; } diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 32375aa..2a9419d 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1216,7 +1216,7 @@ dontblock: } else if (type == MT_OOBDATA) break; else - KASSERT(m->m_type == MT_DATA || m->m_type == MT_HEADER, + KASSERT(m->m_type == MT_DATA, ("m->m_type == %d", m->m_type)); so->so_rcv.sb_state &= ~SBS_RCVATMARK; len = uio->uio_resid; diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c index 9ce6f27..017dc88 100644 --- a/sys/kern/uipc_socket2.c +++ b/sys/kern/uipc_socket2.c @@ -1076,8 +1076,7 @@ sbcompress(sb, m, n) (unsigned)m->m_len); n->m_len += m->m_len; sb->sb_cc += m->m_len; - if (m->m_type != MT_DATA && m->m_type != MT_HEADER && - m->m_type != MT_OOBDATA) + if (m->m_type != MT_DATA && m->m_type != MT_OOBDATA) /* XXX: Probably don't need.*/ sb->sb_ctl += m->m_len; m = m_free(m); @@ -1163,8 +1162,7 @@ sbdrop_locked(sb, len) m->m_len -= len; m->m_data += len; sb->sb_cc -= len; - if (m->m_type != MT_DATA && m->m_type != MT_HEADER && - m->m_type != MT_OOBDATA) + if (m->m_type != MT_DATA && m->m_type != MT_OOBDATA) sb->sb_ctl -= len; break; } diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c index 20a5b90..53639f6 100644 --- a/sys/net/if_gre.c +++ b/sys/net/if_gre.c @@ -315,7 +315,7 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, if ((m->m_data - msiz) < m->m_pktdat) { /* need new mbuf */ - MGETHDR(m0, M_DONTWAIT, MT_HEADER); + MGETHDR(m0, M_DONTWAIT, MT_DATA); if (m0 == NULL) { _IF_DROP(&ifp->if_snd); m_freem(m); diff --git a/sys/net80211/ieee80211_freebsd.c b/sys/net80211/ieee80211_freebsd.c index dd37250..e05744a 100644 --- a/sys/net80211/ieee80211_freebsd.c +++ b/sys/net80211/ieee80211_freebsd.c @@ -170,7 +170,7 @@ ieee80211_getmgtframe(u_int8_t **frm, u_int pktlen) len = roundup(sizeof(struct ieee80211_frame) + pktlen, 4); KASSERT(len <= MCLBYTES, ("802.11 mgt frame too large: %u", len)); if (len < MINCLSIZE) { - m = m_gethdr(M_NOWAIT, MT_HEADER); + m = m_gethdr(M_NOWAIT, MT_DATA); /* * Align the data in case additional headers are added. * This should only happen when a WEP header is added @@ -180,7 +180,7 @@ ieee80211_getmgtframe(u_int8_t **frm, u_int pktlen) if (m != NULL) MH_ALIGN(m, len); } else - m = m_getcl(M_NOWAIT, MT_HEADER, M_PKTHDR); + m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); if (m != NULL) { m->m_data += sizeof(struct ieee80211_frame); *frm = m->m_data; diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c index b6c1586..70baf8d 100644 --- a/sys/net80211/ieee80211_output.c +++ b/sys/net80211/ieee80211_output.c @@ -212,7 +212,7 @@ ieee80211_send_nulldata(struct ieee80211_node *ni) struct mbuf *m; struct ieee80211_frame *wh; - MGETHDR(m, M_NOWAIT, MT_HEADER); + MGETHDR(m, M_NOWAIT, MT_DATA); if (m == NULL) { /* XXX debug msg */ ic->ic_stats.is_tx_nobuf++; diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c index 8612a23..ea93c2e 100644 --- a/sys/netinet/igmp.c +++ b/sys/netinet/igmp.c @@ -462,7 +462,7 @@ igmp_sendpkt(struct in_multi *inm, int type, unsigned long addr) IN_MULTI_LOCK_ASSERT(); - MGETHDR(m, M_DONTWAIT, MT_HEADER); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) return; diff --git a/sys/netinet/ip_fw2.c b/sys/netinet/ip_fw2.c index 4061596..4e37273 100644 --- a/sys/netinet/ip_fw2.c +++ b/sys/netinet/ip_fw2.c @@ -1559,7 +1559,7 @@ send_pkt(struct ipfw_flow_id *id, u_int32_t seq, u_int32_t ack, int flags) struct ip *ip; struct tcphdr *tcp; - MGETHDR(m, M_DONTWAIT, MT_HEADER); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == 0) return (NULL); m->m_pkthdr.rcvif = (struct ifnet *)0; diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c index 00b2341..ec74c33 100644 --- a/sys/netinet/ip_icmp.c +++ b/sys/netinet/ip_icmp.c @@ -183,7 +183,7 @@ icmp_error(n, type, code, dest, mtu) /* * First, formulate icmp message */ - MGETHDR(m, M_DONTWAIT, MT_HEADER); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) goto freeit; #ifdef MAC @@ -719,7 +719,7 @@ match: */ cp = (u_char *) (ip + 1); if ((opts = ip_srcroute(m)) == 0 && - (opts = m_gethdr(M_DONTWAIT, MT_HEADER))) { + (opts = m_gethdr(M_DONTWAIT, MT_DATA))) { opts->m_len = sizeof(struct in_addr); mtod(opts, struct in_addr *)->s_addr = 0; } diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c index 078d098..7fc0296 100644 --- a/sys/netinet/ip_mroute.c +++ b/sys/netinet/ip_mroute.c @@ -1900,7 +1900,7 @@ encap_send(struct ip *ip, struct vif *vifp, struct mbuf *m) * new mbuf so we can modify it. Try to fill the new * mbuf since if we don't the ethernet driver will. */ - MGETHDR(mb_copy, M_DONTWAIT, MT_HEADER); + MGETHDR(mb_copy, M_DONTWAIT, MT_DATA); if (mb_copy == NULL) return; #ifdef MAC @@ -2715,7 +2715,7 @@ bw_upcalls_send(void) * Allocate a new mbuf, initialize it with the header and * the payload for the pending calls. */ - MGETHDR(m, M_DONTWAIT, MT_HEADER); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { log(LOG_WARNING, "bw_upcalls_send: cannot allocate mbuf\n"); return; @@ -3055,7 +3055,7 @@ pim_register_send_upcall(struct ip *ip, struct vif *vifp, /* * Add a new mbuf with an upcall header */ - MGETHDR(mb_first, M_DONTWAIT, MT_HEADER); + MGETHDR(mb_first, M_DONTWAIT, MT_DATA); if (mb_first == NULL) { m_freem(mb_copy); return ENOBUFS; @@ -3115,7 +3115,7 @@ pim_register_send_rp(struct ip *ip, struct vif *vifp, /* * Add a new mbuf with the encapsulating header */ - MGETHDR(mb_first, M_DONTWAIT, MT_HEADER); + MGETHDR(mb_first, M_DONTWAIT, MT_DATA); if (mb_first == NULL) { m_freem(mb_copy); return ENOBUFS; diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index eac1955..0e210ac 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -941,7 +941,7 @@ smart_frag_failure: struct mbuf *m; int mhlen = sizeof (struct ip); - MGETHDR(m, M_DONTWAIT, MT_HEADER); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { error = ENOBUFS; ipstat.ips_odropped++; @@ -1067,7 +1067,7 @@ ip_insertoptions(m, opt, phlen) if (p->ipopt_dst.s_addr) ip->ip_dst = p->ipopt_dst; if (m->m_flags & M_EXT || m->m_data - optlen < m->m_pktdat) { - MGETHDR(n, M_DONTWAIT, MT_HEADER); + MGETHDR(n, M_DONTWAIT, MT_DATA); if (n == NULL) { *phlen = 0; return (m); diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index 6bfaa41..e377bdf 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -747,7 +747,7 @@ send: m->m_len += hdrlen; m->m_data -= hdrlen; #else - MGETHDR(m, M_DONTWAIT, MT_HEADER); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { SOCKBUF_UNLOCK(&so->so_snd); error = ENOBUFS; @@ -800,7 +800,7 @@ send: else tcpstat.tcps_sndwinup++; - MGETHDR(m, M_DONTWAIT, MT_HEADER); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { error = ENOBUFS; goto out; diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 144070c..9267ea2 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -446,7 +446,7 @@ tcp_respond(tp, ipgen, th, m, ack, seq, flags) } } if (m == NULL) { - m = m_gethdr(M_DONTWAIT, MT_HEADER); + m = m_gethdr(M_DONTWAIT, MT_DATA); if (m == NULL) return; tlen = 0; @@ -1794,7 +1794,7 @@ tcp_twrespond(struct tcptw *tw, int flags) INP_LOCK_ASSERT(inp); - m = m_gethdr(M_DONTWAIT, MT_HEADER); + m = m_gethdr(M_DONTWAIT, MT_DATA); if (m == NULL) return (ENOBUFS); m->m_data += max_linkhdr; diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c index a14a855..c92f922 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -1072,7 +1072,7 @@ syncache_respond(sc, m) if (m) m_freem(m); - m = m_gethdr(M_DONTWAIT, MT_HEADER); + m = m_gethdr(M_DONTWAIT, MT_DATA); if (m == NULL) return (ENOBUFS); m->m_data += max_linkhdr; diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c index 144070c..9267ea2 100644 --- a/sys/netinet/tcp_timewait.c +++ b/sys/netinet/tcp_timewait.c @@ -446,7 +446,7 @@ tcp_respond(tp, ipgen, th, m, ack, seq, flags) } } if (m == NULL) { - m = m_gethdr(M_DONTWAIT, MT_HEADER); + m = m_gethdr(M_DONTWAIT, MT_DATA); if (m == NULL) return; tlen = 0; @@ -1794,7 +1794,7 @@ tcp_twrespond(struct tcptw *tw, int flags) INP_LOCK_ASSERT(inp); - m = m_gethdr(M_DONTWAIT, MT_HEADER); + m = m_gethdr(M_DONTWAIT, MT_DATA); if (m == NULL) return (ENOBUFS); m->m_data += max_linkhdr; diff --git a/sys/netipsec/ipsec_output.c b/sys/netipsec/ipsec_output.c index c90524b..788e07a 100644 --- a/sys/netipsec/ipsec_output.c +++ b/sys/netipsec/ipsec_output.c @@ -500,7 +500,7 @@ ipsec6_splithdr(struct mbuf *m) ip6 = mtod(m, struct ip6_hdr *); hlen = sizeof(struct ip6_hdr); if (m->m_len > hlen) { - MGETHDR(mh, M_DONTWAIT, MT_HEADER); + MGETHDR(mh, M_DONTWAIT, MT_DATA); if (!mh) { m_freem(m); return NULL; diff --git a/sys/netipx/ipx_ip.c b/sys/netipx/ipx_ip.c index e100e51..e88b923 100644 --- a/sys/netipx/ipx_ip.c +++ b/sys/netipx/ipx_ip.c @@ -260,7 +260,7 @@ ipxipoutput(ifp, m, dst, rt) /* following clause not necessary on vax */ if (3 & (intptr_t)m->m_data) { /* force longword alignment of ip hdr */ - struct mbuf *m0 = m_gethdr(MT_HEADER, M_DONTWAIT); + struct mbuf *m0 = m_gethdr(MT_DATA, M_DONTWAIT); if (m0 == NULL) { m_freem(m); return (ENOBUFS); diff --git a/sys/netipx/spx_usrreq.c b/sys/netipx/spx_usrreq.c index 30bc70a..def6eb1 100644 --- a/sys/netipx/spx_usrreq.c +++ b/sys/netipx/spx_usrreq.c @@ -813,7 +813,7 @@ spx_output(cb, m0) m->m_next = m1; } } - m = m_gethdr(M_DONTWAIT, MT_HEADER); + m = m_gethdr(M_DONTWAIT, MT_DATA); if (m == NULL) { m_freem(m0); return (ENOBUFS); @@ -1026,7 +1026,7 @@ send: spxstat.spxs_sndprobe++; if (cb->s_flags & SF_ACKNOW) spxstat.spxs_sndacks++; - m = m_gethdr(M_DONTWAIT, MT_HEADER); + m = m_gethdr(M_DONTWAIT, MT_DATA); if (m == NULL) return (ENOBUFS); /* @@ -1373,7 +1373,7 @@ spx_attach(so, proto, td) } sb = &so->so_snd; - mm = m_getclr(M_DONTWAIT, MT_HEADER); + mm = m_getclr(M_DONTWAIT, MT_DATA); if (mm == NULL) { FREE(cb, M_PCB); error = ENOBUFS; diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 7696fa4..91ab0b2 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -221,7 +221,7 @@ struct mbuf { */ #define MT_NOTMBUF 0 /* USED INTERNALLY ONLY! Object is not mbuf */ #define MT_DATA 1 /* dynamic (data) allocation */ -#define MT_HEADER 2 /* packet header */ +#define MT_HEADER MT_DATA /* packet header, use M_PKTHDR instead */ #if 0 #define MT_SOCKET 3 /* socket structure */ #define MT_PCB 4 /* protocol control block */ diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h index 32e0149..3969203 100644 --- a/sys/sys/socketvar.h +++ b/sys/sys/socketvar.h @@ -297,8 +297,7 @@ struct xsocket { /* adjust counters in sb reflecting allocation of m */ #define sballoc(sb, m) { \ (sb)->sb_cc += (m)->m_len; \ - if ((m)->m_type != MT_DATA && (m)->m_type != MT_HEADER && \ - (m)->m_type != MT_OOBDATA) \ + if ((m)->m_type != MT_DATA && (m)->m_type != MT_OOBDATA) \ (sb)->sb_ctl += (m)->m_len; \ (sb)->sb_mbcnt += MSIZE; \ if ((m)->m_flags & M_EXT) \ @@ -308,8 +307,7 @@ struct xsocket { /* adjust counters in sb reflecting freeing of m */ #define sbfree(sb, m) { \ (sb)->sb_cc -= (m)->m_len; \ - if ((m)->m_type != MT_DATA && (m)->m_type != MT_HEADER && \ - (m)->m_type != MT_OOBDATA) \ + if ((m)->m_type != MT_DATA && (m)->m_type != MT_OOBDATA) \ (sb)->sb_ctl -= (m)->m_len; \ (sb)->sb_mbcnt -= MSIZE; \ if ((m)->m_flags & M_EXT) \ |