Skip to content

Commit

Permalink
batman-adv: ELP - use wifi tx bitrate as fallback throughput
Browse files Browse the repository at this point in the history
Some wifi drivers (e.g. ath10k) provide per-station rx/tx values but no
estimated throughput. Setting a better estimate than the default 1 MBit
makes these devices work well with B.A.T.M.A.N. V.

Signed-off-by: René Treffer <treffer@measite.de>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
  • Loading branch information
René Treffer authored and Simon Wunderlich committed Dec 8, 2019
1 parent 69fed4c commit 2b1aa5a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions net/batman-adv/bat_v_elp.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,17 @@ static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh)
}
if (ret)
goto default_throughput;
if (!(sinfo.filled & BIT(NL80211_STA_INFO_EXPECTED_THROUGHPUT)))
goto default_throughput;

return sinfo.expected_throughput / 100;
if (sinfo.filled & BIT(NL80211_STA_INFO_EXPECTED_THROUGHPUT))
return sinfo.expected_throughput / 100;

/* try to estimate the expected throughput based on reported tx
* rates
*/
if (sinfo.filled & BIT(NL80211_STA_INFO_TX_BITRATE))
return cfg80211_calculate_bitrate(&sinfo.txrate) / 3;

goto default_throughput;
}

/* if not a wifi interface, check if this device provides data via
Expand Down

0 comments on commit 2b1aa5a

Please sign in to comment.