Linux wireless drivers development
 help / color / mirror / Atom feed
From: Zhu Yi <yi.zhu@intel.com>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org,
	Abhijeet Kolekar <abhijeet.kolekar@intel.com>,
	Zhu Yi <yi.zhu@intel.com>
Subject: [PATCH 38/39] iwl3945: enable active scanning on active channels
Date: Wed,  3 Sep 2008 11:26:58 +0800	[thread overview]
Message-ID: <1220412419-15404-39-git-send-email-yi.zhu@intel.com> (raw)
In-Reply-To: <1220412419-15404-38-git-send-email-yi.zhu@intel.com>

From: Abhijeet Kolekar <abhijeet.kolekar@intel.com>

This patch enables active scanning on active channels.

Signed-off-by: Abhijeet Kolekar <abhijeet.kolekar@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl3945-base.c |   54 +++++++++++++--------------
 1 files changed, 26 insertions(+), 28 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 709be78..53e234d 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -4782,8 +4782,11 @@ static void iwl3945_free_channel_map(struct iwl3945_priv *priv)
 /* For active scan, listen ACTIVE_DWELL_TIME (msec) on each channel after
  * sending probe req.  This should be set long enough to hear probe responses
  * from more than one AP.  */
-#define IWL_ACTIVE_DWELL_TIME_24    (20)	/* all times in msec */
-#define IWL_ACTIVE_DWELL_TIME_52    (10)
+#define IWL_ACTIVE_DWELL_TIME_24    (30)	/* all times in msec */
+#define IWL_ACTIVE_DWELL_TIME_52    (20)
+
+#define IWL_ACTIVE_DWELL_FACTOR_24GHZ (3)
+#define IWL_ACTIVE_DWELL_FACTOR_52GHZ (2)
 
 /* For faster active scanning, scan will move to the next channel if fewer than
  * PLCP_QUIET_THRESH packets are heard on this channel within
@@ -4792,7 +4795,7 @@ static void iwl3945_free_channel_map(struct iwl3945_priv *priv)
  * no other traffic).
  * Disable "quiet" feature by setting PLCP_QUIET_THRESH to 0. */
 #define IWL_PLCP_QUIET_THRESH       __constant_cpu_to_le16(1)	/* packets */
-#define IWL_ACTIVE_QUIET_TIME       __constant_cpu_to_le16(5)	/* msec */
+#define IWL_ACTIVE_QUIET_TIME       __constant_cpu_to_le16(10)	/* msec */
 
 /* For passive scan, listen PASSIVE_DWELL_TIME (msec) on each channel.
  * Must be set longer than active dwell time.
@@ -4802,13 +4805,18 @@ static void iwl3945_free_channel_map(struct iwl3945_priv *priv)
 #define IWL_PASSIVE_DWELL_BASE      (100)
 #define IWL_CHANNEL_TUNE_TIME       5
 
+#define IWL_SCAN_PROBE_MASK(n)	 cpu_to_le32((BIT(n) | (BIT(n) - BIT(1))))
+
 static inline u16 iwl3945_get_active_dwell_time(struct iwl3945_priv *priv,
-						enum ieee80211_band band)
+						enum ieee80211_band band,
+						u8 n_probes)
 {
 	if (band == IEEE80211_BAND_5GHZ)
-		return IWL_ACTIVE_DWELL_TIME_52;
+		return IWL_ACTIVE_DWELL_TIME_52 +
+			IWL_ACTIVE_DWELL_FACTOR_52GHZ * (n_probes + 1);
 	else
-		return IWL_ACTIVE_DWELL_TIME_24;
+		return IWL_ACTIVE_DWELL_TIME_24 +
+			IWL_ACTIVE_DWELL_FACTOR_24GHZ * (n_probes + 1);
 }
 
 static u16 iwl3945_get_passive_dwell_time(struct iwl3945_priv *priv,
@@ -4833,7 +4841,7 @@ static u16 iwl3945_get_passive_dwell_time(struct iwl3945_priv *priv,
 
 static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv,
 					 enum ieee80211_band band,
-				     u8 is_active, u8 direct_mask,
+				     u8 is_active, u8 n_probes,
 				     struct iwl3945_scan_channel *scan_ch)
 {
 	const struct ieee80211_channel *channels = NULL;
@@ -4849,7 +4857,7 @@ static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv,
 
 	channels = sband->channels;
 
-	active_dwell = iwl3945_get_active_dwell_time(priv, band);
+	active_dwell = iwl3945_get_active_dwell_time(priv, band, n_probes);
 	passive_dwell = iwl3945_get_passive_dwell_time(priv, band);
 
 	if (passive_dwell <= active_dwell)
@@ -4874,8 +4882,8 @@ static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv,
 		else
 			scan_ch->type = 1;	/* active */
 
