Skip to content

Commit

Permalink
iwlwifi: unify 4965 and 5000 scanning code
Browse files Browse the repository at this point in the history
This patch unifies 4965 and 5000 scanning code.

We increases the version number to 1.3.27. Since new uCode
iwlwifi-4965-2.ucode is required for 4965 cards.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Tomas Winkler authored and John W. Linville committed Jul 14, 2008
1 parent ec1a746 commit d16dc48
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 23 deletions.
10 changes: 10 additions & 0 deletions drivers/net/wireless/iwlwifi/iwl-4965.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@
static int iwl4965_send_tx_power(struct iwl_priv *priv);
static int iwl4965_hw_get_temperature(const struct iwl_priv *priv);

/* Change firmware file name, using "-" and incrementing number,
* *only* when uCode interface or architecture changes so that it
* is not compatible with earlier drivers.
* This number will also appear in << 8 position of 1st dword of uCode file */
#define IWL4965_UCODE_API "-2"


/* module parameters */
static struct iwl_mod_params iwl4965_mod_params = {
.num_of_queues = IWL49_NUM_QUEUES,
Expand Down Expand Up @@ -2454,6 +2461,9 @@ struct iwl_cfg iwl4965_agn_cfg = {
.mod_params = &iwl4965_mod_params,
};

/* Module firmware */
MODULE_FIRMWARE("iwlwifi-4965" IWL4965_UCODE_API ".ucode");

module_param_named(antenna, iwl4965_mod_params.antenna, int, 0444);
MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])");
module_param_named(disable, iwl4965_mod_params.disable, int, 0444);
Expand Down
15 changes: 9 additions & 6 deletions drivers/net/wireless/iwlwifi/iwl-commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -2099,6 +2099,9 @@ struct iwl_ct_kill_config {
*
*****************************************************************************/

#define SCAN_CHANNEL_TYPE_PASSIVE __constant_cpu_to_le32(0)
#define SCAN_CHANNEL_TYPE_ACTIVE __constant_cpu_to_le32(1)

/**
* struct iwl_scan_channel - entry in REPLY_SCAN_CMD channel table
*
Expand All @@ -2122,12 +2125,12 @@ struct iwl_scan_channel {
/*
* type is defined as:
* 0:0 1 = active, 0 = passive
* 1:4 SSID direct bit map; if a bit is set, then corresponding
* 1:20 SSID direct bit map; if a bit is set, then corresponding
* SSID IE is transmitted in probe request.
* 5:7 reserved
* 21:31 reserved
*/
u8 type;
u8 channel; /* band is selected by iwl4965_scan_cmd "flags" field */
__le32 type;
__le16 channel; /* band is selected by iwl_scan_cmd "flags" field */
u8 tx_gain; /* gain for analog radio */
u8 dsp_atten; /* gain for DSP */
__le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */
Expand All @@ -2147,9 +2150,9 @@ struct iwl_ssid_ie {
u8 ssid[32];
} __attribute__ ((packed));

#define PROBE_OPTION_MAX 0x4
#define PROBE_OPTION_MAX 0x14
#define TX_CMD_LIFE_TIME_INFINITE __constant_cpu_to_le32(0xFFFFFFFF)
#define IWL_GOOD_CRC_TH __constant_cpu_to_le16(1)
#define IWL_GOOD_CRC_TH __constant_cpu_to_le16(1)
#define IWL_MAX_SCAN_SIZE 1024

/*
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/iwlwifi/iwl-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ struct iwl_host_cmd;
struct iwl_cmd;


#define IWLWIFI_VERSION "1.2.26k"
#define IWLWIFI_VERSION "1.3.27k"
#define DRV_COPYRIGHT "Copyright(c) 2003-2008 Intel Corporation"

#define IWL_PCI_DEVICE(dev, subdev, cfg) \
Expand Down
6 changes: 0 additions & 6 deletions drivers/net/wireless/iwlwifi/iwl-dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@ extern struct iwl_cfg iwl5350_agn_cfg;
extern struct iwl_cfg iwl5100_bg_cfg;
extern struct iwl_cfg iwl5100_abg_cfg;

/* Change firmware file name, using "-" and incrementing number,
* *only* when uCode interface or architecture changes so that it
* is not compatible with earlier drivers.
* This number will also appear in << 8 position of 1st dword of uCode file */
#define IWL4965_UCODE_API "-1"

/* CT-KILL constants */
#define CT_KILL_THRESHOLD 110 /* in Celsius */

Expand Down
23 changes: 13 additions & 10 deletions drivers/net/wireless/iwlwifi/iwl-scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv,
u16 passive_dwell = 0;
u16 active_dwell = 0;
int added, i;
u16 channel;

sband = iwl_get_hw_mode(priv, band);
if (!sband)
Expand All @@ -389,24 +390,25 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv,
if (channels[i].flags & IEEE80211_CHAN_DISABLED)
continue;

scan_ch->channel =
channel =
ieee80211_frequency_to_channel(channels[i].center_freq);
scan_ch->channel = cpu_to_le16(channel);

ch_info = iwl_get_channel_info(priv, band, scan_ch->channel);
ch_info = iwl_get_channel_info(priv, band, channel);
if (!is_channel_valid(ch_info)) {
IWL_DEBUG_SCAN("Channel %d is INVALID for this band.\n",
scan_ch->channel);
channel);
continue;
}

if (!is_active || is_channel_passive(ch_info) ||
(channels[i].flags & IEEE80211_CHAN_PASSIVE_SCAN))
scan_ch->type = 0;
scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE;
else
scan_ch->type = 1;
scan_ch->type = SCAN_CHANNEL_TYPE_ACTIVE;

if (scan_ch->type & 1)
scan_ch->type |= (direct_mask << 1);
if (scan_ch->type & SCAN_CHANNEL_TYPE_ACTIVE)
scan_ch->type |= cpu_to_le32(direct_mask << 1);

scan_ch->active_dwell = cpu_to_le16(active_dwell);
scan_ch->passive_dwell = cpu_to_le16(passive_dwell);
Expand All @@ -425,9 +427,10 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv,
}

IWL_DEBUG_SCAN("Scanning %d [%s %d]\n",
scan_ch->channel,
(scan_ch->type & 1) ? "ACTIVE" : "PASSIVE",
(scan_ch->type & 1) ?
channel,
(scan_ch->type & SCAN_CHANNEL_TYPE_ACTIVE) ?
"ACTIVE" : "PASSIVE",
(scan_ch->type & SCAN_CHANNEL_TYPE_ACTIVE) ?
active_dwell : passive_dwell);

scan_ch++;
Expand Down

0 comments on commit d16dc48

Please sign in to comment.