Source-Changes-HG archive

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

[src-draft/trunk]: src/sys/dev/pci Various typos fixed for conversion to the ...



details:   https://anonhg.NetBSD.org/src-all/rev/3d8f7c9d6dc1
branches:  trunk
changeset: 367654:3d8f7c9d6dc1
user:      Nathanial Sloss <nat%netbsd.org@localhost>
date:      Mon Mar 07 18:36:37 2022 +1100

description:
Various typos fixed for conversion to the new stack.

diffstat:

 sys/dev/pci/if_ipw.c    |  139 ++++++++++++++++++++++++-----------------------
 sys/dev/pci/if_ipwvar.h |    1 +
 2 files changed, 72 insertions(+), 68 deletions(-)

diffs (truncated from 467 to 300 lines):

diff -r 4929518b4e2f -r 3d8f7c9d6dc1 sys/dev/pci/if_ipw.c
--- a/sys/dev/pci/if_ipw.c      Mon Mar 07 17:01:45 2022 +1100
+++ b/sys/dev/pci/if_ipw.c      Mon Mar 07 18:36:37 2022 +1100
@@ -98,24 +98,22 @@
 static int     ipw_detach(device_t, int);
 
 static void    ipw_parent(struct ieee80211com *);
-static int     ipw_media_change(struct ifnet *);
-static void    ipw_media_status(struct ifnet *, struct ifmediareq *);
 static int     ipw_newstate(struct ieee80211vap *, enum ieee80211_state, int);
 static uint16_t        ipw_read_prom_word(struct ipw_softc *, uint8_t);
 static void    ipw_command_intr(struct ipw_softc *, struct ipw_soft_buf *);
-static void    ipw_newstate_intr(struct ipw_softc *, struct ipw_soft_buf *);
-static void    ipw_data_intr(struct ipw_softc *, struct ipw_status *,
+static void    ipw_newstate_intr(struct ieee80211vap *, struct ipw_soft_buf *);
+static void    ipw_data_intr(struct ieee80211vap *, struct ipw_status *,
                    struct ipw_soft_bd *, struct ipw_soft_buf *);
-static void    ipw_rx_intr(struct ipw_softc *);
+static void    ipw_rx_intr(struct ieee80211vap *);
 static void    ipw_release_sbd(struct ipw_softc *, struct ipw_soft_bd *);
 static void    ipw_tx_intr(struct ipw_softc *);
 static int     ipw_intr(void *);
 static void    ipw_softintr(void *);
 static int     ipw_cmd(struct ipw_softc *, uint32_t, void *, uint32_t);
 static int     ipw_transmit(struct ieee80211com *, struct mbuf *);
-static int     ipw_raw_xmit(struct ieee80211node *, struct mbuf *,
+static int     ipw_raw_xmit(struct ieee80211_node *, struct mbuf *,
                    const struct ieee80211_bpf_params *);
-static void    ipw_start(struct ifnet *);
+static void    ipw_start(struct ipw_softc *);
 static void    ipw_watchdog(struct ifnet *);
 static int     ipw_get_table1(struct ipw_softc *, uint32_t *);
 static int     ipw_get_radio(struct ipw_softc *, int *);
@@ -202,7 +200,7 @@
        pci_intr_handle_t ih;
        uint32_t data;
        uint16_t val;
-       int i, error;
+       int error;
        char intrbuf[PCI_INTRSTR_LEN];
 
        sc->sc_dev = self;
@@ -266,8 +264,8 @@
        }
 
        ic->ic_name = device_xname(self);
-       ic->ic_txsream = 1; /* XXX */
-       ic->ic_rxsream = 1; /* XXX */
+       ic->ic_txstream = 1; /* XXX */
+       ic->ic_rxstream = 1; /* XXX */
        ic->ic_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 
        ifp->if_watchdog = ipw_watchdog;
@@ -285,19 +283,19 @@
            | IEEE80211_C_IBSS          /* ibss mode */
            | IEEE80211_C_MONITOR       /* monitor mode */
            | IEEE80211_C_WME           /* 802.11e */
-           IEEE80211_C_WPA;            /* WPA/RSN. */
+           | IEEE80211_C_WPA;          /* WPA/RSN. */
            ;
 
        /* read MAC address from EEPROM */
        val = ipw_read_prom_word(sc, IPW_EEPROM_MAC + 0);
-       ic->ic_myaddr[0] = val >> 8;
-       ic->ic_myaddr[1] = val & 0xff;
+       ic->ic_macaddr[0] = val >> 8;
+       ic->ic_macaddr[1] = val & 0xff;
        val = ipw_read_prom_word(sc, IPW_EEPROM_MAC + 1);
-       ic->ic_myaddr[2] = val >> 8;
-       ic->ic_myaddr[3] = val & 0xff;
+       ic->ic_macaddr[2] = val >> 8;
+       ic->ic_macaddr[3] = val & 0xff;
        val = ipw_read_prom_word(sc, IPW_EEPROM_MAC + 2);
-       ic->ic_myaddr[4] = val >> 8;
-       ic->ic_myaddr[5] = val & 0xff;
+       ic->ic_macaddr[4] = val >> 8;
+       ic->ic_macaddr[5] = val & 0xff;
 
 #if 0
        /* set supported .11b rates */
@@ -315,7 +313,7 @@
                }
        }
 #endif
