More iw link output

This commit is contained in:
kimocoder 2018-07-24 20:32:19 +02:00
parent d6fe5161fd
commit d6e2f9c1be

View File

@ -22,10 +22,24 @@
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0))
#define STATION_INFO_SIGNAL BIT(NL80211_STA_INFO_SIGNAL)
#define STATION_INFO_TX_BITRATE BIT(NL80211_STA_INFO_TX_BITRATE)
#define STATION_INFO_TX_BITRATE_BW_5 BIT(RATE_INFO_BW_5)
#define STATION_INFO_TX_BITRATE_BW_10 BIT(RATE_INFO_BW_10)
#define STATION_INFO_TX_BITRATE_BW_20 BIT(RATE_INFO_BW_20)
#define STATION_INFO_TX_BITRATE_BW_40 BIT(RATE_INFO_BW_40)
#define STATION_INFO_TX_BITRATE_BW_80 BIT(RATE_INFO_BW_80)
#define STATION_INFO_TX_BITRATE_BW_160 BIT(RATE_INFO_BW_160)
#define STATION_INFO_RX_PACKETS BIT(NL80211_STA_INFO_RX_PACKETS)
#define STATION_INFO_TX_PACKETS BIT(NL80211_STA_INFO_TX_PACKETS)
#define STATION_INFO_TX_FAILED BIT(NL80211_STA_INFO_TX_FAILED)
#define STATION_INFO_RX_BYTES BIT(NL80211_STA_INFO_RX_BYTES)
#define STATION_INFO_TX_BYTES BIT(NL80211_STA_INFO_TX_BYTES)
#define STATION_INFO_ASSOC_REQ_IES 0
#define STATION_INFO_BSS_PARAM BIT(NL80211_STA_INFO_BSS_PARAM)
#define STATION_INFO_BSS_PARAM_CTS_PROT BIT(NL80211_STA_BSS_PARAM_CTS_PROT)
#define STATION_INFO_BSS_PARAM_SHORT_PREAMBLE BIT(NL80211_STA_BSS_PARAM_SHORT_PREAMBLE)
#define STATION_INFO_BSS_PARAM_SHORT_SLOT_TIME BIT(NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME)
#define STATION_INFO_BSS_PARAM_DTIM_PERIOD BIT(NL80211_STA_BSS_PARAM_DTIM_PERIOD)
#define STATION_INFO_BSS_PARAM_BEACON_INTERVAL BIT(NL80211_STA_BSS_PARAM_BEACON_INTERVAL)
#endif /* Linux kernel >= 4.0.0 */
#include <rtw_wifi_regd.h>
@ -1922,33 +1936,78 @@ static int cfg80211_rtw_get_station(struct wiphy *wiphy,
RTW_INFO(FUNC_NDEV_FMT" mac="MAC_FMT"\n", FUNC_NDEV_ARG(ndev), MAC_ARG(mac));
#endif
/* for infra./P2PClient mode */
/* for infra./P2PClient mode */
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)
&& check_fwstate(pmlmepriv, _FW_LINKED)
) {
struct wlan_network *cur_network = &(pmlmepriv->cur_network);
struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter);
if (_rtw_memcmp((u8 *)mac, cur_network->network.MacAddress, ETH_ALEN) == _FALSE) {
RTW_INFO("%s, mismatch bssid="MAC_FMT"\n", __func__, MAC_ARG(cur_network->network.MacAddress));
ret = -ENOENT;
goto exit;
}
if (_rtw_memcmp((u8 *)mac, cur_network->network.MacAddress, ETH_ALEN) == _FALSE) {
RTW_INFO("%s, mismatch bssid="MAC_FMT"\n", __func__, MAC_ARG(cur_network->network.MacAddress));
ret = -ENOENT;
goto exit;
}
sinfo->filled |= STATION_INFO_SIGNAL;
sinfo->signal = translate_percentage_to_dbm(padapter->recvpriv.signal_strength);
sinfo->filled |= STATION_INFO_SIGNAL;
sinfo->signal = translate_percentage_to_dbm(padapter->recvpriv.signal_strength);
sinfo->filled |= STATION_INFO_TX_BITRATE;
sinfo->txrate.legacy = rtw_get_cur_max_rate(padapter);
sinfo->filled |= STATION_INFO_TX_BITRATE;
sinfo->txrate.legacy = rtw_get_cur_max_rate(padapter);
sinfo->filled |= STATION_INFO_RX_PACKETS;
sinfo->rx_packets = sta_rx_data_pkts(psta);
/* to-do set the txrate flags */
// for example something like:
//sinfo->txrate.flags |= NL80211_RATE_INFO_VHT_NSS;
//sinfo->txrate.nss = rtw_vht_mcsmap_to_nss(psta->vhtpriv.vht_mcs_map);
sinfo->filled |= STATION_INFO_TX_PACKETS;
sinfo->tx_packets = psta->sta_stats.tx_pkts;
/* bw_mode is more delicate
sinfo->txrate.bw is flagged
psta->bw_mode */
/*
sinfo->txrate.bw = psta->bw_mode;
sinfo->txrate.flags |= psta->bw_mode;
printk("rtw_get_current_tx_sgi: %i", rtw_get_current_tx_sgi(padapter, mac));
printk("NSS: %i", rtw_vht_mcsmap_to_nss(psta->vhtpriv.vht_mcs_map));
printk("BW MODE: %i", psta->bw_mode);
printk("5 10 20 40 80 160: %i %i %i %i %i %i", STATION_INFO_TX_BITRATE_BW_5, STATION_INFO_TX_BITRATE_BW_10, STATION_INFO_TX_BITRATE_BW_20, STATION_INFO_TX_BITRATE_BW_40, STATION_INFO_TX_BITRATE_BW_80, STATION_INFO_TX_BITRATE_BW_160);
printk("5 10 20 40 80 160: %i %i %i %i %i %i", RATE_INFO_BW_5, RATE_INFO_BW_10, RATE_INFO_BW_20, RATE_INFO_BW_40, RATE_INFO_BW_80, RATE_INFO_BW_160);
*/
sinfo->filled |= STATION_INFO_RX_BYTES;
sinfo->rx_bytes = psta->sta_stats.rx_bytes;
sinfo->filled |= STATION_INFO_TX_BYTES;
sinfo->tx_bytes = psta->sta_stats.tx_bytes;
sinfo->filled |= STATION_INFO_RX_PACKETS;
sinfo->rx_packets = sta_rx_data_pkts(psta);
sinfo->filled |= STATION_INFO_TX_PACKETS;
sinfo->tx_packets = psta->sta_stats.tx_pkts;
sinfo->filled |= STATION_INFO_TX_FAILED;
sinfo->tx_failed = psta->sta_stats.tx_fail_cnt;
sinfo->filled |= STATION_INFO_BSS_PARAM;
if (!psta->no_short_preamble_set)
sinfo->bss_param.flags |= STATION_INFO_BSS_PARAM_SHORT_PREAMBLE;
if (!psta->no_short_slot_time_set)
sinfo->bss_param.flags |= STATION_INFO_BSS_PARAM_SHORT_SLOT_TIME;
/* no idea how to check this yet */
if (0)
sinfo->bss_param.flags |= STATION_INFO_BSS_PARAM_CTS_PROT;
/* is this actually the dtim_period? */
sinfo->bss_param.flags |= STATION_INFO_BSS_PARAM_DTIM_PERIOD;
sinfo->bss_param.dtim_period = pwrctl->dtim;
sinfo->bss_param.beacon_interval = get_beacon_interval(&cur_network->network);
}
/* for Ad-Hoc/AP mode */