From 3116f1e01aaaf15ce25377dc722452dd511d0652 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Thu, 14 Nov 2019 20:19:03 +0100 Subject: [PATCH] Added more 'iw' output --- core/rtw_debug.c | 2 +- os_dep/linux/ioctl_cfg80211.c | 82 +++++++++++++++++++++++++++++++---- 2 files changed, 74 insertions(+), 10 deletions(-) diff --git a/core/rtw_debug.c b/core/rtw_debug.c index 6ad11a9..3a61791 100644 --- a/core/rtw_debug.c +++ b/core/rtw_debug.c @@ -42,7 +42,7 @@ const char *rtw_log_level_str[] = { void dump_drv_version(void *sel) { RTW_PRINT_SEL(sel, "%s %s\n", DRV_NAME, DRIVERVERSION); - RTW_PRINT_SEL(sel, "build time: %s %s\n", __DATE__, __TIME__); + //RTW_PRINT_SEL(sel, "build time: %s %s\n", __DATE__, __TIME__); } void dump_drv_cfg(void *sel) diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 6ee5d49..83e5ffc 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -34,13 +34,29 @@ #define STATION_INFO_PLINK_STATE BIT(NL80211_STA_INFO_PLINK_STATE) #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_LOCAL_PM BIT(NL80211_STA_INFO_LOCAL_PM) #define STATION_INFO_PEER_PM BIT(NL80211_STA_INFO_PEER_PM) #define STATION_INFO_NONPEER_PM BIT(NL80211_STA_INFO_NONPEER_PM) +#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 @@ -2264,18 +2280,66 @@ static int cfg80211_rtw_get_station(struct wiphy *wiphy, && 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); + + /* 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); + + /* 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_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); - sinfo->filled |= STATION_INFO_TX_BITRATE; - sinfo->txrate.legacy = rtw_get_cur_max_rate(padapter); } if (psta) {