| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: gemini_gmac.c,v 1.9 2016/06/10 13:27:11 ozaki-r Exp $ */ | | 1 | /* $NetBSD: gemini_gmac.c,v 1.10 2016/12/06 07:09:38 ozaki-r Exp $ */ |
2 | /*- | | 2 | /*- |
3 | * Copyright (c) 2008 The NetBSD Foundation, Inc. | | 3 | * Copyright (c) 2008 The NetBSD Foundation, Inc. |
4 | * All rights reserved. | | 4 | * All rights reserved. |
5 | * | | 5 | * |
6 | * This code is derived from software contributed to The NetBSD Foundation | | 6 | * This code is derived from software contributed to The NetBSD Foundation |
7 | * by Matt Thomas <matt@3am-software.com> | | 7 | * by Matt Thomas <matt@3am-software.com> |
8 | * | | 8 | * |
9 | * Redistribution and use in source and binary forms, with or without | | 9 | * Redistribution and use in source and binary forms, with or without |
10 | * modification, are permitted provided that the following conditions | | 10 | * modification, are permitted provided that the following conditions |
11 | * are met: | | 11 | * are met: |
12 | * 1. Redistributions of source code must retain the above copyright | | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * 2. Redistributions in binary form must reproduce the above copyright | | 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| @@ -39,27 +39,27 @@ | | | @@ -39,27 +39,27 @@ |
39 | | | 39 | |
40 | #include <sys/bus.h> | | 40 | #include <sys/bus.h> |
41 | | | 41 | |
42 | #include <arm/gemini/gemini_reg.h> | | 42 | #include <arm/gemini/gemini_reg.h> |
43 | #include <arm/gemini/gemini_obiovar.h> | | 43 | #include <arm/gemini/gemini_obiovar.h> |
44 | #include <arm/gemini/gemini_gmacvar.h> | | 44 | #include <arm/gemini/gemini_gmacvar.h> |
45 | #include <arm/gemini/gemini_gpiovar.h> | | 45 | #include <arm/gemini/gemini_gpiovar.h> |
46 | | | 46 | |
47 | #include <dev/mii/mii.h> | | 47 | #include <dev/mii/mii.h> |
48 | #include <dev/mii/mii_bitbang.h> | | 48 | #include <dev/mii/mii_bitbang.h> |
49 | | | 49 | |
50 | #include <sys/gpio.h> | | 50 | #include <sys/gpio.h> |
51 | | | 51 | |
52 | __KERNEL_RCSID(0, "$NetBSD: gemini_gmac.c,v 1.9 2016/06/10 13:27:11 ozaki-r Exp $"); | | 52 | __KERNEL_RCSID(0, "$NetBSD: gemini_gmac.c,v 1.10 2016/12/06 07:09:38 ozaki-r Exp $"); |
53 | | | 53 | |
54 | #define SWFREEQ_DESCS 256 /* one page worth */ | | 54 | #define SWFREEQ_DESCS 256 /* one page worth */ |
55 | #define HWFREEQ_DESCS 256 /* one page worth */ | | 55 | #define HWFREEQ_DESCS 256 /* one page worth */ |
56 | | | 56 | |
57 | static int geminigmac_match(device_t, cfdata_t, void *); | | 57 | static int geminigmac_match(device_t, cfdata_t, void *); |
58 | static void geminigmac_attach(device_t, device_t, void *); | | 58 | static void geminigmac_attach(device_t, device_t, void *); |
59 | static int geminigmac_find(device_t, cfdata_t, const int *, void *); | | 59 | static int geminigmac_find(device_t, cfdata_t, const int *, void *); |
60 | static int geminigmac_print(void *aux, const char *name); | | 60 | static int geminigmac_print(void *aux, const char *name); |
61 | | | 61 | |
62 | static int geminigmac_mii_readreg(device_t, int, int); | | 62 | static int geminigmac_mii_readreg(device_t, int, int); |
63 | static void geminigmac_mii_writereg(device_t, int, int, int); | | 63 | static void geminigmac_mii_writereg(device_t, int, int, int); |
64 | | | 64 | |
65 | #define GPIO_MDIO 21 | | 65 | #define GPIO_MDIO 21 |
| @@ -846,27 +846,27 @@ gmac_hwqueue_rxconsume(gmac_hwqueue_t *h | | | @@ -846,27 +846,27 @@ gmac_hwqueue_rxconsume(gmac_hwqueue_t *h |
846 | /* | | 846 | /* |
847 | * Now get the whole chain. | | 847 | * Now get the whole chain. |
848 | */ | | 848 | */ |
849 | m = hwq->hwq_rxmbuf; | | 849 | m = hwq->hwq_rxmbuf; |
850 | m_set_rcvif(m, ifp); /* set receive interface */ | | 850 | m_set_rcvif(m, ifp); /* set receive interface */ |
851 | ifp->if_ipackets++; | | 851 | ifp->if_ipackets++; |
852 | ifp->if_ibytes += m->m_pkthdr.len; | | 852 | ifp->if_ibytes += m->m_pkthdr.len; |
853 | switch (DESC0_RXSTS_GET(d->d_desc0)) { | | 853 | switch (DESC0_RXSTS_GET(d->d_desc0)) { |
854 | case DESC0_RXSTS_GOOD: | | 854 | case DESC0_RXSTS_GOOD: |
855 | case DESC0_RXSTS_LONG: | | 855 | case DESC0_RXSTS_LONG: |
856 | m->m_data += 2; | | 856 | m->m_data += 2; |
857 | KASSERT(m_length(m) == m->m_pkthdr.len); | | 857 | KASSERT(m_length(m) == m->m_pkthdr.len); |
858 | bpf_mtap(ifp, m); | | 858 | bpf_mtap(ifp, m); |
859 | if_input(ifp, m); | | 859 | if_percpuq_enqueue(ifp->if_percpuq, m); |
860 | break; | | 860 | break; |
861 | default: | | 861 | default: |
862 | ifp->if_ierrors++; | | 862 | ifp->if_ierrors++; |
863 | m_freem(m); | | 863 | m_freem(m); |
864 | break; | | 864 | break; |
865 | } | | 865 | } |
866 | hwq->hwq_rxmbuf = NULL; | | 866 | hwq->hwq_rxmbuf = NULL; |
867 | hwq->hwq_mp = &hwq->hwq_rxmbuf; | | 867 | hwq->hwq_mp = &hwq->hwq_rxmbuf; |
868 | | | 868 | |
869 | return true; | | 869 | return true; |
870 | } | | 870 | } |
871 | | | 871 | |
872 | size_t | | 872 | size_t |