diff --git a/src/wifi_ubus.c b/src/wifi_ubus.c index b7efc90a0ed280e924b6045d0e0a48a9e46e6a15..18221870a71c76a6ee25b9cedc72580f76ebf72d 100644 --- a/src/wifi_ubus.c +++ b/src/wifi_ubus.c @@ -1759,8 +1759,6 @@ static int wifi_ubus_get_sta_stats(struct blob_attr *msg, [4] = { .name = "rx_data_pkts", .type = BLOBMSG_TYPE_INT64 }, [5] = { .name = "rx_data_bytes", .type = BLOBMSG_TYPE_INT64 }, [6] = { .name = "rx_failures", .type = BLOBMSG_TYPE_INT64 }, - [7] = { .name = "tx_rate_latest", .type = BLOBMSG_TYPE_TABLE }, - [8] = { .name = "rx_rate_latest", .type = BLOBMSG_TYPE_TABLE }, }; struct blob_attr *tb[ARRAY_SIZE(stats_policy)]; @@ -1781,11 +1779,6 @@ static int wifi_ubus_get_sta_stats(struct blob_attr *msg, stats->rx_bytes = blobmsg_get_u64(tb[5]); stats->rx_fail_pkts = blobmsg_get_u64(tb[6]); - if (tb[7]) - wifi_ubus_get_sta_rate(tb[7], &sta->tx_rate); - if (tb[8]) - wifi_ubus_get_sta_rate(tb[8], &sta->rx_rate); - return 0; } @@ -1810,6 +1803,8 @@ static int wifi_ubus_parse_sta(struct blob_attr *cur, [13] = { .name = "est_rx_thput", .type = BLOBMSG_TYPE_INT32 }, [14] = { .name = "est_tx_thput", .type = BLOBMSG_TYPE_INT32 }, [15] = { .name = "rssi_avg", .type = BLOBMSG_TYPE_INT32 }, + [16] = { .name = "tx_rate_latest", .type = BLOBMSG_TYPE_TABLE }, + [17] = { .name = "rx_rate_latest", .type = BLOBMSG_TYPE_TABLE }, }; struct blob_attr *sta_tb[ARRAY_SIZE(sta_policy)]; @@ -1840,6 +1835,11 @@ static int wifi_ubus_parse_sta(struct blob_attr *cur, wifi_ubus_get_sta_rssi(sta_tb[12], sta->rssi, sizeof(sta->rssi)); wifi_ubus_get_sta_caps(sta_tb[10], &sta->caps); wifi_ubus_get_sta_stats(sta_tb[4], sta, &sta->stats); + if (sta_tb[16]) + wifi_ubus_get_sta_rate(sta_tb[16], &sta->tx_rate); + if (sta_tb[17]) + wifi_ubus_get_sta_rate(sta_tb[17], &sta->rx_rate); + return 0; }