aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl3945-base.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl3945-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c90
1 files changed, 37 insertions, 53 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index c1234ff4fc98..72279e07fe32 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -102,16 +102,6 @@ MODULE_VERSION(DRV_VERSION);
102MODULE_AUTHOR(DRV_COPYRIGHT); 102MODULE_AUTHOR(DRV_COPYRIGHT);
103MODULE_LICENSE("GPL"); 103MODULE_LICENSE("GPL");
104 104
105static __le16 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr)
106{
107 u16 fc = le16_to_cpu(hdr->frame_control);
108 int hdr_len = ieee80211_get_hdrlen(fc);
109
110 if ((fc & 0x00cc) == (IEEE80211_STYPE_QOS_DATA | IEEE80211_FTYPE_DATA))
111 return (__le16 *) ((u8 *) hdr + hdr_len - QOS_CONTROL_LEN);
112 return NULL;
113}
114
115static const struct ieee80211_supported_band *iwl3945_get_band( 105static const struct ieee80211_supported_band *iwl3945_get_band(
116 struct iwl3945_priv *priv, enum ieee80211_band band) 106 struct iwl3945_priv *priv, enum ieee80211_band band)
117{ 107{
@@ -2386,13 +2376,13 @@ static int iwl3945_set_mode(struct iwl3945_priv *priv, int mode)
2386} 2376}
2387 2377
2388static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv, 2378static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv,
2389 struct ieee80211_tx_control *ctl, 2379 struct ieee80211_tx_info *info,
2390 struct iwl3945_cmd *cmd, 2380 struct iwl3945_cmd *cmd,
2391 struct sk_buff *skb_frag, 2381 struct sk_buff *skb_frag,
2392 int last_frag) 2382 int last_frag)
2393{ 2383{
2394 struct iwl3945_hw_key *keyinfo = 2384 struct iwl3945_hw_key *keyinfo =
2395 &priv->stations[ctl->hw_key->hw_key_idx].keyinfo; 2385 &priv->stations[info->control.hw_key->hw_key_idx].keyinfo;
2396 2386
2397 switch (keyinfo->alg) { 2387 switch (keyinfo->alg) {
2398 case ALG_CCMP: 2388 case ALG_CCMP:
@@ -2415,7 +2405,7 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv,
2415 2405
2416 case ALG_WEP: 2406 case ALG_WEP:
2417 cmd->cmd.tx.sec_ctl = TX_CMD_SEC_WEP | 2407 cmd->cmd.tx.sec_ctl = TX_CMD_SEC_WEP |
2418 (ctl->hw_key->hw_key_idx & TX_CMD_SEC_MSK) << TX_CMD_SEC_SHIFT; 2408 (info->control.hw_key->hw_key_idx & TX_CMD_SEC_MSK) << TX_CMD_SEC_SHIFT;
2419 2409
2420 if (keyinfo->keylen == 13) 2410 if (keyinfo->keylen == 13)
2421 cmd->cmd.tx.sec_ctl |= TX_CMD_SEC_KEY128; 2411 cmd->cmd.tx.sec_ctl |= TX_CMD_SEC_KEY128;
@@ -2423,7 +2413,7 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv,
2423 memcpy(&cmd->cmd.tx.key[3], keyinfo->key, keyinfo->keylen); 2413 memcpy(&cmd->cmd.tx.key[3], keyinfo->key, keyinfo->keylen);
2424 2414
2425 IWL_DEBUG_TX("Configuring packet for WEP encryption " 2415 IWL_DEBUG_TX("Configuring packet for WEP encryption "
2426 "with key %d\n", ctl->hw_key->hw_key_idx); 2416 "with key %d\n", info->control.hw_key->hw_key_idx);
2427 break; 2417 break;
2428 2418
2429 default: 2419 default:
@@ -2437,16 +2427,15 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv,
2437 */ 2427 */
2438static void iwl3945_build_tx_cmd_basic(struct iwl3945_priv *priv, 2428static void iwl3945_build_tx_cmd_basic(struct iwl3945_priv *priv,
2439 struct iwl3945_cmd *cmd, 2429 struct iwl3945_cmd *cmd,
2440 struct ieee80211_tx_control *ctrl, 2430 struct ieee80211_tx_info *info,
2441 struct ieee80211_hdr *hdr, 2431 struct ieee80211_hdr *hdr,
2442 int is_unicast, u8 std_id) 2432 int is_unicast, u8 std_id)
2443{ 2433{
2444 __le16 *qc;
2445 u16 fc = le16_to_cpu(hdr->frame_control); 2434 u16 fc = le16_to_cpu(hdr->frame_control);
2446 __le32 tx_flags = cmd->cmd.tx.tx_flags; 2435 __le32 tx_flags = cmd->cmd.tx.tx_flags;
2447 2436
2448 cmd->cmd.tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; 2437 cmd->cmd.tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
2449 if (!(ctrl->flags & IEEE80211_TXCTL_NO_ACK)) { 2438 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) {
2450 tx_flags |= TX_CMD_FLG_ACK_MSK; 2439 tx_flags |= TX_CMD_FLG_ACK_MSK;
2451 if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) 2440 if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT)
2452 tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; 2441 tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK;
@@ -2462,17 +2451,18 @@ static void iwl3945_build_tx_cmd_basic(struct iwl3945_priv *priv,
2462 if (ieee80211_get_morefrag(hdr)) 2451 if (ieee80211_get_morefrag(hdr))
2463 tx_flags |= TX_CMD_FLG_MORE_FRAG_MSK; 2452 tx_flags |= TX_CMD_FLG_MORE_FRAG_MSK;
2464 2453
2465 qc = ieee80211_get_qos_ctrl(hdr); 2454 if (ieee80211_is_qos_data(fc)) {
2466 if (qc) { 2455 u8 *qc = ieee80211_get_qos_ctrl(hdr, ieee80211_get_hdrlen(fc));
2467 cmd->cmd.tx.tid_tspec = (u8) (le16_to_cpu(*qc) & 0xf); 2456 cmd->cmd.tx.tid_tspec = qc[0] & 0xf;
2468 tx_flags &= ~TX_CMD_FLG_SEQ_CTL_MSK; 2457 tx_flags &= ~TX_CMD_FLG_SEQ_CTL_MSK;
2469 } else 2458 } else {
2470 tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; 2459 tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK;
2460 }
2471 2461
2472 if (ctrl->flags & IEEE80211_TXCTL_USE_RTS_CTS) { 2462 if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) {
2473 tx_flags |= TX_CMD_FLG_RTS_MSK; 2463 tx_flags |= TX_CMD_FLG_RTS_MSK;
2474 tx_flags &= ~TX_CMD_FLG_CTS_MSK; 2464 tx_flags &= ~TX_CMD_FLG_CTS_MSK;
2475 } else if (ctrl->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) { 2465 } else if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) {
2476 tx_flags &= ~TX_CMD_FLG_RTS_MSK; 2466 tx_flags &= ~TX_CMD_FLG_RTS_MSK;
2477 tx_flags |= TX_CMD_FLG_CTS_MSK; 2467 tx_flags |= TX_CMD_FLG_CTS_MSK;
2478 } 2468 }
@@ -2556,25 +2546,27 @@ static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *h
2556/* 2546/*
2557 * start REPLY_TX command process 2547 * start REPLY_TX command process
2558 */ 2548 */
2559static int iwl3945_tx_skb(struct iwl3945_priv *priv, 2549static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb)
2560 struct sk_buff *skb, struct ieee80211_tx_control *ctl)
2561{ 2550{
2562 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 2551 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
2552 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2563 struct iwl3945_tfd_frame *tfd; 2553 struct iwl3945_tfd_frame *tfd;
2564 u32 *control_flags; 2554 u32 *control_flags;
2565 int txq_id = ctl->queue; 2555 int txq_id = skb_get_queue_mapping(skb);
2566 struct iwl3945_tx_queue *txq = NULL; 2556 struct iwl3945_tx_queue *txq = NULL;
2567 struct iwl3945_queue *q = NULL; 2557 struct iwl3945_queue *q = NULL;
2568 dma_addr_t phys_addr; 2558 dma_addr_t phys_addr;
2569 dma_addr_t txcmd_phys; 2559 dma_addr_t txcmd_phys;
2570 struct iwl3945_cmd *out_cmd = NULL; 2560 struct iwl3945_cmd *out_cmd = NULL;
2571 u16 len, idx, len_org; 2561 u16 len, idx, len_org, hdr_len;
2572 u8 id, hdr_len, unicast; 2562 u8 id;
2563 u8 unicast;
2573 u8 sta_id; 2564 u8 sta_id;
2565 u8 tid = 0;
2574 u16 seq_number = 0; 2566 u16 seq_number = 0;
2575 u16 fc; 2567 u16 fc;
2576 __le16 *qc;
2577 u8 wait_write_ptr = 0; 2568 u8 wait_write_ptr = 0;
2569 u8 *qc = NULL;
2578 unsigned long flags; 2570 unsigned long flags;
2579 int rc; 2571 int rc;
2580 2572
@@ -2589,7 +2581,7 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv,
2589 goto drop_unlock; 2581 goto drop_unlock;
2590 } 2582 }
2591 2583
2592 if ((ctl->tx_rate->hw_value & 0xFF) == IWL_INVALID_RATE) { 2584 if ((ieee80211_get_tx_rate(priv->hw, info)->hw_value & 0xFF) == IWL_INVALID_RATE) {
2593 IWL_ERROR("ERROR: No TX rate available.\n"); 2585 IWL_ERROR("ERROR: No TX rate available.\n");
2594 goto drop_unlock; 2586 goto drop_unlock;
2595 } 2587 }
@@ -2632,9 +2624,9 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv,
2632 2624
2633 IWL_DEBUG_RATE("station Id %d\n", sta_id); 2625 IWL_DEBUG_RATE("station Id %d\n", sta_id);
2634 2626
2635 qc = ieee80211_get_qos_ctrl(hdr); 2627 if (ieee80211_is_qos_data(fc)) {
2636 if (qc) { 2628 qc = ieee80211_get_qos_ctrl(hdr, hdr_len);
2637 u8 tid = (u8)(le16_to_cpu(*qc) & 0xf); 2629 tid = qc[0] & 0xf;
2638 seq_number = priv->stations[sta_id].tid[tid].seq_number & 2630 seq_number = priv->stations[sta_id].tid[tid].seq_number &
2639 IEEE80211_SCTL_SEQ; 2631 IEEE80211_SCTL_SEQ;
2640 hdr->seq_ctrl = cpu_to_le16(seq_number) | 2632 hdr->seq_ctrl = cpu_to_le16(seq_number) |
@@ -2658,8 +2650,6 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv,
2658 /* Set up driver data for this TFD */ 2650 /* Set up driver data for this TFD */
2659 memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl3945_tx_info)); 2651 memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl3945_tx_info));
2660 txq->txb[q->write_ptr].skb[0] = skb; 2652 txq->txb[q->write_ptr].skb[0] = skb;
2661 memcpy(&(txq->txb[q->write_ptr].status.control),
2662 ctl, sizeof(struct ieee80211_tx_control));
2663 2653
2664 /* Init first empty entry in queue's array of Tx/cmd buffers */ 2654 /* Init first empty entry in queue's array of Tx/cmd buffers */
2665 out_cmd = &txq->cmd[idx]; 2655 out_cmd = &txq->cmd[idx];
@@ -2708,8 +2698,8 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv,
2708 * first entry */ 2698 * first entry */
2709 iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len); 2699 iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len);
2710 2700
2711 if (!(ctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) 2701 if (!(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT))
2712 iwl3945_build_tx_cmd_hwcrypto(priv, ctl, out_cmd, skb, 0); 2702 iwl3945_build_tx_cmd_hwcrypto(priv, info, out_cmd, skb, 0);
2713 2703
2714 /* Set up TFD's 2nd entry to point directly to remainder of skb, 2704 /* Set up TFD's 2nd entry to point directly to remainder of skb,
2715 * if any (802.11 null frames have no payload). */ 2705 * if any (802.11 null frames have no payload). */
@@ -2734,10 +2724,10 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv,
2734 out_cmd->cmd.tx.len = cpu_to_le16(len); 2724 out_cmd->cmd.tx.len = cpu_to_le16(len);
2735 2725
2736 /* TODO need this for burst mode later on */ 2726 /* TODO need this for burst mode later on */
2737 iwl3945_build_tx_cmd_basic(priv, out_cmd, ctl, hdr, unicast, sta_id); 2727 iwl3945_build_tx_cmd_basic(priv, out_cmd, info, hdr, unicast, sta_id);
2738 2728
2739 /* set is_hcca to 0; it probably will never be implemented */ 2729 /* set is_hcca to 0; it probably will never be implemented */
2740 iwl3945_hw_build_tx_cmd_rate(priv, out_cmd, ctl, hdr, sta_id, 0); 2730 iwl3945_hw_build_tx_cmd_rate(priv, out_cmd, info, hdr, sta_id, 0);
2741 2731
2742 out_cmd->cmd.tx.tx_flags &= ~TX_CMD_FLG_ANT_A_MSK; 2732 out_cmd->cmd.tx.tx_flags &= ~TX_CMD_FLG_ANT_A_MSK;
2743 out_cmd->cmd.tx.tx_flags &= ~TX_CMD_FLG_ANT_B_MSK; 2733 out_cmd->cmd.tx.tx_flags &= ~TX_CMD_FLG_ANT_B_MSK;
@@ -2745,7 +2735,6 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv,
2745 if (!ieee80211_get_morefrag(hdr)) { 2735 if (!ieee80211_get_morefrag(hdr)) {
2746 txq->need_update = 1; 2736 txq->need_update = 1;
2747 if (qc) { 2737 if (qc) {
2748 u8 tid = (u8)(le16_to_cpu(*qc) & 0xf);
2749 priv->stations[sta_id].tid[tid].seq_number = seq_number; 2738 priv->stations[sta_id].tid[tid].seq_number = seq_number;
2750 } 2739 }
2751 } else { 2740 } else {
@@ -2776,7 +2765,7 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv,
2776 spin_unlock_irqrestore(&priv->lock, flags); 2765 spin_unlock_irqrestore(&priv->lock, flags);
2777 } 2766 }
2778 2767
2779 ieee80211_stop_queue(priv->hw, ctl->queue); 2768 ieee80211_stop_queue(priv->hw, skb_get_queue_mapping(skb));
2780 } 2769 }
2781 2770
2782 return 0; 2771 return 0;
@@ -3239,7 +3228,7 @@ static void iwl3945_bg_beacon_update(struct work_struct *work)
3239 struct sk_buff *beacon; 3228 struct sk_buff *beacon;
3240 3229
3241 /* Pull updated AP beacon from mac80211. will fail if not in AP mode */ 3230 /* Pull updated AP beacon from mac80211. will fail if not in AP mode */
3242 beacon = ieee80211_beacon_get(priv->hw, priv->vif, NULL); 3231 beacon = ieee80211_beacon_get(priv->hw, priv->vif);
3243 3232
3244 if (!beacon) { 3233 if (!beacon) {
3245 IWL_ERROR("update beacon failed\n"); 3234 IWL_ERROR("update beacon failed\n");
@@ -5832,7 +5821,7 @@ static void iwl3945_alive_start(struct iwl3945_priv *priv)
5832 if (iwl3945_is_rfkill(priv)) 5821 if (iwl3945_is_rfkill(priv))
5833 return; 5822 return;
5834 5823
5835 ieee80211_start_queues(priv->hw); 5824 ieee80211_wake_queues(priv->hw);
5836 5825
5837 priv->active_rate = priv->rates_mask; 5826 priv->active_rate = priv->rates_mask;
5838 priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK; 5827 priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK;
@@ -5858,9 +5847,6 @@ static void iwl3945_alive_start(struct iwl3945_priv *priv)
5858 /* Configure the adapter for unassociated operation */ 5847 /* Configure the adapter for unassociated operation */
5859 iwl3945_commit_rxon(priv); 5848 iwl3945_commit_rxon(priv);
5860 5849
5861 /* At this point, the NIC is initialized and operational */
5862 priv->notif_missed_beacons = 0;
5863
5864 iwl3945_reg_txpower_periodic(priv); 5850 iwl3945_reg_txpower_periodic(priv);
5865 5851
5866 iwl3945_led_register(priv); 5852 iwl3945_led_register(priv);
@@ -6690,8 +6676,7 @@ static void iwl3945_mac_stop(struct ieee80211_hw *hw)
6690 IWL_DEBUG_MAC80211("leave\n"); 6676 IWL_DEBUG_MAC80211("leave\n");
6691} 6677}
6692 6678
6693static int iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb, 6679static int iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
6694 struct ieee80211_tx_control *ctl)
6695{ 6680{
6696 struct iwl3945_priv *priv = hw->priv; 6681 struct iwl3945_priv *priv = hw->priv;
6697 6682
@@ -6703,9 +6688,9 @@ static int iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
6703 } 6688 }
6704 6689
6705 IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, 6690 IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len,
6706 ctl->tx_rate->bitrate); 6691 ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate);
6707 6692
6708 if (iwl3945_tx_skb(priv, skb, ctl)) 6693 if (iwl3945_tx_skb(priv, skb))
6709 dev_kfree_skb_any(skb); 6694 dev_kfree_skb_any(skb);
6710 6695
6711 IWL_DEBUG_MAC80211("leave\n"); 6696 IWL_DEBUG_MAC80211("leave\n");
@@ -7342,8 +7327,7 @@ static void iwl3945_mac_reset_tsf(struct ieee80211_hw *hw)
7342 7327
7343} 7328}
7344 7329
7345static int iwl3945_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, 7330static int iwl3945_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
7346 struct ieee80211_tx_control *control)
7347{ 7331{
7348 struct iwl3945_priv *priv = hw->priv; 7332 struct iwl3945_priv *priv = hw->priv;
7349 unsigned long flags; 7333 unsigned long flags;
@@ -8273,7 +8257,7 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev)
8273 8257
8274 iwl3945_free_channel_map(priv); 8258 iwl3945_free_channel_map(priv);
8275 iwl3945_free_geos(priv); 8259 iwl3945_free_geos(priv);
8276 8260 kfree(priv->scan);
8277 if (priv->ibss_beacon) 8261 if (priv->ibss_beacon)
8278 dev_kfree_skb(priv->ibss_beacon); 8262 dev_kfree_skb(priv->ibss_beacon);
8279 8263