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>

authored by Tomas Winkler and committed by John W. Linville f3674227 e6fce5b9

+22 -25
+2 -2
drivers/net/wireless/iwlwifi/iwl-agn.c
··· 2719 { 2720 struct iwl_priv *priv = hw->priv; 2721 2722 - IWL_DEBUG_MAC80211("enter\n"); 2723 2724 if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) { 2725 IWL_DEBUG_MAC80211("leave - monitor\n"); ··· 2733 if (iwl_tx_skb(priv, skb)) 2734 dev_kfree_skb_any(skb); 2735 2736 - IWL_DEBUG_MAC80211("leave\n"); 2737 return 0; 2738 } 2739
··· 2719 { 2720 struct iwl_priv *priv = hw->priv; 2721 2722 + IWL_DEBUG_MACDUMP("enter\n"); 2723 2724 if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) { 2725 IWL_DEBUG_MAC80211("leave - monitor\n"); ··· 2733 if (iwl_tx_skb(priv, skb)) 2734 dev_kfree_skb_any(skb); 2735 2736 + IWL_DEBUG_MACDUMP("leave\n"); 2737 return 0; 2738 } 2739
+2 -1
drivers/net/wireless/iwlwifi/iwl-debug.h
··· 114 #define IWL_DL_MAC80211 (1 << 1) 115 #define IWL_DL_HOST_COMMAND (1 << 2) 116 #define IWL_DL_STATE (1 << 3) 117 - 118 #define IWL_DL_RADIO (1 << 7) 119 #define IWL_DL_POWER (1 << 8) 120 #define IWL_DL_TEMP (1 << 9) ··· 154 #define IWL_DEBUG_INFO(f, a...) IWL_DEBUG(IWL_DL_INFO, f, ## a) 155 156 #define IWL_DEBUG_MAC80211(f, a...) IWL_DEBUG(IWL_DL_MAC80211, f, ## a) 157 #define IWL_DEBUG_TEMP(f, a...) IWL_DEBUG(IWL_DL_TEMP, f, ## a) 158 #define IWL_DEBUG_SCAN(f, a...) IWL_DEBUG(IWL_DL_SCAN, f, ## a) 159 #define IWL_DEBUG_RX(f, a...) IWL_DEBUG(IWL_DL_RX, f, ## a)
··· 114 #define IWL_DL_MAC80211 (1 << 1) 115 #define IWL_DL_HOST_COMMAND (1 << 2) 116 #define IWL_DL_STATE (1 << 3) 117 + #define IWL_DL_MACDUMP (1 << 4) 118 #define IWL_DL_RADIO (1 << 7) 119 #define IWL_DL_POWER (1 << 8) 120 #define IWL_DL_TEMP (1 << 9) ··· 154 #define IWL_DEBUG_INFO(f, a...) IWL_DEBUG(IWL_DL_INFO, f, ## a) 155 156 #define IWL_DEBUG_MAC80211(f, a...) IWL_DEBUG(IWL_DL_MAC80211, f, ## a) 157 + #define IWL_DEBUG_MACDUMP(f, a...) IWL_DEBUG(IWL_DL_MACDUMP, f, ## a) 158 #define IWL_DEBUG_TEMP(f, a...) IWL_DEBUG(IWL_DL_TEMP, f, ## a) 159 #define IWL_DEBUG_SCAN(f, a...) IWL_DEBUG(IWL_DL_SCAN, f, ## a) 160 #define IWL_DEBUG_RX(f, a...) IWL_DEBUG(IWL_DL_RX, f, ## a)
+18 -22
drivers/net/wireless/iwlwifi/iwl-tx.c
··· 764 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 765 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 766 struct iwl_tfd_frame *tfd; 767 - u32 *control_flags; 768 - int txq_id = skb_get_queue_mapping(skb); 769 - struct iwl_tx_queue *txq = NULL; 770 - struct iwl_queue *q = NULL; 771 dma_addr_t phys_addr; 772 dma_addr_t txcmd_phys; 773 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; 777 u16 seq_number = 0; 778 - u8 id, hdr_len, unicast; 779 - u8 sta_id; 780 __le16 fc; 781 u8 wait_write_ptr = 0; 782 u8 tid = 0; 783 u8 *qc = NULL; ··· 801 } 802 803 unicast = !is_multicast_ether_addr(hdr->addr1); 804 - id = 0; 805 806 fc = hdr->frame_control; 807 ··· 838 839 IWL_DEBUG_TX("station Id %d\n", sta_id); 840 841 if (ieee80211_is_data_qos(fc)) { 842 qc = ieee80211_get_qos_ctl(hdr); 843 tid = qc[0] & 0xf; 844 - seq_number = priv->stations[sta_id].tid[tid].seq_number & 845 - IEEE80211_SCTL_SEQ; 846 - hdr->seq_ctrl = cpu_to_le16(seq_number) | 847 - (hdr->seq_ctrl & 848 - __constant_cpu_to_le16(IEEE80211_SCTL_FRAG)); 849 seq_number += 0x10; 850 /* aggregation is on for this <sta,tid> */ 851 if (info->flags & IEEE80211_TX_CTL_AMPDU) ··· 864 /* Set up first empty TFD within this queue's circular TFD buffer */ 865 tfd = &txq->bd[q->write_ptr]; 866 memset(tfd, 0, sizeof(*tfd)); 867 - control_flags = (u32 *) tfd; 868 idx = get_cmd_index(q, q->write_ptr, 0); 869 870 /* Set up driver data for this TFD */ ··· 982 iwl_txq_update_write_ptr(priv, txq); 983 spin_unlock_irqrestore(&priv->lock, flags); 984 } else { 985 - ieee80211_stop_queue(priv->hw, 986 - skb_get_queue_mapping(skb)); 987 } 988 } 989 ··· 1011 struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM]; 1012 struct iwl_queue *q = &txq->q; 1013 struct iwl_tfd_frame *tfd; 1014 - u32 *control_flags; 1015 struct iwl_cmd *out_cmd; 1016 u32 idx; 1017 u16 fix_size; 1018 - dma_addr_t phys_addr; 1019 - int len, ret; 1020 - unsigned long flags; 1021 1022 cmd->len = priv->cfg->ops->utils->get_hcmd_size(cmd->id, cmd->len); 1023 fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr)); ··· 1042 tfd = &txq->bd[q->write_ptr]; 1043 memset(tfd, 0, sizeof(*tfd)); 1044 1045 - control_flags = (u32 *) tfd; 1046 1047 idx = get_cmd_index(q, q->write_ptr, cmd->meta.flags & CMD_SIZE_HUGE); 1048 out_cmd = txq->cmd[idx];
··· 764 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 765 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 766 struct iwl_tfd_frame *tfd; 767 + struct iwl_tx_queue *txq; 768 + struct iwl_queue *q; 769 + struct iwl_cmd *out_cmd; 770 + struct iwl_tx_cmd *tx_cmd; 771 + int swq_id, txq_id; 772 dma_addr_t phys_addr; 773 dma_addr_t txcmd_phys; 774 dma_addr_t scratch_phys; 775 u16 len, idx, len_org; 776 u16 seq_number = 0; 777 __le16 fc; 778 + u8 hdr_len, unicast; 779 + u8 sta_id; 780 u8 wait_write_ptr = 0; 781 u8 tid = 0; 782 u8 *qc = NULL; ··· 802 } 803 804 unicast = !is_multicast_ether_addr(hdr->addr1); 805 806 fc = hdr->frame_control; 807 ··· 840 841 IWL_DEBUG_TX("station Id %d\n", sta_id); 842 843 + swq_id = skb_get_queue_mapping(skb); 844 + txq_id = swq_id; 845 if (ieee80211_is_data_qos(fc)) { 846 qc = ieee80211_get_qos_ctl(hdr); 847 tid = qc[0] & 0xf; 848 + seq_number = priv->stations[sta_id].tid[tid].seq_number; 849 + seq_number &= IEEE80211_SCTL_SEQ; 850 + hdr->seq_ctrl = hdr->seq_ctrl & 851 + __constant_cpu_to_le16(IEEE80211_SCTL_FRAG); 852 + hdr->seq_ctrl |= cpu_to_le16(seq_number); 853 seq_number += 0x10; 854 /* aggregation is on for this <sta,tid> */ 855 if (info->flags & IEEE80211_TX_CTL_AMPDU) ··· 864 /* Set up first empty TFD within this queue's circular TFD buffer */ 865 tfd = &txq->bd[q->write_ptr]; 866 memset(tfd, 0, sizeof(*tfd)); 867 idx = get_cmd_index(q, q->write_ptr, 0); 868 869 /* Set up driver data for this TFD */ ··· 983 iwl_txq_update_write_ptr(priv, txq); 984 spin_unlock_irqrestore(&priv->lock, flags); 985 } else { 986 + ieee80211_stop_queue(priv->hw, swq_id); 987 } 988 } 989 ··· 1013 struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM]; 1014 struct iwl_queue *q = &txq->q; 1015 struct iwl_tfd_frame *tfd; 1016 struct iwl_cmd *out_cmd; 1017 + dma_addr_t phys_addr; 1018 + unsigned long flags; 1019 + int len, ret; 1020 u32 idx; 1021 u16 fix_size; 1022 1023 cmd->len = priv->cfg->ops->utils->get_hcmd_size(cmd->id, cmd->len); 1024 fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr)); ··· 1045 tfd = &txq->bd[q->write_ptr]; 1046 memset(tfd, 0, sizeof(*tfd)); 1047 1048 1049 idx = get_cmd_index(q, q->write_ptr, cmd->meta.flags & CMD_SIZE_HUGE); 1050 out_cmd = txq->cmd[idx];