Commit 8a933964 authored by Michal Kazior's avatar Michal Kazior Committed by Kalle Valo

ath10k: remove txmode from skb_cb

It was wasteful to keep it in the struct because
it can be passed as function argument down the tx
path.
Signed-off-by: default avatarMichal Kazior <michal.kazior@tieto.com>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent 6a2636d8
...@@ -85,7 +85,6 @@ struct ath10k_skb_cb { ...@@ -85,7 +85,6 @@ struct ath10k_skb_cb {
dma_addr_t paddr; dma_addr_t paddr;
u8 eid; u8 eid;
u8 vdev_id; u8 vdev_id;
enum ath10k_hw_txrx_mode txmode;
struct { struct {
u8 tid; u8 tid;
......
...@@ -1602,7 +1602,9 @@ void __ath10k_htt_tx_dec_pending(struct ath10k_htt *htt, bool limit_mgmt_desc); ...@@ -1602,7 +1602,9 @@ void __ath10k_htt_tx_dec_pending(struct ath10k_htt *htt, bool limit_mgmt_desc);
int ath10k_htt_tx_alloc_msdu_id(struct ath10k_htt *htt, struct sk_buff *skb); int ath10k_htt_tx_alloc_msdu_id(struct ath10k_htt *htt, struct sk_buff *skb);
void ath10k_htt_tx_free_msdu_id(struct ath10k_htt *htt, u16 msdu_id); void ath10k_htt_tx_free_msdu_id(struct ath10k_htt *htt, u16 msdu_id);
int ath10k_htt_mgmt_tx(struct ath10k_htt *htt, struct sk_buff *); int ath10k_htt_mgmt_tx(struct ath10k_htt *htt, struct sk_buff *);
int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff *); int ath10k_htt_tx(struct ath10k_htt *htt,
enum ath10k_hw_txrx_mode txmode,
struct sk_buff *msdu);
void ath10k_htt_rx_pktlog_completion_handler(struct ath10k *ar, void ath10k_htt_rx_pktlog_completion_handler(struct ath10k *ar,
struct sk_buff *skb); struct sk_buff *skb);
......
...@@ -532,7 +532,8 @@ int ath10k_htt_mgmt_tx(struct ath10k_htt *htt, struct sk_buff *msdu) ...@@ -532,7 +532,8 @@ int ath10k_htt_mgmt_tx(struct ath10k_htt *htt, struct sk_buff *msdu)
return res; return res;
} }
int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff *msdu) int ath10k_htt_tx(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txmode,
struct sk_buff *msdu)
{ {
struct ath10k *ar = htt->ar; struct ath10k *ar = htt->ar;
struct device *dev = ar->dev; struct device *dev = ar->dev;
...@@ -584,7 +585,7 @@ int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff *msdu) ...@@ -584,7 +585,7 @@ int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff *msdu)
ieee80211_has_protected(hdr->frame_control)) { ieee80211_has_protected(hdr->frame_control)) {
skb_put(msdu, IEEE80211_CCMP_MIC_LEN); skb_put(msdu, IEEE80211_CCMP_MIC_LEN);
} else if (!skb_cb->htt.nohwcrypt && } else if (!skb_cb->htt.nohwcrypt &&
skb_cb->txmode == ATH10K_HW_TXRX_RAW && txmode == ATH10K_HW_TXRX_RAW &&
ieee80211_has_protected(hdr->frame_control)) { ieee80211_has_protected(hdr->frame_control)) {
skb_put(msdu, IEEE80211_CCMP_MIC_LEN); skb_put(msdu, IEEE80211_CCMP_MIC_LEN);
} }
...@@ -597,7 +598,7 @@ int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff *msdu) ...@@ -597,7 +598,7 @@ int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff *msdu)
goto err_free_msdu_id; goto err_free_msdu_id;
} }
switch (skb_cb->txmode) { switch (txmode) {
case ATH10K_HW_TXRX_RAW: case ATH10K_HW_TXRX_RAW:
case ATH10K_HW_TXRX_NATIVE_WIFI: case ATH10K_HW_TXRX_NATIVE_WIFI:
flags0 |= HTT_DATA_TX_DESC_FLAGS0_MAC_HDR_PRESENT; flags0 |= HTT_DATA_TX_DESC_FLAGS0_MAC_HDR_PRESENT;
...@@ -626,7 +627,7 @@ int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff *msdu) ...@@ -626,7 +627,7 @@ int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff *msdu)
frags_paddr = skb_cb->htt.txbuf_paddr; frags_paddr = skb_cb->htt.txbuf_paddr;
} }
flags0 |= SM(skb_cb->txmode, HTT_DATA_TX_DESC_FLAGS0_PKT_TYPE); flags0 |= SM(txmode, HTT_DATA_TX_DESC_FLAGS0_PKT_TYPE);
break; break;
case ATH10K_HW_TXRX_MGMT: case ATH10K_HW_TXRX_MGMT:
flags0 |= SM(ATH10K_HW_TXRX_MGMT, flags0 |= SM(ATH10K_HW_TXRX_MGMT,
......
...@@ -3335,24 +3335,24 @@ static int ath10k_mac_tx_wmi_mgmt(struct ath10k *ar, struct sk_buff *skb) ...@@ -3335,24 +3335,24 @@ static int ath10k_mac_tx_wmi_mgmt(struct ath10k *ar, struct sk_buff *skb)
return ret; return ret;
} }
static void ath10k_mac_tx(struct ath10k *ar, struct sk_buff *skb) static void ath10k_mac_tx(struct ath10k *ar, enum ath10k_hw_txrx_mode txmode,
struct sk_buff *skb)
{ {
struct ath10k_skb_cb *cb = ATH10K_SKB_CB(skb);
struct ath10k_htt *htt = &ar->htt; struct ath10k_htt *htt = &ar->htt;
int ret = 0; int ret = 0;
switch (cb->txmode) { switch (txmode) {
case ATH10K_HW_TXRX_RAW: case ATH10K_HW_TXRX_RAW:
case ATH10K_HW_TXRX_NATIVE_WIFI: case ATH10K_HW_TXRX_NATIVE_WIFI:
case ATH10K_HW_TXRX_ETHERNET: case ATH10K_HW_TXRX_ETHERNET:
ret = ath10k_htt_tx(htt, skb); ret = ath10k_htt_tx(htt, txmode, skb);
break; break;
case ATH10K_HW_TXRX_MGMT: case ATH10K_HW_TXRX_MGMT:
if (test_bit(ATH10K_FW_FEATURE_HAS_WMI_MGMT_TX, if (test_bit(ATH10K_FW_FEATURE_HAS_WMI_MGMT_TX,
ar->fw_features)) ar->fw_features))
ret = ath10k_mac_tx_wmi_mgmt(ar, skb); ret = ath10k_mac_tx_wmi_mgmt(ar, skb);
else if (ar->htt.target_version_major >= 3) else if (ar->htt.target_version_major >= 3)
ret = ath10k_htt_tx(htt, skb); ret = ath10k_htt_tx(htt, txmode, skb);
else else
ret = ath10k_htt_mgmt_tx(htt, skb); ret = ath10k_htt_mgmt_tx(htt, skb);
break; break;
...@@ -3382,9 +3382,13 @@ void ath10k_offchan_tx_work(struct work_struct *work) ...@@ -3382,9 +3382,13 @@ void ath10k_offchan_tx_work(struct work_struct *work)
{ {
struct ath10k *ar = container_of(work, struct ath10k, offchan_tx_work); struct ath10k *ar = container_of(work, struct ath10k, offchan_tx_work);
struct ath10k_peer *peer; struct ath10k_peer *peer;
struct ath10k_vif *arvif;
struct ieee80211_hdr *hdr; struct ieee80211_hdr *hdr;
struct ieee80211_vif *vif;
struct ieee80211_sta *sta;
struct sk_buff *skb; struct sk_buff *skb;
const u8 *peer_addr; const u8 *peer_addr;
enum ath10k_hw_txrx_mode txmode;
int vdev_id; int vdev_id;
int ret; int ret;
unsigned long time_left; unsigned long time_left;
...@@ -3434,7 +3438,22 @@ void ath10k_offchan_tx_work(struct work_struct *work) ...@@ -3434,7 +3438,22 @@ void ath10k_offchan_tx_work(struct work_struct *work)
ar->offchan_tx_skb = skb; ar->offchan_tx_skb = skb;
spin_unlock_bh(&ar->data_lock); spin_unlock_bh(&ar->data_lock);
ath10k_mac_tx(ar, skb); /* It's safe to access vif and sta - conf_mutex guarantees that
* sta_state() and remove_interface() are locked exclusively
* out wrt to this offchannel worker.
*/
arvif = ath10k_get_arvif(ar, vdev_id);
if (arvif) {
vif = arvif->vif;
sta = ieee80211_find_sta(vif, peer_addr);
} else {
vif = NULL;
sta = NULL;
}
txmode = ath10k_mac_tx_h_get_txmode(ar, vif, sta, skb);
ath10k_mac_tx(ar, txmode, skb);
time_left = time_left =
wait_for_completion_timeout(&ar->offchan_tx_completed, 3 * HZ); wait_for_completion_timeout(&ar->offchan_tx_completed, 3 * HZ);
...@@ -3656,20 +3675,21 @@ static void ath10k_tx(struct ieee80211_hw *hw, ...@@ -3656,20 +3675,21 @@ static void ath10k_tx(struct ieee80211_hw *hw,
struct ieee80211_vif *vif = info->control.vif; struct ieee80211_vif *vif = info->control.vif;
struct ieee80211_sta *sta = control->sta; struct ieee80211_sta *sta = control->sta;
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
enum ath10k_hw_txrx_mode txmode;
/* We should disable CCK RATE due to P2P */ /* We should disable CCK RATE due to P2P */
if (info->flags & IEEE80211_TX_CTL_NO_CCK_RATE) if (info->flags & IEEE80211_TX_CTL_NO_CCK_RATE)
ath10k_dbg(ar, ATH10K_DBG_MAC, "IEEE80211_TX_CTL_NO_CCK_RATE\n"); ath10k_dbg(ar, ATH10K_DBG_MAC, "IEEE80211_TX_CTL_NO_CCK_RATE\n");
txmode = ath10k_mac_tx_h_get_txmode(ar, vif, sta, skb);
ATH10K_SKB_CB(skb)->htt.is_offchan = false; ATH10K_SKB_CB(skb)->htt.is_offchan = false;
ATH10K_SKB_CB(skb)->htt.freq = 0; ATH10K_SKB_CB(skb)->htt.freq = 0;
ATH10K_SKB_CB(skb)->htt.tid = ath10k_tx_h_get_tid(hdr); ATH10K_SKB_CB(skb)->htt.tid = ath10k_tx_h_get_tid(hdr);
ATH10K_SKB_CB(skb)->htt.nohwcrypt = !ath10k_tx_h_use_hwcrypto(vif, skb); ATH10K_SKB_CB(skb)->htt.nohwcrypt = !ath10k_tx_h_use_hwcrypto(vif, skb);
ATH10K_SKB_CB(skb)->vdev_id = ath10k_tx_h_get_vdev_id(ar, vif); ATH10K_SKB_CB(skb)->vdev_id = ath10k_tx_h_get_vdev_id(ar, vif);
ATH10K_SKB_CB(skb)->txmode = ath10k_mac_tx_h_get_txmode(ar, vif, sta,
skb);
switch (ATH10K_SKB_CB(skb)->txmode) { switch (txmode) {
case ATH10K_HW_TXRX_MGMT: case ATH10K_HW_TXRX_MGMT:
case ATH10K_HW_TXRX_NATIVE_WIFI: case ATH10K_HW_TXRX_NATIVE_WIFI:
ath10k_tx_h_nwifi(hw, skb); ath10k_tx_h_nwifi(hw, skb);
...@@ -3706,7 +3726,7 @@ static void ath10k_tx(struct ieee80211_hw *hw, ...@@ -3706,7 +3726,7 @@ static void ath10k_tx(struct ieee80211_hw *hw,
} }
} }
ath10k_mac_tx(ar, skb); ath10k_mac_tx(ar, txmode, skb);
} }
/* Must not be called with conf_mutex held as workers can use that also. */ /* Must not be called with conf_mutex held as workers can use that also. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment