Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb urndis(4): Delete some crazy logic that I think ...



details:   https://anonhg.NetBSD.org/src/rev/2d7dd9174cc0
branches:  trunk
changeset: 362541:2d7dd9174cc0
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Mar 03 05:54:45 2022 +0000

description:
urndis(4): Delete some crazy logic that I think is unnecessary.

XXX definitely need to test this one

diffstat:

 sys/dev/usb/if_urndis.c |  34 ++++++----------------------------
 1 files changed, 6 insertions(+), 28 deletions(-)

diffs (87 lines):

diff -r 77cdd092990d -r 2d7dd9174cc0 sys/dev/usb/if_urndis.c
--- a/sys/dev/usb/if_urndis.c   Thu Mar 03 05:54:37 2022 +0000
+++ b/sys/dev/usb/if_urndis.c   Thu Mar 03 05:54:45 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_urndis.c,v 1.40 2022/03/03 05:50:22 riastradh Exp $ */
+/*     $NetBSD: if_urndis.c,v 1.41 2022/03/03 05:54:45 riastradh Exp $ */
 /*     $OpenBSD: if_urndis.c,v 1.31 2011/07/03 15:47:17 matthew Exp $ */
 
 /*
@@ -21,7 +21,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_urndis.c,v 1.40 2022/03/03 05:50:22 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urndis.c,v 1.41 2022/03/03 05:54:45 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -866,16 +866,6 @@
        if (err != RNDIS_STATUS_SUCCESS)
                return EIO;
 
-       usbnet_lock_core(un);
-       if (usbnet_isdying(un))
-               err = EIO;
-       else {
-               usbnet_stop(un, ifp, 1);
-               err = usbnet_init_rx_tx(un);
-               usbnet_set_link(un, err == 0);
-       }
-       usbnet_unlock_core(un);
-
        return err;
 }
 
@@ -887,9 +877,11 @@
 
        KASSERT(IFNET_LOCKED(ifp));
 
-       usbnet_unlock_core(un);
        error = urndis_init_un(ifp, un);
-       usbnet_lock_core(un);
+       if (error)
+               return EIO;     /* XXX */
+       error = usbnet_init_rx_tx(un);
+       usbnet_set_link(un, error == 0);
 
        return error;
 }
@@ -1064,9 +1056,6 @@
            &buf, &bufsz) != RNDIS_STATUS_SUCCESS) {
                aprint_error("%s: unable to get hardware address\n",
                    DEVNAME(un));
-               usbnet_lock_core(un);
-               usbnet_stop(un, ifp, 1);
-               usbnet_unlock_core(un);
                return;
        }
 
@@ -1077,9 +1066,6 @@
                aprint_error("%s: invalid address\n", DEVNAME(un));
                if (buf && bufsz)
                        kmem_free(buf, bufsz);
-               usbnet_lock_core(un);
-               usbnet_stop(un, ifp, 1);
-               usbnet_unlock_core(un);
                return;
        }
 
@@ -1090,17 +1076,9 @@
        if (urndis_ctrl_set(un, OID_GEN_CURRENT_PACKET_FILTER, &filter,
            sizeof(filter)) != RNDIS_STATUS_SUCCESS) {
                aprint_error("%s: unable to set data filters\n", DEVNAME(un));
-               usbnet_lock_core(un);
-               usbnet_stop(un, ifp, 1);
-               usbnet_unlock_core(un);
                return;
        }
 
-       /* Turn off again now it has been identified. */
-       usbnet_lock_core(un);
-       usbnet_stop(un, ifp, 1);
-       usbnet_unlock_core(un);
-
        usbnet_attach_ifp(un, IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST,
             0, NULL);
 }



Home | Main Index | Thread Index | Old Index