consistent softc member name prefixdiff -r1.48.4.11 -r1.48.4.12 src/sys/dev/usb/if_url.c
(skrll)
--- src/sys/dev/usb/if_url.c 2016/12/05 10:55:18 1.48.4.11
+++ src/sys/dev/usb/if_url.c 2017/01/26 12:40:16 1.48.4.12
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_url.c,v 1.48.4.11 2016/12/05 10:55:18 skrll Exp $ */ | 1 | /* $NetBSD: if_url.c,v 1.48.4.12 2017/01/26 12:40:16 skrll Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2001, 2002 | 4 | * Copyright (c) 2001, 2002 | |
5 | * Shingo WATANABE <nabe@nabechan.org>. All rights reserved. | 5 | * Shingo WATANABE <nabe@nabechan.org>. 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. | |
@@ -34,27 +34,27 @@ | @@ -34,27 +34,27 @@ | |||
34 | * The RTL8150L(Realtek USB to fast ethernet controller) spec can be found at | 34 | * The RTL8150L(Realtek USB to fast ethernet controller) spec can be found at | |
35 | * ftp://ftp.realtek.com.tw/lancard/data_sheet/8150/8150v14.pdf | 35 | * ftp://ftp.realtek.com.tw/lancard/data_sheet/8150/8150v14.pdf | |
36 | * ftp://152.104.125.40/lancard/data_sheet/8150/8150v14.pdf | 36 | * ftp://152.104.125.40/lancard/data_sheet/8150/8150v14.pdf | |
37 | */ | 37 | */ | |
38 | 38 | |||
39 | /* | 39 | /* | |
40 | * TODO: | 40 | * TODO: | |
41 | * Interrupt Endpoint support | 41 | * Interrupt Endpoint support | |
42 | * External PHYs | 42 | * External PHYs | |
43 | * powerhook() support? | 43 | * powerhook() support? | |
44 | */ | 44 | */ | |
45 | 45 | |||
46 | #include <sys/cdefs.h> | 46 | #include <sys/cdefs.h> | |
47 | __KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.48.4.11 2016/12/05 10:55:18 skrll Exp $"); | 47 | __KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.48.4.12 2017/01/26 12:40:16 skrll Exp $"); | |
48 | 48 | |||
49 | #ifdef _KERNEL_OPT | 49 | #ifdef _KERNEL_OPT | |
50 | #include "opt_inet.h" | 50 | #include "opt_inet.h" | |
51 | #include "opt_usb.h" | 51 | #include "opt_usb.h" | |
52 | #endif | 52 | #endif | |
53 | 53 | |||
54 | #include <sys/param.h> | 54 | #include <sys/param.h> | |
55 | #include <sys/systm.h> | 55 | #include <sys/systm.h> | |
56 | #include <sys/rwlock.h> | 56 | #include <sys/rwlock.h> | |
57 | #include <sys/mbuf.h> | 57 | #include <sys/mbuf.h> | |
58 | #include <sys/kernel.h> | 58 | #include <sys/kernel.h> | |
59 | #include <sys/socket.h> | 59 | #include <sys/socket.h> | |
60 | 60 | |||
@@ -182,27 +182,27 @@ void | @@ -182,27 +182,27 @@ void | |||
182 | url_attach(device_t parent, device_t self, void *aux) | 182 | url_attach(device_t parent, device_t self, void *aux) | |
183 | { | 183 | { | |
184 | struct url_softc *sc = device_private(self); | 184 | struct url_softc *sc = device_private(self); | |
185 | struct usb_attach_arg *uaa = aux; | 185 | struct usb_attach_arg *uaa = aux; | |
186 | struct usbd_device *dev = uaa->uaa_device; | 186 | struct usbd_device *dev = uaa->uaa_device; | |
187 | struct usbd_interface *iface; | 187 | struct usbd_interface *iface; | |
188 | usbd_status err; | 188 | usbd_status err; | |
189 | usb_interface_descriptor_t *id; | 189 | usb_interface_descriptor_t *id; | |
190 | usb_endpoint_descriptor_t *ed; | 190 | usb_endpoint_descriptor_t *ed; | |
191 | char *devinfop; | 191 | char *devinfop; | |
192 | struct ifnet *ifp; | 192 | struct ifnet *ifp; | |
193 | struct mii_data *mii; | 193 | struct mii_data *mii; | |
194 | u_char eaddr[ETHER_ADDR_LEN]; | 194 | u_char eaddr[ETHER_ADDR_LEN]; | |
195 | int i, s; | 195 | int i; | |
196 | 196 | |||
197 | sc->sc_dev = self; | 197 | sc->sc_dev = self; | |
198 | 198 | |||
199 | aprint_naive("\n"); | 199 | aprint_naive("\n"); | |
200 | aprint_normal("\n"); | 200 | aprint_normal("\n"); | |
201 | 201 | |||
202 | devinfop = usbd_devinfo_alloc(dev, 0); | 202 | devinfop = usbd_devinfo_alloc(dev, 0); | |
203 | aprint_normal_dev(self, "%s\n", devinfop); | 203 | aprint_normal_dev(self, "%s\n", devinfop); | |
204 | usbd_devinfo_free(devinfop); | 204 | usbd_devinfo_free(devinfop); | |
205 | 205 | |||
206 | /* Move the device into the configured state. */ | 206 | /* Move the device into the configured state. */ | |
207 | err = usbd_set_config_no(dev, URL_CONFIG_NO, 1); | 207 | err = usbd_set_config_no(dev, URL_CONFIG_NO, 1); | |
208 | if (err) { | 208 | if (err) { | |
@@ -246,37 +246,34 @@ url_attach(device_t parent, device_t sel | @@ -246,37 +246,34 @@ url_attach(device_t parent, device_t sel | |||
246 | UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT) | 246 | UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT) | |
247 | sc->sc_bulkout_no = ed->bEndpointAddress; /* TX */ | 247 | sc->sc_bulkout_no = ed->bEndpointAddress; /* TX */ | |
248 | else if ((ed->bmAttributes & UE_XFERTYPE) == UE_INTERRUPT && | 248 | else if ((ed->bmAttributes & UE_XFERTYPE) == UE_INTERRUPT && | |
249 | UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN) | 249 | UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN) | |
250 | sc->sc_intrin_no = ed->bEndpointAddress; /* Status */ | 250 | sc->sc_intrin_no = ed->bEndpointAddress; /* Status */ | |
251 | } | 251 | } | |
252 | 252 | |||
253 | if (sc->sc_bulkin_no == -1 || sc->sc_bulkout_no == -1 || | 253 | if (sc->sc_bulkin_no == -1 || sc->sc_bulkout_no == -1 || | |
254 | sc->sc_intrin_no == -1) { | 254 | sc->sc_intrin_no == -1) { | |
255 | aprint_error_dev(self, "missing endpoint\n"); | 255 | aprint_error_dev(self, "missing endpoint\n"); | |
256 | goto bad; | 256 | goto bad; | |
257 | } | 257 | } | |
258 | 258 | |||
259 | s = splnet(); | |||
260 | ||||
261 | /* reset the adapter */ | 259 | /* reset the adapter */ | |
262 | url_reset(sc); | 260 | url_reset(sc); | |
263 | 261 | |||
264 | /* Get Ethernet Address */ | 262 | /* Get Ethernet Address */ | |
265 | err = url_mem(sc, URL_CMD_READMEM, URL_IDR0, (void *)eaddr, | 263 | err = url_mem(sc, URL_CMD_READMEM, URL_IDR0, (void *)eaddr, | |
266 | ETHER_ADDR_LEN); | 264 | ETHER_ADDR_LEN); | |
267 | if (err) { | 265 | if (err) { | |
268 | aprint_error_dev(self, "read MAC address failed\n"); | 266 | aprint_error_dev(self, "read MAC address failed\n"); | |
269 | splx(s); | |||
270 | goto bad; | 267 | goto bad; | |
271 | } | 268 | } | |
272 | 269 | |||
273 | /* Print Ethernet Address */ | 270 | /* Print Ethernet Address */ | |
274 | aprint_normal_dev(self, "Ethernet address %s\n", ether_sprintf(eaddr)); | 271 | aprint_normal_dev(self, "Ethernet address %s\n", ether_sprintf(eaddr)); | |
275 | 272 | |||
276 | /* initialize interface information */ | 273 | /* initialize interface information */ | |
277 | ifp = GET_IFP(sc); | 274 | ifp = GET_IFP(sc); | |
278 | ifp->if_softc = sc; | 275 | ifp->if_softc = sc; | |
279 | ifp->if_mtu = ETHERMTU; | 276 | ifp->if_mtu = ETHERMTU; | |
280 | strncpy(ifp->if_xname, device_xname(self), IFNAMSIZ); | 277 | strncpy(ifp->if_xname, device_xname(self), IFNAMSIZ); | |
281 | ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; | 278 | ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; | |
282 | ifp->if_start = url_start; | 279 | ifp->if_start = url_start; | |
@@ -311,27 +308,26 @@ url_attach(device_t parent, device_t sel | @@ -311,27 +308,26 @@ url_attach(device_t parent, device_t sel | |||
311 | ifmedia_set(&mii->mii_media, IFM_ETHER | IFM_NONE); | 308 | ifmedia_set(&mii->mii_media, IFM_ETHER | IFM_NONE); | |
312 | } else | 309 | } else | |
313 | ifmedia_set(&mii->mii_media, IFM_ETHER | IFM_AUTO); | 310 | ifmedia_set(&mii->mii_media, IFM_ETHER | IFM_AUTO); | |
314 | 311 | |||
315 | /* attach the interface */ | 312 | /* attach the interface */ | |
316 | if_attach(ifp); | 313 | if_attach(ifp); | |
317 | ether_ifattach(ifp, eaddr); | 314 | ether_ifattach(ifp, eaddr); | |
318 | 315 | |||
319 | rnd_attach_source(&sc->rnd_source, device_xname(self), | 316 | rnd_attach_source(&sc->rnd_source, device_xname(self), | |
320 | RND_TYPE_NET, RND_FLAG_DEFAULT); | 317 | RND_TYPE_NET, RND_FLAG_DEFAULT); | |
321 | 318 | |||
322 | callout_init(&sc->sc_stat_ch, 0); | 319 | callout_init(&sc->sc_stat_ch, 0); | |
323 | sc->sc_attached = 1; | 320 | sc->sc_attached = 1; | |
324 | splx(s); | |||
325 | 321 | |||
326 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, dev, sc->sc_dev); | 322 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, dev, sc->sc_dev); | |
327 | 323 | |||
328 | return; | 324 | return; | |
329 | 325 | |||
330 | bad: | 326 | bad: | |
331 | sc->sc_dying = 1; | 327 | sc->sc_dying = 1; | |
332 | return; | 328 | return; | |
333 | } | 329 | } | |
334 | 330 | |||
335 | /* detach */ | 331 | /* detach */ | |
336 | int | 332 | int | |
337 | url_detach(device_t self, int flags) | 333 | url_detach(device_t self, int flags) |
--- src/sys/dev/usb/if_urndis.c 2016/12/29 08:04:08 1.9.4.14
+++ src/sys/dev/usb/if_urndis.c 2017/01/26 12:40:16 1.9.4.15
@@ -1,37 +1,37 @@ | @@ -1,37 +1,37 @@ | |||
1 | /* $NetBSD: if_urndis.c,v 1.9.4.14 2016/12/29 08:04:08 skrll Exp $ */ | 1 | /* $NetBSD: if_urndis.c,v 1.9.4.15 2017/01/26 12:40:16 skrll Exp $ */ | |
2 | /* $OpenBSD: if_urndis.c,v 1.31 2011/07/03 15:47:17 matthew Exp $ */ | 2 | /* $OpenBSD: if_urndis.c,v 1.31 2011/07/03 15:47:17 matthew Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2010 Jonathan Armani <armani@openbsd.org> | 5 | * Copyright (c) 2010 Jonathan Armani <armani@openbsd.org> | |
6 | * Copyright (c) 2010 Fabien Romano <fabien@openbsd.org> | 6 | * Copyright (c) 2010 Fabien Romano <fabien@openbsd.org> | |
7 | * Copyright (c) 2010 Michael Knudsen <mk@openbsd.org> | 7 | * Copyright (c) 2010 Michael Knudsen <mk@openbsd.org> | |
8 | * All rights reserved. | 8 | * All rights reserved. | |
9 | * | 9 | * | |
10 | * Permission to use, copy, modify, and distribute this software for any | 10 | * Permission to use, copy, modify, and distribute this software for any | |
11 | * purpose with or without fee is hereby granted, provided that the above | 11 | * purpose with or without fee is hereby granted, provided that the above | |
12 | * copyright notice and this permission notice appear in all copies. | 12 | * copyright notice and this permission notice appear in all copies. | |
13 | * | 13 | * | |
14 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 14 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
15 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 15 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
16 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 16 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
17 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 17 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
18 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 18 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
19 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 19 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
20 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 20 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
21 | */ | 21 | */ | |
22 | 22 | |||
23 | #include <sys/cdefs.h> | 23 | #include <sys/cdefs.h> | |
24 | __KERNEL_RCSID(0, "$NetBSD: if_urndis.c,v 1.9.4.14 2016/12/29 08:04:08 skrll Exp $"); | 24 | __KERNEL_RCSID(0, "$NetBSD: if_urndis.c,v 1.9.4.15 2017/01/26 12:40:16 skrll Exp $"); | |
25 | 25 | |||
26 | #ifdef _KERNEL_OPT | 26 | #ifdef _KERNEL_OPT | |
27 | #include "opt_usb.h" | 27 | #include "opt_usb.h" | |
28 | #endif | 28 | #endif | |
29 | 29 | |||
30 | #include <sys/param.h> | 30 | #include <sys/param.h> | |
31 | #include <sys/systm.h> | 31 | #include <sys/systm.h> | |
32 | #include <sys/sockio.h> | 32 | #include <sys/sockio.h> | |
33 | #include <sys/rwlock.h> | 33 | #include <sys/rwlock.h> | |
34 | #include <sys/mbuf.h> | 34 | #include <sys/mbuf.h> | |
35 | #include <sys/kmem.h> | 35 | #include <sys/kmem.h> | |
36 | #include <sys/kernel.h> | 36 | #include <sys/kernel.h> | |
37 | #include <sys/proc.h> | 37 | #include <sys/proc.h> | |
@@ -1036,29 +1036,29 @@ urndis_watchdog(struct ifnet *ifp) | @@ -1036,29 +1036,29 @@ urndis_watchdog(struct ifnet *ifp) | |||
1036 | 1036 | |||
1037 | ifp->if_oerrors++; | 1037 | ifp->if_oerrors++; | |
1038 | printf("%s: watchdog timeout\n", DEVNAME(sc)); | 1038 | printf("%s: watchdog timeout\n", DEVNAME(sc)); | |
1039 | 1039 | |||
1040 | urndis_ctrl_keepalive(sc); | 1040 | urndis_ctrl_keepalive(sc); | |
1041 | } | 1041 | } | |
1042 | #endif | 1042 | #endif | |
1043 | 1043 | |||
1044 | static int | 1044 | static int | |
1045 | urndis_init(struct ifnet *ifp) | 1045 | urndis_init(struct ifnet *ifp) | |
1046 | { | 1046 | { | |
1047 | struct urndis_softc *sc = ifp->if_softc; | 1047 | struct urndis_softc *sc = ifp->if_softc; | |
1048 | 1048 | |||
1049 | mutex_enter(&sc->urndis_lock); | 1049 | mutex_enter(&sc->sc_lock); | |
1050 | int ret = urndis_init_locked(ifp); | 1050 | int ret = urndis_init_locked(ifp); | |
1051 | mutex_exit(&sc->urndis_lock); | 1051 | mutex_exit(&sc->sc_lock); | |
1052 | 1052 | |||
1053 | return ret; | 1053 | return ret; | |
1054 | } | 1054 | } | |
1055 | 1055 | |||
1056 | static int | 1056 | static int | |
1057 | urndis_init_locked(struct ifnet *ifp) | 1057 | urndis_init_locked(struct ifnet *ifp) | |
1058 | { | 1058 | { | |
1059 | struct urndis_softc *sc; | 1059 | struct urndis_softc *sc; | |
1060 | int i; | 1060 | int i; | |
1061 | int err; | 1061 | int err; | |
1062 | usbd_status usberr; | 1062 | usbd_status usberr; | |
1063 | 1063 | |||
1064 | sc = ifp->if_softc; | 1064 | sc = ifp->if_softc; | |
@@ -1120,29 +1120,29 @@ fail4: | @@ -1120,29 +1120,29 @@ fail4: | |||
1120 | fail3: | 1120 | fail3: | |
1121 | usbd_close_pipe(sc->sc_bulkout_pipe); | 1121 | usbd_close_pipe(sc->sc_bulkout_pipe); | |
1122 | fail2: | 1122 | fail2: | |
1123 | usbd_close_pipe(sc->sc_bulkin_pipe); | 1123 | usbd_close_pipe(sc->sc_bulkin_pipe); | |
1124 | fail: | 1124 | fail: | |
1125 | return EIO; | 1125 | return EIO; | |
1126 | } | 1126 | } | |
1127 | 1127 | |||
1128 | static void | 1128 | static void | |
1129 | urndis_stop(struct ifnet *ifp) | 1129 | urndis_stop(struct ifnet *ifp) | |
1130 | { | 1130 | { | |
1131 | struct urndis_softc *sc = ifp->if_softc; | 1131 | struct urndis_softc *sc = ifp->if_softc; | |
1132 | 1132 | |||
1133 | mutex_enter(&sc->urndis_lock); | 1133 | mutex_enter(&sc->sc_lock); | |
1134 | urndis_stop_locked(ifp); | 1134 | urndis_stop_locked(ifp); | |
1135 | mutex_exit(&sc->urndis_lock); | 1135 | mutex_exit(&sc->sc_lock); | |
1136 | } | 1136 | } | |
1137 | 1137 | |||
1138 | static void | 1138 | static void | |
1139 | urndis_stop_locked(struct ifnet *ifp) | 1139 | urndis_stop_locked(struct ifnet *ifp) | |
1140 | { | 1140 | { | |
1141 | struct urndis_softc *sc; | 1141 | struct urndis_softc *sc; | |
1142 | usbd_status err; | 1142 | usbd_status err; | |
1143 | 1143 | |||
1144 | sc = ifp->if_softc; | 1144 | sc = ifp->if_softc; | |
1145 | 1145 | |||
1146 | ifp->if_timer = 0; | 1146 | ifp->if_timer = 0; | |
1147 | ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); | 1147 | ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); | |
1148 | 1148 | |||
@@ -1178,29 +1178,29 @@ urndis_stop_locked(struct ifnet *ifp) | @@ -1178,29 +1178,29 @@ urndis_stop_locked(struct ifnet *ifp) | |||
1178 | if (err) | 1178 | if (err) | |
1179 | printf("%s: close tx pipe failed: %s\n", | 1179 | printf("%s: close tx pipe failed: %s\n", | |
1180 | DEVNAME(sc), usbd_errstr(err)); | 1180 | DEVNAME(sc), usbd_errstr(err)); | |
1181 | sc->sc_bulkout_pipe = NULL; | 1181 | sc->sc_bulkout_pipe = NULL; | |
1182 | } | 1182 | } | |
1183 | } | 1183 | } | |
1184 | 1184 | |||
1185 | static void | 1185 | static void | |
1186 | urndis_start(struct ifnet *ifp) | 1186 | urndis_start(struct ifnet *ifp) | |
1187 | { | 1187 | { | |
1188 | struct urndis_softc *sc = ifp->if_softc; | 1188 | struct urndis_softc *sc = ifp->if_softc; | |
1189 | KASSERT(ifp->if_extflags & IFEF_START_MPSAFE); | 1189 | KASSERT(ifp->if_extflags & IFEF_START_MPSAFE); | |
1190 | 1190 | |||
1191 | mutex_enter(&sc->urndis_txlock); | 1191 | mutex_enter(&sc->sc_txlock); | |
1192 | urndis_start_locked(ifp); | 1192 | urndis_start_locked(ifp); | |
1193 | mutex_exit(&sc->urndis_txlock); | 1193 | mutex_exit(&sc->sc_txlock); | |
1194 | } | 1194 | } | |
1195 | 1195 | |||
1196 | static void | 1196 | static void | |
1197 | urndis_start_locked(struct ifnet *ifp) | 1197 | urndis_start_locked(struct ifnet *ifp) | |
1198 | { | 1198 | { | |
1199 | struct urndis_softc *sc; | 1199 | struct urndis_softc *sc; | |
1200 | struct mbuf *m_head = NULL; | 1200 | struct mbuf *m_head = NULL; | |
1201 | 1201 | |||
1202 | sc = ifp->if_softc; | 1202 | sc = ifp->if_softc; | |
1203 | 1203 | |||
1204 | if (sc->sc_dying || (ifp->if_flags & IFF_OACTIVE)) | 1204 | if (sc->sc_dying || (ifp->if_flags & IFF_OACTIVE)) | |
1205 | return; | 1205 | return; | |
1206 | 1206 | |||
@@ -1466,29 +1466,29 @@ urndis_attach(device_t parent, device_t | @@ -1466,29 +1466,29 @@ urndis_attach(device_t parent, device_t | |||
1466 | sc->sc_bulkin_no, | 1466 | sc->sc_bulkin_no, | |
1467 | sc->sc_bulkout_no)); | 1467 | sc->sc_bulkout_no)); | |
1468 | goto found; | 1468 | goto found; | |
1469 | } | 1469 | } | |
1470 | } | 1470 | } | |
1471 | 1471 | |||
1472 | if (sc->sc_bulkin_no == -1) | 1472 | if (sc->sc_bulkin_no == -1) | |
1473 | aprint_error("%s: could not find data bulk in\n", DEVNAME(sc)); | 1473 | aprint_error("%s: could not find data bulk in\n", DEVNAME(sc)); | |
1474 | if (sc->sc_bulkout_no == -1 ) | 1474 | if (sc->sc_bulkout_no == -1 ) | |
1475 | aprint_error("%s: could not find data bulk out\n",DEVNAME(sc)); | 1475 | aprint_error("%s: could not find data bulk out\n",DEVNAME(sc)); | |
1476 | return; | 1476 | return; | |
1477 | 1477 | |||
1478 | found: | 1478 | found: | |
1479 | mutex_init(&sc->urndis_lock, MUTEX_DEFAULT, IPL_NONE); | 1479 | mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE); | |
1480 | mutex_init(&sc->urndis_txlock, MUTEX_DEFAULT, IPL_SOFTUSB); | 1480 | mutex_init(&sc->sc_txlock, MUTEX_DEFAULT, IPL_SOFTUSB); | |
1481 | mutex_init(&sc->urndis_rxlock, MUTEX_DEFAULT, IPL_SOFTUSB); | 1481 | mutex_init(&sc->sc_rxlock, MUTEX_DEFAULT, IPL_SOFTUSB); | |
1482 | 1482 | |||
1483 | ifp = GET_IFP(sc); | 1483 | ifp = GET_IFP(sc); | |
1484 | ifp->if_softc = sc; | 1484 | ifp->if_softc = sc; | |
1485 | ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; | 1485 | ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; | |
1486 | ifp->if_extflags = IFEF_START_MPSAFE; | 1486 | ifp->if_extflags = IFEF_START_MPSAFE; | |
1487 | ifp->if_start = urndis_start; | 1487 | ifp->if_start = urndis_start; | |
1488 | ifp->if_ioctl = urndis_ioctl; | 1488 | ifp->if_ioctl = urndis_ioctl; | |
1489 | ifp->if_init = urndis_init; | 1489 | ifp->if_init = urndis_init; | |
1490 | #if 0 | 1490 | #if 0 | |
1491 | ifp->if_watchdog = urndis_watchdog; | 1491 | ifp->if_watchdog = urndis_watchdog; | |
1492 | #endif | 1492 | #endif | |
1493 | 1493 | |||
1494 | strlcpy(ifp->if_xname, DEVNAME(sc), IFNAMSIZ); | 1494 | strlcpy(ifp->if_xname, DEVNAME(sc), IFNAMSIZ); | |
@@ -1527,29 +1527,29 @@ found: | @@ -1527,29 +1527,29 @@ found: | |||
1527 | urndis_stop(ifp); | 1527 | urndis_stop(ifp); | |
1528 | goto fail; | 1528 | goto fail; | |
1529 | } | 1529 | } | |
1530 | 1530 | |||
1531 | if_initialize(ifp); | 1531 | if_initialize(ifp); | |
1532 | sc->urndis_ipq = if_percpuq_create(&sc->sc_ec.ec_if); | 1532 | sc->urndis_ipq = if_percpuq_create(&sc->sc_ec.ec_if); | |
1533 | ether_ifattach(ifp, eaddr); | 1533 | ether_ifattach(ifp, eaddr); | |
1534 | if_register(ifp); | 1534 | if_register(ifp); | |
1535 | 1535 | |||
1536 | sc->sc_attached = 1; | 1536 | sc->sc_attached = 1; | |
1537 | return; | 1537 | return; | |
1538 | 1538 | |||
1539 | fail: | 1539 | fail: | |
1540 | mutex_destroy(&sc->urndis_lock); | 1540 | mutex_destroy(&sc->sc_lock); | |
1541 | mutex_destroy(&sc->urndis_txlock); | 1541 | mutex_destroy(&sc->sc_txlock); | |
1542 | mutex_destroy(&sc->urndis_rxlock); | 1542 | mutex_destroy(&sc->sc_rxlock); | |
1543 | } | 1543 | } | |
1544 | 1544 | |||
1545 | static int | 1545 | static int | |
1546 | urndis_detach(device_t self, int flags) | 1546 | urndis_detach(device_t self, int flags) | |
1547 | { | 1547 | { | |
1548 | struct urndis_softc *sc; | 1548 | struct urndis_softc *sc; | |
1549 | struct ifnet *ifp; | 1549 | struct ifnet *ifp; | |
1550 | int s; | 1550 | int s; | |
1551 | 1551 | |||
1552 | sc = device_private(self); | 1552 | sc = device_private(self); | |
1553 | 1553 | |||
1554 | DPRINTF(("urndis_detach: %s flags %u\n", DEVNAME(sc), | 1554 | DPRINTF(("urndis_detach: %s flags %u\n", DEVNAME(sc), | |
1555 | flags)); | 1555 | flags)); | |
@@ -1558,29 +1558,29 @@ urndis_detach(device_t self, int flags) | @@ -1558,29 +1558,29 @@ urndis_detach(device_t self, int flags) | |||
1558 | return 0; | 1558 | return 0; | |
1559 | 1559 | |||
1560 | s = splusb(); | 1560 | s = splusb(); | |
1561 | 1561 | |||
1562 | ifp = GET_IFP(sc); | 1562 | ifp = GET_IFP(sc); | |
1563 | 1563 | |||
1564 | if (ifp->if_softc != NULL) { | 1564 | if (ifp->if_softc != NULL) { | |
1565 | ether_ifdetach(ifp); | 1565 | ether_ifdetach(ifp); | |
1566 | if_detach(ifp); | 1566 | if_detach(ifp); | |
1567 | } | 1567 | } | |
1568 | 1568 | |||
1569 | urndis_stop(ifp); | 1569 | urndis_stop(ifp); | |
1570 | 1570 | |||
1571 | mutex_destroy(&sc->urndis_rxlock); | 1571 | mutex_destroy(&sc->sc_rxlock); | |
1572 | mutex_destroy(&sc->urndis_txlock); | 1572 | mutex_destroy(&sc->sc_txlock); | |
1573 | mutex_destroy(&sc->urndis_lock); | 1573 | mutex_destroy(&sc->sc_lock); | |
1574 | 1574 | |||
1575 | sc->sc_attached = 0; | 1575 | sc->sc_attached = 0; | |
1576 | 1576 | |||
1577 | splx(s); | 1577 | splx(s); | |
1578 | 1578 | |||
1579 | return 0; | 1579 | return 0; | |
1580 | } | 1580 | } | |
1581 | 1581 | |||
1582 | static int | 1582 | static int | |
1583 | urndis_activate(device_t self, enum devact act) | 1583 | urndis_activate(device_t self, enum devact act) | |
1584 | { | 1584 | { | |
1585 | struct urndis_softc *sc; | 1585 | struct urndis_softc *sc; | |
1586 | 1586 |
--- src/sys/dev/usb/Attic/if_urndisreg.h 2016/12/28 08:55:20 1.1.32.4
+++ src/sys/dev/usb/Attic/if_urndisreg.h 2017/01/26 12:40:16 1.1.32.5
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_urndisreg.h,v 1.1.32.4 2016/12/28 08:55:20 skrll Exp $ */ | 1 | /* $NetBSD: if_urndisreg.h,v 1.1.32.5 2017/01/26 12:40:16 skrll Exp $ */ | |
2 | /* $OpenBSD: if_urndisreg.h,v 1.14 2010/07/08 18:22:01 ckuethe Exp $ */ | 2 | /* $OpenBSD: if_urndisreg.h,v 1.14 2010/07/08 18:22:01 ckuethe Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2010 Jonathan Armani <armani@openbsd.org> | 5 | * Copyright (c) 2010 Jonathan Armani <armani@openbsd.org> | |
6 | * Copyright (c) 2010 Fabien Romano <fabien@openbsd.org> | 6 | * Copyright (c) 2010 Fabien Romano <fabien@openbsd.org> | |
7 | * Copyright (c) 2010 Michael Knudsen <mk@openbsd.org> | 7 | * Copyright (c) 2010 Michael Knudsen <mk@openbsd.org> | |
8 | * All rights reserved. | 8 | * All rights reserved. | |
9 | * | 9 | * | |
10 | * Permission to use, copy, modify, and distribute this software for any | 10 | * Permission to use, copy, modify, and distribute this software for any | |
11 | * purpose with or without fee is hereby granted, provided that the above | 11 | * purpose with or without fee is hereby granted, provided that the above | |
12 | * copyright notice and this permission notice appear in all copies. | 12 | * copyright notice and this permission notice appear in all copies. | |
13 | * | 13 | * | |
14 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 14 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
@@ -32,29 +32,29 @@ struct urndis_chain { | @@ -32,29 +32,29 @@ struct urndis_chain { | |||
32 | int sc_idx; | 32 | int sc_idx; | |
33 | }; | 33 | }; | |
34 | 34 | |||
35 | struct urndis_cdata { | 35 | struct urndis_cdata { | |
36 | struct urndis_chain sc_rx_chain[RNDIS_RX_LIST_CNT]; | 36 | struct urndis_chain sc_rx_chain[RNDIS_RX_LIST_CNT]; | |
37 | struct urndis_chain sc_tx_chain[RNDIS_TX_LIST_CNT]; | 37 | struct urndis_chain sc_tx_chain[RNDIS_TX_LIST_CNT]; | |
38 | int sc_tx_cnt; | 38 | int sc_tx_cnt; | |
39 | }; | 39 | }; | |
40 | 40 | |||
41 | #define GET_IFP(sc) (&(sc)->sc_ec.ec_if) | 41 | #define GET_IFP(sc) (&(sc)->sc_ec.ec_if) | |
42 | struct urndis_softc { | 42 | struct urndis_softc { | |
43 | device_t sc_dev; | 43 | device_t sc_dev; | |
44 | 44 | |||
45 | kmutex_t urndis_lock; | 45 | kmutex_t sc_lock; | |
46 | kmutex_t urndis_txlock; | 46 | kmutex_t sc_txlock; | |
47 | kmutex_t urndis_rxlock; | 47 | kmutex_t sc_rxlock; | |
48 | 48 | |||
49 | char sc_attached; | 49 | char sc_attached; | |
50 | int sc_dying; | 50 | int sc_dying; | |
51 | struct ethercom sc_ec; | 51 | struct ethercom sc_ec; | |
52 | 52 | |||
53 | /* RNDIS device info */ | 53 | /* RNDIS device info */ | |
54 | uint32_t sc_lim_pktsz; | 54 | uint32_t sc_lim_pktsz; | |
55 | uint32_t sc_filter; | 55 | uint32_t sc_filter; | |
56 | 56 | |||
57 | /* USB goo */ | 57 | /* USB goo */ | |
58 | struct usbd_device * sc_udev; | 58 | struct usbd_device * sc_udev; | |
59 | int sc_ifaceno_ctl; | 59 | int sc_ifaceno_ctl; | |
60 | struct usbd_interface * sc_iface_ctl; | 60 | struct usbd_interface * sc_iface_ctl; |