diff mbox series

[RFC/RFT,v5,3/4] mac80211: add busy time factor into expected throughput

Message ID 20220719123525.3448926-4-gasmibal@gmail.com
State New
Headers show
Series expected throughput from AQL airtime | expand

Commit Message

Baligh GASMI July 19, 2022, 12:35 p.m. UTC
When estimating the expected throughput, take into account the busy time
of the current channel.

Signed-off-by: Baligh Gasmi <gasmibal@gmail.com>
---
 net/mac80211/sta_info.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Nicolas Escande Aug. 25, 2022, 1:36 p.m. UTC | #1
On Tue Jul 19, 2022 at 2:35 PM CEST, Baligh Gasmi wrote:
> When estimating the expected throughput, take into account the busy time
> of the current channel.
>
> Signed-off-by: Baligh Gasmi <gasmibal@gmail.com>
> ---
>  net/mac80211/sta_info.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
> index 201aab465234..7e32c06ae771 100644
> --- a/net/mac80211/sta_info.c
> +++ b/net/mac80211/sta_info.c
> @@ -2000,6 +2000,8 @@ void ieee80211_sta_update_tp(struct ieee80211_local *local,
>  			     bool ack, int retry)
>  {
>  	unsigned long diff;
> +	struct ieee80211_sub_if_data *sdata;
> +	u32 avg_busy;
>  	struct rate_control_ref *ref = NULL;
>
>  	if (!skb || !sta || !tx_time_est)
> @@ -2014,6 +2016,7 @@ void ieee80211_sta_update_tp(struct ieee80211_local *local,
>  	if (local->ops->get_expected_throughput)
>  		return;
>
> +	sdata = sta->sdata;
>  	tx_time_est += ack ? 4 : 0;
>  	tx_time_est += retry ? retry * 2 : 2;
>
> @@ -2022,6 +2025,10 @@ void ieee80211_sta_update_tp(struct ieee80211_local *local,
>
>  	diff = jiffies - sta->deflink.status_stats.last_tp_update;
>  	if (diff > HZ / 10) {
> +		avg_busy = ewma_avg_busy_read(&sdata->avg_busy) >> 1;
> +		sta->deflink.tx_stats.tp_tx_time_est +> +			(sta->deflink.tx_stats.tp_tx_time_est * avg_busy) / 100;
Once again div_u64() ?
> +
>  		ewma_avg_est_tp_add(&sta->deflink.status_stats.avg_est_tp,
>  				    sta->deflink.tx_stats.tp_tx_size /
>  				    sta->deflink.tx_stats.tp_tx_time_est);
> --
> 2.37.1
diff mbox series

Patch

diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 201aab465234..7e32c06ae771 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -2000,6 +2000,8 @@  void ieee80211_sta_update_tp(struct ieee80211_local *local,
 			     bool ack, int retry)
 {
 	unsigned long diff;
+	struct ieee80211_sub_if_data *sdata;
+	u32 avg_busy;
 	struct rate_control_ref *ref = NULL;
 
 	if (!skb || !sta || !tx_time_est)
@@ -2014,6 +2016,7 @@  void ieee80211_sta_update_tp(struct ieee80211_local *local,
 	if (local->ops->get_expected_throughput)
 		return;
 
+	sdata = sta->sdata;
 	tx_time_est += ack ? 4 : 0;
 	tx_time_est += retry ? retry * 2 : 2;
 
@@ -2022,6 +2025,10 @@  void ieee80211_sta_update_tp(struct ieee80211_local *local,
 
 	diff = jiffies - sta->deflink.status_stats.last_tp_update;
 	if (diff > HZ / 10) {
+		avg_busy = ewma_avg_busy_read(&sdata->avg_busy) >> 1;
+		sta->deflink.tx_stats.tp_tx_time_est +=
+			(sta->deflink.tx_stats.tp_tx_time_est * avg_busy) / 100;
+
 		ewma_avg_est_tp_add(&sta->deflink.status_stats.avg_est_tp,
 				    sta->deflink.tx_stats.tp_tx_size /
 				    sta->deflink.tx_stats.tp_tx_time_est);