-		if (scan_ch->type & 1)
-			scan_ch->type |= (direct_mask << 1);
+		if ((scan_ch->type & 1) && n_probes)
+			scan_ch->type |= IWL_SCAN_PROBE_MASK(n_probes);
 
 		scan_ch->active_dwell = cpu_to_le16(active_dwell);
 		scan_ch->passive_dwell = cpu_to_le16(passive_dwell);
@@ -6092,7 +6100,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
 	int rc = 0;
 	struct iwl3945_scan_cmd *scan;
 	struct ieee80211_conf *conf = NULL;
-	u8 direct_mask;
+	u8 n_probes = 2;
 	enum ieee80211_band band;
 
 	conf = ieee80211_get_hw_conf(priv->hw);
@@ -6200,7 +6208,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
 		scan->direct_scan[0].len = priv->direct_ssid_len;
 		memcpy(scan->direct_scan[0].ssid,
 		       priv->direct_ssid, priv->direct_ssid_len);
-		direct_mask = 1;
+		n_probes++;
 	} else if (!iwl3945_is_associated(priv) && priv->essid_len) {
 		IWL_DEBUG_SCAN
 		  ("Kicking off one direct scan for '%s' when not associated\n",
@@ -6208,11 +6216,9 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
 		scan->direct_scan[0].id = WLAN_EID_SSID;
 		scan->direct_scan[0].len = priv->essid_len;
 		memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len);
-		direct_mask = 1;
-	} else {
+		n_probes++;
+	} else
 		IWL_DEBUG_SCAN("Kicking off one indirect scan.\n");
-		direct_mask = 0;
-	}
 
 	/* We don't build a direct scan probe request; the uCode will do
 	 * that based on the direct_mask added to each channel entry */
@@ -6245,18 +6251,10 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
 	if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR)
 		scan->filter_flags = RXON_FILTER_PROMISC_MSK;
 
-	if (direct_mask)
-		scan->channel_count =
-			iwl3945_get_channels_for_scan(
-				priv, band, 1, /* active */
-				direct_mask,
-				(void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]);
-	else
-		scan->channel_count =
-			iwl3945_get_channels_for_scan(
-				priv, band, 0, /* passive */
-				direct_mask,
-				(void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]);
+	scan->channel_count =
+		iwl3945_get_channels_for_scan(priv, band, 1, /* active */
+					      n_probes,
+			(void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]);
 
 	cmd.len += le16_to_cpu(scan->tx_cmd.len) +
 	    scan->channel_count * sizeof(struct iwl3945_scan_channel);
