iwlwifi : Set monitor mode for 4965

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>
This commit is contained in:
Abhijeet Kolekar 2008-05-05 10:22:47 +08:00 committed by John W. Linville
parent f3ccc08c8c
commit 4419e39b60
3 changed files with 46 additions and 2 deletions

View 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_start->byte_count = amsdu->byte_count;
rx_end = (__le32 *) (((u8 *) hdr) + len); 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); IWL_WARNING("byte count out of range [16,4K] : %d\n", len);
return; return;
} }
@ -2989,6 +2991,13 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv,
rx_status.ssi, rx_status.noise, rx_status.signal, rx_status.ssi, rx_status.noise, rx_status.signal,
(unsigned long long)rx_status.mactime); (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); network_packet = iwl4965_is_network_packet(priv, header);
if (network_packet) { if (network_packet) {
priv->last_rx_rssi = rx_status.ssi; priv->last_rx_rssi = rx_status.ssi;

View File

@ -1163,6 +1163,7 @@ struct iwl_priv {
struct work_struct report_work; struct work_struct report_work;
struct work_struct request_scan; struct work_struct request_scan;
struct work_struct beacon_update; struct work_struct beacon_update;
struct work_struct set_monitor;
struct tasklet_struct irq_tasklet; struct tasklet_struct irq_tasklet;

View File

@ -4539,6 +4539,24 @@ static void iwl4965_bg_rf_kill(struct work_struct *work)
mutex_unlock(&priv->mutex); 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) #define IWL_SCAN_CHECK_WATCHDOG (7 * HZ)
static void iwl4965_bg_scan_check(struct work_struct *data) 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 * XXX: dummy
* see also iwl4965_connection_init_rx_config * 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, 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->abort_scan, iwl4965_bg_abort_scan);
INIT_WORK(&priv->rf_kill, iwl4965_bg_rf_kill); INIT_WORK(&priv->rf_kill, iwl4965_bg_rf_kill);
INIT_WORK(&priv->beacon_update, iwl4965_bg_beacon_update); 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->post_associate, iwl4965_bg_post_associate);
INIT_DELAYED_WORK(&priv->init_alive_start, iwl4965_bg_init_alive_start); INIT_DELAYED_WORK(&priv->init_alive_start, iwl4965_bg_init_alive_start);
INIT_DELAYED_WORK(&priv->alive_start, iwl4965_bg_alive_start); INIT_DELAYED_WORK(&priv->alive_start, iwl4965_bg_alive_start);