From e52119c50d6a35506b1c063eeacf7acc40b4e03d Mon Sep 17 00:00:00 2001 From: "Winkler, Tomas" Date: Mon, 22 Dec 2008 11:31:19 +0800 Subject: [PATCH] iwl3945: use iwl3945_tx_cmd instead of iwl_tx_cmd The patch replaces iwl_tx_cmd with iwl3945_tx_cmd to complete transitions introduced by "iwlwifi: use iwl_cmd instead of iwl3945_cmd" Signed-off-by: Tomas Winkler Signed-off-by: Zhu Yi Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-3945.c | 2 +- drivers/net/wireless/iwlwifi/iwl3945-base.c | 66 +++++++++++++++-------------- 2 files changed, 35 insertions(+), 33 deletions(-) diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 54ad07722b0..0260545e356 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c @@ -1322,7 +1322,7 @@ static void iwl3945_apm_stop(struct iwl_priv *priv) spin_unlock_irqrestore(&priv->lock, flags); } -int iwl3945_apm_reset(struct iwl_priv *priv) +static int iwl3945_apm_reset(struct iwl_priv *priv) { int rc; unsigned long flags; diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index afde87bc499..0059d288931 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, struct sk_buff *skb_frag, int last_frag) { + struct iwl3945_tx_cmd *tx = (struct iwl3945_tx_cmd *)cmd->cmd.payload; struct iwl3945_hw_key *keyinfo = &priv->stations_39[info->control.hw_key->hw_key_idx].keyinfo; switch (keyinfo->alg) { case ALG_CCMP: - cmd->cmd.tx.sec_ctl = TX_CMD_SEC_CCM; - memcpy(cmd->cmd.tx.key, keyinfo->key, keyinfo->keylen); + tx->sec_ctl = TX_CMD_SEC_CCM; + memcpy(tx->key, keyinfo->key, keyinfo->keylen); IWL_DEBUG_TX("tx_cmd with AES hwcrypto\n"); break; case ALG_TKIP: #if 0 - cmd->cmd.tx.sec_ctl = TX_CMD_SEC_TKIP; + tx->sec_ctl = TX_CMD_SEC_TKIP; if (last_frag) - memcpy(cmd->cmd.tx.tkip_mic.byte, skb_frag->tail - 8, + memcpy(tx->tkip_mic.byte, skb_frag->tail - 8, 8); else - memset(cmd->cmd.tx.tkip_mic.byte, 0, 8); + memset(tx->tkip_mic.byte, 0, 8); #endif break; case ALG_WEP: - cmd->cmd.tx.sec_ctl = TX_CMD_SEC_WEP | + tx->sec_ctl = TX_CMD_SEC_WEP | (info->control.hw_key->hw_key_idx & TX_CMD_SEC_MSK) << TX_CMD_SEC_SHIFT; if (keyinfo->keylen == 13) - cmd->cmd.tx.sec_ctl |= TX_CMD_SEC_KEY128; + tx->sec_ctl |= TX_CMD_SEC_KEY128; - memcpy(&cmd->cmd.tx.key[3], keyinfo->key, keyinfo->keylen); + memcpy(&tx->key[3], keyinfo->key, keyinfo->keylen); IWL_DEBUG_TX("Configuring packet for WEP encryption " "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, static void iwl3945_build_tx_cmd_basic(struct iwl_priv *priv, struct iwl_cmd *cmd, struct ieee80211_tx_info *info, - struct ieee80211_hdr *hdr, - int is_unicast, u8 std_id) + struct ieee80211_hdr *hdr, u8 std_id) { + struct iwl3945_tx_cmd *tx = (struct iwl3945_tx_cmd *)cmd->cmd.payload; + __le32 tx_flags = tx->tx_flags; __le16 fc = hdr->frame_control; - __le32 tx_flags = cmd->cmd.tx.tx_flags; u8 rc_flags = info->control.rates[0].flags; - cmd->cmd.tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; + tx->stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) { tx_flags |= TX_CMD_FLG_ACK_MSK; if (ieee80211_is_mgmt(fc)) @@ -2112,13 +2113,13 @@ static void iwl3945_build_tx_cmd_basic(struct iwl_priv *priv, tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; } - cmd->cmd.tx.sta_id = std_id; + tx->sta_id = std_id; if (ieee80211_has_morefrags(fc)) tx_flags |= TX_CMD_FLG_MORE_FRAG_MSK; if (ieee80211_is_data_qos(fc)) { u8 *qc = ieee80211_get_qos_ctl(hdr); - cmd->cmd.tx.tid_tspec = qc[0] & 0xf; + tx->tid_tspec = qc[0] & 0xf; tx_flags &= ~TX_CMD_FLG_SEQ_CTL_MSK; } else { tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; @@ -2138,19 +2139,19 @@ static void iwl3945_build_tx_cmd_basic(struct iwl_priv *priv, tx_flags &= ~(TX_CMD_FLG_ANT_SEL_MSK); if (ieee80211_is_mgmt(fc)) { if (ieee80211_is_assoc_req(fc) || ieee80211_is_reassoc_req(fc)) - cmd->cmd.tx.timeout.pm_frame_timeout = cpu_to_le16(3); + tx->timeout.pm_frame_timeout = cpu_to_le16(3); else - cmd->cmd.tx.timeout.pm_frame_timeout = cpu_to_le16(2); + tx->timeout.pm_frame_timeout = cpu_to_le16(2); } else { - cmd->cmd.tx.timeout.pm_frame_timeout = 0; + tx->timeout.pm_frame_timeout = 0; #ifdef CONFIG_IWL3945_LEDS priv->rxtxpackets += le16_to_cpu(cmd->cmd.tx.len); #endif } - cmd->cmd.tx.driver_txop = 0; - cmd->cmd.tx.tx_flags = tx_flags; - cmd->cmd.tx.next_frame_len = 0; + tx->driver_txop = 0; + tx->tx_flags = tx_flags; + tx->next_frame_len = 0; } /** @@ -2219,12 +2220,13 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); struct iwl3945_tfd *tfd; - int txq_id = skb_get_queue_mapping(skb); + struct iwl3945_tx_cmd *tx; struct iwl_tx_queue *txq = NULL; struct iwl_queue *q = NULL; + struct iwl_cmd *out_cmd = NULL; dma_addr_t phys_addr; dma_addr_t txcmd_phys; - struct iwl_cmd *out_cmd = NULL; + int txq_id = skb_get_queue_mapping(skb); u16 len, idx, len_org, hdr_len; u8 id; u8 unicast; @@ -2313,8 +2315,9 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) /* Init first empty entry in queue's array of Tx/cmd buffers */ out_cmd = txq->cmd[idx]; + tx = (struct iwl3945_tx_cmd *)out_cmd->cmd.payload; memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr)); - memset(&out_cmd->cmd.tx, 0, sizeof(out_cmd->cmd.tx)); + memset(tx, 0, sizeof(*tx)); /* * 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) INDEX_TO_SEQ(q->write_ptr))); /* Copy MAC header from skb into command buffer */ - memcpy(out_cmd->cmd.tx.hdr, hdr, hdr_len); + memcpy(tx->hdr, hdr, hdr_len); /* * 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) /* Total # bytes to be transmitted */ len = (u16)skb->len; - out_cmd->cmd.tx.len = cpu_to_le16(len); + tx->len = cpu_to_le16(len); /* TODO need this for burst mode later on */ - iwl3945_build_tx_cmd_basic(priv, out_cmd, info, hdr, unicast, sta_id); + iwl3945_build_tx_cmd_basic(priv, out_cmd, info, hdr, sta_id); /* set is_hcca to 0; it probably will never be implemented */ iwl3945_hw_build_tx_cmd_rate(priv, out_cmd, info, hdr, sta_id, 0); - out_cmd->cmd.tx.tx_flags &= ~TX_CMD_FLG_ANT_A_MSK; - out_cmd->cmd.tx.tx_flags &= ~TX_CMD_FLG_ANT_B_MSK; + tx->tx_flags &= ~TX_CMD_FLG_ANT_A_MSK; + tx->tx_flags &= ~TX_CMD_FLG_ANT_B_MSK; if (!ieee80211_has_morefrags(hdr->frame_control)) { txq->need_update = 1; @@ -2407,10 +2410,9 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) txq->need_update = 0; } - iwl_print_hex_dump(priv, IWL_DL_TX, out_cmd->cmd.payload, - sizeof(out_cmd->cmd.tx)); + iwl_print_hex_dump(priv, IWL_DL_TX, tx, sizeof(*tx)); - iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)out_cmd->cmd.tx.hdr, + iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx->hdr, ieee80211_hdrlen(fc)); /* Tell device the write index *just past* this latest filled TFD */ @@ -7407,7 +7409,7 @@ static struct ieee80211_ops iwl3945_hw_ops = { .hw_scan = iwl3945_mac_hw_scan }; -int iwl3945_init_drv(struct iwl_priv *priv) +static int iwl3945_init_drv(struct iwl_priv *priv) { int ret; -- 2.11.4.GIT