aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl4965-base.c
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2008-03-21 16:53:44 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-03-25 16:41:55 -0400
commit857485c0c46ceee5c658c1761bba4d9a5ddf433f (patch)
treedf2028c6a3d99ad32491efba7b6ca69f7d45edcf /drivers/net/wireless/iwlwifi/iwl4965-base.c
parent8622e7058a8764223ae2305d980a38d07f034717 (diff)
iwlwifi: move host command sending functions to core module
1. Host command sending functions moved from iwl4965-base.c to iwl-hcmd.c in iwlcore module 2. enqueue_hcmd function currently stays in iwl4965-base.c. It is invoked through the new 'utils' field in priv's ops. Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Assaf Krauss <assaf.krauss@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c299
1 files changed, 50 insertions, 249 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index fac9bf1aa1d7..8fe09e893279 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -305,7 +305,7 @@ int iwl4965_tx_queue_init(struct iwl_priv *priv,
305 * For normal Tx queues (all other queues), no super-size command 305 * For normal Tx queues (all other queues), no super-size command
306 * space is needed. 306 * space is needed.
307 */ 307 */
308 len = sizeof(struct iwl4965_cmd) * slots_num; 308 len = sizeof(struct iwl_cmd) * slots_num;
309 if (txq_id == IWL_CMD_QUEUE_NUM) 309 if (txq_id == IWL_CMD_QUEUE_NUM)
310 len += IWL_MAX_SCAN_SIZE; 310 len += IWL_MAX_SCAN_SIZE;
311 txq->cmd = pci_alloc_consistent(dev, len, &txq->dma_addr_cmd); 311 txq->cmd = pci_alloc_consistent(dev, len, &txq->dma_addr_cmd);
@@ -356,7 +356,7 @@ void iwl4965_tx_queue_free(struct iwl_priv *priv, struct iwl4965_tx_queue *txq)
356 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) 356 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd))
357 iwl4965_hw_txq_free_tfd(priv, txq); 357 iwl4965_hw_txq_free_tfd(priv, txq);
358 358
359 len = sizeof(struct iwl4965_cmd) * q->n_window; 359 len = sizeof(struct iwl_cmd) * q->n_window;
360 if (q->id == IWL_CMD_QUEUE_NUM) 360 if (q->id == IWL_CMD_QUEUE_NUM)
361 len += IWL_MAX_SCAN_SIZE; 361 len += IWL_MAX_SCAN_SIZE;
362 362
@@ -541,65 +541,6 @@ static inline int iwl4965_is_ready_rf(struct iwl_priv *priv)
541 541
542/*************** HOST COMMAND QUEUE FUNCTIONS *****/ 542/*************** HOST COMMAND QUEUE FUNCTIONS *****/
543 543
544#define IWL_CMD(x) case x : return #x
545
546static const char *get_cmd_string(u8 cmd)
547{
548 switch (cmd) {
549 IWL_CMD(REPLY_ALIVE);
550 IWL_CMD(REPLY_ERROR);
551 IWL_CMD(REPLY_RXON);
552 IWL_CMD(REPLY_RXON_ASSOC);
553 IWL_CMD(REPLY_QOS_PARAM);
554 IWL_CMD(REPLY_RXON_TIMING);
555 IWL_CMD(REPLY_ADD_STA);
556 IWL_CMD(REPLY_REMOVE_STA);
557 IWL_CMD(REPLY_REMOVE_ALL_STA);
558 IWL_CMD(REPLY_TX);
559 IWL_CMD(REPLY_RATE_SCALE);
560 IWL_CMD(REPLY_LEDS_CMD);
561 IWL_CMD(REPLY_TX_LINK_QUALITY_CMD);
562 IWL_CMD(RADAR_NOTIFICATION);
563 IWL_CMD(REPLY_QUIET_CMD);
564 IWL_CMD(REPLY_CHANNEL_SWITCH);
565 IWL_CMD(CHANNEL_SWITCH_NOTIFICATION);
566 IWL_CMD(REPLY_SPECTRUM_MEASUREMENT_CMD);
567 IWL_CMD(SPECTRUM_MEASURE_NOTIFICATION);
568 IWL_CMD(POWER_TABLE_CMD);
569 IWL_CMD(PM_SLEEP_NOTIFICATION);
570 IWL_CMD(PM_DEBUG_STATISTIC_NOTIFIC);
571 IWL_CMD(REPLY_SCAN_CMD);
572 IWL_CMD(REPLY_SCAN_ABORT_CMD);
573 IWL_CMD(SCAN_START_NOTIFICATION);
574 IWL_CMD(SCAN_RESULTS_NOTIFICATION);
575 IWL_CMD(SCAN_COMPLETE_NOTIFICATION);
576 IWL_CMD(BEACON_NOTIFICATION);
577 IWL_CMD(REPLY_TX_BEACON);
578 IWL_CMD(WHO_IS_AWAKE_NOTIFICATION);
579 IWL_CMD(QUIET_NOTIFICATION);
580 IWL_CMD(REPLY_TX_PWR_TABLE_CMD);
581 IWL_CMD(MEASURE_ABORT_NOTIFICATION);
582 IWL_CMD(REPLY_BT_CONFIG);
583 IWL_CMD(REPLY_STATISTICS_CMD);
584 IWL_CMD(STATISTICS_NOTIFICATION);
585 IWL_CMD(REPLY_CARD_STATE_CMD);
586 IWL_CMD(CARD_STATE_NOTIFICATION);
587 IWL_CMD(MISSED_BEACONS_NOTIFICATION);
588 IWL_CMD(REPLY_CT_KILL_CONFIG_CMD);
589 IWL_CMD(SENSITIVITY_CMD);
590 IWL_CMD(REPLY_PHY_CALIBRATION_CMD);
591 IWL_CMD(REPLY_RX_PHY_CMD);
592 IWL_CMD(REPLY_RX_MPDU_CMD);
593 IWL_CMD(REPLY_4965_RX);
594 IWL_CMD(REPLY_COMPRESSED_BA);
595 default:
596 return "UNKNOWN";
597
598 }
599}
600
601#define HOST_COMPLETE_TIMEOUT (HZ / 2)
602
603/** 544/**
604 * iwl4965_enqueue_hcmd - enqueue a uCode command 545 * iwl4965_enqueue_hcmd - enqueue a uCode command
605 * @priv: device private data point 546 * @priv: device private data point
@@ -609,13 +550,13 @@ static const char *get_cmd_string(u8 cmd)
609 * failed. On success, it turns the index (> 0) of command in the 550 * failed. On success, it turns the index (> 0) of command in the
610 * command queue. 551 * command queue.
611 */ 552 */
612static int iwl4965_enqueue_hcmd(struct iwl_priv *priv, struct iwl4965_host_cmd *cmd) 553int iwl4965_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
613{ 554{
614 struct iwl4965_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM]; 555 struct iwl4965_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM];
615 struct iwl4965_queue *q = &txq->q; 556 struct iwl4965_queue *q = &txq->q;
616 struct iwl4965_tfd_frame *tfd; 557 struct iwl4965_tfd_frame *tfd;
617 u32 *control_flags; 558 u32 *control_flags;
618 struct iwl4965_cmd *out_cmd; 559 struct iwl_cmd *out_cmd;
619 u32 idx; 560 u32 idx;
620 u16 fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr)); 561 u16 fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr));
621 dma_addr_t phys_addr; 562 dma_addr_t phys_addr;
@@ -662,7 +603,7 @@ static int iwl4965_enqueue_hcmd(struct iwl_priv *priv, struct iwl4965_host_cmd *
662 out_cmd->hdr.sequence |= cpu_to_le16(SEQ_HUGE_FRAME); 603 out_cmd->hdr.sequence |= cpu_to_le16(SEQ_HUGE_FRAME);
663 604
664 phys_addr = txq->dma_addr_cmd + sizeof(txq->cmd[0]) * idx + 605 phys_addr = txq->dma_addr_cmd + sizeof(txq->cmd[0]) * idx +
665 offsetof(struct iwl4965_cmd, hdr); 606 offsetof(struct iwl_cmd, hdr);
666 iwl4965_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size); 607 iwl4965_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size);
667 608
668 IWL_DEBUG_HC("Sending command %s (#%x), seq: 0x%04X, " 609 IWL_DEBUG_HC("Sending command %s (#%x), seq: 0x%04X, "
@@ -684,118 +625,6 @@ static int iwl4965_enqueue_hcmd(struct iwl_priv *priv, struct iwl4965_host_cmd *
684 return ret ? ret : idx; 625 return ret ? ret : idx;
685} 626}
686 627
687static int iwl4965_send_cmd_async(struct iwl_priv *priv, struct iwl4965_host_cmd *cmd)
688{
689 int ret;
690
691 BUG_ON(!(cmd->meta.flags & CMD_ASYNC));
692
693 /* An asynchronous command can not expect an SKB to be set. */
694 BUG_ON(cmd->meta.flags & CMD_WANT_SKB);
695
696 /* An asynchronous command MUST have a callback. */
697 BUG_ON(!cmd->meta.u.callback);
698
699 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
700 return -EBUSY;
701
702 ret = iwl4965_enqueue_hcmd(priv, cmd);
703 if (ret < 0) {
704 IWL_ERROR("Error sending %s: iwl4965_enqueue_hcmd failed: %d\n",
705 get_cmd_string(cmd->id), ret);
706 return ret;
707 }
708 return 0;
709}
710
711static int iwl4965_send_cmd_sync(struct iwl_priv *priv, struct iwl4965_host_cmd *cmd)
712{
713 int cmd_idx;
714 int ret;
715 static atomic_t entry = ATOMIC_INIT(0); /* reentrance protection */
716
717 BUG_ON(cmd->meta.flags & CMD_ASYNC);
718
719 /* A synchronous command can not have a callback set. */
720 BUG_ON(cmd->meta.u.callback != NULL);
721
722 if (atomic_xchg(&entry, 1)) {
723 IWL_ERROR("Error sending %s: Already sending a host command\n",
724 get_cmd_string(cmd->id));
725 return -EBUSY;
726 }
727
728 set_bit(STATUS_HCMD_ACTIVE, &priv->status);
729
730 if (cmd->meta.flags & CMD_WANT_SKB)
731 cmd->meta.source = &cmd->meta;
732
733 cmd_idx = iwl4965_enqueue_hcmd(priv, cmd);
734 if (cmd_idx < 0) {
735 ret = cmd_idx;
736 IWL_ERROR("Error sending %s: iwl4965_enqueue_hcmd failed: %d\n",
737 get_cmd_string(cmd->id), ret);
738 goto out;
739 }
740
741 ret = wait_event_interruptible_timeout(priv->wait_command_queue,
742 !test_bit(STATUS_HCMD_ACTIVE, &priv->status),
743 HOST_COMPLETE_TIMEOUT);
744 if (!ret) {
745 if (test_bit(STATUS_HCMD_ACTIVE, &priv->status)) {
746 IWL_ERROR("Error sending %s: time out after %dms.\n",
747 get_cmd_string(cmd->id),
748 jiffies_to_msecs(HOST_COMPLETE_TIMEOUT));
749
750 clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
751 ret = -ETIMEDOUT;
752 goto cancel;
753 }
754 }
755
756 if (test_bit(STATUS_RF_KILL_HW, &priv->status)) {
757 IWL_DEBUG_INFO("Command %s aborted: RF KILL Switch\n",
758 get_cmd_string(cmd->id));
759 ret = -ECANCELED;
760 goto fail;
761 }
762 if (test_bit(STATUS_FW_ERROR, &priv->status)) {
763 IWL_DEBUG_INFO("Command %s failed: FW Error\n",
764 get_cmd_string(cmd->id));
765 ret = -EIO;
766 goto fail;
767 }
768 if ((cmd->meta.flags & CMD_WANT_SKB) && !cmd->meta.u.skb) {
769 IWL_ERROR("Error: Response NULL in '%s'\n",
770 get_cmd_string(cmd->id));
771 ret = -EIO;
772 goto out;
773 }
774
775 ret = 0;
776 goto out;
777
778cancel:
779 if (cmd->meta.flags & CMD_WANT_SKB) {
780 struct iwl4965_cmd *qcmd;
781
782 /* Cancel the CMD_WANT_SKB flag for the cmd in the
783 * TX cmd queue. Otherwise in case the cmd comes
784 * in later, it will possibly set an invalid
785 * address (cmd->meta.source). */
786 qcmd = &priv->txq[IWL_CMD_QUEUE_NUM].cmd[cmd_idx];
787 qcmd->meta.flags &= ~CMD_WANT_SKB;
788 }
789fail:
790 if (cmd->meta.u.skb) {
791 dev_kfree_skb_any(cmd->meta.u.skb);
792 cmd->meta.u.skb = NULL;
793 }
794out:
795 atomic_set(&entry, 0);
796 return ret;
797}
798
799static void iwl4965_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt) 628static void iwl4965_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt)
800{ 629{
801 struct iwl4965_rxon_cmd *rxon = &priv->staging_rxon; 630 struct iwl4965_rxon_cmd *rxon = &priv->staging_rxon;
@@ -807,39 +636,11 @@ static void iwl4965_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt)
807 636
808} 637}
809 638
810int iwl4965_send_cmd(struct iwl_priv *priv, struct iwl4965_host_cmd *cmd)
811{
812 if (cmd->meta.flags & CMD_ASYNC)
813 return iwl4965_send_cmd_async(priv, cmd);
814
815 return iwl4965_send_cmd_sync(priv, cmd);
816}
817
818int iwl4965_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, const void *data)
819{
820 struct iwl4965_host_cmd cmd = {
821 .id = id,
822 .len = len,
823 .data = data,
824 };
825
826 return iwl4965_send_cmd_sync(priv, &cmd);
827}
828
829static int __must_check iwl4965_send_cmd_u32(struct iwl_priv *priv, u8 id, u32 val)
830{
831 struct iwl4965_host_cmd cmd = {
832 .id = id,
833 .len = sizeof(val),
834 .data = &val,
835 };
836
837 return iwl4965_send_cmd_sync(priv, &cmd);
838}
839
840int iwl4965_send_statistics_request(struct iwl_priv *priv) 639int iwl4965_send_statistics_request(struct iwl_priv *priv)
841{ 640{
842 return iwl4965_send_cmd_u32(priv, REPLY_STATISTICS_CMD, 0); 641 u32 flags = 0;
642 return iwl_send_cmd_pdu(priv, REPLY_STATISTICS_CMD,
643 sizeof(flags), &flags);
843} 644}
844 645
845/** 646/**
@@ -1000,7 +801,7 @@ static int iwl4965_send_rxon_assoc(struct iwl_priv *priv)
1000 int rc = 0; 801 int rc = 0;
1001 struct iwl4965_rx_packet *res = NULL; 802 struct iwl4965_rx_packet *res = NULL;
1002 struct iwl4965_rxon_assoc_cmd rxon_assoc; 803 struct iwl4965_rxon_assoc_cmd rxon_assoc;
1003 struct iwl4965_host_cmd cmd = { 804 struct iwl_host_cmd cmd = {
1004 .id = REPLY_RXON_ASSOC, 805 .id = REPLY_RXON_ASSOC,
1005 .len = sizeof(rxon_assoc), 806 .len = sizeof(rxon_assoc),
1006 .meta.flags = CMD_WANT_SKB, 807 .meta.flags = CMD_WANT_SKB,
@@ -1033,7 +834,7 @@ static int iwl4965_send_rxon_assoc(struct iwl_priv *priv)
1033 priv->staging_rxon.ofdm_ht_dual_stream_basic_rates; 834 priv->staging_rxon.ofdm_ht_dual_stream_basic_rates;
1034 rxon_assoc.rx_chain_select_flags = priv->staging_rxon.rx_chain; 835 rxon_assoc.rx_chain_select_flags = priv->staging_rxon.rx_chain;
1035 836
1036 rc = iwl4965_send_cmd_sync(priv, &cmd); 837 rc = iwl_send_cmd_sync(priv, &cmd);
1037 if (rc) 838 if (rc)
1038 return rc; 839 return rc;
1039 840
@@ -1112,7 +913,7 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv)
1112 IWL_DEBUG_INFO("Toggling associated bit on current RXON\n"); 913 IWL_DEBUG_INFO("Toggling associated bit on current RXON\n");
1113 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 914 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
1114 915
1115 rc = iwl4965_send_cmd_pdu(priv, REPLY_RXON, 916 rc = iwl_send_cmd_pdu(priv, REPLY_RXON,
1116 sizeof(struct iwl4965_rxon_cmd), 917 sizeof(struct iwl4965_rxon_cmd),
1117 &priv->active_rxon); 918 &priv->active_rxon);
1118 919
@@ -1137,7 +938,7 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv)
1137 938
1138 iwl4965_set_rxon_hwcrypto(priv, priv->cfg->mod_params->hw_crypto); 939 iwl4965_set_rxon_hwcrypto(priv, priv->cfg->mod_params->hw_crypto);
1139 /* Apply the new configuration */ 940 /* Apply the new configuration */
1140 rc = iwl4965_send_cmd_pdu(priv, REPLY_RXON, 941 rc = iwl_send_cmd_pdu(priv, REPLY_RXON,
1141 sizeof(struct iwl4965_rxon_cmd), &priv->staging_rxon); 942 sizeof(struct iwl4965_rxon_cmd), &priv->staging_rxon);
1142 if (rc) { 943 if (rc) {
1143 IWL_ERROR("Error setting new configuration (%d).\n", rc); 944 IWL_ERROR("Error setting new configuration (%d).\n", rc);
@@ -1196,7 +997,7 @@ static int iwl4965_send_bt_config(struct iwl_priv *priv)
1196 .kill_cts_mask = 0, 997 .kill_cts_mask = 0,
1197 }; 998 };
1198 999
1199 return iwl4965_send_cmd_pdu(priv, REPLY_BT_CONFIG, 1000 return iwl_send_cmd_pdu(priv, REPLY_BT_CONFIG,
1200 sizeof(struct iwl4965_bt_cmd), &bt_cmd); 1001 sizeof(struct iwl4965_bt_cmd), &bt_cmd);
1201} 1002}
1202 1003
@@ -1204,7 +1005,7 @@ static int iwl4965_send_scan_abort(struct iwl_priv *priv)
1204{ 1005{
1205 int rc = 0; 1006 int rc = 0;
1206 struct iwl4965_rx_packet *res; 1007 struct iwl4965_rx_packet *res;
1207 struct iwl4965_host_cmd cmd = { 1008 struct iwl_host_cmd cmd = {
1208 .id = REPLY_SCAN_ABORT_CMD, 1009 .id = REPLY_SCAN_ABORT_CMD,
1209 .meta.flags = CMD_WANT_SKB, 1010 .meta.flags = CMD_WANT_SKB,
1210 }; 1011 };
@@ -1217,7 +1018,7 @@ static int iwl4965_send_scan_abort(struct iwl_priv *priv)
1217 return 0; 1018 return 0;
1218 } 1019 }
1219 1020
1220 rc = iwl4965_send_cmd_sync(priv, &cmd); 1021 rc = iwl_send_cmd_sync(priv, &cmd);
1221 if (rc) { 1022 if (rc) {
1222 clear_bit(STATUS_SCAN_ABORTING, &priv->status); 1023 clear_bit(STATUS_SCAN_ABORTING, &priv->status);
1223 return rc; 1024 return rc;
@@ -1242,7 +1043,7 @@ static int iwl4965_send_scan_abort(struct iwl_priv *priv)
1242} 1043}
1243 1044
1244static int iwl4965_card_state_sync_callback(struct iwl_priv *priv, 1045static int iwl4965_card_state_sync_callback(struct iwl_priv *priv,
1245 struct iwl4965_cmd *cmd, 1046 struct iwl_cmd *cmd,
1246 struct sk_buff *skb) 1047 struct sk_buff *skb)
1247{ 1048{
1248 return 1; 1049 return 1;
@@ -1260,7 +1061,7 @@ static int iwl4965_card_state_sync_callback(struct iwl_priv *priv,
1260 */ 1061 */
1261static int iwl4965_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_flag) 1062static int iwl4965_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_flag)
1262{ 1063{
1263 struct iwl4965_host_cmd cmd = { 1064 struct iwl_host_cmd cmd = {
1264 .id = REPLY_CARD_STATE_CMD, 1065 .id = REPLY_CARD_STATE_CMD,
1265 .len = sizeof(u32), 1066 .len = sizeof(u32),
1266 .data = &flags, 1067 .data = &flags,
@@ -1270,11 +1071,11 @@ static int iwl4965_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_fla
1270 if (meta_flag & CMD_ASYNC) 1071 if (meta_flag & CMD_ASYNC)
1271 cmd.meta.u.callback = iwl4965_card_state_sync_callback; 1072 cmd.meta.u.callback = iwl4965_card_state_sync_callback;
1272 1073
1273 return iwl4965_send_cmd(priv, &cmd); 1074 return iwl_send_cmd(priv, &cmd);
1274} 1075}
1275 1076
1276static int iwl4965_add_sta_sync_callback(struct iwl_priv *priv, 1077static int iwl4965_add_sta_sync_callback(struct iwl_priv *priv,
1277 struct iwl4965_cmd *cmd, struct sk_buff *skb) 1078 struct iwl_cmd *cmd, struct sk_buff *skb)
1278{ 1079{
1279 struct iwl4965_rx_packet *res = NULL; 1080 struct iwl4965_rx_packet *res = NULL;
1280 1081
@@ -1306,7 +1107,7 @@ int iwl4965_send_add_station(struct iwl_priv *priv,
1306{ 1107{
1307 struct iwl4965_rx_packet *res = NULL; 1108 struct iwl4965_rx_packet *res = NULL;
1308 int rc = 0; 1109 int rc = 0;
1309 struct iwl4965_host_cmd cmd = { 1110 struct iwl_host_cmd cmd = {
1310 .id = REPLY_ADD_STA, 1111 .id = REPLY_ADD_STA,
1311 .len = sizeof(struct iwl4965_addsta_cmd), 1112 .len = sizeof(struct iwl4965_addsta_cmd),
1312 .meta.flags = flags, 1113 .meta.flags = flags,
@@ -1318,7 +1119,7 @@ int iwl4965_send_add_station(struct iwl_priv *priv,
1318 else 1119 else
1319 cmd.meta.flags |= CMD_WANT_SKB; 1120 cmd.meta.flags |= CMD_WANT_SKB;
1320 1121
1321 rc = iwl4965_send_cmd(priv, &cmd); 1122 rc = iwl_send_cmd(priv, &cmd);
1322 1123
1323 if (rc || (flags & CMD_ASYNC)) 1124 if (rc || (flags & CMD_ASYNC))
1324 return rc; 1125 return rc;
@@ -1579,7 +1380,7 @@ static int iwl4965_send_beacon_cmd(struct iwl_priv *priv)
1579 1380
1580 frame_size = iwl4965_hw_get_beacon_cmd(priv, frame, rate); 1381 frame_size = iwl4965_hw_get_beacon_cmd(priv, frame, rate);
1581 1382
1582 rc = iwl4965_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size, 1383 rc = iwl_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size,
1583 &frame->u.cmd[0]); 1384 &frame->u.cmd[0]);
1584 1385
1585 iwl4965_free_frame(priv, frame); 1386 iwl4965_free_frame(priv, frame);
@@ -1756,7 +1557,7 @@ static int iwl4965_send_qos_params_command(struct iwl_priv *priv,
1756 struct iwl4965_qosparam_cmd *qos) 1557 struct iwl4965_qosparam_cmd *qos)
1757{ 1558{
1758 1559
1759 return iwl4965_send_cmd_pdu(priv, REPLY_QOS_PARAM, 1560 return iwl_send_cmd_pdu(priv, REPLY_QOS_PARAM,
1760 sizeof(struct iwl4965_qosparam_cmd), qos); 1561 sizeof(struct iwl4965_qosparam_cmd), qos);
1761} 1562}
1762 1563
@@ -1966,7 +1767,7 @@ static int iwl4965_send_power_mode(struct iwl_priv *priv, u32 mode)
1966 1767
1967 iwl4965_update_power_cmd(priv, &cmd, final_mode); 1768 iwl4965_update_power_cmd(priv, &cmd, final_mode);
1968 1769
1969 rc = iwl4965_send_cmd_pdu(priv, POWER_TABLE_CMD, sizeof(cmd), &cmd); 1770 rc = iwl_send_cmd_pdu(priv, POWER_TABLE_CMD, sizeof(cmd), &cmd);
1970 1771
1971 if (final_mode == IWL_POWER_MODE_CAM) 1772 if (final_mode == IWL_POWER_MODE_CAM)
1972 clear_bit(STATUS_POWER_PMI, &priv->status); 1773 clear_bit(STATUS_POWER_PMI, &priv->status);
@@ -2345,7 +2146,7 @@ static int iwl4965_set_mode(struct iwl_priv *priv, int mode)
2345 2146
2346static void iwl4965_build_tx_cmd_hwcrypto(struct iwl_priv *priv, 2147static void iwl4965_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
2347 struct ieee80211_tx_control *ctl, 2148 struct ieee80211_tx_control *ctl,
2348 struct iwl4965_cmd *cmd, 2149 struct iwl_cmd *cmd,
2349 struct sk_buff *skb_frag, 2150 struct sk_buff *skb_frag,
2350 int sta_id) 2151 int sta_id)
2351{ 2152{
@@ -2390,7 +2191,7 @@ static void iwl4965_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
2390 * handle build REPLY_TX command notification. 2191 * handle build REPLY_TX command notification.
2391 */ 2192 */
2392static void iwl4965_build_tx_cmd_basic(struct iwl_priv *priv, 2193static void iwl4965_build_tx_cmd_basic(struct iwl_priv *priv,
2393 struct iwl4965_cmd *cmd, 2194 struct iwl_cmd *cmd,
2394 struct ieee80211_tx_control *ctrl, 2195 struct ieee80211_tx_control *ctrl,
2395 struct ieee80211_hdr *hdr, 2196 struct ieee80211_hdr *hdr,
2396 int is_unicast, u8 std_id) 2197 int is_unicast, u8 std_id)
@@ -2531,7 +2332,7 @@ static int iwl4965_tx_skb(struct iwl_priv *priv,
2531 dma_addr_t phys_addr; 2332 dma_addr_t phys_addr;
2532 dma_addr_t txcmd_phys; 2333 dma_addr_t txcmd_phys;
2533 dma_addr_t scratch_phys; 2334 dma_addr_t scratch_phys;
2534 struct iwl4965_cmd *out_cmd = NULL; 2335 struct iwl_cmd *out_cmd = NULL;
2535 u16 len, idx, len_org; 2336 u16 len, idx, len_org;
2536 u8 id, hdr_len, unicast; 2337 u8 id, hdr_len, unicast;
2537 u8 sta_id; 2338 u8 sta_id;
@@ -2660,7 +2461,7 @@ static int iwl4965_tx_skb(struct iwl_priv *priv,
2660 * We'll tell device about this padding later. 2461 * We'll tell device about this padding later.
2661 */ 2462 */
2662 len = priv->hw_setting.tx_cmd_len + 2463 len = priv->hw_setting.tx_cmd_len +
2663 sizeof(struct iwl4965_cmd_header) + hdr_len; 2464 sizeof(struct iwl_cmd_header) + hdr_len;
2664 2465
2665 len_org = len; 2466 len_org = len;
2666 len = (len + 3) & ~3; 2467 len = (len + 3) & ~3;
@@ -2672,8 +2473,8 @@ static int iwl4965_tx_skb(struct iwl_priv *priv,
2672 2473
2673 /* Physical address of this Tx command's header (not MAC header!), 2474 /* Physical address of this Tx command's header (not MAC header!),
2674 * within command buffer array. */ 2475 * within command buffer array. */
2675 txcmd_phys = txq->dma_addr_cmd + sizeof(struct iwl4965_cmd) * idx + 2476 txcmd_phys = txq->dma_addr_cmd + sizeof(struct iwl_cmd) * idx +
2676 offsetof(struct iwl4965_cmd, hdr); 2477 offsetof(struct iwl_cmd, hdr);
2677 2478
2678 /* Add buffer containing Tx command and MAC(!) header to TFD's 2479 /* Add buffer containing Tx command and MAC(!) header to TFD's
2679 * first entry */ 2480 * first entry */
@@ -2707,7 +2508,7 @@ static int iwl4965_tx_skb(struct iwl_priv *priv,
2707 2508
2708 iwl_update_tx_stats(priv, fc, len); 2509 iwl_update_tx_stats(priv, fc, len);
2709 2510
2710 scratch_phys = txcmd_phys + sizeof(struct iwl4965_cmd_header) + 2511 scratch_phys = txcmd_phys + sizeof(struct iwl_cmd_header) +
2711 offsetof(struct iwl4965_tx_cmd, scratch); 2512 offsetof(struct iwl4965_tx_cmd, scratch);
2712 out_cmd->cmd.tx.dram_lsb_ptr = cpu_to_le32(scratch_phys); 2513 out_cmd->cmd.tx.dram_lsb_ptr = cpu_to_le32(scratch_phys);
2713 out_cmd->cmd.tx.dram_msb_ptr = iwl_get_dma_hi_address(scratch_phys); 2514 out_cmd->cmd.tx.dram_msb_ptr = iwl_get_dma_hi_address(scratch_phys);
@@ -3020,7 +2821,7 @@ static int iwl4965_get_measurement(struct iwl_priv *priv,
3020{ 2821{
3021 struct iwl4965_spectrum_cmd spectrum; 2822 struct iwl4965_spectrum_cmd spectrum;
3022 struct iwl4965_rx_packet *res; 2823 struct iwl4965_rx_packet *res;
3023 struct iwl4965_host_cmd cmd = { 2824 struct iwl_host_cmd cmd = {
3024 .id = REPLY_SPECTRUM_MEASUREMENT_CMD, 2825 .id = REPLY_SPECTRUM_MEASUREMENT_CMD,
3025 .data = (void *)&spectrum, 2826 .data = (void *)&spectrum,
3026 .meta.flags = CMD_WANT_SKB, 2827 .meta.flags = CMD_WANT_SKB,
@@ -3060,7 +2861,7 @@ static int iwl4965_get_measurement(struct iwl_priv *priv,
3060 spectrum.flags |= RXON_FLG_BAND_24G_MSK | 2861 spectrum.flags |= RXON_FLG_BAND_24G_MSK |
3061 RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK; 2862 RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK;
3062 2863
3063 rc = iwl4965_send_cmd_sync(priv, &cmd); 2864 rc = iwl_send_cmd_sync(priv, &cmd);
3064 if (rc) 2865 if (rc)
3065 return rc; 2866 return rc;
3066 2867
@@ -3835,7 +3636,7 @@ static void iwl4965_tx_cmd_complete(struct iwl_priv *priv,
3835 int index = SEQ_TO_INDEX(sequence); 3636 int index = SEQ_TO_INDEX(sequence);
3836 int huge = sequence & SEQ_HUGE_FRAME; 3637 int huge = sequence & SEQ_HUGE_FRAME;
3837 int cmd_index; 3638 int cmd_index;
3838 struct iwl4965_cmd *cmd; 3639 struct iwl_cmd *cmd;
3839 3640
3840 /* If a Tx command is being handled and it isn't in the actual 3641 /* If a Tx command is being handled and it isn't in the actual
3841 * command queue then there a command routing bug has been introduced 3642 * command queue then there a command routing bug has been introduced
@@ -4337,7 +4138,7 @@ static void iwl4965_rx_handle(struct iwl_priv *priv)
4337 * but apparently a few don't get set; catch them here. */ 4138 * but apparently a few don't get set; catch them here. */
4338 reclaim = !(pkt->hdr.sequence & SEQ_RX_FRAME) && 4139 reclaim = !(pkt->hdr.sequence & SEQ_RX_FRAME) &&
4339 (pkt->hdr.cmd != REPLY_RX_PHY_CMD) && 4140 (pkt->hdr.cmd != REPLY_RX_PHY_CMD) &&
4340 (pkt->hdr.cmd != REPLY_4965_RX) && 4141 (pkt->hdr.cmd != REPLY_RX) &&
4341 (pkt->hdr.cmd != REPLY_COMPRESSED_BA) && 4142 (pkt->hdr.cmd != REPLY_COMPRESSED_BA) &&
4342 (pkt->hdr.cmd != STATISTICS_NOTIFICATION) && 4143 (pkt->hdr.cmd != STATISTICS_NOTIFICATION) &&
4343 (pkt->hdr.cmd != REPLY_TX); 4144 (pkt->hdr.cmd != REPLY_TX);
@@ -4360,7 +4161,7 @@ static void iwl4965_rx_handle(struct iwl_priv *priv)
4360 4161
4361 if (reclaim) { 4162 if (reclaim) {
4362 /* Invoke any callbacks, transfer the skb to caller, and 4163 /* Invoke any callbacks, transfer the skb to caller, and
4363 * fire off the (possibly) blocking iwl4965_send_cmd() 4164 * fire off the (possibly) blocking iwl_send_cmd()
4364 * as we reclaim the driver command queue */ 4165 * as we reclaim the driver command queue */
4365 if (rxb && rxb->skb) 4166 if (rxb && rxb->skb)
4366 iwl4965_tx_cmd_complete(priv, rxb); 4167 iwl4965_tx_cmd_complete(priv, rxb);
@@ -6213,17 +6014,17 @@ static void iwl4965_bg_request_scan(struct work_struct *data)
6213{ 6014{
6214 struct iwl_priv *priv = 6015 struct iwl_priv *priv =
6215 container_of(data, struct iwl_priv, request_scan); 6016 container_of(data, struct iwl_priv, request_scan);
6216 struct iwl4965_host_cmd cmd = { 6017 struct iwl_host_cmd cmd = {
6217 .id = REPLY_SCAN_CMD, 6018 .id = REPLY_SCAN_CMD,
6218 .len = sizeof(struct iwl4965_scan_cmd), 6019 .len = sizeof(struct iwl4965_scan_cmd),
6219 .meta.flags = CMD_SIZE_HUGE, 6020 .meta.flags = CMD_SIZE_HUGE,
6220 }; 6021 };
6221 int rc = 0;
6222 struct iwl4965_scan_cmd *scan; 6022 struct iwl4965_scan_cmd *scan;
6223 struct ieee80211_conf *conf = NULL; 6023 struct ieee80211_conf *conf = NULL;
6224 u16 cmd_len; 6024 u16 cmd_len;
6225 enum ieee80211_band band; 6025 enum ieee80211_band band;
6226 u8 direct_mask; 6026 u8 direct_mask;
6027 int ret = 0;
6227 6028
6228 conf = ieee80211_get_hw_conf(priv->hw); 6029 conf = ieee80211_get_hw_conf(priv->hw);
6229 6030
@@ -6244,7 +6045,7 @@ static void iwl4965_bg_request_scan(struct work_struct *data)
6244 if (test_bit(STATUS_SCAN_HW, &priv->status)) { 6045 if (test_bit(STATUS_SCAN_HW, &priv->status)) {
6245 IWL_DEBUG_INFO("Multiple concurrent scan requests in parallel. " 6046 IWL_DEBUG_INFO("Multiple concurrent scan requests in parallel. "
6246 "Ignoring second request.\n"); 6047 "Ignoring second request.\n");
6247 rc = -EIO; 6048 ret = -EIO;
6248 goto done; 6049 goto done;
6249 } 6050 }
6250 6051
@@ -6277,7 +6078,7 @@ static void iwl4965_bg_request_scan(struct work_struct *data)
6277 priv->scan = kmalloc(sizeof(struct iwl4965_scan_cmd) + 6078 priv->scan = kmalloc(sizeof(struct iwl4965_scan_cmd) +
6278 IWL_MAX_SCAN_SIZE, GFP_KERNEL); 6079 IWL_MAX_SCAN_SIZE, GFP_KERNEL);
6279 if (!priv->scan) { 6080 if (!priv->scan) {
6280 rc = -ENOMEM; 6081 ret = -ENOMEM;
6281 goto done; 6082 goto done;
6282 } 6083 }
6283 } 6084 }
@@ -6329,8 +6130,9 @@ static void iwl4965_bg_request_scan(struct work_struct *data)
6329 scan->direct_scan[0].len = priv->essid_len; 6130 scan->direct_scan[0].len = priv->essid_len;
6330 memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); 6131 memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len);
6331 direct_mask = 1; 6132 direct_mask = 1;
6332 } else 6133 } else {
6333 direct_mask = 0; 6134 direct_mask = 0;
6135 }
6334 6136
6335 scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; 6137 scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK;
6336 scan->tx_cmd.sta_id = priv->hw_setting.bcast_sta_id; 6138 scan->tx_cmd.sta_id = priv->hw_setting.bcast_sta_id;
@@ -6405,8 +6207,8 @@ static void iwl4965_bg_request_scan(struct work_struct *data)
6405 scan->len = cpu_to_le16(cmd.len); 6207 scan->len = cpu_to_le16(cmd.len);
6406 6208
6407 set_bit(STATUS_SCAN_HW, &priv->status); 6209 set_bit(STATUS_SCAN_HW, &priv->status);
6408 rc = iwl4965_send_cmd_sync(priv, &cmd); 6210 ret = iwl_send_cmd_sync(priv, &cmd);
6409 if (rc) 6211 if (ret)
6410 goto done; 6212 goto done;
6411 6213
6412 queue_delayed_work(priv->workqueue, &priv->scan_check, 6214 queue_delayed_work(priv->workqueue, &priv->scan_check,
@@ -6463,9 +6265,8 @@ static void iwl4965_bg_post_associate(struct work_struct *data)
6463{ 6265{
6464 struct iwl_priv *priv = container_of(data, struct iwl_priv, 6266 struct iwl_priv *priv = container_of(data, struct iwl_priv,
6465 post_associate.work); 6267 post_associate.work);
6466
6467 int rc = 0;
6468 struct ieee80211_conf *conf = NULL; 6268 struct ieee80211_conf *conf = NULL;
6269 int ret = 0;
6469 DECLARE_MAC_BUF(mac); 6270 DECLARE_MAC_BUF(mac);
6470 6271
6471 if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { 6272 if (priv->iw_mode == IEEE80211_IF_TYPE_AP) {
@@ -6496,9 +6297,9 @@ static void iwl4965_bg_post_associate(struct work_struct *data)
6496 6297
6497 memset(&priv->rxon_timing, 0, sizeof(struct iwl4965_rxon_time_cmd)); 6298 memset(&priv->rxon_timing, 0, sizeof(struct iwl4965_rxon_time_cmd));
6498 iwl4965_setup_rxon_timing(priv); 6299 iwl4965_setup_rxon_timing(priv);
6499 rc = iwl4965_send_cmd_pdu(priv, REPLY_RXON_TIMING, 6300 ret = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING,
6500 sizeof(priv->rxon_timing), &priv->rxon_timing); 6301 sizeof(priv->rxon_timing), &priv->rxon_timing);
6501 if (rc) 6302 if (ret)
6502 IWL_WARNING("REPLY_RXON_TIMING failed - " 6303 IWL_WARNING("REPLY_RXON_TIMING failed - "
6503 "Attempting to continue.\n"); 6304 "Attempting to continue.\n");
6504 6305
@@ -6894,7 +6695,7 @@ out:
6894 6695
6895static void iwl4965_config_ap(struct iwl_priv *priv) 6696static void iwl4965_config_ap(struct iwl_priv *priv)
6896{ 6697{
6897 int rc = 0; 6698 int ret = 0;
6898 6699
6899 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 6700 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
6900 return; 6701 return;
@@ -6909,9 +6710,9 @@ static void iwl4965_config_ap(struct iwl_priv *priv)
6909 /* RXON Timing */ 6710 /* RXON Timing */
6910 memset(&priv->rxon_timing, 0, sizeof(struct iwl4965_rxon_time_cmd)); 6711 memset(&priv->rxon_timing, 0, sizeof(struct iwl4965_rxon_time_cmd));
6911 iwl4965_setup_rxon_timing(priv); 6712 iwl4965_setup_rxon_timing(priv);
6912 rc = iwl4965_send_cmd_pdu(priv, REPLY_RXON_TIMING, 6713 ret = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING,
6913 sizeof(priv->rxon_timing), &priv->rxon_timing); 6714 sizeof(priv->rxon_timing), &priv->rxon_timing);
6914 if (rc) 6715 if (ret)
6915 IWL_WARNING("REPLY_RXON_TIMING failed - " 6716 IWL_WARNING("REPLY_RXON_TIMING failed - "
6916 "Attempting to continue.\n"); 6717 "Attempting to continue.\n");
6917 6718