add support for expected throughput
cfg80211 allows drivers to announce the to-be-expected layer-2 datarate using the NL80211_STA_INFO_EXPECTED_THROUGHPUT field. This information is useful as a metric for user-space routing daemons, so grab it via nl80211 and make it available in both C and Lua APIs, and show expected throughput on CLI interface assoclist. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
parent
fb749bf51a
commit
223e09bf3f
4 changed files with 14 additions and 1 deletions
|
@ -122,6 +122,7 @@ struct iwinfo_assoclist_entry {
|
||||||
uint8_t is_wme:1;
|
uint8_t is_wme:1;
|
||||||
uint8_t is_mfp:1;
|
uint8_t is_mfp:1;
|
||||||
uint8_t is_tdls:1;
|
uint8_t is_tdls:1;
|
||||||
|
uint32_t thr;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct iwinfo_txpwrlist_entry {
|
struct iwinfo_txpwrlist_entry {
|
||||||
|
|
|
@ -700,10 +700,13 @@ static void print_assoclist(const struct iwinfo_ops *iw, const char *ifname)
|
||||||
e->rx_packets
|
e->rx_packets
|
||||||
);
|
);
|
||||||
|
|
||||||
printf(" TX: %-38s %8d Pkts.\n\n",
|
printf(" TX: %-38s %8d Pkts.\n",
|
||||||
format_assocrate(&e->tx_rate),
|
format_assocrate(&e->tx_rate),
|
||||||
e->tx_packets
|
e->tx_packets
|
||||||
);
|
);
|
||||||
|
|
||||||
|
printf(" expected throughput: %s\n\n",
|
||||||
|
format_rate(e->thr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -328,6 +328,11 @@ static int iwinfo_L_assoclist(lua_State *L, int (*func)(const char *, char *, in
|
||||||
set_rateinfo(L, &e->rx_rate, true);
|
set_rateinfo(L, &e->rx_rate, true);
|
||||||
set_rateinfo(L, &e->tx_rate, false);
|
set_rateinfo(L, &e->tx_rate, false);
|
||||||
|
|
||||||
|
if (e->thr) {
|
||||||
|
lua_pushnumber(L, e->thr);
|
||||||
|
lua_setfield(L, -2, "expected_throughput");
|
||||||
|
}
|
||||||
|
|
||||||
lua_setfield(L, -2, macstr);
|
lua_setfield(L, -2, macstr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1701,6 +1701,7 @@ static int nl80211_get_assoclist_cb(struct nl_msg *msg, void *arg)
|
||||||
[NL80211_STA_INFO_T_OFFSET] = { .type = NLA_U64 },
|
[NL80211_STA_INFO_T_OFFSET] = { .type = NLA_U64 },
|
||||||
[NL80211_STA_INFO_STA_FLAGS] =
|
[NL80211_STA_INFO_STA_FLAGS] =
|
||||||
{ .minlen = sizeof(struct nl80211_sta_flag_update) },
|
{ .minlen = sizeof(struct nl80211_sta_flag_update) },
|
||||||
|
[NL80211_STA_INFO_EXPECTED_THROUGHPUT] = { .type = NLA_U32 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct nla_policy rate_policy[NL80211_RATE_INFO_MAX + 1] = {
|
static struct nla_policy rate_policy[NL80211_RATE_INFO_MAX + 1] = {
|
||||||
|
@ -1758,6 +1759,9 @@ static int nl80211_get_assoclist_cb(struct nl_msg *msg, void *arg)
|
||||||
if (sinfo[NL80211_STA_INFO_T_OFFSET])
|
if (sinfo[NL80211_STA_INFO_T_OFFSET])
|
||||||
e->t_offset = nla_get_u64(sinfo[NL80211_STA_INFO_T_OFFSET]);
|
e->t_offset = nla_get_u64(sinfo[NL80211_STA_INFO_T_OFFSET]);
|
||||||
|
|
||||||
|
if (sinfo[NL80211_STA_INFO_EXPECTED_THROUGHPUT])
|
||||||
|
e->thr = nla_get_u32(sinfo[NL80211_STA_INFO_EXPECTED_THROUGHPUT]);
|
||||||
|
|
||||||
/* Station flags */
|
/* Station flags */
|
||||||
if (sinfo[NL80211_STA_INFO_STA_FLAGS])
|
if (sinfo[NL80211_STA_INFO_STA_FLAGS])
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue