diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2008-08-04 04:00:44 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-08-07 09:49:04 -0400 |
commit | f367422794315b7632f2a78c93e15b3c757d4be8 (patch) | |
tree | df5159c5e749db5b4985f4f4ac64c82d2f584604 /drivers/net/wireless/iwlwifi/iwl-tx.c | |
parent | e6fce5b916cd7f7f79b2b3e53ba74bbfc1d7cf8b (diff) |
iwlwifi: cleanup iwl_tx_skb
This patch cleans up iwl_tx_skb function.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-tx.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-tx.c | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c index aa98c76d8195..4108c7c8f00f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-tx.c | |||
@@ -764,20 +764,19 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
764 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 764 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
765 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 765 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
766 | struct iwl_tfd_frame *tfd; | 766 | struct iwl_tfd_frame *tfd; |
767 | u32 *control_flags; | 767 | struct iwl_tx_queue *txq; |
768 | int txq_id = skb_get_queue_mapping(skb); | 768 | struct iwl_queue *q; |
769 | struct iwl_tx_queue *txq = NULL; | 769 | struct iwl_cmd *out_cmd; |
770 | struct iwl_queue *q = NULL; | 770 | struct iwl_tx_cmd *tx_cmd; |
771 | int swq_id, txq_id; | ||
771 | dma_addr_t phys_addr; | 772 | dma_addr_t phys_addr; |
772 | dma_addr_t txcmd_phys; | 773 | dma_addr_t txcmd_phys; |
773 | dma_addr_t scratch_phys; | 774 | dma_addr_t scratch_phys; |
774 | struct iwl_cmd *out_cmd = NULL; | ||
775 | struct iwl_tx_cmd *tx_cmd; | ||
776 | u16 len, idx, len_org; | 775 | u16 len, idx, len_org; |
777 | u16 seq_number = 0; | 776 | u16 seq_number = 0; |
778 | u8 id, hdr_len, unicast; | ||
779 | u8 sta_id; | ||
780 | __le16 fc; | 777 | __le16 fc; |
778 | u8 hdr_len, unicast; | ||
779 | u8 sta_id; | ||
781 | u8 wait_write_ptr = 0; | 780 | u8 wait_write_ptr = 0; |
782 | u8 tid = 0; | 781 | u8 tid = 0; |
783 | u8 *qc = NULL; | 782 | u8 *qc = NULL; |
@@ -802,7 +801,6 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
802 | } | 801 | } |
803 | 802 | ||
804 | unicast = !is_multicast_ether_addr(hdr->addr1); | 803 | unicast = !is_multicast_ether_addr(hdr->addr1); |
805 | id = 0; | ||
806 | 804 | ||
807 | fc = hdr->frame_control; | 805 | fc = hdr->frame_control; |
808 | 806 | ||
@@ -840,14 +838,16 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
840 | 838 | ||
841 | IWL_DEBUG_TX("station Id %d\n", sta_id); | 839 | IWL_DEBUG_TX("station Id %d\n", sta_id); |
842 | 840 | ||
841 | swq_id = skb_get_queue_mapping(skb); | ||
842 | txq_id = swq_id; | ||
843 | if (ieee80211_is_data_qos(fc)) { | 843 | if (ieee80211_is_data_qos(fc)) { |
844 | qc = ieee80211_get_qos_ctl(hdr); | 844 | qc = ieee80211_get_qos_ctl(hdr); |
845 | tid = qc[0] & 0xf; | 845 | tid = qc[0] & 0xf; |
846 | seq_number = priv->stations[sta_id].tid[tid].seq_number & | 846 | seq_number = priv->stations[sta_id].tid[tid].seq_number; |
847 | IEEE80211_SCTL_SEQ; | 847 | seq_number &= IEEE80211_SCTL_SEQ; |
848 | hdr->seq_ctrl = cpu_to_le16(seq_number) | | 848 | hdr->seq_ctrl = hdr->seq_ctrl & |
849 | (hdr->seq_ctrl & | 849 | __constant_cpu_to_le16(IEEE80211_SCTL_FRAG); |
850 | __constant_cpu_to_le16(IEEE80211_SCTL_FRAG)); | 850 | hdr->seq_ctrl |= cpu_to_le16(seq_number); |
851 | seq_number += 0x10; | 851 | seq_number += 0x10; |
852 | /* aggregation is on for this <sta,tid> */ | 852 | /* aggregation is on for this <sta,tid> */ |
853 | if (info->flags & IEEE80211_TX_CTL_AMPDU) | 853 | if (info->flags & IEEE80211_TX_CTL_AMPDU) |
@@ -864,7 +864,6 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
864 | /* Set up first empty TFD within this queue's circular TFD buffer */ | 864 | /* Set up first empty TFD within this queue's circular TFD buffer */ |
865 | tfd = &txq->bd[q->write_ptr]; | 865 | tfd = &txq->bd[q->write_ptr]; |
866 | memset(tfd, 0, sizeof(*tfd)); | 866 | memset(tfd, 0, sizeof(*tfd)); |
867 | control_flags = (u32 *) tfd; | ||
868 | idx = get_cmd_index(q, q->write_ptr, 0); | 867 | idx = get_cmd_index(q, q->write_ptr, 0); |
869 | 868 | ||
870 | /* Set up driver data for this TFD */ | 869 | /* Set up driver data for this TFD */ |
@@ -983,8 +982,7 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
983 | iwl_txq_update_write_ptr(priv, txq); | 982 | iwl_txq_update_write_ptr(priv, txq); |
984 | spin_unlock_irqrestore(&priv->lock, flags); | 983 | spin_unlock_irqrestore(&priv->lock, flags); |
985 | } else { | 984 | } else { |
986 | ieee80211_stop_queue(priv->hw, | 985 | ieee80211_stop_queue(priv->hw, swq_id); |
987 | skb_get_queue_mapping(skb)); | ||
988 | } | 986 | } |
989 | } | 987 | } |
990 | 988 | ||
@@ -1013,13 +1011,12 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
1013 | struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM]; | 1011 | struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM]; |
1014 | struct iwl_queue *q = &txq->q; | 1012 | struct iwl_queue *q = &txq->q; |
1015 | struct iwl_tfd_frame *tfd; | 1013 | struct iwl_tfd_frame *tfd; |
1016 | u32 *control_flags; | ||
1017 | struct iwl_cmd *out_cmd; | 1014 | struct iwl_cmd *out_cmd; |
1018 | u32 idx; | ||
1019 | u16 fix_size; | ||
1020 | dma_addr_t phys_addr; | 1015 | dma_addr_t phys_addr; |
1021 | int len, ret; | ||
1022 | unsigned long flags; | 1016 | unsigned long flags; |
1017 | int len, ret; | ||
1018 | u32 idx; | ||
1019 | u16 fix_size; | ||
1023 | 1020 | ||
1024 | cmd->len = priv->cfg->ops->utils->get_hcmd_size(cmd->id, cmd->len); | 1021 | cmd->len = priv->cfg->ops->utils->get_hcmd_size(cmd->id, cmd->len); |
1025 | fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr)); | 1022 | fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr)); |
@@ -1045,7 +1042,6 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
1045 | tfd = &txq->bd[q->write_ptr]; | 1042 | tfd = &txq->bd[q->write_ptr]; |
1046 | memset(tfd, 0, sizeof(*tfd)); | 1043 | memset(tfd, 0, sizeof(*tfd)); |
1047 | 1044 | ||
1048 | control_flags = (u32 *) tfd; | ||
1049 | 1045 | ||
1050 | idx = get_cmd_index(q, q->write_ptr, cmd->meta.flags & CMD_SIZE_HUGE); | 1046 | idx = get_cmd_index(q, q->write_ptr, cmd->meta.flags & CMD_SIZE_HUGE); |
1051 | out_cmd = txq->cmd[idx]; | 1047 | out_cmd = txq->cmd[idx]; |