aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath
diff options
context:
space:
mode:
authorMichal Kazior <michal.kazior@tieto.com>2014-07-21 14:03:09 -0400
committerKalle Valo <kvalo@qca.qualcomm.com>2014-07-22 11:53:52 -0400
commit4b6045586f31c7cc49b641a7ad5298b0c379a1c7 (patch)
treed1e55edf2c17f713346e688991c1344af98ca286 /drivers/net/wireless/ath
parent708b9bde5d8462d7ce47c1c8ddfc84dd2539e39a (diff)
ath10k: simplify tx helpers
It always bugged me how tid is computed and stored in a temporary var before written to the control buffer. It was confusing and it made it difficult to work with tx helpers. While at it rename the qos workaround function as it was misleading - it's not a workaround but preparation for nwifi tx mode. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Diffstat (limited to 'drivers/net/wireless/ath')
-rw-r--r--drivers/net/wireless/ath/ath10k/mac.c49
-rw-r--r--drivers/net/wireless/ath/ath10k/mac.h4
-rw-r--r--drivers/net/wireless/ath/ath10k/wmi.c2
3 files changed, 23 insertions, 32 deletions
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index b8314a534972..bbce3a0f8a39 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1865,13 +1865,10 @@ static u8 ath10k_tx_h_get_vdev_id(struct ath10k *ar,
1865 return 0; 1865 return 0;
1866} 1866}
1867 1867
1868/* 1868/* HTT Tx uses Native Wifi tx mode which expects 802.11 frames without QoS
1869 * Frames sent to the FW have to be in "Native Wifi" format. 1869 * Control in the header.
1870 * Strip the QoS field from the 802.11 header.
1871 */ 1870 */
1872static void ath10k_tx_h_qos_workaround(struct ieee80211_hw *hw, 1871static void ath10k_tx_h_nwifi(struct ieee80211_hw *hw, struct sk_buff *skb)
1873 struct ieee80211_tx_control *control,
1874 struct sk_buff *skb)
1875{ 1872{
1876 struct ieee80211_hdr *hdr = (void *)skb->data; 1873 struct ieee80211_hdr *hdr = (void *)skb->data;
1877 u8 *qos_ctl; 1874 u8 *qos_ctl;
@@ -1919,14 +1916,13 @@ unlock:
1919 mutex_unlock(&arvif->ar->conf_mutex); 1916 mutex_unlock(&arvif->ar->conf_mutex);
1920} 1917}
1921 1918
1922static void ath10k_tx_h_update_wep_key(struct sk_buff *skb) 1919static void ath10k_tx_h_update_wep_key(struct ieee80211_vif *vif,
1920 struct ieee80211_key_conf *key,
1921 struct sk_buff *skb)
1923{ 1922{
1924 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1925 struct ieee80211_vif *vif = info->control.vif;
1926 struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif); 1923 struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
1927 struct ath10k *ar = arvif->ar; 1924 struct ath10k *ar = arvif->ar;
1928 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 1925 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
1929 struct ieee80211_key_conf *key = info->control.hw_key;
1930 1926
1931 if (!ieee80211_has_protected(hdr->frame_control)) 1927 if (!ieee80211_has_protected(hdr->frame_control))
1932 return; 1928 return;
@@ -1948,11 +1944,11 @@ static void ath10k_tx_h_update_wep_key(struct sk_buff *skb)
1948 ieee80211_queue_work(ar->hw, &arvif->wep_key_work); 1944 ieee80211_queue_work(ar->hw, &arvif->wep_key_work);
1949} 1945}
1950 1946
1951static void ath10k_tx_h_add_p2p_noa_ie(struct ath10k *ar, struct sk_buff *skb) 1947static void ath10k_tx_h_add_p2p_noa_ie(struct ath10k *ar,
1948 struct ieee80211_vif *vif,
1949 struct sk_buff *skb)
1952{ 1950{
1953 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 1951 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
1954 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1955 struct ieee80211_vif *vif = info->control.vif;
1956 struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif); 1952 struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
1957 1953
1958 /* This is case only for P2P_GO */ 1954 /* This is case only for P2P_GO */
@@ -2254,33 +2250,28 @@ static void ath10k_tx(struct ieee80211_hw *hw,
2254 struct ieee80211_tx_control *control, 2250 struct ieee80211_tx_control *control,
2255 struct sk_buff *skb) 2251 struct sk_buff *skb)
2256{ 2252{
2253 struct ath10k *ar = hw->priv;
2257 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 2254 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2255 struct ieee80211_vif *vif = info->control.vif;
2256 struct ieee80211_key_conf *key = info->control.hw_key;
2258 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 2257 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
2259 struct ath10k *ar = hw->priv;
2260 u8 tid, vdev_id;
2261 2258
2262 /* We should disable CCK RATE due to P2P */ 2259 /* We should disable CCK RATE due to P2P */
2263 if (info->flags & IEEE80211_TX_CTL_NO_CCK_RATE) 2260 if (info->flags & IEEE80211_TX_CTL_NO_CCK_RATE)
2264 ath10k_dbg(ATH10K_DBG_MAC, "IEEE80211_TX_CTL_NO_CCK_RATE\n"); 2261 ath10k_dbg(ATH10K_DBG_MAC, "IEEE80211_TX_CTL_NO_CCK_RATE\n");
2265 2262
2266 /* we must calculate tid before we apply qos workaround 2263 ATH10K_SKB_CB(skb)->htt.is_offchan = false;
2267 * as we'd lose the qos control field */ 2264 ATH10K_SKB_CB(skb)->htt.tid = ath10k_tx_h_get_tid(hdr);
2268 tid = ath10k_tx_h_get_tid(hdr); 2265 ATH10K_SKB_CB(skb)->vdev_id = ath10k_tx_h_get_vdev_id(ar, info);
2269 vdev_id = ath10k_tx_h_get_vdev_id(ar, info);
2270 2266
2271 /* it makes no sense to process injected frames like that */ 2267 /* it makes no sense to process injected frames like that */
2272 if (info->control.vif && 2268 if (vif && vif->type != NL80211_IFTYPE_MONITOR) {
2273 info->control.vif->type != NL80211_IFTYPE_MONITOR) { 2269 ath10k_tx_h_nwifi(hw, skb);
2274 ath10k_tx_h_qos_workaround(hw, control, skb); 2270 ath10k_tx_h_update_wep_key(vif, key, skb);
2275 ath10k_tx_h_update_wep_key(skb); 2271 ath10k_tx_h_add_p2p_noa_ie(ar, vif, skb);
2276 ath10k_tx_h_add_p2p_noa_ie(ar, skb); 2272 ath10k_tx_h_seq_no(vif, skb);
2277 ath10k_tx_h_seq_no(skb);
2278 } 2273 }
2279 2274
2280 ATH10K_SKB_CB(skb)->vdev_id = vdev_id;
2281 ATH10K_SKB_CB(skb)->htt.is_offchan = false;
2282 ATH10K_SKB_CB(skb)->htt.tid = tid;
2283
2284 if (info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) { 2275 if (info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) {
2285 spin_lock_bh(&ar->data_lock); 2276 spin_lock_bh(&ar->data_lock);
2286 ATH10K_SKB_CB(skb)->htt.is_offchan = true; 2277 ATH10K_SKB_CB(skb)->htt.is_offchan = true;
diff --git a/drivers/net/wireless/ath/ath10k/mac.h b/drivers/net/wireless/ath/ath10k/mac.h
index ba1021997b8f..ef4f84376d7c 100644
--- a/drivers/net/wireless/ath/ath10k/mac.h
+++ b/drivers/net/wireless/ath/ath10k/mac.h
@@ -43,11 +43,11 @@ static inline struct ath10k_vif *ath10k_vif_to_arvif(struct ieee80211_vif *vif)
43 return (struct ath10k_vif *)vif->drv_priv; 43 return (struct ath10k_vif *)vif->drv_priv;
44} 44}
45 45
46static inline void ath10k_tx_h_seq_no(struct sk_buff *skb) 46static inline void ath10k_tx_h_seq_no(struct ieee80211_vif *vif,
47 struct sk_buff *skb)
47{ 48{
48 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 49 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
49 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 50 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
50 struct ieee80211_vif *vif = info->control.vif;
51 struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif); 51 struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
52 52
53 if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { 53 if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 6f83cae57655..c2c87c916b5a 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1432,7 +1432,7 @@ static void ath10k_wmi_event_host_swba(struct ath10k *ar, struct sk_buff *skb)
1432 continue; 1432 continue;
1433 } 1433 }
1434 1434
1435 ath10k_tx_h_seq_no(bcn); 1435 ath10k_tx_h_seq_no(arvif->vif, bcn);
1436 ath10k_wmi_update_tim(ar, arvif, bcn, bcn_info); 1436 ath10k_wmi_update_tim(ar, arvif, bcn, bcn_info);
1437 ath10k_wmi_update_noa(ar, arvif, bcn, bcn_info); 1437 ath10k_wmi_update_noa(ar, arvif, bcn, bcn_info);
1438 1438