diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2008-05-15 06:55:29 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-05-21 21:48:11 -0400 |
commit | e039fa4a4195ac4ee895e6f3d1334beed63256fe (patch) | |
tree | cfd0762d73df96b73052378be7b157c4ac6e7035 /drivers/net/wireless/iwlwifi/iwl3945-base.c | |
parent | e24549485f859be6518929bb1c9c0257d79f033d (diff) |
mac80211: move TX info into skb->cb
This patch converts mac80211 and all drivers to have transmit
information and status in skb->cb rather than allocating extra
memory for it and copying all the data around. To make it fit,
a union is used where only data that is necessary for all steps
is kept outside of the union.
A number of fixes were done by Ivo, as well as the rt2x00 part
of this patch.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl3945-base.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl3945-base.c | 48 |
1 files changed, 22 insertions, 26 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index a28b4c9f6524..a740a1817d16 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -2376,13 +2376,13 @@ static int iwl3945_set_mode(struct iwl3945_priv *priv, int mode) | |||
2376 | } | 2376 | } |
2377 | 2377 | ||
2378 | static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv, | 2378 | static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv, |
2379 | struct ieee80211_tx_control *ctl, | 2379 | struct ieee80211_tx_info *info, |
2380 | struct iwl3945_cmd *cmd, | 2380 | struct iwl3945_cmd *cmd, |
2381 | struct sk_buff *skb_frag, | 2381 | struct sk_buff *skb_frag, |
2382 | int last_frag) | 2382 | int last_frag) |
2383 | { | 2383 | { |
2384 | struct iwl3945_hw_key *keyinfo = | 2384 | struct iwl3945_hw_key *keyinfo = |
2385 | &priv->stations[ctl->hw_key->hw_key_idx].keyinfo; | 2385 | &priv->stations[info->control.hw_key->hw_key_idx].keyinfo; |
2386 | 2386 | ||
2387 | switch (keyinfo->alg) { | 2387 | switch (keyinfo->alg) { |
2388 | case ALG_CCMP: | 2388 | case ALG_CCMP: |
@@ -2405,7 +2405,7 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv, | |||
2405 | 2405 | ||
2406 | case ALG_WEP: | 2406 | case ALG_WEP: |
2407 | cmd->cmd.tx.sec_ctl = TX_CMD_SEC_WEP | | 2407 | cmd->cmd.tx.sec_ctl = TX_CMD_SEC_WEP | |
2408 | (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; |
2409 | 2409 | ||
2410 | if (keyinfo->keylen == 13) | 2410 | if (keyinfo->keylen == 13) |
2411 | cmd->cmd.tx.sec_ctl |= TX_CMD_SEC_KEY128; | 2411 | cmd->cmd.tx.sec_ctl |= TX_CMD_SEC_KEY128; |
@@ -2413,7 +2413,7 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv, | |||
2413 | memcpy(&cmd->cmd.tx.key[3], keyinfo->key, keyinfo->keylen); | 2413 | memcpy(&cmd->cmd.tx.key[3], keyinfo->key, keyinfo->keylen); |
2414 | 2414 | ||
2415 | IWL_DEBUG_TX("Configuring packet for WEP encryption " | 2415 | IWL_DEBUG_TX("Configuring packet for WEP encryption " |
2416 | "with key %d\n", ctl->hw_key->hw_key_idx); | 2416 | "with key %d\n", info->control.hw_key->hw_key_idx); |
2417 | break; | 2417 | break; |
2418 | 2418 | ||
2419 | default: | 2419 | default: |
@@ -2427,7 +2427,7 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv, | |||
2427 | */ | 2427 | */ |
2428 | static void iwl3945_build_tx_cmd_basic(struct iwl3945_priv *priv, | 2428 | static void iwl3945_build_tx_cmd_basic(struct iwl3945_priv *priv, |
2429 | struct iwl3945_cmd *cmd, | 2429 | struct iwl3945_cmd *cmd, |
2430 | struct ieee80211_tx_control *ctrl, | 2430 | struct ieee80211_tx_info *info, |
2431 | struct ieee80211_hdr *hdr, | 2431 | struct ieee80211_hdr *hdr, |
2432 | int is_unicast, u8 std_id) | 2432 | int is_unicast, u8 std_id) |
2433 | { | 2433 | { |
@@ -2435,7 +2435,7 @@ static void iwl3945_build_tx_cmd_basic(struct iwl3945_priv *priv, | |||
2435 | __le32 tx_flags = cmd->cmd.tx.tx_flags; | 2435 | __le32 tx_flags = cmd->cmd.tx.tx_flags; |
2436 | 2436 | ||
2437 | 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; |
2438 | if (!(ctrl->flags & IEEE80211_TXCTL_NO_ACK)) { | 2438 | if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) { |
2439 | tx_flags |= TX_CMD_FLG_ACK_MSK; | 2439 | tx_flags |= TX_CMD_FLG_ACK_MSK; |
2440 | if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) | 2440 | if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) |
2441 | tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; | 2441 | tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; |
@@ -2459,10 +2459,10 @@ static void iwl3945_build_tx_cmd_basic(struct iwl3945_priv *priv, | |||
2459 | tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; | 2459 | tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; |
2460 | } | 2460 | } |
2461 | 2461 | ||
2462 | if (ctrl->flags & IEEE80211_TXCTL_USE_RTS_CTS) { | 2462 | if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) { |
2463 | tx_flags |= TX_CMD_FLG_RTS_MSK; | 2463 | tx_flags |= TX_CMD_FLG_RTS_MSK; |
2464 | tx_flags &= ~TX_CMD_FLG_CTS_MSK; | 2464 | tx_flags &= ~TX_CMD_FLG_CTS_MSK; |
2465 | } else if (ctrl->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) { | 2465 | } else if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) { |
2466 | tx_flags &= ~TX_CMD_FLG_RTS_MSK; | 2466 | tx_flags &= ~TX_CMD_FLG_RTS_MSK; |
2467 | tx_flags |= TX_CMD_FLG_CTS_MSK; | 2467 | tx_flags |= TX_CMD_FLG_CTS_MSK; |
2468 | } | 2468 | } |
@@ -2546,13 +2546,13 @@ static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *h | |||
2546 | /* | 2546 | /* |
2547 | * start REPLY_TX command process | 2547 | * start REPLY_TX command process |
2548 | */ | 2548 | */ |
2549 | static int iwl3945_tx_skb(struct iwl3945_priv *priv, | 2549 | static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb) |
2550 | struct sk_buff *skb, struct ieee80211_tx_control *ctl) | ||
2551 | { | 2550 | { |
2552 | 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); | ||
2553 | struct iwl3945_tfd_frame *tfd; | 2553 | struct iwl3945_tfd_frame *tfd; |
2554 | u32 *control_flags; | 2554 | u32 *control_flags; |
2555 | int txq_id = ctl->queue; | 2555 | int txq_id = info->queue; |
2556 | struct iwl3945_tx_queue *txq = NULL; | 2556 | struct iwl3945_tx_queue *txq = NULL; |
2557 | struct iwl3945_queue *q = NULL; | 2557 | struct iwl3945_queue *q = NULL; |
2558 | dma_addr_t phys_addr; | 2558 | dma_addr_t phys_addr; |
@@ -2581,7 +2581,7 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, | |||
2581 | goto drop_unlock; | 2581 | goto drop_unlock; |
2582 | } | 2582 | } |
2583 | 2583 | ||
2584 | if ((ieee80211_get_tx_rate(priv->hw, ctl)->hw_value & 0xFF) == IWL_INVALID_RATE) { | 2584 | if ((ieee80211_get_tx_rate(priv->hw, info)->hw_value & 0xFF) == IWL_INVALID_RATE) { |
2585 | IWL_ERROR("ERROR: No TX rate available.\n"); | 2585 | IWL_ERROR("ERROR: No TX rate available.\n"); |
2586 | goto drop_unlock; | 2586 | goto drop_unlock; |
2587 | } | 2587 | } |
@@ -2650,8 +2650,6 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, | |||
2650 | /* Set up driver data for this TFD */ | 2650 | /* Set up driver data for this TFD */ |
2651 | 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)); |
2652 | txq->txb[q->write_ptr].skb[0] = skb; | 2652 | txq->txb[q->write_ptr].skb[0] = skb; |
2653 | memcpy(&(txq->txb[q->write_ptr].status.control), | ||
2654 | ctl, sizeof(struct ieee80211_tx_control)); | ||
2655 | 2653 | ||
2656 | /* 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 */ |
2657 | out_cmd = &txq->cmd[idx]; | 2655 | out_cmd = &txq->cmd[idx]; |
@@ -2700,8 +2698,8 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, | |||
2700 | * first entry */ | 2698 | * first entry */ |
2701 | 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); |
2702 | 2700 | ||
2703 | if (!(ctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) | 2701 | if (!(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT)) |
2704 | iwl3945_build_tx_cmd_hwcrypto(priv, ctl, out_cmd, skb, 0); | 2702 | iwl3945_build_tx_cmd_hwcrypto(priv, info, out_cmd, skb, 0); |
2705 | 2703 | ||
2706 | /* 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, |
2707 | * if any (802.11 null frames have no payload). */ | 2705 | * if any (802.11 null frames have no payload). */ |
@@ -2726,10 +2724,10 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, | |||
2726 | out_cmd->cmd.tx.len = cpu_to_le16(len); | 2724 | out_cmd->cmd.tx.len = cpu_to_le16(len); |
2727 | 2725 | ||
2728 | /* TODO need this for burst mode later on */ | 2726 | /* TODO need this for burst mode later on */ |
2729 | 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); |
2730 | 2728 | ||
2731 | /* set is_hcca to 0; it probably will never be implemented */ | 2729 | /* set is_hcca to 0; it probably will never be implemented */ |
2732 | 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); |
2733 | 2731 | ||
2734 | 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; |
2735 | 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; |
@@ -2767,7 +2765,7 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, | |||
2767 | spin_unlock_irqrestore(&priv->lock, flags); | 2765 | spin_unlock_irqrestore(&priv->lock, flags); |
2768 | } | 2766 | } |
2769 | 2767 | ||
2770 | ieee80211_stop_queue(priv->hw, ctl->queue); | 2768 | ieee80211_stop_queue(priv->hw, info->queue); |
2771 | } | 2769 | } |
2772 | 2770 | ||
2773 | return 0; | 2771 | return 0; |
@@ -3230,7 +3228,7 @@ static void iwl3945_bg_beacon_update(struct work_struct *work) | |||
3230 | struct sk_buff *beacon; | 3228 | struct sk_buff *beacon; |
3231 | 3229 | ||
3232 | /* 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 */ |
3233 | beacon = ieee80211_beacon_get(priv->hw, priv->vif, NULL); | 3231 | beacon = ieee80211_beacon_get(priv->hw, priv->vif); |
3234 | 3232 | ||
3235 | if (!beacon) { | 3233 | if (!beacon) { |
3236 | IWL_ERROR("update beacon failed\n"); | 3234 | IWL_ERROR("update beacon failed\n"); |
@@ -6681,8 +6679,7 @@ static void iwl3945_mac_stop(struct ieee80211_hw *hw) | |||
6681 | IWL_DEBUG_MAC80211("leave\n"); | 6679 | IWL_DEBUG_MAC80211("leave\n"); |
6682 | } | 6680 | } |
6683 | 6681 | ||
6684 | static int iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb, | 6682 | static int iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) |
6685 | struct ieee80211_tx_control *ctl) | ||
6686 | { | 6683 | { |
6687 | struct iwl3945_priv *priv = hw->priv; | 6684 | struct iwl3945_priv *priv = hw->priv; |
6688 | 6685 | ||
@@ -6694,9 +6691,9 @@ static int iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
6694 | } | 6691 | } |
6695 | 6692 | ||
6696 | IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, | 6693 | IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, |
6697 | ieee80211_get_tx_rate(hw, ctl)->bitrate); | 6694 | ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate); |
6698 | 6695 | ||
6699 | if (iwl3945_tx_skb(priv, skb, ctl)) | 6696 | if (iwl3945_tx_skb(priv, skb)) |
6700 | dev_kfree_skb_any(skb); | 6697 | dev_kfree_skb_any(skb); |
6701 | 6698 | ||
6702 | IWL_DEBUG_MAC80211("leave\n"); | 6699 | IWL_DEBUG_MAC80211("leave\n"); |
@@ -7333,8 +7330,7 @@ static void iwl3945_mac_reset_tsf(struct ieee80211_hw *hw) | |||
7333 | 7330 | ||
7334 | } | 7331 | } |
7335 | 7332 | ||
7336 | static int iwl3945_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, | 7333 | static int iwl3945_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) |
7337 | struct ieee80211_tx_control *control) | ||
7338 | { | 7334 | { |
7339 | struct iwl3945_priv *priv = hw->priv; | 7335 | struct iwl3945_priv *priv = hw->priv; |
7340 | unsigned long flags; | 7336 | unsigned long flags; |