ath10k: pack up flags in skb_cb

It was wasteful to have all the flags as separate
bools.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
This commit is contained in:
Michal Kazior 2015-11-18 06:59:20 +01:00 committed by Kalle Valo
parent bd87744028
commit 66b8a0108d
4 changed files with 24 additions and 15 deletions

View File

@ -81,22 +81,23 @@ static inline const char *ath10k_bus_str(enum ath10k_bus bus)
return "unknown"; return "unknown";
} }
enum ath10k_skb_flags {
ATH10K_SKB_F_NO_HWCRYPT = BIT(0),
ATH10K_SKB_F_DTIM_ZERO = BIT(1),
ATH10K_SKB_F_DELIVER_CAB = BIT(2),
};
struct ath10k_skb_cb { struct ath10k_skb_cb {
dma_addr_t paddr; dma_addr_t paddr;
u8 flags;
u8 eid; u8 eid;
u8 vdev_id; u8 vdev_id;
struct { struct {
u8 tid; u8 tid;
bool nohwcrypt;
struct ath10k_htt_txbuf *txbuf; struct ath10k_htt_txbuf *txbuf;
u32 txbuf_paddr; u32 txbuf_paddr;
} __packed htt; } __packed htt;
struct {
bool dtim_zero;
bool deliver_cab;
} bcn;
} __packed; } __packed;
struct ath10k_skb_rxcb { struct ath10k_skb_rxcb {

View File

@ -586,7 +586,7 @@ int ath10k_htt_tx(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txmode,
ieee80211_is_disassoc(hdr->frame_control)) && ieee80211_is_disassoc(hdr->frame_control)) &&
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->flags & ATH10K_SKB_F_NO_HWCRYPT) &&
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);
@ -666,7 +666,7 @@ int ath10k_htt_tx(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txmode,
prefetch_len); prefetch_len);
skb_cb->htt.txbuf->htc_hdr.flags = 0; skb_cb->htt.txbuf->htc_hdr.flags = 0;
if (skb_cb->htt.nohwcrypt) if (skb_cb->flags & ATH10K_SKB_F_NO_HWCRYPT)
flags0 |= HTT_DATA_TX_DESC_FLAGS0_NO_ENCRYPT; flags0 |= HTT_DATA_TX_DESC_FLAGS0_NO_ENCRYPT;
flags1 |= SM((u16)vdev_id, HTT_DATA_TX_DESC_FLAGS1_VDEV_ID); flags1 |= SM((u16)vdev_id, HTT_DATA_TX_DESC_FLAGS1_VDEV_ID);

View File

@ -3672,6 +3672,7 @@ static void ath10k_tx(struct ieee80211_hw *hw,
struct sk_buff *skb) struct sk_buff *skb)
{ {
struct ath10k *ar = hw->priv; struct ath10k *ar = hw->priv;
struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb);
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
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;
@ -3684,9 +3685,12 @@ static void ath10k_tx(struct ieee80211_hw *hw,
txmode = ath10k_mac_tx_h_get_txmode(ar, vif, sta, skb); txmode = ath10k_mac_tx_h_get_txmode(ar, vif, sta, skb);
ATH10K_SKB_CB(skb)->htt.tid = ath10k_tx_h_get_tid(hdr); skb_cb->flags = 0;
ATH10K_SKB_CB(skb)->htt.nohwcrypt = !ath10k_tx_h_use_hwcrypto(vif, skb); if (!ath10k_tx_h_use_hwcrypto(vif, skb))
ATH10K_SKB_CB(skb)->vdev_id = ath10k_tx_h_get_vdev_id(ar, vif); skb_cb->flags |= ATH10K_SKB_F_NO_HWCRYPT;
skb_cb->htt.tid = ath10k_tx_h_get_tid(hdr);
skb_cb->vdev_id = ath10k_tx_h_get_vdev_id(ar, vif);
switch (txmode) { switch (txmode) {
case ATH10K_HW_TXRX_MGMT: case ATH10K_HW_TXRX_MGMT:

View File

@ -1715,6 +1715,8 @@ static void ath10k_wmi_tx_beacon_nowait(struct ath10k_vif *arvif)
struct ath10k *ar = arvif->ar; struct ath10k *ar = arvif->ar;
struct ath10k_skb_cb *cb; struct ath10k_skb_cb *cb;
struct sk_buff *bcn; struct sk_buff *bcn;
bool dtim_zero;
bool deliver_cab;
int ret; int ret;
spin_lock_bh(&ar->data_lock); spin_lock_bh(&ar->data_lock);
@ -1734,12 +1736,14 @@ static void ath10k_wmi_tx_beacon_nowait(struct ath10k_vif *arvif)
arvif->beacon_state = ATH10K_BEACON_SENDING; arvif->beacon_state = ATH10K_BEACON_SENDING;
spin_unlock_bh(&ar->data_lock); spin_unlock_bh(&ar->data_lock);
dtim_zero = !!(cb->flags & ATH10K_SKB_F_DTIM_ZERO);
deliver_cab = !!(cb->flags & ATH10K_SKB_F_DELIVER_CAB);
ret = ath10k_wmi_beacon_send_ref_nowait(arvif->ar, ret = ath10k_wmi_beacon_send_ref_nowait(arvif->ar,
arvif->vdev_id, arvif->vdev_id,
bcn->data, bcn->len, bcn->data, bcn->len,
cb->paddr, cb->paddr,
cb->bcn.dtim_zero, dtim_zero,
cb->bcn.deliver_cab); deliver_cab);
spin_lock_bh(&ar->data_lock); spin_lock_bh(&ar->data_lock);
@ -3157,10 +3161,10 @@ static void ath10k_wmi_update_tim(struct ath10k *ar,
memcpy(tim->virtual_map, arvif->u.ap.tim_bitmap, pvm_len); memcpy(tim->virtual_map, arvif->u.ap.tim_bitmap, pvm_len);
if (tim->dtim_count == 0) { if (tim->dtim_count == 0) {
ATH10K_SKB_CB(bcn)->bcn.dtim_zero = true; ATH10K_SKB_CB(bcn)->flags |= ATH10K_SKB_F_DTIM_ZERO;
if (__le32_to_cpu(tim_info->tim_mcast) == 1) if (__le32_to_cpu(tim_info->tim_mcast) == 1)
ATH10K_SKB_CB(bcn)->bcn.deliver_cab = true; ATH10K_SKB_CB(bcn)->flags |= ATH10K_SKB_F_DELIVER_CAB;
} }
ath10k_dbg(ar, ATH10K_DBG_MGMT, "dtim %d/%d mcast %d pvmlen %d\n", ath10k_dbg(ar, ATH10K_DBG_MGMT, "dtim %d/%d mcast %d pvmlen %d\n",