From c70590ecd039677aa056e725fd5fd3c733ba7149 Mon Sep 17 00:00:00 2001 From: thorpej Date: Thu, 12 Mar 2020 03:01:46 +0000 Subject: [PATCH] Add support for MBUFTRACE. --- sys/dev/ic/aic6915.c | 7 +++++-- sys/dev/ic/elinkxl.c | 6 ++++-- sys/dev/ic/hme.c | 5 +++-- sys/dev/ic/rtl8169.c | 5 +++-- sys/dev/ic/rtl81x9.c | 6 ++++-- sys/dev/ic/smc83c170.c | 7 +++++-- 6 files changed, 24 insertions(+), 12 deletions(-) diff --git a/sys/dev/ic/aic6915.c b/sys/dev/ic/aic6915.c index 57eecb9a7398..6e73eef29f1a 100644 --- a/sys/dev/ic/aic6915.c +++ b/sys/dev/ic/aic6915.c @@ -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 -__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 @@ -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) { diff --git a/sys/dev/ic/elinkxl.c b/sys/dev/ic/elinkxl.c index ec63d98b5f90..a2cdc599009a 100644 --- a/sys/dev/ic/elinkxl.c +++ b/sys/dev/ic/elinkxl.c @@ -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 -__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 #include @@ -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); diff --git a/sys/dev/ic/hme.c b/sys/dev/ic/hme.c index d1d119a7becd..909685d6b291 100644 --- a/sys/dev/ic/hme.c +++ b/sys/dev/ic/hme.c @@ -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 -__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; diff --git a/sys/dev/ic/rtl8169.c b/sys/dev/ic/rtl8169.c index c52032c61927..23ca138c8cc5 100644 --- a/sys/dev/ic/rtl8169.c +++ b/sys/dev/ic/rtl8169.c @@ -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 -__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); diff --git a/sys/dev/ic/rtl81x9.c b/sys/dev/ic/rtl81x9.c index 706af69c2956..8fc833cc7ab2 100644 --- a/sys/dev/ic/rtl81x9.c +++ b/sys/dev/ic/rtl81x9.c @@ -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 -__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 @@ -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) { diff --git a/sys/dev/ic/smc83c170.c b/sys/dev/ic/smc83c170.c index 79fcef723e9f..3000cc877fc0 100644 --- a/sys/dev/ic/smc83c170.c +++ b/sys/dev/ic/smc83c170.c @@ -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 -__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 @@ -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) {