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 Function paramaters re written to use vap.
details: https://anonhg.NetBSD.org/src-all/rev/163994878dc8
branches: trunk
changeset: 360093:163994878dc8
user: Nathanial Sloss <nat%netbsd.org@localhost>
date: Sat May 16 10:54:05 2020 +1000
description:
Function paramaters re written to use vap.
Improved rx_done handling from urtwn.
Let state machine control scanning.
No functions except for newstate_cb override newstate callback.
iwn can now scan!
diffstat:
sys/dev/pci/if_iwn.c | 132 ++++++++++++++++++++++++++++----------------------
1 files changed, 75 insertions(+), 57 deletions(-)
diffs (truncated from 395 to 300 lines):
diff -r 61e8d95a58fa -r 163994878dc8 sys/dev/pci/if_iwn.c
--- a/sys/dev/pci/if_iwn.c Thu May 14 20:42:54 2020 +1000
+++ b/sys/dev/pci/if_iwn.c Sat May 16 10:54:05 2020 +1000
@@ -263,7 +263,7 @@
static void iwn_calib_timeout(void *);
static void iwn_rx_phy(struct iwn_softc *, struct iwn_rx_desc *,
struct iwn_rx_data *);
-static void iwn_rx_done(struct iwn_softc *, struct iwn_rx_desc *,
+static void iwn_rx_done(struct ieee80211vap *, struct iwn_rx_desc *,
struct iwn_rx_data *);
#ifndef IEEE80211_NO_HT
static void iwn_rx_compressed_ba(struct iwn_softc *, struct iwn_rx_desc *,
@@ -271,7 +271,7 @@
#endif
static void iwn5000_rx_calib_results(struct iwn_softc *,
struct iwn_rx_desc *, struct iwn_rx_data *);
-static void iwn_rx_statistics(struct iwn_softc *, struct iwn_rx_desc *,
+static void iwn_rx_statistics(struct ieee80211vap *, struct iwn_rx_desc *,
struct iwn_rx_data *);
static void iwn4965_tx_done(struct iwn_softc *, struct iwn_rx_desc *,
struct iwn_rx_data *);
@@ -280,7 +280,7 @@
static void iwn_tx_done(struct iwn_softc *, struct iwn_rx_desc *, int,
uint8_t);
static void iwn_cmd_done(struct iwn_softc *, struct iwn_rx_desc *);
-static void iwn_notif_intr(struct iwn_softc *);
+static void iwn_notif_intr(struct ieee80211vap *);
static void iwn_wakeup_intr(struct iwn_softc *);
static void iwn_fatal_intr(struct iwn_softc *);
static int iwn_intr(void *);
@@ -335,13 +335,13 @@
static int iwn_config_bt_coex_adv2(struct iwn_softc *);
static int iwn_config(struct ieee80211vap *);
-static uint16_t iwn_get_active_dwell_time(struct ieee80211vap *, uint16_t,
+static uint16_t iwn_get_active_dwell_time(struct ieee80211_node *, uint16_t,
uint8_t);
-static uint16_t iwn_limit_dwell(struct ieee80211vap *, uint16_t);
-static uint16_t iwn_get_passive_dwell_time(struct ieee80211vap *, uint16_t);
+static uint16_t iwn_limit_dwell(struct ieee80211_node *, uint16_t);
+static uint16_t iwn_get_passive_dwell_time(struct ieee80211_node *, uint16_t);
static void iwn_scan(struct ieee80211com *);
-static int iwn_auth(struct iwn_softc *);
-static int iwn_run(struct iwn_softc *);
+static int iwn_auth(struct ieee80211vap *);
+static int iwn_run(struct ieee80211vap *);
#ifdef IWN_HWCRYPTO
static int iwn_set_key(struct ieee80211com *, struct ieee80211_node *,
struct ieee80211_key *);
@@ -781,7 +781,6 @@
return 0;
}
-
ieee80211_announce(ic);
return 0;
@@ -861,6 +860,7 @@
/* Local setup */
vap->iv_reset = iwn_reset;
+ vap->iv_ic = ic;
ifp = vap->iv_ifp;// = &sc->sc_ec.ec_if;
if_initialize(ifp);
@@ -1079,8 +1079,6 @@
{
struct iwn_softc *sc = device_private(self);
struct ieee80211com *ic = &sc->sc_ic;
- struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
- struct ifnet *ifp = vap->iv_ifp;
int qid;
if (!(sc->sc_flags & IWN_FLAG_ATTACHED))
@@ -1111,8 +1109,7 @@
bus_space_unmap(sc->sc_st, sc->sc_sh, sc->sc_sz);
- ieee80211_ifdetach(&sc->sc_ic);
- if_detach(ifp);
+ ieee80211_ifdetach(ic);
return 0;
}
@@ -2121,11 +2118,12 @@
enum ieee80211_state ostate = vap->iv_state;
+ vap->iv_debug = ieee80211_debug;
switch (nstate) {
case IEEE80211_S_SCAN:
/* XXX Do not abort a running scan. */
if (sc->sc_flags & IWN_FLAG_SCANNING) {
- if (ostate != nstate)
+ if (ostate == nstate)
aprint_debug_dev(sc->sc_dev, "scan request(%d) "
"while scanning(%d) ignored\n", nstate,
ostate);
@@ -2140,7 +2138,7 @@
/* Make the link LED blink while we're scanning. */
iwn_set_led(sc, IWN_LED_LINK, 10, 10);
- iwn_scan(ic);
+ //iwn_scan(ic);
//ic->ic_state = nstate;
break;
@@ -2162,7 +2160,7 @@
if (IEEE80211_IS_CHAN_PASSIVE(ic->ic_curchan))
sc->sc_beacon_wait = 1;
- if ((error = iwn_auth(sc)) != 0) {
+ if ((error = iwn_auth(vap)) != 0) {
aprint_error_dev(sc->sc_dev,
"could not move to auth state\n");
return error;
@@ -2182,7 +2180,7 @@
if (IEEE80211_IS_CHAN_PASSIVE(ic->ic_curchan))
sc->sc_beacon_wait = 1;
- if ((error = iwn_run(sc)) != 0) {
+ if ((error = iwn_run(vap)) != 0) {
aprint_error_dev(sc->sc_dev,
"could not move to run state\n");
return error;
@@ -2196,13 +2194,15 @@
* Purge the xmit queue so we don't have old frames
* during a new association attempt.
*/
+ error = iwn_init(ifp);
+ if (error)
+ return error;
sc->sc_beacon_wait = 0;
ifp->if_flags &= ~IFF_OACTIVE;
iwn_start(ifp);
break;
}
- vap->iv_debug = ieee80211_debug;
error = (*sc->sc_newstate)(vap, nstate, arg);
return error;
}
@@ -2273,12 +2273,12 @@
* Each MPDU_RX_DONE notification must be preceded by an RX_PHY one.
*/
static void
-iwn_rx_done(struct iwn_softc *sc, struct iwn_rx_desc *desc,
+iwn_rx_done(struct ieee80211vap *vap, struct iwn_rx_desc *desc,
struct iwn_rx_data *data)
{
+ struct ieee80211com *ic = vap->iv_ic;
+ struct iwn_softc *sc = ic->ic_softc;
struct iwn_ops *ops = &sc->ops;
- struct ieee80211com *ic = &sc->sc_ic;
- struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
struct ifnet *ifp = vap->iv_ifp;
struct iwn_rx_ring *ring = &sc->rxq;
struct ieee80211_frame *wh;
@@ -2444,11 +2444,24 @@
}
}
- /* Send the frame to the 802.11 layer. */
- ieee80211_input(ni, m, rssi, 0);
-
- /* Node is no longer needed. */
- ieee80211_free_node(ni);
+ if (ni != NULL) {
+ if (ni->ni_vap == NULL) {
+ ieee80211_free_node(ni);
+ splx(s);
+ return;
+ }
+ /* push the frame up to the 802.11 stack */
+ /* NNN Convert rssi to -10 to 110 ? for 802.11 layer */
+ ieee80211_input(ni, m, rssi, 0);
+
+ /* Node is no longer needed. */
+ ieee80211_free_node(ni);
+
+ } else {
+
+ /* No node found ... process differently. */
+ (void) ieee80211_input_all(ic, m, rssi, 0);
+ }
splx(s);
}
@@ -2536,11 +2549,11 @@
* The latter is sent by the firmware after each received beacon.
*/
static void
-iwn_rx_statistics(struct iwn_softc *sc, struct iwn_rx_desc *desc,
+iwn_rx_statistics(struct ieee80211vap *vap, struct iwn_rx_desc *desc,
struct iwn_rx_data *data)
{
- struct ieee80211com *ic = &sc->sc_ic;
- struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
+ struct ieee80211com *ic = vap->iv_ic;
+ struct iwn_softc *sc = ic->ic_softc;
struct iwn_ops *ops = &sc->ops;
struct iwn_calib_state *calib = &sc->calib;
struct iwn_stats *stats = (struct iwn_stats *)(desc + 1);
@@ -2702,11 +2715,11 @@
* Process an INT_FH_RX or INT_SW_RX interrupt.
*/
static void
-iwn_notif_intr(struct iwn_softc *sc)
-{
+iwn_notif_intr(struct ieee80211vap *vap)
+{
+ struct ieee80211com *ic = vap->iv_ic;
+ struct iwn_softc *sc = ic->ic_softc;
struct iwn_ops *ops = &sc->ops;
- struct ieee80211com *ic = &sc->sc_ic;
- struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
struct ifnet *ifp = vap->iv_ifp;
uint16_t hw;
int s;
@@ -2737,7 +2750,7 @@
case IWN_RX_DONE: /* 4965AGN only. */
case IWN_MPDU_RX_DONE:
/* An 802.11 frame has been received. */
- iwn_rx_done(sc, desc, data);
+ iwn_rx_done(vap, desc, data);
break;
#ifndef IEEE80211_NO_HT
case IWN_RX_COMPRESSED_BA:
@@ -2752,7 +2765,7 @@
case IWN_RX_STATISTICS:
case IWN_BEACON_STATISTICS:
- iwn_rx_statistics(sc, desc, data);
+ iwn_rx_statistics(vap, desc, data);
break;
case IWN_BEACON_MISSED:
@@ -2853,10 +2866,10 @@
*/
sc->sc_flags &= ~IWN_FLAG_SCANNING_2GHZ;
sc->sc_flags |= IWN_FLAG_SCANNING_5GHZ;
- iwn_scan(ic);
+ //iwn_scan(ic);
}
sc->sc_flags &= ~IWN_FLAG_SCANNING;
- // ieee80211_end_scan(ic);
+ //ieee80211_end_scan(ic);
break;
}
case IWN5000_CALIBRATION_RESULT:
@@ -3044,13 +3057,13 @@
if (r1 & (IWN_INT_FH_RX | IWN_INT_SW_RX))
IWN_WRITE(sc, IWN_FH_INT, IWN_FH_INT_RX);
IWN_WRITE_1(sc, IWN_INT_PERIODIC, IWN_INT_PERIODIC_DIS);
- iwn_notif_intr(sc);
+ iwn_notif_intr(vap);
if (r1 & (IWN_INT_FH_RX | IWN_INT_SW_RX)) {
IWN_WRITE_1(sc, IWN_INT_PERIODIC,
IWN_INT_PERIODIC_ENA);
}
} else
- iwn_notif_intr(sc);
+ iwn_notif_intr(vap);
}
if ((r1 & IWN_INT_FH_TX) || (r2 & IWN_FH_INT_TX)) {
@@ -4841,7 +4854,7 @@
}
static uint16_t
-iwn_get_active_dwell_time(struct ieee80211vap *vap, uint16_t flags,
+iwn_get_active_dwell_time(struct ieee80211_node *ni, uint16_t flags,
uint8_t n_probes)
{
/* No channel? Default to 2GHz settings */
@@ -4860,9 +4873,9 @@
* Returns the dwell time in milliseconds.
*/
static uint16_t
-iwn_limit_dwell(struct ieee80211vap *vap, uint16_t dwell_time)
-{
- struct ieee80211_node *ni = vap->iv_bss;
+iwn_limit_dwell(struct ieee80211_node *ni, uint16_t dwell_time)
+{
+
int bintval = 0;
/* bintval is in TU (1.024mS) */
@@ -4884,7 +4897,7 @@
}
static uint16_t
-iwn_get_passive_dwell_time(struct ieee80211vap *vap, uint16_t flags)
+iwn_get_passive_dwell_time(struct ieee80211_node *ni, uint16_t flags)
{
uint16_t passive;
if (flags & IEEE80211_CHAN_2GHZ)
@@ -4893,13 +4906,13 @@
passive = IWN_PASSIVE_DWELL_BASE + IWN_PASSIVE_DWELL_TIME_5GHZ;
Home |
Main Index |
Thread Index |
Old Index