linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@nbd.name>
To: linux-wireless@vger.kernel.org
Cc: johannes@sipsolutions.net
Subject: [PATCH v4 10/14] mac80211: unify 802.3 (offload) and 802.11 tx status codepath
Date: Tue,  8 Sep 2020 14:36:58 +0200	[thread overview]
Message-ID: <20200908123702.88454-11-nbd@nbd.name> (raw)
In-Reply-To: <20200908123702.88454-1-nbd@nbd.name>

Make ieee80211_tx_status_8023 call ieee80211_tx_status_ext, similar to
ieee80211_tx_status.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 net/mac80211/status.c | 93 +++++++++++++------------------------------
 1 file changed, 28 insertions(+), 65 deletions(-)

diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index c873910d95e0..ac4d988556b0 100644
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -894,7 +894,6 @@ static void __ieee80211_tx_status(struct ieee80211_hw *hw,
 	struct ieee80211_bar *bar;
 	int shift = 0;
 	int tid = IEEE80211_NUM_TIDS;
-	u16 tx_time_est;
 
 	sband = local->hw.wiphy->bands[info->band];
 	fc = hdr->frame_control;
@@ -987,17 +986,6 @@ static void __ieee80211_tx_status(struct ieee80211_hw *hw,
 		    ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS))
 			ieee80211_sta_tx_notify(sta->sdata, (void *) skb->data,
 						acked, info->status.tx_time);
