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 State save.



details:   https://anonhg.NetBSD.org/src-all/rev/efb92aff6a8d
branches:  trunk
changeset: 950590:efb92aff6a8d
user:      Nathanial Sloss <nat%netbsd.org@localhost>
date:      Sat Aug 29 03:02:57 2020 +1000

description:
State save.

diffstat:

 sys/dev/pci/if_iwm.c |  116 ++++++++++++++++++++++++++++----------------------
 1 files changed, 65 insertions(+), 51 deletions(-)

diffs (truncated from 349 to 300 lines):

diff -r 1479bf92862b -r efb92aff6a8d sys/dev/pci/if_iwm.c
--- a/sys/dev/pci/if_iwm.c      Sat Aug 29 03:02:29 2020 +1000
+++ b/sys/dev/pci/if_iwm.c      Sat Aug 29 03:02:57 2020 +1000
@@ -461,7 +461,7 @@
 static int     iwm_mac_ctxt_cmd(struct iwm_softc *, struct iwm_node *,
                    uint32_t, int);
 static int     iwm_update_quotas(struct iwm_softc *, struct iwm_node *);
-static int     iwm_auth(struct iwm_softc *);
+static int     iwm_auth(struct ieee80211vap *);
 static int     iwm_assoc(struct iwm_softc *);
 static void    iwm_calib_timeout(void *);
 #ifndef IEEE80211_NO_HT
@@ -476,11 +476,11 @@
 static void    iwm_endscan(struct iwm_softc *);
 static void    iwm_fill_sf_command(struct iwm_softc *, struct iwm_sf_cfg_cmd *,
                    struct ieee80211_node *);
-static int     iwm_sf_config(struct iwm_softc *, int);
+static int     iwm_sf_config(struct ieee80211vap *, int);
 static int     iwm_send_bt_init_conf(struct iwm_softc *);
 static int     iwm_send_update_mcc_cmd(struct iwm_softc *, const char *);
 static void    iwm_tt_tx_backoff(struct iwm_softc *, uint32_t);
-static int     iwm_init_hw(struct iwm_softc *);
+static int     iwm_init_hw(struct ieee80211_vap *);
 static int     iwm_init(struct ifnet *);
 static void    iwm_start(struct ifnet *);
 static void    iwm_stop(struct ifnet *, int);
@@ -494,7 +494,7 @@
 static void    iwm_notif_intr(struct iwm_softc *);
 static int     iwm_intr(void *);
 static void    iwm_softintr(void *);
-static int     iwm_preinit(struct iwm_softc *);
+//static int   iwm_preinit(struct iwm_softc *);
 static void    iwm_attach_hook(device_t);
 static void    iwm_attach(device_t, device_t, void *);
 static int     iwm_config_complete(device_t);
@@ -503,7 +503,7 @@
 static int     iwm_activate(device_t, enum devact);
 static void    iwm_wakeup(struct iwm_softc *);
 #endif
-static void    iwm_radiotap_attach(struct iwm_softc *);
+static void    iwm_radiotap_attach(struct iwm_softc *, struct ifnet *);
 static int     iwm_sysctl_fw_loaded_handler(SYSCTLFN_PROTO);
 
 static int iwm_sysctl_root_num;
@@ -2871,9 +2871,9 @@
 static void
 iwm_ba_task(void *arg)
 {
-       struct iwm_softc *sc = arg;
-       struct ieee80211com *ic = &sc->sc_ic;
-       struct ieee80211_node *ni = ic->ic_bss;
+       struct ieee80211vap *vap = arg;
+       struct ieee80211com *ic = vap->iv_ic;
+       struct iwm_softc *sc = ic->ic_softc;
 
        if (sc->ba_start)
                iwm_sta_rx_agg(sc, ni, sc->ba_tid, sc->ba_ssn, 1);
@@ -2881,6 +2881,7 @@
                iwm_sta_rx_agg(sc, ni, sc->ba_tid, 0, 0);
 }
 