-       ipw_get_radiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_rchans,
+       ipw_get_radiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans,
            ic->ic_channels);
 
        /* check support for radio transmitter switch in EEPROM */
@@ -323,7 +321,7 @@
                sc->flags |= IPW_FLAG_HAS_RADIO_SWITCH;
 
        aprint_normal_dev(sc->sc_dev, "802.11 address %s\n",
-           ether_sprintf(ic->ic_myaddr));
+           ether_sprintf(ic->ic_macaddr));
 
        ieee80211_ifattach(ic);
        /* Use common softint-based if_input */
@@ -337,8 +335,6 @@
        ic->ic_transmit = ipw_transmit;
        ic->ic_raw_xmit = ipw_raw_xmit;
 
-       ieee80211_media_init(ic, ipw_media_change, ipw_media_status);
-
        bpf_attach2(ifp, DLT_IEEE802_11_RADIO,
            sizeof(struct ieee80211_frame) + 64, &sc->sc_drvbpf);
 
@@ -804,6 +800,7 @@
 
 }
 
+#if 0
 static int
 ipw_media_change(struct ifnet *ifp)
 {
@@ -874,14 +871,14 @@
        }
 #undef N
 }
+#endif
 
 static int
 ipw_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate,
     int arg)
 {
        struct ipw_vap *myvap = (struct ipw_vap *)vap;
-       struct ieee80211_com *ic = vap->iv_ic
-       struct ifnet *ifp = vap->iv_ifp;
+       struct ieee80211com *ic = vap->iv_ic;
        struct ipw_softc *sc = ic->ic_softc;
        struct ieee80211_node *ni;
        uint8_t macaddr[IEEE80211_ADDR_LEN];
@@ -914,21 +911,24 @@
                        break;
 
                ieee80211_ref_node(ni);
-               ieee80211_sta_join(ic, ni);
+               //ieee80211_sta_join(vap, ni);
                ieee80211_node_authorize(ni);
 
                if (ic->ic_opmode == IEEE80211_M_STA)
-                       ieee80211_notify_node_join(ic, ni, 1);
+                       ieee80211_notify_node_join(ni, 1);
                break;
 
        case IEEE80211_S_INIT:
        case IEEE80211_S_SCAN:
        case IEEE80211_S_AUTH:
        case IEEE80211_S_ASSOC:
+       case IEEE80211_S_CAC:
+       case IEEE80211_S_CSA:
+       case IEEE80211_S_SLEEP:
                break;
        }
 
-       return (*my_vap->newstate)(vap, nstate, arg);
+       return (*myvap->newstate)(vap, nstate, arg);
 }
 
 static void
@@ -938,14 +938,14 @@
        bool startall = false;
 
        if (ic->ic_nrunning > 0) {
-               if ((sc->sc_flags & IPW_FLAG_FW_INITED) == 0) {
+               if ((sc->flags & IPW_FLAG_FW_INITED) == 0) {
                        ipw_init(sc);
                        startall = true;
                } else {
                        /* update filters or whatever */
                }
-       } else {
-               ipw_stop(sc);
+       } else if (sc->flags & IPW_FLAG_TX_RUNNING) {
+               ipw_stop(sc, 1);
        }
 
        if (startall)
@@ -1027,9 +1027,10 @@
 }
 
 static void
