diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl4965-base.c | 1729 |
1 files changed, 563 insertions, 1166 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 0b7335181719..44cfd0274976 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -50,7 +50,7 @@ | |||
50 | #include "iwl-4965.h" | 50 | #include "iwl-4965.h" |
51 | #include "iwl-helpers.h" | 51 | #include "iwl-helpers.h" |
52 | 52 | ||
53 | static int iwl4965_tx_queue_update_write_ptr(struct iwl4965_priv *priv, | 53 | static int iwl4965_tx_queue_update_write_ptr(struct iwl_priv *priv, |
54 | struct iwl4965_tx_queue *txq); | 54 | struct iwl4965_tx_queue *txq); |
55 | 55 | ||
56 | /****************************************************************************** | 56 | /****************************************************************************** |
@@ -59,16 +59,6 @@ static int iwl4965_tx_queue_update_write_ptr(struct iwl4965_priv *priv, | |||
59 | * | 59 | * |
60 | ******************************************************************************/ | 60 | ******************************************************************************/ |
61 | 61 | ||
62 | /* module parameters */ | ||
63 | static int iwl4965_param_disable_hw_scan; /* def: 0 = use 4965's h/w scan */ | ||
64 | static int iwl4965_param_debug; /* def: 0 = minimal debug log messages */ | ||
65 | static int iwl4965_param_disable; /* def: enable radio */ | ||
66 | static int iwl4965_param_antenna; /* def: 0 = both antennas (use diversity) */ | ||
67 | int iwl4965_param_hwcrypto; /* def: using software encryption */ | ||
68 | static int iwl4965_param_qos_enable = 1; /* def: 1 = use quality of service */ | ||
69 | int iwl4965_param_queues_num = IWL_MAX_NUM_QUEUES; /* def: 16 Tx queues */ | ||
70 | int iwl4965_param_amsdu_size_8K; /* def: enable 8K amsdu size */ | ||
71 | |||
72 | /* | 62 | /* |
73 | * module name, copyright, version, etc. | 63 | * module name, copyright, version, etc. |
74 | * NOTE: DRV_NAME is defined in iwlwifi.h for use by iwl-debug.h and printk | 64 | * NOTE: DRV_NAME is defined in iwlwifi.h for use by iwl-debug.h and printk |
@@ -76,7 +66,7 @@ int iwl4965_param_amsdu_size_8K; /* def: enable 8K amsdu size */ | |||
76 | 66 | ||
77 | #define DRV_DESCRIPTION "Intel(R) Wireless WiFi Link 4965AGN driver for Linux" | 67 | #define DRV_DESCRIPTION "Intel(R) Wireless WiFi Link 4965AGN driver for Linux" |
78 | 68 | ||
79 | #ifdef CONFIG_IWL4965_DEBUG | 69 | #ifdef CONFIG_IWLWIFI_DEBUG |
80 | #define VD "d" | 70 | #define VD "d" |
81 | #else | 71 | #else |
82 | #define VD | 72 | #define VD |
@@ -107,7 +97,7 @@ __le16 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr) | |||
107 | } | 97 | } |
108 | 98 | ||
109 | static const struct ieee80211_supported_band *iwl4965_get_hw_mode( | 99 | static const struct ieee80211_supported_band *iwl4965_get_hw_mode( |
110 | struct iwl4965_priv *priv, enum ieee80211_band band) | 100 | struct iwl_priv *priv, enum ieee80211_band band) |
111 | { | 101 | { |
112 | return priv->hw->wiphy->bands[band]; | 102 | return priv->hw->wiphy->bands[band]; |
113 | } | 103 | } |
@@ -216,7 +206,7 @@ static inline u8 get_cmd_index(struct iwl4965_queue *q, u32 index, int is_huge) | |||
216 | /** | 206 | /** |
217 | * iwl4965_queue_init - Initialize queue's high/low-water and read/write indexes | 207 | * iwl4965_queue_init - Initialize queue's high/low-water and read/write indexes |
218 | */ | 208 | */ |
219 | static int iwl4965_queue_init(struct iwl4965_priv *priv, struct iwl4965_queue *q, | 209 | static int iwl4965_queue_init(struct iwl_priv *priv, struct iwl4965_queue *q, |
220 | int count, int slots_num, u32 id) | 210 | int count, int slots_num, u32 id) |
221 | { | 211 | { |
222 | q->n_bd = count; | 212 | q->n_bd = count; |
@@ -247,7 +237,7 @@ static int iwl4965_queue_init(struct iwl4965_priv *priv, struct iwl4965_queue *q | |||
247 | /** | 237 | /** |
248 | * iwl4965_tx_queue_alloc - Alloc driver data and TFD CB for one Tx/cmd queue | 238 | * iwl4965_tx_queue_alloc - Alloc driver data and TFD CB for one Tx/cmd queue |
249 | */ | 239 | */ |
250 | static int iwl4965_tx_queue_alloc(struct iwl4965_priv *priv, | 240 | static int iwl4965_tx_queue_alloc(struct iwl_priv *priv, |
251 | struct iwl4965_tx_queue *txq, u32 id) | 241 | struct iwl4965_tx_queue *txq, u32 id) |
252 | { | 242 | { |
253 | struct pci_dev *dev = priv->pci_dev; | 243 | struct pci_dev *dev = priv->pci_dev; |
@@ -292,7 +282,7 @@ static int iwl4965_tx_queue_alloc(struct iwl4965_priv *priv, | |||
292 | /** | 282 | /** |
293 | * iwl4965_tx_queue_init - Allocate and initialize one tx/cmd queue | 283 | * iwl4965_tx_queue_init - Allocate and initialize one tx/cmd queue |
294 | */ | 284 | */ |
295 | int iwl4965_tx_queue_init(struct iwl4965_priv *priv, | 285 | int iwl4965_tx_queue_init(struct iwl_priv *priv, |
296 | struct iwl4965_tx_queue *txq, int slots_num, u32 txq_id) | 286 | struct iwl4965_tx_queue *txq, int slots_num, u32 txq_id) |
297 | { | 287 | { |
298 | struct pci_dev *dev = priv->pci_dev; | 288 | struct pci_dev *dev = priv->pci_dev; |
@@ -307,7 +297,7 @@ int iwl4965_tx_queue_init(struct iwl4965_priv *priv, | |||
307 | * For normal Tx queues (all other queues), no super-size command | 297 | * For normal Tx queues (all other queues), no super-size command |
308 | * space is needed. | 298 | * space is needed. |
309 | */ | 299 | */ |
310 | len = sizeof(struct iwl4965_cmd) * slots_num; | 300 | len = sizeof(struct iwl_cmd) * slots_num; |
311 | if (txq_id == IWL_CMD_QUEUE_NUM) | 301 | if (txq_id == IWL_CMD_QUEUE_NUM) |
312 | len += IWL_MAX_SCAN_SIZE; | 302 | len += IWL_MAX_SCAN_SIZE; |
313 | txq->cmd = pci_alloc_consistent(dev, len, &txq->dma_addr_cmd); | 303 | txq->cmd = pci_alloc_consistent(dev, len, &txq->dma_addr_cmd); |
@@ -344,7 +334,7 @@ int iwl4965_tx_queue_init(struct iwl4965_priv *priv, | |||
344 | * Free all buffers. | 334 | * Free all buffers. |
345 | * 0-fill, but do not free "txq" descriptor structure. | 335 | * 0-fill, but do not free "txq" descriptor structure. |
346 | */ | 336 | */ |
347 | void iwl4965_tx_queue_free(struct iwl4965_priv *priv, struct iwl4965_tx_queue *txq) | 337 | void iwl4965_tx_queue_free(struct iwl_priv *priv, struct iwl4965_tx_queue *txq) |
348 | { | 338 | { |
349 | struct iwl4965_queue *q = &txq->q; | 339 | struct iwl4965_queue *q = &txq->q; |
350 | struct pci_dev *dev = priv->pci_dev; | 340 | struct pci_dev *dev = priv->pci_dev; |
@@ -358,7 +348,7 @@ void iwl4965_tx_queue_free(struct iwl4965_priv *priv, struct iwl4965_tx_queue *t | |||
358 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) | 348 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) |
359 | iwl4965_hw_txq_free_tfd(priv, txq); | 349 | iwl4965_hw_txq_free_tfd(priv, txq); |
360 | 350 | ||
361 | len = sizeof(struct iwl4965_cmd) * q->n_window; | 351 | len = sizeof(struct iwl_cmd) * q->n_window; |
362 | if (q->id == IWL_CMD_QUEUE_NUM) | 352 | if (q->id == IWL_CMD_QUEUE_NUM) |
363 | len += IWL_MAX_SCAN_SIZE; | 353 | len += IWL_MAX_SCAN_SIZE; |
364 | 354 | ||
@@ -395,7 +385,7 @@ const u8 iwl4965_broadcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF | |||
395 | * | 385 | * |
396 | * NOTE: This does not remove station from device's station table. | 386 | * NOTE: This does not remove station from device's station table. |
397 | */ | 387 | */ |
398 | static u8 iwl4965_remove_station(struct iwl4965_priv *priv, const u8 *addr, int is_ap) | 388 | static u8 iwl4965_remove_station(struct iwl_priv *priv, const u8 *addr, int is_ap) |
399 | { | 389 | { |
400 | int index = IWL_INVALID_STATION; | 390 | int index = IWL_INVALID_STATION; |
401 | int i; | 391 | int i; |
@@ -433,26 +423,9 @@ out: | |||
433 | #endif | 423 | #endif |
434 | 424 | ||
435 | /** | 425 | /** |
436 | * iwl4965_clear_stations_table - Clear the driver's station table | ||
437 | * | ||
438 | * NOTE: This does not clear or otherwise alter the device's station table. | ||
439 | */ | ||
440 | static void iwl4965_clear_stations_table(struct iwl4965_priv *priv) | ||
441 | { | ||
442 | unsigned long flags; | ||
443 | |||
444 | spin_lock_irqsave(&priv->sta_lock, flags); | ||
445 | |||
446 | priv->num_stations = 0; | ||
447 | memset(priv->stations, 0, sizeof(priv->stations)); | ||
448 | |||
449 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
450 | } | ||
451 | |||
452 | /** | ||
453 | * iwl4965_add_station_flags - Add station to tables in driver and device | 426 | * iwl4965_add_station_flags - Add station to tables in driver and device |
454 | */ | 427 | */ |
455 | u8 iwl4965_add_station_flags(struct iwl4965_priv *priv, const u8 *addr, | 428 | u8 iwl4965_add_station_flags(struct iwl_priv *priv, const u8 *addr, |
456 | int is_ap, u8 flags, void *ht_data) | 429 | int is_ap, u8 flags, void *ht_data) |
457 | { | 430 | { |
458 | int i; | 431 | int i; |
@@ -524,7 +497,7 @@ u8 iwl4965_add_station_flags(struct iwl4965_priv *priv, const u8 *addr, | |||
524 | 497 | ||
525 | /*************** DRIVER STATUS FUNCTIONS *****/ | 498 | /*************** DRIVER STATUS FUNCTIONS *****/ |
526 | 499 | ||
527 | static inline int iwl4965_is_ready(struct iwl4965_priv *priv) | 500 | static inline int iwl4965_is_ready(struct iwl_priv *priv) |
528 | { | 501 | { |
529 | /* The adapter is 'ready' if READY and GEO_CONFIGURED bits are | 502 | /* The adapter is 'ready' if READY and GEO_CONFIGURED bits are |
530 | * set but EXIT_PENDING is not */ | 503 | * set but EXIT_PENDING is not */ |
@@ -533,23 +506,23 @@ static inline int iwl4965_is_ready(struct iwl4965_priv *priv) | |||
533 | !test_bit(STATUS_EXIT_PENDING, &priv->status); | 506 | !test_bit(STATUS_EXIT_PENDING, &priv->status); |
534 | } | 507 | } |
535 | 508 | ||
536 | static inline int iwl4965_is_alive(struct iwl4965_priv *priv) | 509 | static inline int iwl4965_is_alive(struct iwl_priv *priv) |
537 | { | 510 | { |
538 | return test_bit(STATUS_ALIVE, &priv->status); | 511 | return test_bit(STATUS_ALIVE, &priv->status); |
539 | } | 512 | } |
540 | 513 | ||
541 | static inline int iwl4965_is_init(struct iwl4965_priv *priv) | 514 | static inline int iwl4965_is_init(struct iwl_priv *priv) |
542 | { | 515 | { |
543 | return test_bit(STATUS_INIT, &priv->status); | 516 | return test_bit(STATUS_INIT, &priv->status); |
544 | } | 517 | } |
545 | 518 | ||
546 | static inline int iwl4965_is_rfkill(struct iwl4965_priv *priv) | 519 | static inline int iwl4965_is_rfkill(struct iwl_priv *priv) |
547 | { | 520 | { |
548 | return test_bit(STATUS_RF_KILL_HW, &priv->status) || | 521 | return test_bit(STATUS_RF_KILL_HW, &priv->status) || |
549 | test_bit(STATUS_RF_KILL_SW, &priv->status); | 522 | test_bit(STATUS_RF_KILL_SW, &priv->status); |
550 | } | 523 | } |
551 | 524 | ||
552 | static inline int iwl4965_is_ready_rf(struct iwl4965_priv *priv) | 525 | static inline int iwl4965_is_ready_rf(struct iwl_priv *priv) |
553 | { | 526 | { |
554 | 527 | ||
555 | if (iwl4965_is_rfkill(priv)) | 528 | if (iwl4965_is_rfkill(priv)) |
@@ -560,65 +533,6 @@ static inline int iwl4965_is_ready_rf(struct iwl4965_priv *priv) | |||
560 | 533 | ||
561 | /*************** HOST COMMAND QUEUE FUNCTIONS *****/ | 534 | /*************** HOST COMMAND QUEUE FUNCTIONS *****/ |
562 | 535 | ||
563 | #define IWL_CMD(x) case x : return #x | ||
564 | |||
565 | static const char *get_cmd_string(u8 cmd) | ||
566 | { | ||
567 | switch (cmd) { | ||
568 | IWL_CMD(REPLY_ALIVE); | ||
569 | IWL_CMD(REPLY_ERROR); | ||
570 | IWL_CMD(REPLY_RXON); | ||
571 | IWL_CMD(REPLY_RXON_ASSOC); | ||
572 | IWL_CMD(REPLY_QOS_PARAM); | ||
573 | IWL_CMD(REPLY_RXON_TIMING); | ||
574 | IWL_CMD(REPLY_ADD_STA); | ||
575 | IWL_CMD(REPLY_REMOVE_STA); | ||
576 | IWL_CMD(REPLY_REMOVE_ALL_STA); | ||
577 | IWL_CMD(REPLY_TX); | ||
578 | IWL_CMD(REPLY_RATE_SCALE); | ||
579 | IWL_CMD(REPLY_LEDS_CMD); | ||
580 | IWL_CMD(REPLY_TX_LINK_QUALITY_CMD); | ||
581 | IWL_CMD(RADAR_NOTIFICATION); | ||
582 | IWL_CMD(REPLY_QUIET_CMD); | ||
583 | IWL_CMD(REPLY_CHANNEL_SWITCH); | ||
584 | IWL_CMD(CHANNEL_SWITCH_NOTIFICATION); | ||
585 | IWL_CMD(REPLY_SPECTRUM_MEASUREMENT_CMD); | ||
586 | IWL_CMD(SPECTRUM_MEASURE_NOTIFICATION); | ||
587 | IWL_CMD(POWER_TABLE_CMD); | ||
588 | IWL_CMD(PM_SLEEP_NOTIFICATION); | ||
589 | IWL_CMD(PM_DEBUG_STATISTIC_NOTIFIC); | ||
590 | IWL_CMD(REPLY_SCAN_CMD); | ||
591 | IWL_CMD(REPLY_SCAN_ABORT_CMD); | ||
592 | IWL_CMD(SCAN_START_NOTIFICATION); | ||
593 | IWL_CMD(SCAN_RESULTS_NOTIFICATION); | ||
594 | IWL_CMD(SCAN_COMPLETE_NOTIFICATION); | ||
595 | IWL_CMD(BEACON_NOTIFICATION); | ||
596 | IWL_CMD(REPLY_TX_BEACON); | ||
597 | IWL_CMD(WHO_IS_AWAKE_NOTIFICATION); | ||
598 | IWL_CMD(QUIET_NOTIFICATION); | ||
599 | IWL_CMD(REPLY_TX_PWR_TABLE_CMD); | ||
600 | IWL_CMD(MEASURE_ABORT_NOTIFICATION); | ||
601 | IWL_CMD(REPLY_BT_CONFIG); | ||
602 | IWL_CMD(REPLY_STATISTICS_CMD); | ||
603 | IWL_CMD(STATISTICS_NOTIFICATION); | ||
604 | IWL_CMD(REPLY_CARD_STATE_CMD); | ||
605 | IWL_CMD(CARD_STATE_NOTIFICATION); | ||
606 | IWL_CMD(MISSED_BEACONS_NOTIFICATION); | ||
607 | IWL_CMD(REPLY_CT_KILL_CONFIG_CMD); | ||
608 | IWL_CMD(SENSITIVITY_CMD); | ||
609 | IWL_CMD(REPLY_PHY_CALIBRATION_CMD); | ||
610 | IWL_CMD(REPLY_RX_PHY_CMD); | ||
611 | IWL_CMD(REPLY_RX_MPDU_CMD); | ||
612 | IWL_CMD(REPLY_4965_RX); | ||
613 | IWL_CMD(REPLY_COMPRESSED_BA); | ||
614 | default: | ||
615 | return "UNKNOWN"; | ||
616 | |||
617 | } | ||
618 | } | ||
619 | |||
620 | #define HOST_COMPLETE_TIMEOUT (HZ / 2) | ||
621 | |||
622 | /** | 536 | /** |
623 | * iwl4965_enqueue_hcmd - enqueue a uCode command | 537 | * iwl4965_enqueue_hcmd - enqueue a uCode command |
624 | * @priv: device private data point | 538 | * @priv: device private data point |
@@ -628,13 +542,13 @@ static const char *get_cmd_string(u8 cmd) | |||
628 | * failed. On success, it turns the index (> 0) of command in the | 542 | * failed. On success, it turns the index (> 0) of command in the |
629 | * command queue. | 543 | * command queue. |
630 | */ | 544 | */ |
631 | static int iwl4965_enqueue_hcmd(struct iwl4965_priv *priv, struct iwl4965_host_cmd *cmd) | 545 | int iwl4965_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) |
632 | { | 546 | { |
633 | struct iwl4965_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM]; | 547 | struct iwl4965_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM]; |
634 | struct iwl4965_queue *q = &txq->q; | 548 | struct iwl4965_queue *q = &txq->q; |
635 | struct iwl4965_tfd_frame *tfd; | 549 | struct iwl4965_tfd_frame *tfd; |
636 | u32 *control_flags; | 550 | u32 *control_flags; |
637 | struct iwl4965_cmd *out_cmd; | 551 | struct iwl_cmd *out_cmd; |
638 | u32 idx; | 552 | u32 idx; |
639 | u16 fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr)); | 553 | u16 fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr)); |
640 | dma_addr_t phys_addr; | 554 | dma_addr_t phys_addr; |
@@ -681,7 +595,7 @@ static int iwl4965_enqueue_hcmd(struct iwl4965_priv *priv, struct iwl4965_host_c | |||
681 | out_cmd->hdr.sequence |= cpu_to_le16(SEQ_HUGE_FRAME); | 595 | out_cmd->hdr.sequence |= cpu_to_le16(SEQ_HUGE_FRAME); |
682 | 596 | ||
683 | phys_addr = txq->dma_addr_cmd + sizeof(txq->cmd[0]) * idx + | 597 | phys_addr = txq->dma_addr_cmd + sizeof(txq->cmd[0]) * idx + |
684 | offsetof(struct iwl4965_cmd, hdr); | 598 | offsetof(struct iwl_cmd, hdr); |
685 | iwl4965_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size); | 599 | iwl4965_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size); |
686 | 600 | ||
687 | IWL_DEBUG_HC("Sending command %s (#%x), seq: 0x%04X, " | 601 | IWL_DEBUG_HC("Sending command %s (#%x), seq: 0x%04X, " |
@@ -703,151 +617,22 @@ static int iwl4965_enqueue_hcmd(struct iwl4965_priv *priv, struct iwl4965_host_c | |||
703 | return ret ? ret : idx; | 617 | return ret ? ret : idx; |
704 | } | 618 | } |
705 | 619 | ||
706 | static int iwl4965_send_cmd_async(struct iwl4965_priv *priv, struct iwl4965_host_cmd *cmd) | 620 | static void iwl4965_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt) |
707 | { | 621 | { |
708 | int ret; | 622 | struct iwl4965_rxon_cmd *rxon = &priv->staging_rxon; |
709 | |||
710 | BUG_ON(!(cmd->meta.flags & CMD_ASYNC)); | ||
711 | |||
712 | /* An asynchronous command can not expect an SKB to be set. */ | ||
713 | BUG_ON(cmd->meta.flags & CMD_WANT_SKB); | ||
714 | |||
715 | /* An asynchronous command MUST have a callback. */ | ||
716 | BUG_ON(!cmd->meta.u.callback); | ||
717 | |||
718 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | ||
719 | return -EBUSY; | ||
720 | |||
721 | ret = iwl4965_enqueue_hcmd(priv, cmd); | ||
722 | if (ret < 0) { | ||
723 | IWL_ERROR("Error sending %s: iwl4965_enqueue_hcmd failed: %d\n", | ||
724 | get_cmd_string(cmd->id), ret); | ||
725 | return ret; | ||
726 | } | ||
727 | return 0; | ||
728 | } | ||
729 | |||
730 | static int iwl4965_send_cmd_sync(struct iwl4965_priv *priv, struct iwl4965_host_cmd *cmd) | ||
731 | { | ||
732 | int cmd_idx; | ||
733 | int ret; | ||
734 | static atomic_t entry = ATOMIC_INIT(0); /* reentrance protection */ | ||
735 | |||
736 | BUG_ON(cmd->meta.flags & CMD_ASYNC); | ||
737 | |||
738 | /* A synchronous command can not have a callback set. */ | ||
739 | BUG_ON(cmd->meta.u.callback != NULL); | ||
740 | |||
741 | if (atomic_xchg(&entry, 1)) { | ||
742 | IWL_ERROR("Error sending %s: Already sending a host command\n", | ||
743 | get_cmd_string(cmd->id)); | ||
744 | return -EBUSY; | ||
745 | } | ||
746 | |||
747 | set_bit(STATUS_HCMD_ACTIVE, &priv->status); | ||
748 | |||
749 | if (cmd->meta.flags & CMD_WANT_SKB) | ||
750 | cmd->meta.source = &cmd->meta; | ||
751 | |||
752 | cmd_idx = iwl4965_enqueue_hcmd(priv, cmd); | ||
753 | if (cmd_idx < 0) { | ||
754 | ret = cmd_idx; | ||
755 | IWL_ERROR("Error sending %s: iwl4965_enqueue_hcmd failed: %d\n", | ||
756 | get_cmd_string(cmd->id), ret); | ||
757 | goto out; | ||
758 | } | ||
759 | |||
760 | ret = wait_event_interruptible_timeout(priv->wait_command_queue, | ||
761 | !test_bit(STATUS_HCMD_ACTIVE, &priv->status), | ||
762 | HOST_COMPLETE_TIMEOUT); | ||
763 | if (!ret) { | ||
764 | if (test_bit(STATUS_HCMD_ACTIVE, &priv->status)) { | ||
765 | IWL_ERROR("Error sending %s: time out after %dms.\n", | ||
766 | get_cmd_string(cmd->id), | ||
767 | jiffies_to_msecs(HOST_COMPLETE_TIMEOUT)); | ||
768 | |||
769 | clear_bit(STATUS_HCMD_ACTIVE, &priv->status); | ||
770 | ret = -ETIMEDOUT; | ||
771 | goto cancel; | ||
772 | } | ||
773 | } | ||
774 | |||
775 | if (test_bit(STATUS_RF_KILL_HW, &priv->status)) { | ||
776 | IWL_DEBUG_INFO("Command %s aborted: RF KILL Switch\n", | ||
777 | get_cmd_string(cmd->id)); | ||
778 | ret = -ECANCELED; | ||
779 | goto fail; | ||
780 | } | ||
781 | if (test_bit(STATUS_FW_ERROR, &priv->status)) { | ||
782 | IWL_DEBUG_INFO("Command %s failed: FW Error\n", | ||
783 | get_cmd_string(cmd->id)); | ||
784 | ret = -EIO; | ||
785 | goto fail; | ||
786 | } | ||
787 | if ((cmd->meta.flags & CMD_WANT_SKB) && !cmd->meta.u.skb) { | ||
788 | IWL_ERROR("Error: Response NULL in '%s'\n", | ||
789 | get_cmd_string(cmd->id)); | ||
790 | ret = -EIO; | ||
791 | goto out; | ||
792 | } | ||
793 | |||
794 | ret = 0; | ||
795 | goto out; | ||
796 | |||
797 | cancel: | ||
798 | if (cmd->meta.flags & CMD_WANT_SKB) { | ||
799 | struct iwl4965_cmd *qcmd; | ||
800 | |||
801 | /* Cancel the CMD_WANT_SKB flag for the cmd in the | ||
802 | * TX cmd queue. Otherwise in case the cmd comes | ||
803 | * in later, it will possibly set an invalid | ||
804 | * address (cmd->meta.source). */ | ||
805 | qcmd = &priv->txq[IWL_CMD_QUEUE_NUM].cmd[cmd_idx]; | ||
806 | qcmd->meta.flags &= ~CMD_WANT_SKB; | ||
807 | } | ||
808 | fail: | ||
809 | if (cmd->meta.u.skb) { | ||
810 | dev_kfree_skb_any(cmd->meta.u.skb); | ||
811 | cmd->meta.u.skb = NULL; | ||
812 | } | ||
813 | out: | ||
814 | atomic_set(&entry, 0); | ||
815 | return ret; | ||
816 | } | ||
817 | |||
818 | int iwl4965_send_cmd(struct iwl4965_priv *priv, struct iwl4965_host_cmd *cmd) | ||
819 | { | ||
820 | if (cmd->meta.flags & CMD_ASYNC) | ||
821 | return iwl4965_send_cmd_async(priv, cmd); | ||
822 | |||
823 | return iwl4965_send_cmd_sync(priv, cmd); | ||
824 | } | ||
825 | |||
826 | int iwl4965_send_cmd_pdu(struct iwl4965_priv *priv, u8 id, u16 len, const void *data) | ||
827 | { | ||
828 | struct iwl4965_host_cmd cmd = { | ||
829 | .id = id, | ||
830 | .len = len, | ||
831 | .data = data, | ||
832 | }; | ||
833 | |||
834 | return iwl4965_send_cmd_sync(priv, &cmd); | ||
835 | } | ||
836 | 623 | ||
837 | static int __must_check iwl4965_send_cmd_u32(struct iwl4965_priv *priv, u8 id, u32 val) | 624 | if (hw_decrypt) |
838 | { | 625 | rxon->filter_flags &= ~RXON_FILTER_DIS_DECRYPT_MSK; |
839 | struct iwl4965_host_cmd cmd = { | 626 | else |
840 | .id = id, | 627 | rxon->filter_flags |= RXON_FILTER_DIS_DECRYPT_MSK; |
841 | .len = sizeof(val), | ||
842 | .data = &val, | ||
843 | }; | ||
844 | 628 | ||
845 | return iwl4965_send_cmd_sync(priv, &cmd); | ||
846 | } | 629 | } |
847 | 630 | ||
848 | int iwl4965_send_statistics_request(struct iwl4965_priv *priv) | 631 | int iwl4965_send_statistics_request(struct iwl_priv *priv) |
849 | { | 632 | { |
850 | return iwl4965_send_cmd_u32(priv, REPLY_STATISTICS_CMD, 0); | 633 | u32 flags = 0; |
634 | return iwl_send_cmd_pdu(priv, REPLY_STATISTICS_CMD, | ||
635 | sizeof(flags), &flags); | ||
851 | } | 636 | } |
852 | 637 | ||
853 | /** | 638 | /** |
@@ -856,7 +641,7 @@ int iwl4965_send_statistics_request(struct iwl4965_priv *priv) | |||
856 | * there is only one AP station with id= IWL_AP_ID | 641 | * there is only one AP station with id= IWL_AP_ID |
857 | * NOTE: mutex must be held before calling this fnction | 642 | * NOTE: mutex must be held before calling this fnction |
858 | */ | 643 | */ |
859 | static int iwl4965_rxon_add_station(struct iwl4965_priv *priv, | 644 | static int iwl4965_rxon_add_station(struct iwl_priv *priv, |
860 | const u8 *addr, int is_ap) | 645 | const u8 *addr, int is_ap) |
861 | { | 646 | { |
862 | u8 sta_id; | 647 | u8 sta_id; |
@@ -883,43 +668,6 @@ static int iwl4965_rxon_add_station(struct iwl4965_priv *priv, | |||
883 | } | 668 | } |
884 | 669 | ||
885 | /** | 670 | /** |
886 | * iwl4965_set_rxon_channel - Set the phymode and channel values in staging RXON | ||
887 | * @phymode: MODE_IEEE80211A sets to 5.2GHz; all else set to 2.4GHz | ||
888 | * @channel: Any channel valid for the requested phymode | ||
889 | |||
890 | * In addition to setting the staging RXON, priv->phymode is also set. | ||
891 | * | ||
892 | * NOTE: Does not commit to the hardware; it sets appropriate bit fields | ||
893 | * in the staging RXON flag structure based on the phymode | ||
894 | */ | ||
895 | static int iwl4965_set_rxon_channel(struct iwl4965_priv *priv, | ||
896 | enum ieee80211_band band, | ||
897 | u16 channel) | ||
898 | { | ||
899 | if (!iwl4965_get_channel_info(priv, band, channel)) { | ||
900 | IWL_DEBUG_INFO("Could not set channel to %d [%d]\n", | ||
901 | channel, band); | ||
902 | return -EINVAL; | ||
903 | } | ||
904 | |||
905 | if ((le16_to_cpu(priv->staging_rxon.channel) == channel) && | ||
906 | (priv->band == band)) | ||
907 | return 0; | ||
908 | |||
909 | priv->staging_rxon.channel = cpu_to_le16(channel); | ||
910 | if (band == IEEE80211_BAND_5GHZ) | ||
911 | priv->staging_rxon.flags &= ~RXON_FLG_BAND_24G_MSK; | ||
912 | else | ||
913 | priv->staging_rxon.flags |= RXON_FLG_BAND_24G_MSK; | ||
914 | |||
915 | priv->band = band; | ||
916 | |||
917 | IWL_DEBUG_INFO("Staging channel set to %d [%d]\n", channel, band); | ||
918 | |||
919 | return 0; | ||
920 | } | ||
921 | |||
922 | /** | ||
923 | * iwl4965_check_rxon_cmd - validate RXON structure is valid | 671 | * iwl4965_check_rxon_cmd - validate RXON structure is valid |
924 | * | 672 | * |
925 | * NOTE: This is really only useful during development and can eventually | 673 | * NOTE: This is really only useful during development and can eventually |
@@ -1000,7 +748,7 @@ static int iwl4965_check_rxon_cmd(struct iwl4965_rxon_cmd *rxon) | |||
1000 | * or is clearing the RXON_FILTER_ASSOC_MSK, then return 1 to indicate that | 748 | * or is clearing the RXON_FILTER_ASSOC_MSK, then return 1 to indicate that |
1001 | * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required. | 749 | * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required. |
1002 | */ | 750 | */ |
1003 | static int iwl4965_full_rxon_required(struct iwl4965_priv *priv) | 751 | static int iwl4965_full_rxon_required(struct iwl_priv *priv) |
1004 | { | 752 | { |
1005 | 753 | ||
1006 | /* These items are only settable from the full RXON command */ | 754 | /* These items are only settable from the full RXON command */ |
@@ -1040,12 +788,12 @@ static int iwl4965_full_rxon_required(struct iwl4965_priv *priv) | |||
1040 | return 0; | 788 | return 0; |
1041 | } | 789 | } |
1042 | 790 | ||
1043 | static int iwl4965_send_rxon_assoc(struct iwl4965_priv *priv) | 791 | static int iwl4965_send_rxon_assoc(struct iwl_priv *priv) |
1044 | { | 792 | { |
1045 | int rc = 0; | 793 | int rc = 0; |
1046 | struct iwl4965_rx_packet *res = NULL; | 794 | struct iwl4965_rx_packet *res = NULL; |
1047 | struct iwl4965_rxon_assoc_cmd rxon_assoc; | 795 | struct iwl4965_rxon_assoc_cmd rxon_assoc; |
1048 | struct iwl4965_host_cmd cmd = { | 796 | struct iwl_host_cmd cmd = { |
1049 | .id = REPLY_RXON_ASSOC, | 797 | .id = REPLY_RXON_ASSOC, |
1050 | .len = sizeof(rxon_assoc), | 798 | .len = sizeof(rxon_assoc), |
1051 | .meta.flags = CMD_WANT_SKB, | 799 | .meta.flags = CMD_WANT_SKB, |
@@ -1078,7 +826,7 @@ static int iwl4965_send_rxon_assoc(struct iwl4965_priv *priv) | |||
1078 | priv->staging_rxon.ofdm_ht_dual_stream_basic_rates; | 826 | priv->staging_rxon.ofdm_ht_dual_stream_basic_rates; |
1079 | rxon_assoc.rx_chain_select_flags = priv->staging_rxon.rx_chain; | 827 | rxon_assoc.rx_chain_select_flags = priv->staging_rxon.rx_chain; |
1080 | 828 | ||
1081 | rc = iwl4965_send_cmd_sync(priv, &cmd); | 829 | rc = iwl_send_cmd_sync(priv, &cmd); |
1082 | if (rc) | 830 | if (rc) |
1083 | return rc; | 831 | return rc; |
1084 | 832 | ||
@@ -1102,7 +850,7 @@ static int iwl4965_send_rxon_assoc(struct iwl4965_priv *priv) | |||
1102 | * function correctly transitions out of the RXON_ASSOC_MSK state if | 850 | * function correctly transitions out of the RXON_ASSOC_MSK state if |
1103 | * a HW tune is required based on the RXON structure changes. | 851 | * a HW tune is required based on the RXON structure changes. |
1104 | */ | 852 | */ |
1105 | static int iwl4965_commit_rxon(struct iwl4965_priv *priv) | 853 | static int iwl4965_commit_rxon(struct iwl_priv *priv) |
1106 | { | 854 | { |
1107 | /* cast away the const for active_rxon in this function */ | 855 | /* cast away the const for active_rxon in this function */ |
1108 | struct iwl4965_rxon_cmd *active_rxon = (void *)&priv->active_rxon; | 856 | struct iwl4965_rxon_cmd *active_rxon = (void *)&priv->active_rxon; |
@@ -1157,7 +905,7 @@ static int iwl4965_commit_rxon(struct iwl4965_priv *priv) | |||
1157 | IWL_DEBUG_INFO("Toggling associated bit on current RXON\n"); | 905 | IWL_DEBUG_INFO("Toggling associated bit on current RXON\n"); |
1158 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 906 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
1159 | 907 | ||
1160 | rc = iwl4965_send_cmd_pdu(priv, REPLY_RXON, | 908 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON, |
1161 | sizeof(struct iwl4965_rxon_cmd), | 909 | sizeof(struct iwl4965_rxon_cmd), |
1162 | &priv->active_rxon); | 910 | &priv->active_rxon); |
1163 | 911 | ||
@@ -1180,15 +928,16 @@ static int iwl4965_commit_rxon(struct iwl4965_priv *priv) | |||
1180 | le16_to_cpu(priv->staging_rxon.channel), | 928 | le16_to_cpu(priv->staging_rxon.channel), |
1181 | print_mac(mac, priv->staging_rxon.bssid_addr)); | 929 | print_mac(mac, priv->staging_rxon.bssid_addr)); |
1182 | 930 | ||
931 | iwl4965_set_rxon_hwcrypto(priv, priv->cfg->mod_params->hw_crypto); | ||
1183 | /* Apply the new configuration */ | 932 | /* Apply the new configuration */ |
1184 | rc = iwl4965_send_cmd_pdu(priv, REPLY_RXON, | 933 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON, |
1185 | sizeof(struct iwl4965_rxon_cmd), &priv->staging_rxon); | 934 | sizeof(struct iwl4965_rxon_cmd), &priv->staging_rxon); |
1186 | if (rc) { | 935 | if (rc) { |
1187 | IWL_ERROR("Error setting new configuration (%d).\n", rc); | 936 | IWL_ERROR("Error setting new configuration (%d).\n", rc); |
1188 | return rc; | 937 | return rc; |
1189 | } | 938 | } |
1190 | 939 | ||
1191 | iwl4965_clear_stations_table(priv); | 940 | iwlcore_clear_stations_table(priv); |
1192 | 941 | ||
1193 | #ifdef CONFIG_IWL4965_SENSITIVITY | 942 | #ifdef CONFIG_IWL4965_SENSITIVITY |
1194 | if (!priv->error_recovering) | 943 | if (!priv->error_recovering) |
@@ -1230,7 +979,7 @@ static int iwl4965_commit_rxon(struct iwl4965_priv *priv) | |||
1230 | return 0; | 979 | return 0; |
1231 | } | 980 | } |
1232 | 981 | ||
1233 | static int iwl4965_send_bt_config(struct iwl4965_priv *priv) | 982 | static int iwl4965_send_bt_config(struct iwl_priv *priv) |
1234 | { | 983 | { |
1235 | struct iwl4965_bt_cmd bt_cmd = { | 984 | struct iwl4965_bt_cmd bt_cmd = { |
1236 | .flags = 3, | 985 | .flags = 3, |
@@ -1240,15 +989,15 @@ static int iwl4965_send_bt_config(struct iwl4965_priv *priv) | |||
1240 | .kill_cts_mask = 0, | 989 | .kill_cts_mask = 0, |
1241 | }; | 990 | }; |
1242 | 991 | ||
1243 | return iwl4965_send_cmd_pdu(priv, REPLY_BT_CONFIG, | 992 | return iwl_send_cmd_pdu(priv, REPLY_BT_CONFIG, |
1244 | sizeof(struct iwl4965_bt_cmd), &bt_cmd); | 993 | sizeof(struct iwl4965_bt_cmd), &bt_cmd); |
1245 | } | 994 | } |
1246 | 995 | ||
1247 | static int iwl4965_send_scan_abort(struct iwl4965_priv *priv) | 996 | static int iwl4965_send_scan_abort(struct iwl_priv *priv) |
1248 | { | 997 | { |
1249 | int rc = 0; | 998 | int rc = 0; |
1250 | struct iwl4965_rx_packet *res; | 999 | struct iwl4965_rx_packet *res; |
1251 | struct iwl4965_host_cmd cmd = { | 1000 | struct iwl_host_cmd cmd = { |
1252 | .id = REPLY_SCAN_ABORT_CMD, | 1001 | .id = REPLY_SCAN_ABORT_CMD, |
1253 | .meta.flags = CMD_WANT_SKB, | 1002 | .meta.flags = CMD_WANT_SKB, |
1254 | }; | 1003 | }; |
@@ -1261,7 +1010,7 @@ static int iwl4965_send_scan_abort(struct iwl4965_priv *priv) | |||
1261 | return 0; | 1010 | return 0; |
1262 | } | 1011 | } |
1263 | 1012 | ||
1264 | rc = iwl4965_send_cmd_sync(priv, &cmd); | 1013 | rc = iwl_send_cmd_sync(priv, &cmd); |
1265 | if (rc) { | 1014 | if (rc) { |
1266 | clear_bit(STATUS_SCAN_ABORTING, &priv->status); | 1015 | clear_bit(STATUS_SCAN_ABORTING, &priv->status); |
1267 | return rc; | 1016 | return rc; |
@@ -1285,8 +1034,8 @@ static int iwl4965_send_scan_abort(struct iwl4965_priv *priv) | |||
1285 | return rc; | 1034 | return rc; |
1286 | } | 1035 | } |
1287 | 1036 | ||
1288 | static int iwl4965_card_state_sync_callback(struct iwl4965_priv *priv, | 1037 | static int iwl4965_card_state_sync_callback(struct iwl_priv *priv, |
1289 | struct iwl4965_cmd *cmd, | 1038 | struct iwl_cmd *cmd, |
1290 | struct sk_buff *skb) | 1039 | struct sk_buff *skb) |
1291 | { | 1040 | { |
1292 | return 1; | 1041 | return 1; |
@@ -1302,9 +1051,9 @@ static int iwl4965_card_state_sync_callback(struct iwl4965_priv *priv, | |||
1302 | * When in the 'halt' state, the card is shut down and must be fully | 1051 | * When in the 'halt' state, the card is shut down and must be fully |
1303 | * restarted to come back on. | 1052 | * restarted to come back on. |
1304 | */ | 1053 | */ |
1305 | static int iwl4965_send_card_state(struct iwl4965_priv *priv, u32 flags, u8 meta_flag) | 1054 | static int iwl4965_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_flag) |
1306 | { | 1055 | { |
1307 | struct iwl4965_host_cmd cmd = { | 1056 | struct iwl_host_cmd cmd = { |
1308 | .id = REPLY_CARD_STATE_CMD, | 1057 | .id = REPLY_CARD_STATE_CMD, |
1309 | .len = sizeof(u32), | 1058 | .len = sizeof(u32), |
1310 | .data = &flags, | 1059 | .data = &flags, |
@@ -1314,11 +1063,11 @@ static int iwl4965_send_card_state(struct iwl4965_priv *priv, u32 flags, u8 meta | |||
1314 | if (meta_flag & CMD_ASYNC) | 1063 | if (meta_flag & CMD_ASYNC) |
1315 | cmd.meta.u.callback = iwl4965_card_state_sync_callback; | 1064 | cmd.meta.u.callback = iwl4965_card_state_sync_callback; |
1316 | 1065 | ||
1317 | return iwl4965_send_cmd(priv, &cmd); | 1066 | return iwl_send_cmd(priv, &cmd); |
1318 | } | 1067 | } |
1319 | 1068 | ||
1320 | static int iwl4965_add_sta_sync_callback(struct iwl4965_priv *priv, | 1069 | static int iwl4965_add_sta_sync_callback(struct iwl_priv *priv, |
1321 | struct iwl4965_cmd *cmd, struct sk_buff *skb) | 1070 | struct iwl_cmd *cmd, struct sk_buff *skb) |
1322 | { | 1071 | { |
1323 | struct iwl4965_rx_packet *res = NULL; | 1072 | struct iwl4965_rx_packet *res = NULL; |
1324 | 1073 | ||
@@ -1345,12 +1094,12 @@ static int iwl4965_add_sta_sync_callback(struct iwl4965_priv *priv, | |||
1345 | return 1; | 1094 | return 1; |
1346 | } | 1095 | } |
1347 | 1096 | ||
1348 | int iwl4965_send_add_station(struct iwl4965_priv *priv, | 1097 | int iwl4965_send_add_station(struct iwl_priv *priv, |
1349 | struct iwl4965_addsta_cmd *sta, u8 flags) | 1098 | struct iwl4965_addsta_cmd *sta, u8 flags) |
1350 | { | 1099 | { |
1351 | struct iwl4965_rx_packet *res = NULL; | 1100 | struct iwl4965_rx_packet *res = NULL; |
1352 | int rc = 0; | 1101 | int rc = 0; |
1353 | struct iwl4965_host_cmd cmd = { | 1102 | struct iwl_host_cmd cmd = { |
1354 | .id = REPLY_ADD_STA, | 1103 | .id = REPLY_ADD_STA, |
1355 | .len = sizeof(struct iwl4965_addsta_cmd), | 1104 | .len = sizeof(struct iwl4965_addsta_cmd), |
1356 | .meta.flags = flags, | 1105 | .meta.flags = flags, |
@@ -1362,7 +1111,7 @@ int iwl4965_send_add_station(struct iwl4965_priv *priv, | |||
1362 | else | 1111 | else |
1363 | cmd.meta.flags |= CMD_WANT_SKB; | 1112 | cmd.meta.flags |= CMD_WANT_SKB; |
1364 | 1113 | ||
1365 | rc = iwl4965_send_cmd(priv, &cmd); | 1114 | rc = iwl_send_cmd(priv, &cmd); |
1366 | 1115 | ||
1367 | if (rc || (flags & CMD_ASYNC)) | 1116 | if (rc || (flags & CMD_ASYNC)) |
1368 | return rc; | 1117 | return rc; |
@@ -1392,33 +1141,36 @@ int iwl4965_send_add_station(struct iwl4965_priv *priv, | |||
1392 | return rc; | 1141 | return rc; |
1393 | } | 1142 | } |
1394 | 1143 | ||
1395 | static int iwl4965_update_sta_key_info(struct iwl4965_priv *priv, | 1144 | static int iwl4965_set_ccmp_dynamic_key_info(struct iwl_priv *priv, |
1396 | struct ieee80211_key_conf *keyconf, | 1145 | struct ieee80211_key_conf *keyconf, |
1397 | u8 sta_id) | 1146 | u8 sta_id) |
1398 | { | 1147 | { |
1399 | unsigned long flags; | 1148 | unsigned long flags; |
1400 | __le16 key_flags = 0; | 1149 | __le16 key_flags = 0; |
1401 | 1150 | ||
1402 | switch (keyconf->alg) { | 1151 | key_flags |= (STA_KEY_FLG_CCMP | STA_KEY_FLG_MAP_KEY_MSK); |
1403 | case ALG_CCMP: | 1152 | key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); |
1404 | key_flags |= STA_KEY_FLG_CCMP; | 1153 | |
1405 | key_flags |= cpu_to_le16( | 1154 | if (sta_id == priv->hw_setting.bcast_sta_id) |
1406 | keyconf->keyidx << STA_KEY_FLG_KEYID_POS); | 1155 | key_flags |= STA_KEY_MULTICAST_MSK; |
1407 | key_flags &= ~STA_KEY_FLG_INVALID; | 1156 | |
1408 | break; | 1157 | keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; |
1409 | case ALG_TKIP: | 1158 | keyconf->hw_key_idx = keyconf->keyidx; |
1410 | case ALG_WEP: | 1159 | |
1411 | default: | 1160 | key_flags &= ~STA_KEY_FLG_INVALID; |
1412 | return -EINVAL; | 1161 | |
1413 | } | ||
1414 | spin_lock_irqsave(&priv->sta_lock, flags); | 1162 | spin_lock_irqsave(&priv->sta_lock, flags); |
1415 | priv->stations[sta_id].keyinfo.alg = keyconf->alg; | 1163 | priv->stations[sta_id].keyinfo.alg = keyconf->alg; |
1416 | priv->stations[sta_id].keyinfo.keylen = keyconf->keylen; | 1164 | priv->stations[sta_id].keyinfo.keylen = keyconf->keylen; |
1165 | |||
1417 | memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key, | 1166 | memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key, |
1418 | keyconf->keylen); | 1167 | keyconf->keylen); |
1419 | 1168 | ||
1420 | memcpy(priv->stations[sta_id].sta.key.key, keyconf->key, | 1169 | memcpy(priv->stations[sta_id].sta.key.key, keyconf->key, |
1421 | keyconf->keylen); | 1170 | keyconf->keylen); |
1171 | |||
1172 | priv->stations[sta_id].sta.key.key_offset | ||
1173 | = (sta_id % STA_KEY_MAX_NUM);/*FIXME*/ | ||
1422 | priv->stations[sta_id].sta.key.key_flags = key_flags; | 1174 | priv->stations[sta_id].sta.key.key_flags = key_flags; |
1423 | priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; | 1175 | priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; |
1424 | priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; | 1176 | priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; |
@@ -1426,11 +1178,38 @@ static int iwl4965_update_sta_key_info(struct iwl4965_priv *priv, | |||
1426 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 1178 | spin_unlock_irqrestore(&priv->sta_lock, flags); |
1427 | 1179 | ||
1428 | IWL_DEBUG_INFO("hwcrypto: modify ucode station key info\n"); | 1180 | IWL_DEBUG_INFO("hwcrypto: modify ucode station key info\n"); |
1429 | iwl4965_send_add_station(priv, &priv->stations[sta_id].sta, 0); | 1181 | return iwl4965_send_add_station(priv, |
1430 | return 0; | 1182 | &priv->stations[sta_id].sta, CMD_ASYNC); |
1431 | } | 1183 | } |
1432 | 1184 | ||
1433 | static int iwl4965_clear_sta_key_info(struct iwl4965_priv *priv, u8 sta_id) | 1185 | static int iwl4965_set_tkip_dynamic_key_info(struct iwl_priv *priv, |
1186 | struct ieee80211_key_conf *keyconf, | ||
1187 | u8 sta_id) | ||
1188 | { | ||
1189 | unsigned long flags; | ||
1190 | int ret = 0; | ||
1191 | |||
1192 | keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; | ||
1193 | keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; | ||
1194 | keyconf->hw_key_idx = keyconf->keyidx; | ||
1195 | |||
1196 | spin_lock_irqsave(&priv->sta_lock, flags); | ||
1197 | |||
1198 | priv->stations[sta_id].keyinfo.alg = keyconf->alg; | ||
1199 | priv->stations[sta_id].keyinfo.conf = keyconf; | ||
1200 | priv->stations[sta_id].keyinfo.keylen = 16; | ||
1201 | |||
1202 | /* This copy is acutally not needed: we get the key with each TX */ | ||
1203 | memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key, 16); | ||
1204 | |||
1205 | memcpy(priv->stations[sta_id].sta.key.key, keyconf->key, 16); | ||
1206 | |||
1207 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
1208 | |||
1209 | return ret; | ||
1210 | } | ||
1211 | |||
1212 | static int iwl4965_clear_sta_key_info(struct iwl_priv *priv, u8 sta_id) | ||
1434 | { | 1213 | { |
1435 | unsigned long flags; | 1214 | unsigned long flags; |
1436 | 1215 | ||
@@ -1447,7 +1226,47 @@ static int iwl4965_clear_sta_key_info(struct iwl4965_priv *priv, u8 sta_id) | |||
1447 | return 0; | 1226 | return 0; |
1448 | } | 1227 | } |
1449 | 1228 | ||
1450 | static void iwl4965_clear_free_frames(struct iwl4965_priv *priv) | 1229 | static int iwl4965_set_dynamic_key(struct iwl_priv *priv, |
1230 | struct ieee80211_key_conf *key, u8 sta_id) | ||
1231 | { | ||
1232 | int ret; | ||
1233 | |||
1234 | switch (key->alg) { | ||
1235 | case ALG_CCMP: | ||
1236 | ret = iwl4965_set_ccmp_dynamic_key_info(priv, key, sta_id); | ||
1237 | break; | ||
1238 | case ALG_TKIP: | ||
1239 | ret = iwl4965_set_tkip_dynamic_key_info(priv, key, sta_id); | ||
1240 | break; | ||
1241 | case ALG_WEP: | ||
1242 | ret = -EOPNOTSUPP; | ||
1243 | break; | ||
1244 | default: | ||
1245 | IWL_ERROR("Unknown alg: %s alg = %d\n", __func__, key->alg); | ||
1246 | ret = -EINVAL; | ||
1247 | } | ||
1248 | |||
1249 | return ret; | ||
1250 | } | ||
1251 | |||
1252 | static int iwl4965_remove_static_key(struct iwl_priv *priv) | ||
1253 | { | ||
1254 | int ret = -EOPNOTSUPP; | ||
1255 | |||
1256 | return ret; | ||
1257 | } | ||
1258 | |||
1259 | static int iwl4965_set_static_key(struct iwl_priv *priv, | ||
1260 | struct ieee80211_key_conf *key) | ||
1261 | { | ||
1262 | if (key->alg == ALG_WEP) | ||
1263 | return -EOPNOTSUPP; | ||
1264 | |||
1265 | IWL_ERROR("Static key invalid: alg %d\n", key->alg); | ||
1266 | return -EINVAL; | ||
1267 | } | ||
1268 | |||
1269 | static void iwl4965_clear_free_frames(struct iwl_priv *priv) | ||
1451 | { | 1270 | { |
1452 | struct list_head *element; | 1271 | struct list_head *element; |
1453 | 1272 | ||
@@ -1468,7 +1287,7 @@ static void iwl4965_clear_free_frames(struct iwl4965_priv *priv) | |||
1468 | } | 1287 | } |
1469 | } | 1288 | } |
1470 | 1289 | ||
1471 | static struct iwl4965_frame *iwl4965_get_free_frame(struct iwl4965_priv *priv) | 1290 | static struct iwl4965_frame *iwl4965_get_free_frame(struct iwl_priv *priv) |
1472 | { | 1291 | { |
1473 | struct iwl4965_frame *frame; | 1292 | struct iwl4965_frame *frame; |
1474 | struct list_head *element; | 1293 | struct list_head *element; |
@@ -1488,13 +1307,13 @@ static struct iwl4965_frame *iwl4965_get_free_frame(struct iwl4965_priv *priv) | |||
1488 | return list_entry(element, struct iwl4965_frame, list); | 1307 | return list_entry(element, struct iwl4965_frame, list); |
1489 | } | 1308 | } |
1490 | 1309 | ||
1491 | static void iwl4965_free_frame(struct iwl4965_priv *priv, struct iwl4965_frame *frame) | 1310 | static void iwl4965_free_frame(struct iwl_priv *priv, struct iwl4965_frame *frame) |
1492 | { | 1311 | { |
1493 | memset(frame, 0, sizeof(*frame)); | 1312 | memset(frame, 0, sizeof(*frame)); |
1494 | list_add(&frame->list, &priv->free_frames); | 1313 | list_add(&frame->list, &priv->free_frames); |
1495 | } | 1314 | } |
1496 | 1315 | ||
1497 | unsigned int iwl4965_fill_beacon_frame(struct iwl4965_priv *priv, | 1316 | unsigned int iwl4965_fill_beacon_frame(struct iwl_priv *priv, |
1498 | struct ieee80211_hdr *hdr, | 1317 | struct ieee80211_hdr *hdr, |
1499 | const u8 *dest, int left) | 1318 | const u8 *dest, int left) |
1500 | { | 1319 | { |
@@ -1525,7 +1344,7 @@ static u8 iwl4965_rate_get_lowest_plcp(int rate_mask) | |||
1525 | return IWL_RATE_INVALID; | 1344 | return IWL_RATE_INVALID; |
1526 | } | 1345 | } |
1527 | 1346 | ||
1528 | static int iwl4965_send_beacon_cmd(struct iwl4965_priv *priv) | 1347 | static int iwl4965_send_beacon_cmd(struct iwl_priv *priv) |
1529 | { | 1348 | { |
1530 | struct iwl4965_frame *frame; | 1349 | struct iwl4965_frame *frame; |
1531 | unsigned int frame_size; | 1350 | unsigned int frame_size; |
@@ -1553,7 +1372,7 @@ static int iwl4965_send_beacon_cmd(struct iwl4965_priv *priv) | |||
1553 | 1372 | ||
1554 | frame_size = iwl4965_hw_get_beacon_cmd(priv, frame, rate); | 1373 | frame_size = iwl4965_hw_get_beacon_cmd(priv, frame, rate); |
1555 | 1374 | ||
1556 | rc = iwl4965_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size, | 1375 | rc = iwl_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size, |
1557 | &frame->u.cmd[0]); | 1376 | &frame->u.cmd[0]); |
1558 | 1377 | ||
1559 | iwl4965_free_frame(priv, frame); | 1378 | iwl4965_free_frame(priv, frame); |
@@ -1567,7 +1386,7 @@ static int iwl4965_send_beacon_cmd(struct iwl4965_priv *priv) | |||
1567 | * | 1386 | * |
1568 | ******************************************************************************/ | 1387 | ******************************************************************************/ |
1569 | 1388 | ||
1570 | static void iwl4965_unset_hw_setting(struct iwl4965_priv *priv) | 1389 | static void iwl4965_unset_hw_setting(struct iwl_priv *priv) |
1571 | { | 1390 | { |
1572 | if (priv->hw_setting.shared_virt) | 1391 | if (priv->hw_setting.shared_virt) |
1573 | pci_free_consistent(priv->pci_dev, | 1392 | pci_free_consistent(priv->pci_dev, |
@@ -1608,7 +1427,7 @@ static u16 iwl4965_supported_rate_to_ie(u8 *ie, u16 supported_rate, | |||
1608 | /** | 1427 | /** |
1609 | * iwl4965_fill_probe_req - fill in all required fields and IE for probe request | 1428 | * iwl4965_fill_probe_req - fill in all required fields and IE for probe request |
1610 | */ | 1429 | */ |
1611 | static u16 iwl4965_fill_probe_req(struct iwl4965_priv *priv, | 1430 | static u16 iwl4965_fill_probe_req(struct iwl_priv *priv, |
1612 | enum ieee80211_band band, | 1431 | enum ieee80211_band band, |
1613 | struct ieee80211_mgmt *frame, | 1432 | struct ieee80211_mgmt *frame, |
1614 | int left, int is_direct) | 1433 | int left, int is_direct) |
@@ -1726,102 +1545,15 @@ static u16 iwl4965_fill_probe_req(struct iwl4965_priv *priv, | |||
1726 | /* | 1545 | /* |
1727 | * QoS support | 1546 | * QoS support |
1728 | */ | 1547 | */ |
1729 | static int iwl4965_send_qos_params_command(struct iwl4965_priv *priv, | 1548 | static int iwl4965_send_qos_params_command(struct iwl_priv *priv, |
1730 | struct iwl4965_qosparam_cmd *qos) | 1549 | struct iwl4965_qosparam_cmd *qos) |
1731 | { | 1550 | { |
1732 | 1551 | ||
1733 | return iwl4965_send_cmd_pdu(priv, REPLY_QOS_PARAM, | 1552 | return iwl_send_cmd_pdu(priv, REPLY_QOS_PARAM, |
1734 | sizeof(struct iwl4965_qosparam_cmd), qos); | 1553 | sizeof(struct iwl4965_qosparam_cmd), qos); |
1735 | } | 1554 | } |
1736 | 1555 | ||
1737 | static void iwl4965_reset_qos(struct iwl4965_priv *priv) | 1556 | static void iwl4965_activate_qos(struct iwl_priv *priv, u8 force) |
1738 | { | ||
1739 | u16 cw_min = 15; | ||
1740 | u16 cw_max = 1023; | ||
1741 | u8 aifs = 2; | ||
1742 | u8 is_legacy = 0; | ||
1743 | unsigned long flags; | ||
1744 | int i; | ||
1745 | |||
1746 | spin_lock_irqsave(&priv->lock, flags); | ||
1747 | priv->qos_data.qos_active = 0; | ||
1748 | |||
1749 | if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS) { | ||
1750 | if (priv->qos_data.qos_enable) | ||
1751 | priv->qos_data.qos_active = 1; | ||
1752 | if (!(priv->active_rate & 0xfff0)) { | ||
1753 | cw_min = 31; | ||
1754 | is_legacy = 1; | ||
1755 | } | ||
1756 | } else if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { | ||
1757 | if (priv->qos_data.qos_enable) | ||
1758 | priv->qos_data.qos_active = 1; | ||
1759 | } else if (!(priv->staging_rxon.flags & RXON_FLG_SHORT_SLOT_MSK)) { | ||
1760 | cw_min = 31; | ||
1761 | is_legacy = 1; | ||
1762 | } | ||
1763 | |||
1764 | if (priv->qos_data.qos_active) | ||
1765 | aifs = 3; | ||
1766 | |||
1767 | priv->qos_data.def_qos_parm.ac[0].cw_min = cpu_to_le16(cw_min); | ||
1768 | priv->qos_data.def_qos_parm.ac[0].cw_max = cpu_to_le16(cw_max); | ||
1769 | priv->qos_data.def_qos_parm.ac[0].aifsn = aifs; | ||
1770 | priv->qos_data.def_qos_parm.ac[0].edca_txop = 0; | ||
1771 | priv->qos_data.def_qos_parm.ac[0].reserved1 = 0; | ||
1772 | |||
1773 | if (priv->qos_data.qos_active) { | ||
1774 | i = 1; | ||
1775 | priv->qos_data.def_qos_parm.ac[i].cw_min = cpu_to_le16(cw_min); | ||
1776 | priv->qos_data.def_qos_parm.ac[i].cw_max = cpu_to_le16(cw_max); | ||
1777 | priv->qos_data.def_qos_parm.ac[i].aifsn = 7; | ||
1778 | priv->qos_data.def_qos_parm.ac[i].edca_txop = 0; | ||
1779 | priv->qos_data.def_qos_parm.ac[i].reserved1 = 0; | ||
1780 | |||
1781 | i = 2; | ||
1782 | priv->qos_data.def_qos_parm.ac[i].cw_min = | ||
1783 | cpu_to_le16((cw_min + 1) / 2 - 1); | ||
1784 | priv->qos_data.def_qos_parm.ac[i].cw_max = | ||
1785 | cpu_to_le16(cw_max); | ||
1786 | priv->qos_data.def_qos_parm.ac[i].aifsn = 2; | ||
1787 | if (is_legacy) | ||
1788 | priv->qos_data.def_qos_parm.ac[i].edca_txop = | ||
1789 | cpu_to_le16(6016); | ||
1790 | else | ||
1791 | priv->qos_data.def_qos_parm.ac[i].edca_txop = | ||
1792 | cpu_to_le16(3008); | ||
1793 | priv->qos_data.def_qos_parm.ac[i].reserved1 = 0; | ||
1794 | |||
1795 | i = 3; | ||
1796 | priv->qos_data.def_qos_parm.ac[i].cw_min = | ||
1797 | cpu_to_le16((cw_min + 1) / 4 - 1); | ||
1798 | priv->qos_data.def_qos_parm.ac[i].cw_max = | ||
1799 | cpu_to_le16((cw_max + 1) / 2 - 1); | ||
1800 | priv->qos_data.def_qos_parm.ac[i].aifsn = 2; | ||
1801 | priv->qos_data.def_qos_parm.ac[i].reserved1 = 0; | ||
1802 | if (is_legacy) | ||
1803 | priv->qos_data.def_qos_parm.ac[i].edca_txop = | ||
1804 | cpu_to_le16(3264); | ||
1805 | else | ||
1806 | priv->qos_data.def_qos_parm.ac[i].edca_txop = | ||
1807 | cpu_to_le16(1504); | ||
1808 | } else { | ||
1809 | for (i = 1; i < 4; i++) { | ||
1810 | priv->qos_data.def_qos_parm.ac[i].cw_min = | ||
1811 | cpu_to_le16(cw_min); | ||
1812 | priv->qos_data.def_qos_parm.ac[i].cw_max = | ||
1813 | cpu_to_le16(cw_max); | ||
1814 | priv->qos_data.def_qos_parm.ac[i].aifsn = aifs; | ||
1815 | priv->qos_data.def_qos_parm.ac[i].edca_txop = 0; | ||
1816 | priv->qos_data.def_qos_parm.ac[i].reserved1 = 0; | ||
1817 | } | ||
1818 | } | ||
1819 | IWL_DEBUG_QOS("set QoS to default \n"); | ||
1820 | |||
1821 | spin_unlock_irqrestore(&priv->lock, flags); | ||
1822 | } | ||
1823 | |||
1824 | static void iwl4965_activate_qos(struct iwl4965_priv *priv, u8 force) | ||
1825 | { | 1557 | { |
1826 | unsigned long flags; | 1558 | unsigned long flags; |
1827 | 1559 | ||
@@ -1899,7 +1631,7 @@ static struct iwl4965_power_vec_entry range_1[IWL_POWER_AC] = { | |||
1899 | SLP_VEC(4, 7, 10, 10, 0xFF)}, 0} | 1631 | SLP_VEC(4, 7, 10, 10, 0xFF)}, 0} |
1900 | }; | 1632 | }; |
1901 | 1633 | ||
1902 | int iwl4965_power_init_handle(struct iwl4965_priv *priv) | 1634 | int iwl4965_power_init_handle(struct iwl_priv *priv) |
1903 | { | 1635 | { |
1904 | int rc = 0, i; | 1636 | int rc = 0, i; |
1905 | struct iwl4965_power_mgr *pow_data; | 1637 | struct iwl4965_power_mgr *pow_data; |
@@ -1938,7 +1670,7 @@ int iwl4965_power_init_handle(struct iwl4965_priv *priv) | |||
1938 | return rc; | 1670 | return rc; |
1939 | } | 1671 | } |
1940 | 1672 | ||
1941 | static int iwl4965_update_power_cmd(struct iwl4965_priv *priv, | 1673 | static int iwl4965_update_power_cmd(struct iwl_priv *priv, |
1942 | struct iwl4965_powertable_cmd *cmd, u32 mode) | 1674 | struct iwl4965_powertable_cmd *cmd, u32 mode) |
1943 | { | 1675 | { |
1944 | int rc = 0, i; | 1676 | int rc = 0, i; |
@@ -2002,7 +1734,7 @@ static int iwl4965_update_power_cmd(struct iwl4965_priv *priv, | |||
2002 | return rc; | 1734 | return rc; |
2003 | } | 1735 | } |
2004 | 1736 | ||
2005 | static int iwl4965_send_power_mode(struct iwl4965_priv *priv, u32 mode) | 1737 | static int iwl4965_send_power_mode(struct iwl_priv *priv, u32 mode) |
2006 | { | 1738 | { |
2007 | u32 uninitialized_var(final_mode); | 1739 | u32 uninitialized_var(final_mode); |
2008 | int rc; | 1740 | int rc; |
@@ -2027,7 +1759,7 @@ static int iwl4965_send_power_mode(struct iwl4965_priv *priv, u32 mode) | |||
2027 | 1759 | ||
2028 | iwl4965_update_power_cmd(priv, &cmd, final_mode); | 1760 | iwl4965_update_power_cmd(priv, &cmd, final_mode); |
2029 | 1761 | ||
2030 | rc = iwl4965_send_cmd_pdu(priv, POWER_TABLE_CMD, sizeof(cmd), &cmd); | 1762 | rc = iwl_send_cmd_pdu(priv, POWER_TABLE_CMD, sizeof(cmd), &cmd); |
2031 | 1763 | ||
2032 | if (final_mode == IWL_POWER_MODE_CAM) | 1764 | if (final_mode == IWL_POWER_MODE_CAM) |
2033 | clear_bit(STATUS_POWER_PMI, &priv->status); | 1765 | clear_bit(STATUS_POWER_PMI, &priv->status); |
@@ -2037,7 +1769,7 @@ static int iwl4965_send_power_mode(struct iwl4965_priv *priv, u32 mode) | |||
2037 | return rc; | 1769 | return rc; |
2038 | } | 1770 | } |
2039 | 1771 | ||
2040 | int iwl4965_is_network_packet(struct iwl4965_priv *priv, struct ieee80211_hdr *header) | 1772 | int iwl4965_is_network_packet(struct iwl_priv *priv, struct ieee80211_hdr *header) |
2041 | { | 1773 | { |
2042 | /* Filter incoming packets to determine if they are targeted toward | 1774 | /* Filter incoming packets to determine if they are targeted toward |
2043 | * this network, discarding packets coming from ourselves */ | 1775 | * this network, discarding packets coming from ourselves */ |
@@ -2098,7 +1830,7 @@ static const char *iwl4965_get_tx_fail_reason(u32 status) | |||
2098 | * | 1830 | * |
2099 | * NOTE: priv->mutex is not required before calling this function | 1831 | * NOTE: priv->mutex is not required before calling this function |
2100 | */ | 1832 | */ |
2101 | static int iwl4965_scan_cancel(struct iwl4965_priv *priv) | 1833 | static int iwl4965_scan_cancel(struct iwl_priv *priv) |
2102 | { | 1834 | { |
2103 | if (!test_bit(STATUS_SCAN_HW, &priv->status)) { | 1835 | if (!test_bit(STATUS_SCAN_HW, &priv->status)) { |
2104 | clear_bit(STATUS_SCANNING, &priv->status); | 1836 | clear_bit(STATUS_SCANNING, &priv->status); |
@@ -2126,7 +1858,7 @@ static int iwl4965_scan_cancel(struct iwl4965_priv *priv) | |||
2126 | * | 1858 | * |
2127 | * NOTE: priv->mutex must be held before calling this function | 1859 | * NOTE: priv->mutex must be held before calling this function |
2128 | */ | 1860 | */ |
2129 | static int iwl4965_scan_cancel_timeout(struct iwl4965_priv *priv, unsigned long ms) | 1861 | static int iwl4965_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms) |
2130 | { | 1862 | { |
2131 | unsigned long now = jiffies; | 1863 | unsigned long now = jiffies; |
2132 | int ret; | 1864 | int ret; |
@@ -2145,7 +1877,7 @@ static int iwl4965_scan_cancel_timeout(struct iwl4965_priv *priv, unsigned long | |||
2145 | return ret; | 1877 | return ret; |
2146 | } | 1878 | } |
2147 | 1879 | ||
2148 | static void iwl4965_sequence_reset(struct iwl4965_priv *priv) | 1880 | static void iwl4965_sequence_reset(struct iwl_priv *priv) |
2149 | { | 1881 | { |
2150 | /* Reset ieee stats */ | 1882 | /* Reset ieee stats */ |
2151 | 1883 | ||
@@ -2175,7 +1907,7 @@ static __le16 iwl4965_adjust_beacon_interval(u16 beacon_val) | |||
2175 | return cpu_to_le16(new_val); | 1907 | return cpu_to_le16(new_val); |
2176 | } | 1908 | } |
2177 | 1909 | ||
2178 | static void iwl4965_setup_rxon_timing(struct iwl4965_priv *priv) | 1910 | static void iwl4965_setup_rxon_timing(struct iwl_priv *priv) |
2179 | { | 1911 | { |
2180 | u64 interval_tm_unit; | 1912 | u64 interval_tm_unit; |
2181 | u64 tsf, result; | 1913 | u64 tsf, result; |
@@ -2231,7 +1963,7 @@ static void iwl4965_setup_rxon_timing(struct iwl4965_priv *priv) | |||
2231 | le16_to_cpu(priv->rxon_timing.atim_window)); | 1963 | le16_to_cpu(priv->rxon_timing.atim_window)); |
2232 | } | 1964 | } |
2233 | 1965 | ||
2234 | static int iwl4965_scan_initiate(struct iwl4965_priv *priv) | 1966 | static int iwl4965_scan_initiate(struct iwl_priv *priv) |
2235 | { | 1967 | { |
2236 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { | 1968 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { |
2237 | IWL_ERROR("APs don't scan.\n"); | 1969 | IWL_ERROR("APs don't scan.\n"); |
@@ -2265,19 +1997,8 @@ static int iwl4965_scan_initiate(struct iwl4965_priv *priv) | |||
2265 | return 0; | 1997 | return 0; |
2266 | } | 1998 | } |
2267 | 1999 | ||
2268 | static int iwl4965_set_rxon_hwcrypto(struct iwl4965_priv *priv, int hw_decrypt) | ||
2269 | { | ||
2270 | struct iwl4965_rxon_cmd *rxon = &priv->staging_rxon; | ||
2271 | 2000 | ||
2272 | if (hw_decrypt) | 2001 | static void iwl4965_set_flags_for_phymode(struct iwl_priv *priv, |
2273 | rxon->filter_flags &= ~RXON_FILTER_DIS_DECRYPT_MSK; | ||
2274 | else | ||
2275 | rxon->filter_flags |= RXON_FILTER_DIS_DECRYPT_MSK; | ||
2276 | |||
2277 | return 0; | ||
2278 | } | ||
2279 | |||
2280 | static void iwl4965_set_flags_for_phymode(struct iwl4965_priv *priv, | ||
2281 | enum ieee80211_band band) | 2002 | enum ieee80211_band band) |
2282 | { | 2003 | { |
2283 | if (band == IEEE80211_BAND_5GHZ) { | 2004 | if (band == IEEE80211_BAND_5GHZ) { |
@@ -2304,9 +2025,9 @@ static void iwl4965_set_flags_for_phymode(struct iwl4965_priv *priv, | |||
2304 | /* | 2025 | /* |
2305 | * initialize rxon structure with default values from eeprom | 2026 | * initialize rxon structure with default values from eeprom |
2306 | */ | 2027 | */ |
2307 | static void iwl4965_connection_init_rx_config(struct iwl4965_priv *priv) | 2028 | static void iwl4965_connection_init_rx_config(struct iwl_priv *priv) |
2308 | { | 2029 | { |
2309 | const struct iwl4965_channel_info *ch_info; | 2030 | const struct iwl_channel_info *ch_info; |
2310 | 2031 | ||
2311 | memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon)); | 2032 | memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon)); |
2312 | 2033 | ||
@@ -2343,7 +2064,7 @@ static void iwl4965_connection_init_rx_config(struct iwl4965_priv *priv) | |||
2343 | priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; | 2064 | priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; |
2344 | #endif | 2065 | #endif |
2345 | 2066 | ||
2346 | ch_info = iwl4965_get_channel_info(priv, priv->band, | 2067 | ch_info = iwl_get_channel_info(priv, priv->band, |
2347 | le16_to_cpu(priv->staging_rxon.channel)); | 2068 | le16_to_cpu(priv->staging_rxon.channel)); |
2348 | 2069 | ||
2349 | if (!ch_info) | 2070 | if (!ch_info) |
@@ -2376,12 +2097,12 @@ static void iwl4965_connection_init_rx_config(struct iwl4965_priv *priv) | |||
2376 | iwl4965_set_rxon_chain(priv); | 2097 | iwl4965_set_rxon_chain(priv); |
2377 | } | 2098 | } |
2378 | 2099 | ||
2379 | static int iwl4965_set_mode(struct iwl4965_priv *priv, int mode) | 2100 | static int iwl4965_set_mode(struct iwl_priv *priv, int mode) |
2380 | { | 2101 | { |
2381 | if (mode == IEEE80211_IF_TYPE_IBSS) { | 2102 | if (mode == IEEE80211_IF_TYPE_IBSS) { |
2382 | const struct iwl4965_channel_info *ch_info; | 2103 | const struct iwl_channel_info *ch_info; |
2383 | 2104 | ||
2384 | ch_info = iwl4965_get_channel_info(priv, | 2105 | ch_info = iwl_get_channel_info(priv, |
2385 | priv->band, | 2106 | priv->band, |
2386 | le16_to_cpu(priv->staging_rxon.channel)); | 2107 | le16_to_cpu(priv->staging_rxon.channel)); |
2387 | 2108 | ||
@@ -2397,7 +2118,7 @@ static int iwl4965_set_mode(struct iwl4965_priv *priv, int mode) | |||
2397 | iwl4965_connection_init_rx_config(priv); | 2118 | iwl4965_connection_init_rx_config(priv); |
2398 | memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); | 2119 | memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); |
2399 | 2120 | ||
2400 | iwl4965_clear_stations_table(priv); | 2121 | iwlcore_clear_stations_table(priv); |
2401 | 2122 | ||
2402 | /* dont commit rxon if rf-kill is on*/ | 2123 | /* dont commit rxon if rf-kill is on*/ |
2403 | if (!iwl4965_is_ready_rf(priv)) | 2124 | if (!iwl4965_is_ready_rf(priv)) |
@@ -2415,31 +2136,28 @@ static int iwl4965_set_mode(struct iwl4965_priv *priv, int mode) | |||
2415 | return 0; | 2136 | return 0; |
2416 | } | 2137 | } |
2417 | 2138 | ||
2418 | static void iwl4965_build_tx_cmd_hwcrypto(struct iwl4965_priv *priv, | 2139 | static void iwl4965_build_tx_cmd_hwcrypto(struct iwl_priv *priv, |
2419 | struct ieee80211_tx_control *ctl, | 2140 | struct ieee80211_tx_control *ctl, |
2420 | struct iwl4965_cmd *cmd, | 2141 | struct iwl_cmd *cmd, |
2421 | struct sk_buff *skb_frag, | 2142 | struct sk_buff *skb_frag, |
2422 | int last_frag) | 2143 | int sta_id) |
2423 | { | 2144 | { |
2424 | struct iwl4965_hw_key *keyinfo = &priv->stations[ctl->key_idx].keyinfo; | 2145 | struct iwl4965_hw_key *keyinfo = &priv->stations[sta_id].keyinfo; |
2425 | 2146 | ||
2426 | switch (keyinfo->alg) { | 2147 | switch (keyinfo->alg) { |
2427 | case ALG_CCMP: | 2148 | case ALG_CCMP: |
2428 | cmd->cmd.tx.sec_ctl = TX_CMD_SEC_CCM; | 2149 | cmd->cmd.tx.sec_ctl = TX_CMD_SEC_CCM; |
2429 | memcpy(cmd->cmd.tx.key, keyinfo->key, keyinfo->keylen); | 2150 | memcpy(cmd->cmd.tx.key, keyinfo->key, keyinfo->keylen); |
2151 | if (ctl->flags & IEEE80211_TXCTL_AMPDU) | ||
2152 | cmd->cmd.tx.tx_flags |= TX_CMD_FLG_AGG_CCMP_MSK; | ||
2430 | IWL_DEBUG_TX("tx_cmd with aes hwcrypto\n"); | 2153 | IWL_DEBUG_TX("tx_cmd with aes hwcrypto\n"); |
2431 | break; | 2154 | break; |
2432 | 2155 | ||
2433 | case ALG_TKIP: | 2156 | case ALG_TKIP: |
2434 | #if 0 | ||
2435 | cmd->cmd.tx.sec_ctl = TX_CMD_SEC_TKIP; | 2157 | cmd->cmd.tx.sec_ctl = TX_CMD_SEC_TKIP; |
2436 | 2158 | ieee80211_get_tkip_key(keyinfo->conf, skb_frag, | |
2437 | if (last_frag) | 2159 | IEEE80211_TKIP_P2_KEY, cmd->cmd.tx.key); |
2438 | memcpy(cmd->cmd.tx.tkip_mic.byte, skb_frag->tail - 8, | 2160 | IWL_DEBUG_TX("tx_cmd with tkip hwcrypto\n"); |
2439 | 8); | ||
2440 | else | ||
2441 | memset(cmd->cmd.tx.tkip_mic.byte, 0, 8); | ||
2442 | #endif | ||
2443 | break; | 2161 | break; |
2444 | 2162 | ||
2445 | case ALG_WEP: | 2163 | case ALG_WEP: |
@@ -2464,8 +2182,8 @@ static void iwl4965_build_tx_cmd_hwcrypto(struct iwl4965_priv *priv, | |||
2464 | /* | 2182 | /* |
2465 | * handle build REPLY_TX command notification. | 2183 | * handle build REPLY_TX command notification. |
2466 | */ | 2184 | */ |
2467 | static void iwl4965_build_tx_cmd_basic(struct iwl4965_priv *priv, | 2185 | static void iwl4965_build_tx_cmd_basic(struct iwl_priv *priv, |
2468 | struct iwl4965_cmd *cmd, | 2186 | struct iwl_cmd *cmd, |
2469 | struct ieee80211_tx_control *ctrl, | 2187 | struct ieee80211_tx_control *ctrl, |
2470 | struct ieee80211_hdr *hdr, | 2188 | struct ieee80211_hdr *hdr, |
2471 | int is_unicast, u8 std_id) | 2189 | int is_unicast, u8 std_id) |
@@ -2527,13 +2245,19 @@ static void iwl4965_build_tx_cmd_basic(struct iwl4965_priv *priv, | |||
2527 | cmd->cmd.tx.tx_flags = tx_flags; | 2245 | cmd->cmd.tx.tx_flags = tx_flags; |
2528 | cmd->cmd.tx.next_frame_len = 0; | 2246 | cmd->cmd.tx.next_frame_len = 0; |
2529 | } | 2247 | } |
2530 | 2248 | static void iwl_update_tx_stats(struct iwl_priv *priv, u16 fc, u16 len) | |
2249 | { | ||
2250 | /* 0 - mgmt, 1 - cnt, 2 - data */ | ||
2251 | int idx = (fc & IEEE80211_FCTL_FTYPE) >> 2; | ||
2252 | priv->tx_stats[idx].cnt++; | ||
2253 | priv->tx_stats[idx].bytes += len; | ||
2254 | } | ||
2531 | /** | 2255 | /** |
2532 | * iwl4965_get_sta_id - Find station's index within station table | 2256 | * iwl4965_get_sta_id - Find station's index within station table |
2533 | * | 2257 | * |
2534 | * If new IBSS station, create new entry in station table | 2258 | * If new IBSS station, create new entry in station table |
2535 | */ | 2259 | */ |
2536 | static int iwl4965_get_sta_id(struct iwl4965_priv *priv, | 2260 | static int iwl4965_get_sta_id(struct iwl_priv *priv, |
2537 | struct ieee80211_hdr *hdr) | 2261 | struct ieee80211_hdr *hdr) |
2538 | { | 2262 | { |
2539 | int sta_id; | 2263 | int sta_id; |
@@ -2576,7 +2300,7 @@ static int iwl4965_get_sta_id(struct iwl4965_priv *priv, | |||
2576 | IWL_DEBUG_DROP("Station %s not in station map. " | 2300 | IWL_DEBUG_DROP("Station %s not in station map. " |
2577 | "Defaulting to broadcast...\n", | 2301 | "Defaulting to broadcast...\n", |
2578 | print_mac(mac, hdr->addr1)); | 2302 | print_mac(mac, hdr->addr1)); |
2579 | iwl4965_print_hex_dump(IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr)); | 2303 | iwl_print_hex_dump(IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr)); |
2580 | return priv->hw_setting.bcast_sta_id; | 2304 | return priv->hw_setting.bcast_sta_id; |
2581 | 2305 | ||
2582 | default: | 2306 | default: |
@@ -2588,7 +2312,7 @@ static int iwl4965_get_sta_id(struct iwl4965_priv *priv, | |||
2588 | /* | 2312 | /* |
2589 | * start REPLY_TX command process | 2313 | * start REPLY_TX command process |
2590 | */ | 2314 | */ |
2591 | static int iwl4965_tx_skb(struct iwl4965_priv *priv, | 2315 | static int iwl4965_tx_skb(struct iwl_priv *priv, |
2592 | struct sk_buff *skb, struct ieee80211_tx_control *ctl) | 2316 | struct sk_buff *skb, struct ieee80211_tx_control *ctl) |
2593 | { | 2317 | { |
2594 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 2318 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
@@ -2600,7 +2324,7 @@ static int iwl4965_tx_skb(struct iwl4965_priv *priv, | |||
2600 | dma_addr_t phys_addr; | 2324 | dma_addr_t phys_addr; |
2601 | dma_addr_t txcmd_phys; | 2325 | dma_addr_t txcmd_phys; |
2602 | dma_addr_t scratch_phys; | 2326 | dma_addr_t scratch_phys; |
2603 | struct iwl4965_cmd *out_cmd = NULL; | 2327 | struct iwl_cmd *out_cmd = NULL; |
2604 | u16 len, idx, len_org; | 2328 | u16 len, idx, len_org; |
2605 | u8 id, hdr_len, unicast; | 2329 | u8 id, hdr_len, unicast; |
2606 | u8 sta_id; | 2330 | u8 sta_id; |
@@ -2632,7 +2356,7 @@ static int iwl4965_tx_skb(struct iwl4965_priv *priv, | |||
2632 | 2356 | ||
2633 | fc = le16_to_cpu(hdr->frame_control); | 2357 | fc = le16_to_cpu(hdr->frame_control); |
2634 | 2358 | ||
2635 | #ifdef CONFIG_IWL4965_DEBUG | 2359 | #ifdef CONFIG_IWLWIFI_DEBUG |
2636 | if (ieee80211_is_auth(fc)) | 2360 | if (ieee80211_is_auth(fc)) |
2637 | IWL_DEBUG_TX("Sending AUTH frame\n"); | 2361 | IWL_DEBUG_TX("Sending AUTH frame\n"); |
2638 | else if (ieee80211_is_assoc_request(fc)) | 2362 | else if (ieee80211_is_assoc_request(fc)) |
@@ -2729,7 +2453,7 @@ static int iwl4965_tx_skb(struct iwl4965_priv *priv, | |||
2729 | * We'll tell device about this padding later. | 2453 | * We'll tell device about this padding later. |
2730 | */ | 2454 | */ |
2731 | len = priv->hw_setting.tx_cmd_len + | 2455 | len = priv->hw_setting.tx_cmd_len + |
2732 | sizeof(struct iwl4965_cmd_header) + hdr_len; | 2456 | sizeof(struct iwl_cmd_header) + hdr_len; |
2733 | 2457 | ||
2734 | len_org = len; | 2458 | len_org = len; |
2735 | len = (len + 3) & ~3; | 2459 | len = (len + 3) & ~3; |
@@ -2741,15 +2465,15 @@ static int iwl4965_tx_skb(struct iwl4965_priv *priv, | |||
2741 | 2465 | ||
2742 | /* Physical address of this Tx command's header (not MAC header!), | 2466 | /* Physical address of this Tx command's header (not MAC header!), |
2743 | * within command buffer array. */ | 2467 | * within command buffer array. */ |
2744 | txcmd_phys = txq->dma_addr_cmd + sizeof(struct iwl4965_cmd) * idx + | 2468 | txcmd_phys = txq->dma_addr_cmd + sizeof(struct iwl_cmd) * idx + |
2745 | offsetof(struct iwl4965_cmd, hdr); | 2469 | offsetof(struct iwl_cmd, hdr); |
2746 | 2470 | ||
2747 | /* Add buffer containing Tx command and MAC(!) header to TFD's | 2471 | /* Add buffer containing Tx command and MAC(!) header to TFD's |
2748 | * first entry */ | 2472 | * first entry */ |
2749 | iwl4965_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len); | 2473 | iwl4965_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len); |
2750 | 2474 | ||
2751 | if (!(ctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) | 2475 | if (!(ctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) |
2752 | iwl4965_build_tx_cmd_hwcrypto(priv, ctl, out_cmd, skb, 0); | 2476 | iwl4965_build_tx_cmd_hwcrypto(priv, ctl, out_cmd, skb, sta_id); |
2753 | 2477 | ||
2754 | /* Set up TFD's 2nd entry to point directly to remainder of skb, | 2478 | /* Set up TFD's 2nd entry to point directly to remainder of skb, |
2755 | * if any (802.11 null frames have no payload). */ | 2479 | * if any (802.11 null frames have no payload). */ |
@@ -2774,7 +2498,9 @@ static int iwl4965_tx_skb(struct iwl4965_priv *priv, | |||
2774 | /* set is_hcca to 0; it probably will never be implemented */ | 2498 | /* set is_hcca to 0; it probably will never be implemented */ |
2775 | iwl4965_hw_build_tx_cmd_rate(priv, out_cmd, ctl, hdr, sta_id, 0); | 2499 | iwl4965_hw_build_tx_cmd_rate(priv, out_cmd, ctl, hdr, sta_id, 0); |
2776 | 2500 | ||
2777 | scratch_phys = txcmd_phys + sizeof(struct iwl4965_cmd_header) + | 2501 | iwl_update_tx_stats(priv, fc, len); |
2502 | |||
2503 | scratch_phys = txcmd_phys + sizeof(struct iwl_cmd_header) + | ||
2778 | offsetof(struct iwl4965_tx_cmd, scratch); | 2504 | offsetof(struct iwl4965_tx_cmd, scratch); |
2779 | out_cmd->cmd.tx.dram_lsb_ptr = cpu_to_le32(scratch_phys); | 2505 | out_cmd->cmd.tx.dram_lsb_ptr = cpu_to_le32(scratch_phys); |
2780 | out_cmd->cmd.tx.dram_msb_ptr = iwl_get_dma_hi_address(scratch_phys); | 2506 | out_cmd->cmd.tx.dram_msb_ptr = iwl_get_dma_hi_address(scratch_phys); |
@@ -2790,10 +2516,10 @@ static int iwl4965_tx_skb(struct iwl4965_priv *priv, | |||
2790 | txq->need_update = 0; | 2516 | txq->need_update = 0; |
2791 | } | 2517 | } |
2792 | 2518 | ||
2793 | iwl4965_print_hex_dump(IWL_DL_TX, out_cmd->cmd.payload, | 2519 | iwl_print_hex_dump(IWL_DL_TX, out_cmd->cmd.payload, |
2794 | sizeof(out_cmd->cmd.tx)); | 2520 | sizeof(out_cmd->cmd.tx)); |
2795 | 2521 | ||
2796 | iwl4965_print_hex_dump(IWL_DL_TX, (u8 *)out_cmd->cmd.tx.hdr, | 2522 | iwl_print_hex_dump(IWL_DL_TX, (u8 *)out_cmd->cmd.tx.hdr, |
2797 | ieee80211_get_hdrlen(fc)); | 2523 | ieee80211_get_hdrlen(fc)); |
2798 | 2524 | ||
2799 | /* Set up entry for this TFD in Tx byte-count array */ | 2525 | /* Set up entry for this TFD in Tx byte-count array */ |
@@ -2827,7 +2553,7 @@ drop: | |||
2827 | return -1; | 2553 | return -1; |
2828 | } | 2554 | } |
2829 | 2555 | ||
2830 | static void iwl4965_set_rate(struct iwl4965_priv *priv) | 2556 | static void iwl4965_set_rate(struct iwl_priv *priv) |
2831 | { | 2557 | { |
2832 | const struct ieee80211_supported_band *hw = NULL; | 2558 | const struct ieee80211_supported_band *hw = NULL; |
2833 | struct ieee80211_rate *rate; | 2559 | struct ieee80211_rate *rate; |
@@ -2874,7 +2600,7 @@ static void iwl4965_set_rate(struct iwl4965_priv *priv) | |||
2874 | (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; | 2600 | (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; |
2875 | } | 2601 | } |
2876 | 2602 | ||
2877 | static void iwl4965_radio_kill_sw(struct iwl4965_priv *priv, int disable_radio) | 2603 | static void iwl4965_radio_kill_sw(struct iwl_priv *priv, int disable_radio) |
2878 | { | 2604 | { |
2879 | unsigned long flags; | 2605 | unsigned long flags; |
2880 | 2606 | ||
@@ -2923,7 +2649,7 @@ static void iwl4965_radio_kill_sw(struct iwl4965_priv *priv, int disable_radio) | |||
2923 | return; | 2649 | return; |
2924 | } | 2650 | } |
2925 | 2651 | ||
2926 | void iwl4965_set_decrypted_flag(struct iwl4965_priv *priv, struct sk_buff *skb, | 2652 | void iwl4965_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb, |
2927 | u32 decrypt_res, struct ieee80211_rx_status *stats) | 2653 | u32 decrypt_res, struct ieee80211_rx_status *stats) |
2928 | { | 2654 | { |
2929 | u16 fc = | 2655 | u16 fc = |
@@ -2938,6 +2664,12 @@ void iwl4965_set_decrypted_flag(struct iwl4965_priv *priv, struct sk_buff *skb, | |||
2938 | IWL_DEBUG_RX("decrypt_res:0x%x\n", decrypt_res); | 2664 | IWL_DEBUG_RX("decrypt_res:0x%x\n", decrypt_res); |
2939 | switch (decrypt_res & RX_RES_STATUS_SEC_TYPE_MSK) { | 2665 | switch (decrypt_res & RX_RES_STATUS_SEC_TYPE_MSK) { |
2940 | case RX_RES_STATUS_SEC_TYPE_TKIP: | 2666 | case RX_RES_STATUS_SEC_TYPE_TKIP: |
2667 | /* The uCode has got a bad phase 1 Key, pushes the packet. | ||
2668 | * Decryption will be done in SW. */ | ||
2669 | if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) == | ||
2670 | RX_RES_STATUS_BAD_KEY_TTAK) | ||
2671 | break; | ||
2672 | |||
2941 | if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) == | 2673 | if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) == |
2942 | RX_RES_STATUS_BAD_ICV_MIC) | 2674 | RX_RES_STATUS_BAD_ICV_MIC) |
2943 | stats->flag |= RX_FLAG_MMIC_ERROR; | 2675 | stats->flag |= RX_FLAG_MMIC_ERROR; |
@@ -2958,7 +2690,7 @@ void iwl4965_set_decrypted_flag(struct iwl4965_priv *priv, struct sk_buff *skb, | |||
2958 | 2690 | ||
2959 | #define IWL_PACKET_RETRY_TIME HZ | 2691 | #define IWL_PACKET_RETRY_TIME HZ |
2960 | 2692 | ||
2961 | int iwl4965_is_duplicate_packet(struct iwl4965_priv *priv, struct ieee80211_hdr *header) | 2693 | int iwl4965_is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr *header) |
2962 | { | 2694 | { |
2963 | u16 sc = le16_to_cpu(header->seq_ctrl); | 2695 | u16 sc = le16_to_cpu(header->seq_ctrl); |
2964 | u16 seq = (sc & IEEE80211_SCTL_SEQ) >> 4; | 2696 | u16 seq = (sc & IEEE80211_SCTL_SEQ) >> 4; |
@@ -3075,13 +2807,13 @@ static __le32 iwl4965_add_beacon_time(u32 base, u32 addon, u32 beacon_interval) | |||
3075 | return cpu_to_le32(res); | 2807 | return cpu_to_le32(res); |
3076 | } | 2808 | } |
3077 | 2809 | ||
3078 | static int iwl4965_get_measurement(struct iwl4965_priv *priv, | 2810 | static int iwl4965_get_measurement(struct iwl_priv *priv, |
3079 | struct ieee80211_measurement_params *params, | 2811 | struct ieee80211_measurement_params *params, |
3080 | u8 type) | 2812 | u8 type) |
3081 | { | 2813 | { |
3082 | struct iwl4965_spectrum_cmd spectrum; | 2814 | struct iwl4965_spectrum_cmd spectrum; |
3083 | struct iwl4965_rx_packet *res; | 2815 | struct iwl4965_rx_packet *res; |
3084 | struct iwl4965_host_cmd cmd = { | 2816 | struct iwl_host_cmd cmd = { |
3085 | .id = REPLY_SPECTRUM_MEASUREMENT_CMD, | 2817 | .id = REPLY_SPECTRUM_MEASUREMENT_CMD, |
3086 | .data = (void *)&spectrum, | 2818 | .data = (void *)&spectrum, |
3087 | .meta.flags = CMD_WANT_SKB, | 2819 | .meta.flags = CMD_WANT_SKB, |
@@ -3121,7 +2853,7 @@ static int iwl4965_get_measurement(struct iwl4965_priv *priv, | |||
3121 | spectrum.flags |= RXON_FLG_BAND_24G_MSK | | 2853 | spectrum.flags |= RXON_FLG_BAND_24G_MSK | |
3122 | RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK; | 2854 | RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK; |
3123 | 2855 | ||
3124 | rc = iwl4965_send_cmd_sync(priv, &cmd); | 2856 | rc = iwl_send_cmd_sync(priv, &cmd); |
3125 | if (rc) | 2857 | if (rc) |
3126 | return rc; | 2858 | return rc; |
3127 | 2859 | ||
@@ -3155,7 +2887,7 @@ static int iwl4965_get_measurement(struct iwl4965_priv *priv, | |||
3155 | } | 2887 | } |
3156 | #endif | 2888 | #endif |
3157 | 2889 | ||
3158 | static void iwl4965_txstatus_to_ieee(struct iwl4965_priv *priv, | 2890 | static void iwl4965_txstatus_to_ieee(struct iwl_priv *priv, |
3159 | struct iwl4965_tx_info *tx_sta) | 2891 | struct iwl4965_tx_info *tx_sta) |
3160 | { | 2892 | { |
3161 | 2893 | ||
@@ -3181,7 +2913,7 @@ static void iwl4965_txstatus_to_ieee(struct iwl4965_priv *priv, | |||
3181 | * need to be reclaimed. As result, some free space forms. If there is | 2913 | * need to be reclaimed. As result, some free space forms. If there is |
3182 | * enough free space (> low mark), wake the stack that feeds us. | 2914 | * enough free space (> low mark), wake the stack that feeds us. |
3183 | */ | 2915 | */ |
3184 | int iwl4965_tx_queue_reclaim(struct iwl4965_priv *priv, int txq_id, int index) | 2916 | int iwl4965_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) |
3185 | { | 2917 | { |
3186 | struct iwl4965_tx_queue *txq = &priv->txq[txq_id]; | 2918 | struct iwl4965_tx_queue *txq = &priv->txq[txq_id]; |
3187 | struct iwl4965_queue *q = &txq->q; | 2919 | struct iwl4965_queue *q = &txq->q; |
@@ -3232,7 +2964,7 @@ static int iwl4965_is_tx_success(u32 status) | |||
3232 | ******************************************************************************/ | 2964 | ******************************************************************************/ |
3233 | #ifdef CONFIG_IWL4965_HT | 2965 | #ifdef CONFIG_IWL4965_HT |
3234 | 2966 | ||
3235 | static inline int iwl4965_get_ra_sta_id(struct iwl4965_priv *priv, | 2967 | static inline int iwl4965_get_ra_sta_id(struct iwl_priv *priv, |
3236 | struct ieee80211_hdr *hdr) | 2968 | struct ieee80211_hdr *hdr) |
3237 | { | 2969 | { |
3238 | if (priv->iw_mode == IEEE80211_IF_TYPE_STA) | 2970 | if (priv->iw_mode == IEEE80211_IF_TYPE_STA) |
@@ -3244,7 +2976,7 @@ static inline int iwl4965_get_ra_sta_id(struct iwl4965_priv *priv, | |||
3244 | } | 2976 | } |
3245 | 2977 | ||
3246 | static struct ieee80211_hdr *iwl4965_tx_queue_get_hdr( | 2978 | static struct ieee80211_hdr *iwl4965_tx_queue_get_hdr( |
3247 | struct iwl4965_priv *priv, int txq_id, int idx) | 2979 | struct iwl_priv *priv, int txq_id, int idx) |
3248 | { | 2980 | { |
3249 | if (priv->txq[txq_id].txb[idx].skb[0]) | 2981 | if (priv->txq[txq_id].txb[idx].skb[0]) |
3250 | return (struct ieee80211_hdr *)priv->txq[txq_id]. | 2982 | return (struct ieee80211_hdr *)priv->txq[txq_id]. |
@@ -3263,7 +2995,7 @@ static inline u32 iwl4965_get_scd_ssn(struct iwl4965_tx_resp *tx_resp) | |||
3263 | /** | 2995 | /** |
3264 | * iwl4965_tx_status_reply_tx - Handle Tx rspnse for frames in aggregation queue | 2996 | * iwl4965_tx_status_reply_tx - Handle Tx rspnse for frames in aggregation queue |
3265 | */ | 2997 | */ |
3266 | static int iwl4965_tx_status_reply_tx(struct iwl4965_priv *priv, | 2998 | static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, |
3267 | struct iwl4965_ht_agg *agg, | 2999 | struct iwl4965_ht_agg *agg, |
3268 | struct iwl4965_tx_resp_agg *tx_resp, | 3000 | struct iwl4965_tx_resp_agg *tx_resp, |
3269 | u16 start_idx) | 3001 | u16 start_idx) |
@@ -3384,7 +3116,7 @@ static int iwl4965_tx_status_reply_tx(struct iwl4965_priv *priv, | |||
3384 | /** | 3116 | /** |
3385 | * iwl4965_rx_reply_tx - Handle standard (non-aggregation) Tx response | 3117 | * iwl4965_rx_reply_tx - Handle standard (non-aggregation) Tx response |
3386 | */ | 3118 | */ |
3387 | static void iwl4965_rx_reply_tx(struct iwl4965_priv *priv, | 3119 | static void iwl4965_rx_reply_tx(struct iwl_priv *priv, |
3388 | struct iwl4965_rx_mem_buffer *rxb) | 3120 | struct iwl4965_rx_mem_buffer *rxb) |
3389 | { | 3121 | { |
3390 | struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; | 3122 | struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; |
@@ -3495,7 +3227,7 @@ static void iwl4965_rx_reply_tx(struct iwl4965_priv *priv, | |||
3495 | } | 3227 | } |
3496 | 3228 | ||
3497 | 3229 | ||
3498 | static void iwl4965_rx_reply_alive(struct iwl4965_priv *priv, | 3230 | static void iwl4965_rx_reply_alive(struct iwl_priv *priv, |
3499 | struct iwl4965_rx_mem_buffer *rxb) | 3231 | struct iwl4965_rx_mem_buffer *rxb) |
3500 | { | 3232 | { |
3501 | struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; | 3233 | struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; |
@@ -3531,7 +3263,7 @@ static void iwl4965_rx_reply_alive(struct iwl4965_priv *priv, | |||
3531 | IWL_WARNING("uCode did not respond OK.\n"); | 3263 | IWL_WARNING("uCode did not respond OK.\n"); |
3532 | } | 3264 | } |
3533 | 3265 | ||
3534 | static void iwl4965_rx_reply_add_sta(struct iwl4965_priv *priv, | 3266 | static void iwl4965_rx_reply_add_sta(struct iwl_priv *priv, |
3535 | struct iwl4965_rx_mem_buffer *rxb) | 3267 | struct iwl4965_rx_mem_buffer *rxb) |
3536 | { | 3268 | { |
3537 | struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; | 3269 | struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; |
@@ -3540,7 +3272,7 @@ static void iwl4965_rx_reply_add_sta(struct iwl4965_priv *priv, | |||
3540 | return; | 3272 | return; |
3541 | } | 3273 | } |
3542 | 3274 | ||
3543 | static void iwl4965_rx_reply_error(struct iwl4965_priv *priv, | 3275 | static void iwl4965_rx_reply_error(struct iwl_priv *priv, |
3544 | struct iwl4965_rx_mem_buffer *rxb) | 3276 | struct iwl4965_rx_mem_buffer *rxb) |
3545 | { | 3277 | { |
3546 | struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; | 3278 | struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; |
@@ -3556,7 +3288,7 @@ static void iwl4965_rx_reply_error(struct iwl4965_priv *priv, | |||
3556 | 3288 | ||
3557 | #define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x | 3289 | #define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x |
3558 | 3290 | ||
3559 | static void iwl4965_rx_csa(struct iwl4965_priv *priv, struct iwl4965_rx_mem_buffer *rxb) | 3291 | static void iwl4965_rx_csa(struct iwl_priv *priv, struct iwl4965_rx_mem_buffer *rxb) |
3560 | { | 3292 | { |
3561 | struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; | 3293 | struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; |
3562 | struct iwl4965_rxon_cmd *rxon = (void *)&priv->active_rxon; | 3294 | struct iwl4965_rxon_cmd *rxon = (void *)&priv->active_rxon; |
@@ -3567,7 +3299,7 @@ static void iwl4965_rx_csa(struct iwl4965_priv *priv, struct iwl4965_rx_mem_buff | |||
3567 | priv->staging_rxon.channel = csa->channel; | 3299 | priv->staging_rxon.channel = csa->channel; |
3568 | } | 3300 | } |
3569 | 3301 | ||
3570 | static void iwl4965_rx_spectrum_measure_notif(struct iwl4965_priv *priv, | 3302 | static void iwl4965_rx_spectrum_measure_notif(struct iwl_priv *priv, |
3571 | struct iwl4965_rx_mem_buffer *rxb) | 3303 | struct iwl4965_rx_mem_buffer *rxb) |
3572 | { | 3304 | { |
3573 | #ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT | 3305 | #ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT |
@@ -3585,10 +3317,10 @@ static void iwl4965_rx_spectrum_measure_notif(struct iwl4965_priv *priv, | |||
3585 | #endif | 3317 | #endif |
3586 | } | 3318 | } |
3587 | 3319 | ||
3588 | static void iwl4965_rx_pm_sleep_notif(struct iwl4965_priv *priv, | 3320 | static void iwl4965_rx_pm_sleep_notif(struct iwl_priv *priv, |
3589 | struct iwl4965_rx_mem_buffer *rxb) | 3321 | struct iwl4965_rx_mem_buffer *rxb) |
3590 | { | 3322 | { |
3591 | #ifdef CONFIG_IWL4965_DEBUG | 3323 | #ifdef CONFIG_IWLWIFI_DEBUG |
3592 | struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; | 3324 | struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; |
3593 | struct iwl4965_sleep_notification *sleep = &(pkt->u.sleep_notif); | 3325 | struct iwl4965_sleep_notification *sleep = &(pkt->u.sleep_notif); |
3594 | IWL_DEBUG_RX("sleep mode: %d, src: %d\n", | 3326 | IWL_DEBUG_RX("sleep mode: %d, src: %d\n", |
@@ -3596,20 +3328,20 @@ static void iwl4965_rx_pm_sleep_notif(struct iwl4965_priv *priv, | |||
3596 | #endif | 3328 | #endif |
3597 | } | 3329 | } |
3598 | 3330 | ||
3599 | static void iwl4965_rx_pm_debug_statistics_notif(struct iwl4965_priv *priv, | 3331 | static void iwl4965_rx_pm_debug_statistics_notif(struct iwl_priv *priv, |
3600 | struct iwl4965_rx_mem_buffer *rxb) | 3332 | struct iwl4965_rx_mem_buffer *rxb) |
3601 | { | 3333 | { |
3602 | struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; | 3334 | struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; |
3603 | IWL_DEBUG_RADIO("Dumping %d bytes of unhandled " | 3335 | IWL_DEBUG_RADIO("Dumping %d bytes of unhandled " |
3604 | "notification for %s:\n", | 3336 | "notification for %s:\n", |
3605 | le32_to_cpu(pkt->len), get_cmd_string(pkt->hdr.cmd)); | 3337 | le32_to_cpu(pkt->len), get_cmd_string(pkt->hdr.cmd)); |
3606 | iwl4965_print_hex_dump(IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len)); | 3338 | iwl_print_hex_dump(IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len)); |
3607 | } | 3339 | } |
3608 | 3340 | ||
3609 | static void iwl4965_bg_beacon_update(struct work_struct *work) | 3341 | static void iwl4965_bg_beacon_update(struct work_struct *work) |
3610 | { | 3342 | { |
3611 | struct iwl4965_priv *priv = | 3343 | struct iwl_priv *priv = |
3612 | container_of(work, struct iwl4965_priv, beacon_update); | 3344 | container_of(work, struct iwl_priv, beacon_update); |
3613 | struct sk_buff *beacon; | 3345 | struct sk_buff *beacon; |
3614 | 3346 | ||
3615 | /* Pull updated AP beacon from mac80211. will fail if not in AP mode */ | 3347 | /* Pull updated AP beacon from mac80211. will fail if not in AP mode */ |
@@ -3631,10 +3363,10 @@ static void iwl4965_bg_beacon_update(struct work_struct *work) | |||
3631 | iwl4965_send_beacon_cmd(priv); | 3363 | iwl4965_send_beacon_cmd(priv); |
3632 | } | 3364 | } |
3633 | 3365 | ||
3634 | static void iwl4965_rx_beacon_notif(struct iwl4965_priv *priv, | 3366 | static void iwl4965_rx_beacon_notif(struct iwl_priv *priv, |
3635 | struct iwl4965_rx_mem_buffer *rxb) | 3367 | struct iwl4965_rx_mem_buffer *rxb) |
3636 | { | 3368 | { |
3637 | #ifdef CONFIG_IWL4965_DEBUG | 3369 | #ifdef CONFIG_IWLWIFI_DEBUG |
3638 | struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; | 3370 | struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; |
3639 | struct iwl4965_beacon_notif *beacon = &(pkt->u.beacon_status); | 3371 | struct iwl4965_beacon_notif *beacon = &(pkt->u.beacon_status); |
3640 | u8 rate = iwl4965_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags); | 3372 | u8 rate = iwl4965_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags); |
@@ -3654,10 +3386,10 @@ static void iwl4965_rx_beacon_notif(struct iwl4965_priv *priv, | |||
3654 | } | 3386 | } |
3655 | 3387 | ||
3656 | /* Service response to REPLY_SCAN_CMD (0x80) */ | 3388 | /* Service response to REPLY_SCAN_CMD (0x80) */ |
3657 | static void iwl4965_rx_reply_scan(struct iwl4965_priv *priv, | 3389 | static void iwl4965_rx_reply_scan(struct iwl_priv *priv, |
3658 | struct iwl4965_rx_mem_buffer *rxb) | 3390 | struct iwl4965_rx_mem_buffer *rxb) |
3659 | { | 3391 | { |
3660 | #ifdef CONFIG_IWL4965_DEBUG | 3392 | #ifdef CONFIG_IWLWIFI_DEBUG |
3661 | struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; | 3393 | struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; |
3662 | struct iwl4965_scanreq_notification *notif = | 3394 | struct iwl4965_scanreq_notification *notif = |
3663 | (struct iwl4965_scanreq_notification *)pkt->u.raw; | 3395 | (struct iwl4965_scanreq_notification *)pkt->u.raw; |
@@ -3667,7 +3399,7 @@ static void iwl4965_rx_reply_scan(struct iwl4965_priv *priv, | |||
3667 | } | 3399 | } |
3668 | 3400 | ||
3669 | /* Service SCAN_START_NOTIFICATION (0x82) */ | 3401 | /* Service SCAN_START_NOTIFICATION (0x82) */ |
3670 | static void iwl4965_rx_scan_start_notif(struct iwl4965_priv *priv, | 3402 | static void iwl4965_rx_scan_start_notif(struct iwl_priv *priv, |
3671 | struct iwl4965_rx_mem_buffer *rxb) | 3403 | struct iwl4965_rx_mem_buffer *rxb) |
3672 | { | 3404 | { |
3673 | struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; | 3405 | struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; |
@@ -3684,7 +3416,7 @@ static void iwl4965_rx_scan_start_notif(struct iwl4965_priv *priv, | |||
3684 | } | 3416 | } |
3685 | 3417 | ||
3686 | /* Service SCAN_RESULTS_NOTIFICATION (0x83) */ | 3418 | /* Service SCAN_RESULTS_NOTIFICATION (0x83) */ |
3687 | static void iwl4965_rx_scan_results_notif(struct iwl4965_priv *priv, | 3419 | static void iwl4965_rx_scan_results_notif(struct iwl_priv *priv, |
3688 | struct iwl4965_rx_mem_buffer *rxb) | 3420 | struct iwl4965_rx_mem_buffer *rxb) |
3689 | { | 3421 | { |
3690 | struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; | 3422 | struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; |
@@ -3709,7 +3441,7 @@ static void iwl4965_rx_scan_results_notif(struct iwl4965_priv *priv, | |||
3709 | } | 3441 | } |
3710 | 3442 | ||
3711 | /* Service SCAN_COMPLETE_NOTIFICATION (0x84) */ | 3443 | /* Service SCAN_COMPLETE_NOTIFICATION (0x84) */ |
3712 | static void iwl4965_rx_scan_complete_notif(struct iwl4965_priv *priv, | 3444 | static void iwl4965_rx_scan_complete_notif(struct iwl_priv *priv, |
3713 | struct iwl4965_rx_mem_buffer *rxb) | 3445 | struct iwl4965_rx_mem_buffer *rxb) |
3714 | { | 3446 | { |
3715 | struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; | 3447 | struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; |
@@ -3767,7 +3499,7 @@ reschedule: | |||
3767 | 3499 | ||
3768 | /* Handle notification from uCode that card's power state is changing | 3500 | /* Handle notification from uCode that card's power state is changing |
3769 | * due to software, hardware, or critical temperature RFKILL */ | 3501 | * due to software, hardware, or critical temperature RFKILL */ |
3770 | static void iwl4965_rx_card_state_notif(struct iwl4965_priv *priv, | 3502 | static void iwl4965_rx_card_state_notif(struct iwl_priv *priv, |
3771 | struct iwl4965_rx_mem_buffer *rxb) | 3503 | struct iwl4965_rx_mem_buffer *rxb) |
3772 | { | 3504 | { |
3773 | struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; | 3505 | struct iwl4965_rx_packet *pkt = (void *)rxb->skb->data; |
@@ -3845,7 +3577,7 @@ static void iwl4965_rx_card_state_notif(struct iwl4965_priv *priv, | |||
3845 | * This function chains into the hardware specific files for them to setup | 3577 | * This function chains into the hardware specific files for them to setup |
3846 | * any hardware specific handlers as well. | 3578 | * any hardware specific handlers as well. |
3847 | */ | 3579 | */ |
3848 | static void iwl4965_setup_rx_handlers(struct iwl4965_priv *priv) | 3580 | static void iwl4965_setup_rx_handlers(struct iwl_priv *priv) |
3849 | { | 3581 | { |
3850 | priv->rx_handlers[REPLY_ALIVE] = iwl4965_rx_reply_alive; | 3582 | priv->rx_handlers[REPLY_ALIVE] = iwl4965_rx_reply_alive; |
3851 | priv->rx_handlers[REPLY_ADD_STA] = iwl4965_rx_reply_add_sta; | 3583 | priv->rx_handlers[REPLY_ADD_STA] = iwl4965_rx_reply_add_sta; |
@@ -3887,7 +3619,7 @@ static void iwl4965_setup_rx_handlers(struct iwl4965_priv *priv) | |||
3887 | * will be executed. The attached skb (if present) will only be freed | 3619 | * will be executed. The attached skb (if present) will only be freed |
3888 | * if the callback returns 1 | 3620 | * if the callback returns 1 |
3889 | */ | 3621 | */ |
3890 | static void iwl4965_tx_cmd_complete(struct iwl4965_priv *priv, | 3622 | static void iwl4965_tx_cmd_complete(struct iwl_priv *priv, |
3891 | struct iwl4965_rx_mem_buffer *rxb) | 3623 | struct iwl4965_rx_mem_buffer *rxb) |
3892 | { | 3624 | { |
3893 | struct iwl4965_rx_packet *pkt = (struct iwl4965_rx_packet *)rxb->skb->data; | 3625 | struct iwl4965_rx_packet *pkt = (struct iwl4965_rx_packet *)rxb->skb->data; |
@@ -3896,7 +3628,7 @@ static void iwl4965_tx_cmd_complete(struct iwl4965_priv *priv, | |||
3896 | int index = SEQ_TO_INDEX(sequence); | 3628 | int index = SEQ_TO_INDEX(sequence); |
3897 | int huge = sequence & SEQ_HUGE_FRAME; | 3629 | int huge = sequence & SEQ_HUGE_FRAME; |
3898 | int cmd_index; | 3630 | int cmd_index; |
3899 | struct iwl4965_cmd *cmd; | 3631 | struct iwl_cmd *cmd; |
3900 | 3632 | ||
3901 | /* If a Tx command is being handled and it isn't in the actual | 3633 | /* If a Tx command is being handled and it isn't in the actual |
3902 | * command queue then there a command routing bug has been introduced | 3634 | * command queue then there a command routing bug has been introduced |
@@ -4010,7 +3742,7 @@ static int iwl4965_rx_queue_space(const struct iwl4965_rx_queue *q) | |||
4010 | /** | 3742 | /** |
4011 | * iwl4965_rx_queue_update_write_ptr - Update the write pointer for the RX queue | 3743 | * iwl4965_rx_queue_update_write_ptr - Update the write pointer for the RX queue |
4012 | */ | 3744 | */ |
4013 | int iwl4965_rx_queue_update_write_ptr(struct iwl4965_priv *priv, struct iwl4965_rx_queue *q) | 3745 | int iwl4965_rx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl4965_rx_queue *q) |
4014 | { | 3746 | { |
4015 | u32 reg = 0; | 3747 | u32 reg = 0; |
4016 | int rc = 0; | 3748 | int rc = 0; |
@@ -4056,7 +3788,7 @@ int iwl4965_rx_queue_update_write_ptr(struct iwl4965_priv *priv, struct iwl4965_ | |||
4056 | /** | 3788 | /** |
4057 | * iwl4965_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer ptr | 3789 | * iwl4965_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer ptr |
4058 | */ | 3790 | */ |
4059 | static inline __le32 iwl4965_dma_addr2rbd_ptr(struct iwl4965_priv *priv, | 3791 | static inline __le32 iwl4965_dma_addr2rbd_ptr(struct iwl_priv *priv, |
4060 | dma_addr_t dma_addr) | 3792 | dma_addr_t dma_addr) |
4061 | { | 3793 | { |
4062 | return cpu_to_le32((u32)(dma_addr >> 8)); | 3794 | return cpu_to_le32((u32)(dma_addr >> 8)); |
@@ -4074,7 +3806,7 @@ static inline __le32 iwl4965_dma_addr2rbd_ptr(struct iwl4965_priv *priv, | |||
4074 | * also updates the memory address in the firmware to reference the new | 3806 | * also updates the memory address in the firmware to reference the new |
4075 | * target buffer. | 3807 | * target buffer. |
4076 | */ | 3808 | */ |
4077 | static int iwl4965_rx_queue_restock(struct iwl4965_priv *priv) | 3809 | static int iwl4965_rx_queue_restock(struct iwl_priv *priv) |
4078 | { | 3810 | { |
4079 | struct iwl4965_rx_queue *rxq = &priv->rxq; | 3811 | struct iwl4965_rx_queue *rxq = &priv->rxq; |
4080 | struct list_head *element; | 3812 | struct list_head *element; |
@@ -4126,7 +3858,7 @@ static int iwl4965_rx_queue_restock(struct iwl4965_priv *priv) | |||
4126 | * Also restock the Rx queue via iwl4965_rx_queue_restock. | 3858 | * Also restock the Rx queue via iwl4965_rx_queue_restock. |
4127 | * This is called as a scheduled work item (except for during initialization) | 3859 | * This is called as a scheduled work item (except for during initialization) |
4128 | */ | 3860 | */ |
4129 | static void iwl4965_rx_allocate(struct iwl4965_priv *priv) | 3861 | static void iwl4965_rx_allocate(struct iwl_priv *priv) |
4130 | { | 3862 | { |
4131 | struct iwl4965_rx_queue *rxq = &priv->rxq; | 3863 | struct iwl4965_rx_queue *rxq = &priv->rxq; |
4132 | struct list_head *element; | 3864 | struct list_head *element; |
@@ -4168,7 +3900,7 @@ static void iwl4965_rx_allocate(struct iwl4965_priv *priv) | |||
4168 | */ | 3900 | */ |
4169 | static void __iwl4965_rx_replenish(void *data) | 3901 | static void __iwl4965_rx_replenish(void *data) |
4170 | { | 3902 | { |
4171 | struct iwl4965_priv *priv = data; | 3903 | struct iwl_priv *priv = data; |
4172 | 3904 | ||
4173 | iwl4965_rx_allocate(priv); | 3905 | iwl4965_rx_allocate(priv); |
4174 | iwl4965_rx_queue_restock(priv); | 3906 | iwl4965_rx_queue_restock(priv); |
@@ -4177,7 +3909,7 @@ static void __iwl4965_rx_replenish(void *data) | |||
4177 | 3909 | ||
4178 | void iwl4965_rx_replenish(void *data) | 3910 | void iwl4965_rx_replenish(void *data) |
4179 | { | 3911 | { |
4180 | struct iwl4965_priv *priv = data; | 3912 | struct iwl_priv *priv = data; |
4181 | unsigned long flags; | 3913 | unsigned long flags; |
4182 | 3914 | ||
4183 | iwl4965_rx_allocate(priv); | 3915 | iwl4965_rx_allocate(priv); |
@@ -4192,7 +3924,7 @@ void iwl4965_rx_replenish(void *data) | |||
4192 | * This free routine walks the list of POOL entries and if SKB is set to | 3924 | * This free routine walks the list of POOL entries and if SKB is set to |
4193 | * non NULL it is unmapped and freed | 3925 | * non NULL it is unmapped and freed |
4194 | */ | 3926 | */ |
4195 | static void iwl4965_rx_queue_free(struct iwl4965_priv *priv, struct iwl4965_rx_queue *rxq) | 3927 | static void iwl4965_rx_queue_free(struct iwl_priv *priv, struct iwl4965_rx_queue *rxq) |
4196 | { | 3928 | { |
4197 | int i; | 3929 | int i; |
4198 | for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { | 3930 | for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { |
@@ -4210,7 +3942,7 @@ static void iwl4965_rx_queue_free(struct iwl4965_priv *priv, struct iwl4965_rx_q | |||
4210 | rxq->bd = NULL; | 3942 | rxq->bd = NULL; |
4211 | } | 3943 | } |
4212 | 3944 | ||
4213 | int iwl4965_rx_queue_alloc(struct iwl4965_priv *priv) | 3945 | int iwl4965_rx_queue_alloc(struct iwl_priv *priv) |
4214 | { | 3946 | { |
4215 | struct iwl4965_rx_queue *rxq = &priv->rxq; | 3947 | struct iwl4965_rx_queue *rxq = &priv->rxq; |
4216 | struct pci_dev *dev = priv->pci_dev; | 3948 | struct pci_dev *dev = priv->pci_dev; |
@@ -4237,7 +3969,7 @@ int iwl4965_rx_queue_alloc(struct iwl4965_priv *priv) | |||
4237 | return 0; | 3969 | return 0; |
4238 | } | 3970 | } |
4239 | 3971 | ||
4240 | void iwl4965_rx_queue_reset(struct iwl4965_priv *priv, struct iwl4965_rx_queue *rxq) | 3972 | void iwl4965_rx_queue_reset(struct iwl_priv *priv, struct iwl4965_rx_queue *rxq) |
4241 | { | 3973 | { |
4242 | unsigned long flags; | 3974 | unsigned long flags; |
4243 | int i; | 3975 | int i; |
@@ -4352,7 +4084,7 @@ int iwl4965_calc_sig_qual(int rssi_dbm, int noise_dbm) | |||
4352 | * the appropriate handlers, including command responses, | 4084 | * the appropriate handlers, including command responses, |
4353 | * frame-received notifications, and other notifications. | 4085 | * frame-received notifications, and other notifications. |
4354 | */ | 4086 | */ |
4355 | static void iwl4965_rx_handle(struct iwl4965_priv *priv) | 4087 | static void iwl4965_rx_handle(struct iwl_priv *priv) |
4356 | { | 4088 | { |
4357 | struct iwl4965_rx_mem_buffer *rxb; | 4089 | struct iwl4965_rx_mem_buffer *rxb; |
4358 | struct iwl4965_rx_packet *pkt; | 4090 | struct iwl4965_rx_packet *pkt; |
@@ -4398,7 +4130,7 @@ static void iwl4965_rx_handle(struct iwl4965_priv *priv) | |||
4398 | * but apparently a few don't get set; catch them here. */ | 4130 | * but apparently a few don't get set; catch them here. */ |
4399 | reclaim = !(pkt->hdr.sequence & SEQ_RX_FRAME) && | 4131 | reclaim = !(pkt->hdr.sequence & SEQ_RX_FRAME) && |
4400 | (pkt->hdr.cmd != REPLY_RX_PHY_CMD) && | 4132 | (pkt->hdr.cmd != REPLY_RX_PHY_CMD) && |
4401 | (pkt->hdr.cmd != REPLY_4965_RX) && | 4133 | (pkt->hdr.cmd != REPLY_RX) && |
4402 | (pkt->hdr.cmd != REPLY_COMPRESSED_BA) && | 4134 | (pkt->hdr.cmd != REPLY_COMPRESSED_BA) && |
4403 | (pkt->hdr.cmd != STATISTICS_NOTIFICATION) && | 4135 | (pkt->hdr.cmd != STATISTICS_NOTIFICATION) && |
4404 | (pkt->hdr.cmd != REPLY_TX); | 4136 | (pkt->hdr.cmd != REPLY_TX); |
@@ -4421,7 +4153,7 @@ static void iwl4965_rx_handle(struct iwl4965_priv *priv) | |||
4421 | 4153 | ||
4422 | if (reclaim) { | 4154 | if (reclaim) { |
4423 | /* Invoke any callbacks, transfer the skb to caller, and | 4155 | /* Invoke any callbacks, transfer the skb to caller, and |
4424 | * fire off the (possibly) blocking iwl4965_send_cmd() | 4156 | * fire off the (possibly) blocking iwl_send_cmd() |
4425 | * as we reclaim the driver command queue */ | 4157 | * as we reclaim the driver command queue */ |
4426 | if (rxb && rxb->skb) | 4158 | if (rxb && rxb->skb) |
4427 | iwl4965_tx_cmd_complete(priv, rxb); | 4159 | iwl4965_tx_cmd_complete(priv, rxb); |
@@ -4465,7 +4197,7 @@ static void iwl4965_rx_handle(struct iwl4965_priv *priv) | |||
4465 | /** | 4197 | /** |
4466 | * iwl4965_tx_queue_update_write_ptr - Send new write index to hardware | 4198 | * iwl4965_tx_queue_update_write_ptr - Send new write index to hardware |
4467 | */ | 4199 | */ |
4468 | static int iwl4965_tx_queue_update_write_ptr(struct iwl4965_priv *priv, | 4200 | static int iwl4965_tx_queue_update_write_ptr(struct iwl_priv *priv, |
4469 | struct iwl4965_tx_queue *txq) | 4201 | struct iwl4965_tx_queue *txq) |
4470 | { | 4202 | { |
4471 | u32 reg = 0; | 4203 | u32 reg = 0; |
@@ -4508,13 +4240,13 @@ static int iwl4965_tx_queue_update_write_ptr(struct iwl4965_priv *priv, | |||
4508 | return rc; | 4240 | return rc; |
4509 | } | 4241 | } |
4510 | 4242 | ||
4511 | #ifdef CONFIG_IWL4965_DEBUG | 4243 | #ifdef CONFIG_IWLWIFI_DEBUG |
4512 | static void iwl4965_print_rx_config_cmd(struct iwl4965_rxon_cmd *rxon) | 4244 | static void iwl4965_print_rx_config_cmd(struct iwl4965_rxon_cmd *rxon) |
4513 | { | 4245 | { |
4514 | DECLARE_MAC_BUF(mac); | 4246 | DECLARE_MAC_BUF(mac); |
4515 | 4247 | ||
4516 | IWL_DEBUG_RADIO("RX CONFIG:\n"); | 4248 | IWL_DEBUG_RADIO("RX CONFIG:\n"); |
4517 | iwl4965_print_hex_dump(IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon)); | 4249 | iwl_print_hex_dump(IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon)); |
4518 | IWL_DEBUG_RADIO("u16 channel: 0x%x\n", le16_to_cpu(rxon->channel)); | 4250 | IWL_DEBUG_RADIO("u16 channel: 0x%x\n", le16_to_cpu(rxon->channel)); |
4519 | IWL_DEBUG_RADIO("u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags)); | 4251 | IWL_DEBUG_RADIO("u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags)); |
4520 | IWL_DEBUG_RADIO("u32 filter_flags: 0x%08x\n", | 4252 | IWL_DEBUG_RADIO("u32 filter_flags: 0x%08x\n", |
@@ -4531,14 +4263,14 @@ static void iwl4965_print_rx_config_cmd(struct iwl4965_rxon_cmd *rxon) | |||
4531 | } | 4263 | } |
4532 | #endif | 4264 | #endif |
4533 | 4265 | ||
4534 | static void iwl4965_enable_interrupts(struct iwl4965_priv *priv) | 4266 | static void iwl4965_enable_interrupts(struct iwl_priv *priv) |
4535 | { | 4267 | { |
4536 | IWL_DEBUG_ISR("Enabling interrupts\n"); | 4268 | IWL_DEBUG_ISR("Enabling interrupts\n"); |
4537 | set_bit(STATUS_INT_ENABLED, &priv->status); | 4269 | set_bit(STATUS_INT_ENABLED, &priv->status); |
4538 | iwl4965_write32(priv, CSR_INT_MASK, CSR_INI_SET_MASK); | 4270 | iwl4965_write32(priv, CSR_INT_MASK, CSR_INI_SET_MASK); |
4539 | } | 4271 | } |
4540 | 4272 | ||
4541 | static inline void iwl4965_disable_interrupts(struct iwl4965_priv *priv) | 4273 | static inline void iwl4965_disable_interrupts(struct iwl_priv *priv) |
4542 | { | 4274 | { |
4543 | clear_bit(STATUS_INT_ENABLED, &priv->status); | 4275 | clear_bit(STATUS_INT_ENABLED, &priv->status); |
4544 | 4276 | ||
@@ -4575,7 +4307,7 @@ static const char *desc_lookup(int i) | |||
4575 | #define ERROR_START_OFFSET (1 * sizeof(u32)) | 4307 | #define ERROR_START_OFFSET (1 * sizeof(u32)) |
4576 | #define ERROR_ELEM_SIZE (7 * sizeof(u32)) | 4308 | #define ERROR_ELEM_SIZE (7 * sizeof(u32)) |
4577 | 4309 | ||
4578 | static void iwl4965_dump_nic_error_log(struct iwl4965_priv *priv) | 4310 | static void iwl4965_dump_nic_error_log(struct iwl_priv *priv) |
4579 | { | 4311 | { |
4580 | u32 data2, line; | 4312 | u32 data2, line; |
4581 | u32 desc, time, count, base, data1; | 4313 | u32 desc, time, count, base, data1; |
@@ -4630,7 +4362,7 @@ static void iwl4965_dump_nic_error_log(struct iwl4965_priv *priv) | |||
4630 | * | 4362 | * |
4631 | * NOTE: Must be called with iwl4965_grab_nic_access() already obtained! | 4363 | * NOTE: Must be called with iwl4965_grab_nic_access() already obtained! |
4632 | */ | 4364 | */ |
4633 | static void iwl4965_print_event_log(struct iwl4965_priv *priv, u32 start_idx, | 4365 | static void iwl4965_print_event_log(struct iwl_priv *priv, u32 start_idx, |
4634 | u32 num_events, u32 mode) | 4366 | u32 num_events, u32 mode) |
4635 | { | 4367 | { |
4636 | u32 i; | 4368 | u32 i; |
@@ -4668,7 +4400,7 @@ static void iwl4965_print_event_log(struct iwl4965_priv *priv, u32 start_idx, | |||
4668 | } | 4400 | } |
4669 | } | 4401 | } |
4670 | 4402 | ||
4671 | static void iwl4965_dump_nic_event_log(struct iwl4965_priv *priv) | 4403 | static void iwl4965_dump_nic_event_log(struct iwl_priv *priv) |
4672 | { | 4404 | { |
4673 | int rc; | 4405 | int rc; |
4674 | u32 base; /* SRAM byte address of event log header */ | 4406 | u32 base; /* SRAM byte address of event log header */ |
@@ -4723,7 +4455,7 @@ static void iwl4965_dump_nic_event_log(struct iwl4965_priv *priv) | |||
4723 | /** | 4455 | /** |
4724 | * iwl4965_irq_handle_error - called for HW or SW error interrupt from card | 4456 | * iwl4965_irq_handle_error - called for HW or SW error interrupt from card |
4725 | */ | 4457 | */ |
4726 | static void iwl4965_irq_handle_error(struct iwl4965_priv *priv) | 4458 | static void iwl4965_irq_handle_error(struct iwl_priv *priv) |
4727 | { | 4459 | { |
4728 | /* Set the FW error flag -- cleared on iwl4965_down */ | 4460 | /* Set the FW error flag -- cleared on iwl4965_down */ |
4729 | set_bit(STATUS_FW_ERROR, &priv->status); | 4461 | set_bit(STATUS_FW_ERROR, &priv->status); |
@@ -4731,8 +4463,8 @@ static void iwl4965_irq_handle_error(struct iwl4965_priv *priv) | |||
4731 | /* Cancel currently queued command. */ | 4463 | /* Cancel currently queued command. */ |
4732 | clear_bit(STATUS_HCMD_ACTIVE, &priv->status); | 4464 | clear_bit(STATUS_HCMD_ACTIVE, &priv->status); |
4733 | 4465 | ||
4734 | #ifdef CONFIG_IWL4965_DEBUG | 4466 | #ifdef CONFIG_IWLWIFI_DEBUG |
4735 | if (iwl4965_debug_level & IWL_DL_FW_ERRORS) { | 4467 | if (iwl_debug_level & IWL_DL_FW_ERRORS) { |
4736 | iwl4965_dump_nic_error_log(priv); | 4468 | iwl4965_dump_nic_error_log(priv); |
4737 | iwl4965_dump_nic_event_log(priv); | 4469 | iwl4965_dump_nic_event_log(priv); |
4738 | iwl4965_print_rx_config_cmd(&priv->staging_rxon); | 4470 | iwl4965_print_rx_config_cmd(&priv->staging_rxon); |
@@ -4758,7 +4490,7 @@ static void iwl4965_irq_handle_error(struct iwl4965_priv *priv) | |||
4758 | } | 4490 | } |
4759 | } | 4491 | } |
4760 | 4492 | ||
4761 | static void iwl4965_error_recovery(struct iwl4965_priv *priv) | 4493 | static void iwl4965_error_recovery(struct iwl_priv *priv) |
4762 | { | 4494 | { |
4763 | unsigned long flags; | 4495 | unsigned long flags; |
4764 | 4496 | ||
@@ -4775,12 +4507,12 @@ static void iwl4965_error_recovery(struct iwl4965_priv *priv) | |||
4775 | spin_unlock_irqrestore(&priv->lock, flags); | 4507 | spin_unlock_irqrestore(&priv->lock, flags); |
4776 | } | 4508 | } |
4777 | 4509 | ||
4778 | static void iwl4965_irq_tasklet(struct iwl4965_priv *priv) | 4510 | static void iwl4965_irq_tasklet(struct iwl_priv *priv) |
4779 | { | 4511 | { |
4780 | u32 inta, handled = 0; | 4512 | u32 inta, handled = 0; |
4781 | u32 inta_fh; | 4513 | u32 inta_fh; |
4782 | unsigned long flags; | 4514 | unsigned long flags; |
4783 | #ifdef CONFIG_IWL4965_DEBUG | 4515 | #ifdef CONFIG_IWLWIFI_DEBUG |
4784 | u32 inta_mask; | 4516 | u32 inta_mask; |
4785 | #endif | 4517 | #endif |
4786 | 4518 | ||
@@ -4798,8 +4530,8 @@ static void iwl4965_irq_tasklet(struct iwl4965_priv *priv) | |||
4798 | inta_fh = iwl4965_read32(priv, CSR_FH_INT_STATUS); | 4530 | inta_fh = iwl4965_read32(priv, CSR_FH_INT_STATUS); |
4799 | iwl4965_write32(priv, CSR_FH_INT_STATUS, inta_fh); | 4531 | iwl4965_write32(priv, CSR_FH_INT_STATUS, inta_fh); |
4800 | 4532 | ||
4801 | #ifdef CONFIG_IWL4965_DEBUG | 4533 | #ifdef CONFIG_IWLWIFI_DEBUG |
4802 | if (iwl4965_debug_level & IWL_DL_ISR) { | 4534 | if (iwl_debug_level & IWL_DL_ISR) { |
4803 | /* just for debug */ | 4535 | /* just for debug */ |
4804 | inta_mask = iwl4965_read32(priv, CSR_INT_MASK); | 4536 | inta_mask = iwl4965_read32(priv, CSR_INT_MASK); |
4805 | IWL_DEBUG_ISR("inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", | 4537 | IWL_DEBUG_ISR("inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", |
@@ -4832,8 +4564,8 @@ static void iwl4965_irq_tasklet(struct iwl4965_priv *priv) | |||
4832 | return; | 4564 | return; |
4833 | } | 4565 | } |
4834 | 4566 | ||
4835 | #ifdef CONFIG_IWL4965_DEBUG | 4567 | #ifdef CONFIG_IWLWIFI_DEBUG |
4836 | if (iwl4965_debug_level & (IWL_DL_ISR)) { | 4568 | if (iwl_debug_level & (IWL_DL_ISR)) { |
4837 | /* NIC fires this, but we don't use it, redundant with WAKEUP */ | 4569 | /* NIC fires this, but we don't use it, redundant with WAKEUP */ |
4838 | if (inta & CSR_INT_BIT_SCD) | 4570 | if (inta & CSR_INT_BIT_SCD) |
4839 | IWL_DEBUG_ISR("Scheduler finished to transmit " | 4571 | IWL_DEBUG_ISR("Scheduler finished to transmit " |
@@ -4923,8 +4655,8 @@ static void iwl4965_irq_tasklet(struct iwl4965_priv *priv) | |||
4923 | /* Re-enable all interrupts */ | 4655 | /* Re-enable all interrupts */ |
4924 | iwl4965_enable_interrupts(priv); | 4656 | iwl4965_enable_interrupts(priv); |
4925 | 4657 | ||
4926 | #ifdef CONFIG_IWL4965_DEBUG | 4658 | #ifdef CONFIG_IWLWIFI_DEBUG |
4927 | if (iwl4965_debug_level & (IWL_DL_ISR)) { | 4659 | if (iwl_debug_level & (IWL_DL_ISR)) { |
4928 | inta = iwl4965_read32(priv, CSR_INT); | 4660 | inta = iwl4965_read32(priv, CSR_INT); |
4929 | inta_mask = iwl4965_read32(priv, CSR_INT_MASK); | 4661 | inta_mask = iwl4965_read32(priv, CSR_INT_MASK); |
4930 | inta_fh = iwl4965_read32(priv, CSR_FH_INT_STATUS); | 4662 | inta_fh = iwl4965_read32(priv, CSR_FH_INT_STATUS); |
@@ -4937,7 +4669,7 @@ static void iwl4965_irq_tasklet(struct iwl4965_priv *priv) | |||
4937 | 4669 | ||
4938 | static irqreturn_t iwl4965_isr(int irq, void *data) | 4670 | static irqreturn_t iwl4965_isr(int irq, void *data) |
4939 | { | 4671 | { |
4940 | struct iwl4965_priv *priv = data; | 4672 | struct iwl_priv *priv = data; |
4941 | u32 inta, inta_mask; | 4673 | u32 inta, inta_mask; |
4942 | u32 inta_fh; | 4674 | u32 inta_fh; |
4943 | if (!priv) | 4675 | if (!priv) |
@@ -4991,308 +4723,6 @@ static irqreturn_t iwl4965_isr(int irq, void *data) | |||
4991 | return IRQ_NONE; | 4723 | return IRQ_NONE; |
4992 | } | 4724 | } |
4993 | 4725 | ||
4994 | /************************** EEPROM BANDS **************************** | ||
4995 | * | ||
4996 | * The iwl4965_eeprom_band definitions below provide the mapping from the | ||
4997 | * EEPROM contents to the specific channel number supported for each | ||
4998 | * band. | ||
4999 | * | ||
5000 | * For example, iwl4965_priv->eeprom.band_3_channels[4] from the band_3 | ||
5001 | * definition below maps to physical channel 42 in the 5.2GHz spectrum. | ||
5002 | * The specific geography and calibration information for that channel | ||
5003 | * is contained in the eeprom map itself. | ||
5004 | * | ||
5005 | * During init, we copy the eeprom information and channel map | ||
5006 | * information into priv->channel_info_24/52 and priv->channel_map_24/52 | ||
5007 | * | ||
5008 | * channel_map_24/52 provides the index in the channel_info array for a | ||
5009 | * given channel. We have to have two separate maps as there is channel | ||
5010 | * overlap with the 2.4GHz and 5.2GHz spectrum as seen in band_1 and | ||
5011 | * band_2 | ||
5012 | * | ||
5013 | * A value of 0xff stored in the channel_map indicates that the channel | ||
5014 | * is not supported by the hardware at all. | ||
5015 | * | ||
5016 | * A value of 0xfe in the channel_map indicates that the channel is not | ||
5017 | * valid for Tx with the current hardware. This means that | ||
5018 | * while the system can tune and receive on a given channel, it may not | ||
5019 | * be able to associate or transmit any frames on that | ||
5020 | * channel. There is no corresponding channel information for that | ||
5021 | * entry. | ||
5022 | * | ||
5023 | *********************************************************************/ | ||
5024 | |||
5025 | /* 2.4 GHz */ | ||
5026 | static const u8 iwl4965_eeprom_band_1[14] = { | ||
5027 | 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 | ||
5028 | }; | ||
5029 | |||
5030 | /* 5.2 GHz bands */ | ||
5031 | static const u8 iwl4965_eeprom_band_2[] = { /* 4915-5080MHz */ | ||
5032 | 183, 184, 185, 187, 188, 189, 192, 196, 7, 8, 11, 12, 16 | ||
5033 | }; | ||
5034 | |||
5035 | static const u8 iwl4965_eeprom_band_3[] = { /* 5170-5320MHz */ | ||
5036 | 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64 | ||
5037 | }; | ||
5038 | |||
5039 | static const u8 iwl4965_eeprom_band_4[] = { /* 5500-5700MHz */ | ||
5040 | 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 | ||
5041 | }; | ||
5042 | |||
5043 | static const u8 iwl4965_eeprom_band_5[] = { /* 5725-5825MHz */ | ||
5044 | 145, 149, 153, 157, 161, 165 | ||
5045 | }; | ||
5046 | |||
5047 | static u8 iwl4965_eeprom_band_6[] = { /* 2.4 FAT channel */ | ||
5048 | 1, 2, 3, 4, 5, 6, 7 | ||
5049 | }; | ||
5050 | |||
5051 | static u8 iwl4965_eeprom_band_7[] = { /* 5.2 FAT channel */ | ||
5052 | 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157 | ||
5053 | }; | ||
5054 | |||
5055 | static void iwl4965_init_band_reference(const struct iwl4965_priv *priv, | ||
5056 | int band, | ||
5057 | int *eeprom_ch_count, | ||
5058 | const struct iwl4965_eeprom_channel | ||
5059 | **eeprom_ch_info, | ||
5060 | const u8 **eeprom_ch_index) | ||
5061 | { | ||
5062 | switch (band) { | ||
5063 | case 1: /* 2.4GHz band */ | ||
5064 | *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_1); | ||
5065 | *eeprom_ch_info = priv->eeprom.band_1_channels; | ||
5066 | *eeprom_ch_index = iwl4965_eeprom_band_1; | ||
5067 | break; | ||
5068 | case 2: /* 4.9GHz band */ | ||
5069 | *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_2); | ||
5070 | *eeprom_ch_info = priv->eeprom.band_2_channels; | ||
5071 | *eeprom_ch_index = iwl4965_eeprom_band_2; | ||
5072 | break; | ||
5073 | case 3: /* 5.2GHz band */ | ||
5074 | *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_3); | ||
5075 | *eeprom_ch_info = priv->eeprom.band_3_channels; | ||
5076 | *eeprom_ch_index = iwl4965_eeprom_band_3; | ||
5077 | break; | ||
5078 | case 4: /* 5.5GHz band */ | ||
5079 | *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_4); | ||
5080 | *eeprom_ch_info = priv->eeprom.band_4_channels; | ||
5081 | *eeprom_ch_index = iwl4965_eeprom_band_4; | ||
5082 | break; | ||
5083 | case 5: /* 5.7GHz band */ | ||
5084 | *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_5); | ||
5085 | *eeprom_ch_info = priv->eeprom.band_5_channels; | ||
5086 | *eeprom_ch_index = iwl4965_eeprom_band_5; | ||
5087 | break; | ||
5088 | case 6: /* 2.4GHz FAT channels */ | ||
5089 | *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_6); | ||
5090 | *eeprom_ch_info = priv->eeprom.band_24_channels; | ||
5091 | *eeprom_ch_index = iwl4965_eeprom_band_6; | ||
5092 | break; | ||
5093 | case 7: /* 5 GHz FAT channels */ | ||
5094 | *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_7); | ||
5095 | *eeprom_ch_info = priv->eeprom.band_52_channels; | ||
5096 | *eeprom_ch_index = iwl4965_eeprom_band_7; | ||
5097 | break; | ||
5098 | default: | ||
5099 | BUG(); | ||
5100 | return; | ||
5101 | } | ||
5102 | } | ||
5103 | |||
5104 | /** | ||
5105 | * iwl4965_get_channel_info - Find driver's private channel info | ||
5106 | * | ||
5107 | * Based on band and channel number. | ||
5108 | */ | ||
5109 | const struct iwl4965_channel_info *iwl4965_get_channel_info(const struct iwl4965_priv *priv, | ||
5110 | enum ieee80211_band band, u16 channel) | ||
5111 | { | ||
5112 | int i; | ||
5113 | |||
5114 | switch (band) { | ||
5115 | case IEEE80211_BAND_5GHZ: | ||
5116 | for (i = 14; i < priv->channel_count; i++) { | ||
5117 | if (priv->channel_info[i].channel == channel) | ||
5118 | return &priv->channel_info[i]; | ||
5119 | } | ||
5120 | break; | ||
5121 | case IEEE80211_BAND_2GHZ: | ||
5122 | if (channel >= 1 && channel <= 14) | ||
5123 | return &priv->channel_info[channel - 1]; | ||
5124 | break; | ||
5125 | default: | ||
5126 | BUG(); | ||
5127 | } | ||
5128 | |||
5129 | return NULL; | ||
5130 | } | ||
5131 | |||
5132 | #define CHECK_AND_PRINT(x) ((eeprom_ch_info[ch].flags & EEPROM_CHANNEL_##x) \ | ||
5133 | ? # x " " : "") | ||
5134 | |||
5135 | /** | ||
5136 | * iwl4965_init_channel_map - Set up driver's info for all possible channels | ||
5137 | */ | ||
5138 | static int iwl4965_init_channel_map(struct iwl4965_priv *priv) | ||
5139 | { | ||
5140 | int eeprom_ch_count = 0; | ||
5141 | const u8 *eeprom_ch_index = NULL; | ||
5142 | const struct iwl4965_eeprom_channel *eeprom_ch_info = NULL; | ||
5143 | int band, ch; | ||
5144 | struct iwl4965_channel_info *ch_info; | ||
5145 | |||
5146 | if (priv->channel_count) { | ||
5147 | IWL_DEBUG_INFO("Channel map already initialized.\n"); | ||
5148 | return 0; | ||
5149 | } | ||
5150 | |||
5151 | if (priv->eeprom.version < 0x2f) { | ||
5152 | IWL_WARNING("Unsupported EEPROM version: 0x%04X\n", | ||
5153 | priv->eeprom.version); | ||
5154 | return -EINVAL; | ||
5155 | } | ||
5156 | |||
5157 | IWL_DEBUG_INFO("Initializing regulatory info from EEPROM\n"); | ||
5158 | |||
5159 | priv->channel_count = | ||
5160 | ARRAY_SIZE(iwl4965_eeprom_band_1) + | ||
5161 | ARRAY_SIZE(iwl4965_eeprom_band_2) + | ||
5162 | ARRAY_SIZE(iwl4965_eeprom_band_3) + | ||
5163 | ARRAY_SIZE(iwl4965_eeprom_band_4) + | ||
5164 | ARRAY_SIZE(iwl4965_eeprom_band_5); | ||
5165 | |||
5166 | IWL_DEBUG_INFO("Parsing data for %d channels.\n", priv->channel_count); | ||
5167 | |||
5168 | priv->channel_info = kzalloc(sizeof(struct iwl4965_channel_info) * | ||
5169 | priv->channel_count, GFP_KERNEL); | ||
5170 | if (!priv->channel_info) { | ||
5171 | IWL_ERROR("Could not allocate channel_info\n"); | ||
5172 | priv->channel_count = 0; | ||
5173 | return -ENOMEM; | ||
5174 | } | ||
5175 | |||
5176 | ch_info = priv->channel_info; | ||
5177 | |||
5178 | /* Loop through the 5 EEPROM bands adding them in order to the | ||
5179 | * channel map we maintain (that contains additional information than | ||
5180 | * what just in the EEPROM) */ | ||
5181 | for (band = 1; band <= 5; band++) { | ||
5182 | |||
5183 | iwl4965_init_band_reference(priv, band, &eeprom_ch_count, | ||
5184 | &eeprom_ch_info, &eeprom_ch_index); | ||
5185 | |||
5186 | /* Loop through each band adding each of the channels */ | ||
5187 | for (ch = 0; ch < eeprom_ch_count; ch++) { | ||
5188 | ch_info->channel = eeprom_ch_index[ch]; | ||
5189 | ch_info->band = (band == 1) ? IEEE80211_BAND_2GHZ : | ||
5190 | IEEE80211_BAND_5GHZ; | ||
5191 | |||
5192 | /* permanently store EEPROM's channel regulatory flags | ||
5193 | * and max power in channel info database. */ | ||
5194 | ch_info->eeprom = eeprom_ch_info[ch]; | ||
5195 | |||
5196 | /* Copy the run-time flags so they are there even on | ||
5197 | * invalid channels */ | ||
5198 | ch_info->flags = eeprom_ch_info[ch].flags; | ||
5199 | |||
5200 | if (!(is_channel_valid(ch_info))) { | ||
5201 | IWL_DEBUG_INFO("Ch. %d Flags %x [%sGHz] - " | ||
5202 | "No traffic\n", | ||
5203 | ch_info->channel, | ||
5204 | ch_info->flags, | ||
5205 | is_channel_a_band(ch_info) ? | ||
5206 | "5.2" : "2.4"); | ||
5207 | ch_info++; | ||
5208 | continue; | ||
5209 | } | ||
5210 | |||
5211 | /* Initialize regulatory-based run-time data */ | ||
5212 | ch_info->max_power_avg = ch_info->curr_txpow = | ||
5213 | eeprom_ch_info[ch].max_power_avg; | ||
5214 | ch_info->scan_power = eeprom_ch_info[ch].max_power_avg; | ||
5215 | ch_info->min_power = 0; | ||
5216 | |||
5217 | IWL_DEBUG_INFO("Ch. %d [%sGHz] %s%s%s%s%s%s%s(0x%02x" | ||
5218 | " %ddBm): Ad-Hoc %ssupported\n", | ||
5219 | ch_info->channel, | ||
5220 | is_channel_a_band(ch_info) ? | ||
5221 | "5.2" : "2.4", | ||
5222 | CHECK_AND_PRINT(VALID), | ||
5223 | CHECK_AND_PRINT(IBSS), | ||
5224 | CHECK_AND_PRINT(ACTIVE), | ||
5225 | CHECK_AND_PRINT(RADAR), | ||
5226 | CHECK_AND_PRINT(WIDE), | ||
5227 | CHECK_AND_PRINT(NARROW), | ||
5228 | CHECK_AND_PRINT(DFS), | ||
5229 | eeprom_ch_info[ch].flags, | ||
5230 | eeprom_ch_info[ch].max_power_avg, | ||
5231 | ((eeprom_ch_info[ch]. | ||
5232 | flags & EEPROM_CHANNEL_IBSS) | ||
5233 | && !(eeprom_ch_info[ch]. | ||
5234 | flags & EEPROM_CHANNEL_RADAR)) | ||
5235 | ? "" : "not "); | ||
5236 | |||
5237 | /* Set the user_txpower_limit to the highest power | ||
5238 | * supported by any channel */ | ||
5239 | if (eeprom_ch_info[ch].max_power_avg > | ||
5240 | priv->user_txpower_limit) | ||
5241 | priv->user_txpower_limit = | ||
5242 | eeprom_ch_info[ch].max_power_avg; | ||
5243 | |||
5244 | ch_info++; | ||
5245 | } | ||
5246 | } | ||
5247 | |||
5248 | /* Two additional EEPROM bands for 2.4 and 5 GHz FAT channels */ | ||
5249 | for (band = 6; band <= 7; band++) { | ||
5250 | enum ieee80211_band ieeeband; | ||
5251 | u8 fat_extension_chan; | ||
5252 | |||
5253 | iwl4965_init_band_reference(priv, band, &eeprom_ch_count, | ||
5254 | &eeprom_ch_info, &eeprom_ch_index); | ||
5255 | |||
5256 | /* EEPROM band 6 is 2.4, band 7 is 5 GHz */ | ||
5257 | ieeeband = (band == 6) ? IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ; | ||
5258 | |||
5259 | /* Loop through each band adding each of the channels */ | ||
5260 | for (ch = 0; ch < eeprom_ch_count; ch++) { | ||
5261 | |||
5262 | if ((band == 6) && | ||
5263 | ((eeprom_ch_index[ch] == 5) || | ||
5264 | (eeprom_ch_index[ch] == 6) || | ||
5265 | (eeprom_ch_index[ch] == 7))) | ||
5266 | fat_extension_chan = HT_IE_EXT_CHANNEL_MAX; | ||
5267 | else | ||
5268 | fat_extension_chan = HT_IE_EXT_CHANNEL_ABOVE; | ||
5269 | |||
5270 | /* Set up driver's info for lower half */ | ||
5271 | iwl4965_set_fat_chan_info(priv, ieeeband, | ||
5272 | eeprom_ch_index[ch], | ||
5273 | &(eeprom_ch_info[ch]), | ||
5274 | fat_extension_chan); | ||
5275 | |||
5276 | /* Set up driver's info for upper half */ | ||
5277 | iwl4965_set_fat_chan_info(priv, ieeeband, | ||
5278 | (eeprom_ch_index[ch] + 4), | ||
5279 | &(eeprom_ch_info[ch]), | ||
5280 | HT_IE_EXT_CHANNEL_BELOW); | ||
5281 | } | ||
5282 | } | ||
5283 | |||
5284 | return 0; | ||
5285 | } | ||
5286 | |||
5287 | /* | ||
5288 | * iwl4965_free_channel_map - undo allocations in iwl4965_init_channel_map | ||
5289 | */ | ||
5290 | static void iwl4965_free_channel_map(struct iwl4965_priv *priv) | ||
5291 | { | ||
5292 | kfree(priv->channel_info); | ||
5293 | priv->channel_count = 0; | ||
5294 | } | ||
5295 | |||
5296 | /* For active scan, listen ACTIVE_DWELL_TIME (msec) on each channel after | 4726 | /* For active scan, listen ACTIVE_DWELL_TIME (msec) on each channel after |
5297 | * sending probe req. This should be set long enough to hear probe responses | 4727 | * sending probe req. This should be set long enough to hear probe responses |
5298 | * from more than one AP. */ | 4728 | * from more than one AP. */ |
@@ -5316,7 +4746,7 @@ static void iwl4965_free_channel_map(struct iwl4965_priv *priv) | |||
5316 | #define IWL_PASSIVE_DWELL_BASE (100) | 4746 | #define IWL_PASSIVE_DWELL_BASE (100) |
5317 | #define IWL_CHANNEL_TUNE_TIME 5 | 4747 | #define IWL_CHANNEL_TUNE_TIME 5 |
5318 | 4748 | ||
5319 | static inline u16 iwl4965_get_active_dwell_time(struct iwl4965_priv *priv, | 4749 | static inline u16 iwl4965_get_active_dwell_time(struct iwl_priv *priv, |
5320 | enum ieee80211_band band) | 4750 | enum ieee80211_band band) |
5321 | { | 4751 | { |
5322 | if (band == IEEE80211_BAND_5GHZ) | 4752 | if (band == IEEE80211_BAND_5GHZ) |
@@ -5325,7 +4755,7 @@ static inline u16 iwl4965_get_active_dwell_time(struct iwl4965_priv *priv, | |||
5325 | return IWL_ACTIVE_DWELL_TIME_24; | 4755 | return IWL_ACTIVE_DWELL_TIME_24; |
5326 | } | 4756 | } |
5327 | 4757 | ||
5328 | static u16 iwl4965_get_passive_dwell_time(struct iwl4965_priv *priv, | 4758 | static u16 iwl4965_get_passive_dwell_time(struct iwl_priv *priv, |
5329 | enum ieee80211_band band) | 4759 | enum ieee80211_band band) |
5330 | { | 4760 | { |
5331 | u16 active = iwl4965_get_active_dwell_time(priv, band); | 4761 | u16 active = iwl4965_get_active_dwell_time(priv, band); |
@@ -5349,14 +4779,14 @@ static u16 iwl4965_get_passive_dwell_time(struct iwl4965_priv *priv, | |||
5349 | return passive; | 4779 | return passive; |
5350 | } | 4780 | } |
5351 | 4781 | ||
5352 | static int iwl4965_get_channels_for_scan(struct iwl4965_priv *priv, | 4782 | static int iwl4965_get_channels_for_scan(struct iwl_priv *priv, |
5353 | enum ieee80211_band band, | 4783 | enum ieee80211_band band, |
5354 | u8 is_active, u8 direct_mask, | 4784 | u8 is_active, u8 direct_mask, |
5355 | struct iwl4965_scan_channel *scan_ch) | 4785 | struct iwl4965_scan_channel *scan_ch) |
5356 | { | 4786 | { |
5357 | const struct ieee80211_channel *channels = NULL; | 4787 | const struct ieee80211_channel *channels = NULL; |
5358 | const struct ieee80211_supported_band *sband; | 4788 | const struct ieee80211_supported_band *sband; |
5359 | const struct iwl4965_channel_info *ch_info; | 4789 | const struct iwl_channel_info *ch_info; |
5360 | u16 passive_dwell = 0; | 4790 | u16 passive_dwell = 0; |
5361 | u16 active_dwell = 0; | 4791 | u16 active_dwell = 0; |
5362 | int added, i; | 4792 | int added, i; |
@@ -5384,7 +4814,7 @@ static int iwl4965_get_channels_for_scan(struct iwl4965_priv *priv, | |||
5384 | 4814 | ||
5385 | scan_ch->channel = ieee80211_frequency_to_channel(channels[i].center_freq); | 4815 | scan_ch->channel = ieee80211_frequency_to_channel(channels[i].center_freq); |
5386 | 4816 | ||
5387 | ch_info = iwl4965_get_channel_info(priv, band, | 4817 | ch_info = iwl_get_channel_info(priv, band, |
5388 | scan_ch->channel); | 4818 | scan_ch->channel); |
5389 | if (!is_channel_valid(ch_info)) { | 4819 | if (!is_channel_valid(ch_info)) { |
5390 | IWL_DEBUG_SCAN("Channel %d is INVALID for this SKU.\n", | 4820 | IWL_DEBUG_SCAN("Channel %d is INVALID for this SKU.\n", |
@@ -5436,7 +4866,7 @@ static int iwl4965_get_channels_for_scan(struct iwl4965_priv *priv, | |||
5436 | return added; | 4866 | return added; |
5437 | } | 4867 | } |
5438 | 4868 | ||
5439 | static void iwl4965_init_hw_rates(struct iwl4965_priv *priv, | 4869 | static void iwl4965_init_hw_rates(struct iwl_priv *priv, |
5440 | struct ieee80211_rate *rates) | 4870 | struct ieee80211_rate *rates) |
5441 | { | 4871 | { |
5442 | int i; | 4872 | int i; |
@@ -5460,9 +4890,9 @@ static void iwl4965_init_hw_rates(struct iwl4965_priv *priv, | |||
5460 | /** | 4890 | /** |
5461 | * iwl4965_init_geos - Initialize mac80211's geo/channel info based from eeprom | 4891 | * iwl4965_init_geos - Initialize mac80211's geo/channel info based from eeprom |
5462 | */ | 4892 | */ |
5463 | static int iwl4965_init_geos(struct iwl4965_priv *priv) | 4893 | int iwl4965_init_geos(struct iwl_priv *priv) |
5464 | { | 4894 | { |
5465 | struct iwl4965_channel_info *ch; | 4895 | struct iwl_channel_info *ch; |
5466 | struct ieee80211_supported_band *sband; | 4896 | struct ieee80211_supported_band *sband; |
5467 | struct ieee80211_channel *channels; | 4897 | struct ieee80211_channel *channels; |
5468 | struct ieee80211_channel *geo_ch; | 4898 | struct ieee80211_channel *geo_ch; |
@@ -5490,12 +4920,12 @@ static int iwl4965_init_geos(struct iwl4965_priv *priv) | |||
5490 | 4920 | ||
5491 | /* 5.2GHz channels start after the 2.4GHz channels */ | 4921 | /* 5.2GHz channels start after the 2.4GHz channels */ |
5492 | sband = &priv->bands[IEEE80211_BAND_5GHZ]; | 4922 | sband = &priv->bands[IEEE80211_BAND_5GHZ]; |
5493 | sband->channels = &channels[ARRAY_SIZE(iwl4965_eeprom_band_1)]; | 4923 | sband->channels = &channels[ARRAY_SIZE(iwl_eeprom_band_1)]; |
5494 | /* just OFDM */ | 4924 | /* just OFDM */ |
5495 | sband->bitrates = &rates[IWL_FIRST_OFDM_RATE]; | 4925 | sband->bitrates = &rates[IWL_FIRST_OFDM_RATE]; |
5496 | sband->n_bitrates = IWL_RATE_COUNT - IWL_FIRST_OFDM_RATE; | 4926 | sband->n_bitrates = IWL_RATE_COUNT - IWL_FIRST_OFDM_RATE; |
5497 | 4927 | ||
5498 | iwl4965_init_ht_hw_capab(&sband->ht_info, IEEE80211_BAND_5GHZ); | 4928 | iwl4965_init_ht_hw_capab(priv, &sband->ht_info, IEEE80211_BAND_5GHZ); |
5499 | 4929 | ||
5500 | sband = &priv->bands[IEEE80211_BAND_2GHZ]; | 4930 | sband = &priv->bands[IEEE80211_BAND_2GHZ]; |
5501 | sband->channels = channels; | 4931 | sband->channels = channels; |
@@ -5503,7 +4933,7 @@ static int iwl4965_init_geos(struct iwl4965_priv *priv) | |||
5503 | sband->bitrates = rates; | 4933 | sband->bitrates = rates; |
5504 | sband->n_bitrates = IWL_RATE_COUNT; | 4934 | sband->n_bitrates = IWL_RATE_COUNT; |
5505 | 4935 | ||
5506 | iwl4965_init_ht_hw_capab(&sband->ht_info, IEEE80211_BAND_2GHZ); | 4936 | iwl4965_init_ht_hw_capab(priv, &sband->ht_info, IEEE80211_BAND_2GHZ); |
5507 | 4937 | ||
5508 | priv->ieee_channels = channels; | 4938 | priv->ieee_channels = channels; |
5509 | priv->ieee_rates = rates; | 4939 | priv->ieee_rates = rates; |
@@ -5582,7 +5012,7 @@ static int iwl4965_init_geos(struct iwl4965_priv *priv) | |||
5582 | /* | 5012 | /* |
5583 | * iwl4965_free_geos - undo allocations in iwl4965_init_geos | 5013 | * iwl4965_free_geos - undo allocations in iwl4965_init_geos |
5584 | */ | 5014 | */ |
5585 | static void iwl4965_free_geos(struct iwl4965_priv *priv) | 5015 | void iwl4965_free_geos(struct iwl_priv *priv) |
5586 | { | 5016 | { |
5587 | kfree(priv->ieee_channels); | 5017 | kfree(priv->ieee_channels); |
5588 | kfree(priv->ieee_rates); | 5018 | kfree(priv->ieee_rates); |
@@ -5595,7 +5025,7 @@ static void iwl4965_free_geos(struct iwl4965_priv *priv) | |||
5595 | * | 5025 | * |
5596 | ******************************************************************************/ | 5026 | ******************************************************************************/ |
5597 | 5027 | ||
5598 | static void iwl4965_dealloc_ucode_pci(struct iwl4965_priv *priv) | 5028 | static void iwl4965_dealloc_ucode_pci(struct iwl_priv *priv) |
5599 | { | 5029 | { |
5600 | iwl_free_fw_desc(priv->pci_dev, &priv->ucode_code); | 5030 | iwl_free_fw_desc(priv->pci_dev, &priv->ucode_code); |
5601 | iwl_free_fw_desc(priv->pci_dev, &priv->ucode_data); | 5031 | iwl_free_fw_desc(priv->pci_dev, &priv->ucode_data); |
@@ -5609,7 +5039,7 @@ static void iwl4965_dealloc_ucode_pci(struct iwl4965_priv *priv) | |||
5609 | * iwl4965_verify_inst_full - verify runtime uCode image in card vs. host, | 5039 | * iwl4965_verify_inst_full - verify runtime uCode image in card vs. host, |
5610 | * looking at all data. | 5040 | * looking at all data. |
5611 | */ | 5041 | */ |
5612 | static int iwl4965_verify_inst_full(struct iwl4965_priv *priv, __le32 *image, | 5042 | static int iwl4965_verify_inst_full(struct iwl_priv *priv, __le32 *image, |
5613 | u32 len) | 5043 | u32 len) |
5614 | { | 5044 | { |
5615 | u32 val; | 5045 | u32 val; |
@@ -5657,7 +5087,7 @@ static int iwl4965_verify_inst_full(struct iwl4965_priv *priv, __le32 *image, | |||
5657 | * using sample data 100 bytes apart. If these sample points are good, | 5087 | * using sample data 100 bytes apart. If these sample points are good, |
5658 | * it's a pretty good bet that everything between them is good, too. | 5088 | * it's a pretty good bet that everything between them is good, too. |
5659 | */ | 5089 | */ |
5660 | static int iwl4965_verify_inst_sparse(struct iwl4965_priv *priv, __le32 *image, u32 len) | 5090 | static int iwl4965_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len) |
5661 | { | 5091 | { |
5662 | u32 val; | 5092 | u32 val; |
5663 | int rc = 0; | 5093 | int rc = 0; |
@@ -5700,7 +5130,7 @@ static int iwl4965_verify_inst_sparse(struct iwl4965_priv *priv, __le32 *image, | |||
5700 | * iwl4965_verify_ucode - determine which instruction image is in SRAM, | 5130 | * iwl4965_verify_ucode - determine which instruction image is in SRAM, |
5701 | * and verify its contents | 5131 | * and verify its contents |
5702 | */ | 5132 | */ |
5703 | static int iwl4965_verify_ucode(struct iwl4965_priv *priv) | 5133 | static int iwl4965_verify_ucode(struct iwl_priv *priv) |
5704 | { | 5134 | { |
5705 | __le32 *image; | 5135 | __le32 *image; |
5706 | u32 len; | 5136 | u32 len; |
@@ -5747,7 +5177,7 @@ static int iwl4965_verify_ucode(struct iwl4965_priv *priv) | |||
5747 | 5177 | ||
5748 | 5178 | ||
5749 | /* check contents of special bootstrap uCode SRAM */ | 5179 | /* check contents of special bootstrap uCode SRAM */ |
5750 | static int iwl4965_verify_bsm(struct iwl4965_priv *priv) | 5180 | static int iwl4965_verify_bsm(struct iwl_priv *priv) |
5751 | { | 5181 | { |
5752 | __le32 *image = priv->ucode_boot.v_addr; | 5182 | __le32 *image = priv->ucode_boot.v_addr; |
5753 | u32 len = priv->ucode_boot.len; | 5183 | u32 len = priv->ucode_boot.len; |
@@ -5809,7 +5239,7 @@ static int iwl4965_verify_bsm(struct iwl4965_priv *priv) | |||
5809 | * the runtime uCode instructions and the backup data cache into SRAM, | 5239 | * the runtime uCode instructions and the backup data cache into SRAM, |
5810 | * and re-launches the runtime uCode from where it left off. | 5240 | * and re-launches the runtime uCode from where it left off. |
5811 | */ | 5241 | */ |
5812 | static int iwl4965_load_bsm(struct iwl4965_priv *priv) | 5242 | static int iwl4965_load_bsm(struct iwl_priv *priv) |
5813 | { | 5243 | { |
5814 | __le32 *image = priv->ucode_boot.v_addr; | 5244 | __le32 *image = priv->ucode_boot.v_addr; |
5815 | u32 len = priv->ucode_boot.len; | 5245 | u32 len = priv->ucode_boot.len; |
@@ -5895,7 +5325,7 @@ static int iwl4965_load_bsm(struct iwl4965_priv *priv) | |||
5895 | return 0; | 5325 | return 0; |
5896 | } | 5326 | } |
5897 | 5327 | ||
5898 | static void iwl4965_nic_start(struct iwl4965_priv *priv) | 5328 | static void iwl4965_nic_start(struct iwl_priv *priv) |
5899 | { | 5329 | { |
5900 | /* Remove all resets to allow NIC to operate */ | 5330 | /* Remove all resets to allow NIC to operate */ |
5901 | iwl4965_write32(priv, CSR_RESET, 0); | 5331 | iwl4965_write32(priv, CSR_RESET, 0); |
@@ -5907,7 +5337,7 @@ static void iwl4965_nic_start(struct iwl4965_priv *priv) | |||
5907 | * | 5337 | * |
5908 | * Copy into buffers for card to fetch via bus-mastering | 5338 | * Copy into buffers for card to fetch via bus-mastering |
5909 | */ | 5339 | */ |
5910 | static int iwl4965_read_ucode(struct iwl4965_priv *priv) | 5340 | static int iwl4965_read_ucode(struct iwl_priv *priv) |
5911 | { | 5341 | { |
5912 | struct iwl4965_ucode *ucode; | 5342 | struct iwl4965_ucode *ucode; |
5913 | int ret; | 5343 | int ret; |
@@ -6108,7 +5538,7 @@ static int iwl4965_read_ucode(struct iwl4965_priv *priv) | |||
6108 | * We need to replace them to load runtime uCode inst and data, | 5538 | * We need to replace them to load runtime uCode inst and data, |
6109 | * and to save runtime data when powering down. | 5539 | * and to save runtime data when powering down. |
6110 | */ | 5540 | */ |
6111 | static int iwl4965_set_ucode_ptrs(struct iwl4965_priv *priv) | 5541 | static int iwl4965_set_ucode_ptrs(struct iwl_priv *priv) |
6112 | { | 5542 | { |
6113 | dma_addr_t pinst; | 5543 | dma_addr_t pinst; |
6114 | dma_addr_t pdata; | 5544 | dma_addr_t pdata; |
@@ -6157,7 +5587,7 @@ static int iwl4965_set_ucode_ptrs(struct iwl4965_priv *priv) | |||
6157 | * | 5587 | * |
6158 | * Tell "initialize" uCode to go ahead and load the runtime uCode. | 5588 | * Tell "initialize" uCode to go ahead and load the runtime uCode. |
6159 | */ | 5589 | */ |
6160 | static void iwl4965_init_alive_start(struct iwl4965_priv *priv) | 5590 | static void iwl4965_init_alive_start(struct iwl_priv *priv) |
6161 | { | 5591 | { |
6162 | /* Check alive response for "valid" sign from uCode */ | 5592 | /* Check alive response for "valid" sign from uCode */ |
6163 | if (priv->card_alive_init.is_valid != UCODE_VALID_OK) { | 5593 | if (priv->card_alive_init.is_valid != UCODE_VALID_OK) { |
@@ -6202,7 +5632,7 @@ static void iwl4965_init_alive_start(struct iwl4965_priv *priv) | |||
6202 | * from protocol/runtime uCode (initialization uCode's | 5632 | * from protocol/runtime uCode (initialization uCode's |
6203 | * Alive gets handled by iwl4965_init_alive_start()). | 5633 | * Alive gets handled by iwl4965_init_alive_start()). |
6204 | */ | 5634 | */ |
6205 | static void iwl4965_alive_start(struct iwl4965_priv *priv) | 5635 | static void iwl4965_alive_start(struct iwl_priv *priv) |
6206 | { | 5636 | { |
6207 | int rc = 0; | 5637 | int rc = 0; |
6208 | 5638 | ||
@@ -6225,7 +5655,7 @@ static void iwl4965_alive_start(struct iwl4965_priv *priv) | |||
6225 | goto restart; | 5655 | goto restart; |
6226 | } | 5656 | } |
6227 | 5657 | ||
6228 | iwl4965_clear_stations_table(priv); | 5658 | iwlcore_clear_stations_table(priv); |
6229 | 5659 | ||
6230 | rc = iwl4965_alive_notify(priv); | 5660 | rc = iwl4965_alive_notify(priv); |
6231 | if (rc) { | 5661 | if (rc) { |
@@ -6287,9 +5717,9 @@ static void iwl4965_alive_start(struct iwl4965_priv *priv) | |||
6287 | queue_work(priv->workqueue, &priv->restart); | 5717 | queue_work(priv->workqueue, &priv->restart); |
6288 | } | 5718 | } |
6289 | 5719 | ||
6290 | static void iwl4965_cancel_deferred_work(struct iwl4965_priv *priv); | 5720 | static void iwl4965_cancel_deferred_work(struct iwl_priv *priv); |
6291 | 5721 | ||
6292 | static void __iwl4965_down(struct iwl4965_priv *priv) | 5722 | static void __iwl4965_down(struct iwl_priv *priv) |
6293 | { | 5723 | { |
6294 | unsigned long flags; | 5724 | unsigned long flags; |
6295 | int exit_pending = test_bit(STATUS_EXIT_PENDING, &priv->status); | 5725 | int exit_pending = test_bit(STATUS_EXIT_PENDING, &priv->status); |
@@ -6302,7 +5732,7 @@ static void __iwl4965_down(struct iwl4965_priv *priv) | |||
6302 | if (!exit_pending) | 5732 | if (!exit_pending) |
6303 | set_bit(STATUS_EXIT_PENDING, &priv->status); | 5733 | set_bit(STATUS_EXIT_PENDING, &priv->status); |
6304 | 5734 | ||
6305 | iwl4965_clear_stations_table(priv); | 5735 | iwlcore_clear_stations_table(priv); |
6306 | 5736 | ||
6307 | /* Unblock any waiting calls */ | 5737 | /* Unblock any waiting calls */ |
6308 | wake_up_interruptible_all(&priv->wait_command_queue); | 5738 | wake_up_interruptible_all(&priv->wait_command_queue); |
@@ -6381,7 +5811,7 @@ static void __iwl4965_down(struct iwl4965_priv *priv) | |||
6381 | iwl4965_clear_free_frames(priv); | 5811 | iwl4965_clear_free_frames(priv); |
6382 | } | 5812 | } |
6383 | 5813 | ||
6384 | static void iwl4965_down(struct iwl4965_priv *priv) | 5814 | static void iwl4965_down(struct iwl_priv *priv) |
6385 | { | 5815 | { |
6386 | mutex_lock(&priv->mutex); | 5816 | mutex_lock(&priv->mutex); |
6387 | __iwl4965_down(priv); | 5817 | __iwl4965_down(priv); |
@@ -6392,7 +5822,7 @@ static void iwl4965_down(struct iwl4965_priv *priv) | |||
6392 | 5822 | ||
6393 | #define MAX_HW_RESTARTS 5 | 5823 | #define MAX_HW_RESTARTS 5 |
6394 | 5824 | ||
6395 | static int __iwl4965_up(struct iwl4965_priv *priv) | 5825 | static int __iwl4965_up(struct iwl_priv *priv) |
6396 | { | 5826 | { |
6397 | int rc, i; | 5827 | int rc, i; |
6398 | 5828 | ||
@@ -6457,7 +5887,7 @@ static int __iwl4965_up(struct iwl4965_priv *priv) | |||
6457 | 5887 | ||
6458 | for (i = 0; i < MAX_HW_RESTARTS; i++) { | 5888 | for (i = 0; i < MAX_HW_RESTARTS; i++) { |
6459 | 5889 | ||
6460 | iwl4965_clear_stations_table(priv); | 5890 | iwlcore_clear_stations_table(priv); |
6461 | 5891 | ||
6462 | /* load bootstrap state machine, | 5892 | /* load bootstrap state machine, |
6463 | * load bootstrap program into processor's memory, | 5893 | * load bootstrap program into processor's memory, |
@@ -6495,8 +5925,8 @@ static int __iwl4965_up(struct iwl4965_priv *priv) | |||
6495 | 5925 | ||
6496 | static void iwl4965_bg_init_alive_start(struct work_struct *data) | 5926 | static void iwl4965_bg_init_alive_start(struct work_struct *data) |
6497 | { | 5927 | { |
6498 | struct iwl4965_priv *priv = | 5928 | struct iwl_priv *priv = |
6499 | container_of(data, struct iwl4965_priv, init_alive_start.work); | 5929 | container_of(data, struct iwl_priv, init_alive_start.work); |
6500 | 5930 | ||
6501 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 5931 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
6502 | return; | 5932 | return; |
@@ -6508,8 +5938,8 @@ static void iwl4965_bg_init_alive_start(struct work_struct *data) | |||
6508 | 5938 | ||
6509 | static void iwl4965_bg_alive_start(struct work_struct *data) | 5939 | static void iwl4965_bg_alive_start(struct work_struct *data) |
6510 | { | 5940 | { |
6511 | struct iwl4965_priv *priv = | 5941 | struct iwl_priv *priv = |
6512 | container_of(data, struct iwl4965_priv, alive_start.work); | 5942 | container_of(data, struct iwl_priv, alive_start.work); |
6513 | 5943 | ||
6514 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 5944 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
6515 | return; | 5945 | return; |
@@ -6521,7 +5951,7 @@ static void iwl4965_bg_alive_start(struct work_struct *data) | |||
6521 | 5951 | ||
6522 | static void iwl4965_bg_rf_kill(struct work_struct *work) | 5952 | static void iwl4965_bg_rf_kill(struct work_struct *work) |
6523 | { | 5953 | { |
6524 | struct iwl4965_priv *priv = container_of(work, struct iwl4965_priv, rf_kill); | 5954 | struct iwl_priv *priv = container_of(work, struct iwl_priv, rf_kill); |
6525 | 5955 | ||
6526 | wake_up_interruptible(&priv->wait_command_queue); | 5956 | wake_up_interruptible(&priv->wait_command_queue); |
6527 | 5957 | ||
@@ -6553,8 +5983,8 @@ static void iwl4965_bg_rf_kill(struct work_struct *work) | |||
6553 | 5983 | ||
6554 | static void iwl4965_bg_scan_check(struct work_struct *data) | 5984 | static void iwl4965_bg_scan_check(struct work_struct *data) |
6555 | { | 5985 | { |
6556 | struct iwl4965_priv *priv = | 5986 | struct iwl_priv *priv = |
6557 | container_of(data, struct iwl4965_priv, scan_check.work); | 5987 | container_of(data, struct iwl_priv, scan_check.work); |
6558 | 5988 | ||
6559 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 5989 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
6560 | return; | 5990 | return; |
@@ -6574,19 +6004,19 @@ static void iwl4965_bg_scan_check(struct work_struct *data) | |||
6574 | 6004 | ||
6575 | static void iwl4965_bg_request_scan(struct work_struct *data) | 6005 | static void iwl4965_bg_request_scan(struct work_struct *data) |
6576 | { | 6006 | { |
6577 | struct iwl4965_priv *priv = | 6007 | struct iwl_priv *priv = |
6578 | container_of(data, struct iwl4965_priv, request_scan); | 6008 | container_of(data, struct iwl_priv, request_scan); |
6579 | struct iwl4965_host_cmd cmd = { | 6009 | struct iwl_host_cmd cmd = { |
6580 | .id = REPLY_SCAN_CMD, | 6010 | .id = REPLY_SCAN_CMD, |
6581 | .len = sizeof(struct iwl4965_scan_cmd), | 6011 | .len = sizeof(struct iwl4965_scan_cmd), |
6582 | .meta.flags = CMD_SIZE_HUGE, | 6012 | .meta.flags = CMD_SIZE_HUGE, |
6583 | }; | 6013 | }; |
6584 | int rc = 0; | ||
6585 | struct iwl4965_scan_cmd *scan; | 6014 | struct iwl4965_scan_cmd *scan; |
6586 | struct ieee80211_conf *conf = NULL; | 6015 | struct ieee80211_conf *conf = NULL; |
6587 | u16 cmd_len; | 6016 | u16 cmd_len; |
6588 | enum ieee80211_band band; | 6017 | enum ieee80211_band band; |
6589 | u8 direct_mask; | 6018 | u8 direct_mask; |
6019 | int ret = 0; | ||
6590 | 6020 | ||
6591 | conf = ieee80211_get_hw_conf(priv->hw); | 6021 | conf = ieee80211_get_hw_conf(priv->hw); |
6592 | 6022 | ||
@@ -6607,7 +6037,7 @@ static void iwl4965_bg_request_scan(struct work_struct *data) | |||
6607 | if (test_bit(STATUS_SCAN_HW, &priv->status)) { | 6037 | if (test_bit(STATUS_SCAN_HW, &priv->status)) { |
6608 | IWL_DEBUG_INFO("Multiple concurrent scan requests in parallel. " | 6038 | IWL_DEBUG_INFO("Multiple concurrent scan requests in parallel. " |
6609 | "Ignoring second request.\n"); | 6039 | "Ignoring second request.\n"); |
6610 | rc = -EIO; | 6040 | ret = -EIO; |
6611 | goto done; | 6041 | goto done; |
6612 | } | 6042 | } |
6613 | 6043 | ||
@@ -6640,7 +6070,7 @@ static void iwl4965_bg_request_scan(struct work_struct *data) | |||
6640 | priv->scan = kmalloc(sizeof(struct iwl4965_scan_cmd) + | 6070 | priv->scan = kmalloc(sizeof(struct iwl4965_scan_cmd) + |
6641 | IWL_MAX_SCAN_SIZE, GFP_KERNEL); | 6071 | IWL_MAX_SCAN_SIZE, GFP_KERNEL); |
6642 | if (!priv->scan) { | 6072 | if (!priv->scan) { |
6643 | rc = -ENOMEM; | 6073 | ret = -ENOMEM; |
6644 | goto done; | 6074 | goto done; |
6645 | } | 6075 | } |
6646 | } | 6076 | } |
@@ -6692,8 +6122,9 @@ static void iwl4965_bg_request_scan(struct work_struct *data) | |||
6692 | scan->direct_scan[0].len = priv->essid_len; | 6122 | scan->direct_scan[0].len = priv->essid_len; |
6693 | memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); | 6123 | memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); |
6694 | direct_mask = 1; | 6124 | direct_mask = 1; |
6695 | } else | 6125 | } else { |
6696 | direct_mask = 0; | 6126 | direct_mask = 0; |
6127 | } | ||
6697 | 6128 | ||
6698 | scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; | 6129 | scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; |
6699 | scan->tx_cmd.sta_id = priv->hw_setting.bcast_sta_id; | 6130 | scan->tx_cmd.sta_id = priv->hw_setting.bcast_sta_id; |
@@ -6768,8 +6199,8 @@ static void iwl4965_bg_request_scan(struct work_struct *data) | |||
6768 | scan->len = cpu_to_le16(cmd.len); | 6199 | scan->len = cpu_to_le16(cmd.len); |
6769 | 6200 | ||
6770 | set_bit(STATUS_SCAN_HW, &priv->status); | 6201 | set_bit(STATUS_SCAN_HW, &priv->status); |
6771 | rc = iwl4965_send_cmd_sync(priv, &cmd); | 6202 | ret = iwl_send_cmd_sync(priv, &cmd); |
6772 | if (rc) | 6203 | if (ret) |
6773 | goto done; | 6204 | goto done; |
6774 | 6205 | ||
6775 | queue_delayed_work(priv->workqueue, &priv->scan_check, | 6206 | queue_delayed_work(priv->workqueue, &priv->scan_check, |
@@ -6786,7 +6217,7 @@ static void iwl4965_bg_request_scan(struct work_struct *data) | |||
6786 | 6217 | ||
6787 | static void iwl4965_bg_up(struct work_struct *data) | 6218 | static void iwl4965_bg_up(struct work_struct *data) |
6788 | { | 6219 | { |
6789 | struct iwl4965_priv *priv = container_of(data, struct iwl4965_priv, up); | 6220 | struct iwl_priv *priv = container_of(data, struct iwl_priv, up); |
6790 | 6221 | ||
6791 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 6222 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
6792 | return; | 6223 | return; |
@@ -6798,7 +6229,7 @@ static void iwl4965_bg_up(struct work_struct *data) | |||
6798 | 6229 | ||
6799 | static void iwl4965_bg_restart(struct work_struct *data) | 6230 | static void iwl4965_bg_restart(struct work_struct *data) |
6800 | { | 6231 | { |
6801 | struct iwl4965_priv *priv = container_of(data, struct iwl4965_priv, restart); | 6232 | struct iwl_priv *priv = container_of(data, struct iwl_priv, restart); |
6802 | 6233 | ||
6803 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 6234 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
6804 | return; | 6235 | return; |
@@ -6809,8 +6240,8 @@ static void iwl4965_bg_restart(struct work_struct *data) | |||
6809 | 6240 | ||
6810 | static void iwl4965_bg_rx_replenish(struct work_struct *data) | 6241 | static void iwl4965_bg_rx_replenish(struct work_struct *data) |
6811 | { | 6242 | { |
6812 | struct iwl4965_priv *priv = | 6243 | struct iwl_priv *priv = |
6813 | container_of(data, struct iwl4965_priv, rx_replenish); | 6244 | container_of(data, struct iwl_priv, rx_replenish); |
6814 | 6245 | ||
6815 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 6246 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
6816 | return; | 6247 | return; |
@@ -6824,11 +6255,10 @@ static void iwl4965_bg_rx_replenish(struct work_struct *data) | |||
6824 | 6255 | ||
6825 | static void iwl4965_bg_post_associate(struct work_struct *data) | 6256 | static void iwl4965_bg_post_associate(struct work_struct *data) |
6826 | { | 6257 | { |
6827 | struct iwl4965_priv *priv = container_of(data, struct iwl4965_priv, | 6258 | struct iwl_priv *priv = container_of(data, struct iwl_priv, |
6828 | post_associate.work); | 6259 | post_associate.work); |
6829 | |||
6830 | int rc = 0; | ||
6831 | struct ieee80211_conf *conf = NULL; | 6260 | struct ieee80211_conf *conf = NULL; |
6261 | int ret = 0; | ||
6832 | DECLARE_MAC_BUF(mac); | 6262 | DECLARE_MAC_BUF(mac); |
6833 | 6263 | ||
6834 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { | 6264 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { |
@@ -6859,9 +6289,9 @@ static void iwl4965_bg_post_associate(struct work_struct *data) | |||
6859 | 6289 | ||
6860 | memset(&priv->rxon_timing, 0, sizeof(struct iwl4965_rxon_time_cmd)); | 6290 | memset(&priv->rxon_timing, 0, sizeof(struct iwl4965_rxon_time_cmd)); |
6861 | iwl4965_setup_rxon_timing(priv); | 6291 | iwl4965_setup_rxon_timing(priv); |
6862 | rc = iwl4965_send_cmd_pdu(priv, REPLY_RXON_TIMING, | 6292 | ret = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, |
6863 | sizeof(priv->rxon_timing), &priv->rxon_timing); | 6293 | sizeof(priv->rxon_timing), &priv->rxon_timing); |
6864 | if (rc) | 6294 | if (ret) |
6865 | IWL_WARNING("REPLY_RXON_TIMING failed - " | 6295 | IWL_WARNING("REPLY_RXON_TIMING failed - " |
6866 | "Attempting to continue.\n"); | 6296 | "Attempting to continue.\n"); |
6867 | 6297 | ||
@@ -6903,7 +6333,7 @@ static void iwl4965_bg_post_associate(struct work_struct *data) | |||
6903 | case IEEE80211_IF_TYPE_IBSS: | 6333 | case IEEE80211_IF_TYPE_IBSS: |
6904 | 6334 | ||
6905 | /* clear out the station table */ | 6335 | /* clear out the station table */ |
6906 | iwl4965_clear_stations_table(priv); | 6336 | iwlcore_clear_stations_table(priv); |
6907 | 6337 | ||
6908 | iwl4965_rxon_add_station(priv, iwl4965_broadcast_addr, 0); | 6338 | iwl4965_rxon_add_station(priv, iwl4965_broadcast_addr, 0); |
6909 | iwl4965_rxon_add_station(priv, priv->bssid, 0); | 6339 | iwl4965_rxon_add_station(priv, priv->bssid, 0); |
@@ -6938,7 +6368,7 @@ static void iwl4965_bg_post_associate(struct work_struct *data) | |||
6938 | 6368 | ||
6939 | static void iwl4965_bg_abort_scan(struct work_struct *work) | 6369 | static void iwl4965_bg_abort_scan(struct work_struct *work) |
6940 | { | 6370 | { |
6941 | struct iwl4965_priv *priv = container_of(work, struct iwl4965_priv, abort_scan); | 6371 | struct iwl_priv *priv = container_of(work, struct iwl_priv, abort_scan); |
6942 | 6372 | ||
6943 | if (!iwl4965_is_ready(priv)) | 6373 | if (!iwl4965_is_ready(priv)) |
6944 | return; | 6374 | return; |
@@ -6955,8 +6385,8 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co | |||
6955 | 6385 | ||
6956 | static void iwl4965_bg_scan_completed(struct work_struct *work) | 6386 | static void iwl4965_bg_scan_completed(struct work_struct *work) |
6957 | { | 6387 | { |
6958 | struct iwl4965_priv *priv = | 6388 | struct iwl_priv *priv = |
6959 | container_of(work, struct iwl4965_priv, scan_completed); | 6389 | container_of(work, struct iwl_priv, scan_completed); |
6960 | 6390 | ||
6961 | IWL_DEBUG(IWL_DL_INFO | IWL_DL_SCAN, "SCAN complete scan\n"); | 6391 | IWL_DEBUG(IWL_DL_INFO | IWL_DL_SCAN, "SCAN complete scan\n"); |
6962 | 6392 | ||
@@ -6985,7 +6415,7 @@ static void iwl4965_bg_scan_completed(struct work_struct *work) | |||
6985 | 6415 | ||
6986 | static int iwl4965_mac_start(struct ieee80211_hw *hw) | 6416 | static int iwl4965_mac_start(struct ieee80211_hw *hw) |
6987 | { | 6417 | { |
6988 | struct iwl4965_priv *priv = hw->priv; | 6418 | struct iwl_priv *priv = hw->priv; |
6989 | int ret; | 6419 | int ret; |
6990 | 6420 | ||
6991 | IWL_DEBUG_MAC80211("enter\n"); | 6421 | IWL_DEBUG_MAC80211("enter\n"); |
@@ -7062,7 +6492,7 @@ out_disable_msi: | |||
7062 | 6492 | ||
7063 | static void iwl4965_mac_stop(struct ieee80211_hw *hw) | 6493 | static void iwl4965_mac_stop(struct ieee80211_hw *hw) |
7064 | { | 6494 | { |
7065 | struct iwl4965_priv *priv = hw->priv; | 6495 | struct iwl_priv *priv = hw->priv; |
7066 | 6496 | ||
7067 | IWL_DEBUG_MAC80211("enter\n"); | 6497 | IWL_DEBUG_MAC80211("enter\n"); |
7068 | 6498 | ||
@@ -7097,7 +6527,7 @@ static void iwl4965_mac_stop(struct ieee80211_hw *hw) | |||
7097 | static int iwl4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb, | 6527 | static int iwl4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb, |
7098 | struct ieee80211_tx_control *ctl) | 6528 | struct ieee80211_tx_control *ctl) |
7099 | { | 6529 | { |
7100 | struct iwl4965_priv *priv = hw->priv; | 6530 | struct iwl_priv *priv = hw->priv; |
7101 | 6531 | ||
7102 | IWL_DEBUG_MAC80211("enter\n"); | 6532 | IWL_DEBUG_MAC80211("enter\n"); |
7103 | 6533 | ||
@@ -7119,7 +6549,7 @@ static int iwl4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
7119 | static int iwl4965_mac_add_interface(struct ieee80211_hw *hw, | 6549 | static int iwl4965_mac_add_interface(struct ieee80211_hw *hw, |
7120 | struct ieee80211_if_init_conf *conf) | 6550 | struct ieee80211_if_init_conf *conf) |
7121 | { | 6551 | { |
7122 | struct iwl4965_priv *priv = hw->priv; | 6552 | struct iwl_priv *priv = hw->priv; |
7123 | unsigned long flags; | 6553 | unsigned long flags; |
7124 | DECLARE_MAC_BUF(mac); | 6554 | DECLARE_MAC_BUF(mac); |
7125 | 6555 | ||
@@ -7160,8 +6590,8 @@ static int iwl4965_mac_add_interface(struct ieee80211_hw *hw, | |||
7160 | */ | 6590 | */ |
7161 | static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) | 6591 | static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) |
7162 | { | 6592 | { |
7163 | struct iwl4965_priv *priv = hw->priv; | 6593 | struct iwl_priv *priv = hw->priv; |
7164 | const struct iwl4965_channel_info *ch_info; | 6594 | const struct iwl_channel_info *ch_info; |
7165 | unsigned long flags; | 6595 | unsigned long flags; |
7166 | int ret = 0; | 6596 | int ret = 0; |
7167 | 6597 | ||
@@ -7176,7 +6606,7 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co | |||
7176 | goto out; | 6606 | goto out; |
7177 | } | 6607 | } |
7178 | 6608 | ||
7179 | if (unlikely(!iwl4965_param_disable_hw_scan && | 6609 | if (unlikely(!priv->cfg->mod_params->disable_hw_scan && |
7180 | test_bit(STATUS_SCANNING, &priv->status))) { | 6610 | test_bit(STATUS_SCANNING, &priv->status))) { |
7181 | IWL_DEBUG_MAC80211("leave - scanning\n"); | 6611 | IWL_DEBUG_MAC80211("leave - scanning\n"); |
7182 | set_bit(STATUS_CONF_PENDING, &priv->status); | 6612 | set_bit(STATUS_CONF_PENDING, &priv->status); |
@@ -7186,7 +6616,7 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co | |||
7186 | 6616 | ||
7187 | spin_lock_irqsave(&priv->lock, flags); | 6617 | spin_lock_irqsave(&priv->lock, flags); |
7188 | 6618 | ||
7189 | ch_info = iwl4965_get_channel_info(priv, conf->channel->band, | 6619 | ch_info = iwl_get_channel_info(priv, conf->channel->band, |
7190 | ieee80211_frequency_to_channel(conf->channel->center_freq)); | 6620 | ieee80211_frequency_to_channel(conf->channel->center_freq)); |
7191 | if (!is_channel_valid(ch_info)) { | 6621 | if (!is_channel_valid(ch_info)) { |
7192 | IWL_DEBUG_MAC80211("leave - invalid channel\n"); | 6622 | IWL_DEBUG_MAC80211("leave - invalid channel\n"); |
@@ -7207,7 +6637,7 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co | |||
7207 | priv->staging_rxon.flags = 0; | 6637 | priv->staging_rxon.flags = 0; |
7208 | #endif /* CONFIG_IWL4965_HT */ | 6638 | #endif /* CONFIG_IWL4965_HT */ |
7209 | 6639 | ||
7210 | iwl4965_set_rxon_channel(priv, conf->channel->band, | 6640 | iwlcore_set_rxon_channel(priv, conf->channel->band, |
7211 | ieee80211_frequency_to_channel(conf->channel->center_freq)); | 6641 | ieee80211_frequency_to_channel(conf->channel->center_freq)); |
7212 | 6642 | ||
7213 | iwl4965_set_flags_for_phymode(priv, conf->channel->band); | 6643 | iwl4965_set_flags_for_phymode(priv, conf->channel->band); |
@@ -7255,9 +6685,9 @@ out: | |||
7255 | return ret; | 6685 | return ret; |
7256 | } | 6686 | } |
7257 | 6687 | ||
7258 | static void iwl4965_config_ap(struct iwl4965_priv *priv) | 6688 | static void iwl4965_config_ap(struct iwl_priv *priv) |
7259 | { | 6689 | { |
7260 | int rc = 0; | 6690 | int ret = 0; |
7261 | 6691 | ||
7262 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 6692 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
7263 | return; | 6693 | return; |
@@ -7272,9 +6702,9 @@ static void iwl4965_config_ap(struct iwl4965_priv *priv) | |||
7272 | /* RXON Timing */ | 6702 | /* RXON Timing */ |
7273 | memset(&priv->rxon_timing, 0, sizeof(struct iwl4965_rxon_time_cmd)); | 6703 | memset(&priv->rxon_timing, 0, sizeof(struct iwl4965_rxon_time_cmd)); |
7274 | iwl4965_setup_rxon_timing(priv); | 6704 | iwl4965_setup_rxon_timing(priv); |
7275 | rc = iwl4965_send_cmd_pdu(priv, REPLY_RXON_TIMING, | 6705 | ret = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, |
7276 | sizeof(priv->rxon_timing), &priv->rxon_timing); | 6706 | sizeof(priv->rxon_timing), &priv->rxon_timing); |
7277 | if (rc) | 6707 | if (ret) |
7278 | IWL_WARNING("REPLY_RXON_TIMING failed - " | 6708 | IWL_WARNING("REPLY_RXON_TIMING failed - " |
7279 | "Attempting to continue.\n"); | 6709 | "Attempting to continue.\n"); |
7280 | 6710 | ||
@@ -7319,7 +6749,7 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, | |||
7319 | struct ieee80211_vif *vif, | 6749 | struct ieee80211_vif *vif, |
7320 | struct ieee80211_if_conf *conf) | 6750 | struct ieee80211_if_conf *conf) |
7321 | { | 6751 | { |
7322 | struct iwl4965_priv *priv = hw->priv; | 6752 | struct iwl_priv *priv = hw->priv; |
7323 | DECLARE_MAC_BUF(mac); | 6753 | DECLARE_MAC_BUF(mac); |
7324 | unsigned long flags; | 6754 | unsigned long flags; |
7325 | int rc; | 6755 | int rc; |
@@ -7437,7 +6867,7 @@ static void iwl4965_configure_filter(struct ieee80211_hw *hw, | |||
7437 | static void iwl4965_mac_remove_interface(struct ieee80211_hw *hw, | 6867 | static void iwl4965_mac_remove_interface(struct ieee80211_hw *hw, |
7438 | struct ieee80211_if_init_conf *conf) | 6868 | struct ieee80211_if_init_conf *conf) |
7439 | { | 6869 | { |
7440 | struct iwl4965_priv *priv = hw->priv; | 6870 | struct iwl_priv *priv = hw->priv; |
7441 | 6871 | ||
7442 | IWL_DEBUG_MAC80211("enter\n"); | 6872 | IWL_DEBUG_MAC80211("enter\n"); |
7443 | 6873 | ||
@@ -7466,7 +6896,7 @@ static void iwl4965_bss_info_changed(struct ieee80211_hw *hw, | |||
7466 | struct ieee80211_bss_conf *bss_conf, | 6896 | struct ieee80211_bss_conf *bss_conf, |
7467 | u32 changes) | 6897 | u32 changes) |
7468 | { | 6898 | { |
7469 | struct iwl4965_priv *priv = hw->priv; | 6899 | struct iwl_priv *priv = hw->priv; |
7470 | 6900 | ||
7471 | if (changes & BSS_CHANGED_ERP_PREAMBLE) { | 6901 | if (changes & BSS_CHANGED_ERP_PREAMBLE) { |
7472 | if (bss_conf->use_short_preamble) | 6902 | if (bss_conf->use_short_preamble) |
@@ -7497,7 +6927,7 @@ static int iwl4965_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) | |||
7497 | { | 6927 | { |
7498 | int rc = 0; | 6928 | int rc = 0; |
7499 | unsigned long flags; | 6929 | unsigned long flags; |
7500 | struct iwl4965_priv *priv = hw->priv; | 6930 | struct iwl_priv *priv = hw->priv; |
7501 | 6931 | ||
7502 | IWL_DEBUG_MAC80211("enter\n"); | 6932 | IWL_DEBUG_MAC80211("enter\n"); |
7503 | 6933 | ||
@@ -7550,18 +6980,69 @@ out_unlock: | |||
7550 | return rc; | 6980 | return rc; |
7551 | } | 6981 | } |
7552 | 6982 | ||
6983 | static void iwl4965_mac_update_tkip_key(struct ieee80211_hw *hw, | ||
6984 | struct ieee80211_key_conf *keyconf, const u8 *addr, | ||
6985 | u32 iv32, u16 *phase1key) | ||
6986 | { | ||
6987 | struct iwl_priv *priv = hw->priv; | ||
6988 | u8 sta_id = IWL_INVALID_STATION; | ||
6989 | unsigned long flags; | ||
6990 | __le16 key_flags = 0; | ||
6991 | int i; | ||
6992 | DECLARE_MAC_BUF(mac); | ||
6993 | |||
6994 | IWL_DEBUG_MAC80211("enter\n"); | ||
6995 | |||
6996 | sta_id = iwl4965_hw_find_station(priv, addr); | ||
6997 | if (sta_id == IWL_INVALID_STATION) { | ||
6998 | IWL_DEBUG_MAC80211("leave - %s not in station map.\n", | ||
6999 | print_mac(mac, addr)); | ||
7000 | return; | ||
7001 | } | ||
7002 | |||
7003 | iwl4965_scan_cancel_timeout(priv, 100); | ||
7004 | |||
7005 | key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK); | ||
7006 | key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); | ||
7007 | key_flags &= ~STA_KEY_FLG_INVALID; | ||
7008 | |||
7009 | if (sta_id == priv->hw_setting.bcast_sta_id) | ||
7010 | key_flags |= STA_KEY_MULTICAST_MSK; | ||
7011 | |||
7012 | spin_lock_irqsave(&priv->sta_lock, flags); | ||
7013 | |||
7014 | priv->stations[sta_id].sta.key.key_offset = | ||
7015 | (sta_id % STA_KEY_MAX_NUM);/* FIXME */ | ||
7016 | priv->stations[sta_id].sta.key.key_flags = key_flags; | ||
7017 | priv->stations[sta_id].sta.key.tkip_rx_tsc_byte2 = (u8) iv32; | ||
7018 | |||
7019 | for (i = 0; i < 5; i++) | ||
7020 | priv->stations[sta_id].sta.key.tkip_rx_ttak[i] = | ||
7021 | cpu_to_le16(phase1key[i]); | ||
7022 | |||
7023 | priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; | ||
7024 | priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; | ||
7025 | |||
7026 | iwl4965_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC); | ||
7027 | |||
7028 | spin_unlock_irqrestore(&priv->sta_lock, flags); | ||
7029 | |||
7030 | IWL_DEBUG_MAC80211("leave\n"); | ||
7031 | } | ||
7032 | |||
7553 | static int iwl4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | 7033 | static int iwl4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, |
7554 | const u8 *local_addr, const u8 *addr, | 7034 | const u8 *local_addr, const u8 *addr, |
7555 | struct ieee80211_key_conf *key) | 7035 | struct ieee80211_key_conf *key) |
7556 | { | 7036 | { |
7557 | struct iwl4965_priv *priv = hw->priv; | 7037 | struct iwl_priv *priv = hw->priv; |
7558 | DECLARE_MAC_BUF(mac); | 7038 | DECLARE_MAC_BUF(mac); |
7559 | int rc = 0; | 7039 | int ret = 0; |
7560 | u8 sta_id; | 7040 | u8 sta_id = IWL_INVALID_STATION; |
7041 | u8 static_key; | ||
7561 | 7042 | ||
7562 | IWL_DEBUG_MAC80211("enter\n"); | 7043 | IWL_DEBUG_MAC80211("enter\n"); |
7563 | 7044 | ||
7564 | if (!iwl4965_param_hwcrypto) { | 7045 | if (!priv->cfg->mod_params->hw_crypto) { |
7565 | IWL_DEBUG_MAC80211("leave - hwcrypto disabled\n"); | 7046 | IWL_DEBUG_MAC80211("leave - hwcrypto disabled\n"); |
7566 | return -EOPNOTSUPP; | 7047 | return -EOPNOTSUPP; |
7567 | } | 7048 | } |
@@ -7570,50 +7051,51 @@ static int iwl4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
7570 | /* only support pairwise keys */ | 7051 | /* only support pairwise keys */ |
7571 | return -EOPNOTSUPP; | 7052 | return -EOPNOTSUPP; |
7572 | 7053 | ||
7573 | sta_id = iwl4965_hw_find_station(priv, addr); | 7054 | /* FIXME: need to differenciate between static and dynamic key |
7574 | if (sta_id == IWL_INVALID_STATION) { | 7055 | * in the level of mac80211 */ |
7575 | IWL_DEBUG_MAC80211("leave - %s not in station map.\n", | 7056 | static_key = !iwl4965_is_associated(priv); |
7576 | print_mac(mac, addr)); | ||
7577 | return -EINVAL; | ||
7578 | } | ||
7579 | 7057 | ||
7580 | mutex_lock(&priv->mutex); | 7058 | if (!static_key) { |
7059 | sta_id = iwl4965_hw_find_station(priv, addr); | ||
7060 | if (sta_id == IWL_INVALID_STATION) { | ||
7061 | IWL_DEBUG_MAC80211("leave - %s not in station map.\n", | ||
7062 | print_mac(mac, addr)); | ||
7063 | return -EINVAL; | ||
7064 | } | ||
7065 | } | ||
7581 | 7066 | ||
7582 | iwl4965_scan_cancel_timeout(priv, 100); | 7067 | iwl4965_scan_cancel_timeout(priv, 100); |
7583 | 7068 | ||
7584 | switch (cmd) { | 7069 | switch (cmd) { |
7585 | case SET_KEY: | 7070 | case SET_KEY: |
7586 | rc = iwl4965_update_sta_key_info(priv, key, sta_id); | 7071 | if (static_key) |
7587 | if (!rc) { | 7072 | ret = iwl4965_set_static_key(priv, key); |
7588 | iwl4965_set_rxon_hwcrypto(priv, 1); | 7073 | else |
7589 | iwl4965_commit_rxon(priv); | 7074 | ret = iwl4965_set_dynamic_key(priv, key, sta_id); |
7590 | key->hw_key_idx = sta_id; | 7075 | |
7591 | IWL_DEBUG_MAC80211("set_key success, using hwcrypto\n"); | 7076 | IWL_DEBUG_MAC80211("enable hwcrypto key\n"); |
7592 | key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; | ||
7593 | } | ||
7594 | break; | 7077 | break; |
7595 | case DISABLE_KEY: | 7078 | case DISABLE_KEY: |
7596 | rc = iwl4965_clear_sta_key_info(priv, sta_id); | 7079 | if (static_key) |
7597 | if (!rc) { | 7080 | ret = iwl4965_remove_static_key(priv); |
7598 | iwl4965_set_rxon_hwcrypto(priv, 0); | 7081 | else |
7599 | iwl4965_commit_rxon(priv); | 7082 | ret = iwl4965_clear_sta_key_info(priv, sta_id); |
7600 | IWL_DEBUG_MAC80211("disable hwcrypto key\n"); | 7083 | |
7601 | } | 7084 | IWL_DEBUG_MAC80211("disable hwcrypto key\n"); |
7602 | break; | 7085 | break; |
7603 | default: | 7086 | default: |
7604 | rc = -EINVAL; | 7087 | ret = -EINVAL; |
7605 | } | 7088 | } |
7606 | 7089 | ||
7607 | IWL_DEBUG_MAC80211("leave\n"); | 7090 | IWL_DEBUG_MAC80211("leave\n"); |
7608 | mutex_unlock(&priv->mutex); | ||
7609 | 7091 | ||
7610 | return rc; | 7092 | return ret; |
7611 | } | 7093 | } |
7612 | 7094 | ||
7613 | static int iwl4965_mac_conf_tx(struct ieee80211_hw *hw, int queue, | 7095 | static int iwl4965_mac_conf_tx(struct ieee80211_hw *hw, int queue, |
7614 | const struct ieee80211_tx_queue_params *params) | 7096 | const struct ieee80211_tx_queue_params *params) |
7615 | { | 7097 | { |
7616 | struct iwl4965_priv *priv = hw->priv; | 7098 | struct iwl_priv *priv = hw->priv; |
7617 | unsigned long flags; | 7099 | unsigned long flags; |
7618 | int q; | 7100 | int q; |
7619 | 7101 | ||
@@ -7664,7 +7146,7 @@ static int iwl4965_mac_conf_tx(struct ieee80211_hw *hw, int queue, | |||
7664 | static int iwl4965_mac_get_tx_stats(struct ieee80211_hw *hw, | 7146 | static int iwl4965_mac_get_tx_stats(struct ieee80211_hw *hw, |
7665 | struct ieee80211_tx_queue_stats *stats) | 7147 | struct ieee80211_tx_queue_stats *stats) |
7666 | { | 7148 | { |
7667 | struct iwl4965_priv *priv = hw->priv; | 7149 | struct iwl_priv *priv = hw->priv; |
7668 | int i, avail; | 7150 | int i, avail; |
7669 | struct iwl4965_tx_queue *txq; | 7151 | struct iwl4965_tx_queue *txq; |
7670 | struct iwl4965_queue *q; | 7152 | struct iwl4965_queue *q; |
@@ -7715,7 +7197,7 @@ static u64 iwl4965_mac_get_tsf(struct ieee80211_hw *hw) | |||
7715 | 7197 | ||
7716 | static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw) | 7198 | static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw) |
7717 | { | 7199 | { |
7718 | struct iwl4965_priv *priv = hw->priv; | 7200 | struct iwl_priv *priv = hw->priv; |
7719 | unsigned long flags; | 7201 | unsigned long flags; |
7720 | 7202 | ||
7721 | mutex_lock(&priv->mutex); | 7203 | mutex_lock(&priv->mutex); |
@@ -7728,7 +7210,7 @@ static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw) | |||
7728 | spin_unlock_irqrestore(&priv->lock, flags); | 7210 | spin_unlock_irqrestore(&priv->lock, flags); |
7729 | #endif /* CONFIG_IWL4965_HT */ | 7211 | #endif /* CONFIG_IWL4965_HT */ |
7730 | 7212 | ||
7731 | iwl4965_reset_qos(priv); | 7213 | iwlcore_reset_qos(priv); |
7732 | 7214 | ||
7733 | cancel_delayed_work(&priv->post_associate); | 7215 | cancel_delayed_work(&priv->post_associate); |
7734 | 7216 | ||
@@ -7787,7 +7269,7 @@ static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw) | |||
7787 | static int iwl4965_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, | 7269 | static int iwl4965_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, |
7788 | struct ieee80211_tx_control *control) | 7270 | struct ieee80211_tx_control *control) |
7789 | { | 7271 | { |
7790 | struct iwl4965_priv *priv = hw->priv; | 7272 | struct iwl_priv *priv = hw->priv; |
7791 | unsigned long flags; | 7273 | unsigned long flags; |
7792 | 7274 | ||
7793 | mutex_lock(&priv->mutex); | 7275 | mutex_lock(&priv->mutex); |
@@ -7817,7 +7299,7 @@ static int iwl4965_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *sk | |||
7817 | IWL_DEBUG_MAC80211("leave\n"); | 7299 | IWL_DEBUG_MAC80211("leave\n"); |
7818 | spin_unlock_irqrestore(&priv->lock, flags); | 7300 | spin_unlock_irqrestore(&priv->lock, flags); |
7819 | 7301 | ||
7820 | iwl4965_reset_qos(priv); | 7302 | iwlcore_reset_qos(priv); |
7821 | 7303 | ||
7822 | queue_work(priv->workqueue, &priv->post_associate.work); | 7304 | queue_work(priv->workqueue, &priv->post_associate.work); |
7823 | 7305 | ||
@@ -7829,7 +7311,7 @@ static int iwl4965_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *sk | |||
7829 | #ifdef CONFIG_IWL4965_HT | 7311 | #ifdef CONFIG_IWL4965_HT |
7830 | 7312 | ||
7831 | static void iwl4965_ht_info_fill(struct ieee80211_conf *conf, | 7313 | static void iwl4965_ht_info_fill(struct ieee80211_conf *conf, |
7832 | struct iwl4965_priv *priv) | 7314 | struct iwl_priv *priv) |
7833 | { | 7315 | { |
7834 | struct iwl_ht_info *iwl_conf = &priv->current_ht_config; | 7316 | struct iwl_ht_info *iwl_conf = &priv->current_ht_config; |
7835 | struct ieee80211_ht_info *ht_conf = &conf->ht_conf; | 7317 | struct ieee80211_ht_info *ht_conf = &conf->ht_conf; |
@@ -7883,7 +7365,7 @@ static void iwl4965_ht_info_fill(struct ieee80211_conf *conf, | |||
7883 | static int iwl4965_mac_conf_ht(struct ieee80211_hw *hw, | 7365 | static int iwl4965_mac_conf_ht(struct ieee80211_hw *hw, |
7884 | struct ieee80211_conf *conf) | 7366 | struct ieee80211_conf *conf) |
7885 | { | 7367 | { |
7886 | struct iwl4965_priv *priv = hw->priv; | 7368 | struct iwl_priv *priv = hw->priv; |
7887 | 7369 | ||
7888 | IWL_DEBUG_MAC80211("enter: \n"); | 7370 | IWL_DEBUG_MAC80211("enter: \n"); |
7889 | 7371 | ||
@@ -7914,7 +7396,7 @@ static int iwl4965_mac_conf_ht(struct ieee80211_hw *hw, | |||
7914 | * | 7396 | * |
7915 | *****************************************************************************/ | 7397 | *****************************************************************************/ |
7916 | 7398 | ||
7917 | #ifdef CONFIG_IWL4965_DEBUG | 7399 | #ifdef CONFIG_IWLWIFI_DEBUG |
7918 | 7400 | ||
7919 | /* | 7401 | /* |
7920 | * The following adds a new attribute to the sysfs representation | 7402 | * The following adds a new attribute to the sysfs representation |
@@ -7926,7 +7408,7 @@ static int iwl4965_mac_conf_ht(struct ieee80211_hw *hw, | |||
7926 | 7408 | ||
7927 | static ssize_t show_debug_level(struct device_driver *d, char *buf) | 7409 | static ssize_t show_debug_level(struct device_driver *d, char *buf) |
7928 | { | 7410 | { |
7929 | return sprintf(buf, "0x%08X\n", iwl4965_debug_level); | 7411 | return sprintf(buf, "0x%08X\n", iwl_debug_level); |
7930 | } | 7412 | } |
7931 | static ssize_t store_debug_level(struct device_driver *d, | 7413 | static ssize_t store_debug_level(struct device_driver *d, |
7932 | const char *buf, size_t count) | 7414 | const char *buf, size_t count) |
@@ -7939,7 +7421,7 @@ static ssize_t store_debug_level(struct device_driver *d, | |||
7939 | printk(KERN_INFO DRV_NAME | 7421 | printk(KERN_INFO DRV_NAME |
7940 | ": %s is not in hex or decimal form.\n", buf); | 7422 | ": %s is not in hex or decimal form.\n", buf); |
7941 | else | 7423 | else |
7942 | iwl4965_debug_level = val; | 7424 | iwl_debug_level = val; |
7943 | 7425 | ||
7944 | return strnlen(buf, count); | 7426 | return strnlen(buf, count); |
7945 | } | 7427 | } |
@@ -7947,7 +7429,7 @@ static ssize_t store_debug_level(struct device_driver *d, | |||
7947 | static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, | 7429 | static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, |
7948 | show_debug_level, store_debug_level); | 7430 | show_debug_level, store_debug_level); |
7949 | 7431 | ||
7950 | #endif /* CONFIG_IWL4965_DEBUG */ | 7432 | #endif /* CONFIG_IWLWIFI_DEBUG */ |
7951 | 7433 | ||
7952 | static ssize_t show_rf_kill(struct device *d, | 7434 | static ssize_t show_rf_kill(struct device *d, |
7953 | struct device_attribute *attr, char *buf) | 7435 | struct device_attribute *attr, char *buf) |
@@ -7958,7 +7440,7 @@ static ssize_t show_rf_kill(struct device *d, | |||
7958 | * 2 - HW based RF kill active | 7440 | * 2 - HW based RF kill active |
7959 | * 3 - Both HW and SW based RF kill active | 7441 | * 3 - Both HW and SW based RF kill active |
7960 | */ | 7442 | */ |
7961 | struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data; | 7443 | struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; |
7962 | int val = (test_bit(STATUS_RF_KILL_SW, &priv->status) ? 0x1 : 0x0) | | 7444 | int val = (test_bit(STATUS_RF_KILL_SW, &priv->status) ? 0x1 : 0x0) | |
7963 | (test_bit(STATUS_RF_KILL_HW, &priv->status) ? 0x2 : 0x0); | 7445 | (test_bit(STATUS_RF_KILL_HW, &priv->status) ? 0x2 : 0x0); |
7964 | 7446 | ||
@@ -7969,7 +7451,7 @@ static ssize_t store_rf_kill(struct device *d, | |||
7969 | struct device_attribute *attr, | 7451 | struct device_attribute *attr, |
7970 | const char *buf, size_t count) | 7452 | const char *buf, size_t count) |
7971 | { | 7453 | { |
7972 | struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data; | 7454 | struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; |
7973 | 7455 | ||
7974 | mutex_lock(&priv->mutex); | 7456 | mutex_lock(&priv->mutex); |
7975 | iwl4965_radio_kill_sw(priv, buf[0] == '1'); | 7457 | iwl4965_radio_kill_sw(priv, buf[0] == '1'); |
@@ -7983,7 +7465,7 @@ static DEVICE_ATTR(rf_kill, S_IWUSR | S_IRUGO, show_rf_kill, store_rf_kill); | |||
7983 | static ssize_t show_temperature(struct device *d, | 7465 | static ssize_t show_temperature(struct device *d, |
7984 | struct device_attribute *attr, char *buf) | 7466 | struct device_attribute *attr, char *buf) |
7985 | { | 7467 | { |
7986 | struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data; | 7468 | struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; |
7987 | 7469 | ||
7988 | if (!iwl4965_is_alive(priv)) | 7470 | if (!iwl4965_is_alive(priv)) |
7989 | return -EAGAIN; | 7471 | return -EAGAIN; |
@@ -7997,7 +7479,7 @@ static ssize_t show_rs_window(struct device *d, | |||
7997 | struct device_attribute *attr, | 7479 | struct device_attribute *attr, |
7998 | char *buf) | 7480 | char *buf) |
7999 | { | 7481 | { |
8000 | struct iwl4965_priv *priv = d->driver_data; | 7482 | struct iwl_priv *priv = d->driver_data; |
8001 | return iwl4965_fill_rs_info(priv->hw, buf, IWL_AP_ID); | 7483 | return iwl4965_fill_rs_info(priv->hw, buf, IWL_AP_ID); |
8002 | } | 7484 | } |
8003 | static DEVICE_ATTR(rs_window, S_IRUGO, show_rs_window, NULL); | 7485 | static DEVICE_ATTR(rs_window, S_IRUGO, show_rs_window, NULL); |
@@ -8005,7 +7487,7 @@ static DEVICE_ATTR(rs_window, S_IRUGO, show_rs_window, NULL); | |||
8005 | static ssize_t show_tx_power(struct device *d, | 7487 | static ssize_t show_tx_power(struct device *d, |
8006 | struct device_attribute *attr, char *buf) | 7488 | struct device_attribute *attr, char *buf) |
8007 | { | 7489 | { |
8008 | struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data; | 7490 | struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; |
8009 | return sprintf(buf, "%d\n", priv->user_txpower_limit); | 7491 | return sprintf(buf, "%d\n", priv->user_txpower_limit); |
8010 | } | 7492 | } |
8011 | 7493 | ||
@@ -8013,7 +7495,7 @@ static ssize_t store_tx_power(struct device *d, | |||
8013 | struct device_attribute *attr, | 7495 | struct device_attribute *attr, |
8014 | const char *buf, size_t count) | 7496 | const char *buf, size_t count) |
8015 | { | 7497 | { |
8016 | struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data; | 7498 | struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; |
8017 | char *p = (char *)buf; | 7499 | char *p = (char *)buf; |
8018 | u32 val; | 7500 | u32 val; |
8019 | 7501 | ||
@@ -8032,7 +7514,7 @@ static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, show_tx_power, store_tx_power); | |||
8032 | static ssize_t show_flags(struct device *d, | 7514 | static ssize_t show_flags(struct device *d, |
8033 | struct device_attribute *attr, char *buf) | 7515 | struct device_attribute *attr, char *buf) |
8034 | { | 7516 | { |
8035 | struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data; | 7517 | struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; |
8036 | 7518 | ||
8037 | return sprintf(buf, "0x%04X\n", priv->active_rxon.flags); | 7519 | return sprintf(buf, "0x%04X\n", priv->active_rxon.flags); |
8038 | } | 7520 | } |
@@ -8041,7 +7523,7 @@ static ssize_t store_flags(struct device *d, | |||
8041 | struct device_attribute *attr, | 7523 | struct device_attribute *attr, |
8042 | const char *buf, size_t count) | 7524 | const char *buf, size_t count) |
8043 | { | 7525 | { |
8044 | struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data; | 7526 | struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; |
8045 | u32 flags = simple_strtoul(buf, NULL, 0); | 7527 | u32 flags = simple_strtoul(buf, NULL, 0); |
8046 | 7528 | ||
8047 | mutex_lock(&priv->mutex); | 7529 | mutex_lock(&priv->mutex); |
@@ -8066,7 +7548,7 @@ static DEVICE_ATTR(flags, S_IWUSR | S_IRUGO, show_flags, store_flags); | |||
8066 | static ssize_t show_filter_flags(struct device *d, | 7548 | static ssize_t show_filter_flags(struct device *d, |
8067 | struct device_attribute *attr, char *buf) | 7549 | struct device_attribute *attr, char *buf) |
8068 | { | 7550 | { |
8069 | struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data; | 7551 | struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; |
8070 | 7552 | ||
8071 | return sprintf(buf, "0x%04X\n", | 7553 | return sprintf(buf, "0x%04X\n", |
8072 | le32_to_cpu(priv->active_rxon.filter_flags)); | 7554 | le32_to_cpu(priv->active_rxon.filter_flags)); |
@@ -8076,7 +7558,7 @@ static ssize_t store_filter_flags(struct device *d, | |||
8076 | struct device_attribute *attr, | 7558 | struct device_attribute *attr, |
8077 | const char *buf, size_t count) | 7559 | const char *buf, size_t count) |
8078 | { | 7560 | { |
8079 | struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data; | 7561 | struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; |
8080 | u32 filter_flags = simple_strtoul(buf, NULL, 0); | 7562 | u32 filter_flags = simple_strtoul(buf, NULL, 0); |
8081 | 7563 | ||
8082 | mutex_lock(&priv->mutex); | 7564 | mutex_lock(&priv->mutex); |
@@ -8105,7 +7587,7 @@ static DEVICE_ATTR(filter_flags, S_IWUSR | S_IRUGO, show_filter_flags, | |||
8105 | static ssize_t show_measurement(struct device *d, | 7587 | static ssize_t show_measurement(struct device *d, |
8106 | struct device_attribute *attr, char *buf) | 7588 | struct device_attribute *attr, char *buf) |
8107 | { | 7589 | { |
8108 | struct iwl4965_priv *priv = dev_get_drvdata(d); | 7590 | struct iwl_priv *priv = dev_get_drvdata(d); |
8109 | struct iwl4965_spectrum_notification measure_report; | 7591 | struct iwl4965_spectrum_notification measure_report; |
8110 | u32 size = sizeof(measure_report), len = 0, ofs = 0; | 7592 | u32 size = sizeof(measure_report), len = 0, ofs = 0; |
8111 | u8 *data = (u8 *) & measure_report; | 7593 | u8 *data = (u8 *) & measure_report; |
@@ -8138,7 +7620,7 @@ static ssize_t store_measurement(struct device *d, | |||
8138 | struct device_attribute *attr, | 7620 | struct device_attribute *attr, |
8139 | const char *buf, size_t count) | 7621 | const char *buf, size_t count) |
8140 | { | 7622 | { |
8141 | struct iwl4965_priv *priv = dev_get_drvdata(d); | 7623 | struct iwl_priv *priv = dev_get_drvdata(d); |
8142 | struct ieee80211_measurement_params params = { | 7624 | struct ieee80211_measurement_params params = { |
8143 | .channel = le16_to_cpu(priv->active_rxon.channel), | 7625 | .channel = le16_to_cpu(priv->active_rxon.channel), |
8144 | .start_time = cpu_to_le64(priv->last_tsf), | 7626 | .start_time = cpu_to_le64(priv->last_tsf), |
@@ -8177,7 +7659,7 @@ static ssize_t store_retry_rate(struct device *d, | |||
8177 | struct device_attribute *attr, | 7659 | struct device_attribute *attr, |
8178 | const char *buf, size_t count) | 7660 | const char *buf, size_t count) |
8179 | { | 7661 | { |
8180 | struct iwl4965_priv *priv = dev_get_drvdata(d); | 7662 | struct iwl_priv *priv = dev_get_drvdata(d); |
8181 | 7663 | ||
8182 | priv->retry_rate = simple_strtoul(buf, NULL, 0); | 7664 | priv->retry_rate = simple_strtoul(buf, NULL, 0); |
8183 | if (priv->retry_rate <= 0) | 7665 | if (priv->retry_rate <= 0) |
@@ -8189,7 +7671,7 @@ static ssize_t store_retry_rate(struct device *d, | |||
8189 | static ssize_t show_retry_rate(struct device *d, | 7671 | static ssize_t show_retry_rate(struct device *d, |
8190 | struct device_attribute *attr, char *buf) | 7672 | struct device_attribute *attr, char *buf) |
8191 | { | 7673 | { |
8192 | struct iwl4965_priv *priv = dev_get_drvdata(d); | 7674 | struct iwl_priv *priv = dev_get_drvdata(d); |
8193 | return sprintf(buf, "%d", priv->retry_rate); | 7675 | return sprintf(buf, "%d", priv->retry_rate); |
8194 | } | 7676 | } |
8195 | 7677 | ||
@@ -8200,7 +7682,7 @@ static ssize_t store_power_level(struct device *d, | |||
8200 | struct device_attribute *attr, | 7682 | struct device_attribute *attr, |
8201 | const char *buf, size_t count) | 7683 | const char *buf, size_t count) |
8202 | { | 7684 | { |
8203 | struct iwl4965_priv *priv = dev_get_drvdata(d); | 7685 | struct iwl_priv *priv = dev_get_drvdata(d); |
8204 | int rc; | 7686 | int rc; |
8205 | int mode; | 7687 | int mode; |
8206 | 7688 | ||
@@ -8254,7 +7736,7 @@ static const s32 period_duration[] = { | |||
8254 | static ssize_t show_power_level(struct device *d, | 7736 | static ssize_t show_power_level(struct device *d, |
8255 | struct device_attribute *attr, char *buf) | 7737 | struct device_attribute *attr, char *buf) |
8256 | { | 7738 | { |
8257 | struct iwl4965_priv *priv = dev_get_drvdata(d); | 7739 | struct iwl_priv *priv = dev_get_drvdata(d); |
8258 | int level = IWL_POWER_LEVEL(priv->power_mode); | 7740 | int level = IWL_POWER_LEVEL(priv->power_mode); |
8259 | char *p = buf; | 7741 | char *p = buf; |
8260 | 7742 | ||
@@ -8298,7 +7780,7 @@ static DEVICE_ATTR(channels, S_IRUSR, show_channels, NULL); | |||
8298 | static ssize_t show_statistics(struct device *d, | 7780 | static ssize_t show_statistics(struct device *d, |
8299 | struct device_attribute *attr, char *buf) | 7781 | struct device_attribute *attr, char *buf) |
8300 | { | 7782 | { |
8301 | struct iwl4965_priv *priv = dev_get_drvdata(d); | 7783 | struct iwl_priv *priv = dev_get_drvdata(d); |
8302 | u32 size = sizeof(struct iwl4965_notif_statistics); | 7784 | u32 size = sizeof(struct iwl4965_notif_statistics); |
8303 | u32 len = 0, ofs = 0; | 7785 | u32 len = 0, ofs = 0; |
8304 | u8 *data = (u8 *) & priv->statistics; | 7786 | u8 *data = (u8 *) & priv->statistics; |
@@ -8336,7 +7818,7 @@ static DEVICE_ATTR(statistics, S_IRUGO, show_statistics, NULL); | |||
8336 | static ssize_t show_antenna(struct device *d, | 7818 | static ssize_t show_antenna(struct device *d, |
8337 | struct device_attribute *attr, char *buf) | 7819 | struct device_attribute *attr, char *buf) |
8338 | { | 7820 | { |
8339 | struct iwl4965_priv *priv = dev_get_drvdata(d); | 7821 | struct iwl_priv *priv = dev_get_drvdata(d); |
8340 | 7822 | ||
8341 | if (!iwl4965_is_alive(priv)) | 7823 | if (!iwl4965_is_alive(priv)) |
8342 | return -EAGAIN; | 7824 | return -EAGAIN; |
@@ -8349,7 +7831,7 @@ static ssize_t store_antenna(struct device *d, | |||
8349 | const char *buf, size_t count) | 7831 | const char *buf, size_t count) |
8350 | { | 7832 | { |
8351 | int ant; | 7833 | int ant; |
8352 | struct iwl4965_priv *priv = dev_get_drvdata(d); | 7834 | struct iwl_priv *priv = dev_get_drvdata(d); |
8353 | 7835 | ||
8354 | if (count == 0) | 7836 | if (count == 0) |
8355 | return 0; | 7837 | return 0; |
@@ -8374,7 +7856,7 @@ static DEVICE_ATTR(antenna, S_IWUSR | S_IRUGO, show_antenna, store_antenna); | |||
8374 | static ssize_t show_status(struct device *d, | 7856 | static ssize_t show_status(struct device *d, |
8375 | struct device_attribute *attr, char *buf) | 7857 | struct device_attribute *attr, char *buf) |
8376 | { | 7858 | { |
8377 | struct iwl4965_priv *priv = (struct iwl4965_priv *)d->driver_data; | 7859 | struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; |
8378 | if (!iwl4965_is_alive(priv)) | 7860 | if (!iwl4965_is_alive(priv)) |
8379 | return -EAGAIN; | 7861 | return -EAGAIN; |
8380 | return sprintf(buf, "0x%08x\n", (int)priv->status); | 7862 | return sprintf(buf, "0x%08x\n", (int)priv->status); |
@@ -8389,7 +7871,7 @@ static ssize_t dump_error_log(struct device *d, | |||
8389 | char *p = (char *)buf; | 7871 | char *p = (char *)buf; |
8390 | 7872 | ||
8391 | if (p[0] == '1') | 7873 | if (p[0] == '1') |
8392 | iwl4965_dump_nic_error_log((struct iwl4965_priv *)d->driver_data); | 7874 | iwl4965_dump_nic_error_log((struct iwl_priv *)d->driver_data); |
8393 | 7875 | ||
8394 | return strnlen(buf, count); | 7876 | return strnlen(buf, count); |
8395 | } | 7877 | } |
@@ -8403,7 +7885,7 @@ static ssize_t dump_event_log(struct device *d, | |||
8403 | char *p = (char *)buf; | 7885 | char *p = (char *)buf; |
8404 | 7886 | ||
8405 | if (p[0] == '1') | 7887 | if (p[0] == '1') |
8406 | iwl4965_dump_nic_event_log((struct iwl4965_priv *)d->driver_data); | 7888 | iwl4965_dump_nic_event_log((struct iwl_priv *)d->driver_data); |
8407 | 7889 | ||
8408 | return strnlen(buf, count); | 7890 | return strnlen(buf, count); |
8409 | } | 7891 | } |
@@ -8416,7 +7898,7 @@ static DEVICE_ATTR(dump_events, S_IWUSR, NULL, dump_event_log); | |||
8416 | * | 7898 | * |
8417 | *****************************************************************************/ | 7899 | *****************************************************************************/ |
8418 | 7900 | ||
8419 | static void iwl4965_setup_deferred_work(struct iwl4965_priv *priv) | 7901 | static void iwl4965_setup_deferred_work(struct iwl_priv *priv) |
8420 | { | 7902 | { |
8421 | priv->workqueue = create_workqueue(DRV_NAME); | 7903 | priv->workqueue = create_workqueue(DRV_NAME); |
8422 | 7904 | ||
@@ -8441,7 +7923,7 @@ static void iwl4965_setup_deferred_work(struct iwl4965_priv *priv) | |||
8441 | iwl4965_irq_tasklet, (unsigned long)priv); | 7923 | iwl4965_irq_tasklet, (unsigned long)priv); |
8442 | } | 7924 | } |
8443 | 7925 | ||
8444 | static void iwl4965_cancel_deferred_work(struct iwl4965_priv *priv) | 7926 | static void iwl4965_cancel_deferred_work(struct iwl_priv *priv) |
8445 | { | 7927 | { |
8446 | iwl4965_hw_cancel_deferred_work(priv); | 7928 | iwl4965_hw_cancel_deferred_work(priv); |
8447 | 7929 | ||
@@ -8489,6 +7971,7 @@ static struct ieee80211_ops iwl4965_hw_ops = { | |||
8489 | .config_interface = iwl4965_mac_config_interface, | 7971 | .config_interface = iwl4965_mac_config_interface, |
8490 | .configure_filter = iwl4965_configure_filter, | 7972 | .configure_filter = iwl4965_configure_filter, |
8491 | .set_key = iwl4965_mac_set_key, | 7973 | .set_key = iwl4965_mac_set_key, |
7974 | .update_tkip_key = iwl4965_mac_update_tkip_key, | ||
8492 | .get_stats = iwl4965_mac_get_stats, | 7975 | .get_stats = iwl4965_mac_get_stats, |
8493 | .get_tx_stats = iwl4965_mac_get_tx_stats, | 7976 | .get_tx_stats = iwl4965_mac_get_tx_stats, |
8494 | .conf_tx = iwl4965_mac_conf_tx, | 7977 | .conf_tx = iwl4965_mac_conf_tx, |
@@ -8506,85 +7989,44 @@ static struct ieee80211_ops iwl4965_hw_ops = { | |||
8506 | static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | 7989 | static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
8507 | { | 7990 | { |
8508 | int err = 0; | 7991 | int err = 0; |
8509 | struct iwl4965_priv *priv; | 7992 | struct iwl_priv *priv; |
8510 | struct ieee80211_hw *hw; | 7993 | struct ieee80211_hw *hw; |
8511 | struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); | 7994 | struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); |
8512 | int i; | ||
8513 | DECLARE_MAC_BUF(mac); | 7995 | DECLARE_MAC_BUF(mac); |
8514 | 7996 | ||
7997 | /************************ | ||
7998 | * 1. Allocating HW data | ||
7999 | ************************/ | ||
8000 | |||
8515 | /* Disabling hardware scan means that mac80211 will perform scans | 8001 | /* Disabling hardware scan means that mac80211 will perform scans |
8516 | * "the hard way", rather than using device's scan. */ | 8002 | * "the hard way", rather than using device's scan. */ |
8517 | if (iwl4965_param_disable_hw_scan) { | 8003 | if (cfg->mod_params->disable_hw_scan) { |
8518 | IWL_DEBUG_INFO("Disabling hw_scan\n"); | 8004 | IWL_DEBUG_INFO("Disabling hw_scan\n"); |
8519 | iwl4965_hw_ops.hw_scan = NULL; | 8005 | iwl4965_hw_ops.hw_scan = NULL; |
8520 | } | 8006 | } |
8521 | 8007 | ||
8522 | if ((iwl4965_param_queues_num > IWL_MAX_NUM_QUEUES) || | 8008 | hw = iwl_alloc_all(cfg, &iwl4965_hw_ops); |
8523 | (iwl4965_param_queues_num < IWL_MIN_NUM_QUEUES)) { | 8009 | if (!hw) { |
8524 | IWL_ERROR("invalid queues_num, should be between %d and %d\n", | ||
8525 | IWL_MIN_NUM_QUEUES, IWL_MAX_NUM_QUEUES); | ||
8526 | err = -EINVAL; | ||
8527 | goto out; | ||
8528 | } | ||
8529 | |||
8530 | /* mac80211 allocates memory for this device instance, including | ||
8531 | * space for this driver's private structure */ | ||
8532 | hw = ieee80211_alloc_hw(sizeof(struct iwl4965_priv), &iwl4965_hw_ops); | ||
8533 | if (hw == NULL) { | ||
8534 | IWL_ERROR("Can not allocate network device\n"); | ||
8535 | err = -ENOMEM; | 8010 | err = -ENOMEM; |
8536 | goto out; | 8011 | goto out; |
8537 | } | 8012 | } |
8538 | SET_IEEE80211_DEV(hw, &pdev->dev); | 8013 | priv = hw->priv; |
8014 | /* At this point both hw and priv are allocated. */ | ||
8539 | 8015 | ||
8540 | hw->rate_control_algorithm = "iwl-4965-rs"; | 8016 | SET_IEEE80211_DEV(hw, &pdev->dev); |
8541 | 8017 | ||
8542 | IWL_DEBUG_INFO("*** LOAD DRIVER ***\n"); | 8018 | IWL_DEBUG_INFO("*** LOAD DRIVER ***\n"); |
8543 | priv = hw->priv; | ||
8544 | priv->hw = hw; | ||
8545 | priv->cfg = cfg; | 8019 | priv->cfg = cfg; |
8546 | |||
8547 | priv->pci_dev = pdev; | 8020 | priv->pci_dev = pdev; |
8548 | priv->antenna = (enum iwl4965_antenna)iwl4965_param_antenna; | 8021 | |
8549 | #ifdef CONFIG_IWL4965_DEBUG | 8022 | #ifdef CONFIG_IWLWIFI_DEBUG |
8550 | iwl4965_debug_level = iwl4965_param_debug; | 8023 | iwl_debug_level = priv->cfg->mod_params->debug; |
8551 | atomic_set(&priv->restrict_refcnt, 0); | 8024 | atomic_set(&priv->restrict_refcnt, 0); |
8552 | #endif | 8025 | #endif |
8553 | priv->retry_rate = 1; | ||
8554 | |||
8555 | priv->ibss_beacon = NULL; | ||
8556 | |||
8557 | /* Tell mac80211 and its clients (e.g. Wireless Extensions) | ||
8558 | * the range of signal quality values that we'll provide. | ||
8559 | * Negative values for level/noise indicate that we'll provide dBm. | ||
8560 | * For WE, at least, non-0 values here *enable* display of values | ||
8561 | * in app (iwconfig). */ | ||
8562 | hw->max_rssi = -20; /* signal level, negative indicates dBm */ | ||
8563 | hw->max_noise = -20; /* noise level, negative indicates dBm */ | ||
8564 | hw->max_signal = 100; /* link quality indication (%) */ | ||
8565 | |||
8566 | /* Tell mac80211 our Tx characteristics */ | ||
8567 | hw->flags = IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE; | ||
8568 | |||
8569 | /* Default value; 4 EDCA QOS priorities */ | ||
8570 | hw->queues = 4; | ||
8571 | #ifdef CONFIG_IWL4965_HT | ||
8572 | /* Enhanced value; more queues, to support 11n aggregation */ | ||
8573 | hw->queues = 16; | ||
8574 | #endif /* CONFIG_IWL4965_HT */ | ||
8575 | |||
8576 | spin_lock_init(&priv->lock); | ||
8577 | spin_lock_init(&priv->power_data.lock); | ||
8578 | spin_lock_init(&priv->sta_lock); | ||
8579 | spin_lock_init(&priv->hcmd_lock); | ||
8580 | spin_lock_init(&priv->lq_mngr.lock); | ||
8581 | |||
8582 | for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) | ||
8583 | INIT_LIST_HEAD(&priv->ibss_mac_hash[i]); | ||
8584 | |||
8585 | INIT_LIST_HEAD(&priv->free_frames); | ||
8586 | 8026 | ||
8587 | mutex_init(&priv->mutex); | 8027 | /************************** |
8028 | * 2. Initializing PCI bus | ||
8029 | **************************/ | ||
8588 | if (pci_enable_device(pdev)) { | 8030 | if (pci_enable_device(pdev)) { |
8589 | err = -ENODEV; | 8031 | err = -ENODEV; |
8590 | goto out_ieee80211_free_hw; | 8032 | goto out_ieee80211_free_hw; |
@@ -8592,31 +8034,28 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
8592 | 8034 | ||
8593 | pci_set_master(pdev); | 8035 | pci_set_master(pdev); |
8594 | 8036 | ||
8595 | /* Clear the driver's (not device's) station table */ | ||
8596 | iwl4965_clear_stations_table(priv); | ||
8597 | |||
8598 | priv->data_retry_limit = -1; | ||
8599 | priv->ieee_channels = NULL; | ||
8600 | priv->ieee_rates = NULL; | ||
8601 | priv->band = IEEE80211_BAND_2GHZ; | ||
8602 | |||
8603 | err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); | 8037 | err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); |
8604 | if (!err) | 8038 | if (!err) |
8605 | err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); | 8039 | err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); |
8606 | if (err) { | 8040 | if (err) { |
8607 | printk(KERN_WARNING DRV_NAME ": No suitable DMA available.\n"); | 8041 | printk(KERN_WARNING DRV_NAME |
8608 | goto out_pci_disable_device; | 8042 | ": No suitable DMA available.\n"); |
8043 | goto out_pci_disable_device; | ||
8609 | } | 8044 | } |
8610 | 8045 | ||
8611 | pci_set_drvdata(pdev, priv); | ||
8612 | err = pci_request_regions(pdev, DRV_NAME); | 8046 | err = pci_request_regions(pdev, DRV_NAME); |
8613 | if (err) | 8047 | if (err) |
8614 | goto out_pci_disable_device; | 8048 | goto out_pci_disable_device; |
8615 | 8049 | ||
8050 | pci_set_drvdata(pdev, priv); | ||
8051 | |||
8616 | /* We disable the RETRY_TIMEOUT register (0x41) to keep | 8052 | /* We disable the RETRY_TIMEOUT register (0x41) to keep |
8617 | * PCI Tx retries from interfering with C3 CPU state */ | 8053 | * PCI Tx retries from interfering with C3 CPU state */ |
8618 | pci_write_config_byte(pdev, 0x41, 0x00); | 8054 | pci_write_config_byte(pdev, 0x41, 0x00); |
8619 | 8055 | ||
8056 | /*********************** | ||
8057 | * 3. Read REV register | ||
8058 | ***********************/ | ||
8620 | priv->hw_base = pci_iomap(pdev, 0, 0); | 8059 | priv->hw_base = pci_iomap(pdev, 0, 0); |
8621 | if (!priv->hw_base) { | 8060 | if (!priv->hw_base) { |
8622 | err = -ENODEV; | 8061 | err = -ENODEV; |
@@ -8624,130 +8063,108 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
8624 | } | 8063 | } |
8625 | 8064 | ||
8626 | IWL_DEBUG_INFO("pci_resource_len = 0x%08llx\n", | 8065 | IWL_DEBUG_INFO("pci_resource_len = 0x%08llx\n", |
8627 | (unsigned long long) pci_resource_len(pdev, 0)); | 8066 | (unsigned long long) pci_resource_len(pdev, 0)); |
8628 | IWL_DEBUG_INFO("pci_resource_base = %p\n", priv->hw_base); | 8067 | IWL_DEBUG_INFO("pci_resource_base = %p\n", priv->hw_base); |
8629 | 8068 | ||
8630 | /* Initialize module parameter values here */ | ||
8631 | |||
8632 | /* Disable radio (SW RF KILL) via parameter when loading driver */ | ||
8633 | if (iwl4965_param_disable) { | ||
8634 | set_bit(STATUS_RF_KILL_SW, &priv->status); | ||
8635 | IWL_DEBUG_INFO("Radio disabled.\n"); | ||
8636 | } | ||
8637 | |||
8638 | priv->iw_mode = IEEE80211_IF_TYPE_STA; | ||
8639 | |||
8640 | priv->ps_mode = 0; | ||
8641 | priv->use_ant_b_for_management_frame = 1; /* start with ant B */ | ||
8642 | priv->valid_antenna = 0x7; /* assume all 3 connected */ | ||
8643 | priv->ps_mode = IWL_MIMO_PS_NONE; | ||
8644 | |||
8645 | /* Choose which receivers/antennas to use */ | ||
8646 | iwl4965_set_rxon_chain(priv); | ||
8647 | |||
8648 | |||
8649 | printk(KERN_INFO DRV_NAME | 8069 | printk(KERN_INFO DRV_NAME |
8650 | ": Detected Intel Wireless WiFi Link %s\n", priv->cfg->name); | 8070 | ": Detected Intel Wireless WiFi Link %s\n", priv->cfg->name); |
8651 | 8071 | ||
8072 | /***************** | ||
8073 | * 4. Read EEPROM | ||
8074 | *****************/ | ||
8075 | /* nic init */ | ||
8076 | iwl4965_set_bit(priv, CSR_GIO_CHICKEN_BITS, | ||
8077 | CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER); | ||
8078 | |||
8079 | iwl4965_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); | ||
8080 | err = iwl4965_poll_bit(priv, CSR_GP_CNTRL, | ||
8081 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, | ||
8082 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); | ||
8083 | if (err < 0) { | ||
8084 | IWL_DEBUG_INFO("Failed to init the card\n"); | ||
8085 | goto out_iounmap; | ||
8086 | } | ||
8087 | /* Read the EEPROM */ | ||
8088 | err = iwl_eeprom_init(priv); | ||
8089 | if (err) { | ||
8090 | IWL_ERROR("Unable to init EEPROM\n"); | ||
8091 | goto out_iounmap; | ||
8092 | } | ||
8093 | /* MAC Address location in EEPROM same for 3945/4965 */ | ||
8094 | iwl_eeprom_get_mac(priv, priv->mac_addr); | ||
8095 | IWL_DEBUG_INFO("MAC address: %s\n", print_mac(mac, priv->mac_addr)); | ||
8096 | SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr); | ||
8097 | |||
8098 | /************************ | ||
8099 | * 5. Setup HW constants | ||
8100 | ************************/ | ||
8652 | /* Device-specific setup */ | 8101 | /* Device-specific setup */ |
8653 | if (iwl4965_hw_set_hw_setting(priv)) { | 8102 | if (iwl4965_hw_set_hw_setting(priv)) { |
8654 | IWL_ERROR("failed to set hw settings\n"); | 8103 | IWL_ERROR("failed to set hw settings\n"); |
8655 | goto out_iounmap; | 8104 | goto out_iounmap; |
8656 | } | 8105 | } |
8657 | 8106 | ||
8658 | if (iwl4965_param_qos_enable) | 8107 | /******************* |
8659 | priv->qos_data.qos_enable = 1; | 8108 | * 6. Setup hw/priv |
8109 | *******************/ | ||
8660 | 8110 | ||
8661 | iwl4965_reset_qos(priv); | 8111 | err = iwl_setup(priv); |
8112 | if (err) | ||
8113 | goto out_unset_hw_settings; | ||
8114 | /* At this point both hw and priv are initialized. */ | ||
8662 | 8115 | ||
8663 | priv->qos_data.qos_active = 0; | 8116 | /********************************** |
8664 | priv->qos_data.qos_cap.val = 0; | 8117 | * 7. Initialize module parameters |
8118 | **********************************/ | ||
8665 | 8119 | ||
8666 | iwl4965_set_rxon_channel(priv, IEEE80211_BAND_2GHZ, 6); | 8120 | /* Disable radio (SW RF KILL) via parameter when loading driver */ |
8667 | iwl4965_setup_deferred_work(priv); | 8121 | if (priv->cfg->mod_params->disable) { |
8668 | iwl4965_setup_rx_handlers(priv); | 8122 | set_bit(STATUS_RF_KILL_SW, &priv->status); |
8123 | IWL_DEBUG_INFO("Radio disabled.\n"); | ||
8124 | } | ||
8669 | 8125 | ||
8670 | priv->rates_mask = IWL_RATES_MASK; | 8126 | if (priv->cfg->mod_params->enable_qos) |
8671 | /* If power management is turned on, default to AC mode */ | 8127 | priv->qos_data.qos_enable = 1; |
8672 | priv->power_mode = IWL_POWER_AC; | ||
8673 | priv->user_txpower_limit = IWL_DEFAULT_TX_POWER; | ||
8674 | 8128 | ||
8129 | /******************** | ||
8130 | * 8. Setup services | ||
8131 | ********************/ | ||
8675 | iwl4965_disable_interrupts(priv); | 8132 | iwl4965_disable_interrupts(priv); |
8676 | 8133 | ||
8677 | err = sysfs_create_group(&pdev->dev.kobj, &iwl4965_attribute_group); | 8134 | err = sysfs_create_group(&pdev->dev.kobj, &iwl4965_attribute_group); |
8678 | if (err) { | 8135 | if (err) { |
8679 | IWL_ERROR("failed to create sysfs device attributes\n"); | 8136 | IWL_ERROR("failed to create sysfs device attributes\n"); |
8680 | goto out_release_irq; | 8137 | goto out_unset_hw_settings; |
8681 | } | 8138 | } |
8682 | 8139 | ||
8683 | /* nic init */ | 8140 | err = iwl_dbgfs_register(priv, DRV_NAME); |
8684 | iwl4965_set_bit(priv, CSR_GIO_CHICKEN_BITS, | ||
8685 | CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER); | ||
8686 | |||
8687 | iwl4965_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); | ||
8688 | err = iwl4965_poll_bit(priv, CSR_GP_CNTRL, | ||
8689 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, | ||
8690 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); | ||
8691 | if (err < 0) { | ||
8692 | IWL_DEBUG_INFO("Failed to init the card\n"); | ||
8693 | goto out_remove_sysfs; | ||
8694 | } | ||
8695 | /* Read the EEPROM */ | ||
8696 | err = iwl_eeprom_init(priv); | ||
8697 | if (err) { | 8141 | if (err) { |
8698 | IWL_ERROR("Unable to init EEPROM\n"); | 8142 | IWL_ERROR("failed to create debugfs files\n"); |
8699 | goto out_remove_sysfs; | 8143 | goto out_remove_sysfs; |
8700 | } | 8144 | } |
8701 | /* MAC Address location in EEPROM same for 3945/4965 */ | ||
8702 | iwl_eeprom_get_mac(priv, priv->mac_addr); | ||
8703 | IWL_DEBUG_INFO("MAC address: %s\n", print_mac(mac, priv->mac_addr)); | ||
8704 | SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr); | ||
8705 | 8145 | ||
8706 | err = iwl4965_init_channel_map(priv); | 8146 | iwl4965_setup_deferred_work(priv); |
8707 | if (err) { | 8147 | iwl4965_setup_rx_handlers(priv); |
8708 | IWL_ERROR("initializing regulatory failed: %d\n", err); | ||
8709 | goto out_remove_sysfs; | ||
8710 | } | ||
8711 | |||
8712 | err = iwl4965_init_geos(priv); | ||
8713 | if (err) { | ||
8714 | IWL_ERROR("initializing geos failed: %d\n", err); | ||
8715 | goto out_free_channel_map; | ||
8716 | } | ||
8717 | |||
8718 | iwl4965_rate_control_register(priv->hw); | ||
8719 | err = ieee80211_register_hw(priv->hw); | ||
8720 | if (err) { | ||
8721 | IWL_ERROR("Failed to register network device (error %d)\n", err); | ||
8722 | goto out_free_geos; | ||
8723 | } | ||
8724 | 8148 | ||
8725 | priv->hw->conf.beacon_int = 100; | 8149 | /******************** |
8726 | priv->mac80211_registered = 1; | 8150 | * 9. Conclude |
8151 | ********************/ | ||
8727 | pci_save_state(pdev); | 8152 | pci_save_state(pdev); |
8728 | pci_disable_device(pdev); | 8153 | pci_disable_device(pdev); |
8729 | 8154 | ||
8730 | return 0; | 8155 | return 0; |
8731 | 8156 | ||
8732 | out_free_geos: | ||
8733 | iwl4965_free_geos(priv); | ||
8734 | out_free_channel_map: | ||
8735 | iwl4965_free_channel_map(priv); | ||
8736 | out_remove_sysfs: | 8157 | out_remove_sysfs: |
8737 | sysfs_remove_group(&pdev->dev.kobj, &iwl4965_attribute_group); | 8158 | sysfs_remove_group(&pdev->dev.kobj, &iwl4965_attribute_group); |
8738 | 8159 | out_unset_hw_settings: | |
8739 | out_release_irq: | ||
8740 | destroy_workqueue(priv->workqueue); | ||
8741 | priv->workqueue = NULL; | ||
8742 | iwl4965_unset_hw_setting(priv); | 8160 | iwl4965_unset_hw_setting(priv); |
8743 | |||
8744 | out_iounmap: | 8161 | out_iounmap: |
8745 | pci_iounmap(pdev, priv->hw_base); | 8162 | pci_iounmap(pdev, priv->hw_base); |
8746 | out_pci_release_regions: | 8163 | out_pci_release_regions: |
8747 | pci_release_regions(pdev); | 8164 | pci_release_regions(pdev); |
8165 | pci_set_drvdata(pdev, NULL); | ||
8748 | out_pci_disable_device: | 8166 | out_pci_disable_device: |
8749 | pci_disable_device(pdev); | 8167 | pci_disable_device(pdev); |
8750 | pci_set_drvdata(pdev, NULL); | ||
8751 | out_ieee80211_free_hw: | 8168 | out_ieee80211_free_hw: |
8752 | ieee80211_free_hw(priv->hw); | 8169 | ieee80211_free_hw(priv->hw); |
8753 | out: | 8170 | out: |
@@ -8756,7 +8173,7 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
8756 | 8173 | ||
8757 | static void iwl4965_pci_remove(struct pci_dev *pdev) | 8174 | static void iwl4965_pci_remove(struct pci_dev *pdev) |
8758 | { | 8175 | { |
8759 | struct iwl4965_priv *priv = pci_get_drvdata(pdev); | 8176 | struct iwl_priv *priv = pci_get_drvdata(pdev); |
8760 | struct list_head *p, *q; | 8177 | struct list_head *p, *q; |
8761 | int i; | 8178 | int i; |
8762 | 8179 | ||
@@ -8777,6 +8194,7 @@ static void iwl4965_pci_remove(struct pci_dev *pdev) | |||
8777 | } | 8194 | } |
8778 | } | 8195 | } |
8779 | 8196 | ||
8197 | iwl_dbgfs_unregister(priv); | ||
8780 | sysfs_remove_group(&pdev->dev.kobj, &iwl4965_attribute_group); | 8198 | sysfs_remove_group(&pdev->dev.kobj, &iwl4965_attribute_group); |
8781 | 8199 | ||
8782 | iwl4965_dealloc_ucode_pci(priv); | 8200 | iwl4965_dealloc_ucode_pci(priv); |
@@ -8786,7 +8204,7 @@ static void iwl4965_pci_remove(struct pci_dev *pdev) | |||
8786 | iwl4965_hw_txq_ctx_free(priv); | 8204 | iwl4965_hw_txq_ctx_free(priv); |
8787 | 8205 | ||
8788 | iwl4965_unset_hw_setting(priv); | 8206 | iwl4965_unset_hw_setting(priv); |
8789 | iwl4965_clear_stations_table(priv); | 8207 | iwlcore_clear_stations_table(priv); |
8790 | 8208 | ||
8791 | if (priv->mac80211_registered) { | 8209 | if (priv->mac80211_registered) { |
8792 | ieee80211_unregister_hw(priv->hw); | 8210 | ieee80211_unregister_hw(priv->hw); |
@@ -8807,7 +8225,7 @@ static void iwl4965_pci_remove(struct pci_dev *pdev) | |||
8807 | pci_disable_device(pdev); | 8225 | pci_disable_device(pdev); |
8808 | pci_set_drvdata(pdev, NULL); | 8226 | pci_set_drvdata(pdev, NULL); |
8809 | 8227 | ||
8810 | iwl4965_free_channel_map(priv); | 8228 | iwl_free_channel_map(priv); |
8811 | iwl4965_free_geos(priv); | 8229 | iwl4965_free_geos(priv); |
8812 | 8230 | ||
8813 | if (priv->ibss_beacon) | 8231 | if (priv->ibss_beacon) |
@@ -8820,7 +8238,7 @@ static void iwl4965_pci_remove(struct pci_dev *pdev) | |||
8820 | 8238 | ||
8821 | static int iwl4965_pci_suspend(struct pci_dev *pdev, pm_message_t state) | 8239 | static int iwl4965_pci_suspend(struct pci_dev *pdev, pm_message_t state) |
8822 | { | 8240 | { |
8823 | struct iwl4965_priv *priv = pci_get_drvdata(pdev); | 8241 | struct iwl_priv *priv = pci_get_drvdata(pdev); |
8824 | 8242 | ||
8825 | if (priv->is_open) { | 8243 | if (priv->is_open) { |
8826 | set_bit(STATUS_IN_SUSPEND, &priv->status); | 8244 | set_bit(STATUS_IN_SUSPEND, &priv->status); |
@@ -8835,7 +8253,7 @@ static int iwl4965_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
8835 | 8253 | ||
8836 | static int iwl4965_pci_resume(struct pci_dev *pdev) | 8254 | static int iwl4965_pci_resume(struct pci_dev *pdev) |
8837 | { | 8255 | { |
8838 | struct iwl4965_priv *priv = pci_get_drvdata(pdev); | 8256 | struct iwl_priv *priv = pci_get_drvdata(pdev); |
8839 | 8257 | ||
8840 | pci_set_power_state(pdev, PCI_D0); | 8258 | pci_set_power_state(pdev, PCI_D0); |
8841 | 8259 | ||
@@ -8876,7 +8294,7 @@ static int __init iwl4965_init(void) | |||
8876 | IWL_ERROR("Unable to initialize PCI module\n"); | 8294 | IWL_ERROR("Unable to initialize PCI module\n"); |
8877 | return ret; | 8295 | return ret; |
8878 | } | 8296 | } |
8879 | #ifdef CONFIG_IWL4965_DEBUG | 8297 | #ifdef CONFIG_IWLWIFI_DEBUG |
8880 | ret = driver_create_file(&iwl4965_driver.driver, &driver_attr_debug_level); | 8298 | ret = driver_create_file(&iwl4965_driver.driver, &driver_attr_debug_level); |
8881 | if (ret) { | 8299 | if (ret) { |
8882 | IWL_ERROR("Unable to create driver sysfs file\n"); | 8300 | IWL_ERROR("Unable to create driver sysfs file\n"); |
@@ -8890,32 +8308,11 @@ static int __init iwl4965_init(void) | |||
8890 | 8308 | ||
8891 | static void __exit iwl4965_exit(void) | 8309 | static void __exit iwl4965_exit(void) |
8892 | { | 8310 | { |
8893 | #ifdef CONFIG_IWL4965_DEBUG | 8311 | #ifdef CONFIG_IWLWIFI_DEBUG |
8894 | driver_remove_file(&iwl4965_driver.driver, &driver_attr_debug_level); | 8312 | driver_remove_file(&iwl4965_driver.driver, &driver_attr_debug_level); |
8895 | #endif | 8313 | #endif |
8896 | pci_unregister_driver(&iwl4965_driver); | 8314 | pci_unregister_driver(&iwl4965_driver); |
8897 | } | 8315 | } |
8898 | 8316 | ||
8899 | module_param_named(antenna, iwl4965_param_antenna, int, 0444); | ||
8900 | MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])"); | ||
8901 | module_param_named(disable, iwl4965_param_disable, int, 0444); | ||
8902 | MODULE_PARM_DESC(disable, "manually disable the radio (default 0 [radio on])"); | ||
8903 | module_param_named(hwcrypto, iwl4965_param_hwcrypto, int, 0444); | ||
8904 | MODULE_PARM_DESC(hwcrypto, | ||
8905 | "using hardware crypto engine (default 0 [software])\n"); | ||
8906 | module_param_named(debug, iwl4965_param_debug, int, 0444); | ||
8907 | MODULE_PARM_DESC(debug, "debug output mask"); | ||
8908 | module_param_named(disable_hw_scan, iwl4965_param_disable_hw_scan, int, 0444); | ||
8909 | MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 0)"); | ||
8910 | |||
8911 | module_param_named(queues_num, iwl4965_param_queues_num, int, 0444); | ||
8912 | MODULE_PARM_DESC(queues_num, "number of hw queues."); | ||
8913 | |||
8914 | /* QoS */ | ||
8915 | module_param_named(qos_enable, iwl4965_param_qos_enable, int, 0444); | ||
8916 | MODULE_PARM_DESC(qos_enable, "enable all QoS functionality"); | ||
8917 | module_param_named(amsdu_size_8K, iwl4965_param_amsdu_size_8K, int, 0444); | ||
8918 | MODULE_PARM_DESC(amsdu_size_8K, "enable 8K amsdu size"); | ||
8919 | |||
8920 | module_exit(iwl4965_exit); | 8317 | module_exit(iwl4965_exit); |
8921 | module_init(iwl4965_init); | 8318 | module_init(iwl4965_init); |