+#ifdef notyet
 /*
  * This function is called by upper layer when an ADDBA request is received
  * from another STA and before the ADDBA response is sent.
@@ -2918,6 +2919,7 @@
        task_add(systq, &sc->ba_task);
 }
 #endif
+#endif
 
 static void
 iwm_free_fw_paging(struct iwm_softc *sc)
@@ -3811,7 +3813,7 @@
        if (err)
                return err;
 
-       err = iwm_sf_config(sc, IWM_SF_INIT_OFF);
+       err = iwm_sf_config(vap, IWM_SF_INIT_OFF);
        if (err)
                return err;
 
@@ -3983,6 +3985,7 @@
        return (nbant == 0) ? -127 : (total / nbant) - 107;
 }
 
+#ifdef notyet
 static void
 iwm_rx_rx_mpdu(struct iwm_softc *sc, struct iwm_rx_packet *pkt,
     struct iwm_rx_data *data)
@@ -4115,6 +4118,7 @@
        }
        splx(s);
 }
+#endif
 
 static void
 iwm_rx_tx_cmd_single(struct iwm_softc *sc, struct iwm_rx_packet *pkt,
@@ -6005,14 +6009,15 @@
 }
 
 static int
-iwm_auth(struct iwm_softc *sc)
-{
-       struct ieee80211com *ic = &sc->sc_ic;
-       struct iwm_node *in = (struct iwm_node *)ic->ic_bss;
+iwm_auth(struct ieee80211vap *vap)
+{
+       struct ieee80211com *ic = vap->iv_ic;
+       struct iwm_softc *sc = ic->ic_softc;
+       struct iwm_node *in = (struct iwm_node *)vap->iv_bss;
        uint32_t duration;
        int err;
 
-       err = iwm_sf_config(sc, IWM_SF_FULL_ON);
+       err = iwm_sf_config(vap, IWM_SF_FULL_ON);
        if (err)
                return err;
 
@@ -6085,9 +6090,10 @@
 static void
 iwm_calib_timeout(void *arg)
 {
-       struct iwm_softc *sc = arg;
-       struct ieee80211com *ic = &sc->sc_ic;
-       struct iwm_node *in = (struct iwm_node *)ic->ic_bss;
+       struct ieee80211vap *vap = arg;
+       struct ieee80211com *ic = vap->iv_ic;
+       struct iwm_softc *sc = ic->ic_softc;
+       struct iwm_node *in = (struct iwm_node *)vap->iv_bss;
 #ifndef IEEE80211_NO_HT
        struct ieee80211_node *ni = &in->in_ni;
        int otxrate;
@@ -6100,7 +6106,7 @@
            || ic->ic_fixed_mcs == -1
 #endif
            ) &&
-           ic->ic_opmode == IEEE80211_M_STA && ic->ic_bss) {
+           ic->ic_opmode == IEEE80211_M_STA && iv->iv_bss) {
 #ifndef IEEE80211_NO_HT
                if (ni->ni_flags & IEEE80211_NODE_HT)
                        otxrate = ni->ni_txmcs;
@@ -6130,9 +6136,10 @@
 static void
 iwm_setrates_task(void *arg)
 {
-       struct iwm_softc *sc = arg;
-       struct ieee80211com *ic = &sc->sc_ic;
-       struct iwm_node *in = (struct iwm_node *)ic->ic_bss;
+       struct ieee80211vap *vap = arg;
+       struct ieee80211com *ic = vap->iv_ic;
+       struct iwm_softc *sc = ic->ic_softc;
+       struct iwm_node *in = (struct iwm_node *)vap->iv_bss;
 
        /* Update rates table based on new TX rate determined by AMRR. */
        iwm_setrates(in);
@@ -6311,7 +6318,7 @@
                }
 
                iwm_stop_device(sc);
