Hello,

compared with upl driver code (if_upl.c), I found ugl needs maintenance.

 - remove extra blank line
 - roll back (not commit) when ugl_send() failed
 - call ifq_clr_oactive() before splx()

ok?

Index: if_ugl.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/if_ugl.c,v
retrieving revision 1.21
diff -u -p -r1.21 if_ugl.c
--- if_ugl.c    22 Jan 2017 10:17:39 -0000      1.21
+++ if_ugl.c    7 Mar 2018 04:39:38 -0000
@@ -215,7 +215,6 @@ ugl_attach(struct device *parent, struct
 
        DPRINTFN(5,(" : ugl_attach: sc=%p, dev=%p", sc, dev));
 
-
        sc->sc_udev = dev;
        sc->sc_iface = iface;
        id = usbd_get_interface_descriptor(iface);
@@ -595,7 +594,7 @@ ugl_start(struct ifnet *ifp)
                return;
 
        if (ugl_send(sc, m_head, 0)) {
-               ifq_deq_commit(&ifp->if_snd, m_head);
+               ifq_deq_rollback(&ifp->if_snd, m_head);
                ifq_set_oactive(&ifp->if_snd);
                return;
        }
@@ -655,9 +654,9 @@ ugl_init(void *xsc)
        }
 
        ifp->if_flags |= IFF_RUNNING;
-       splx(s);
-
        ifq_clr_oactive(&ifp->if_snd);
+
+       splx(s);
 }
 
 int

-- 
SASANO Takayoshi (JG1UAA) <u...@mx5.nisiq.net>

Reply via email to