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.c66
1 files changed, 34 insertions, 32 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index afde87bc4990..0059d2889314 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2045,36 +2045,37 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
2045 struct sk_buff *skb_frag, 2045 struct sk_buff *skb_frag,
2046 int last_frag) 2046 int last_frag)
2047{ 2047{
2048 struct iwl3945_tx_cmd *tx = (struct iwl3945_tx_cmd *)cmd->cmd.payload;
2048 struct iwl3945_hw_key *keyinfo = 2049 struct iwl3945_hw_key *keyinfo =
2049 &priv->stations_39[info->control.hw_key->hw_key_idx].keyinfo; 2050 &priv->stations_39[info->control.hw_key->hw_key_idx].keyinfo;
2050 2051
2051 switch (keyinfo->alg) { 2052 switch (keyinfo->alg) {
2052 case ALG_CCMP: 2053 case ALG_CCMP:
2053 cmd->cmd.tx.sec_ctl = TX_CMD_SEC_CCM; 2054 tx->sec_ctl = TX_CMD_SEC_CCM;
2054 memcpy(cmd->cmd.tx.key, keyinfo->key, keyinfo->keylen); 2055 memcpy(tx->key, keyinfo->key, keyinfo->keylen);
2055 IWL_DEBUG_TX("tx_cmd with AES hwcrypto\n"); 2056 IWL_DEBUG_TX("tx_cmd with AES hwcrypto\n");
2056 break; 2057 break;
2057 2058
2058 case ALG_TKIP: 2059 case ALG_TKIP:
2059#if 0 2060#if 0
2060 cmd->cmd.tx.sec_ctl = TX_CMD_SEC_TKIP; 2061 tx->sec_ctl = TX_CMD_SEC_TKIP;
2061 2062
2062 if (last_frag) 2063 if (last_frag)
2063 memcpy(cmd->cmd.tx.tkip_mic.byte, skb_frag->tail - 8, 2064 memcpy(tx->tkip_mic.byte, skb_frag->tail - 8,
2064 8); 2065 8);
2065 else 2066 else
2066 memset(cmd->cmd.tx.tkip_mic.byte, 0, 8); 2067 memset(tx->tkip_mic.byte, 0, 8);
2067#endif 2068#endif
2068 break; 2069 break;
2069 2070
2070 case ALG_WEP: 2071 case ALG_WEP:
2071 cmd->cmd.tx.sec_ctl = TX_CMD_SEC_WEP | 2072 tx->sec_ctl = TX_CMD_SEC_WEP |
2072 (info->control.hw_key->hw_key_idx & TX_CMD_SEC_MSK) << TX_CMD_SEC_SHIFT; 2073 (info->control.hw_key->hw_key_idx & TX_CMD_SEC_MSK) << TX_CMD_SEC_SHIFT;
2073 2074
2074 if (keyinfo->keylen == 13) 2075 if (keyinfo->keylen == 13)
2075 cmd->cmd.tx.sec_ctl |= TX_CMD_SEC_KEY128; 2076 tx->sec_ctl |= TX_CMD_SEC_KEY128;
2076 2077
2077 memcpy(&cmd->cmd.tx.key[3], keyinfo->key, keyinfo->keylen); 2078 memcpy(&tx->key[3], keyinfo->key, keyinfo->keylen);
2078 2079
2079 IWL_DEBUG_TX("Configuring packet for WEP encryption " 2080 IWL_DEBUG_TX("Configuring packet for WEP encryption "
2080 "with key %d\n", info->control.hw_key->hw_key_idx); 2081 "with key %d\n", info->control.hw_key->hw_key_idx);
@@ -2092,14 +2093,14 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
2092static void iwl3945_build_tx_cmd_basic(struct iwl_priv *priv, 2093static void iwl3945_build_tx_cmd_basic(struct iwl_priv *priv,
2093 struct iwl_cmd *cmd, 2094 struct iwl_cmd *cmd,
2094 struct ieee80211_tx_info *info, 2095 struct ieee80211_tx_info *info,
2095 struct ieee80211_hdr *hdr, 2096 struct ieee80211_hdr *hdr, u8 std_id)
2096 int is_unicast, u8 std_id)
2097{ 2097{
2098 struct iwl3945_tx_cmd *tx = (struct iwl3945_tx_cmd *)cmd->cmd.payload;
2099 __le32 tx_flags = tx->tx_flags;
2098 __le16 fc = hdr->frame_control; 2100 __le16 fc = hdr->frame_control;
2099 __le32 tx_flags = cmd->cmd.tx.tx_flags;
2100 u8 rc_flags = info->control.rates[0].flags; 2101 u8 rc_flags = info->control.rates[0].flags;
2101 2102
2102 cmd->cmd.tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; 2103 tx->stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
2103 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) { 2104 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) {
2104 tx_flags |= TX_CMD_FLG_ACK_MSK; 2105 tx_flags |= TX_CMD_FLG_ACK_MSK;
2105 if (ieee80211_is_mgmt(fc)) 2106 if (ieee80211_is_mgmt(fc))
@@ -2112,13 +2113,13 @@ static void iwl3945_build_tx_cmd_basic(struct iwl_priv *priv,
2112 tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; 2113 tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK;
2113 } 2114 }
2114 2115
2115 cmd->cmd.tx.sta_id = std_id; 2116 tx->sta_id = std_id;
2116 if (ieee80211_has_morefrags(fc)) 2117 if (ieee80211_has_morefrags(fc))
2117 tx_flags |= TX_CMD_FLG_MORE_FRAG_MSK; 2118 tx_flags |= TX_CMD_FLG_MORE_FRAG_MSK;
2118 2119
2119 if (ieee80211_is_data_qos(fc)) { 2120 if (ieee80211_is_data_qos(fc)) {
2120 u8 *qc = ieee80211_get_qos_ctl(hdr); 2121 u8 *qc = ieee80211_get_qos_ctl(hdr);
2121 cmd->cmd.tx.tid_tspec = qc[0] & 0xf; 2122 tx->tid_tspec = qc[0] & 0xf;
2122 tx_flags &= ~TX_CMD_FLG_SEQ_CTL_MSK; 2123 tx_flags &= ~TX_CMD_FLG_SEQ_CTL_MSK;
2123 } else { 2124 } else {
2124 tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; 2125 tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK;
@@ -2138,19 +2139,19 @@ static void iwl3945_build_tx_cmd_basic(struct iwl_priv *priv,
2138 tx_flags &= ~(TX_CMD_FLG_ANT_SEL_MSK); 2139 tx_flags &= ~(TX_CMD_FLG_ANT_SEL_MSK);
2139 if (ieee80211_is_mgmt(fc)) { 2140 if (ieee80211_is_mgmt(fc)) {
2140 if (ieee80211_is_assoc_req(fc) || ieee80211_is_reassoc_req(fc)) 2141 if (ieee80211_is_assoc_req(fc) || ieee80211_is_reassoc_req(fc))
2141 cmd->cmd.tx.timeout.pm_frame_timeout = cpu_to_le16(3); 2142 tx->timeout.pm_frame_timeout = cpu_to_le16(3);
2142 else 2143 else
2143 cmd->cmd.tx.timeout.pm_frame_timeout = cpu_to_le16(2); 2144 tx->timeout.pm_frame_timeout = cpu_to_le16(2);
2144 } else { 2145 } else {
2145 cmd->cmd.tx.timeout.pm_frame_timeout = 0; 2146 tx->timeout.pm_frame_timeout = 0;
2146#ifdef CONFIG_IWL3945_LEDS 2147#ifdef CONFIG_IWL3945_LEDS
2147 priv->rxtxpackets += le16_to_cpu(cmd->cmd.tx.len); 2148 priv->rxtxpackets += le16_to_cpu(cmd->cmd.tx.len);
2148#endif 2149#endif
2149 } 2150 }
2150 2151
2151 cmd->cmd.tx.driver_txop = 0; 2152 tx->driver_txop = 0;
2152 cmd->cmd.tx.tx_flags = tx_flags; 2153 tx->tx_flags = tx_flags;
2153 cmd->cmd.tx.next_frame_len = 0; 2154 tx->next_frame_len = 0;
2154} 2155}
2155 2156
2156/** 2157/**
@@ -2219,12 +2220,13 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
2219 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 2220 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
2220 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 2221 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2221 struct iwl3945_tfd *tfd; 2222 struct iwl3945_tfd *tfd;
2222 int txq_id = skb_get_queue_mapping(skb); 2223 struct iwl3945_tx_cmd *tx;
2223 struct iwl_tx_queue *txq = NULL; 2224 struct iwl_tx_queue *txq = NULL;
2224 struct iwl_queue *q = NULL; 2225 struct iwl_queue *q = NULL;
2226 struct iwl_cmd *out_cmd = NULL;
2225 dma_addr_t phys_addr; 2227 dma_addr_t phys_addr;
2226 dma_addr_t txcmd_phys; 2228 dma_addr_t txcmd_phys;
2227 struct iwl_cmd *out_cmd = NULL; 2229 int txq_id = skb_get_queue_mapping(skb);
2228 u16 len, idx, len_org, hdr_len; 2230 u16 len, idx, len_org, hdr_len;
2229 u8 id; 2231 u8 id;
2230 u8 unicast; 2232 u8 unicast;
@@ -2313,8 +2315,9 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
2313 2315
2314 /* Init first empty entry in queue's array of Tx/cmd buffers */ 2316 /* Init first empty entry in queue's array of Tx/cmd buffers */
2315 out_cmd = txq->cmd[idx]; 2317 out_cmd = txq->cmd[idx];
2318 tx = (struct iwl3945_tx_cmd *)out_cmd->cmd.payload;
2316 memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr)); 2319 memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr));
2317 memset(&out_cmd->cmd.tx, 0, sizeof(out_cmd->cmd.tx)); 2320 memset(tx, 0, sizeof(*tx));
2318 2321
2319 /* 2322 /*
2320 * Set up the Tx-command (not MAC!) header. 2323 * Set up the Tx-command (not MAC!) header.
@@ -2327,7 +2330,7 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
2327 INDEX_TO_SEQ(q->write_ptr))); 2330 INDEX_TO_SEQ(q->write_ptr)));
2328 2331
2329 /* Copy MAC header from skb into command buffer */ 2332 /* Copy MAC header from skb into command buffer */
2330 memcpy(out_cmd->cmd.tx.hdr, hdr, hdr_len); 2333 memcpy(tx->hdr, hdr, hdr_len);
2331 2334
2332 /* 2335 /*
2333 * Use the first empty entry in this queue's command buffer array 2336 * Use the first empty entry in this queue's command buffer array
@@ -2387,16 +2390,16 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
2387 2390
2388 /* Total # bytes to be transmitted */ 2391 /* Total # bytes to be transmitted */
2389 len = (u16)skb->len; 2392 len = (u16)skb->len;
2390 out_cmd->cmd.tx.len = cpu_to_le16(len); 2393 tx->len = cpu_to_le16(len);
2391 2394
2392 /* TODO need this for burst mode later on */ 2395 /* TODO need this for burst mode later on */
2393 iwl3945_build_tx_cmd_basic(priv, out_cmd, info, hdr, unicast, sta_id); 2396 iwl3945_build_tx_cmd_basic(priv, out_cmd, info, hdr, sta_id);
2394 2397
2395 /* set is_hcca to 0; it probably will never be implemented */ 2398 /* set is_hcca to 0; it probably will never be implemented */
2396 iwl3945_hw_build_tx_cmd_rate(priv, out_cmd, info, hdr, sta_id, 0); 2399 iwl3945_hw_build_tx_cmd_rate(priv, out_cmd, info, hdr, sta_id, 0);
2397 2400
2398 out_cmd->cmd.tx.tx_flags &= ~TX_CMD_FLG_ANT_A_MSK; 2401 tx->tx_flags &= ~TX_CMD_FLG_ANT_A_MSK;
2399 out_cmd->cmd.tx.tx_flags &= ~TX_CMD_FLG_ANT_B_MSK; 2402 tx->tx_flags &= ~TX_CMD_FLG_ANT_B_MSK;
2400 2403
2401 if (!ieee80211_has_morefrags(hdr->frame_control)) { 2404 if (!ieee80211_has_morefrags(hdr->frame_control)) {
2402 txq->need_update = 1; 2405 txq->need_update = 1;
@@ -2407,10 +2410,9 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
2407 txq->need_update = 0; 2410 txq->need_update = 0;
2408 } 2411 }
2409 2412
2410 iwl_print_hex_dump(priv, IWL_DL_TX, out_cmd->cmd.payload, 2413 iwl_print_hex_dump(priv, IWL_DL_TX, tx, sizeof(*tx));
2411 sizeof(out_cmd->cmd.tx));
2412 2414
2413 iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)out_cmd->cmd.tx.hdr, 2415 iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx->hdr,
2414 ieee80211_hdrlen(fc)); 2416 ieee80211_hdrlen(fc));
2415 2417
2416 /* Tell device the write index *just past* this latest filled TFD */ 2418 /* Tell device the write index *just past* this latest filled TFD */
@@ -7407,7 +7409,7 @@ static struct ieee80211_ops iwl3945_hw_ops = {
7407 .hw_scan = iwl3945_mac_hw_scan 7409 .hw_scan = iwl3945_mac_hw_scan
7408}; 7410};
7409 7411
7410int iwl3945_init_drv(struct iwl_priv *priv) 7412static int iwl3945_init_drv(struct iwl_priv *priv)
7411{ 7413{
7412 int ret; 7414 int ret;
7413 7415