-               iwm_init_hw(sc);
+               iwm_init_hw(vap);
        }
 
        switch (nstate) {
@@ -6337,7 +6344,7 @@
                return 0;
 
        case IEEE80211_S_AUTH:
-               err = iwm_auth(sc);
+               err = iwm_auth(vap);
                if (err) {
                        DPRINTF(("%s: could not move to auth state: %d\n",
                            DEVNAME(sc), err));
@@ -6355,7 +6362,7 @@
                break;
 
        case IEEE80211_S_RUN:
-               in = (struct iwm_node *)ic->ic_bss;
+               in = (struct iwm_node *)iv->iv_bss;
 
                /* We have now been assigned an associd by the AP. */
                err = iwm_mac_ctxt_cmd(sc, in, IWM_FW_CTXT_ACTION_MODIFY, 1);
@@ -6589,9 +6596,11 @@
 }
 
 static int
-iwm_sf_config(struct iwm_softc *sc, int new_state)
-{
-       struct ieee80211com *ic = &sc->sc_ic;
+iwm_sf_config(struct ieee80211vap *vap, int new_state)
+{
+       struct ieee80211com *ic = vap->iv_ic;
+       struct iwm_softc *sc = ic->ic_softc;
+       struct iwm_node *in = (struct iwm_node *)vap->iv_bss;
        struct iwm_sf_cfg_cmd sf_cmd = {
                .state = htole32(IWM_SF_FULL_ON),
        };
@@ -6605,7 +6614,7 @@
                iwm_fill_sf_command(sc, &sf_cmd, NULL);
                break;
        case IWM_SF_FULL_ON:
-               iwm_fill_sf_command(sc, &sf_cmd, ic->ic_bss);
+               iwm_fill_sf_command(sc, &sf_cmd, in);
                break;
        default:
                return EINVAL;
@@ -6699,14 +6708,17 @@
 }
 
 static int
-iwm_init_hw(struct iwm_softc *sc)
-{
-       struct ieee80211com *ic = &sc->sc_ic;
+iwm_init_hw(struct ieee80211vap *vap)
+{
+       struct ieee80211com *ic = &vap->iv_ic;
+       struct iwm_softc *sc = &ic->if_softc;
        int err, i, ac;
 
+#if 0
        err = iwm_preinit(sc);
        if (err)
                return err;
+#endif
 
        err = iwm_start_hw(sc);
        if (err) {
@@ -6845,7 +6857,7 @@
 iwm_allow_mcast(struct iwm_softc *sc)
 {
        struct ieee80211com *ic = &sc->sc_ic;
-       struct ieee80211_node *ni = ic->ic_bss;
+       struct ieee80211_node *ni = iv->iv_bss;
        struct iwm_mcast_filter_cmd *cmd;
        size_t size;
        int err;
@@ -6889,7 +6901,8 @@
 static int
 iwm_init(struct ifnet *ifp)
 {
-       struct iwm_softc *sc = ifp->if_softc;
+       struct ieee80211vap *vap = ifp->if_softc;
+       struct iwm_softc *sc = vap->if_softc;
        int err;
 
        if (ISSET(sc->sc_flags, IWM_FLAG_HW_INITED))
@@ -6898,7 +6911,7 @@
        sc->sc_generation++;
        sc->sc_flags &= ~IWM_FLAG_STOPPED;
 
-       err = iwm_init_hw(sc);
+       err = iwm_init_hw(vap);
        if (err) {
                iwm_stop(ifp, 1);
                return err;
@@ -7840,6 +7853,7 @@
        return 0;
 }
 
+#if 0
 static int
 iwm_preinit(struct iwm_softc *sc)
 {
@@ -7897,7 +7911,7 @@
 
        ieee80211_announce(ic);
 
-       iwm_radiotap_attach(sc);
+       iwn_radiotap_attach(sc, vap->iv_ifp);
 
        return 0;
 }
@@ -7909,6 +7923,7 @@
 
        iwm_preinit(sc);
 }
+#endif
 
 static void
 iwm_attach(device_t parent, device_t self, void *aux)
@@ -8203,19 +8218,7 @@
        sc->sc_amrr.amrr_max_success_threshold = 15;
 
        callout_init(&sc->sc_calib_to, 0);
-       callout_setfunc(&sc->sc_calib_to, iwm_calib_timeout, sc);
        callout_init(&sc->sc_led_blink_to, 0);
-       callout_setfunc(&sc->sc_led_blink_to, iwm_led_blink_timeout, sc);
-#ifndef IEEE80211_NO_HT
-       if (workqueue_create(&sc->sc_setratewq, "iwmsr",
-           iwm_setrates_task, sc, PRI_NONE, IPL_NET, 0))
-               panic("%s: could not create workqueue: setrates",
-                   device_xname(self));
-       if (workqueue_create(&sc->sc_bawq, "iwmba",
-           iwm_ba_task, sc, PRI_NONE, IPL_NET, 0))
-               panic("%s: could not create workqueue: blockack",
-                   device_xname(self));
-#endif
 
        if (pmf_device_register(self, NULL, NULL))



Home | Main Index | Thread Index | Old Index