[haiku-commits] r41218 - haiku/vendor/freebsd/current/dev/iwi

  • From: korli@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 11 Apr 2011 20:02:27 +0200 (CEST)

Author: korli
Date: 2011-04-11 20:02:27 +0200 (Mon, 11 Apr 2011)
New Revision: 41218
Changeset: https://dev.haiku-os.org/changeset/41218

Modified:
   haiku/vendor/freebsd/current/dev/iwi/if_iwi.c
   haiku/vendor/freebsd/current/dev/iwi/if_iwivar.h
Log:
updating to FreeBSD 8.2 release

Modified: haiku/vendor/freebsd/current/dev/iwi/if_iwi.c
===================================================================
--- haiku/vendor/freebsd/current/dev/iwi/if_iwi.c       2011-04-11 18:02:13 UTC 
(rev 41217)
+++ haiku/vendor/freebsd/current/dev/iwi/if_iwi.c       2011-04-11 18:02:27 UTC 
(rev 41218)
@@ -180,6 +180,7 @@
 static int     iwi_config(struct iwi_softc *);
 static int     iwi_get_firmware(struct iwi_softc *, enum ieee80211_opmode);
 static void    iwi_put_firmware(struct iwi_softc *);
+static void    iwi_monitor_scan(void *, int);
 static int     iwi_scanchan(struct iwi_softc *, unsigned long, int);
 static void    iwi_scan_start(struct ieee80211com *);
 static void    iwi_scan_end(struct ieee80211com *);
@@ -292,6 +293,7 @@
        TASK_INIT(&sc->sc_restarttask, 0, iwi_restart, sc);
        TASK_INIT(&sc->sc_disassoctask, 0, iwi_disassoc, sc);
        TASK_INIT(&sc->sc_wmetask, 0, iwi_update_wme, sc);
+       TASK_INIT(&sc->sc_monitortask, 0, iwi_monitor_scan, sc);
 
        callout_init_mtx(&sc->sc_wdtimer, &sc->sc_mtx, 0);
        callout_init_mtx(&sc->sc_rftimer, &sc->sc_mtx, 0);
@@ -363,8 +365,8 @@
        ifp->if_init = iwi_init;
        ifp->if_ioctl = iwi_ioctl;
        ifp->if_start = iwi_start;
-       IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
-       ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN;
+       IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen);
+       ifp->if_snd.ifq_drv_maxlen = ifqmaxlen;
        IFQ_SET_READY(&ifp->if_snd);
 
        ic->ic_ifp = ifp;
@@ -460,6 +462,7 @@
        ieee80211_draintask(ic, &sc->sc_radiofftask);
        ieee80211_draintask(ic, &sc->sc_restarttask);
        ieee80211_draintask(ic, &sc->sc_disassoctask);
+       ieee80211_draintask(ic, &sc->sc_monitortask);
 
        iwi_stop(sc);
 
@@ -988,7 +991,8 @@
                         * This is all totally bogus and needs to be redone.
                         */
                        iwi_auth_and_assoc(sc, vap);
-               }
+               } else if (vap->iv_opmode == IEEE80211_M_MONITOR)
+                       ieee80211_runtask(ic, &sc->sc_monitortask);
                break;
        case IEEE80211_S_ASSOC:
                /*
@@ -1364,7 +1368,7 @@
 
        ni = vap->iv_bss;
        ni->ni_capinfo = capinfo;
-       ni->ni_associd = associd;
+       ni->ni_associd = associd & 0x3fff;
        if (wme != NULL)
                ni->ni_flags |= IEEE80211_NODE_QOS;
        else
@@ -1407,6 +1411,18 @@
 
                IWI_STATE_END(sc, IWI_FW_SCANNING);
 
+               /*
+                * Monitor mode works by doing a passive scan to set
+                * the channel and enable rx.  Because we don't want
+                * to abort a scan lest the firmware crash we scan
+                * for a short period of time and automatically restart
+                * the scan when notified the sweep has completed.
+                */
+               if (vap->iv_opmode == IEEE80211_M_MONITOR) {
+                       ieee80211_runtask(ic, &sc->sc_monitortask);
+                       break;
+               }
+
                if (scan->status == IWI_SCAN_COMPLETED) {
                        /* NB: don't need to defer, net80211 does it for us */
                        ieee80211_scan_next(vap);
@@ -1467,7 +1483,7 @@
                        IWI_STATE_END(sc, IWI_FW_ASSOCIATING);
                        iwi_checkforqos(vap,
                            (const struct ieee80211_frame *)(assoc+1),
-                           le16toh(notif->len) - sizeof(*assoc));
+                           le16toh(notif->len) - sizeof(*assoc) - 1);
                        ieee80211_new_state(vap, IEEE80211_S_RUN, -1);
                        break;
                case IWI_ASSOC_INIT:
@@ -2557,6 +2573,11 @@
        config.answer_pbreq = (ic->ic_opmode == IEEE80211_M_IBSS) ? 1 : 0;
        config.disable_unicast_decryption = 1;
        config.disable_multicast_decryption = 1;
+       if (ic->ic_opmode == IEEE80211_M_MONITOR) {
+               config.allow_invalid_frames = 1;
+               config.allow_beacon_and_probe_resp = 1;
+               config.allow_mgt = 1;
+       }
        DPRINTF(("Configuring adapter\n"));
        error = iwi_cmd(sc, IWI_CMD_SET_CONFIG, &config, sizeof config);
        if (error != 0)
@@ -2642,6 +2663,17 @@
        return IEEE80211_IS_CHAN_5GHZ(c) ?  IWI_CHAN_5GHZ : IWI_CHAN_2GHZ;
 }
 
+static void
+iwi_monitor_scan(void *arg, int npending)
+{
+       struct iwi_softc *sc = arg;
+       IWI_LOCK_DECL;
+
+       IWI_LOCK(sc);
+       (void) iwi_scanchan(sc, 2000, 0);
+       IWI_UNLOCK(sc);
+}
+
 /*
  * Start a scan on the current channel or all channels.
  */

Modified: haiku/vendor/freebsd/current/dev/iwi/if_iwivar.h
===================================================================
--- haiku/vendor/freebsd/current/dev/iwi/if_iwivar.h    2011-04-11 18:02:13 UTC 
(rev 41217)
+++ haiku/vendor/freebsd/current/dev/iwi/if_iwivar.h    2011-04-11 18:02:27 UTC 
(rev 41218)
@@ -193,6 +193,7 @@
        struct task             sc_restarttask; /* restart adapter processing */
        struct task             sc_disassoctask;
        struct task             sc_wmetask;     /* set wme parameters */
+       struct task             sc_monitortask;
 
        unsigned int            sc_softled : 1, /* enable LED gpio status */
                                sc_ledstate: 1, /* LED on/off state */


Other related posts:

  • » [haiku-commits] r41218 - haiku/vendor/freebsd/current/dev/iwi - korli