Add support for MBUFTRACE.

This commit is contained in:
thorpej 2020-03-12 03:01:46 +00:00
parent 63d07d6408
commit c70590ecd0
6 changed files with 24 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: aic6915.c,v 1.42 2020/02/07 00:56:48 thorpej Exp $ */
/* $NetBSD: aic6915.c,v 1.43 2020/03/12 03:01:46 thorpej Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: aic6915.c,v 1.42 2020/02/07 00:56:48 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: aic6915.c,v 1.43 2020/03/12 03:01:46 thorpej Exp $");
#include <sys/param.h>
@ -404,6 +404,7 @@ sf_start(struct ifnet *ifp)
"unable to allocate Tx mbuf\n");
break;
}
MCLAIM(m, &sc->sc_ethercom.ec_tx_mowner);
if (m0->m_pkthdr.len > MHLEN) {
MCLGET(m, M_DONTWAIT);
if ((m->m_flags & M_EXT) == 0) {
@ -769,6 +770,7 @@ sf_rxintr(struct sf_softc *sc)
ds->ds_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD);
continue;
}
MCLAIM(m, &sc->sc_ethercom.ec_rx_mowner);
if (len > (MHLEN - 2)) {
MCLGET(m, M_DONTWAIT);
if ((m->m_flags & M_EXT) == 0) {
@ -1203,6 +1205,7 @@ sf_add_rxbuf(struct sf_softc *sc, int idx)
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL)
return (ENOBUFS);
MCLAIM(m, &sc->sc_ethercom.ec_rx_mowner);
MCLGET(m, M_DONTWAIT);
if ((m->m_flags & M_EXT) == 0) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: elinkxl.c,v 1.137 2020/02/10 07:48:02 msaitoh Exp $ */
/* $NetBSD: elinkxl.c,v 1.138 2020/03/12 03:01:46 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: elinkxl.c,v 1.137 2020/02/10 07:48:02 msaitoh Exp $");
__KERNEL_RCSID(0, "$NetBSD: elinkxl.c,v 1.138 2020/03/12 03:01:46 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1084,6 +1084,7 @@ ex_start(struct ifnet *ifp)
aprint_error("aborting\n");
goto out;
}
MCLAIM(mn, &sc->sc_ethercom.ec_tx_mowner);
if (mb_head->m_pkthdr.len > MHLEN) {
MCLGET(mn, M_DONTWAIT);
if ((mn->m_flags & M_EXT) == 0) {
@ -1801,6 +1802,7 @@ ex_add_rxbuf(struct ex_softc *sc, struct ex_rxdesc *rxd)
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m != NULL) {
MCLAIM(m, &sc->sc_ethercom.ec_rx_mowner);
MCLGET(m, M_DONTWAIT);
if ((m->m_flags & M_EXT) == 0) {
m_freem(m);

View File

@ -1,4 +1,4 @@
/* $NetBSD: hme.c,v 1.107 2020/02/07 00:56:48 thorpej Exp $ */
/* $NetBSD: hme.c,v 1.108 2020/03/12 03:01:46 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.107 2020/02/07 00:56:48 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.108 2020/03/12 03:01:46 thorpej Exp $");
/* #define HMEDEBUG */
@ -695,6 +695,7 @@ hme_get(struct hme_softc *sc, int ri, uint32_t flags)
MGETHDR(m0, M_DONTWAIT, MT_DATA);
if (m0 == 0)
return (0);
MCLAIM(m0, &sc->sc_ethercom.ec_rx_mowner);
m_set_rcvif(m0, ifp);
m0->m_pkthdr.len = totlen;
len = MHLEN;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtl8169.c,v 1.164 2020/02/07 00:56:48 thorpej Exp $ */
/* $NetBSD: rtl8169.c,v 1.165 2020/03/12 03:01:46 thorpej Exp $ */
/*
* Copyright (c) 1997, 1998-2003
@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.164 2020/02/07 00:56:48 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.165 2020/03/12 03:01:46 thorpej Exp $");
/* $FreeBSD: /repoman/r/ncvs/src/sys/dev/re/if_re.c,v 1.20 2004/04/11 20:34:08 ru Exp $ */
/*
@ -1076,6 +1076,7 @@ re_newbuf(struct rtk_softc *sc, int idx, struct mbuf *m)
if (n == NULL)
return ENOBUFS;
MCLAIM(n, &sc->ethercom.ec_rx_mowner);
MCLGET(n, M_DONTWAIT);
if ((n->m_flags & M_EXT) == 0) {
m_freem(n);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtl81x9.c,v 1.110 2020/02/07 00:56:48 thorpej Exp $ */
/* $NetBSD: rtl81x9.c,v 1.111 2020/03/12 03:01:46 thorpej Exp $ */
/*
* Copyright (c) 1997, 1998
@ -86,7 +86,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rtl81x9.c,v 1.110 2020/02/07 00:56:48 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: rtl81x9.c,v 1.111 2020/03/12 03:01:46 thorpej Exp $");
#include <sys/param.h>
@ -1034,6 +1034,7 @@ rtk_rxeof(struct rtk_softc *sc)
if_statinc(ifp, if_ierrors);
goto next_packet;
}
MCLAIM(m, &sc->ethercom.ec_rx_mowner);
if (total_len > (MHLEN - RTK_ETHER_ALIGN)) {
MCLGET(m, M_DONTWAIT);
if ((m->m_flags & M_EXT) == 0) {
@ -1255,6 +1256,7 @@ rtk_start(struct ifnet *ifp)
device_xname(sc->sc_dev));
break;
}
MCLAIM(m_new, &sc->ethercom.ec_rx_mowner);
if (m_head->m_pkthdr.len > MHLEN) {
MCLGET(m_new, M_DONTWAIT);
if ((m_new->m_flags & M_EXT) == 0) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: smc83c170.c,v 1.93 2020/02/07 00:56:48 thorpej Exp $ */
/* $NetBSD: smc83c170.c,v 1.94 2020/03/12 03:01:46 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: smc83c170.c,v 1.93 2020/02/07 00:56:48 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: smc83c170.c,v 1.94 2020/03/12 03:01:46 thorpej Exp $");
#include <sys/param.h>
@ -415,6 +415,7 @@ epic_start(struct ifnet *ifp)
device_xname(sc->sc_dev));
break;
}
MCLAIM(m, &sc->sc_ethercom.ec_tx_mowner);
if (m0->m_pkthdr.len > MHLEN) {
MCLGET(m, M_DONTWAIT);
if ((m->m_flags & M_EXT) == 0) {
@ -687,6 +688,7 @@ epic_intr(void *arg)
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL)
goto dropit;
MCLAIM(m, &sc->sc_ethercom.ec_rx_mowner);
memcpy(mtod(m, void *),
mtod(ds->ds_mbuf, void *), len);
EPIC_INIT_RXDESC(sc, i);
@ -1220,6 +1222,7 @@ epic_add_rxbuf(struct epic_softc *sc, int idx)
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL)
return ENOBUFS;
MCLAIM(m, &sc->sc_ethercom.ec_rx_mowner);
MCLGET(m, M_DONTWAIT);
if ((m->m_flags & M_EXT) == 0) {