On Mon, Dec 03, 2018 at 11:57:34AM +0100, Claudio Jeker wrote: > Next round of conversions. Additionally to converting MH_ALIGN() to > m_align() this also switches m_gethdr/M_GETHDR calls to m_get/M_GET calls > because M_MOVE_PKTHDR() is initialising the pkthdr and so there is no need > to do that when allocating the mbuf. > > OK?
OK bluhm@ > Index: net/if_gre.c > =================================================================== > RCS file: /cvs/src/sys/net/if_gre.c,v > retrieving revision 1.140 > diff -u -p -r1.140 if_gre.c > --- net/if_gre.c 29 Nov 2018 00:14:29 -0000 1.140 > +++ net/if_gre.c 30 Nov 2018 09:48:19 -0000 > @@ -1939,7 +1939,8 @@ egre_start(struct ifnet *ifp) > bpf_mtap_ether(if_bpf, m0, BPF_DIRECTION_OUT); > #endif > > - m = m_gethdr(M_DONTWAIT, m0->m_type); > + /* force prepend mbuf because of alignment problems */ > + m = m_get(M_DONTWAIT, m0->m_type); > if (m == NULL) { > m_freem(m0); > continue; > @@ -1948,7 +1949,7 @@ egre_start(struct ifnet *ifp) > M_MOVE_PKTHDR(m, m0); > m->m_next = m0; > > - MH_ALIGN(m, 0); > + m_align(m, 0); > m->m_len = 0; > > m = gre_encap(&sc->sc_tunnel, m, htons(ETHERTYPE_TRANSETHER), > @@ -3757,7 +3758,8 @@ nvgre_start(struct ifnet *ifp) > rw_exit_read(&sc->sc_ether_lock); > } > > - m = m_gethdr(M_DONTWAIT, m0->m_type); > + /* force prepend mbuf because of alignment problems */ > + m = m_get(M_DONTWAIT, m0->m_type); > if (m == NULL) { > m_freem(m0); > continue; > @@ -3766,7 +3768,7 @@ nvgre_start(struct ifnet *ifp) > M_MOVE_PKTHDR(m, m0); > m->m_next = m0; > > - MH_ALIGN(m, 0); > + m_align(m, 0); > m->m_len = 0; > > m = gre_encap_dst(tunnel, &gateway, m, > @@ -3932,7 +3934,8 @@ eoip_start(struct ifnet *ifp) > bpf_mtap_ether(if_bpf, m0, BPF_DIRECTION_OUT); > #endif > > - m = m_gethdr(M_DONTWAIT, m0->m_type); > + /* force prepend mbuf because of alignment problems */ > + m = m_get(M_DONTWAIT, m0->m_type); > if (m == NULL) { > m_freem(m0); > continue; > @@ -3941,7 +3944,7 @@ eoip_start(struct ifnet *ifp) > M_MOVE_PKTHDR(m, m0); > m->m_next = m0; > > - MH_ALIGN(m, 0); > + m_align(m, 0); > m->m_len = 0; > > m = eoip_encap(sc, m, gre_l2_tos(&sc->sc_tunnel, m)); > Index: net/if_vxlan.c > =================================================================== > RCS file: /cvs/src/sys/net/if_vxlan.c,v > retrieving revision 1.69 > diff -u -p -r1.69 if_vxlan.c > --- net/if_vxlan.c 15 Nov 2018 22:22:03 -0000 1.69 > +++ net/if_vxlan.c 30 Nov 2018 09:48:19 -0000 > @@ -867,8 +867,8 @@ vxlan_output(struct ifnet *ifp, struct m > uint32_t tag; > struct mbuf *m0; > > - /* VXLAN header */ > - MGETHDR(m0, M_DONTWAIT, m->m_type); > + /* VXLAN header, needs new mbuf because of alignment issues */ > + MGET(m0, M_DONTWAIT, m->m_type); > if (m0 == NULL) { > ifp->if_oerrors++; > return (ENOBUFS); > @@ -876,7 +876,7 @@ vxlan_output(struct ifnet *ifp, struct m > M_MOVE_PKTHDR(m0, m); > m0->m_next = m; > m = m0; > - MH_ALIGN(m, sizeof(*vu)); > + m_align(m, sizeof(*vu)); > m->m_len = sizeof(*vu); > m->m_pkthdr.len += sizeof(*vu); > > Index: netinet6/ip6_output.c > =================================================================== > RCS file: /cvs/src/sys/netinet6/ip6_output.c,v > retrieving revision 1.240 > diff -u -p -r1.240 ip6_output.c > --- netinet6/ip6_output.c 9 Nov 2018 14:14:32 -0000 1.240 > +++ netinet6/ip6_output.c 30 Nov 2018 09:48:19 -0000 > @@ -2571,13 +2571,13 @@ ip6_splithdr(struct mbuf *m, struct ip6_ > > ip6 = mtod(m, struct ip6_hdr *); > if (m->m_len > sizeof(*ip6)) { > - MGETHDR(mh, M_DONTWAIT, MT_HEADER); > + MGET(mh, M_DONTWAIT, MT_HEADER); > if (mh == NULL) { > m_freem(m); > return ENOBUFS; > } > M_MOVE_PKTHDR(mh, m); > - MH_ALIGN(mh, sizeof(*ip6)); > + m_align(mh, sizeof(*ip6)); > m->m_len -= sizeof(*ip6); > m->m_data += sizeof(*ip6); > mh->m_next = m;