| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: dp83932.c,v 1.35 2010/11/13 13:52:00 uebayasi Exp $ */ | | 1 | /* $NetBSD: dp83932.c,v 1.35.28.1 2017/08/18 15:05:29 snj Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2001 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2001 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Jason R. Thorpe. | | 8 | * by Jason R. Thorpe. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -25,27 +25,27 @@ | | | @@ -25,27 +25,27 @@ |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
29 | * POSSIBILITY OF SUCH DAMAGE. | | 29 | * POSSIBILITY OF SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | /* | | 32 | /* |
33 | * Device driver for the National Semiconductor DP83932 | | 33 | * Device driver for the National Semiconductor DP83932 |
34 | * Systems-Oriented Network Interface Controller (SONIC). | | 34 | * Systems-Oriented Network Interface Controller (SONIC). |
35 | */ | | 35 | */ |
36 | | | 36 | |
37 | #include <sys/cdefs.h> | | 37 | #include <sys/cdefs.h> |
38 | __KERNEL_RCSID(0, "$NetBSD: dp83932.c,v 1.35 2010/11/13 13:52:00 uebayasi Exp $"); | | 38 | __KERNEL_RCSID(0, "$NetBSD: dp83932.c,v 1.35.28.1 2017/08/18 15:05:29 snj Exp $"); |
39 | | | 39 | |
40 | | | 40 | |
41 | #include <sys/param.h> | | 41 | #include <sys/param.h> |
42 | #include <sys/systm.h> | | 42 | #include <sys/systm.h> |
43 | #include <sys/mbuf.h> | | 43 | #include <sys/mbuf.h> |
44 | #include <sys/malloc.h> | | 44 | #include <sys/malloc.h> |
45 | #include <sys/kernel.h> | | 45 | #include <sys/kernel.h> |
46 | #include <sys/socket.h> | | 46 | #include <sys/socket.h> |
47 | #include <sys/ioctl.h> | | 47 | #include <sys/ioctl.h> |
48 | #include <sys/errno.h> | | 48 | #include <sys/errno.h> |
49 | #include <sys/device.h> | | 49 | #include <sys/device.h> |
50 | | | 50 | |
51 | #include <net/if.h> | | 51 | #include <net/if.h> |
| @@ -775,28 +775,30 @@ sonic_rxintr(struct sonic_softc *sc) | | | @@ -775,28 +775,30 @@ sonic_rxintr(struct sonic_softc *sc) |
775 | * packet into it, scooted forward 2 bytes to ensure | | 775 | * packet into it, scooted forward 2 bytes to ensure |
776 | * proper alignment. | | 776 | * proper alignment. |
777 | * | | 777 | * |
778 | * Note, in 16-bit mode, we can configure the SONIC | | 778 | * Note, in 16-bit mode, we can configure the SONIC |
779 | * to do what we want, and we have. | | 779 | * to do what we want, and we have. |
780 | */ | | 780 | */ |
781 | #ifndef __NO_STRICT_ALIGNMENT | | 781 | #ifndef __NO_STRICT_ALIGNMENT |
782 | if (sc->sc_32bit) { | | 782 | if (sc->sc_32bit) { |
783 | MGETHDR(m, M_DONTWAIT, MT_DATA); | | 783 | MGETHDR(m, M_DONTWAIT, MT_DATA); |
784 | if (m == NULL) | | 784 | if (m == NULL) |
785 | goto dropit; | | 785 | goto dropit; |
786 | if (len > (MHLEN - 2)) { | | 786 | if (len > (MHLEN - 2)) { |
787 | MCLGET(m, M_DONTWAIT); | | 787 | MCLGET(m, M_DONTWAIT); |
788 | if ((m->m_flags & M_EXT) == 0) | | 788 | if ((m->m_flags & M_EXT) == 0) { |
| | | 789 | m_freem(m); |
789 | goto dropit; | | 790 | goto dropit; |
| | | 791 | } |
790 | } | | 792 | } |
791 | m->m_data += 2; | | 793 | m->m_data += 2; |
792 | /* | | 794 | /* |
793 | * Note that we use a cluster for incoming frames, | | 795 | * Note that we use a cluster for incoming frames, |
794 | * so the buffer is virtually contiguous. | | 796 | * so the buffer is virtually contiguous. |
795 | */ | | 797 | */ |
796 | memcpy(mtod(m, void *), mtod(ds->ds_mbuf, void *), | | 798 | memcpy(mtod(m, void *), mtod(ds->ds_mbuf, void *), |
797 | len); | | 799 | len); |
798 | SONIC_INIT_RXDESC(sc, i); | | 800 | SONIC_INIT_RXDESC(sc, i); |
799 | bus_dmamap_sync(sc->sc_dmat, ds->ds_dmamap, 0, | | 801 | bus_dmamap_sync(sc->sc_dmat, ds->ds_dmamap, 0, |
800 | ds->ds_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD); | | 802 | ds->ds_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD); |
801 | } else | | 803 | } else |
802 | #endif /* ! __NO_STRICT_ALIGNMENT */ | | 804 | #endif /* ! __NO_STRICT_ALIGNMENT */ |