| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- From: Felix Fietkau <[email protected]>
- Date: Mon, 17 Aug 2020 13:16:59 +0200
- Subject: [PATCH] mac80211: reduce duplication in tx status functions
- Move redundant functionality from __ieee80211_tx_status into
- ieee80211_tx_status_ext. Preparation for unifying with the 802.3 tx status
- codepath.
- Signed-off-by: Felix Fietkau <[email protected]>
- ---
- --- a/net/mac80211/status.c
- +++ b/net/mac80211/status.c
- @@ -184,18 +184,6 @@ static void ieee80211_frame_acked(struct
- struct ieee80211_mgmt *mgmt = (void *) skb->data;
- struct ieee80211_local *local = sta->local;
- struct ieee80211_sub_if_data *sdata = sta->sdata;
- - struct ieee80211_tx_info *txinfo = IEEE80211_SKB_CB(skb);
- -
- - if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) {
- - sta->status_stats.last_ack = jiffies;
- - if (txinfo->status.is_valid_ack_signal) {
- - sta->status_stats.last_ack_signal =
- - (s8)txinfo->status.ack_signal;
- - sta->status_stats.ack_signal_filled = true;
- - ewma_avg_signal_add(&sta->status_stats.avg_ack_signal,
- - -txinfo->status.ack_signal);
- - }
- - }
-
- if (ieee80211_is_data_qos(mgmt->frame_control)) {
- struct ieee80211_hdr *hdr = (void *) skb->data;
- @@ -897,7 +885,8 @@ void ieee80211_tx_monitor(struct ieee802
- }
-
- static void __ieee80211_tx_status(struct ieee80211_hw *hw,
- - struct ieee80211_tx_status *status)
- + struct ieee80211_tx_status *status,
- + int rates_idx, int retry_count)
- {
- struct sk_buff *skb = status->skb;
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
- @@ -906,8 +895,6 @@ static void __ieee80211_tx_status(struct
- struct sta_info *sta;
- __le16 fc;
- struct ieee80211_supported_band *sband;
- - int retry_count;
- - int rates_idx;
- bool send_to_cooked;
- bool acked;
- bool noack_success;
- @@ -916,8 +903,6 @@ static void __ieee80211_tx_status(struct
- int tid = IEEE80211_NUM_TIDS;
- u16 tx_time_est;
-
- - rates_idx = ieee80211_tx_get_rates(hw, info, &retry_count);
- -
- sband = local->hw.wiphy->bands[info->band];
- fc = hdr->frame_control;
-
- @@ -994,24 +979,14 @@ static void __ieee80211_tx_status(struct
- if (info->flags & IEEE80211_TX_STAT_TX_FILTERED) {
- ieee80211_handle_filtered_frame(local, sta, skb);
- return;
- - } else {
- + } else if (ieee80211_is_data_present(fc)) {
- if (!acked && !noack_success)
- - sta->status_stats.retry_failed++;
- - sta->status_stats.retry_count += retry_count;
- + sta->status_stats.msdu_failed[tid]++;
-
- - if (ieee80211_is_data_present(fc)) {
- - if (!acked && !noack_success)
- - sta->status_stats.msdu_failed[tid]++;
- -
- - sta->status_stats.msdu_retries[tid] +=
- - retry_count;
- - }
- + sta->status_stats.msdu_retries[tid] +=
- + retry_count;
- }
-
- - rate_control_tx_status(local, sband, status);
- - if (ieee80211_vif_is_mesh(&sta->sdata->vif))
- - ieee80211s_update_metric(local, sta, status);
- -
- if (!(info->flags & IEEE80211_TX_CTL_INJECTED) && acked)
- ieee80211_frame_acked(sta, skb);
-
- @@ -1036,20 +1011,6 @@ static void __ieee80211_tx_status(struct
- true);
- ieee80211_info_set_tx_time_est(info, 0);
- }
- -
- - if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) {
- - if (acked) {
- - if (sta->status_stats.lost_packets)
- - sta->status_stats.lost_packets = 0;
- -
- - /* Track when last TDLS packet was ACKed */
- - sta->status_stats.last_pkt_time = jiffies;
- - } else if (noack_success) {
- - /* nothing to do here, do not account as lost */
- - } else {
- - ieee80211_lost_packet(sta, info);
- - }
- - }
- }
-
- /* SNMP counters
- @@ -1133,7 +1094,7 @@ void ieee80211_tx_status(struct ieee8021
- if (sta)
- status.sta = &sta->sta;
-
- - __ieee80211_tx_status(hw, &status);
- + ieee80211_tx_status_ext(hw, &status);
- rcu_read_unlock();
- }
- EXPORT_SYMBOL(ieee80211_tx_status);
- @@ -1146,7 +1107,7 @@ void ieee80211_tx_status_ext(struct ieee
- struct ieee80211_sta *pubsta = status->sta;
- struct ieee80211_supported_band *sband;
- struct sta_info *sta;
- - int retry_count;
- + int rates_idx, retry_count;
- bool acked, noack_success;
-
- if (pubsta) {
- @@ -1156,13 +1117,7 @@ void ieee80211_tx_status_ext(struct ieee
- sta->tx_stats.last_rate_info = *status->rate;
- }
-
- - if (status->skb)
- - return __ieee80211_tx_status(hw, status);
- -
- - if (!status->sta)
- - return;
- -
- - ieee80211_tx_get_rates(hw, info, &retry_count);
- + rates_idx = ieee80211_tx_get_rates(hw, info, &retry_count);
-
- sband = hw->wiphy->bands[info->band];
-
- @@ -1174,20 +1129,30 @@ void ieee80211_tx_status_ext(struct ieee
- sta->status_stats.retry_failed++;
- sta->status_stats.retry_count += retry_count;
-
- - if (acked) {
- - sta->status_stats.last_ack = jiffies;
- + if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) {
- + if (acked) {
- + sta->status_stats.last_ack = jiffies;
-
- - if (sta->status_stats.lost_packets)
- - sta->status_stats.lost_packets = 0;
- + if (sta->status_stats.lost_packets)
- + sta->status_stats.lost_packets = 0;
-
- - /* Track when last packet was ACKed */
- - sta->status_stats.last_pkt_time = jiffies;
- - } else if (test_sta_flag(sta, WLAN_STA_PS_STA)) {
- - return;
- - } else if (noack_success) {
- - /* nothing to do here, do not account as lost */
- - } else {
- - ieee80211_lost_packet(sta, info);
- + /* Track when last packet was ACKed */
- + sta->status_stats.last_pkt_time = jiffies;
- +
- + if (info->status.is_valid_ack_signal) {
- + sta->status_stats.last_ack_signal =
- + (s8)info->status.ack_signal;
- + sta->status_stats.ack_signal_filled = true;
- + ewma_avg_signal_add(&sta->status_stats.avg_ack_signal,
- + -info->status.ack_signal);
- + }
- + } else if (test_sta_flag(sta, WLAN_STA_PS_STA)) {
- + return;
- + } else if (noack_success) {
- + /* nothing to do here, do not account as lost */
- + } else {
- + ieee80211_lost_packet(sta, info);
- + }
- }
-
- rate_control_tx_status(local, sband, status);
- @@ -1195,6 +1160,10 @@ void ieee80211_tx_status_ext(struct ieee
- ieee80211s_update_metric(local, sta, status);
- }
-
- + if (status->skb)
- + return __ieee80211_tx_status(hw, status, rates_idx,
- + retry_count);
- +
- if (acked || noack_success) {
- I802_DEBUG_INC(local->dot11TransmittedFrameCount);
- if (!pubsta)
|