From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org,
make-wifi-fast@lists.bufferbloat.net,
John Crispin <john@phrozen.org>,
Lorenzo Bianconi <lorenzo@kernel.org>,
Felix Fietkau <nbd@nbd.name>
Subject: [PATCH RFC/RFT 2/4] mac80211: Add API function to set the last TX bitrate for a station
Date: Thu, 19 Sep 2019 14:22:46 +0200 [thread overview]
Message-ID: <156889576646.191202.14461472477971784776.stgit@alrua-x1> (raw)
In-Reply-To: <156889576422.191202.5906619710809654631.stgit@alrua-x1>
From: Toke Høiland-Jørgensen <toke@redhat.com>
To implement airtime queue limits, we need an estimate of the transmission
rate a station is currently transmitting at. The ath10k driver already
keeps this internally, so add an API function to pass this up to mac80211.
We also keep a pre-calculated 64-bit reciprocal that will be used in the
actual calculations, to avoid a division operation in the fast path.
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
---
include/net/mac80211.h | 10 ++++++++++
net/mac80211/ieee80211_i.h | 4 ++++
net/mac80211/sta_info.c | 9 +++++++++
net/mac80211/sta_info.h | 2 ++
4 files changed, 25 insertions(+)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index b12d378621b0..1b7f4a370122 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -4529,6 +4529,16 @@ void ieee80211_get_tx_rates(struct ieee80211_vif *vif,
void ieee80211_sta_set_expected_throughput(struct ieee80211_sta *pubsta,
u32 thr);
+/**
+ * ieee80211_sta_set_last_tx_bitrate - set last tx rate for station
+ *
+ * This sets the last TX bitrate for a given station.
+ *
+ * @sta: Pointer to the station
+ * @bitrate: Bitrate in kbps
+ */
+void ieee80211_sta_set_last_tx_bitrate(struct ieee80211_sta *sta, u32 bitrate);
+
/**
* ieee80211_tx_rate_update - transmit rate update callback
*
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 05406e9c05b3..9de5390411ba 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -59,6 +59,10 @@ struct ieee80211_local;
/* power level hasn't been configured (or set to automatic) */
#define IEEE80211_UNSET_POWER_LEVEL INT_MIN
+/* constants for calculating reciprocals to avoid division in fast path */
+#define IEEE80211_RECIPROCAL_DIVISOR 0x100000000ULL
+#define IEEE80211_RECIPROCAL_SHIFT 32
+
/*
* Some APs experience problems when working with U-APSD. Decreasing the
* probability of that happening by using legacy mode for all ACs but VO isn't
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index df553070206c..aae878ffe94c 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -2481,3 +2481,12 @@ void ieee80211_sta_set_expected_throughput(struct ieee80211_sta *pubsta,
sta_update_codel_params(sta, thr);
}
+
+void ieee80211_sta_set_last_tx_bitrate(struct ieee80211_sta *pubsta,
+ u32 rate)
+{
+ struct sta_info *sta = container_of(pubsta, struct sta_info, sta);
+
+ sta->last_tx_bitrate = rate;
+ sta->last_tx_bitrate_reciprocal = ((u64)IEEE80211_RECIPROCAL_DIVISOR / rate);
+}
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 369c2dddce52..dd1a0b87f234 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -617,6 +617,8 @@ struct sta_info {
const struct ieee80211_cipher_scheme *cipher_scheme;
struct codel_params cparams;
+ u32 last_tx_bitrate;
+ u64 last_tx_bitrate_reciprocal;
u8 reserved_tid;
next prev parent reply other threads:[~2019-09-19 12:22 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-19 12:22 [PATCH RFC/RFT 0/4] Add Airtime Queue Limits (AQL) to mac80211 Toke Høiland-Jørgensen
2019-09-19 12:22 ` [PATCH RFC/RFT 1/4] mac80211: Rearrange ieee80211_tx_info to make room for tx_time_est Toke Høiland-Jørgensen
2019-10-01 8:44 ` Johannes Berg
2019-10-01 9:08 ` Toke Høiland-Jørgensen
2019-10-01 9:12 ` Johannes Berg
2019-10-01 9:39 ` Toke Høiland-Jørgensen
2019-09-19 12:22 ` Toke Høiland-Jørgensen [this message]
2019-10-01 8:46 ` [PATCH RFC/RFT 2/4] mac80211: Add API function to set the last TX bitrate for a station Johannes Berg
2019-10-01 9:09 ` Toke Høiland-Jørgensen
2019-09-19 12:22 ` [PATCH RFC/RFT 3/4] ath10k: Pass last TX bitrate up to mac80211 Toke Høiland-Jørgensen
2019-09-19 12:22 ` [PATCH RFC/RFT 4/4] mac80211: Apply Airtime-based Queue Limit (AQL) on packet dequeue Toke Høiland-Jørgensen
2019-09-19 17:44 ` Peter Oh
2019-09-19 17:46 ` Ben Greear
2019-09-19 17:54 ` Peter Oh
2019-09-19 18:03 ` Peter Oh
2019-09-19 18:18 ` [Make-wifi-fast] " Dave Taht
2019-09-19 20:09 ` John Yates
2019-09-19 20:15 ` Toke Høiland-Jørgensen
2019-09-19 18:03 ` Toke Høiland-Jørgensen
2019-09-20 12:06 ` Lorenzo Bianconi
2019-09-20 12:54 ` Toke Høiland-Jørgensen
2019-09-20 13:06 ` Lorenzo Bianconi
2019-09-20 13:32 ` Toke Høiland-Jørgensen
2019-09-20 22:55 ` Kan Yan
2019-09-21 12:11 ` Toke Høiland-Jørgensen
2019-09-25 7:37 ` Yibo Zhao
2019-09-25 8:11 ` Toke Høiland-Jørgensen
2019-09-25 11:54 ` Yibo Zhao
2019-09-25 12:52 ` Toke Høiland-Jørgensen
2019-09-26 0:27 ` Kan Yan
2019-09-26 0:34 ` Kan Yan
2019-09-26 5:57 ` Toke Høiland-Jørgensen
2019-09-26 6:04 ` Toke Høiland-Jørgensen
2019-09-26 12:53 ` Felix Fietkau
2019-09-26 13:17 ` Toke Høiland-Jørgensen
2019-09-26 13:47 ` Felix Fietkau
2019-09-26 15:19 ` Toke Høiland-Jørgensen
2019-09-27 2:42 ` Kan Yan
2019-09-27 6:12 ` Toke Høiland-Jørgensen
2019-09-27 9:20 ` Yibo Zhao
2019-09-28 20:24 ` Kan Yan
2019-09-29 19:18 ` Toke Høiland-Jørgensen
2019-10-01 4:47 ` Kan Yan
2019-10-01 6:57 ` Toke Høiland-Jørgensen
2019-09-19 14:12 ` [PATCH RFC/RFT 0/4] Add Airtime Queue Limits (AQL) to mac80211 Toke Høiland-Jørgensen
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=156889576646.191202.14461472477971784776.stgit@alrua-x1 \
--to=toke@redhat.com \
--cc=johannes@sipsolutions.net \
--cc=john@phrozen.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=make-wifi-fast@lists.bufferbloat.net \
--cc=nbd@nbd.name \
/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;
as well as URLs for NNTP newsgroup(s).