2020-09-08 16:38:21

by Felix Fietkau

[permalink] [raw]
Subject: [PATCH v4 11/14] mac80211: support using ieee80211_tx_status_ext to free skbs without status info

For encap-offloaded packets, ieee80211_free_txskb cannot be used, since it
does not have the vif pointer.
Using ieee80211_tx_status_ext for this purpose has the advantage of being able
avoid an extra station lookup for AQL

Signed-off-by: Felix Fietkau <[email protected]>
---
net/mac80211/status.c | 32 +++++++++++++++++++-------------
1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index ac4d988556b0..a3543c3dbd3d 100644
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -1087,6 +1087,24 @@ void ieee80211_tx_status_ext(struct ieee80211_hw *hw,
bool acked, noack_success;
u16 tx_time_est;

+ if (pubsta)
+ sta = container_of(pubsta, struct sta_info, sta);
+
+ if (skb && (tx_time_est =
+ ieee80211_info_get_tx_time_est(IEEE80211_SKB_CB(skb))) > 0) {
+ /* Do this here to avoid the expensive lookup of the sta
+ * in ieee80211_report_used_skb().
+ */
+ ieee80211_sta_update_pending_airtime(local, sta,
+ skb_get_queue_mapping(skb),
+ tx_time_est,
+ true);
+ ieee80211_info_set_tx_time_est(IEEE80211_SKB_CB(skb), 0);
+ }
+
+ if (!status->info)
+ goto free;
+
rates_idx = ieee80211_tx_get_rates(hw, info, &retry_count);

sband = hw->wiphy->bands[info->band];
@@ -1095,8 +1113,6 @@ void ieee80211_tx_status_ext(struct ieee80211_hw *hw,
noack_success = !!(info->flags & IEEE80211_TX_STAT_NOACK_TRANSMITTED);

if (pubsta) {
- sta = container_of(pubsta, struct sta_info, sta);
-
if (!acked && !noack_success)
sta->status_stats.retry_failed++;
sta->status_stats.retry_count += retry_count;
@@ -1132,17 +1148,6 @@ void ieee80211_tx_status_ext(struct ieee80211_hw *hw,
ieee80211s_update_metric(local, sta, status);
}

- if (skb && (tx_time_est = ieee80211_info_get_tx_time_est(info)) > 0) {
- /* Do this here to avoid the expensive lookup of the sta
- * in ieee80211_report_used_skb().
- */
- ieee80211_sta_update_pending_airtime(local, sta,
- skb_get_queue_mapping(skb),
- tx_time_est,
- true);
- ieee80211_info_set_tx_time_est(info, 0);
- }
-
if (skb && !(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP))
return __ieee80211_tx_status(hw, status, rates_idx,
retry_count);
@@ -1159,6 +1164,7 @@ void ieee80211_tx_status_ext(struct ieee80211_hw *hw,
I802_DEBUG_INC(local->dot11FailedCount);
}

+free:
if (!skb)
return;

--
2.28.0


2020-09-18 10:32:26

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH v4 11/14] mac80211: support using ieee80211_tx_status_ext to free skbs without status info

On Tue, 2020-09-08 at 14:36 +0200, Felix Fietkau wrote:
> For encap-offloaded packets, ieee80211_free_txskb cannot be used, since it
> does not have the vif pointer.
> Using ieee80211_tx_status_ext for this purpose has the advantage of being able
> avoid an extra station lookup for AQL
>
> Signed-off-by: Felix Fietkau <[email protected]>
> ---
> net/mac80211/status.c | 32 +++++++++++++++++++-------------
> 1 file changed, 19 insertions(+), 13 deletions(-)
>
> diff --git a/net/mac80211/status.c b/net/mac80211/status.c
> index ac4d988556b0..a3543c3dbd3d 100644
> --- a/net/mac80211/status.c
> +++ b/net/mac80211/status.c
> @@ -1087,6 +1087,24 @@ void ieee80211_tx_status_ext(struct ieee80211_hw *hw,
> bool acked, noack_success;
> u16 tx_time_est;
>
> + if (pubsta)
> + sta = container_of(pubsta, struct sta_info, sta);

There were some conflicts, e.g. this was already in place ...

Please check once I push it out.

johannes