Re: [PATCH] batman-adv: Use wifi rx/tx as fallback throughput

Sven Eckelmann
2019-06-09T10:37:54Z

[-- Attachment #1: Type: text/plain, Size: 1634 bytes --]

On Sunday, 9 June 2019 12:19:22 CEST René Treffer wrote:
> @@ -107,10 +107,25 @@ 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 rx/tx rates
> + // 1/3 of tx or 1/3 of the average of rx and tx, whichever is smaller
> + if (sinfo.filled & BIT(NL80211_STA_INFO_TX_BITRATE)) {
> + tx = cfg80211_calculate_bitrate(&sinfo.txrate);
> + if (sinfo.filled & BIT(NL80211_STA_INFO_RX_BITRATE)) {
> + rx = cfg80211_calculate_bitrate(&sinfo.rxrate);
> + if (rx < tx) {
> + return (rx + tx) / 6;
> + }
> + }
> + return tx / 3;
> + }
> +
> + goto default_throughput;
> }
>
> /* if not a wifi interface, check if this device provides data via
> --
> 2.20.1

No, we are not interested in rx rate for tx throughput estimations.

Kind regards,
Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]