From: Simon Wunderlich <sw@simonwunderlich.de>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
"René Treffer" <treffer@measite.de>,
"Marek Lindner" <mareklindner@neomailbox.ch>,
"Sven Eckelmann" <sven@narfation.org>,
"Simon Wunderlich" <sw@simonwunderlich.de>
Subject: [PATCH 4/7] batman-adv: ELP - use wifi tx bitrate as fallback throughput
Date: Tue, 14 Jan 2020 15:23:48 +0100 [thread overview]
Message-ID: <20200114142351.26622-5-sw@simonwunderlich.de> (raw)
In-Reply-To: <20200114142351.26622-1-sw@simonwunderlich.de>
From: René Treffer <treffer@measite.de>
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>
---
net/batman-adv/bat_v_elp.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c
index 2614a9caee00..6536e8cc53a0 100644
--- a/net/batman-adv/bat_v_elp.c
+++ b/net/batman-adv/bat_v_elp.c
@@ -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
--
2.20.1
next prev parent reply other threads:[~2020-01-14 14:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-14 14:23 [PATCH 0/7] pull request for net-next: batman-adv 2020-01-14 Simon Wunderlich
2020-01-14 14:23 ` [PATCH 1/7] batman-adv: Start new development cycle Simon Wunderlich
2020-01-14 14:23 ` [PATCH 2/7] batman-adv: Strip dots from variable macro kerneldoc Simon Wunderlich
2020-01-14 14:23 ` [PATCH 3/7] batman-adv: Fix typo metAdata Simon Wunderlich
2020-01-14 14:23 ` Simon Wunderlich [this message]
2020-01-14 14:23 ` [PATCH 5/7] batman-adv: Annotate bitwise integer pointer casts Simon Wunderlich
2020-01-14 14:23 ` [PATCH 6/7] batman-adv: Update copyright years for 2020 Simon Wunderlich
2020-01-14 14:23 ` [PATCH 7/7] batman-adv: Disable CONFIG_BATMAN_ADV_SYSFS by default Simon Wunderlich
2020-01-15 22:04 ` [PATCH 0/7] pull request for net-next: batman-adv 2020-01-14 David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200114142351.26622-5-sw@simonwunderlich.de \
--to=sw@simonwunderlich.de \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=davem@davemloft.net \
--cc=mareklindner@neomailbox.ch \
--cc=netdev@vger.kernel.org \
--cc=sven@narfation.org \
--cc=treffer@measite.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox