Skip to content

Commit 5a5c731

Browse files
greearblinvjw
authored andcommitted
wireless: Set some stats used by /proc/net/wireless (wext)
Some stats for /proc/net/wireless (and wext in general) are not being set. This patch addresses a few of those with values easily obtained from mac80211 core. Signed-off-by: Ben Greear <greearb@candelatech.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent b38afa8 commit 5a5c731

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

‎include/net/cfg80211.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ struct station_parameters {
403403
* @STATION_INFO_TX_PACKETS: @tx_packets filled
404404
* @STATION_INFO_TX_RETRIES: @tx_retries filled
405405
* @STATION_INFO_TX_FAILED: @tx_failed filled
406+
* @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled
406407
*/
407408
enum station_info_flags {
408409
STATION_INFO_INACTIVE_TIME = 1<<0,
@@ -417,6 +418,7 @@ enum station_info_flags {
417418
STATION_INFO_TX_PACKETS = 1<<9,
418419
STATION_INFO_TX_RETRIES = 1<<10,
419420
STATION_INFO_TX_FAILED = 1<<11,
421+
STATION_INFO_RX_DROP_MISC = 1<<12,
420422
};
421423

422424
/**
@@ -468,6 +470,7 @@ struct rate_info {
468470
* @tx_packets: packets transmitted to this station
469471
* @tx_retries: cumulative retry counts
470472
* @tx_failed: number of failed transmissions (retries exceeded, no ACK)
473+
* @rx_dropped_misc: Dropped for un-specified reason.
471474
* @generation: generation number for nl80211 dumps.
472475
* This number should increase every time the list of stations
473476
* changes, i.e. when a station is added or removed, so that
@@ -487,6 +490,7 @@ struct station_info {
487490
u32 tx_packets;
488491
u32 tx_retries;
489492
u32 tx_failed;
493+
u32 rx_dropped_misc;
490494

491495
int generation;
492496
};

‎net/mac80211/cfg.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,8 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
329329
STATION_INFO_TX_PACKETS |
330330
STATION_INFO_TX_RETRIES |
331331
STATION_INFO_TX_FAILED |
332-
STATION_INFO_TX_BITRATE;
332+
STATION_INFO_TX_BITRATE |
333+
STATION_INFO_RX_DROP_MISC;
333334

334335
sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx);
335336
sinfo->rx_bytes = sta->rx_bytes;
@@ -338,6 +339,7 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
338339
sinfo->tx_packets = sta->tx_packets;
339340
sinfo->tx_retries = sta->tx_retry_count;
340341
sinfo->tx_failed = sta->tx_retry_failed;
342+
sinfo->rx_dropped_misc = sta->rx_dropped;
341343

342344
if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) ||
343345
(sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) {

‎net/wireless/wext-compat.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,6 +1366,10 @@ struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev)
13661366
}
13671367

13681368
wstats.qual.updated |= IW_QUAL_NOISE_INVALID;
1369+
if (sinfo.filled & STATION_INFO_RX_DROP_MISC)
1370+
wstats.discard.misc = sinfo.rx_dropped_misc;
1371+
if (sinfo.filled & STATION_INFO_TX_FAILED)
1372+
wstats.discard.retries = sinfo.tx_failed;
13691373

13701374
return &wstats;
13711375
}

0 commit comments

Comments
 (0)