diff options
author | 2008-10-14 18:01:53 +0000 | |
---|---|---|
committer | 2008-10-14 18:01:53 +0000 | |
commit | 726f1e82439c1428de93ce6b73c8465b84018b9f (patch) | |
tree | 323b3a975737123fb991acc7b59964b144235af0 /sys/dev | |
parent | Add luphy(4). (diff) | |
download | wireguard-openbsd-726f1e82439c1428de93ce6b73c8465b84018b9f.tar.xz wireguard-openbsd-726f1e82439c1428de93ce6b73c8465b84018b9f.zip |
Change m_devget()'s outdated and unused "offset" argument: It is
now the offset into the first mbuf of the target chain before copying
the source data over. From FreeBSD.
Convert drivers' use of m_devget(). Mostly from thib@.
Update mbuf(9) man page.
ok claudio@, thib@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ic/dc.c | 7 | ||||
-rw-r--r-- | sys/dev/ic/mtd8xx.c | 7 | ||||
-rw-r--r-- | sys/dev/ic/rtl81x9.c | 19 | ||||
-rw-r--r-- | sys/dev/pci/if_bge.c | 9 | ||||
-rw-r--r-- | sys/dev/pci/if_cas.c | 13 | ||||
-rw-r--r-- | sys/dev/pci/if_msk.c | 7 | ||||
-rw-r--r-- | sys/dev/pci/if_sis.c | 7 | ||||
-rw-r--r-- | sys/dev/pci/if_sk.c | 7 | ||||
-rw-r--r-- | sys/dev/pci/if_ti.c | 7 | ||||
-rw-r--r-- | sys/dev/pci/if_vge.c | 8 | ||||
-rw-r--r-- | sys/dev/pci/if_vr.c | 7 | ||||
-rw-r--r-- | sys/dev/pci/if_wb.c | 7 | ||||
-rw-r--r-- | sys/dev/pcmcia/if_malo.c | 7 | ||||
-rw-r--r-- | sys/dev/usb/if_upgt.c | 6 |
14 files changed, 48 insertions, 70 deletions
diff --git a/sys/dev/ic/dc.c b/sys/dev/ic/dc.c index 1f6be3b776e..232494a990b 100644 --- a/sys/dev/ic/dc.c +++ b/sys/dev/ic/dc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dc.c,v 1.104 2008/10/02 20:21:13 brad Exp $ */ +/* $OpenBSD: dc.c,v 1.105 2008/10/14 18:01:53 naddy Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -2183,15 +2183,14 @@ dc_rxeof(struct dc_softc *sc) total_len -= ETHER_CRC_LEN; m->m_pkthdr.rcvif = ifp; - m0 = m_devget(mtod(m, char *) - ETHER_ALIGN, - total_len + ETHER_ALIGN, 0, ifp, NULL); + m0 = m_devget(mtod(m, char *), total_len, ETHER_ALIGN, + ifp, NULL); dc_newbuf(sc, i, m); DC_INC(i, DC_RX_LIST_CNT); if (m0 == NULL) { ifp->if_ierrors++; continue; } - m_adj(m0, ETHER_ALIGN); m = m0; ifp->if_ipackets++; diff --git a/sys/dev/ic/mtd8xx.c b/sys/dev/ic/mtd8xx.c index 0256e67a490..3fa3f8daa8b 100644 --- a/sys/dev/ic/mtd8xx.c +++ b/sys/dev/ic/mtd8xx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mtd8xx.c,v 1.14 2008/10/02 20:21:13 brad Exp $ */ +/* $OpenBSD: mtd8xx.c,v 1.15 2008/10/14 18:01:53 naddy Exp $ */ /* * Copyright (c) 2003 Oleg Safiullin <form@pdp11.org.ru> @@ -945,15 +945,14 @@ 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 *) - ETHER_ALIGN, total_len + ETHER_ALIGN, - 0, ifp, NULL); + m0 = m_devget(mtod(m, char *), total_len, ETHER_ALIGN, + ifp, NULL); mtd_newbuf(sc, i, m); i = (i + 1) % MTD_RX_LIST_CNT; if (m0 == NULL) { ifp->if_ierrors++; continue; } - m_adj(m0, ETHER_ALIGN); m = m0; ifp->if_ipackets++; diff --git a/sys/dev/ic/rtl81x9.c b/sys/dev/ic/rtl81x9.c index f7e9c98f9d9..3a0256f699e 100644 --- a/sys/dev/ic/rtl81x9.c +++ b/sys/dev/ic/rtl81x9.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtl81x9.c,v 1.60 2008/10/02 20:21:13 brad Exp $ */ +/* $OpenBSD: rtl81x9.c,v 1.61 2008/10/14 18:01:53 naddy Exp $ */ /* * Copyright (c) 1997, 1998 @@ -676,27 +676,22 @@ rl_rxeof(sc) wrap = (sc->rl_cdata.rl_rx_buf + RL_RXBUFLEN) - rxbufpos; if (total_len > wrap) { - m = m_devget(rxbufpos - ETHER_ALIGN, - wrap + ETHER_ALIGN, 0, ifp, NULL); + m = m_devget(rxbufpos, wrap, ETHER_ALIGN, ifp, NULL); if (m == NULL) ifp->if_ierrors++; else { - m_copyback(m, wrap + ETHER_ALIGN, - total_len - wrap, sc->rl_cdata.rl_rx_buf); - m = m_pullup(m, sizeof(struct ip) +ETHER_ALIGN); + m_copyback(m, wrap, total_len - wrap, + sc->rl_cdata.rl_rx_buf); + m = m_pullup(m, sizeof(struct ip)); if (m == NULL) ifp->if_ierrors++; - else - m_adj(m, ETHER_ALIGN); } cur_rx = (total_len - wrap + ETHER_CRC_LEN); } else { - m = m_devget(rxbufpos - ETHER_ALIGN, - total_len + ETHER_ALIGN, 0, ifp, NULL); + m = m_devget(rxbufpos, total_len, ETHER_ALIGN, ifp, + NULL); if (m == NULL) ifp->if_ierrors++; - else - m_adj(m, ETHER_ALIGN); cur_rx += total_len + 4 + ETHER_CRC_LEN; } diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c index 539479badda..7ef02187d77 100644 --- a/sys/dev/pci/if_bge.c +++ b/sys/dev/pci/if_bge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bge.c,v 1.246 2008/10/02 20:21:14 brad Exp $ */ +/* $OpenBSD: if_bge.c,v 1.247 2008/10/14 18:01:53 naddy Exp $ */ /* * Copyright (c) 2001 Wind River Systems @@ -2468,15 +2468,14 @@ bge_rxeof(struct bge_softc *sc) if (bge_newbuf_jumbo(sc, sc->bge_jumbo, NULL) == ENOBUFS) { struct mbuf *m0; - m0 = m_devget(mtod(m, char *) - ETHER_ALIGN, - cur_rx->bge_len - ETHER_CRC_LEN + - ETHER_ALIGN, 0, ifp, NULL); + m0 = m_devget(mtod(m, char *), + cur_rx->bge_len - ETHER_CRC_LEN, + ETHER_ALIGN, ifp, NULL); bge_newbuf_jumbo(sc, sc->bge_jumbo, m); if (m0 == NULL) { ifp->if_ierrors++; continue; } - m_adj(m0, ETHER_ALIGN); m = m0; } } else { diff --git a/sys/dev/pci/if_cas.c b/sys/dev/pci/if_cas.c index a6cfd556c05..4c42eb8bbe0 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.22 2008/10/02 20:21:14 brad Exp $ */ +/* $OpenBSD: if_cas.c,v 1.23 2008/10/14 18:01:53 naddy Exp $ */ /* * @@ -1205,14 +1205,13 @@ cas_rint(struct cas_softc *sc) bus_dmamap_sync(sc->sc_dmatag, rxs->rxs_dmamap, 0, rxs->rxs_dmamap->dm_mapsize, BUS_DMASYNC_POSTREAD); - cp = rxs->rxs_kva + off * 256; - m = m_devget(cp, len + ETHER_ALIGN, 0, ifp, NULL); + cp = rxs->rxs_kva + off * 256 + ETHER_ALIGN; + m = m_devget(cp, len, ETHER_ALIGN, ifp, NULL); if (word[0] & CAS_RC0_RELEASE_HDR) cas_add_rxbuf(sc, idx); if (m != NULL) { - m_adj(m, ETHER_ALIGN); #if NBPFILTER > 0 /* @@ -1242,15 +1241,13 @@ cas_rint(struct cas_softc *sc) rxs->rxs_dmamap->dm_mapsize, BUS_DMASYNC_POSTREAD); /* XXX We should not be copying the packet here. */ - cp = rxs->rxs_kva + off; - m = m_devget(cp, len + ETHER_ALIGN, 0, ifp, NULL); + cp = rxs->rxs_kva + off + ETHER_ALIGN; + m = m_devget(cp, len, ETHER_ALIGN, ifp, NULL); if (word[0] & CAS_RC0_RELEASE_DATA) cas_add_rxbuf(sc, idx); if (m != NULL) { - m_adj(m, ETHER_ALIGN); - #if NBPFILTER > 0 /* * Pass this up to any BPF listeners, but only diff --git a/sys/dev/pci/if_msk.c b/sys/dev/pci/if_msk.c index 489ef5e9b96..ad9c0958fad 100644 --- a/sys/dev/pci/if_msk.c +++ b/sys/dev/pci/if_msk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_msk.c,v 1.66 2008/10/02 20:21:14 brad Exp $ */ +/* $OpenBSD: if_msk.c,v 1.67 2008/10/14 18:01:53 naddy Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -1702,14 +1702,13 @@ msk_rxeof(struct sk_if_softc *sc_if, u_int16_t len, u_int32_t rxstat) */ if (msk_newbuf(sc_if, cur, NULL, dmamap) == ENOBUFS) { struct mbuf *m0; - m0 = m_devget(mtod(m, char *) - ETHER_ALIGN, - total_len + ETHER_ALIGN, 0, ifp, NULL); + m0 = m_devget(mtod(m, char *), total_len, ETHER_ALIGN, + ifp, NULL); msk_newbuf(sc_if, cur, m, dmamap); if (m0 == NULL) { ifp->if_ierrors++; return; } - m_adj(m0, ETHER_ALIGN); m = m0; } else { m->m_pkthdr.rcvif = ifp; diff --git a/sys/dev/pci/if_sis.c b/sys/dev/pci/if_sis.c index 34fd7dac425..d1d94d5b1fc 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.82 2008/10/02 20:21:14 brad Exp $ */ +/* $OpenBSD: if_sis.c,v 1.83 2008/10/14 18:01:53 naddy Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. @@ -1344,14 +1344,13 @@ sis_rxeof(struct sis_softc *sc) #endif { struct mbuf *m0; - m0 = m_devget(mtod(m, char *) - ETHER_ALIGN, - total_len + ETHER_ALIGN, 0, ifp, NULL); + m0 = m_devget(mtod(m, char *), total_len, ETHER_ALIGN, + ifp, NULL); sis_newbuf(sc, cur_rx, m); if (m0 == NULL) { ifp->if_ierrors++; continue; } - m_adj(m0, ETHER_ALIGN); m = m0; } diff --git a/sys/dev/pci/if_sk.c b/sys/dev/pci/if_sk.c index 13c3b8b0e4c..40466aa83f7 100644 --- a/sys/dev/pci/if_sk.c +++ b/sys/dev/pci/if_sk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sk.c,v 1.148 2008/10/02 20:21:14 brad Exp $ */ +/* $OpenBSD: if_sk.c,v 1.149 2008/10/14 18:01:53 naddy Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -1777,14 +1777,13 @@ sk_rxeof(struct sk_if_softc *sc_if) */ if (sk_newbuf(sc_if, cur, NULL, dmamap) == ENOBUFS) { struct mbuf *m0; - m0 = m_devget(mtod(m, char *) - ETHER_ALIGN, - total_len + ETHER_ALIGN, 0, ifp, NULL); + m0 = m_devget(mtod(m, char *), total_len, ETHER_ALIGN, + ifp, NULL); sk_newbuf(sc_if, cur, m, dmamap); if (m0 == NULL) { ifp->if_ierrors++; continue; } - m_adj(m0, ETHER_ALIGN); m = m0; } else { m->m_pkthdr.rcvif = ifp; diff --git a/sys/dev/pci/if_ti.c b/sys/dev/pci/if_ti.c index a0045948c75..4520179b368 100644 --- a/sys/dev/pci/if_ti.c +++ b/sys/dev/pci/if_ti.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ti.c,v 1.88 2008/10/02 20:21:14 brad Exp $ */ +/* $OpenBSD: if_ti.c,v 1.89 2008/10/14 18:01:53 naddy Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -1787,14 +1787,13 @@ ti_rxeof(struct ti_softc *sc) if (ti_newbuf_jumbo(sc, sc->ti_jumbo, NULL) == ENOBUFS) { struct mbuf *m0; - m0 = m_devget(mtod(m, char *) - ETHER_ALIGN, - cur_rx->ti_len + ETHER_ALIGN, 0, ifp, NULL); + m0 = m_devget(mtod(m, char *), cur_rx->ti_len, + ETHER_ALIGN, ifp, NULL); ti_newbuf_jumbo(sc, sc->ti_jumbo, m); if (m0 == NULL) { ifp->if_ierrors++; continue; } - m_adj(m0, ETHER_ALIGN); m = m0; } } else if (cur_rx->ti_flags & TI_BDFLAG_MINI_RING) { diff --git a/sys/dev/pci/if_vge.c b/sys/dev/pci/if_vge.c index 8259c41a1bf..1c1de93f34c 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.39 2008/10/02 20:21:14 brad Exp $ */ +/* $OpenBSD: if_vge.c,v 1.40 2008/10/14 18:01:53 naddy Exp $ */ /* $FreeBSD: if_vge.c,v 1.3 2004/09/11 22:13:25 wpaul Exp $ */ /* * Copyright (c) 2004 @@ -1031,15 +1031,13 @@ vge_rxeof(struct vge_softc *sc) sc->vge_head = sc->vge_tail = NULL; } - m0 = m_devget(mtod(m, char *) - ETHER_ALIGN, - total_len - ETHER_CRC_LEN + ETHER_ALIGN, - 0, ifp, NULL); + m0 = m_devget(mtod(m, char *), + total_len - ETHER_CRC_LEN, ETHER_ALIGN, ifp, NULL); vge_newbuf(sc, i, m); if (m0 == NULL) { ifp->if_ierrors++; continue; } - m_adj(m0, ETHER_ALIGN); m = m0; VGE_RX_DESC_INC(i); diff --git a/sys/dev/pci/if_vr.c b/sys/dev/pci/if_vr.c index e4def20edf5..90d0d884645 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.78 2008/10/02 20:21:14 brad Exp $ */ +/* $OpenBSD: if_vr.c,v 1.79 2008/10/14 18:01:53 naddy Exp $ */ /* * Copyright (c) 1997, 1998 @@ -806,14 +806,13 @@ vr_rxeof(struct vr_softc *sc) } else #endif { - m0 = m_devget(mtod(m, caddr_t) - ETHER_ALIGN, - total_len + ETHER_ALIGN, 0, ifp, NULL); + m0 = m_devget(mtod(m, caddr_t), total_len, + ETHER_ALIGN, ifp, NULL); vr_alloc_mbuf(sc, cur_rx, m); if (m0 == NULL) { ifp->if_ierrors++; continue; } - m_adj(m0, ETHER_ALIGN); m = m0; } diff --git a/sys/dev/pci/if_wb.c b/sys/dev/pci/if_wb.c index e94485747a7..4b3d36dc0e4 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.40 2008/10/02 20:21:14 brad Exp $ */ +/* $OpenBSD: if_wb.c,v 1.41 2008/10/14 18:01:53 naddy Exp $ */ /* * Copyright (c) 1997, 1998 @@ -1050,14 +1050,13 @@ void wb_rxeof(sc) */ total_len -= ETHER_CRC_LEN; - m0 = m_devget(mtod(m, char *) - ETHER_ALIGN, - total_len + ETHER_ALIGN, 0, ifp, NULL); + m0 = m_devget(mtod(m, char *), total_len, ETHER_ALIGN, + ifp, NULL); wb_newbuf(sc, cur_rx, m); if (m0 == NULL) { ifp->if_ierrors++; break; } - m_adj(m0, ETHER_ALIGN); m = m0; ifp->if_ipackets++; diff --git a/sys/dev/pcmcia/if_malo.c b/sys/dev/pcmcia/if_malo.c index d8ff907f818..ba2395d7a66 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.63 2008/07/29 10:05:38 thib Exp $ */ +/* $OpenBSD: if_malo.c,v 1.64 2008/10/14 18:01:53 naddy Exp $ */ /* * Copyright (c) 2007 Marcus Glocker <mglocker@openbsd.org> @@ -927,14 +927,13 @@ cmalo_rx(struct malo_softc *sc) rxdesc->pkglen -= sizeof(struct llc); /* prepare mbuf */ - m = m_devget(sc->sc_data + rxdesc->pkgoffset - ETHER_ALIGN, - rxdesc->pkglen + ETHER_ALIGN, 0, ifp, NULL); + m = m_devget(sc->sc_data + rxdesc->pkgoffset, + rxdesc->pkglen, ETHER_ALIGN, ifp, NULL); if (m == NULL) { DPRINTF(1, "RX m_devget failed!\n"); ifp->if_ierrors++; return; } - m_adj(m, ETHER_ALIGN); #if NBPFILTER > 0 if (ifp->if_bpf) diff --git a/sys/dev/usb/if_upgt.c b/sys/dev/usb/if_upgt.c index a7496e3319f..3981c81c901 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.38 2008/08/27 10:34:24 damien Exp $ */ +/* $OpenBSD: if_upgt.c,v 1.39 2008/10/14 18:01:53 naddy Exp $ */ /* * Copyright (c) 2007 Marcus Glocker <mglocker@openbsd.org> @@ -1780,14 +1780,12 @@ 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 - ETHER_ALIGN, pkglen + ETHER_ALIGN, 0, ifp, - NULL); + m = m_devget(rxdesc->data, pkglen, ETHER_ALIGN, ifp, NULL); if (m == NULL) { DPRINTF(1, "%s: could not create RX mbuf!\n", sc->sc_dev.dv_xname); ifp->if_ierrors++; return; } - m_adj(m, ETHER_ALIGN); s = splnet(); |