Source-Changes-HG archive

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

[src-draft/trunk]: src/sys/dev/usb Move alloc of rx/tx buffers back into urtw...



details:   https://anonhg.NetBSD.org/src-all/rev/91163cfec2de
branches:  trunk
changeset: 933822:91163cfec2de
user:      Nathanial Sloss <nat%netbsd.org@localhost>
date:      Sun May 03 20:45:26 2020 +1000

description:
Move alloc of rx/tx buffers back into urtwn_init.
Move free of buffers back into urtwn_stop.

diffstat:

 sys/dev/usb/if_urtwn.c |  34 ++++++++++++++++++----------------
 1 files changed, 18 insertions(+), 16 deletions(-)

diffs (73 lines):

diff -r d3ad436e20b6 -r 91163cfec2de sys/dev/usb/if_urtwn.c
--- a/sys/dev/usb/if_urtwn.c    Sun May 03 19:16:20 2020 +1000
+++ b/sys/dev/usb/if_urtwn.c    Sun May 03 20:45:26 2020 +1000
@@ -599,21 +599,6 @@
                goto fail;
        }
        
-       /* Allocate Tx/Rx buffers. */
-       error = urtwn_alloc_rx_list(sc);
-       if (error != 0) {
-               aprint_error_dev(sc->sc_dev,
-                   "could not allocate Rx buffers\n");
-               goto fail;
-       }
-
-       error = urtwn_alloc_tx_list(sc);
-       if (error != 0) {
-               aprint_error_dev(sc->sc_dev,
-                   "could not allocate Tx buffers\n");
-               goto fail;
-       }
-
        return;
 
  fail:
@@ -897,8 +882,8 @@
        return 0;
 
  fail:
+       mutex_exit(&sc->sc_tx_mtx);
        urtwn_free_tx_list(sc);
-       mutex_exit(&sc->sc_tx_mtx);
        return error;
 }
 
@@ -5712,6 +5697,21 @@
        /* Set default channel. */
        urtwn_set_chan(sc, ic->ic_curchan, IEEE80211_HTINFO_2NDCHAN_NONE);
 
+       /* Allocate Tx/Rx buffers. */
+       error = urtwn_alloc_rx_list(sc);
+       if (error != 0) {
+               aprint_error_dev(sc->sc_dev,
+                   "could not allocate Rx buffers\n");
+               goto fail;
+       }
+
+       error = urtwn_alloc_tx_list(sc);
+       if (error != 0) {
+               aprint_error_dev(sc->sc_dev,
+                   "could not allocate Tx buffers\n");
+               goto fail;
+       }
+
        /* Queue Rx xfers. */
        for (size_t j = 0; j < sc->rx_npipe; j++) {
                mutex_enter(&sc->sc_rx_mtx); 
@@ -5790,6 +5790,7 @@
                        usbd_abort_pipe(sc->tx_pipe[i]);
        }
        mutex_exit(&sc->sc_tx_mtx);
+       urtwn_free_tx_list(sc);
 
        mutex_enter(&sc->sc_rx_mtx);
        /* Stop Rx pipe. */
@@ -5798,6 +5799,7 @@
                        usbd_abort_pipe(sc->rx_pipe[i]);
        }
        mutex_exit(&sc->sc_rx_mtx);
+       urtwn_free_rx_list(sc);
 
        sc->sc_running = false;
        if (disable)



Home | Main Index | Thread Index | Old Index