1/* $NetBSD: midway.c,v 1.30 1997/09/29 17:40:38 chuck Exp $ */
2/* (sync'd to midway.c 1.68) */
3
4/*-
5 * Copyright (c) 1996 Charles D. Cranor and Washington University.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
--- 18 unchanged lines hidden (view full) ---
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34#include <sys/cdefs.h>
35__FBSDID("$FreeBSD: head/sys/dev/en/midway.c 177599 2008-03-25 09:39:02Z ru $");
36
37/*
38 *
39 * m i d w a y . c e n i 1 5 5 d r i v e r
40 *
41 * author: Chuck Cranor <chuck@ccrc.wustl.edu>
42 * started: spring, 1996 (written from scratch).
43 *
--- 786 unchanged lines hidden (view full) ---
830 *
831 * LOCK: any, not needed
832 */
833static struct mbuf *
834copy_mbuf(struct mbuf *m)
835{
836 struct mbuf *new;
837
838 MGET(new, M_WAIT, MT_DATA);
839
840 if (m->m_flags & M_PKTHDR) {
841 M_MOVE_PKTHDR(new, m);
842 if (m->m_len > MHLEN)
843 MCLGET(new, M_WAIT);
844 } else {
845 if (m->m_len > MLEN)
846 MCLGET(new, M_WAIT);
847 }
848
849 bcopy(m->m_data, new->m_data, m->m_len);
850 new->m_len = m->m_len;
851 new->m_flags &= ~M_RDONLY;
852
853 return (new);
854}
--- 2060 unchanged lines hidden (view full) ---
2915#endif
2916
2917 IFP2IFATM(sc->ifp)->phy = &sc->utopia;
2918 utopia_attach(&sc->utopia, IFP2IFATM(sc->ifp), &sc->media, &sc->en_mtx,
2919 &sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
2920 &en_utopia_methods);
2921 utopia_init_media(&sc->utopia);
2922
2923 MGET(sc->padbuf, M_WAIT, MT_DATA);
2924 bzero(sc->padbuf->m_data, MLEN);
2925
2926 if (bus_dma_tag_create(NULL, 1, 0,
2927 BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
2928 EN_TXSZ * 1024, EN_MAX_DMASEG, EN_TXSZ * 1024, 0,
2929 NULL, NULL, &sc->txtag))
2930 goto fail;
2931
--- 429 unchanged lines hidden ---
2/* (sync'd to midway.c 1.68) */
3
4/*-
5 * Copyright (c) 1996 Charles D. Cranor and Washington University.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
--- 18 unchanged lines hidden (view full) ---
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34#include <sys/cdefs.h>
35__FBSDID("$FreeBSD: head/sys/dev/en/midway.c 177599 2008-03-25 09:39:02Z ru $");
36
37/*
38 *
39 * m i d w a y . c e n i 1 5 5 d r i v e r
40 *
41 * author: Chuck Cranor <chuck@ccrc.wustl.edu>
42 * started: spring, 1996 (written from scratch).
43 *
--- 786 unchanged lines hidden (view full) ---
830 *
831 * LOCK: any, not needed
832 */
833static struct mbuf *
834copy_mbuf(struct mbuf *m)
835{
836 struct mbuf *new;
837
838 MGET(new, M_WAIT, MT_DATA);
839
840 if (m->m_flags & M_PKTHDR) {
841 M_MOVE_PKTHDR(new, m);
842 if (m->m_len > MHLEN)
843 MCLGET(new, M_WAIT);
844 } else {
845 if (m->m_len > MLEN)
846 MCLGET(new, M_WAIT);
847 }
848
849 bcopy(m->m_data, new->m_data, m->m_len);
850 new->m_len = m->m_len;
851 new->m_flags &= ~M_RDONLY;
852
853 return (new);
854}
--- 2060 unchanged lines hidden (view full) ---
2915#endif
2916
2917 IFP2IFATM(sc->ifp)->phy = &sc->utopia;
2918 utopia_attach(&sc->utopia, IFP2IFATM(sc->ifp), &sc->media, &sc->en_mtx,
2919 &sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
2920 &en_utopia_methods);
2921 utopia_init_media(&sc->utopia);
2922
2923 MGET(sc->padbuf, M_WAIT, MT_DATA);
2924 bzero(sc->padbuf->m_data, MLEN);
2925
2926 if (bus_dma_tag_create(NULL, 1, 0,
2927 BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
2928 EN_TXSZ * 1024, EN_MAX_DMASEG, EN_TXSZ * 1024, 0,
2929 NULL, NULL, &sc->txtag))
2930 goto fail;
2931
--- 429 unchanged lines hidden ---