-- 
1.5.3.6


  reply	other threads:[~2008-09-03  3:31 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-03  3:26 [PATCH 00/39] iwlwifi driver 09/03 updates Zhu Yi
2008-09-03  3:26 ` [PATCH 01/39] iwlwifi : Added bss_info_changed callback to 3945 Zhu Yi
2008-09-03  3:26   ` [PATCH 02/39] iwlwifi: W/A for the TSF correction in IBSS Zhu Yi
2008-09-03  3:26     ` [PATCH 03/39] iwlwifi: clean up hw scan handler Zhu Yi
2008-09-03  3:26       ` [PATCH 04/39] iwlwifi: remove obsolete 4965 forward declarations Zhu Yi
2008-09-03  3:26         ` [PATCH 05/39] iwlwifi: allow consecutive scans in unassociated state Zhu Yi
2008-09-03  3:26           ` [PATCH 06/39] iwlwifi: align set channel with mac80211 Zhu Yi
2008-09-03  3:26             ` [PATCH 07/39] iwl3945: fix unbalanced mutex Zhu Yi
2008-09-03  3:26               ` [PATCH 08/39] iwl3945: replace association and beacon hooks with bss_info_changed cb Zhu Yi
2008-09-03  3:26                 ` [PATCH 09/39] iwlwifi: fix hidden ssid discovery in passive channels Zhu Yi
2008-09-03  3:26                   ` [PATCH 10/39] iwl3945: removed bg_post_associate work Zhu Yi
2008-09-03  3:26                     ` [PATCH 11/39] iwl3945: avoid redundant iwl3945_get_active_dwell_time Zhu Yi
2008-09-03  3:26                       ` [PATCH 12/39] iwlwifi: use strict_strtoul instead of simple_strtoul Zhu Yi
2008-09-03  3:26                         ` [PATCH 13/39] iwlwifi: void full rxon on rx chain changes Zhu Yi
2008-09-03  3:26                           ` [PATCH 14/39] iwlwifi: replace readl and writel with io/read/write/32 Zhu Yi
2008-09-03  3:26                             ` [PATCH 15/39] iwlwifi: remove rfkill warning from iwl-io Zhu Yi
2008-09-03  3:26                               ` [PATCH 16/39] iwlwifi: fix apm_stop function Zhu Yi
2008-09-03  3:26                                 ` [PATCH 17/39] iwlwifi: generic init calibrations framework Zhu Yi
2008-09-03  3:26                                   ` [PATCH 18/39] iwlwifi: call apm stop on exit Zhu Yi
2008-09-03  3:26                                     ` [PATCH 19/39] iwlwifi: fix strict_strtoul error checking Zhu Yi
2008-09-03  3:26                                       ` [PATCH 20/39] iwlwifi: use station's mimo power save values Zhu Yi
2008-09-03  3:26                                         ` [PATCH 21/39] iwlwifi: fix rx_chain computation Zhu Yi
2008-09-03  3:26                                           ` [PATCH 22/39] iwlwifi: fix 64bit platform firmware loading Zhu Yi
2008-09-03  3:26                                             ` [PATCH 23/39] mac80211: change MIMO_PS to SM_PS Zhu Yi
2008-09-03  3:26                                               ` [PATCH 24/39] iwlwifi: " Zhu Yi
2008-09-03  3:26                                                 ` [PATCH 25/39] ath9k: " Zhu Yi
2008-09-03  3:26                                                   ` [PATCH 26/39] iwlwifi: remove double definition of SM PS Zhu Yi
2008-09-03  3:26                                                     ` [PATCH 27/39] iwlwifi: rename ps_mode to sm_ps Zhu Yi
2008-09-03  3:26                                                       ` [PATCH 28/39] iwlwifi: workaround interrupt handling no some platforms Zhu Yi
2008-09-03  3:26                                                         ` [PATCH 29/39] iwlwifi: cleanup PCI register handling Zhu Yi
2008-09-03  3:26                                                           ` [PATCH 30/39] iwlwifi: allow association on radar channel in power save Zhu Yi
2008-09-03  3:26                                                             ` [PATCH 31/39] iwlwifi: fix memory allocation of TX command Zhu Yi
2008-09-03  3:26                                                               ` [PATCH 32/39] iwlwifi: fix host command header according the HW spec Zhu Yi
2008-09-03  3:26                                                                 ` [PATCH 33/39] iwlwifi: use the results from disconnected antenna algorithm Zhu Yi
2008-09-03  3:26                                                                   ` [PATCH 34/39] iwlwifi: take a fresh set of supported rates at each cycle Zhu Yi
2008-09-03  3:26                                                                     ` [PATCH 35/39] iwlwifi: remove bad language from the comments Zhu Yi
2008-09-03  3:26                                                                       ` [PATCH 36/39] iwlwifi: remove uneeded declarations Zhu Yi
2008-09-03  3:26                                                                         ` [PATCH 37/39] iwlwifi: fix compile warning Zhu Yi
2008-09-03  3:26                                                                           ` Zhu Yi [this message]
2008-09-03  3:26                                                                             ` [PATCH 39/39] iwlwifi: enable packet injection for iwlagn Zhu Yi
2008-09-03 14:28                                                               ` [PATCH 31/39] iwlwifi: fix memory allocation of TX command Tomas Winkler
2008-09-05 21:14                 ` [PATCH 08/39] iwl3945: replace association and beacon hooks with bss_info_changed cb Johannes Berg
2008-09-05 22:50                   ` Kolekar, Abhijeet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1220412419-15404-39-git-send-email-yi.zhu@intel.com \
    --to=yi.zhu@intel.com \
    --cc=abhijeet.kolekar@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox