From: Johannes Berg <johannes@sipsolutions.net>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org, Johannes Berg <johannes.berg@intel.com>
Subject: [PATCH 2/2] mac80211: implement packet loss notification
Date: Wed, 24 Nov 2010 08:10:06 +0100 [thread overview]
Message-ID: <20101124071042.955398599@sipsolutions.net> (raw)
In-Reply-To: 20101124071004.597318320@sipsolutions.net
From: Johannes Berg <johannes.berg@intel.com>
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>
---
v2: don't send event on every packet
net/mac80211/sta_info.h | 3 +++
net/mac80211/status.c | 22 ++++++++++++++++++++++
2 files changed, 25 insertions(+)
--- wireless-testing.orig/net/mac80211/sta_info.h 2010-11-23 10:36:12.000000000 +0100
+++ wireless-testing/net/mac80211/sta_info.h 2010-11-24 08:09:23.000000000 +0100
@@ -250,6 +250,7 @@ enum plink_state {
* @sta: station information we share with the driver
* @dead: set to true when sta is unlinked
* @uploaded: set to true when sta is uploaded to the driver
+ * @lost_packets: number of consecutive lost packets
*/
struct sta_info {
/* General information, mostly static */
@@ -338,6 +339,8 @@ struct sta_info {
} debugfs;
#endif
+ unsigned int lost_packets;
+
/* keep last! */
struct ieee80211_sta sta;
};
--- wireless-testing.orig/net/mac80211/status.c 2010-11-23 10:36:12.000000000 +0100
+++ wireless-testing/net/mac80211/status.c 2010-11-24 08:09:23.000000000 +0100
@@ -157,6 +157,15 @@ static void ieee80211_frame_acked(struct
}
}
+/*
+ * Use a static threshold for now, best value to be determined
+ * by testing ...
+ * Should it depend on:
+ * - on # of retransmissions
+ * - current throughput (higher value for higher tpt)?
+ */
+#define STA_LOST_PKT_THRESHOLD 50
+
void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
{
struct sk_buff *skb2;
@@ -243,6 +252,19 @@ void ieee80211_tx_status(struct ieee8021
if (!(info->flags & IEEE80211_TX_CTL_INJECTED) &&
(info->flags & IEEE80211_TX_STAT_ACK))
ieee80211_frame_acked(sta, skb);
+
+ if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) {
+ if (info->flags & IEEE80211_TX_STAT_ACK) {
+ if (sta->lost_packets)
+ sta->lost_packets = 0;
+ } else if (++sta->lost_packets >= STA_LOST_PKT_THRESHOLD) {
+ cfg80211_cqm_pktloss_notify(sta->sdata->dev,
+ sta->sta.addr,
+ sta->lost_packets,
+ GFP_ATOMIC);
+ sta->lost_packets = 0;
+ }
+ }
}
rcu_read_unlock();
prev parent reply other threads:[~2010-11-24 7:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-24 7:10 [PATCH 0/2] station packet loss notification Johannes Berg
2010-11-24 7:10 ` [PATCH 1/2] cfg80211: allow using CQM event to notify packet loss Johannes Berg
2010-11-24 7:10 ` Johannes Berg [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101124071042.955398599@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=johannes.berg@intel.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).