-
-		if ((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);
-		}
 	}
 
 	/* SNMP counters
@@ -1092,9 +1080,12 @@ void ieee80211_tx_status_ext(struct ieee80211_hw *hw,
 	struct ieee80211_local *local = hw_to_local(hw);
 	struct ieee80211_tx_info *info = status->info;
 	struct ieee80211_sta *pubsta = status->sta;
+	struct sk_buff *skb = status->skb;
+	struct sta_info *sta = NULL;
 	struct ieee80211_supported_band *sband;
 	int rates_idx, retry_count;
 	bool acked, noack_success;
+	u16 tx_time_est;
 
 	rates_idx = ieee80211_tx_get_rates(hw, info, &retry_count);
 
@@ -1104,8 +1095,6 @@ void ieee80211_tx_status_ext(struct ieee80211_hw *hw,
 	noack_success = !!(info->flags & IEEE80211_TX_STAT_NOACK_TRANSMITTED);
 
 	if (pubsta) {
-		struct sta_info *sta;
-
 		sta = container_of(pubsta, struct sta_info, sta);
 
 		if (!acked && !noack_success)
@@ -1143,7 +1132,18 @@ void ieee80211_tx_status_ext(struct ieee80211_hw *hw,
 			ieee80211s_update_metric(local, sta, status);
 	}
 
-	if (status->skb)
+	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);
 
@@ -1158,6 +1158,12 @@ void ieee80211_tx_status_ext(struct ieee80211_hw *hw,
 	} else {
 		I802_DEBUG_INC(local->dot11FailedCount);
 	}
+
+	if (!skb)
+		return;
+
+	ieee80211_report_used_skb(local, skb, false);
+	dev_kfree_skb(skb);
 }
 EXPORT_SYMBOL(ieee80211_tx_status_ext);
 
@@ -1184,66 +1190,23 @@ void ieee80211_tx_status_8023(struct ieee80211_hw *hw,
 			      struct ieee80211_vif *vif,
 			      struct sk_buff *skb)
 {
-	struct ieee80211_local *local = hw_to_local(hw);
 	struct ieee80211_sub_if_data *sdata;
-	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+	struct ieee80211_tx_status status = {
+		.skb = skb,
+		.info = IEEE80211_SKB_CB(skb),
+	};
 	struct sta_info *sta;
-	int retry_count;
-	int rates_idx;
-	bool acked;
 
 	sdata = vif_to_sdata(vif);
 
-	acked = info->flags & IEEE80211_TX_STAT_ACK;
-	rates_idx = ieee80211_tx_get_rates(hw, info, &retry_count);
-
 	rcu_read_lock();
 
-	if (ieee80211_lookup_ra_sta(sdata, skb, &sta))
-		goto counters_update;
-
-	if (IS_ERR(sta))
-		goto counters_update;
-
-	if (!acked)
-		sta->status_stats.retry_failed++;
-
-	if (rates_idx != -1)
-		sta->tx_stats.last_rate = info->status.rates[rates_idx];
-
-	sta->status_stats.retry_count += retry_count;
-
-	if (ieee80211_hw_check(hw, REPORTS_TX_ACK_STATUS)) {
-		sta->status_stats.last_ack = jiffies;
-		if (info->flags & IEEE80211_TX_STAT_ACK) {
-			if (sta->status_stats.lost_packets)
-				sta->status_stats.lost_packets = 0;
+	if (!ieee80211_lookup_ra_sta(sdata, skb, &sta) && !IS_ERR(sta))
+		status.sta = &sta->sta;
 
-			sta->status_stats.last_pkt_time = jiffies;
-		} else {
-			ieee80211_lost_packet(sta, info);
-		}
-	}
+	ieee80211_tx_status_ext(hw, &status);
 
-counters_update:
 	rcu_read_unlock();
-	ieee80211_led_tx(local);
-
-	if (!(info->flags & IEEE80211_TX_STAT_ACK) &&
-	    !(info->flags & IEEE80211_TX_STAT_NOACK_TRANSMITTED))
-		goto skip_stats_update;
-
-	I802_DEBUG_INC(local->dot11TransmittedFrameCount);
-	if (is_multicast_ether_addr(skb->data))
-		I802_DEBUG_INC(local->dot11MulticastTransmittedFrameCount);
-	if (retry_count > 0)
-		I802_DEBUG_INC(local->dot11RetryCount);
-	if (retry_count > 1)
-		I802_DEBUG_INC(local->dot11MultipleRetryCount);
-
-skip_stats_update:
-	ieee80211_report_used_skb(local, skb, false);
-	dev_kfree_skb(skb);
 }
 EXPORT_SYMBOL(ieee80211_tx_status_8023);
 
-- 
2.28.0


  parent reply	other threads:[~2020-09-08 16:43 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-08 12:36 [PATCH v4 00/14] mac80211 encapsulation offload / performance patches Felix Fietkau
2020-09-08 12:36 ` [PATCH v4 01/14] mac80211: add missing queue/hash initialization to 802.3 xmit Felix Fietkau
2020-09-08 12:36 ` [PATCH v4 02/14] mac80211: check and refresh aggregation session in encap offload tx Felix Fietkau
2020-09-18  9:58   ` Johannes Berg
2020-09-08 12:36 ` [PATCH v4 03/14] mac80211: skip encap offload for tx multicast/control packets Felix Fietkau
2020-09-18  9:59   ` Johannes Berg
2020-09-08 12:36 ` [PATCH v4 04/14] mac80211: set info->control.hw_key for encap offload packets Felix Fietkau
2020-09-08 12:36 ` [PATCH v4 05/14] mac80211: rework tx encapsulation offload API Felix Fietkau
2020-09-18 10:10   ` Johannes Berg
2020-09-08 12:36 ` [PATCH v4 06/14] mac80211: reduce duplication in tx status functions Felix Fietkau
2020-09-08 12:36 ` [PATCH v4 07/14] mac80211: remove tx status call to ieee80211_sta_register_airtime Felix Fietkau
2020-09-18 10:11   ` Johannes Berg
2020-09-08 12:36 ` [PATCH v4 08/14] mac80211: optimize station connection monitor Felix Fietkau
2020-09-08 12:36 ` [PATCH v4 09/14] mac80211: swap NEED_TXPROCESSING and HW_80211_ENCAP tx flags Felix Fietkau
2020-09-08 12:36 ` Felix Fietkau [this message]
2020-09-08 12:36 ` [PATCH v4 11/14] mac80211: support using ieee80211_tx_status_ext to free skbs without status info Felix Fietkau
2020-09-18 10:31   ` Johannes Berg
2020-09-08 12:37 ` [PATCH v4 12/14] mac80211: extend ieee80211_tx_status_ext to support bulk free Felix Fietkau
2020-09-08 12:37 ` [PATCH v4 13/14] mac80211: notify the driver when a sta uses 4-address mode Felix Fietkau
2020-09-08 12:37 ` [PATCH v4 14/14] mac80211: reorganize code to remove a forward declaration Felix Fietkau

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=20200908123702.88454-11-nbd@nbd.name \
    --to=nbd@nbd.name \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /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).