aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2010-11-24 02:10:06 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-11-24 16:19:36 -0500
commit99ba2a14283be96a682e04455061c08a46bbf4ec (patch)
tree120520c075528d7ef5a32bb8782c82b7c7e972eb
parentc063dbf52b998b852122dff07a8b8dd430b38437 (diff)
mac80211: implement packet loss notification
For drivers that have accurate TX status reporting we can report the number of consecutive lost packets to userspace using the new cfg80211 CQM event. The threshold is fixed right now, this may need to be improved in the future. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--net/mac80211/sta_info.h3
-rw-r--r--net/mac80211/status.c22
2 files changed, 25 insertions, 0 deletions
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 9265acadef32..b562d9b6a702 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -248,6 +248,7 @@ enum plink_state {
248 * @sta: station information we share with the driver 248 * @sta: station information we share with the driver
249 * @dead: set to true when sta is unlinked 249 * @dead: set to true when sta is unlinked
250 * @uploaded: set to true when sta is uploaded to the driver 250 * @uploaded: set to true when sta is uploaded to the driver
251 * @lost_packets: number of consecutive lost packets
251 */ 252 */
252struct sta_info { 253struct sta_info {
253 /* General information, mostly static */ 254 /* General information, mostly static */
@@ -335,6 +336,8 @@ struct sta_info {
335 } debugfs; 336 } debugfs;
336#endif 337#endif
337 338
339 unsigned int lost_packets;
340
338 /* keep last! */ 341 /* keep last! */
339 struct ieee80211_sta sta; 342 struct ieee80211_sta sta;
340}; 343};
diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index 8695cd11dfd9..bed7e32ed908 100644
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -161,6 +161,15 @@ static void ieee80211_frame_acked(struct sta_info *sta, struct sk_buff *skb)
161 ieee80211_sta_tx_notify(sdata, (void *) skb->data); 161 ieee80211_sta_tx_notify(sdata, (void *) skb->data);
162} 162}
163 163
164/*
165 * Use a static threshold for now, best value to be determined
166 * by testing ...
167 * Should it depend on:
168 * - on # of retransmissions
169 * - current throughput (higher value for higher tpt)?
170 */
171#define STA_LOST_PKT_THRESHOLD 50
172
164void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) 173void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
165{ 174{
166 struct sk_buff *skb2; 175 struct sk_buff *skb2;
@@ -247,6 +256,19 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
247 if (!(info->flags & IEEE80211_TX_CTL_INJECTED) && 256 if (!(info->flags & IEEE80211_TX_CTL_INJECTED) &&
248 (info->flags & IEEE80211_TX_STAT_ACK)) 257 (info->flags & IEEE80211_TX_STAT_ACK))
249 ieee80211_frame_acked(sta, skb); 258 ieee80211_frame_acked(sta, skb);
259
260 if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) {
261 if (info->flags & IEEE80211_TX_STAT_ACK) {
262 if (sta->lost_packets)
263 sta->lost_packets = 0;
264 } else if (++sta->lost_packets >= STA_LOST_PKT_THRESHOLD) {
265 cfg80211_cqm_pktloss_notify(sta->sdata->dev,
266 sta->sta.addr,
267 sta->lost_packets,
268 GFP_ATOMIC);
269 sta->lost_packets = 0;
270 }
271 }
250 } 272 }
251 273
252 rcu_read_unlock(); 274 rcu_read_unlock();