Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5ec03976 authored by Abhijeet Kolekar's avatar Abhijeet Kolekar Committed by John W. Linville
Browse files

iwlwifi : Set monitor mode for 3945



The patch leverages mac80211 configure_filter to enable iwl3945
monitor mode.

Signed-off-by: default avatarAbhijeet Kolekar <abhijeet.kolekar@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 4419e39b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -886,6 +886,7 @@ struct iwl3945_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;

+35 −1
Original line number Diff line number Diff line
@@ -6144,6 +6144,24 @@ static void iwl3945_bg_rf_kill(struct work_struct *work)
	mutex_unlock(&priv->mutex);
}

static void iwl3945_bg_set_monitor(struct work_struct *work)
{
	struct iwl3945_priv *priv = container_of(work,
				struct iwl3945_priv, set_monitor);

	IWL_DEBUG(IWL_DL_STATE, "setting monitor mode\n");

	mutex_lock(&priv->mutex);

	if (!iwl3945_is_ready(priv))
		IWL_DEBUG(IWL_DL_STATE, "leave - not ready\n");
	else
		if (iwl3945_set_mode(priv, IEEE80211_IF_TYPE_MNTR) != 0)
			IWL_ERROR("iwl3945_set_mode() failed\n");

	mutex_unlock(&priv->mutex);
}

#define IWL_SCAN_CHECK_WATCHDOG (7 * HZ)

static void iwl3945_bg_scan_check(struct work_struct *data)
@@ -6996,7 +7014,22 @@ static void iwl3945_configure_filter(struct ieee80211_hw *hw,
	 * XXX: dummy
	 * see also iwl3945_connection_init_rx_config
	 */
	*total_flags = 0;
	struct iwl3945_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 iwl3945_mac_remove_interface(struct ieee80211_hw *hw,
@@ -7872,6 +7905,7 @@ static void iwl3945_setup_deferred_work(struct iwl3945_priv *priv)
	INIT_WORK(&priv->abort_scan, iwl3945_bg_abort_scan);
	INIT_WORK(&priv->rf_kill, iwl3945_bg_rf_kill);
	INIT_WORK(&priv->beacon_update, iwl3945_bg_beacon_update);
	INIT_WORK(&priv->set_monitor, iwl3945_bg_set_monitor);
	INIT_DELAYED_WORK(&priv->post_associate, iwl3945_bg_post_associate);
	INIT_DELAYED_WORK(&priv->init_alive_start, iwl3945_bg_init_alive_start);
	INIT_DELAYED_WORK(&priv->alive_start, iwl3945_bg_alive_start);