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 Pipes / chains separation.



details:   https://anonhg.NetBSD.org/src-all/rev/bd782fe6a6f1
branches:  trunk
changeset: 377945:bd782fe6a6f1
user:      Nathanial Sloss <nat%netbsd.org@localhost>
date:      Sun Jan 02 11:50:12 2022 +1100

description:
Pipes / chains separation.

diffstat:

 sys/dev/usb/if_urtwn.c |   4 ++--
 sys/dev/usb/usbwifi.c  |  32 +++++++++++++++++---------------
 sys/dev/usb/usbwifi.h  |   4 +++-
 3 files changed, 22 insertions(+), 18 deletions(-)

diffs (145 lines):

diff -r 2c849754287e -r bd782fe6a6f1 sys/dev/usb/if_urtwn.c
--- a/sys/dev/usb/if_urtwn.c    Tue Dec 21 13:03:21 2021 +1100
+++ b/sys/dev/usb/if_urtwn.c    Sun Jan 02 11:50:12 2022 +1100
@@ -523,8 +523,8 @@ urtwn_attach( device_t parent, device_t 
         * Initialize the global (non-VAP specific) structures and create
         * the VAP list.
         */
-       usbwifi_ic_attach(&sc->sc_uw, num_tx, num_rx,
-            IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST);
+       usbwifi_ic_attach(&sc->sc_uw, sc->ntxchains, sc->nrxchains, num_tx,
+          num_rx, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST);
 
        /* override default methods */
        ic->ic_newassoc = urtwn_newassoc;
diff -r 2c849754287e -r bd782fe6a6f1 sys/dev/usb/usbwifi.c
--- a/sys/dev/usb/usbwifi.c     Tue Dec 21 13:03:21 2021 +1100
+++ b/sys/dev/usb/usbwifi.c     Sun Jan 02 11:50:12 2022 +1100
@@ -435,9 +435,9 @@ usbwifi_pipe_intr(struct usbd_xfer *xfer
 static size_t
 usbwifi_rx_list_size(struct usbwifi_cdata * const cd, struct usbwifi * const uw)
 {
-       return sizeof(*cd->uwcd_rx_chains) * uw->uw_ic.ic_rxstream +
+       return sizeof(*cd->uwcd_rx_chains) * uw->uw_rxpipes +
            sizeof(struct usbwifi_chain) *
-           uw->uw_rx_list_cnt * uw->uw_ic.ic_rxstream;
+           uw->uw_rx_list_cnt * uw->uw_rxpipes;
 }
 
 static void
@@ -466,9 +466,9 @@ usbwifi_rx_list_init(struct usbwifi * co
        struct usbwifi_cdata * const cd = uw_cdata(uw);
        struct usbwifi_private * const uwp = uw->uw_pri;
        struct usbwifi_chain *chain =
-           (struct usbwifi_chain*)&cd->uwcd_rx_chains[uw->uw_ic.ic_rxstream];
+           (struct usbwifi_chain*)&cd->uwcd_rx_chains[uw->uw_rxpipes];
 
-       for (size_t i = 0; i < uw->uw_ic.ic_rxstream; i++) {
+       for (size_t i = 0; i < uw->uw_rxpipes; i++) {
                cd->uwcd_rx_chains[i].uwscd_chain = chain;
                chain += uw->uw_rx_list_cnt;
                for (size_t j = 0; j < uw->uw_rx_list_cnt; j++) {
@@ -476,7 +476,7 @@ usbwifi_rx_list_init(struct usbwifi * co
                            &cd->uwcd_rx_chains[i].uwscd_chain[j];
 
                        c->uwc_uw = uw;
-                       c->uwc_index =  uw->uw_ic.ic_txstream + i;
+                       c->uwc_index =  uw->uw_txpipes + i;
                        if (c->uwc_xfer == NULL) {
                                int err = usbd_create_xfer(
                                    uwp->uwp_ep[c->uwc_index],
@@ -506,7 +506,7 @@ usbwifi_rx_list_fini(struct usbwifi * co
        if (cd->uwcd_rx_chains[0].uwscd_chain == NULL)
                return; /* incomplete init */
 
-       for (size_t i = 0; i < uw->uw_ic.ic_rxstream; i++) {
+       for (size_t i = 0; i < uw->uw_rxpipes; i++) {
                for (size_t j = 0; j < uw->uw_rx_list_cnt; j++) {
                        struct usbwifi_chain *c =
                            &cd->uwcd_rx_chains[i].uwscd_chain[j];
@@ -532,7 +532,7 @@ usbwifi_rx_start_pipes(struct usbwifi * 
        mutex_enter(&uwp->uwp_txlock);
        uwp->uwp_stopping = false;
 
-       for (size_t i = 0; i < uw->uw_ic.ic_rxstream; i++) {
+       for (size_t i = 0; i < uw->uw_rxpipes; i++) {
                for (size_t j = 0; j < uw->uw_rx_list_cnt; j++) {
                        struct usbwifi_chain *c =
                            &cd->uwcd_rx_chains[i].uwscd_chain[j];
@@ -553,9 +553,9 @@ usbwifi_rx_start_pipes(struct usbwifi * 
 static size_t
 usbwifi_tx_list_size(struct usbwifi_cdata * const cd, struct usbwifi * const uw)
 {
-       return sizeof(*cd->uwcd_tx_chains) * uw->uw_ic.ic_txstream +
+       return sizeof(*cd->uwcd_tx_chains) * uw->uw_txpipes +
            sizeof(struct usbwifi_chain) *
-           uw->uw_tx_list_cnt * uw->uw_ic.ic_txstream;
+           uw->uw_tx_list_cnt * uw->uw_txpipes;
 }
 
 static void
@@ -583,9 +583,9 @@ usbwifi_tx_list_init(struct usbwifi * co
        struct usbwifi_cdata * const cd = uw_cdata(uw);
        struct usbwifi_private * const uwp = uw->uw_pri;
        struct usbwifi_chain *chain =
-           (struct usbwifi_chain*)&cd->uwcd_tx_chains[uw->uw_ic.ic_txstream];
+           (struct usbwifi_chain*)&cd->uwcd_tx_chains[uw->uw_txpipes];
 
-       for (size_t i = 0; i < uw->uw_ic.ic_txstream; i++) {
+       for (size_t i = 0; i < uw->uw_txpipes; i++) {
                cd->uwcd_tx_chains[i].uwscd_chain = chain;
                chain += uw->uw_tx_list_cnt;
                for (size_t j = 0; j < uw->uw_tx_list_cnt; j++) {
@@ -623,10 +623,10 @@ usbwifi_tx_list_fini(struct usbwifi * co
        if (cd->uwcd_rx_chains[0].uwscd_chain == NULL)
                return; /* incomplete init */
 
-       for (size_t i = 0; i < uw->uw_ic.ic_rxstream; i++) {
-               for (size_t j = 0; j < uw->uw_rx_list_cnt; j++) {
+       for (size_t i = 0; i < uw->uw_rxpipes; i++) {
+               for (size_t j = 0; j < uw->uw_tx_list_cnt; j++) {
                        struct usbwifi_chain *c =
-                           &cd->uwcd_rx_chains[i].uwscd_chain[j];
+                           &cd->uwcd_tx_chains[i].uwscd_chain[j];
 
                        if (c->uwc_xfer != NULL) {
                                usbd_destroy_xfer(c->uwc_xfer);
@@ -1247,7 +1247,7 @@ usbwifi_attach(struct usbwifi *uw,
 
 void
 usbwifi_ic_attach(struct usbwifi *uw, int num_tx_chains, int num_rx_chains,
-    int flags)
+    int num_tx_pipes, int num_rx_pipes, int flags)
 {
        USBWIFIHIST_FUNC(); USBWIFIHIST_CALLED();
 
@@ -1257,6 +1257,8 @@ usbwifi_ic_attach(struct usbwifi *uw, in
            num_tx_chains <= __arraycount(uw->uw_pri->uwp_sendq));
        KASSERT(num_rx_chains);
 
+       uw->uw_txpipes = num_tx_pipes;
+       uw->uw_rxpipes = num_rx_pipes;
        uw->uw_ic.ic_txstream = num_tx_chains;
        uw->uw_ic.ic_rxstream = num_rx_chains;
        uw->uw_ic.ic_flags = flags;
diff -r 2c849754287e -r bd782fe6a6f1 sys/dev/usb/usbwifi.h
--- a/sys/dev/usb/usbwifi.h     Tue Dec 21 13:03:21 2021 +1100
+++ b/sys/dev/usb/usbwifi.h     Sun Jan 02 11:50:12 2022 +1100
@@ -203,6 +203,8 @@ struct usbwifi {
        unsigned                uw_tx_list_cnt;
        int                     uw_rx_xfer_flags;
        int                     uw_tx_xfer_flags;
+       int                     uw_rxpipes;
+       int                     uw_txpipes;
 
        /*
         * This section should be filled in before calling
@@ -288,7 +290,7 @@ void        usbwifi_enqueue(struct usbwifi * un
 
 /* autoconf */
 void   usbwifi_attach(struct usbwifi *uw, const char *);
-void   usbwifi_ic_attach(struct usbwifi *uw, int, int, int);
+void   usbwifi_ic_attach(struct usbwifi *uw, int, int, int, int, int);
 void   usbwifi_attach_finalize(struct usbwifi *uw);
 int    usbwifi_detach(device_t, int);
 int    usbwifi_activate(device_t, devact_t);



Home | Main Index | Thread Index | Old Index