aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl3945-base.c
diff options
context:
space:
mode:
authorSamuel Ortiz <samuel.ortiz@intel.com>2009-01-27 17:27:52 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-02-09 15:03:33 -0500
commit8ccde88a87a3dc906234b281a036fee9c7371949 (patch)
tree05bb74d5f11201e0a7c38169ecbab3509e18b686 /drivers/net/wireless/iwlwifi/iwl3945-base.c
parentd14c7c1d6aef1175625ea72938b07cee072723dc (diff)
iwl3945: Getting rid of the *39_rxon iwl_priv fields
The iwl_rxon_cmd is really just a iwl3945_rxon_cmd structure extension. So, we can use the *_rxon fields from iwl_priv instead of the 3945 specific ones (*39_rxon). We have to then be careful when submitting REPLY_RXON host commands, since the command length as to be set according to the HW. As another precaution the reserved4 and reserved5 fields are cleared before being sent to the 3945. With the *39_rxon removal, a lot of duplicated code can be removed from the 3945 code base. Signed-off-by: Samuel Ortiz <samuel.ortiz@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl3945-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c711
1 files changed, 115 insertions, 596 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 25a350810a10..6a2c8a3a3d5e 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -233,166 +233,6 @@ u8 iwl3945_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap, u8 flag
233 233
234} 234}
235 235
236/**
237 * iwl3945_set_rxon_channel - Set the phymode and channel values in staging RXON
238 * @band: 2.4 or 5 GHz band
239 * @channel: Any channel valid for the requested band
240
241 * In addition to setting the staging RXON, priv->band is also set.
242 *
243 * NOTE: Does not commit to the hardware; it sets appropriate bit fields
244 * in the staging RXON flag structure based on the band
245 */
246static int iwl3945_set_rxon_channel(struct iwl_priv *priv,
247 enum ieee80211_band band,
248 u16 channel)
249{
250 if (!iwl_get_channel_info(priv, band, channel)) {
251 IWL_DEBUG_INFO("Could not set channel to %d [%d]\n",
252 channel, band);
253 return -EINVAL;
254 }
255
256 if ((le16_to_cpu(priv->staging39_rxon.channel) == channel) &&
257 (priv->band == band))
258 return 0;
259
260 priv->staging39_rxon.channel = cpu_to_le16(channel);
261 if (band == IEEE80211_BAND_5GHZ)
262 priv->staging39_rxon.flags &= ~RXON_FLG_BAND_24G_MSK;
263 else
264 priv->staging39_rxon.flags |= RXON_FLG_BAND_24G_MSK;
265
266 priv->band = band;
267
268 IWL_DEBUG_INFO("Staging channel set to %d [%d]\n", channel, band);
269
270 return 0;
271}
272
273/**
274 * iwl3945_check_rxon_cmd - validate RXON structure is valid
275 *
276 * NOTE: This is really only useful during development and can eventually
277 * be #ifdef'd out once the driver is stable and folks aren't actively
278 * making changes
279 */
280static int iwl3945_check_rxon_cmd(struct iwl_priv *priv)
281{
282 int error = 0;
283 int counter = 1;
284 struct iwl3945_rxon_cmd *rxon = &priv->staging39_rxon;
285
286 if (rxon->flags & RXON_FLG_BAND_24G_MSK) {
287 error |= le32_to_cpu(rxon->flags &
288 (RXON_FLG_TGJ_NARROW_BAND_MSK |
289 RXON_FLG_RADAR_DETECT_MSK));
290 if (error)
291 IWL_WARN(priv, "check 24G fields %d | %d\n",
292 counter++, error);
293 } else {
294 error |= (rxon->flags & RXON_FLG_SHORT_SLOT_MSK) ?
295 0 : le32_to_cpu(RXON_FLG_SHORT_SLOT_MSK);
296 if (error)
297 IWL_WARN(priv, "check 52 fields %d | %d\n",
298 counter++, error);
299 error |= le32_to_cpu(rxon->flags & RXON_FLG_CCK_MSK);
300 if (error)
301 IWL_WARN(priv, "check 52 CCK %d | %d\n",
302 counter++, error);
303 }
304 error |= (rxon->node_addr[0] | rxon->bssid_addr[0]) & 0x1;
305 if (error)
306 IWL_WARN(priv, "check mac addr %d | %d\n", counter++, error);
307
308 /* make sure basic rates 6Mbps and 1Mbps are supported */
309 error |= (((rxon->ofdm_basic_rates & IWL_RATE_6M_MASK) == 0) &&
310 ((rxon->cck_basic_rates & IWL_RATE_1M_MASK) == 0));
311 if (error)
312 IWL_WARN(priv, "check basic rate %d | %d\n", counter++, error);
313
314 error |= (le16_to_cpu(rxon->assoc_id) > 2007);
315 if (error)
316 IWL_WARN(priv, "check assoc id %d | %d\n", counter++, error);
317
318 error |= ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK))
319 == (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK));
320 if (error)
321 IWL_WARN(priv, "check CCK and short slot %d | %d\n",
322 counter++, error);
323
324 error |= ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK))
325 == (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK));
326 if (error)
327 IWL_WARN(priv, "check CCK & auto detect %d | %d\n",
328 counter++, error);
329
330 error |= ((rxon->flags & (RXON_FLG_AUTO_DETECT_MSK |
331 RXON_FLG_TGG_PROTECT_MSK)) == RXON_FLG_TGG_PROTECT_MSK);
332 if (error)
333 IWL_WARN(priv, "check TGG and auto detect %d | %d\n",
334 counter++, error);
335
336 if ((rxon->flags & RXON_FLG_DIS_DIV_MSK))
337 error |= ((rxon->flags & (RXON_FLG_ANT_B_MSK |
338 RXON_FLG_ANT_A_MSK)) == 0);
339 if (error)
340 IWL_WARN(priv, "check antenna %d %d\n", counter++, error);
341
342 if (error)
343 IWL_WARN(priv, "Tuning to channel %d\n",
344 le16_to_cpu(rxon->channel));
345
346 if (error) {
347 IWL_ERR(priv, "Not a valid rxon_assoc_cmd field values\n");
348 return -1;
349 }
350 return 0;
351}
352
353/**
354 * iwl3945_full_rxon_required - check if full RXON (vs RXON_ASSOC) cmd is needed
355 * @priv: staging_rxon is compared to active_rxon
356 *
357 * If the RXON structure is changing enough to require a new tune,
358 * or is clearing the RXON_FILTER_ASSOC_MSK, then return 1 to indicate that
359 * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required.
360 */
361static int iwl3945_full_rxon_required(struct iwl_priv *priv)
362{
363
364 /* These items are only settable from the full RXON command */
365 if (!(iwl3945_is_associated(priv)) ||
366 compare_ether_addr(priv->staging39_rxon.bssid_addr,
367 priv->active39_rxon.bssid_addr) ||
368 compare_ether_addr(priv->staging39_rxon.node_addr,
369 priv->active39_rxon.node_addr) ||
370 compare_ether_addr(priv->staging39_rxon.wlap_bssid_addr,
371 priv->active39_rxon.wlap_bssid_addr) ||
372 (priv->staging39_rxon.dev_type != priv->active39_rxon.dev_type) ||
373 (priv->staging39_rxon.channel != priv->active39_rxon.channel) ||
374 (priv->staging39_rxon.air_propagation !=
375 priv->active39_rxon.air_propagation) ||
376 (priv->staging39_rxon.assoc_id != priv->active39_rxon.assoc_id))
377 return 1;
378
379 /* flags, filter_flags, ofdm_basic_rates, and cck_basic_rates can
380 * be updated with the RXON_ASSOC command -- however only some
381 * flag transitions are allowed using RXON_ASSOC */
382
383 /* Check if we are not switching bands */
384 if ((priv->staging39_rxon.flags & RXON_FLG_BAND_24G_MSK) !=
385 (priv->active39_rxon.flags & RXON_FLG_BAND_24G_MSK))
386 return 1;
387
388 /* Check if we are switching association toggle */
389 if ((priv->staging39_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) !=
390 (priv->active39_rxon.filter_flags & RXON_FILTER_ASSOC_MSK))
391 return 1;
392
393 return 0;
394}
395
396static int iwl3945_send_rxon_assoc(struct iwl_priv *priv) 236static int iwl3945_send_rxon_assoc(struct iwl_priv *priv)
397{ 237{
398 int rc = 0; 238 int rc = 0;
@@ -404,8 +244,8 @@ static int iwl3945_send_rxon_assoc(struct iwl_priv *priv)
404 .meta.flags = CMD_WANT_SKB, 244 .meta.flags = CMD_WANT_SKB,
405 .data = &rxon_assoc, 245 .data = &rxon_assoc,
406 }; 246 };
407 const struct iwl3945_rxon_cmd *rxon1 = &priv->staging39_rxon; 247 const struct iwl_rxon_cmd *rxon1 = &priv->staging_rxon;
408 const struct iwl3945_rxon_cmd *rxon2 = &priv->active39_rxon; 248 const struct iwl_rxon_cmd *rxon2 = &priv->active_rxon;
409 249
410 if ((rxon1->flags == rxon2->flags) && 250 if ((rxon1->flags == rxon2->flags) &&
411 (rxon1->filter_flags == rxon2->filter_flags) && 251 (rxon1->filter_flags == rxon2->filter_flags) &&
@@ -415,10 +255,10 @@ static int iwl3945_send_rxon_assoc(struct iwl_priv *priv)
415 return 0; 255 return 0;
416 } 256 }
417 257
418 rxon_assoc.flags = priv->staging39_rxon.flags; 258 rxon_assoc.flags = priv->staging_rxon.flags;
419 rxon_assoc.filter_flags = priv->staging39_rxon.filter_flags; 259 rxon_assoc.filter_flags = priv->staging_rxon.filter_flags;
420 rxon_assoc.ofdm_basic_rates = priv->staging39_rxon.ofdm_basic_rates; 260 rxon_assoc.ofdm_basic_rates = priv->staging_rxon.ofdm_basic_rates;
421 rxon_assoc.cck_basic_rates = priv->staging39_rxon.cck_basic_rates; 261 rxon_assoc.cck_basic_rates = priv->staging_rxon.cck_basic_rates;
422 rxon_assoc.reserved = 0; 262 rxon_assoc.reserved = 0;
423 263
424 rc = iwl_send_cmd_sync(priv, &cmd); 264 rc = iwl_send_cmd_sync(priv, &cmd);
@@ -485,21 +325,22 @@ __le32 iwl3945_get_antenna_flags(const struct iwl_priv *priv)
485static int iwl3945_commit_rxon(struct iwl_priv *priv) 325static int iwl3945_commit_rxon(struct iwl_priv *priv)
486{ 326{
487 /* cast away the const for active_rxon in this function */ 327 /* cast away the const for active_rxon in this function */
488 struct iwl3945_rxon_cmd *active_rxon = (void *)&priv->active39_rxon; 328 struct iwl3945_rxon_cmd *active_rxon = (void *)&priv->active_rxon;
329 struct iwl3945_rxon_cmd *staging_rxon = (void *)&priv->staging_rxon;
489 int rc = 0; 330 int rc = 0;
490 331
491 if (!iwl_is_alive(priv)) 332 if (!iwl_is_alive(priv))
492 return -1; 333 return -1;
493 334
494 /* always get timestamp with Rx frame */ 335 /* always get timestamp with Rx frame */
495 priv->staging39_rxon.flags |= RXON_FLG_TSF2HOST_MSK; 336 staging_rxon->flags |= RXON_FLG_TSF2HOST_MSK;
496 337
497 /* select antenna */ 338 /* select antenna */
498 priv->staging39_rxon.flags &= 339 staging_rxon->flags &=
499 ~(RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_SEL_MSK); 340 ~(RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_SEL_MSK);
500 priv->staging39_rxon.flags |= iwl3945_get_antenna_flags(priv); 341 staging_rxon->flags |= iwl3945_get_antenna_flags(priv);
501 342
502 rc = iwl3945_check_rxon_cmd(priv); 343 rc = iwl_check_rxon_cmd(priv);
503 if (rc) { 344 if (rc) {
504 IWL_ERR(priv, "Invalid RXON configuration. Not committing.\n"); 345 IWL_ERR(priv, "Invalid RXON configuration. Not committing.\n");
505 return -EINVAL; 346 return -EINVAL;
@@ -508,7 +349,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv)
508 /* If we don't need to send a full RXON, we can use 349 /* If we don't need to send a full RXON, we can use
509 * iwl3945_rxon_assoc_cmd which is used to reconfigure filter 350 * iwl3945_rxon_assoc_cmd which is used to reconfigure filter
510 * and other flags for the current radio configuration. */ 351 * and other flags for the current radio configuration. */
511 if (!iwl3945_full_rxon_required(priv)) { 352 if (!iwl_full_rxon_required(priv)) {
512 rc = iwl3945_send_rxon_assoc(priv); 353 rc = iwl3945_send_rxon_assoc(priv);
513 if (rc) { 354 if (rc) {
514 IWL_ERR(priv, "Error setting RXON_ASSOC " 355 IWL_ERR(priv, "Error setting RXON_ASSOC "
@@ -516,7 +357,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv)
516 return rc; 357 return rc;
517 } 358 }
518 359
519 memcpy(active_rxon, &priv->staging39_rxon, sizeof(*active_rxon)); 360 memcpy(active_rxon, staging_rxon, sizeof(*active_rxon));
520 361
521 return 0; 362 return 0;
522 } 363 }
@@ -525,14 +366,20 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv)
525 * an RXON_ASSOC and the new config wants the associated mask enabled, 366 * an RXON_ASSOC and the new config wants the associated mask enabled,
526 * we must clear the associated from the active configuration 367 * we must clear the associated from the active configuration
527 * before we apply the new config */ 368 * before we apply the new config */
528 if (iwl3945_is_associated(priv) && 369 if (iwl_is_associated(priv) &&
529 (priv->staging39_rxon.filter_flags & RXON_FILTER_ASSOC_MSK)) { 370 (staging_rxon->filter_flags & RXON_FILTER_ASSOC_MSK)) {
530 IWL_DEBUG_INFO("Toggling associated bit on current RXON\n"); 371 IWL_DEBUG_INFO("Toggling associated bit on current RXON\n");
531 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 372 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
532 373
374 /*
375 * reserved4 and 5 could have been filled by the iwlcore code.
376 * Let's clear them before pushing to the 3945.
377 */
378 active_rxon->reserved4 = 0;
379 active_rxon->reserved5 = 0;
533 rc = iwl_send_cmd_pdu(priv, REPLY_RXON, 380 rc = iwl_send_cmd_pdu(priv, REPLY_RXON,
534 sizeof(struct iwl3945_rxon_cmd), 381 sizeof(struct iwl3945_rxon_cmd),
535 &priv->active39_rxon); 382 &priv->active_rxon);
536 383
537 /* If the mask clearing failed then we set 384 /* If the mask clearing failed then we set
538 * active_rxon back to what it was previously */ 385 * active_rxon back to what it was previously */
@@ -548,20 +395,28 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv)
548 "* with%s RXON_FILTER_ASSOC_MSK\n" 395 "* with%s RXON_FILTER_ASSOC_MSK\n"
549 "* channel = %d\n" 396 "* channel = %d\n"
550 "* bssid = %pM\n", 397 "* bssid = %pM\n",
551 ((priv->staging39_rxon.filter_flags & 398 ((priv->staging_rxon.filter_flags &
552 RXON_FILTER_ASSOC_MSK) ? "" : "out"), 399 RXON_FILTER_ASSOC_MSK) ? "" : "out"),
553 le16_to_cpu(priv->staging39_rxon.channel), 400 le16_to_cpu(staging_rxon->channel),
554 priv->staging_rxon.bssid_addr); 401 staging_rxon->bssid_addr);
402
403 /*
404 * reserved4 and 5 could have been filled by the iwlcore code.
405 * Let's clear them before pushing to the 3945.
406 */
407 staging_rxon->reserved4 = 0;
408 staging_rxon->reserved5 = 0;
555 409
556 /* Apply the new configuration */ 410 /* Apply the new configuration */
557 rc = iwl_send_cmd_pdu(priv, REPLY_RXON, 411 rc = iwl_send_cmd_pdu(priv, REPLY_RXON,
558 sizeof(struct iwl3945_rxon_cmd), &priv->staging39_rxon); 412 sizeof(struct iwl3945_rxon_cmd),
413 staging_rxon);
559 if (rc) { 414 if (rc) {
560 IWL_ERR(priv, "Error setting new configuration (%d).\n", rc); 415 IWL_ERR(priv, "Error setting new configuration (%d).\n", rc);
561 return rc; 416 return rc;
562 } 417 }
563 418
564 memcpy(active_rxon, &priv->staging39_rxon, sizeof(*active_rxon)); 419 memcpy(active_rxon, staging_rxon, sizeof(*active_rxon));
565 420
566 iwl3945_clear_stations_table(priv); 421 iwl3945_clear_stations_table(priv);
567 422
@@ -582,9 +437,10 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv)
582 437
583 /* If we have set the ASSOC_MSK and we are in BSS mode then 438 /* If we have set the ASSOC_MSK and we are in BSS mode then
584 * add the IWL_AP_ID to the station rate table */ 439 * add the IWL_AP_ID to the station rate table */
585 if (iwl3945_is_associated(priv) && 440 if (iwl_is_associated(priv) &&
586 (priv->iw_mode == NL80211_IFTYPE_STATION)) 441 (priv->iw_mode == NL80211_IFTYPE_STATION))
587 if (iwl3945_add_station(priv, priv->active39_rxon.bssid_addr, 1, 0) 442 if (iwl3945_add_station(priv, priv->active_rxon.bssid_addr,
443 1, 0)
588 == IWL_INVALID_STATION) { 444 == IWL_INVALID_STATION) {
589 IWL_ERR(priv, "Error adding AP address for transmit\n"); 445 IWL_ERR(priv, "Error adding AP address for transmit\n");
590 return -EIO; 446 return -EIO;
@@ -710,7 +566,7 @@ unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv,
710 int left) 566 int left)
711{ 567{
712 568
713 if (!iwl3945_is_associated(priv) || !priv->ibss_beacon || 569 if (!iwl_is_associated(priv) || !priv->ibss_beacon ||
714 ((priv->iw_mode != NL80211_IFTYPE_ADHOC) && 570 ((priv->iw_mode != NL80211_IFTYPE_ADHOC) &&
715 (priv->iw_mode != NL80211_IFTYPE_AP))) 571 (priv->iw_mode != NL80211_IFTYPE_AP)))
716 return 0; 572 return 0;
@@ -723,30 +579,6 @@ unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv,
723 return priv->ibss_beacon->len; 579 return priv->ibss_beacon->len;
724} 580}
725 581
726static u8 iwl3945_rate_get_lowest_plcp(struct iwl_priv *priv)
727{
728 u8 i;
729 int rate_mask;
730
731 /* Set rate mask*/
732 if (priv->staging39_rxon.flags & RXON_FLG_BAND_24G_MSK)
733 rate_mask = priv->active_rate_basic & IWL_CCK_RATES_MASK;
734 else
735 rate_mask = priv->active_rate_basic & IWL_OFDM_RATES_MASK;
736
737 for (i = IWL_RATE_1M_INDEX; i != IWL_RATE_INVALID;
738 i = iwl3945_rates[i].next_ieee) {
739 if (rate_mask & (1 << i))
740 return iwl3945_rates[i].plcp;
741 }
742
743 /* No valid rate was found. Assign the lowest one */
744 if (priv->staging39_rxon.flags & RXON_FLG_BAND_24G_MSK)
745 return IWL_RATE_1M_PLCP;
746 else
747 return IWL_RATE_6M_PLCP;
748}
749
750static int iwl3945_send_beacon_cmd(struct iwl_priv *priv) 582static int iwl3945_send_beacon_cmd(struct iwl_priv *priv)
751{ 583{
752 struct iwl3945_frame *frame; 584 struct iwl3945_frame *frame;
@@ -762,7 +594,7 @@ static int iwl3945_send_beacon_cmd(struct iwl_priv *priv)
762 return -ENOMEM; 594 return -ENOMEM;
763 } 595 }
764 596
765 rate = iwl3945_rate_get_lowest_plcp(priv); 597 rate = iwl_rate_get_lowest_plcp(priv);
766 598
767 frame_size = iwl3945_hw_get_beacon_cmd(priv, frame, rate); 599 frame_size = iwl3945_hw_get_beacon_cmd(priv, frame, rate);
768 600
@@ -815,7 +647,7 @@ static void iwl3945_activate_qos(struct iwl_priv *priv, u8 force)
815 647
816 spin_unlock_irqrestore(&priv->lock, flags); 648 spin_unlock_irqrestore(&priv->lock, flags);
817 649
818 if (force || iwl3945_is_associated(priv)) { 650 if (force || iwl_is_associated(priv)) {
819 IWL_DEBUG_QOS("send QoS cmd with QoS active %d \n", 651 IWL_DEBUG_QOS("send QoS cmd with QoS active %d \n",
820 priv->qos_data.qos_active); 652 priv->qos_data.qos_active);
821 653
@@ -1082,115 +914,6 @@ static int iwl3945_scan_initiate(struct iwl_priv *priv)
1082 return 0; 914 return 0;
1083} 915}
1084 916
1085static int iwl3945_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt)
1086{
1087 struct iwl3945_rxon_cmd *rxon = &priv->staging39_rxon;
1088
1089 if (hw_decrypt)
1090 rxon->filter_flags &= ~RXON_FILTER_DIS_DECRYPT_MSK;
1091 else
1092 rxon->filter_flags |= RXON_FILTER_DIS_DECRYPT_MSK;
1093
1094 return 0;
1095}
1096
1097static void iwl3945_set_flags_for_phymode(struct iwl_priv *priv,
1098 enum ieee80211_band band)
1099{
1100 if (band == IEEE80211_BAND_5GHZ) {
1101 priv->staging39_rxon.flags &=
1102 ~(RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK
1103 | RXON_FLG_CCK_MSK);
1104 priv->staging39_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK;
1105 } else {
1106 /* Copied from iwl3945_bg_post_associate() */
1107 if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME)
1108 priv->staging39_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK;
1109 else
1110 priv->staging39_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
1111
1112 if (priv->iw_mode == NL80211_IFTYPE_ADHOC)
1113 priv->staging39_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
1114
1115 priv->staging39_rxon.flags |= RXON_FLG_BAND_24G_MSK;
1116 priv->staging39_rxon.flags |= RXON_FLG_AUTO_DETECT_MSK;
1117 priv->staging39_rxon.flags &= ~RXON_FLG_CCK_MSK;
1118 }
1119}
1120
1121/*
1122 * initialize rxon structure with default values from eeprom
1123 */
1124static void iwl3945_connection_init_rx_config(struct iwl_priv *priv,
1125 int mode)
1126{
1127 const struct iwl_channel_info *ch_info;
1128
1129 memset(&priv->staging39_rxon, 0, sizeof(priv->staging39_rxon));
1130
1131 switch (mode) {
1132 case NL80211_IFTYPE_AP:
1133 priv->staging39_rxon.dev_type = RXON_DEV_TYPE_AP;
1134 break;
1135
1136 case NL80211_IFTYPE_STATION:
1137 priv->staging39_rxon.dev_type = RXON_DEV_TYPE_ESS;
1138 priv->staging39_rxon.filter_flags = RXON_FILTER_ACCEPT_GRP_MSK;
1139 break;
1140
1141 case NL80211_IFTYPE_ADHOC:
1142 priv->staging39_rxon.dev_type = RXON_DEV_TYPE_IBSS;
1143 priv->staging39_rxon.flags = RXON_FLG_SHORT_PREAMBLE_MSK;
1144 priv->staging39_rxon.filter_flags = RXON_FILTER_BCON_AWARE_MSK |
1145 RXON_FILTER_ACCEPT_GRP_MSK;
1146 break;
1147
1148 case NL80211_IFTYPE_MONITOR:
1149 priv->staging39_rxon.dev_type = RXON_DEV_TYPE_SNIFFER;
1150 priv->staging39_rxon.filter_flags = RXON_FILTER_PROMISC_MSK |
1151 RXON_FILTER_CTL2HOST_MSK | RXON_FILTER_ACCEPT_GRP_MSK;
1152 break;
1153 default:
1154 IWL_ERR(priv, "Unsupported interface type %d\n", mode);
1155 break;
1156 }
1157
1158#if 0
1159 /* TODO: Figure out when short_preamble would be set and cache from
1160 * that */
1161 if (!hw_to_local(priv->hw)->short_preamble)
1162 priv->staging39_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK;
1163 else
1164 priv->staging39_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
1165#endif
1166
1167 ch_info = iwl_get_channel_info(priv, priv->band,
1168 le16_to_cpu(priv->active39_rxon.channel));
1169
1170 if (!ch_info)
1171 ch_info = &priv->channel_info[0];
1172
1173 /*
1174 * in some case A channels are all non IBSS
1175 * in this case force B/G channel
1176 */
1177 if ((mode == NL80211_IFTYPE_ADHOC) && !(is_channel_ibss(ch_info)))
1178 ch_info = &priv->channel_info[0];
1179
1180 priv->staging39_rxon.channel = cpu_to_le16(ch_info->channel);
1181 if (is_channel_a_band(ch_info))
1182 priv->band = IEEE80211_BAND_5GHZ;
1183 else
1184 priv->band = IEEE80211_BAND_2GHZ;
1185
1186 iwl3945_set_flags_for_phymode(priv, priv->band);
1187
1188 priv->staging39_rxon.ofdm_basic_rates =
1189 (IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF;
1190 priv->staging39_rxon.cck_basic_rates =
1191 (IWL_CCK_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF;
1192}
1193
1194static int iwl3945_set_mode(struct iwl_priv *priv, int mode) 917static int iwl3945_set_mode(struct iwl_priv *priv, int mode)
1195{ 918{
1196 if (mode == NL80211_IFTYPE_ADHOC) { 919 if (mode == NL80211_IFTYPE_ADHOC) {
@@ -1198,17 +921,16 @@ static int iwl3945_set_mode(struct iwl_priv *priv, int mode)
1198 921
1199 ch_info = iwl_get_channel_info(priv, 922 ch_info = iwl_get_channel_info(priv,
1200 priv->band, 923 priv->band,
1201 le16_to_cpu(priv->staging39_rxon.channel)); 924 le16_to_cpu(priv->staging_rxon.channel));
1202 925
1203 if (!ch_info || !is_channel_ibss(ch_info)) { 926 if (!ch_info || !is_channel_ibss(ch_info)) {
1204 IWL_ERR(priv, "channel %d not IBSS channel\n", 927 IWL_ERR(priv, "channel %d not IBSS channel\n",
1205 le16_to_cpu(priv->staging39_rxon.channel)); 928 le16_to_cpu(priv->staging_rxon.channel));
1206 return -EINVAL; 929 return -EINVAL;
1207 } 930 }
1208 } 931 }
1209 932
1210 iwl3945_connection_init_rx_config(priv, mode); 933 iwl_connection_init_rx_config(priv, mode);
1211 memcpy(priv->staging39_rxon.node_addr, priv->mac_addr, ETH_ALEN);
1212 934
1213 iwl3945_clear_stations_table(priv); 935 iwl3945_clear_stations_table(priv);
1214 936
@@ -1455,9 +1177,9 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
1455 /* drop all data frame if we are not associated */ 1177 /* drop all data frame if we are not associated */
1456 if (ieee80211_is_data(fc) && 1178 if (ieee80211_is_data(fc) &&
1457 (priv->iw_mode != NL80211_IFTYPE_MONITOR) && /* packet injection */ 1179 (priv->iw_mode != NL80211_IFTYPE_MONITOR) && /* packet injection */
1458 (!iwl3945_is_associated(priv) || 1180 (!iwl_is_associated(priv) ||
1459 ((priv->iw_mode == NL80211_IFTYPE_STATION) && !priv->assoc_id))) { 1181 ((priv->iw_mode == NL80211_IFTYPE_STATION) && !priv->assoc_id))) {
1460 IWL_DEBUG_DROP("Dropping - !iwl3945_is_associated\n"); 1182 IWL_DEBUG_DROP("Dropping - !iwl_is_associated\n");
1461 goto drop_unlock; 1183 goto drop_unlock;
1462 } 1184 }
1463 1185
@@ -1622,60 +1344,6 @@ drop:
1622 return -1; 1344 return -1;
1623} 1345}
1624 1346
1625static void iwl3945_set_rate(struct iwl_priv *priv)
1626{
1627 const struct ieee80211_supported_band *sband = NULL;
1628 struct ieee80211_rate *rate;
1629 int i;
1630
1631 sband = iwl_get_hw_mode(priv, priv->band);
1632 if (!sband) {
1633 IWL_ERR(priv, "Failed to set rate: unable to get hw mode\n");
1634 return;
1635 }
1636
1637 priv->active_rate = 0;
1638 priv->active_rate_basic = 0;
1639
1640 IWL_DEBUG_RATE("Setting rates for %s GHz\n",
1641 sband->band == IEEE80211_BAND_2GHZ ? "2.4" : "5");
1642
1643 for (i = 0; i < sband->n_bitrates; i++) {
1644 rate = &sband->bitrates[i];
1645 if ((rate->hw_value < IWL_RATE_COUNT) &&
1646 !(rate->flags & IEEE80211_CHAN_DISABLED)) {
1647 IWL_DEBUG_RATE("Adding rate index %d (plcp %d)\n",
1648 rate->hw_value, iwl3945_rates[rate->hw_value].plcp);
1649 priv->active_rate |= (1 << rate->hw_value);
1650 }
1651 }
1652
1653 IWL_DEBUG_RATE("Set active_rate = %0x, active_rate_basic = %0x\n",
1654 priv->active_rate, priv->active_rate_basic);
1655
1656 /*
1657 * If a basic rate is configured, then use it (adding IWL_RATE_1M_MASK)
1658 * otherwise set it to the default of all CCK rates and 6, 12, 24 for
1659 * OFDM
1660 */
1661 if (priv->active_rate_basic & IWL_CCK_BASIC_RATES_MASK)
1662 priv->staging39_rxon.cck_basic_rates =
1663 ((priv->active_rate_basic &
1664 IWL_CCK_RATES_MASK) >> IWL_FIRST_CCK_RATE) & 0xF;
1665 else
1666 priv->staging39_rxon.cck_basic_rates =
1667 (IWL_CCK_BASIC_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF;
1668
1669 if (priv->active_rate_basic & IWL_OFDM_BASIC_RATES_MASK)
1670 priv->staging39_rxon.ofdm_basic_rates =
1671 ((priv->active_rate_basic &
1672 (IWL_OFDM_BASIC_RATES_MASK | IWL_RATE_6M_MASK)) >>
1673 IWL_FIRST_OFDM_RATE) & 0xFF;
1674 else
1675 priv->staging39_rxon.ofdm_basic_rates =
1676 (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF;
1677}
1678
1679static void iwl3945_radio_kill_sw(struct iwl_priv *priv, int disable_radio) 1347static void iwl3945_radio_kill_sw(struct iwl_priv *priv, int disable_radio)
1680{ 1348{
1681 unsigned long flags; 1349 unsigned long flags;
@@ -1726,38 +1394,6 @@ static void iwl3945_radio_kill_sw(struct iwl_priv *priv, int disable_radio)
1726 return; 1394 return;
1727} 1395}
1728 1396
1729void iwl3945_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb,
1730 u32 decrypt_res, struct ieee80211_rx_status *stats)
1731{
1732 u16 fc =
1733 le16_to_cpu(((struct ieee80211_hdr *)skb->data)->frame_control);
1734
1735 if (priv->active39_rxon.filter_flags & RXON_FILTER_DIS_DECRYPT_MSK)
1736 return;
1737
1738 if (!(fc & IEEE80211_FCTL_PROTECTED))
1739 return;
1740
1741 IWL_DEBUG_RX("decrypt_res:0x%x\n", decrypt_res);
1742 switch (decrypt_res & RX_RES_STATUS_SEC_TYPE_MSK) {
1743 case RX_RES_STATUS_SEC_TYPE_TKIP:
1744 if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) ==
1745 RX_RES_STATUS_BAD_ICV_MIC)
1746 stats->flag |= RX_FLAG_MMIC_ERROR;
1747 case RX_RES_STATUS_SEC_TYPE_WEP:
1748 case RX_RES_STATUS_SEC_TYPE_CCMP:
1749 if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) ==
1750 RX_RES_STATUS_DECRYPT_OK) {
1751 IWL_DEBUG_RX("hw decrypt successfully!!!\n");
1752 stats->flag |= RX_FLAG_DECRYPTED;
1753 }
1754 break;
1755
1756 default:
1757 break;
1758 }
1759}
1760
1761#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT 1397#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT
1762 1398
1763#include "iwl-spectrum.h" 1399#include "iwl-spectrum.h"
@@ -1827,7 +1463,7 @@ static int iwl3945_get_measurement(struct iwl_priv *priv,
1827 int spectrum_resp_status; 1463 int spectrum_resp_status;
1828 int duration = le16_to_cpu(params->duration); 1464 int duration = le16_to_cpu(params->duration);
1829 1465
1830 if (iwl3945_is_associated(priv)) 1466 if (iwl_is_associated(priv))
1831 add_time = 1467 add_time =
1832 iwl3945_usecs_to_beacons( 1468 iwl3945_usecs_to_beacons(
1833 le64_to_cpu(params->start_time) - priv->last_tsf, 1469 le64_to_cpu(params->start_time) - priv->last_tsf,
@@ -1842,7 +1478,7 @@ static int iwl3945_get_measurement(struct iwl_priv *priv,
1842 cmd.len = sizeof(spectrum); 1478 cmd.len = sizeof(spectrum);
1843 spectrum.len = cpu_to_le16(cmd.len - sizeof(spectrum.len)); 1479 spectrum.len = cpu_to_le16(cmd.len - sizeof(spectrum.len));
1844 1480
1845 if (iwl3945_is_associated(priv)) 1481 if (iwl_is_associated(priv))
1846 spectrum.start_time = 1482 spectrum.start_time =
1847 iwl3945_add_beacon_time(priv->last_beacon_time, 1483 iwl3945_add_beacon_time(priv->last_beacon_time,
1848 add_time, 1484 add_time,
@@ -1853,7 +1489,7 @@ static int iwl3945_get_measurement(struct iwl_priv *priv,
1853 spectrum.channels[0].duration = cpu_to_le32(duration * TIME_UNIT); 1489 spectrum.channels[0].duration = cpu_to_le32(duration * TIME_UNIT);
1854 spectrum.channels[0].channel = params->channel; 1490 spectrum.channels[0].channel = params->channel;
1855 spectrum.channels[0].type = type; 1491 spectrum.channels[0].type = type;
1856 if (priv->active39_rxon.flags & RXON_FLG_BAND_24G_MSK) 1492 if (priv->active_rxon.flags & RXON_FLG_BAND_24G_MSK)
1857 spectrum.flags |= RXON_FLG_BAND_24G_MSK | 1493 spectrum.flags |= RXON_FLG_BAND_24G_MSK |
1858 RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK; 1494 RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK;
1859 1495
@@ -1951,19 +1587,6 @@ static void iwl3945_rx_reply_error(struct iwl_priv *priv,
1951 le32_to_cpu(pkt->u.err_resp.error_info)); 1587 le32_to_cpu(pkt->u.err_resp.error_info));
1952} 1588}
1953 1589
1954#define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x
1955
1956static void iwl3945_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
1957{
1958 struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
1959 struct iwl3945_rxon_cmd *rxon = (void *)&priv->active39_rxon;
1960 struct iwl_csa_notification *csa = &(pkt->u.csa_notif);
1961 IWL_DEBUG_11H("CSA notif: channel %d, status %d\n",
1962 le16_to_cpu(csa->channel), le32_to_cpu(csa->status));
1963 rxon->channel = csa->channel;
1964 priv->staging39_rxon.channel = csa->channel;
1965}
1966
1967static void iwl3945_rx_spectrum_measure_notif(struct iwl_priv *priv, 1590static void iwl3945_rx_spectrum_measure_notif(struct iwl_priv *priv,
1968 struct iwl_rx_mem_buffer *rxb) 1591 struct iwl_rx_mem_buffer *rxb)
1969{ 1592{
@@ -2224,7 +1847,7 @@ static void iwl3945_setup_rx_handlers(struct iwl_priv *priv)
2224 priv->rx_handlers[REPLY_ALIVE] = iwl3945_rx_reply_alive; 1847 priv->rx_handlers[REPLY_ALIVE] = iwl3945_rx_reply_alive;
2225 priv->rx_handlers[REPLY_ADD_STA] = iwl3945_rx_reply_add_sta; 1848 priv->rx_handlers[REPLY_ADD_STA] = iwl3945_rx_reply_add_sta;
2226 priv->rx_handlers[REPLY_ERROR] = iwl3945_rx_reply_error; 1849 priv->rx_handlers[REPLY_ERROR] = iwl3945_rx_reply_error;
2227 priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = iwl3945_rx_csa; 1850 priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = iwl_rx_csa;
2228 priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] = 1851 priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] =
2229 iwl3945_rx_spectrum_measure_notif; 1852 iwl3945_rx_spectrum_measure_notif;
2230 priv->rx_handlers[PM_SLEEP_NOTIFICATION] = iwl3945_rx_pm_sleep_notif; 1853 priv->rx_handlers[PM_SLEEP_NOTIFICATION] = iwl3945_rx_pm_sleep_notif;
@@ -2728,26 +2351,6 @@ static void iwl3945_rx_handle(struct iwl_priv *priv)
2728 iwl3945_rx_queue_restock(priv); 2351 iwl3945_rx_queue_restock(priv);
2729} 2352}
2730 2353
2731#ifdef CONFIG_IWLWIFI_DEBUG
2732static void iwl3945_print_rx_config_cmd(struct iwl_priv *priv,
2733 struct iwl3945_rxon_cmd *rxon)
2734{
2735 IWL_DEBUG_RADIO("RX CONFIG:\n");
2736 iwl_print_hex_dump(priv, IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon));
2737 IWL_DEBUG_RADIO("u16 channel: 0x%x\n", le16_to_cpu(rxon->channel));
2738 IWL_DEBUG_RADIO("u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags));
2739 IWL_DEBUG_RADIO("u32 filter_flags: 0x%08x\n",
2740 le32_to_cpu(rxon->filter_flags));
2741 IWL_DEBUG_RADIO("u8 dev_type: 0x%x\n", rxon->dev_type);
2742 IWL_DEBUG_RADIO("u8 ofdm_basic_rates: 0x%02x\n",
2743 rxon->ofdm_basic_rates);
2744 IWL_DEBUG_RADIO("u8 cck_basic_rates: 0x%02x\n", rxon->cck_basic_rates);
2745 IWL_DEBUG_RADIO("u8[6] node_addr: %pM\n", rxon->node_addr);
2746 IWL_DEBUG_RADIO("u8[6] bssid_addr: %pM\n", rxon->bssid_addr);
2747 IWL_DEBUG_RADIO("u16 assoc_id: 0x%x\n", le16_to_cpu(rxon->assoc_id));
2748}
2749#endif
2750
2751static void iwl3945_enable_interrupts(struct iwl_priv *priv) 2354static void iwl3945_enable_interrupts(struct iwl_priv *priv)
2752{ 2355{
2753 IWL_DEBUG_ISR("Enabling interrupts\n"); 2356 IWL_DEBUG_ISR("Enabling interrupts\n");
@@ -2957,58 +2560,19 @@ static void iwl3945_dump_nic_event_log(struct iwl_priv *priv)
2957 iwl_release_nic_access(priv); 2560 iwl_release_nic_access(priv);
2958} 2561}
2959 2562
2960/**
2961 * iwl3945_irq_handle_error - called for HW or SW error interrupt from card
2962 */
2963static void iwl3945_irq_handle_error(struct iwl_priv *priv)
2964{
2965 /* Set the FW error flag -- cleared on iwl3945_down */
2966 set_bit(STATUS_FW_ERROR, &priv->status);
2967
2968 /* Cancel currently queued command. */
2969 clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
2970
2971#ifdef CONFIG_IWLWIFI_DEBUG
2972 if (priv->debug_level & IWL_DL_FW_ERRORS) {
2973 iwl3945_dump_nic_error_log(priv);
2974 iwl3945_dump_nic_event_log(priv);
2975 iwl3945_print_rx_config_cmd(priv, &priv->staging39_rxon);
2976 }
2977#endif
2978
2979 wake_up_interruptible(&priv->wait_command_queue);
2980
2981 /* Keep the restart process from trying to send host
2982 * commands by clearing the INIT status bit */
2983 clear_bit(STATUS_READY, &priv->status);
2984
2985 if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) {
2986 IWL_DEBUG(IWL_DL_INFO | IWL_DL_FW_ERRORS,
2987 "Restarting adapter due to uCode error.\n");
2988
2989 if (iwl3945_is_associated(priv)) {
2990 memcpy(&priv->recovery39_rxon, &priv->active39_rxon,
2991 sizeof(priv->recovery39_rxon));
2992 priv->error_recovering = 1;
2993 }
2994 if (priv->cfg->mod_params->restart_fw)
2995 queue_work(priv->workqueue, &priv->restart);
2996 }
2997}
2998
2999static void iwl3945_error_recovery(struct iwl_priv *priv) 2563static void iwl3945_error_recovery(struct iwl_priv *priv)
3000{ 2564{
3001 unsigned long flags; 2565 unsigned long flags;
3002 2566
3003 memcpy(&priv->staging39_rxon, &priv->recovery39_rxon, 2567 memcpy(&priv->staging_rxon, &priv->recovery_rxon,
3004 sizeof(priv->staging39_rxon)); 2568 sizeof(priv->staging_rxon));
3005 priv->staging39_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 2569 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
3006 iwl3945_commit_rxon(priv); 2570 iwl3945_commit_rxon(priv);
3007 2571
3008 iwl3945_add_station(priv, priv->bssid, 1, 0); 2572 iwl3945_add_station(priv, priv->bssid, 1, 0);
3009 2573
3010 spin_lock_irqsave(&priv->lock, flags); 2574 spin_lock_irqsave(&priv->lock, flags);
3011 priv->assoc_id = le16_to_cpu(priv->staging39_rxon.assoc_id); 2575 priv->assoc_id = le16_to_cpu(priv->staging_rxon.assoc_id);
3012 priv->error_recovering = 0; 2576 priv->error_recovering = 0;
3013 spin_unlock_irqrestore(&priv->lock, flags); 2577 spin_unlock_irqrestore(&priv->lock, flags);
3014} 2578}
@@ -3061,7 +2625,7 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv)
3061 /* Tell the device to stop sending interrupts */ 2625 /* Tell the device to stop sending interrupts */
3062 iwl3945_disable_interrupts(priv); 2626 iwl3945_disable_interrupts(priv);
3063 2627
3064 iwl3945_irq_handle_error(priv); 2628 iwl_irq_handle_error(priv);
3065 2629
3066 handled |= CSR_INT_BIT_HW_ERR; 2630 handled |= CSR_INT_BIT_HW_ERR;
3067 2631
@@ -3089,7 +2653,7 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv)
3089 if (inta & CSR_INT_BIT_SW_ERR) { 2653 if (inta & CSR_INT_BIT_SW_ERR) {
3090 IWL_ERR(priv, "Microcode SW error detected. " 2654 IWL_ERR(priv, "Microcode SW error detected. "
3091 "Restarting 0x%X.\n", inta); 2655 "Restarting 0x%X.\n", inta);
3092 iwl3945_irq_handle_error(priv); 2656 iwl_irq_handle_error(priv);
3093 handled |= CSR_INT_BIT_SW_ERR; 2657 handled |= CSR_INT_BIT_SW_ERR;
3094 } 2658 }
3095 2659
@@ -3893,17 +3457,16 @@ static void iwl3945_alive_start(struct iwl_priv *priv)
3893 3457
3894 iwl3945_send_power_mode(priv, IWL_POWER_LEVEL(priv->power_mode)); 3458 iwl3945_send_power_mode(priv, IWL_POWER_LEVEL(priv->power_mode));
3895 3459
3896 if (iwl3945_is_associated(priv)) { 3460 if (iwl_is_associated(priv)) {
3897 struct iwl3945_rxon_cmd *active_rxon = 3461 struct iwl3945_rxon_cmd *active_rxon =
3898 (struct iwl3945_rxon_cmd *)(&priv->active39_rxon); 3462 (struct iwl3945_rxon_cmd *)(&priv->active_rxon);
3899 3463
3900 memcpy(&priv->staging39_rxon, &priv->active39_rxon, 3464 memcpy(&priv->staging_rxon, &priv->active_rxon,
3901 sizeof(priv->staging39_rxon)); 3465 sizeof(priv->staging_rxon));
3902 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 3466 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
3903 } else { 3467 } else {
3904 /* Initialize our rx_config data */ 3468 /* Initialize our rx_config data */
3905 iwl3945_connection_init_rx_config(priv, priv->iw_mode); 3469 iwl_connection_init_rx_config(priv, priv->iw_mode);
3906 memcpy(priv->staging39_rxon.node_addr, priv->mac_addr, ETH_ALEN);
3907 } 3470 }
3908 3471
3909 /* Configure Bluetooth device coexistence support */ 3472 /* Configure Bluetooth device coexistence support */
@@ -4278,7 +3841,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
4278 scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH; 3841 scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH;
4279 scan->quiet_time = IWL_ACTIVE_QUIET_TIME; 3842 scan->quiet_time = IWL_ACTIVE_QUIET_TIME;
4280 3843
4281 if (iwl3945_is_associated(priv)) { 3844 if (iwl_is_associated(priv)) {
4282 u16 interval = 0; 3845 u16 interval = 0;
4283 u32 extra; 3846 u32 extra;
4284 u32 suspend_time = 100; 3847 u32 suspend_time = 100;
@@ -4449,7 +4012,7 @@ static void iwl3945_post_associate(struct iwl_priv *priv)
4449 4012
4450 4013
4451 IWL_DEBUG_ASSOC("Associated as %d to: %pM\n", 4014 IWL_DEBUG_ASSOC("Associated as %d to: %pM\n",
4452 priv->assoc_id, priv->active39_rxon.bssid_addr); 4015 priv->assoc_id, priv->active_rxon.bssid_addr);
4453 4016
4454 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 4017 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
4455 return; 4018 return;
@@ -4461,7 +4024,7 @@ static void iwl3945_post_associate(struct iwl_priv *priv)
4461 4024
4462 conf = ieee80211_get_hw_conf(priv->hw); 4025 conf = ieee80211_get_hw_conf(priv->hw);
4463 4026
4464 priv->staging39_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 4027 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
4465 iwl3945_commit_rxon(priv); 4028 iwl3945_commit_rxon(priv);
4466 4029
4467 memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); 4030 memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd));
@@ -4472,26 +4035,26 @@ static void iwl3945_post_associate(struct iwl_priv *priv)
4472 IWL_WARN(priv, "REPLY_RXON_TIMING failed - " 4035 IWL_WARN(priv, "REPLY_RXON_TIMING failed - "
4473 "Attempting to continue.\n"); 4036 "Attempting to continue.\n");
4474 4037
4475 priv->staging39_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; 4038 priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK;
4476 4039
4477 priv->staging39_rxon.assoc_id = cpu_to_le16(priv->assoc_id); 4040 priv->staging_rxon.assoc_id = cpu_to_le16(priv->assoc_id);
4478 4041
4479 IWL_DEBUG_ASSOC("assoc id %d beacon interval %d\n", 4042 IWL_DEBUG_ASSOC("assoc id %d beacon interval %d\n",
4480 priv->assoc_id, priv->beacon_int); 4043 priv->assoc_id, priv->beacon_int);
4481 4044
4482 if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_PREAMBLE) 4045 if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
4483 priv->staging39_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; 4046 priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
4484 else 4047 else
4485 priv->staging39_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; 4048 priv->staging_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK;
4486 4049
4487 if (priv->staging39_rxon.flags & RXON_FLG_BAND_24G_MSK) { 4050 if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) {
4488 if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME) 4051 if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME)
4489 priv->staging39_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK; 4052 priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK;
4490 else 4053 else
4491 priv->staging39_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; 4054 priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
4492 4055
4493 if (priv->iw_mode == NL80211_IFTYPE_ADHOC) 4056 if (priv->iw_mode == NL80211_IFTYPE_ADHOC)
4494 priv->staging39_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK; 4057 priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
4495 4058
4496 } 4059 }
4497 4060
@@ -4547,7 +4110,7 @@ static int iwl3945_mac_start(struct ieee80211_hw *hw)
4547 /* we should be verifying the device is ready to be opened */ 4110 /* we should be verifying the device is ready to be opened */
4548 mutex_lock(&priv->mutex); 4111 mutex_lock(&priv->mutex);
4549 4112
4550 memset(&priv->staging39_rxon, 0, sizeof(struct iwl3945_rxon_cmd)); 4113 memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon));
4551 /* fetch ucode file from disk, alloc and copy to bus-master buffers ... 4114 /* fetch ucode file from disk, alloc and copy to bus-master buffers ...
4552 * ucode filename and max sizes are card-specific. */ 4115 * ucode filename and max sizes are card-specific. */
4553 4116
@@ -4732,14 +4295,14 @@ static int iwl3945_mac_config(struct ieee80211_hw *hw, u32 changed)
4732 goto out; 4295 goto out;
4733 } 4296 }
4734 4297
4735 iwl3945_set_rxon_channel(priv, conf->channel->band, conf->channel->hw_value); 4298 iwl_set_rxon_channel(priv, conf->channel);
4736 4299
4737 iwl3945_set_flags_for_phymode(priv, conf->channel->band); 4300 iwl_set_flags_for_band(priv, conf->channel->band);
4738 4301
4739 /* The list of supported rates and rate mask can be different 4302 /* The list of supported rates and rate mask can be different
4740 * for each phymode; since the phymode may have changed, reset 4303 * for each phymode; since the phymode may have changed, reset
4741 * the rate mask to what mac80211 lists */ 4304 * the rate mask to what mac80211 lists */
4742 iwl3945_set_rate(priv); 4305 iwl_set_rate(priv);
4743 4306
4744 spin_unlock_irqrestore(&priv->lock, flags); 4307 spin_unlock_irqrestore(&priv->lock, flags);
4745 4308
@@ -4763,10 +4326,10 @@ static int iwl3945_mac_config(struct ieee80211_hw *hw, u32 changed)
4763 goto out; 4326 goto out;
4764 } 4327 }
4765 4328
4766 iwl3945_set_rate(priv); 4329 iwl_set_rate(priv);
4767 4330
4768 if (memcmp(&priv->active39_rxon, 4331 if (memcmp(&priv->active_rxon,
4769 &priv->staging39_rxon, sizeof(priv->staging39_rxon))) 4332 &priv->staging_rxon, sizeof(priv->staging_rxon)))
4770 iwl3945_commit_rxon(priv); 4333 iwl3945_commit_rxon(priv);
4771 else 4334 else
4772 IWL_DEBUG_INFO("No re-sending same RXON configuration.\n"); 4335 IWL_DEBUG_INFO("No re-sending same RXON configuration.\n");
@@ -4787,10 +4350,10 @@ static void iwl3945_config_ap(struct iwl_priv *priv)
4787 return; 4350 return;
4788 4351
4789 /* The following should be done only at AP bring up */ 4352 /* The following should be done only at AP bring up */
4790 if (!(iwl3945_is_associated(priv))) { 4353 if (!(iwl_is_associated(priv))) {
4791 4354
4792 /* RXON - unassoc (to set timing command) */ 4355 /* RXON - unassoc (to set timing command) */
4793 priv->staging39_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 4356 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
4794 iwl3945_commit_rxon(priv); 4357 iwl3945_commit_rxon(priv);
4795 4358
4796 /* RXON Timing */ 4359 /* RXON Timing */
@@ -4804,29 +4367,29 @@ static void iwl3945_config_ap(struct iwl_priv *priv)
4804 "Attempting to continue.\n"); 4367 "Attempting to continue.\n");
4805 4368
4806 /* FIXME: what should be the assoc_id for AP? */ 4369 /* FIXME: what should be the assoc_id for AP? */
4807 priv->staging39_rxon.assoc_id = cpu_to_le16(priv->assoc_id); 4370 priv->staging_rxon.assoc_id = cpu_to_le16(priv->assoc_id);
4808 if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_PREAMBLE) 4371 if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
4809 priv->staging39_rxon.flags |= 4372 priv->staging_rxon.flags |=
4810 RXON_FLG_SHORT_PREAMBLE_MSK; 4373 RXON_FLG_SHORT_PREAMBLE_MSK;
4811 else 4374 else
4812 priv->staging39_rxon.flags &= 4375 priv->staging_rxon.flags &=
4813 ~RXON_FLG_SHORT_PREAMBLE_MSK; 4376 ~RXON_FLG_SHORT_PREAMBLE_MSK;
4814 4377
4815 if (priv->staging39_rxon.flags & RXON_FLG_BAND_24G_MSK) { 4378 if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) {
4816 if (priv->assoc_capability & 4379 if (priv->assoc_capability &
4817 WLAN_CAPABILITY_SHORT_SLOT_TIME) 4380 WLAN_CAPABILITY_SHORT_SLOT_TIME)
4818 priv->staging39_rxon.flags |= 4381 priv->staging_rxon.flags |=
4819 RXON_FLG_SHORT_SLOT_MSK; 4382 RXON_FLG_SHORT_SLOT_MSK;
4820 else 4383 else
4821 priv->staging39_rxon.flags &= 4384 priv->staging_rxon.flags &=
4822 ~RXON_FLG_SHORT_SLOT_MSK; 4385 ~RXON_FLG_SHORT_SLOT_MSK;
4823 4386
4824 if (priv->iw_mode == NL80211_IFTYPE_ADHOC) 4387 if (priv->iw_mode == NL80211_IFTYPE_ADHOC)
4825 priv->staging39_rxon.flags &= 4388 priv->staging_rxon.flags &=
4826 ~RXON_FLG_SHORT_SLOT_MSK; 4389 ~RXON_FLG_SHORT_SLOT_MSK;
4827 } 4390 }
4828 /* restore RXON assoc */ 4391 /* restore RXON assoc */
4829 priv->staging39_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; 4392 priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK;
4830 iwl3945_commit_rxon(priv); 4393 iwl3945_commit_rxon(priv);
4831 iwl3945_add_station(priv, iwl_bcast_addr, 0, 0); 4394 iwl3945_add_station(priv, iwl_bcast_addr, 0, 0);
4832 } 4395 }
@@ -4907,7 +4470,7 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw,
4907 mutex_unlock(&priv->mutex); 4470 mutex_unlock(&priv->mutex);
4908 return -EAGAIN; 4471 return -EAGAIN;
4909 } 4472 }
4910 memcpy(priv->staging39_rxon.bssid_addr, conf->bssid, ETH_ALEN); 4473 memcpy(priv->staging_rxon.bssid_addr, conf->bssid, ETH_ALEN);
4911 4474
4912 /* TODO: Audit driver for usage of these members and see 4475 /* TODO: Audit driver for usage of these members and see
4913 * if mac80211 deprecates them (priv->bssid looks like it 4476 * if mac80211 deprecates them (priv->bssid looks like it
@@ -4921,12 +4484,12 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw,
4921 rc = iwl3945_commit_rxon(priv); 4484 rc = iwl3945_commit_rxon(priv);
4922 if ((priv->iw_mode == NL80211_IFTYPE_STATION) && rc) 4485 if ((priv->iw_mode == NL80211_IFTYPE_STATION) && rc)
4923 iwl3945_add_station(priv, 4486 iwl3945_add_station(priv,
4924 priv->active39_rxon.bssid_addr, 1, 0); 4487 priv->active_rxon.bssid_addr, 1, 0);
4925 } 4488 }
4926 4489
4927 } else { 4490 } else {
4928 iwl_scan_cancel_timeout(priv, 100); 4491 iwl_scan_cancel_timeout(priv, 100);
4929 priv->staging39_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 4492 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
4930 iwl3945_commit_rxon(priv); 4493 iwl3945_commit_rxon(priv);
4931 } 4494 }
4932 4495
@@ -4937,52 +4500,6 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw,
4937 return 0; 4500 return 0;
4938} 4501}
4939 4502
4940static void iwl3945_configure_filter(struct ieee80211_hw *hw,
4941 unsigned int changed_flags,
4942 unsigned int *total_flags,
4943 int mc_count, struct dev_addr_list *mc_list)
4944{
4945 struct iwl_priv *priv = hw->priv;
4946 __le32 *filter_flags = &priv->staging39_rxon.filter_flags;
4947
4948 IWL_DEBUG_MAC80211("Enter: changed: 0x%x, total: 0x%x\n",
4949 changed_flags, *total_flags);
4950
4951 if (changed_flags & (FIF_OTHER_BSS | FIF_PROMISC_IN_BSS)) {
4952 if (*total_flags & (FIF_OTHER_BSS | FIF_PROMISC_IN_BSS))
4953 *filter_flags |= RXON_FILTER_PROMISC_MSK;
4954 else
4955 *filter_flags &= ~RXON_FILTER_PROMISC_MSK;
4956 }
4957 if (changed_flags & FIF_ALLMULTI) {
4958 if (*total_flags & FIF_ALLMULTI)
4959 *filter_flags |= RXON_FILTER_ACCEPT_GRP_MSK;
4960 else
4961 *filter_flags &= ~RXON_FILTER_ACCEPT_GRP_MSK;
4962 }
4963 if (changed_flags & FIF_CONTROL) {
4964 if (*total_flags & FIF_CONTROL)
4965 *filter_flags |= RXON_FILTER_CTL2HOST_MSK;
4966 else
4967 *filter_flags &= ~RXON_FILTER_CTL2HOST_MSK;
4968 }
4969 if (changed_flags & FIF_BCN_PRBRESP_PROMISC) {
4970 if (*total_flags & FIF_BCN_PRBRESP_PROMISC)
4971 *filter_flags |= RXON_FILTER_BCON_AWARE_MSK;
4972 else
4973 *filter_flags &= ~RXON_FILTER_BCON_AWARE_MSK;
4974 }
4975
4976 /* We avoid iwl_commit_rxon here to commit the new filter flags
4977 * since mac80211 will call ieee80211_hw_config immediately.
4978 * (mc_list is not supported at this time). Otherwise, we need to
4979 * queue a background iwl_commit_rxon work.
4980 */
4981
4982 *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS |
4983 FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL;
4984}
4985
4986static void iwl3945_mac_remove_interface(struct ieee80211_hw *hw, 4503static void iwl3945_mac_remove_interface(struct ieee80211_hw *hw,
4987 struct ieee80211_if_init_conf *conf) 4504 struct ieee80211_if_init_conf *conf)
4988{ 4505{
@@ -4994,7 +4511,7 @@ static void iwl3945_mac_remove_interface(struct ieee80211_hw *hw,
4994 4511
4995 if (iwl_is_ready_rf(priv)) { 4512 if (iwl_is_ready_rf(priv)) {
4996 iwl_scan_cancel_timeout(priv, 100); 4513 iwl_scan_cancel_timeout(priv, 100);
4997 priv->staging39_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 4514 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
4998 iwl3945_commit_rxon(priv); 4515 iwl3945_commit_rxon(priv);
4999 } 4516 }
5000 if (priv->vif == conf->vif) { 4517 if (priv->vif == conf->vif) {
@@ -5021,17 +4538,18 @@ static void iwl3945_bss_info_changed(struct ieee80211_hw *hw,
5021 IWL_DEBUG_MAC80211("ERP_PREAMBLE %d\n", 4538 IWL_DEBUG_MAC80211("ERP_PREAMBLE %d\n",
5022 bss_conf->use_short_preamble); 4539 bss_conf->use_short_preamble);
5023 if (bss_conf->use_short_preamble) 4540 if (bss_conf->use_short_preamble)
5024 priv->staging39_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; 4541 priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
5025 else 4542 else
5026 priv->staging39_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; 4543 priv->staging_rxon.flags &=
4544 ~RXON_FLG_SHORT_PREAMBLE_MSK;
5027 } 4545 }
5028 4546
5029 if (changes & BSS_CHANGED_ERP_CTS_PROT) { 4547 if (changes & BSS_CHANGED_ERP_CTS_PROT) {
5030 IWL_DEBUG_MAC80211("ERP_CTS %d\n", bss_conf->use_cts_prot); 4548 IWL_DEBUG_MAC80211("ERP_CTS %d\n", bss_conf->use_cts_prot);
5031 if (bss_conf->use_cts_prot && (priv->band != IEEE80211_BAND_5GHZ)) 4549 if (bss_conf->use_cts_prot && (priv->band != IEEE80211_BAND_5GHZ))
5032 priv->staging39_rxon.flags |= RXON_FLG_TGG_PROTECT_MSK; 4550 priv->staging_rxon.flags |= RXON_FLG_TGG_PROTECT_MSK;
5033 else 4551 else
5034 priv->staging39_rxon.flags &= ~RXON_FLG_TGG_PROTECT_MSK; 4552 priv->staging_rxon.flags &= ~RXON_FLG_TGG_PROTECT_MSK;
5035 } 4553 }
5036 4554
5037 if (changes & BSS_CHANGED_ASSOC) { 4555 if (changes & BSS_CHANGED_ASSOC) {
@@ -5055,7 +4573,7 @@ static void iwl3945_bss_info_changed(struct ieee80211_hw *hw,
5055 priv->assoc_id = 0; 4573 priv->assoc_id = 0;
5056 IWL_DEBUG_MAC80211("DISASSOC %d\n", bss_conf->assoc); 4574 IWL_DEBUG_MAC80211("DISASSOC %d\n", bss_conf->assoc);
5057 } 4575 }
5058 } else if (changes && iwl3945_is_associated(priv) && priv->assoc_id) { 4576 } else if (changes && iwl_is_associated(priv) && priv->assoc_id) {
5059 IWL_DEBUG_MAC80211("Associated Changes %d\n", changes); 4577 IWL_DEBUG_MAC80211("Associated Changes %d\n", changes);
5060 iwl3945_send_rxon_assoc(priv); 4578 iwl3945_send_rxon_assoc(priv);
5061 } 4579 }
@@ -5148,7 +4666,7 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
5148 case SET_KEY: 4666 case SET_KEY:
5149 ret = iwl3945_update_sta_key_info(priv, key, sta_id); 4667 ret = iwl3945_update_sta_key_info(priv, key, sta_id);
5150 if (!ret) { 4668 if (!ret) {
5151 iwl3945_set_rxon_hwcrypto(priv, 1); 4669 iwl_set_rxon_hwcrypto(priv, 1);
5152 iwl3945_commit_rxon(priv); 4670 iwl3945_commit_rxon(priv);
5153 key->hw_key_idx = sta_id; 4671 key->hw_key_idx = sta_id;
5154 IWL_DEBUG_MAC80211("set_key success, using hwcrypto\n"); 4672 IWL_DEBUG_MAC80211("set_key success, using hwcrypto\n");
@@ -5158,7 +4676,7 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
5158 case DISABLE_KEY: 4676 case DISABLE_KEY:
5159 ret = iwl3945_clear_sta_key_info(priv, sta_id); 4677 ret = iwl3945_clear_sta_key_info(priv, sta_id);
5160 if (!ret) { 4678 if (!ret) {
5161 iwl3945_set_rxon_hwcrypto(priv, 0); 4679 iwl_set_rxon_hwcrypto(priv, 0);
5162 iwl3945_commit_rxon(priv); 4680 iwl3945_commit_rxon(priv);
5163 IWL_DEBUG_MAC80211("disable hwcrypto key\n"); 4681 IWL_DEBUG_MAC80211("disable hwcrypto key\n");
5164 } 4682 }
@@ -5210,7 +4728,7 @@ static int iwl3945_mac_conf_tx(struct ieee80211_hw *hw, u16 queue,
5210 mutex_lock(&priv->mutex); 4728 mutex_lock(&priv->mutex);
5211 if (priv->iw_mode == NL80211_IFTYPE_AP) 4729 if (priv->iw_mode == NL80211_IFTYPE_AP)
5212 iwl3945_activate_qos(priv, 1); 4730 iwl3945_activate_qos(priv, 1);
5213 else if (priv->assoc_id && iwl3945_is_associated(priv)) 4731 else if (priv->assoc_id && iwl_is_associated(priv))
5214 iwl3945_activate_qos(priv, 0); 4732 iwl3945_activate_qos(priv, 0);
5215 4733
5216 mutex_unlock(&priv->mutex); 4734 mutex_unlock(&priv->mutex);
@@ -5292,7 +4810,7 @@ static void iwl3945_mac_reset_tsf(struct ieee80211_hw *hw)
5292 */ 4810 */
5293 if (priv->iw_mode != NL80211_IFTYPE_AP) { 4811 if (priv->iw_mode != NL80211_IFTYPE_AP) {
5294 iwl_scan_cancel_timeout(priv, 100); 4812 iwl_scan_cancel_timeout(priv, 100);
5295 priv->staging39_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 4813 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
5296 iwl3945_commit_rxon(priv); 4814 iwl3945_commit_rxon(priv);
5297 } 4815 }
5298 4816
@@ -5304,7 +4822,7 @@ static void iwl3945_mac_reset_tsf(struct ieee80211_hw *hw)
5304 return; 4822 return;
5305 } 4823 }
5306 4824
5307 iwl3945_set_rate(priv); 4825 iwl_set_rate(priv);
5308 4826
5309 mutex_unlock(&priv->mutex); 4827 mutex_unlock(&priv->mutex);
5310 4828
@@ -5437,7 +4955,7 @@ static ssize_t show_flags(struct device *d,
5437{ 4955{
5438 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 4956 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
5439 4957
5440 return sprintf(buf, "0x%04X\n", priv->active39_rxon.flags); 4958 return sprintf(buf, "0x%04X\n", priv->active_rxon.flags);
5441} 4959}
5442 4960
5443static ssize_t store_flags(struct device *d, 4961static ssize_t store_flags(struct device *d,
@@ -5448,14 +4966,14 @@ static ssize_t store_flags(struct device *d,
5448 u32 flags = simple_strtoul(buf, NULL, 0); 4966 u32 flags = simple_strtoul(buf, NULL, 0);
5449 4967
5450 mutex_lock(&priv->mutex); 4968 mutex_lock(&priv->mutex);
5451 if (le32_to_cpu(priv->staging39_rxon.flags) != flags) { 4969 if (le32_to_cpu(priv->staging_rxon.flags) != flags) {
5452 /* Cancel any currently running scans... */ 4970 /* Cancel any currently running scans... */
5453 if (iwl_scan_cancel_timeout(priv, 100)) 4971 if (iwl_scan_cancel_timeout(priv, 100))
5454 IWL_WARN(priv, "Could not cancel scan.\n"); 4972 IWL_WARN(priv, "Could not cancel scan.\n");
5455 else { 4973 else {
5456 IWL_DEBUG_INFO("Committing rxon.flags = 0x%04X\n", 4974 IWL_DEBUG_INFO("Committing rxon.flags = 0x%04X\n",
5457 flags); 4975 flags);
5458 priv->staging39_rxon.flags = cpu_to_le32(flags); 4976 priv->staging_rxon.flags = cpu_to_le32(flags);
5459 iwl3945_commit_rxon(priv); 4977 iwl3945_commit_rxon(priv);
5460 } 4978 }
5461 } 4979 }
@@ -5472,7 +4990,7 @@ static ssize_t show_filter_flags(struct device *d,
5472 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 4990 struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
5473 4991
5474 return sprintf(buf, "0x%04X\n", 4992 return sprintf(buf, "0x%04X\n",
5475 le32_to_cpu(priv->active39_rxon.filter_flags)); 4993 le32_to_cpu(priv->active_rxon.filter_flags));
5476} 4994}
5477 4995
5478static ssize_t store_filter_flags(struct device *d, 4996static ssize_t store_filter_flags(struct device *d,
@@ -5483,14 +5001,14 @@ static ssize_t store_filter_flags(struct device *d,
5483 u32 filter_flags = simple_strtoul(buf, NULL, 0); 5001 u32 filter_flags = simple_strtoul(buf, NULL, 0);
5484 5002
5485 mutex_lock(&priv->mutex); 5003 mutex_lock(&priv->mutex);
5486 if (le32_to_cpu(priv->staging39_rxon.filter_flags) != filter_flags) { 5004 if (le32_to_cpu(priv->staging_rxon.filter_flags) != filter_flags) {
5487 /* Cancel any currently running scans... */ 5005 /* Cancel any currently running scans... */
5488 if (iwl_scan_cancel_timeout(priv, 100)) 5006 if (iwl_scan_cancel_timeout(priv, 100))
5489 IWL_WARN(priv, "Could not cancel scan.\n"); 5007 IWL_WARN(priv, "Could not cancel scan.\n");
5490 else { 5008 else {
5491 IWL_DEBUG_INFO("Committing rxon.filter_flags = " 5009 IWL_DEBUG_INFO("Committing rxon.filter_flags = "
5492 "0x%04X\n", filter_flags); 5010 "0x%04X\n", filter_flags);
5493 priv->staging39_rxon.filter_flags = 5011 priv->staging_rxon.filter_flags =
5494 cpu_to_le32(filter_flags); 5012 cpu_to_le32(filter_flags);
5495 iwl3945_commit_rxon(priv); 5013 iwl3945_commit_rxon(priv);
5496 } 5014 }
@@ -5543,7 +5061,7 @@ static ssize_t store_measurement(struct device *d,
5543{ 5061{
5544 struct iwl_priv *priv = dev_get_drvdata(d); 5062 struct iwl_priv *priv = dev_get_drvdata(d);
5545 struct ieee80211_measurement_params params = { 5063 struct ieee80211_measurement_params params = {
5546 .channel = le16_to_cpu(priv->active39_rxon.channel), 5064 .channel = le16_to_cpu(priv->active_rxon.channel),
5547 .start_time = cpu_to_le64(priv->last_tsf), 5065 .start_time = cpu_to_le64(priv->last_tsf),
5548 .duration = cpu_to_le16(1), 5066 .duration = cpu_to_le16(1),
5549 }; 5067 };
@@ -5890,7 +5408,7 @@ static struct ieee80211_ops iwl3945_hw_ops = {
5890 .remove_interface = iwl3945_mac_remove_interface, 5408 .remove_interface = iwl3945_mac_remove_interface,
5891 .config = iwl3945_mac_config, 5409 .config = iwl3945_mac_config,
5892 .config_interface = iwl3945_mac_config_interface, 5410 .config_interface = iwl3945_mac_config_interface,
5893 .configure_filter = iwl3945_configure_filter, 5411 .configure_filter = iwl_configure_filter,
5894 .set_key = iwl3945_mac_set_key, 5412 .set_key = iwl3945_mac_set_key,
5895 .get_tx_stats = iwl3945_mac_get_tx_stats, 5413 .get_tx_stats = iwl3945_mac_get_tx_stats,
5896 .conf_tx = iwl3945_mac_conf_tx, 5414 .conf_tx = iwl3945_mac_conf_tx,
@@ -6163,7 +5681,8 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
6163 goto out_release_irq; 5681 goto out_release_irq;
6164 } 5682 }
6165 5683
6166 iwl3945_set_rxon_channel(priv, IEEE80211_BAND_2GHZ, 6); 5684 iwl_set_rxon_channel(priv,
5685 &priv->bands[IEEE80211_BAND_2GHZ].channels[5]);
6167 iwl3945_setup_deferred_work(priv); 5686 iwl3945_setup_deferred_work(priv);
6168 iwl3945_setup_rx_handlers(priv); 5687 iwl3945_setup_rx_handlers(priv);
6169 5688