Commit a36f6d01 authored by Anjan Chanda's avatar Anjan Chanda

show capability in interface status output

parent 2a4c479c
......@@ -360,6 +360,71 @@ static const char *uci_get_wifi_option(char *type, char *name, const char *optio
return val ? val : NULL;
}
static void wl_dump_capabilities(struct blob_buf *bb, struct wifi_caps *caps, uint8_t *bitmap)
{
void *f;
f = blobmsg_open_table(bb, "capabilities");
blobmsg_add_u8(bb, "wmm", wifi_cap_isset(bitmap, WIFI_CAP_WMM) ? true : false);
blobmsg_add_u8(bb, "apsd", wifi_cap_isset(bitmap, WIFI_CAP_APSD) ? true : false);
blobmsg_add_u8(bb, "shortslot", wifi_cap_isset(bitmap, WIFI_CAP_SHORT_SLOT) ? true : false);
blobmsg_add_u8(bb, "11h", wifi_cap_isset(bitmap, WIFI_CAP_SPECTRUM_MGMT) ? true : false);
blobmsg_add_u8(bb, "11k", wifi_cap_isset(bitmap, WIFI_CAP_RADIO_MEAS) ? true : false);
if (!!(caps->valid & WIFI_CAP_EXT_VALID)) {
blobmsg_add_u8(bb, "2040coex", wifi_cap_isset(bitmap, WIFI_CAP_2040_COEX) ? true : false);
blobmsg_add_u8(bb, "psmp", wifi_cap_isset(bitmap, WIFI_CAP_PSMP) ? true : false);
blobmsg_add_u8(bb, "proxy_arp", wifi_cap_isset(bitmap, WIFI_CAP_PROXY_ARP) ? true : false);
blobmsg_add_u8(bb, "11v_btm", wifi_cap_isset(bitmap, WIFI_CAP_11V_BSS_TRANS) ? true : false);
}
if (!!(caps->valid & WIFI_CAP_HT_VALID)) {
blobmsg_add_u8(bb, "11n", true);
blobmsg_add_u8(bb, "11n_ldpc", wifi_cap_isset(bitmap, WIFI_CAP_HT_LDPC) ? true : false);
blobmsg_add_u8(bb, "11n_40", wifi_cap_isset(bitmap, WIFI_CAP_2040) ? true : false);
blobmsg_add_u8(bb, "11n_ps", wifi_cap_isset(bitmap, WIFI_CAP_HT_SMPS) ? true : false);
blobmsg_add_u8(bb, "11n_sgi20", wifi_cap_isset(bitmap, WIFI_CAP_SGI20) ? true : false);
blobmsg_add_u8(bb, "11n_sgi40", wifi_cap_isset(bitmap, WIFI_CAP_SGI40) ? true : false);
blobmsg_add_u8(bb, "11n_tx_stbc", wifi_cap_isset(bitmap, WIFI_CAP_HT_TX_STBC) ? true : false);
blobmsg_add_u8(bb, "11n_rx_stbc", wifi_cap_isset(bitmap, WIFI_CAP_HT_RX_STBC) ? true : false);
} else {
blobmsg_add_u8(bb, "11n", false);
}
if (!!(caps->valid & WIFI_CAP_VHT_VALID)) {
blobmsg_add_u8(bb, "11ac", true);
blobmsg_add_u8(bb, "11ac_160", wifi_cap_isset(bitmap, WIFI_CAP_160) ? true : false);
blobmsg_add_u8(bb, "11ac_8080", wifi_cap_isset(bitmap, WIFI_CAP_8080) ? true : false);
blobmsg_add_u8(bb, "11ac_rx_ldpc", wifi_cap_isset(bitmap, WIFI_CAP_VHT_RX_LDPC) ? true : false);
blobmsg_add_u8(bb, "11ac_tx_stbc", wifi_cap_isset(bitmap, WIFI_CAP_VHT_TX_STBC) ? true : false);
blobmsg_add_u8(bb, "11ac_rx_stbc_1ss", wifi_cap_isset(bitmap, WIFI_CAP_VHT_RX_STBC_1SS) ? true : false);
blobmsg_add_u8(bb, "11ac_rx_stbc_2ss", wifi_cap_isset(bitmap, WIFI_CAP_VHT_RX_STBC_2SS) ? true : false);
blobmsg_add_u8(bb, "11ac_rx_stbc_3ss", wifi_cap_isset(bitmap, WIFI_CAP_VHT_RX_STBC_3SS) ? true : false);
blobmsg_add_u8(bb, "11ac_rx_stbc_4ss", wifi_cap_isset(bitmap, WIFI_CAP_VHT_RX_STBC_4SS) ? true : false);
blobmsg_add_u8(bb, "11ac_su_beamformer", wifi_cap_isset(bitmap, WIFI_CAP_VHT_SU_BFR) ? true : false);
blobmsg_add_u8(bb, "11ac_su_beamformee", wifi_cap_isset(bitmap, WIFI_CAP_VHT_SU_BFE) ? true : false);
blobmsg_add_u8(bb, "11ac_mu_beamformer", wifi_cap_isset(bitmap, WIFI_CAP_VHT_MU_BFR) ? true : false);
blobmsg_add_u8(bb, "11ac_mu_beamformee", wifi_cap_isset(bitmap, WIFI_CAP_VHT_MU_BFE) ? true : false);
} else {
blobmsg_add_u8(bb, "11ac", false);
}
if (!!(caps->valid & WIFI_CAP_RM_VALID)) {
blobmsg_add_u8(bb, "11k", true);
blobmsg_add_u8(bb, "11k_link_meas", wifi_cap_isset(bitmap, WIFI_CAP_RM_LINK) ? true : false);
blobmsg_add_u8(bb, "11k_nbr_report", wifi_cap_isset(bitmap, WIFI_CAP_RM_NBR_REPORT) ? true : false);
blobmsg_add_u8(bb, "11k_bcn_passive", wifi_cap_isset(bitmap, WIFI_CAP_RM_BCN_PASSIVE) ? true : false);
blobmsg_add_u8(bb, "11k_bcn_active", wifi_cap_isset(bitmap, WIFI_CAP_RM_BCN_ACTIVE) ? true : false);
blobmsg_add_u8(bb, "11k_bcn_table", wifi_cap_isset(bitmap, WIFI_CAP_RM_BCN_TABLE) ? true : false);
blobmsg_add_u8(bb, "11k_rcpi", wifi_cap_isset(bitmap, WIFI_CAP_RM_RCPI) ? true : false);
blobmsg_add_u8(bb, "11k_rsni", wifi_cap_isset(bitmap, WIFI_CAP_RM_RSNI) ? true : false);
} /* else
blobmsg_add_u8(bb, "11k", false); */
//blobmsg_add_u8(bb, "11r", wifi_cap_isset(bitmap, WIFI_CAP_FT_BSS) ? true : false);
blobmsg_close_table(bb, f);
}
enum {
VIF_NAME,
__WL_MAX,
......@@ -514,11 +579,14 @@ static int wl_interface_status(struct ubus_context *ctx, struct ubus_object *obj
int bandwidth, noise;
char auth_buf[32] = {0};
//struct bss b; // use struct ap
struct wifi_ap ap;
struct wifi_bss *bss = &ap.bss;
struct blob_buf bb;
uint32_t channel;
enum wifi_bw bw;
memset(&bb, 0, sizeof(bb));
memset(&ap, 0, sizeof(struct wifi_ap));
ifname = ubus_ap_to_ifname(obj);
......@@ -533,6 +601,8 @@ static int wl_interface_status(struct ubus_context *ctx, struct ubus_object *obj
bw = bw8080 + 1; // Unknown
}
wifi_ap_info(ifname, &ap);
wifi_get_bssid(ifname, bssid);
hwaddr_ntoa(bssid, bssid_str);
wifi_get_ssid(ifname, ssid);
......@@ -562,6 +632,8 @@ static int wl_interface_status(struct ubus_context *ctx, struct ubus_object *obj
blobmsg_add_u32(&bb, "bandwidth", bw_int[bw]);
//blobmsg_add_u64(&bb, "rate", rate);
wl_dump_capabilities(&bb, &bss->caps, bss->cbitmap);
ubus_send_reply(ctx, req, bb.head);
blob_buf_free(&bb);
......@@ -894,6 +966,7 @@ static int wl_dump_stations(struct blob_buf *bb, const char *ifname,
blobmsg_add_u32(bb, "airtime", sx.sta_info.airtime);
//blobmsg_add_u32(bb, "max_rate", sx.sta_info.maxrate);
#if 0
f = blobmsg_open_table(bb, "capabilities");
blobmsg_add_u8(bb, "wmm", wifi_cap_isset(sx.sta_info.cbitmap, WIFI_CAP_WMM) ? true : false);
blobmsg_add_u8(bb, "apsd", wifi_cap_isset(sx.sta_info.cbitmap, WIFI_CAP_APSD) ? true : false);
......@@ -953,6 +1026,9 @@ static int wl_dump_stations(struct blob_buf *bb, const char *ifname,
//blobmsg_add_u8(bb, "11r", wifi_cap_isset(sx.sta_info.cbitmap, WIFI_CAP_FT_BSS) ? true : false);
blobmsg_close_table(bb, f);
#endif
wl_dump_capabilities(bb, &sx.sta_info.caps, sx.sta_info.cbitmap);
s = blobmsg_open_table(bb, "stats");
blobmsg_add_u32(bb, "tx_total_pkts", sx.sta_info.stats.tx_pkts);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment