diff options
| -rw-r--r-- | CORE/HDD/inc/wlan_hdd_wext.h | 2 | ||||
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_wext.c | 41 |
2 files changed, 40 insertions, 3 deletions
diff --git a/CORE/HDD/inc/wlan_hdd_wext.h b/CORE/HDD/inc/wlan_hdd_wext.h index 0dd4beaf2eb4..dd28d68d4817 100644 --- a/CORE/HDD/inc/wlan_hdd_wext.h +++ b/CORE/HDD/inc/wlan_hdd_wext.h @@ -340,6 +340,8 @@ typedef struct hdd_wext_state_s v_BOOL_t isESEConnection; eCsrAuthType collectedAuthType; /* Collected from ALL SIOCSIWAUTH Ioctls. Will be negotiatedAuthType - in tCsrProfile */ #endif + /* Wireless statistics */ + struct iw_statistics iw_stats; }hdd_wext_state_t; typedef struct ccp_freq_chan_map_s{ diff --git a/CORE/HDD/src/wlan_hdd_wext.c b/CORE/HDD/src/wlan_hdd_wext.c index 0c90f022645b..b46485547043 100644 --- a/CORE/HDD/src/wlan_hdd_wext.c +++ b/CORE/HDD/src/wlan_hdd_wext.c @@ -4630,12 +4630,48 @@ static int iw_get_nick(struct net_device *dev, * __get_wireless_stats() - get wireless stats * @dev: pointer to net_device * - * Return: %NULL + * Return: pointer to iw_statistics on success, NULL otherwise */ static struct iw_statistics *__get_wireless_stats(struct net_device *dev) { + hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); + hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); + hdd_wext_state_t *wext_state = WLAN_HDD_GET_WEXT_STATE_PTR(adapter); + hdd_station_ctx_t *hdd_sta_ctx; + v_S7_t snr = 0, rssi = 0; + int status; + ENTER(); - return NULL; + + status = wlan_hdd_validate_context(hdd_ctx); + if (0 != status) + return NULL; + + hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); + if (eConnectionState_Associated != hdd_sta_ctx->conn_info.connState) { + hddLog(VOS_TRACE_LEVEL_INFO, + FL("not in associated state: %d"), + hdd_sta_ctx->conn_info.connState); + return NULL; + } + + wlan_hdd_get_station_stats(adapter); + wlan_hdd_get_snr(adapter, &snr); + wlan_hdd_get_rssi(adapter, &rssi); + + vos_mem_zero(&wext_state->iw_stats, sizeof(wext_state->iw_stats)); + wext_state->iw_stats.status = 0; + wext_state->iw_stats.qual.qual = snr; + wext_state->iw_stats.qual.level = rssi; + wext_state->iw_stats.qual.noise = rssi - snr; + wext_state->iw_stats.discard.code = 0; + wext_state->iw_stats.discard.retries = 0; + wext_state->iw_stats.miss.beacon = 0; + wext_state->iw_stats.qual.updated = + IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; + + EXIT(); + return &(wext_state->iw_stats); } /** @@ -4656,7 +4692,6 @@ static struct iw_statistics *get_wireless_stats(struct net_device *dev) return iw_stats; } - /** * __iw_set_encode() - SIOCSIWENCODE ioctl handler * @dev: device upon which the ioctl was received |
