Skip to contentSkip to conversation

mac80211: Add a debug entry to track last beacon

RFC In review Mohammed Shafi Shajakhan 1 participant 3 messages Aug 21, 2011 – Aug 22, 2011 mac80211

lore
Share & tools
lore
#0 lore raw

RFC 1/1 mac80211: Add a debug entry to track last beacon

From: Mohammed Shafi Shajakhan <[email protected]>

when we obtain time_since_last_beacon_ms parameter from the mac80211 debugfs it should be always less than 100, otherwise we are missing beacons.

---
 net/mac80211/debugfs_netdev.c |   14 ++++++++++++++
 net/mac80211/ieee80211_i.h    |    3 +++
 net/mac80211/mlme.c           |    2 ++
 3 files changed, 19 insertions(+), 0 deletions(-)
net/mac80211/debugfs_netdev.c +14 -0
index 9ea7c0d..18e1bfc 100644
@@ -157,6 +157,19 @@ IEEE80211_IF_FILE(aid, u.mgd.aid, DEC);
 IEEE80211_IF_FILE(last_beacon, u.mgd.last_beacon_signal, DEC);
 IEEE80211_IF_FILE(ave_beacon, u.mgd.ave_beacon_signal, DEC_DIV_16);
 
+static ssize_t ieee80211_if_fmt_time_since_last_beacon_ms(
+	const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)
+{
+	const struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
+	unsigned long time_since_last_beacon;
+
+	time_since_last_beacon = jiffies_to_msecs(jiffies -
+						  ifmgd->last_beacon_timestamp);
+	return scnprintf(buf, buflen, "%lu\n",
+			 time_since_last_beacon);
+}
+__IEEE80211_IF_FILE(time_since_last_beacon_ms, NULL);
+
 static int ieee80211_set_smps(struct ieee80211_sub_if_data *sdata,
 			      enum ieee80211_smps_mode smps_mode)
 {
@@ -394,6 +407,7 @@ static void add_sta_files(struct ieee80211_sub_if_data *sdata)
 
 	DEBUGFS_ADD(bssid);
 	DEBUGFS_ADD(aid);
+	DEBUGFS_ADD(time_since_last_beacon_ms);
 	DEBUGFS_ADD(last_beacon);
 	DEBUGFS_ADD(ave_beacon);
 	DEBUGFS_ADD_MODE(smps, 0600);
net/mac80211/ieee80211_i.h +3 -0
index ea74190..ec532a5 100644
@@ -410,6 +410,9 @@ struct ieee80211_if_managed {
 
 	u8 use_4addr;
 
+	/* timestamp of the last Beacon frame in the current BSS. */
+	unsigned long last_beacon_timestamp;
+
 	/* Signal strength from the last Beacon frame in the current BSS. */
 	int last_beacon_signal;
 
net/mac80211/mlme.c +2 -0
index d6470c7..13ee1b6 100644
@@ -1758,6 +1758,8 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
 	if (memcmp(bssid, mgmt->bssid, ETH_ALEN) != 0)
 		return;
 
+	ifmgd->last_beacon_timestamp = jiffies;
+
 	/* Track average RSSI from the Beacon frames of the current AP */
 	ifmgd->last_beacon_signal = rx_status->signal;
 	if (ifmgd->flags & IEEE80211_STA_RESET_SIGNAL_AVE) {
Signature · 1 line
1.7.0.4
author
#1 lore raw
Quoted 5 lines · Mohammed Shafi Shajakhan

From: Mohammed Shafi Shajakhan<[email protected]>

when we obtain time_since_last_beacon_ms parameter from the mac80211 debugfs it should be always less than 100, otherwise we are missing beacons.

made a mistake in the commit-log
'time_since_last_beacon_ms' should be always less than the configured beacon interval in the AP, otherwise we are missing beacons

Quoted 67 lines
---
  net/mac80211/debugfs_netdev.c |   14 ++++++++++++++
  net/mac80211/ieee80211_i.h    |    3 +++
  net/mac80211/mlme.c           |    2 ++
  3 files changed, 19 insertions(+), 0 deletions(-)
net/mac80211/debugfs_netdev.c +14 -0
index 9ea7c0d..18e1bfc 100644
@@ -157,6 +157,19 @@ IEEE80211_IF_FILE(aid, u.mgd.aid, DEC);
  IEEE80211_IF_FILE(last_beacon, u.mgd.last_beacon_signal, DEC);
  IEEE80211_IF_FILE(ave_beacon, u.mgd.ave_beacon_signal, DEC_DIV_16);
 
+static ssize_t ieee80211_if_fmt_time_since_last_beacon_ms(
+	const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)
+{
+	const struct ieee80211_if_managed *ifmgd =&sdata->u.mgd;
+	unsigned long time_since_last_beacon;
+
+	time_since_last_beacon = jiffies_to_msecs(jiffies -
+						  ifmgd->last_beacon_timestamp);
+	return scnprintf(buf, buflen, "%lu\n",
+			 time_since_last_beacon);
+}
+__IEEE80211_IF_FILE(time_since_last_beacon_ms, NULL);
+
  static int ieee80211_set_smps(struct ieee80211_sub_if_data *sdata,
  			      enum ieee80211_smps_mode smps_mode)
  {
@@ -394,6 +407,7 @@ static void add_sta_files(struct ieee80211_sub_if_data *sdata)
 
  	DEBUGFS_ADD(bssid);
  	DEBUGFS_ADD(aid);
+	DEBUGFS_ADD(time_since_last_beacon_ms);
  	DEBUGFS_ADD(last_beacon);
  	DEBUGFS_ADD(ave_beacon);
  	DEBUGFS_ADD_MODE(smps, 0600);
net/mac80211/ieee80211_i.h +3 -0
index ea74190..ec532a5 100644
@@ -410,6 +410,9 @@ struct ieee80211_if_managed {
 
  	u8 use_4addr;
 
+	/* timestamp of the last Beacon frame in the current BSS. */
+	unsigned long last_beacon_timestamp;
+
  	/* Signal strength from the last Beacon frame in the current BSS. */
  	int last_beacon_signal;
 
net/mac80211/mlme.c +2 -0
index d6470c7..13ee1b6 100644
@@ -1758,6 +1758,8 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
  	if (memcmp(bssid, mgmt->bssid, ETH_ALEN) != 0)
  		return;
 
+	ifmgd->last_beacon_timestamp = jiffies;
+
  	/* Track average RSSI from the Beacon frames of the current AP */
  	ifmgd->last_beacon_signal = rx_status->signal;
  	if (ifmgd->flags&  IEEE80211_STA_RESET_SIGNAL_AVE) {
author
#2 lore raw
Quoted 10 lines · mohammed
Quoted 5 lines · Mohammed Shafi Shajakhan

From: Mohammed Shafi Shajakhan<[email protected]>

when we obtain time_since_last_beacon_ms parameter from the mac80211 debugfs it should be always less than 100, otherwise we are missing beacons.

made a mistake in the commit-log 'time_since_last_beacon_ms' should be always less than the configured beacon interval in the AP, otherwise we are missing beacons

also the case of station not getting associated should be taken care. will sending a proper patch addressing the above two. thanks!

Quoted 4 lines
Quoted 3 lines