mac80211: improve ath9k AP A-MPDU PS buffering
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 530-mac80211_drv_tim_override.patch
1 --- a/include/net/mac80211.h
2 +++ b/include/net/mac80211.h
3 @@ -2209,6 +2209,18 @@ static inline int ieee80211_sta_ps_trans
4 #define IEEE80211_TX_STATUS_HEADROOM 13
5
6 /**
7 + * ieee80211_sta_set_tim - set the TIM bit for a sleeping station
8 + *
9 + * If a driver buffers frames for a powersave station instead of passing
10 + * them back to mac80211 for retransmission, the station needs to be told
11 + * to wake up using the TIM bitmap in the beacon.
12 + *
13 + * This function sets the station's TIM bit - it will be cleared when the
14 + * station wakes up.
15 + */
16 +void ieee80211_sta_set_tim(struct ieee80211_sta *sta);
17 +
18 +/**
19 * ieee80211_tx_status - transmit status callback
20 *
21 * Call this function for all transmitted frames after they have been
22 --- a/net/mac80211/sta_info.c
23 +++ b/net/mac80211/sta_info.c
24 @@ -608,7 +608,8 @@ static bool sta_info_cleanup_expire_buff
25 #endif
26 dev_kfree_skb(skb);
27
28 - if (skb_queue_empty(&sta->ps_tx_buf))
29 + if (skb_queue_empty(&sta->ps_tx_buf) &&
30 + !test_sta_flags(sta, WLAN_STA_PS_DRIVER_BUF))
31 sta_info_clear_tim_bit(sta);
32 }
33
34 @@ -899,6 +900,7 @@ void ieee80211_sta_ps_deliver_wakeup(str
35 struct ieee80211_local *local = sdata->local;
36 int sent, buffered;
37
38 + clear_sta_flags(sta, WLAN_STA_PS_DRIVER_BUF);
39 if (!(local->hw.flags & IEEE80211_HW_AP_LINK_PS))
40 drv_sta_notify(local, sdata, STA_NOTIFY_AWAKE, &sta->sta);
41
42 @@ -991,3 +993,12 @@ void ieee80211_sta_block_awake(struct ie
43 ieee80211_queue_work(hw, &sta->drv_unblock_wk);
44 }
45 EXPORT_SYMBOL(ieee80211_sta_block_awake);
46 +
47 +void ieee80211_sta_set_tim(struct ieee80211_sta *pubsta)
48 +{
49 + struct sta_info *sta = container_of(pubsta, struct sta_info, sta);
50 +
51 + set_sta_flags(sta, WLAN_STA_PS_DRIVER_BUF);
52 + sta_info_set_tim_bit(sta);
53 +}
54 +EXPORT_SYMBOL(ieee80211_sta_set_tim);
55 --- a/net/mac80211/sta_info.h
56 +++ b/net/mac80211/sta_info.h
57 @@ -43,6 +43,8 @@
58 * be in the queues
59 * @WLAN_STA_PSPOLL: Station sent PS-poll while driver was keeping
60 * station in power-save mode, reply when the driver unblocks.
61 + * @WLAN_STA_PS_DRIVER_BUF: Station has frames pending in driver internal
62 + * buffers. Automatically cleared on station wake-up.
63 */
64 enum ieee80211_sta_info_flags {
65 WLAN_STA_AUTH = 1<<0,
66 @@ -58,6 +60,7 @@ enum ieee80211_sta_info_flags {
67 WLAN_STA_BLOCK_BA = 1<<11,
68 WLAN_STA_PS_DRIVER = 1<<12,
69 WLAN_STA_PSPOLL = 1<<13,
70 + WLAN_STA_PS_DRIVER_BUF = 1<<14,
71 };
72
73 #define STA_TID_NUM 16