| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: if_ti.c,v 1.112 2019/07/09 08:46:59 msaitoh Exp $ */ | | 1 | /* $NetBSD: if_ti.c,v 1.112.2.1 2020/07/15 17:16:59 martin Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1997, 1998, 1999 | | 4 | * Copyright (c) 1997, 1998, 1999 |
5 | * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. | | 5 | * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -71,27 +71,27 @@ | | | @@ -71,27 +71,27 @@ |
71 | * compiling it requires a GNU toolchain targeted for mips-sgi-irix5.3. | | 71 | * compiling it requires a GNU toolchain targeted for mips-sgi-irix5.3. |
72 | * | | 72 | * |
73 | * The following people deserve special thanks: | | 73 | * The following people deserve special thanks: |
74 | * - Terry Murphy of 3Com, for providing a 3c985 Tigon 1 board | | 74 | * - Terry Murphy of 3Com, for providing a 3c985 Tigon 1 board |
75 | * for testing | | 75 | * for testing |
76 | * - Raymond Lee of Netgear, for providing a pair of Netgear | | 76 | * - Raymond Lee of Netgear, for providing a pair of Netgear |
77 | * GA620 Tigon 2 boards for testing | | 77 | * GA620 Tigon 2 boards for testing |
78 | * - Ulf Zimmermann, for bringing the GA620 to my attention and | | 78 | * - Ulf Zimmermann, for bringing the GA620 to my attention and |
79 | * convincing me to write this driver. | | 79 | * convincing me to write this driver. |
80 | * - Andrew Gallatin for providing FreeBSD/Alpha support. | | 80 | * - Andrew Gallatin for providing FreeBSD/Alpha support. |
81 | */ | | 81 | */ |
82 | | | 82 | |
83 | #include <sys/cdefs.h> | | 83 | #include <sys/cdefs.h> |
84 | __KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.112 2019/07/09 08:46:59 msaitoh Exp $"); | | 84 | __KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.112.2.1 2020/07/15 17:16:59 martin Exp $"); |
85 | | | 85 | |
86 | #include "opt_inet.h" | | 86 | #include "opt_inet.h" |
87 | | | 87 | |
88 | #include <sys/param.h> | | 88 | #include <sys/param.h> |
89 | #include <sys/systm.h> | | 89 | #include <sys/systm.h> |
90 | #include <sys/sockio.h> | | 90 | #include <sys/sockio.h> |
91 | #include <sys/mbuf.h> | | 91 | #include <sys/mbuf.h> |
92 | #include <sys/malloc.h> | | 92 | #include <sys/malloc.h> |
93 | #include <sys/kernel.h> | | 93 | #include <sys/kernel.h> |
94 | #include <sys/socket.h> | | 94 | #include <sys/socket.h> |
95 | #include <sys/queue.h> | | 95 | #include <sys/queue.h> |
96 | #include <sys/device.h> | | 96 | #include <sys/device.h> |
97 | #include <sys/reboot.h> | | 97 | #include <sys/reboot.h> |
| @@ -130,26 +130,28 @@ __KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1. | | | @@ -130,26 +130,28 @@ __KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1. |
130 | static const struct ti_type ti_devs[] = { | | 130 | static const struct ti_type ti_devs[] = { |
131 | { PCI_VENDOR_ALTEON, PCI_PRODUCT_ALTEON_ACENIC, | | 131 | { PCI_VENDOR_ALTEON, PCI_PRODUCT_ALTEON_ACENIC, |
132 | "Alteon AceNIC 1000BASE-SX Ethernet" }, | | 132 | "Alteon AceNIC 1000BASE-SX Ethernet" }, |
133 | { PCI_VENDOR_ALTEON, PCI_PRODUCT_ALTEON_ACENIC_COPPER, | | 133 | { PCI_VENDOR_ALTEON, PCI_PRODUCT_ALTEON_ACENIC_COPPER, |
134 | "Alteon AceNIC 1000BASE-T Ethernet" }, | | 134 | "Alteon AceNIC 1000BASE-T Ethernet" }, |
135 | { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C985, | | 135 | { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C985, |
136 | "3Com 3c985-SX Gigabit Ethernet" }, | | 136 | "3Com 3c985-SX Gigabit Ethernet" }, |
137 | { PCI_VENDOR_NETGEAR, PCI_PRODUCT_NETGEAR_GA620, | | 137 | { PCI_VENDOR_NETGEAR, PCI_PRODUCT_NETGEAR_GA620, |
138 | "Netgear GA620 1000BASE-SX Ethernet" }, | | 138 | "Netgear GA620 1000BASE-SX Ethernet" }, |
139 | { PCI_VENDOR_NETGEAR, PCI_PRODUCT_NETGEAR_GA620T, | | 139 | { PCI_VENDOR_NETGEAR, PCI_PRODUCT_NETGEAR_GA620T, |
140 | "Netgear GA620 1000BASE-T Ethernet" }, | | 140 | "Netgear GA620 1000BASE-T Ethernet" }, |
141 | { PCI_VENDOR_SGI, PCI_PRODUCT_SGI_TIGON, | | 141 | { PCI_VENDOR_SGI, PCI_PRODUCT_SGI_TIGON, |
142 | "Silicon Graphics Gigabit Ethernet" }, | | 142 | "Silicon Graphics Gigabit Ethernet" }, |
| | | 143 | { PCI_VENDOR_DEC, PCI_PRODUCT_DEC_PN9000SX, |
| | | 144 | "Farallon PN9000SX Gigabit Ethernet" }, |
143 | { 0, 0, NULL } | | 145 | { 0, 0, NULL } |
144 | }; | | 146 | }; |
145 | | | 147 | |
146 | static const struct ti_type *ti_type_match(struct pci_attach_args *); | | 148 | static const struct ti_type *ti_type_match(struct pci_attach_args *); |
147 | static int ti_probe(device_t, cfdata_t, void *); | | 149 | static int ti_probe(device_t, cfdata_t, void *); |
148 | static void ti_attach(device_t, device_t, void *); | | 150 | static void ti_attach(device_t, device_t, void *); |
149 | static bool ti_shutdown(device_t, int); | | 151 | static bool ti_shutdown(device_t, int); |
150 | static void ti_txeof_tigon1(struct ti_softc *); | | 152 | static void ti_txeof_tigon1(struct ti_softc *); |
151 | static void ti_txeof_tigon2(struct ti_softc *); | | 153 | static void ti_txeof_tigon2(struct ti_softc *); |
152 | static void ti_rxeof(struct ti_softc *); | | 154 | static void ti_rxeof(struct ti_softc *); |
153 | | | 155 | |
154 | static void ti_stats_update(struct ti_softc *); | | 156 | static void ti_stats_update(struct ti_softc *); |
155 | static int ti_encap_tigon1(struct ti_softc *, struct mbuf *, uint32_t *); | | 157 | static int ti_encap_tigon1(struct ti_softc *, struct mbuf *, uint32_t *); |
| @@ -206,27 +208,27 @@ CFATTACH_DECL_NEW(ti, sizeof(struct ti_s | | | @@ -206,27 +208,27 @@ CFATTACH_DECL_NEW(ti, sizeof(struct ti_s |
206 | * Send an instruction or address to the EEPROM, check for ACK. | | 208 | * Send an instruction or address to the EEPROM, check for ACK. |
207 | */ | | 209 | */ |
208 | static uint32_t | | 210 | static uint32_t |
209 | ti_eeprom_putbyte(struct ti_softc *sc, int byte) | | 211 | ti_eeprom_putbyte(struct ti_softc *sc, int byte) |
210 | { | | 212 | { |
211 | int i, ack = 0; | | 213 | int i, ack = 0; |
212 | | | 214 | |
213 | /* | | 215 | /* |
214 | * Make sure we're in TX mode. | | 216 | * Make sure we're in TX mode. |
215 | */ | | 217 | */ |
216 | TI_SETBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_TXEN); | | 218 | TI_SETBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_TXEN); |
217 | | | 219 | |
218 | /* | | 220 | /* |
219 | * Feed in each bit and stobe the clock. | | 221 | * Feed in each bit and strobe the clock. |
220 | */ | | 222 | */ |
221 | for (i = 0x80; i; i >>= 1) { | | 223 | for (i = 0x80; i; i >>= 1) { |
222 | if (byte & i) { | | 224 | if (byte & i) { |
223 | TI_SETBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_DOUT); | | 225 | TI_SETBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_DOUT); |
224 | } else { | | 226 | } else { |
225 | TI_CLRBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_DOUT); | | 227 | TI_CLRBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_DOUT); |
226 | } | | 228 | } |
227 | DELAY(1); | | 229 | DELAY(1); |
228 | TI_SETBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_CLK); | | 230 | TI_SETBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_CLK); |
229 | DELAY(1); | | 231 | DELAY(1); |
230 | TI_CLRBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_CLK); | | 232 | TI_CLRBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_CLK); |
231 | } | | 233 | } |
232 | | | 234 | |
| @@ -752,27 +754,27 @@ ti_newbuf_std(struct ti_softc *sc, int i | | | @@ -752,27 +754,27 @@ ti_newbuf_std(struct ti_softc *sc, int i |
752 | r->ti_flags = 0; | | 754 | r->ti_flags = 0; |
753 | if (sc->ethercom.ec_if.if_capenable & IFCAP_CSUM_IPv4_Rx) | | 755 | if (sc->ethercom.ec_if.if_capenable & IFCAP_CSUM_IPv4_Rx) |
754 | r->ti_flags |= TI_BDFLAG_IP_CKSUM; | | 756 | r->ti_flags |= TI_BDFLAG_IP_CKSUM; |
755 | if (sc->ethercom.ec_if.if_capenable & | | 757 | if (sc->ethercom.ec_if.if_capenable & |
756 | (IFCAP_CSUM_TCPv4_Rx | IFCAP_CSUM_UDPv4_Rx)) | | 758 | (IFCAP_CSUM_TCPv4_Rx | IFCAP_CSUM_UDPv4_Rx)) |
757 | r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM; | | 759 | r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM; |
758 | r->ti_len = m_new->m_len; /* == ds_len */ | | 760 | r->ti_len = m_new->m_len; /* == ds_len */ |
759 | r->ti_idx = i; | | 761 | r->ti_idx = i; |
760 | | | 762 | |
761 | return (0); | | 763 | return (0); |
762 | } | | 764 | } |
763 | | | 765 | |
764 | /* | | 766 | /* |
765 | * Intialize a mini receive ring descriptor. This only applies to | | 767 | * Initialize a mini receive ring descriptor. This only applies to |
766 | * the Tigon 2. | | 768 | * the Tigon 2. |
767 | */ | | 769 | */ |
768 | static int | | 770 | static int |
769 | ti_newbuf_mini(struct ti_softc *sc, int i, struct mbuf *m, bus_dmamap_t dmamap) | | 771 | ti_newbuf_mini(struct ti_softc *sc, int i, struct mbuf *m, bus_dmamap_t dmamap) |
770 | { | | 772 | { |
771 | struct mbuf *m_new = NULL; | | 773 | struct mbuf *m_new = NULL; |
772 | struct ti_rx_desc *r; | | 774 | struct ti_rx_desc *r; |
773 | int error; | | 775 | int error; |
774 | | | 776 | |
775 | if (dmamap == NULL) { | | 777 | if (dmamap == NULL) { |
776 | /* if (m) panic() */ | | 778 | /* if (m) panic() */ |
777 | | | 779 | |
778 | if ((error = bus_dmamap_create(sc->sc_dmat, MHLEN, 1, | | 780 | if ((error = bus_dmamap_create(sc->sc_dmat, MHLEN, 1, |
| @@ -893,27 +895,27 @@ ti_newbuf_jumbo(struct ti_softc *sc, int | | | @@ -893,27 +895,27 @@ ti_newbuf_jumbo(struct ti_softc *sc, int |
893 | * that's 1MB or memory, which is a lot. For now, we fill only the first | | 895 | * that's 1MB or memory, which is a lot. For now, we fill only the first |
894 | * 256 ring entries and hope that our CPU is fast enough to keep up with | | 896 | * 256 ring entries and hope that our CPU is fast enough to keep up with |
895 | * the NIC. | | 897 | * the NIC. |
896 | */ | | 898 | */ |
897 | static int | | 899 | static int |
898 | ti_init_rx_ring_std(struct ti_softc *sc) | | 900 | ti_init_rx_ring_std(struct ti_softc *sc) |
899 | { | | 901 | { |
900 | int i; | | 902 | int i; |
901 | struct ti_cmd_desc cmd; | | 903 | struct ti_cmd_desc cmd; |
902 | | | 904 | |
903 | for (i = 0; i < TI_SSLOTS; i++) { | | 905 | for (i = 0; i < TI_SSLOTS; i++) { |
904 | if (ti_newbuf_std(sc, i, NULL, 0) == ENOBUFS) | | 906 | if (ti_newbuf_std(sc, i, NULL, 0) == ENOBUFS) |
905 | return (ENOBUFS); | | 907 | return (ENOBUFS); |
906 | }; | | 908 | } |
907 | | | 909 | |
908 | TI_UPDATE_STDPROD(sc, i - 1); | | 910 | TI_UPDATE_STDPROD(sc, i - 1); |
909 | sc->ti_std = i - 1; | | 911 | sc->ti_std = i - 1; |
910 | | | 912 | |
911 | return (0); | | 913 | return (0); |
912 | } | | 914 | } |
913 | | | 915 | |
914 | static void | | 916 | static void |
915 | ti_free_rx_ring_std(struct ti_softc *sc) | | 917 | ti_free_rx_ring_std(struct ti_softc *sc) |
916 | { | | 918 | { |
917 | int i; | | 919 | int i; |
918 | | | 920 | |
919 | for (i = 0; i < TI_STD_RX_RING_CNT; i++) { | | 921 | for (i = 0; i < TI_STD_RX_RING_CNT; i++) { |
| @@ -931,27 +933,27 @@ ti_free_rx_ring_std(struct ti_softc *sc) | | | @@ -931,27 +933,27 @@ ti_free_rx_ring_std(struct ti_softc *sc) |
931 | | | 933 | |
932 | return; | | 934 | return; |
933 | } | | 935 | } |
934 | | | 936 | |
935 | static int | | 937 | static int |
936 | ti_init_rx_ring_jumbo(struct ti_softc *sc) | | 938 | ti_init_rx_ring_jumbo(struct ti_softc *sc) |
937 | { | | 939 | { |
938 | int i; | | 940 | int i; |
939 | struct ti_cmd_desc cmd; | | 941 | struct ti_cmd_desc cmd; |
940 | | | 942 | |
941 | for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { | | 943 | for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { |
942 | if (ti_newbuf_jumbo(sc, i, NULL) == ENOBUFS) | | 944 | if (ti_newbuf_jumbo(sc, i, NULL) == ENOBUFS) |
943 | return (ENOBUFS); | | 945 | return (ENOBUFS); |
944 | }; | | 946 | } |
945 | | | 947 | |
946 | TI_UPDATE_JUMBOPROD(sc, i - 1); | | 948 | TI_UPDATE_JUMBOPROD(sc, i - 1); |
947 | sc->ti_jumbo = i - 1; | | 949 | sc->ti_jumbo = i - 1; |
948 | | | 950 | |
949 | return (0); | | 951 | return (0); |
950 | } | | 952 | } |
951 | | | 953 | |
952 | static void | | 954 | static void |
953 | ti_free_rx_ring_jumbo(struct ti_softc *sc) | | 955 | ti_free_rx_ring_jumbo(struct ti_softc *sc) |
954 | { | | 956 | { |
955 | int i; | | 957 | int i; |
956 | | | 958 | |
957 | for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { | | 959 | for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { |
| @@ -964,27 +966,27 @@ ti_free_rx_ring_jumbo(struct ti_softc *s | | | @@ -964,27 +966,27 @@ ti_free_rx_ring_jumbo(struct ti_softc *s |
964 | } | | 966 | } |
965 | | | 967 | |
966 | return; | | 968 | return; |
967 | } | | 969 | } |
968 | | | 970 | |
969 | static int | | 971 | static int |
970 | ti_init_rx_ring_mini(struct ti_softc *sc) | | 972 | ti_init_rx_ring_mini(struct ti_softc *sc) |
971 | { | | 973 | { |
972 | int i; | | 974 | int i; |
973 | | | 975 | |
974 | for (i = 0; i < TI_MSLOTS; i++) { | | 976 | for (i = 0; i < TI_MSLOTS; i++) { |
975 | if (ti_newbuf_mini(sc, i, NULL, 0) == ENOBUFS) | | 977 | if (ti_newbuf_mini(sc, i, NULL, 0) == ENOBUFS) |
976 | return (ENOBUFS); | | 978 | return (ENOBUFS); |
977 | }; | | 979 | } |
978 | | | 980 | |
979 | TI_UPDATE_MINIPROD(sc, i - 1); | | 981 | TI_UPDATE_MINIPROD(sc, i - 1); |
980 | sc->ti_mini = i - 1; | | 982 | sc->ti_mini = i - 1; |
981 | | | 983 | |
982 | return (0); | | 984 | return (0); |
983 | } | | 985 | } |
984 | | | 986 | |
985 | static void | | 987 | static void |
986 | ti_free_rx_ring_mini(struct ti_softc *sc) | | 988 | ti_free_rx_ring_mini(struct ti_softc *sc) |
987 | { | | 989 | { |
988 | int i; | | 990 | int i; |
989 | | | 991 | |
990 | for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { | | 992 | for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { |
| @@ -2016,30 +2018,28 @@ ti_rxeof(struct ti_softc *sc) | | | @@ -2016,30 +2018,28 @@ ti_rxeof(struct ti_softc *sc) |
2016 | break; | | 2018 | break; |
2017 | default: | | 2019 | default: |
2018 | /* Nothing */; | | 2020 | /* Nothing */; |
2019 | } | | 2021 | } |
2020 | } | | 2022 | } |
2021 | break; | | 2023 | break; |
2022 | } | | 2024 | } |
2023 | #endif | | 2025 | #endif |
2024 | default: | | 2026 | default: |
2025 | /* Nothing. */ | | 2027 | /* Nothing. */ |
2026 | break; | | 2028 | break; |
2027 | } | | 2029 | } |
2028 | | | 2030 | |
2029 | if (cur_rx->ti_flags & TI_BDFLAG_VLAN_TAG) { | | 2031 | if (cur_rx->ti_flags & TI_BDFLAG_VLAN_TAG) |
2030 | /* ti_vlan_tag also has the priority, trim it */ | | 2032 | vlan_set_tag(m, cur_rx->ti_vlan_tag); |
2031 | vlan_set_tag(m, cur_rx->ti_vlan_tag & 0x0fff); | | | |
2032 | } | | | |
2033 | | | 2033 | |
2034 | if_percpuq_enqueue(ifp->if_percpuq, m); | | 2034 | if_percpuq_enqueue(ifp->if_percpuq, m); |
2035 | } | | 2035 | } |
2036 | | | 2036 | |
2037 | /* Only necessary on the Tigon 1. */ | | 2037 | /* Only necessary on the Tigon 1. */ |
2038 | if (sc->ti_hwrev == TI_HWREV_TIGON) | | 2038 | if (sc->ti_hwrev == TI_HWREV_TIGON) |
2039 | CSR_WRITE_4(sc, TI_GCR_RXRETURNCONS_IDX, | | 2039 | CSR_WRITE_4(sc, TI_GCR_RXRETURNCONS_IDX, |
2040 | sc->ti_rx_saved_considx); | | 2040 | sc->ti_rx_saved_considx); |
2041 | | | 2041 | |
2042 | TI_UPDATE_STDPROD(sc, sc->ti_std); | | 2042 | TI_UPDATE_STDPROD(sc, sc->ti_std); |
2043 | TI_UPDATE_MINIPROD(sc, sc->ti_mini); | | 2043 | TI_UPDATE_MINIPROD(sc, sc->ti_mini); |
2044 | TI_UPDATE_JUMBOPROD(sc, sc->ti_jumbo); | | 2044 | TI_UPDATE_JUMBOPROD(sc, sc->ti_jumbo); |
2045 | } | | 2045 | } |
| @@ -2195,27 +2195,27 @@ ti_stats_update(struct ti_softc *sc) | | | @@ -2195,27 +2195,27 @@ ti_stats_update(struct ti_softc *sc) |
2195 | TI_CDSTATSSYNC(sc, BUS_DMASYNC_POSTREAD); | | 2195 | TI_CDSTATSSYNC(sc, BUS_DMASYNC_POSTREAD); |
2196 | | | 2196 | |
2197 | ifp->if_collisions += | | 2197 | ifp->if_collisions += |
2198 | (sc->ti_rdata->ti_info.ti_stats.dot3StatsSingleCollisionFrames + | | 2198 | (sc->ti_rdata->ti_info.ti_stats.dot3StatsSingleCollisionFrames + |
2199 | sc->ti_rdata->ti_info.ti_stats.dot3StatsMultipleCollisionFrames + | | 2199 | sc->ti_rdata->ti_info.ti_stats.dot3StatsMultipleCollisionFrames + |
2200 | sc->ti_rdata->ti_info.ti_stats.dot3StatsExcessiveCollisions + | | 2200 | sc->ti_rdata->ti_info.ti_stats.dot3StatsExcessiveCollisions + |
2201 | sc->ti_rdata->ti_info.ti_stats.dot3StatsLateCollisions) - | | 2201 | sc->ti_rdata->ti_info.ti_stats.dot3StatsLateCollisions) - |
2202 | ifp->if_collisions; | | 2202 | ifp->if_collisions; |
2203 | | | 2203 | |
2204 | TI_CDSTATSSYNC(sc, BUS_DMASYNC_PREREAD); | | 2204 | TI_CDSTATSSYNC(sc, BUS_DMASYNC_PREREAD); |
2205 | } | | 2205 | } |
2206 | | | 2206 | |
2207 | /* | | 2207 | /* |
2208 | * Encapsulate an mbuf chain in the tx ring by coupling the mbuf data | | 2208 | * Encapsulate an mbuf chain in the tx ring by coupling the mbuf data |
2209 | * pointers to descriptors. | | 2209 | * pointers to descriptors. |
2210 | */ | | 2210 | */ |
2211 | static int | | 2211 | static int |
2212 | ti_encap_tigon1(struct ti_softc *sc, struct mbuf *m_head, uint32_t *txidx) | | 2212 | ti_encap_tigon1(struct ti_softc *sc, struct mbuf *m_head, uint32_t *txidx) |
2213 | { | | 2213 | { |
2214 | struct ti_tx_desc *f = NULL; | | 2214 | struct ti_tx_desc *f = NULL; |
2215 | uint32_t frag, cur, cnt = 0; | | 2215 | uint32_t frag, cur, cnt = 0; |
2216 | struct txdmamap_pool_entry *dma; | | 2216 | struct txdmamap_pool_entry *dma; |
2217 | bus_dmamap_t dmamap; | | 2217 | bus_dmamap_t dmamap; |
2218 | int error, i; | | 2218 | int error, i; |
2219 | uint16_t csum_flags = 0; | | 2219 | uint16_t csum_flags = 0; |
2220 | | | 2220 | |
2221 | dma = SIMPLEQ_FIRST(&sc->txdma_list); | | 2221 | dma = SIMPLEQ_FIRST(&sc->txdma_list); |
| @@ -2674,27 +2674,27 @@ ti_ifmedia_sts(struct ifnet *ifp, struct | | | @@ -2674,27 +2674,27 @@ ti_ifmedia_sts(struct ifnet *ifp, struct |
2674 | if (media & TI_LNK_FULL_DUPLEX) | | 2674 | if (media & TI_LNK_FULL_DUPLEX) |
2675 | ifmr->ifm_active |= IFM_FDX; | | 2675 | ifmr->ifm_active |= IFM_FDX; |
2676 | if (media & TI_LNK_HALF_DUPLEX) | | 2676 | if (media & TI_LNK_HALF_DUPLEX) |
2677 | ifmr->ifm_active |= IFM_HDX; | | 2677 | ifmr->ifm_active |= IFM_HDX; |
2678 | } | | 2678 | } |
2679 | | | 2679 | |
2680 | sc->ethercom.ec_if.if_baudrate = | | 2680 | sc->ethercom.ec_if.if_baudrate = |
2681 | ifmedia_baudrate(sc->ifmedia.ifm_media); | | 2681 | ifmedia_baudrate(sc->ifmedia.ifm_media); |
2682 | } | | 2682 | } |
2683 | | | 2683 | |
2684 | static int | | 2684 | static int |
2685 | ti_ether_ioctl(struct ifnet *ifp, u_long cmd, void *data) | | 2685 | ti_ether_ioctl(struct ifnet *ifp, u_long cmd, void *data) |
2686 | { | | 2686 | { |
2687 | struct ifaddr *ifa = (struct ifaddr *) data; | | 2687 | struct ifaddr *ifa = (struct ifaddr *)data; |
2688 | struct ti_softc *sc = ifp->if_softc; | | 2688 | struct ti_softc *sc = ifp->if_softc; |
2689 | | | 2689 | |
2690 | if ((ifp->if_flags & IFF_UP) == 0) { | | 2690 | if ((ifp->if_flags & IFF_UP) == 0) { |
2691 | ifp->if_flags |= IFF_UP; | | 2691 | ifp->if_flags |= IFF_UP; |
2692 | ti_init(sc); | | 2692 | ti_init(sc); |
2693 | } | | 2693 | } |
2694 | | | 2694 | |
2695 | switch (cmd) { | | 2695 | switch (cmd) { |
2696 | case SIOCINITIFADDR: | | 2696 | case SIOCINITIFADDR: |
2697 | | | 2697 | |
2698 | switch (ifa->ifa_addr->sa_family) { | | 2698 | switch (ifa->ifa_addr->sa_family) { |
2699 | #ifdef INET | | 2699 | #ifdef INET |
2700 | case AF_INET: | | 2700 | case AF_INET: |
| @@ -2707,27 +2707,27 @@ ti_ether_ioctl(struct ifnet *ifp, u_long | | | @@ -2707,27 +2707,27 @@ ti_ether_ioctl(struct ifnet *ifp, u_long |
2707 | break; | | 2707 | break; |
2708 | | | 2708 | |
2709 | default: | | 2709 | default: |
2710 | return (EINVAL); | | 2710 | return (EINVAL); |
2711 | } | | 2711 | } |
2712 | | | 2712 | |
2713 | return (0); | | 2713 | return (0); |
2714 | } | | 2714 | } |
2715 | | | 2715 | |
2716 | static int | | 2716 | static int |
2717 | ti_ioctl(struct ifnet *ifp, u_long command, void *data) | | 2717 | ti_ioctl(struct ifnet *ifp, u_long command, void *data) |
2718 | { | | 2718 | { |
2719 | struct ti_softc *sc = ifp->if_softc; | | 2719 | struct ti_softc *sc = ifp->if_softc; |
2720 | struct ifreq *ifr = (struct ifreq *) data; | | 2720 | struct ifreq *ifr = (struct ifreq *)data; |
2721 | int s, error = 0; | | 2721 | int s, error = 0; |
2722 | struct ti_cmd_desc cmd; | | 2722 | struct ti_cmd_desc cmd; |
2723 | | | 2723 | |
2724 | s = splnet(); | | 2724 | s = splnet(); |
2725 | | | 2725 | |
2726 | switch (command) { | | 2726 | switch (command) { |
2727 | case SIOCINITIFADDR: | | 2727 | case SIOCINITIFADDR: |
2728 | error = ti_ether_ioctl(ifp, command, data); | | 2728 | error = ti_ether_ioctl(ifp, command, data); |
2729 | break; | | 2729 | break; |
2730 | case SIOCSIFMTU: | | 2730 | case SIOCSIFMTU: |
2731 | if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ETHERMTU_JUMBO) | | 2731 | if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ETHERMTU_JUMBO) |
2732 | error = EINVAL; | | 2732 | error = EINVAL; |
2733 | else if ((error = ifioctl_common(ifp, command, data)) | | 2733 | else if ((error = ifioctl_common(ifp, command, data)) |