Skip to contentSkip to conversation

batman-adv: ELP - use wifi tx bitrate as fallback throughput

RFC In review Marek Lindner 2 participants 2 messages Aug 11, 2019 Batman advanced

lore
Share & tools
lore
#0 lore raw

RFC 1/1 batman-adv: ELP - use wifi tx bitrate as fallback throughput

From: René Treffer <[email protected]>

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.

---
 net/batman-adv/bat_v_elp.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
net/batman-adv/bat_v_elp.c +8 -3
index 2614a9ca..1e852d4b 100644
@@ -107,10 +107,15 @@ 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 en 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
Signature · 1 line
2.20.1
#1 lore raw
Quoted 9 lines · Marek Lindner

From: René Treffer <[email protected]>

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.

---

In general, I like this approach. It's simple and roughly matches our conservative assumptions we used for broadcast packets, too. That is 3x transmissions per packet.

Lukonin's approach sounds more accurate in theory. But should probably have a bit more testing and reviewable test results due to it's slightly higher complexity.

Regards, Linus