From c35f95b812dab7979e23294211d4af0f7e2ce6c6 Mon Sep 17 00:00:00 2001 From: mpi Date: Mon, 13 Apr 2015 08:45:48 +0000 Subject: [PATCH] Now that if_input() set the receiving interface pointer on mbufs for us there's no need to do it in m_devget(9). Stop passing an ``ifp'' will help for upcoming interface pointer -> index conversion. While here remove unused ``ifp'' argument from m_clget(9) and kill two birds^W layer violations in one commit. ok henning@ --- sys/arch/sparc/dev/hme.c | 4 ++-- sys/arch/sparc64/dev/vnet.c | 4 ++-- sys/dev/ic/dc.c | 4 ++-- sys/dev/ic/mtd8xx.c | 4 ++-- sys/dev/ic/rtl81x9.c | 6 +++--- sys/dev/pci/if_ale.c | 4 ++-- sys/dev/pci/if_bce.c | 4 ++-- sys/dev/pci/if_cas.c | 6 +++--- sys/dev/pci/if_lge.c | 5 ++--- sys/dev/pci/if_nge.c | 5 ++--- sys/dev/pci/if_sis.c | 5 ++--- sys/dev/pci/if_vge.c | 4 ++-- sys/dev/pci/if_vr.c | 5 ++--- sys/dev/pci/if_wb.c | 4 ++-- sys/dev/pcmcia/if_malo.c | 4 ++-- sys/dev/usb/if_upgt.c | 4 ++-- sys/kern/uipc_mbuf.c | 7 +++---- sys/net/pfkeyv2.c | 4 ++-- sys/sys/mbuf.h | 10 +++++----- 19 files changed, 44 insertions(+), 49 deletions(-) diff --git a/sys/arch/sparc/dev/hme.c b/sys/arch/sparc/dev/hme.c index 69202b34cc3..f2c48147eba 100644 --- a/sys/arch/sparc/dev/hme.c +++ b/sys/arch/sparc/dev/hme.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hme.c,v 1.68 2015/04/08 10:07:47 mpi Exp $ */ +/* $OpenBSD: hme.c,v 1.69 2015/04/13 08:45:48 mpi Exp $ */ /* * Copyright (c) 1998 Jason L. Wright (jason@thought.net) @@ -828,7 +828,7 @@ hme_read(sc, idx, len, flags) /* Pull packet off interface. */ m = m_devget(sc->sc_bufs->rx_buf[idx] + HME_RX_OFFSET, len, - HME_RX_OFFSET, &sc->sc_arpcom.ac_if); + HME_RX_OFFSET); if (m == NULL) { ifp->if_ierrors++; return; diff --git a/sys/arch/sparc64/dev/vnet.c b/sys/arch/sparc64/dev/vnet.c index 5b011e86acd..505a8491941 100644 --- a/sys/arch/sparc64/dev/vnet.c +++ b/sys/arch/sparc64/dev/vnet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vnet.c,v 1.43 2015/04/02 09:46:48 kettenis Exp $ */ +/* $OpenBSD: vnet.c,v 1.44 2015/04/13 08:45:48 mpi Exp $ */ /* * Copyright (c) 2009, 2015 Mark Kettenis * @@ -734,7 +734,7 @@ vnet_rx_vio_desc_data(struct vnet_softc *sc, struct vio_msg_tag *tag) } /* Stupid OBP doesn't align properly. */ - m = m_devget(buf, dm->nbytes, ETHER_ALIGN, ifp); + m = m_devget(buf, dm->nbytes, ETHER_ALIGN); pool_put(&sc->sc_pool, buf); if (m == NULL) { ifp->if_ierrors++; diff --git a/sys/dev/ic/dc.c b/sys/dev/ic/dc.c index 4641274032e..5a398cd7ca4 100644 --- a/sys/dev/ic/dc.c +++ b/sys/dev/ic/dc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dc.c,v 1.139 2015/03/14 03:38:47 jsg Exp $ */ +/* $OpenBSD: dc.c,v 1.140 2015/04/13 08:45:48 mpi Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -2143,7 +2143,7 @@ dc_rxeof(struct dc_softc *sc) /* No errors; receive the packet. */ total_len -= ETHER_CRC_LEN; - m0 = m_devget(mtod(m, char *), total_len, ETHER_ALIGN, ifp); + m0 = m_devget(mtod(m, char *), total_len, ETHER_ALIGN); dc_newbuf(sc, i, m); DC_INC(i, DC_RX_LIST_CNT); if (m0 == NULL) { diff --git a/sys/dev/ic/mtd8xx.c b/sys/dev/ic/mtd8xx.c index e18c9aa1019..954f22570e4 100644 --- a/sys/dev/ic/mtd8xx.c +++ b/sys/dev/ic/mtd8xx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mtd8xx.c,v 1.25 2015/04/08 12:58:24 mpi Exp $ */ +/* $OpenBSD: mtd8xx.c,v 1.26 2015/04/13 08:45:48 mpi Exp $ */ /* * Copyright (c) 2003 Oleg Safiullin @@ -924,7 +924,7 @@ mtd_rxeof(struct mtd_softc *sc) 0, sc->mtd_cdata.mtd_rx_chain[i].sd_map->dm_mapsize, BUS_DMASYNC_POSTREAD); - m0 = m_devget(mtod(m, char *), total_len, ETHER_ALIGN, ifp); + m0 = m_devget(mtod(m, char *), total_len, ETHER_ALIGN); mtd_newbuf(sc, i, m); i = (i + 1) % MTD_RX_LIST_CNT; if (m0 == NULL) { diff --git a/sys/dev/ic/rtl81x9.c b/sys/dev/ic/rtl81x9.c index a932551ad64..23c5204a5a5 100644 --- a/sys/dev/ic/rtl81x9.c +++ b/sys/dev/ic/rtl81x9.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtl81x9.c,v 1.89 2015/03/30 10:04:11 mpi Exp $ */ +/* $OpenBSD: rtl81x9.c,v 1.90 2015/04/13 08:45:48 mpi Exp $ */ /* * Copyright (c) 1997, 1998 @@ -643,7 +643,7 @@ rl_rxeof(struct rl_softc *sc) wrap = (sc->rl_cdata.rl_rx_buf + RL_RXBUFLEN) - rxbufpos; if (total_len > wrap) { - m = m_devget(rxbufpos, wrap, ETHER_ALIGN, ifp); + m = m_devget(rxbufpos, wrap, ETHER_ALIGN); if (m != NULL) { m_copyback(m, wrap, total_len - wrap, sc->rl_cdata.rl_rx_buf, M_NOWAIT); @@ -654,7 +654,7 @@ rl_rxeof(struct rl_softc *sc) } cur_rx = (total_len - wrap + ETHER_CRC_LEN); } else { - m = m_devget(rxbufpos, total_len, ETHER_ALIGN, ifp); + m = m_devget(rxbufpos, total_len, ETHER_ALIGN); cur_rx += total_len + 4 + ETHER_CRC_LEN; } diff --git a/sys/dev/pci/if_ale.c b/sys/dev/pci/if_ale.c index 8f23cd23f06..f7947878ff5 100644 --- a/sys/dev/pci/if_ale.c +++ b/sys/dev/pci/if_ale.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ale.c,v 1.37 2015/03/24 10:09:06 mpi Exp $ */ +/* $OpenBSD: if_ale.c,v 1.38 2015/04/13 08:45:48 mpi Exp $ */ /*- * Copyright (c) 2008, Pyun YongHyeon * All rights reserved. @@ -1532,7 +1532,7 @@ ale_rxeof(struct ale_softc *sc) * on these low-end consumer ethernet controller. */ m = m_devget((char *)(rs + 1), length - ETHER_CRC_LEN, - ETHER_ALIGN, ifp); + ETHER_ALIGN); if (m == NULL) { ifp->if_iqdrops++; ale_rx_update_page(sc, &rx_page, length, &prod); diff --git a/sys/dev/pci/if_bce.c b/sys/dev/pci/if_bce.c index 286239e93e4..6f06ab072cb 100644 --- a/sys/dev/pci/if_bce.c +++ b/sys/dev/pci/if_bce.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bce.c,v 1.44 2015/04/08 10:07:47 mpi Exp $ */ +/* $OpenBSD: if_bce.c,v 1.45 2015/04/13 08:45:48 mpi Exp $ */ /* $NetBSD: if_bce.c,v 1.3 2003/09/29 01:53:02 mrg Exp $ */ /* @@ -739,7 +739,7 @@ bce_rxintr(struct bce_softc *sc) len -= ETHER_CRC_LEN; m = m_devget(sc->bce_data + i * MCLBYTES + - BCE_PREPKT_HEADER_SIZE, len, ETHER_ALIGN, ifp); + BCE_PREPKT_HEADER_SIZE, len, ETHER_ALIGN); ifp->if_ipackets++; ml_enqueue(&ml, m); diff --git a/sys/dev/pci/if_cas.c b/sys/dev/pci/if_cas.c index 349ef097965..19c9e0c1554 100644 --- a/sys/dev/pci/if_cas.c +++ b/sys/dev/pci/if_cas.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cas.c,v 1.39 2015/03/14 03:38:48 jsg Exp $ */ +/* $OpenBSD: if_cas.c,v 1.40 2015/04/13 08:45:48 mpi Exp $ */ /* * @@ -1196,7 +1196,7 @@ cas_rint(struct cas_softc *sc) rxs->rxs_dmamap->dm_mapsize, BUS_DMASYNC_POSTREAD); cp = rxs->rxs_kva + off * 256 + ETHER_ALIGN; - m = m_devget(cp, len, ETHER_ALIGN, ifp); + m = m_devget(cp, len, ETHER_ALIGN); if (word[0] & CAS_RC0_RELEASE_HDR) cas_add_rxbuf(sc, idx); @@ -1222,7 +1222,7 @@ cas_rint(struct cas_softc *sc) /* XXX We should not be copying the packet here. */ cp = rxs->rxs_kva + off + ETHER_ALIGN; - m = m_devget(cp, len, ETHER_ALIGN, ifp); + m = m_devget(cp, len, ETHER_ALIGN); if (word[0] & CAS_RC0_RELEASE_DATA) cas_add_rxbuf(sc, idx); diff --git a/sys/dev/pci/if_lge.c b/sys/dev/pci/if_lge.c index eaba08d34ae..5c33421ca02 100644 --- a/sys/dev/pci/if_lge.c +++ b/sys/dev/pci/if_lge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_lge.c,v 1.65 2015/04/08 10:07:47 mpi Exp $ */ +/* $OpenBSD: if_lge.c,v 1.66 2015/04/13 08:45:48 mpi Exp $ */ /* * Copyright (c) 2001 Wind River Systems * Copyright (c) 1997, 1998, 1999, 2000, 2001 @@ -719,8 +719,7 @@ lge_rxeof(struct lge_softc *sc, int cnt) } if (lge_newbuf(sc, &LGE_RXTAIL(sc), NULL) == ENOBUFS) { - m0 = m_devget(mtod(m, char *), total_len, ETHER_ALIGN, - ifp); + m0 = m_devget(mtod(m, char *), total_len, ETHER_ALIGN); lge_newbuf(sc, &LGE_RXTAIL(sc), m); if (m0 == NULL) { ifp->if_ierrors++; diff --git a/sys/dev/pci/if_nge.c b/sys/dev/pci/if_nge.c index 4fdf2c83ce6..b813dcd7d7d 100644 --- a/sys/dev/pci/if_nge.c +++ b/sys/dev/pci/if_nge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_nge.c,v 1.82 2015/04/08 10:07:47 mpi Exp $ */ +/* $OpenBSD: if_nge.c,v 1.83 2015/04/13 08:45:48 mpi Exp $ */ /* * Copyright (c) 2001 Wind River Systems * Copyright (c) 1997, 1998, 1999, 2000, 2001 @@ -1066,8 +1066,7 @@ nge_rxeof(struct nge_softc *sc) */ if (nge_newbuf(sc, cur_rx, NULL) == ENOBUFS) { #endif - m0 = m_devget(mtod(m, char *), total_len, - ETHER_ALIGN, ifp); + m0 = m_devget(mtod(m, char *), total_len, ETHER_ALIGN); nge_newbuf(sc, cur_rx, m); if (m0 == NULL) { ifp->if_ierrors++; diff --git a/sys/dev/pci/if_sis.c b/sys/dev/pci/if_sis.c index 2fd92614029..54014128003 100644 --- a/sys/dev/pci/if_sis.c +++ b/sys/dev/pci/if_sis.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sis.c,v 1.125 2015/03/30 10:01:21 mpi Exp $ */ +/* $OpenBSD: if_sis.c,v 1.126 2015/04/13 08:45:48 mpi Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul . All rights reserved. @@ -1423,8 +1423,7 @@ sis_rxeof(struct sis_softc *sc) */ { struct mbuf *m0; - m0 = m_devget(mtod(m, char *), total_len, ETHER_ALIGN, - ifp); + m0 = m_devget(mtod(m, char *), total_len, ETHER_ALIGN); m_freem(m); if (m0 == NULL) { ifp->if_ierrors++; diff --git a/sys/dev/pci/if_vge.c b/sys/dev/pci/if_vge.c index 6977dd0630c..0db21fd640e 100644 --- a/sys/dev/pci/if_vge.c +++ b/sys/dev/pci/if_vge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vge.c,v 1.61 2015/04/08 10:07:47 mpi Exp $ */ +/* $OpenBSD: if_vge.c,v 1.62 2015/04/13 08:45:48 mpi Exp $ */ /* $FreeBSD: if_vge.c,v 1.3 2004/09/11 22:13:25 wpaul Exp $ */ /* * Copyright (c) 2004 @@ -1077,7 +1077,7 @@ vge_rxeof(struct vge_softc *sc) } m0 = m_devget(mtod(m, char *), - total_len - ETHER_CRC_LEN, ETHER_ALIGN, ifp); + total_len - ETHER_CRC_LEN, ETHER_ALIGN); vge_newbuf(sc, i, m); if (m0 == NULL) { ifp->if_ierrors++; diff --git a/sys/dev/pci/if_vr.c b/sys/dev/pci/if_vr.c index 3a35b322d80..6c8e302fdac 100644 --- a/sys/dev/pci/if_vr.c +++ b/sys/dev/pci/if_vr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vr.c,v 1.139 2015/03/14 03:38:48 jsg Exp $ */ +/* $OpenBSD: if_vr.c,v 1.140 2015/04/13 08:45:48 mpi Exp $ */ /* * Copyright (c) 1997, 1998 @@ -898,8 +898,7 @@ vr_rxeof(struct vr_softc *sc) #ifdef __STRICT_ALIGNMENT { struct mbuf *m0; - m0 = m_devget(mtod(m, caddr_t), total_len, - ETHER_ALIGN, ifp); + m0 = m_devget(mtod(m, caddr_t), total_len, ETHER_ALIGN); m_freem(m); if (m0 == NULL) { ifp->if_ierrors++; diff --git a/sys/dev/pci/if_wb.c b/sys/dev/pci/if_wb.c index a6f847a8790..1da679a51b1 100644 --- a/sys/dev/pci/if_wb.c +++ b/sys/dev/pci/if_wb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wb.c,v 1.59 2015/04/08 10:07:47 mpi Exp $ */ +/* $OpenBSD: if_wb.c,v 1.60 2015/04/13 08:45:48 mpi Exp $ */ /* * Copyright (c) 1997, 1998 @@ -970,7 +970,7 @@ void wb_rxeof(sc) total_len -= ETHER_CRC_LEN; m = m_devget(cur_rx->wb_buf + sizeof(u_int64_t), total_len, - ETHER_ALIGN, ifp); + ETHER_ALIGN); wb_newbuf(sc, cur_rx); if (m == NULL) { ifp->if_ierrors++; diff --git a/sys/dev/pcmcia/if_malo.c b/sys/dev/pcmcia/if_malo.c index bdf2c99d152..ad1fac43386 100644 --- a/sys/dev/pcmcia/if_malo.c +++ b/sys/dev/pcmcia/if_malo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_malo.c,v 1.83 2015/04/08 10:07:47 mpi Exp $ */ +/* $OpenBSD: if_malo.c,v 1.84 2015/04/13 08:45:48 mpi Exp $ */ /* * Copyright (c) 2007 Marcus Glocker @@ -966,7 +966,7 @@ cmalo_rx(struct malo_softc *sc) /* prepare mbuf */ m = m_devget(sc->sc_data + rxdesc->pkgoffset, - rxdesc->pkglen, ETHER_ALIGN, ifp); + rxdesc->pkglen, ETHER_ALIGN); if (m == NULL) { DPRINTF(1, "RX m_devget failed\n"); ifp->if_ierrors++; diff --git a/sys/dev/usb/if_upgt.c b/sys/dev/usb/if_upgt.c index e7426fc9e29..dd1e0de0b78 100644 --- a/sys/dev/usb/if_upgt.c +++ b/sys/dev/usb/if_upgt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_upgt.c,v 1.67 2015/03/14 03:38:49 jsg Exp $ */ +/* $OpenBSD: if_upgt.c,v 1.68 2015/04/13 08:45:48 mpi Exp $ */ /* * Copyright (c) 2007 Marcus Glocker @@ -1735,7 +1735,7 @@ upgt_rx(struct upgt_softc *sc, uint8_t *data, int pkglen) rxdesc = (struct upgt_lmac_rx_desc *)data; /* create mbuf which is suitable for strict alignment archs */ - m = m_devget(rxdesc->data, pkglen, ETHER_ALIGN, ifp); + m = m_devget(rxdesc->data, pkglen, ETHER_ALIGN); if (m == NULL) { DPRINTF(1, "%s: could not create RX mbuf!\n", sc->sc_dev.dv_xname); ifp->if_ierrors++; diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index eb01ae9a8f0..704bc98af1e 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_mbuf.c,v 1.202 2015/03/14 03:38:51 jsg Exp $ */ +/* $OpenBSD: uipc_mbuf.c,v 1.203 2015/04/13 08:45:48 mpi Exp $ */ /* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */ /* @@ -278,7 +278,7 @@ m_clpool(u_int pktlen) } struct mbuf * -m_clget(struct mbuf *m, int how, struct ifnet *ifp, u_int pktlen) +m_clget(struct mbuf *m, int how, u_int pktlen) { struct mbuf *m0 = NULL; struct pool *pp; @@ -1024,7 +1024,7 @@ extpacket: * Routine to copy from device local memory into mbufs. */ struct mbuf * -m_devget(char *buf, int totlen, int off, struct ifnet *ifp) +m_devget(char *buf, int totlen, int off) { struct mbuf *m; struct mbuf *top, **mp; @@ -1040,7 +1040,6 @@ m_devget(char *buf, int totlen, int off, struct ifnet *ifp) if (m == NULL) return (NULL); - m->m_pkthdr.rcvif = ifp; m->m_pkthdr.len = totlen; len = MHLEN; diff --git a/sys/net/pfkeyv2.c b/sys/net/pfkeyv2.c index 93a88777180..bcc9b67d137 100644 --- a/sys/net/pfkeyv2.c +++ b/sys/net/pfkeyv2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfkeyv2.c,v 1.139 2015/03/26 12:21:37 mikeb Exp $ */ +/* $OpenBSD: pfkeyv2.c,v 1.140 2015/04/13 08:45:48 mpi Exp $ */ /* * @(#)COPYRIGHT 1.1 (NRL) 17 January 1995 @@ -137,7 +137,7 @@ extern struct pool ipsec_policy_pool; int pfdatatopacket(void *data, int len, struct mbuf **packet) { - if (!(*packet = m_devget(data, len, 0, NULL))) + if (!(*packet = m_devget(data, len, 0))) return (ENOMEM); /* Make sure, all data gets zeroized on free */ diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 451136f66e7..76711471eb4 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mbuf.h,v 1.188 2015/04/10 11:02:12 dlg Exp $ */ +/* $OpenBSD: mbuf.h,v 1.189 2015/04/13 08:45:48 mpi Exp $ */ /* $NetBSD: mbuf.h,v 1.19 1996/02/09 18:25:14 christos Exp $ */ /* @@ -301,8 +301,8 @@ struct mbuf { MCLINITREFERENCE(m); \ } while (/* CONSTCOND */ 0) -#define MCLGET(m, how) (void) m_clget((m), (how), NULL, MCLBYTES) -#define MCLGETI(m, how, ifp, l) m_clget((m), (how), (ifp), (l)) +#define MCLGET(m, how) (void) m_clget((m), (how), MCLBYTES) +#define MCLGETI(m, how, ifp, l) m_clget((m), (how), (l)) /* * MFREE(struct mbuf *m, struct mbuf *n) @@ -425,7 +425,7 @@ struct mbuf *m_inject(struct mbuf *, int, int, int); struct mbuf *m_getptr(struct mbuf *, int, int *); int m_leadingspace(struct mbuf *); int m_trailingspace(struct mbuf *); -struct mbuf *m_clget(struct mbuf *, int, struct ifnet *, u_int); +struct mbuf *m_clget(struct mbuf *, int, u_int); void m_extref(struct mbuf *, struct mbuf *); void m_extfree_pool(caddr_t, u_int, void *); void m_adj(struct mbuf *, int); @@ -434,7 +434,7 @@ void m_freem(struct mbuf *); void m_reclaim(void *, int); void m_copydata(struct mbuf *, int, int, caddr_t); void m_cat(struct mbuf *, struct mbuf *); -struct mbuf *m_devget(char *, int, int, struct ifnet *); +struct mbuf *m_devget(char *, int, int); int m_apply(struct mbuf *, int, int, int (*)(caddr_t, caddr_t, unsigned int), caddr_t); int m_dup_pkthdr(struct mbuf *, struct mbuf *, int); -- 2.20.1