]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
iwlwifi : Set monitor mode for 4965
authorAbhijeet Kolekar <abhijeet.kolekar@intel.com>
Mon, 5 May 2008 02:22:47 +0000 (10:22 +0800)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 14 May 2008 20:29:46 +0000 (16:29 -0400)
The patch leverages mac80211 configure_filter to enable iwl4965
monitor mode.

Signed-off-by: Abhijeet Kolekar <abhijeet.kolekar@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-4965.c
drivers/net/wireless/iwlwifi/iwl-dev.h
drivers/net/wireless/iwlwifi/iwl4965-base.c

index f56b9a91d78aac6a8459eefc8193544e06f614a9..866a93e3de91b1e5fcc47a878da24baf02d67f26 100644 (file)
@@ -2617,7 +2617,9 @@ static void iwl4965_handle_data_packet(struct iwl_priv *priv, int is_data,
                rx_start->byte_count = amsdu->byte_count;
                rx_end = (__le32 *) (((u8 *) hdr) + len);
        }
-       if (len > priv->hw_params.max_pkt_size || len < 16) {
+       /* In monitor mode allow 802.11 ACk frames (10 bytes) */
+       if (len > priv->hw_params.max_pkt_size ||
+           len < ((priv->iw_mode == IEEE80211_IF_TYPE_MNTR) ? 10 : 16)) {
                IWL_WARNING("byte count out of range [16,4K] : %d\n", len);
                return;
        }
@@ -2989,6 +2991,13 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv,
                              rx_status.ssi, rx_status.noise, rx_status.signal,
                              (unsigned long long)rx_status.mactime);
 
+
+       if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) {
+               iwl4965_handle_data_packet(priv, 1, include_phy,
+                                                rxb, &rx_status);
+               return;
+       }
+
        network_packet = iwl4965_is_network_packet(priv, header);
        if (network_packet) {
                priv->last_rx_rssi = rx_status.ssi;
index e730583d88cc455f7b2d191cebbd6eff6c399ff5..25dce14c87d8bf0fddbefdeb84906f552617efd9 100644 (file)
@@ -1163,6 +1163,7 @@ struct iwl_priv {
        struct work_struct report_work;
        struct work_struct request_scan;
        struct work_struct beacon_update;
+       struct work_struct set_monitor;
 
        struct tasklet_struct irq_tasklet;
 
index 2e976c3881e652cdbb2b65a8eed4fe77dbf245fc..88f3554c0fbcefdf1002cee38efd61c1c1198f1d 100644 (file)
@@ -4539,6 +4539,24 @@ static void iwl4965_bg_rf_kill(struct work_struct *work)
        mutex_unlock(&priv->mutex);
 }
 
+static void iwl4965_bg_set_monitor(struct work_struct *work)
+{
+       struct iwl_priv *priv = container_of(work,
+                               struct iwl_priv, set_monitor);
+
+       IWL_DEBUG(IWL_DL_STATE, "setting monitor mode\n");
+
+       mutex_lock(&priv->mutex);
+
+       if (!iwl_is_ready(priv))
+               IWL_DEBUG(IWL_DL_STATE, "leave - not ready\n");
+       else
+               if (iwl4965_set_mode(priv, IEEE80211_IF_TYPE_MNTR) != 0)
+                       IWL_ERROR("iwl4965_set_mode() failed\n");
+
+       mutex_unlock(&priv->mutex);
+}
+
 #define IWL_SCAN_CHECK_WATCHDOG (7 * HZ)
 
 static void iwl4965_bg_scan_check(struct work_struct *data)
@@ -5428,7 +5446,22 @@ static void iwl4965_configure_filter(struct ieee80211_hw *hw,
         * XXX: dummy
         * see also iwl4965_connection_init_rx_config
         */
-       *total_flags = 0;
+       struct iwl_priv *priv = hw->priv;
+       int new_flags = 0;
+       if (changed_flags & (FIF_PROMISC_IN_BSS | FIF_OTHER_BSS)) {
+               if (*total_flags & (FIF_PROMISC_IN_BSS | FIF_OTHER_BSS)) {
+                       IWL_DEBUG_MAC80211("Enter: type %d (0x%x, 0x%x)\n",
+                                          IEEE80211_IF_TYPE_MNTR,
+                                          changed_flags, *total_flags);
+                       /* queue work 'cuz mac80211 is holding a lock which
+                        * prevents us from issuing (synchronous) f/w cmds */
+                       queue_work(priv->workqueue, &priv->set_monitor);
+                       new_flags &= FIF_PROMISC_IN_BSS |
+                                    FIF_OTHER_BSS |
+                                    FIF_ALLMULTI;
+               }
+       }
+       *total_flags = new_flags;
 }
 
 static void iwl4965_mac_remove_interface(struct ieee80211_hw *hw,
@@ -6359,6 +6392,7 @@ static void iwl4965_setup_deferred_work(struct iwl_priv *priv)
        INIT_WORK(&priv->abort_scan, iwl4965_bg_abort_scan);
        INIT_WORK(&priv->rf_kill, iwl4965_bg_rf_kill);
        INIT_WORK(&priv->beacon_update, iwl4965_bg_beacon_update);
+       INIT_WORK(&priv->set_monitor, iwl4965_bg_set_monitor);
        INIT_DELAYED_WORK(&priv->post_associate, iwl4965_bg_post_associate);
        INIT_DELAYED_WORK(&priv->init_alive_start, iwl4965_bg_init_alive_start);
        INIT_DELAYED_WORK(&priv->alive_start, iwl4965_bg_alive_start);