1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Mon, 17 Aug 2020 13:54:19 +0200
3 Subject: [PATCH] mac80211: unify 802.3 (offload) and 802.11 tx status
6 Make ieee80211_tx_status_8023 call ieee80211_tx_status_ext, similar to
9 Signed-off-by: Felix Fietkau <nbd@nbd.name>
12 --- a/net/mac80211/status.c
13 +++ b/net/mac80211/status.c
14 @@ -903,7 +903,6 @@ static void __ieee80211_tx_status(struct
15 struct ieee80211_bar *bar;
17 int tid = IEEE80211_NUM_TIDS;
20 sband = local->hw.wiphy->bands[info->band];
21 fc = hdr->frame_control;
22 @@ -996,17 +995,6 @@ static void __ieee80211_tx_status(struct
23 ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS))
24 ieee80211_sta_tx_notify(sta->sdata, (void *) skb->data,
25 acked, info->status.tx_time);
27 - if ((tx_time_est = ieee80211_info_get_tx_time_est(info)) > 0) {
28 - /* Do this here to avoid the expensive lookup of the sta
29 - * in ieee80211_report_used_skb().
31 - ieee80211_sta_update_pending_airtime(local, sta,
32 - skb_get_queue_mapping(skb),
35 - ieee80211_info_set_tx_time_est(info, 0);
40 @@ -1102,9 +1090,11 @@ void ieee80211_tx_status_ext(struct ieee
41 struct ieee80211_tx_info *info = status->info;
42 struct ieee80211_sta *pubsta = status->sta;
43 struct ieee80211_supported_band *sband;
44 - struct sta_info *sta;
45 + struct sk_buff *skb = status->skb;
46 + struct sta_info *sta = NULL;
47 int rates_idx, retry_count;
48 bool acked, noack_success;
52 sta = container_of(pubsta, struct sta_info, sta);
53 @@ -1156,7 +1146,18 @@ void ieee80211_tx_status_ext(struct ieee
54 ieee80211s_update_metric(local, sta, status);
58 + if (skb && (tx_time_est = ieee80211_info_get_tx_time_est(info)) > 0) {
59 + /* Do this here to avoid the expensive lookup of the sta
60 + * in ieee80211_report_used_skb().
62 + ieee80211_sta_update_pending_airtime(local, sta,
63 + skb_get_queue_mapping(skb),
66 + ieee80211_info_set_tx_time_est(info, 0);
69 + if (skb && !(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP))
70 return __ieee80211_tx_status(hw, status, rates_idx,
73 @@ -1171,6 +1172,12 @@ void ieee80211_tx_status_ext(struct ieee
75 I802_DEBUG_INC(local->dot11FailedCount);
81 + ieee80211_report_used_skb(local, skb, false);
84 EXPORT_SYMBOL(ieee80211_tx_status_ext);
86 @@ -1197,66 +1204,23 @@ void ieee80211_tx_status_8023(struct iee
87 struct ieee80211_vif *vif,
90 - struct ieee80211_local *local = hw_to_local(hw);
91 struct ieee80211_sub_if_data *sdata;
92 - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
93 + struct ieee80211_tx_status status = {
95 + .info = IEEE80211_SKB_CB(skb),
102 sdata = vif_to_sdata(vif);
104 - acked = info->flags & IEEE80211_TX_STAT_ACK;
105 - rates_idx = ieee80211_tx_get_rates(hw, info, &retry_count);
109 - if (ieee80211_lookup_ra_sta(sdata, skb, &sta))
110 - goto counters_update;
113 - goto counters_update;
116 - sta->status_stats.retry_failed++;
118 - if (rates_idx != -1)
119 - sta->tx_stats.last_rate = info->status.rates[rates_idx];
121 - sta->status_stats.retry_count += retry_count;
123 - if (ieee80211_hw_check(hw, REPORTS_TX_ACK_STATUS)) {
124 - sta->status_stats.last_ack = jiffies;
125 - if (info->flags & IEEE80211_TX_STAT_ACK) {
126 - if (sta->status_stats.lost_packets)
127 - sta->status_stats.lost_packets = 0;
128 + if (!ieee80211_lookup_ra_sta(sdata, skb, &sta) && !IS_ERR(sta))
129 + status.sta = &sta->sta;
131 - sta->status_stats.last_pkt_time = jiffies;
133 - ieee80211_lost_packet(sta, info);
136 + ieee80211_tx_status_ext(hw, &status);
140 - ieee80211_led_tx(local);
142 - if (!(info->flags & IEEE80211_TX_STAT_ACK) &&
143 - !(info->flags & IEEE80211_TX_STAT_NOACK_TRANSMITTED))
144 - goto skip_stats_update;
146 - I802_DEBUG_INC(local->dot11TransmittedFrameCount);
147 - if (is_multicast_ether_addr(skb->data))
148 - I802_DEBUG_INC(local->dot11MulticastTransmittedFrameCount);
149 - if (retry_count > 0)
150 - I802_DEBUG_INC(local->dot11RetryCount);
151 - if (retry_count > 1)
152 - I802_DEBUG_INC(local->dot11MultipleRetryCount);
155 - ieee80211_report_used_skb(local, skb, false);
156 - dev_kfree_skb(skb);
158 EXPORT_SYMBOL(ieee80211_tx_status_8023);