-ipw_newstate_intr(struct ipw_softc *sc, struct ipw_soft_buf *sbuf)
+ipw_newstate_intr(struct ieee80211vap *vap, struct ipw_soft_buf *sbuf)
 {
-       struct ieee80211com *ic = &sc->sc_ic;
+       struct ieee80211com *ic = vap->iv_ic;
+       struct ipw_softc *sc = ic->ic_softc;
        uint32_t state;
        int s;
 
@@ -1044,28 +1045,28 @@
 
        switch (state) {
        case IPW_STATE_ASSOCIATED:
-               ieee80211_new_state(ic, IEEE80211_S_RUN, -1);
+               ieee80211_new_state(vap, IEEE80211_S_RUN, -1);
                break;
 
        case IPW_STATE_SCANNING:
                /* don't leave run state on background scan */
-               if (ic->ic_state != IEEE80211_S_RUN)
-                       ieee80211_new_state(ic, IEEE80211_S_SCAN, -1);
+               if (vap->iv_state != IEEE80211_S_RUN)
+                       ieee80211_new_state(vap, IEEE80211_S_SCAN, -1);
 
                ic->ic_flags |= IEEE80211_F_SCAN;
                break;
 
        case IPW_STATE_SCAN_COMPLETE:
-               ieee80211_notify_scan_done(ic);
+               ieee80211_notify_scan_done(vap);
                ic->ic_flags &= ~IEEE80211_F_SCAN;
                break;
 
        case IPW_STATE_ASSOCIATION_LOST:
-               ieee80211_new_state(ic, IEEE80211_S_INIT, -1);
+               ieee80211_new_state(vap, IEEE80211_S_INIT, -1);
                break;
 
        case IPW_STATE_RADIO_DISABLED:
-               ic->ic_ifp->if_flags &= ~IFF_UP;
+               vap->iv_ifp->if_flags &= ~IFF_UP;
                ipw_stop(sc, 1);
                break;
        }
@@ -1112,10 +1113,11 @@
 }
 
 static void
-ipw_data_intr(struct ipw_softc *sc, struct ipw_status *status,
+ipw_data_intr(struct ieee80211vap *vap, struct ipw_status *status,
     struct ipw_soft_bd *sbd, struct ipw_soft_buf *sbuf)
 {
-       struct ieee80211com *ic = &sc->sc_ic;
+       struct ieee80211com *ic = vap->iv_ic;
+       struct ipw_softc *sc = ic->ic_softc;
        struct ifnet *ifp = &sc->sc_if;
        struct mbuf *mnew, *m;
        struct ieee80211_frame *wh;
@@ -1196,14 +1198,14 @@
                bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_rxtap_len, m, BPF_D_IN);
        }
 
-       if (ic->ic_state == IEEE80211_S_SCAN)
+       if (vap->iv_state == IEEE80211_S_SCAN)
                ipw_fix_channel(ic, m);
 
        wh = mtod(m, struct ieee80211_frame *);
        ni = ieee80211_find_rxnode(ic, (struct ieee80211_frame_min *)wh);
 
        /* send the frame to the 802.11 layer */
-       ieee80211_input(ic, m, ni, status->rssi, 0);
+       ieee80211_input(ni, m, status->rssi, 0);
 
        /* node is no longer needed */
        ieee80211_free_node(ni);
@@ -1215,8 +1217,9 @@
 }
 
 static void
-ipw_rx_intr(struct ipw_softc *sc)
+ipw_rx_intr(struct ieee80211vap *vap)
 {
+       struct ipw_softc *sc = vap->iv_ic->ic_softc;
        struct ipw_status *status;
        struct ipw_soft_bd *sbd;
        struct ipw_soft_buf *sbuf;
@@ -1251,12 +1254,12 @@
                        break;
 
                case IPW_STATUS_CODE_NEWSTATE:
-                       ipw_newstate_intr(sc, sbuf);
+                       ipw_newstate_intr(vap, sbuf);
                        break;
 
                case IPW_STATUS_CODE_DATA_802_3:
                case IPW_STATUS_CODE_DATA_802_11:
-                       ipw_data_intr(sc, status, sbd, sbuf);
+                       ipw_data_intr(vap, status, sbd, sbuf);
                        break;
 
                case IPW_STATUS_CODE_NOTIFICATION:
@@ -1350,8 +1353,8 @@
        sc->txold = (r == 0) ? IPW_NTBD - 1 : r - 1;
 
        /* Call start() since some buffer descriptors have been released */
-       ifp->if_flags &= ~IFF_OACTIVE;
-       ipw_start(ifp); /* in softint */
+       sc->flags &= ~IPW_FLAG_TX_RUNNING;
+       ipw_start(sc); /* in softint */
 
        splx(s);
 }
@@ -1377,6 +1380,7 @@
 ipw_softintr(void *arg)
 {
        struct ipw_softc *sc = arg;
+       struct ieee80211vap *vap = TAILQ_FIRST(&sc->sc_ic.ic_vaps);
        uint32_t r;



Home | Main Index | Thread Index | Old Index