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 Minor cosmetics and remove a bogus mfreem().



details:   https://anonhg.NetBSD.org/src-all/rev/520c6e478edd
branches:  trunk
changeset: 371596:520c6e478edd
user:      Martin Husemann <martin%NetBSD.org@localhost>
date:      Sat Nov 13 17:27:25 2021 +0100

description:
Minor cosmetics and remove a bogus mfreem().

diffstat:

 sys/dev/usb/if_run.c    |  137 +-----------------------------------------------
 sys/dev/usb/if_runvar.h |    1 -
 2 files changed, 2 insertions(+), 136 deletions(-)

diffs (182 lines):

diff -r 045cdc447c3e -r 520c6e478edd sys/dev/usb/if_run.c
--- a/sys/dev/usb/if_run.c      Sun Nov 07 09:55:57 2021 +0100
+++ b/sys/dev/usb/if_run.c      Sat Nov 13 17:27:25 2021 +0100
@@ -2427,7 +2427,7 @@
                k = ieee80211_crypto_encap(ni, m);
                if (k == NULL) {
                        m_freem(m);
-                       return ENOBUFS;
+                       return 0;
                }
                
                /* packet header may have moved, reset our local pointer */
@@ -2522,85 +2522,10 @@
 #endif
 
        m_copydata(m, 0, m->m_pkthdr.len, ((uint8_t *)txwi) + txwisize);
-       m_freem(m);
        
-       xferlen += sizeof(*txd) + 4;
-
-    /* XXX keep this? */
-       // ring->cur = (ring->cur + 1) % RUN_TX_RING_COUNT;
-       // if (++ring->queued >= RUN_TX_RING_COUNT)
-       //      sc->qfullmsk |= 1 << qid;
-
-       return xferlen;
+       return xferlen + sizeof(*txd) + 4;
 }
 
-/* XXX safe to remove this? */
-// static void
-// run_start(struct ifnet *ifp)
-// {
-//     struct run_softc *sc = ifp->if_softc;
-//     struct ieee80211com *ic = &sc->sc_uw.uw_ic;
-//     struct ether_header *eh;
-//     struct ieee80211_node *ni;
-//     struct mbuf *m;
-
-//     if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
-//             return;
-
-//     for (;;) {
-//             if (sc->qfullmsk != 0) {
-//                     ifp->if_flags |= IFF_OACTIVE;
-//                     break;
-//             }
-//             /* send pending management frames first */
-//             IF_DEQUEUE(&ic->ic_mgtq, m);
-//             if (m != NULL) {
-//                     ni = M_GETCTX(m, struct ieee80211_node *);
-//                     M_CLEARCTX(m);
-//                     goto sendit;
-//             }
-//             if (ic->ic_state != IEEE80211_S_RUN) /* XXX change to vap state */
-//                     break;
-
-//             /* encapsulate and send data frames */
-//             IFQ_DEQUEUE(&ifp->if_snd, m);
-//             if (m == NULL)
-//                     break;
-//             if (m->m_len < (int)sizeof(*eh) &&
-//                 (m = m_pullup(m, sizeof(*eh))) == NULL) {
-//                     if_statinc(ifp, if_oerrors);
-//                     continue;
-//             }
-
-//             eh = mtod(m, struct ether_header *);
-//             ni = ieee80211_find_txnode(ic, eh->ether_dhost);
-//             if (ni == NULL) {
-//                     m_freem(m);
-//                     if_statinc(ifp, if_oerrors);
-//                     continue;
-//             }
-
-//             bpf_mtap(ifp, m, BPF_D_OUT);
-
-//             if ((m = ieee80211_encap(ic, m, ni)) == NULL) {
-//                     ieee80211_free_node(ni);
-//                     if_statinc(ifp, if_oerrors);
-//                     continue;
-//             }
-// sendit:
-//             bpf_mtap3(ic->ic_rawbpf, m, BPF_D_OUT);
-
-//             if (run_tx(sc, m, ni) != 0) {
-//                     ieee80211_free_node(ni);
-//                     if_statinc(ifp, if_oerrors);
-//                     continue;
-//             }
-
-//             sc->sc_tx_timer = 5;
-//             ifp->if_timer = 1;
-//     }
-// }
-
 static void
 run_watchdog(void *arg)
 {
@@ -2622,61 +2547,6 @@
        }
 }
 
-
-// static int
-// run_ioctl(struct ifnet *ifp, u_long cmd, void *data)
-// {
-//     struct run_softc *sc = ifp->if_softc;
-//     struct ieee80211com *ic = &sc->sc_uw.uw_ic;
-//     int s, error = 0;
-
-//     s = splnet();
-
-//     switch (cmd) {
-//     case SIOCSIFFLAGS:
-//             if ((error = ifioctl_common(ifp, cmd, data)) != 0)
-//                     break;
-//             switch (ifp->if_flags & (IFF_UP|IFF_RUNNING)) {
-//             case IFF_UP|IFF_RUNNING:
-//                     break;
-//             case IFF_UP:
-//                     run_init(ifp);
-//                     break;
-//             case IFF_RUNNING:
-//                     run_stop(ifp, 1);
-//                     break;
-//             case 0:
-//                     break;
-//             }
-//             break;
-
-//     case SIOCADDMULTI:
-//     case SIOCDELMULTI:
-//             if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) {
-//                     /* setup multicast filter, etc */
-//                     error = 0;
-//             }
-//             break;
-
-//     default:
-//             error = ieee80211_ioctl(ic, cmd, data);
-//             break;
-//     }
-
-//     if (error == ENETRESET) {
-//             if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) ==
-//                 (IFF_UP | IFF_RUNNING)) {
-//                     run_init(ifp);
-//             }
-//             error = 0;
-//     }
-
-//     splx(s);
-
-//     return error;
-// }
-
-
 static void
 run_select_chan_group(struct run_softc *sc, int group)
 {
@@ -4829,9 +4699,6 @@
        run_write(sc, RT2860_MAC_SYS_CTRL, RT2860_BBP_HRST | RT2860_MAC_SRST);
        run_write(sc, RT2860_MAC_SYS_CTRL, 0);
 
-       /* reset Tx and Rx rings */
-       sc->qfullmsk = 0;
-       
        /* XXX free rx and tx rings through usbwifi? */
        usbwifi_stop(uw);
 }
diff -r 045cdc447c3e -r 520c6e478edd sys/dev/usb/if_runvar.h
--- a/sys/dev/usb/if_runvar.h   Sun Nov 07 09:55:57 2021 +0100
+++ b/sys/dev/usb/if_runvar.h   Sat Nov 13 17:27:25 2021 +0100
@@ -188,7 +188,6 @@
        callout_t                       sc_watchdog_to;
        
        struct run_host_cmd_ring        cmdq;
-       uint8_t                         qfullmsk;
        int                             sc_tx_timer;
        struct ieee80211_beacon_offsets sc_bo;
        int                             sc_flags;



Home | Main Index | Thread Index | Old Index