Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit be7974aa authored by Helmut Schaa's avatar Helmut Schaa Committed by John W. Linville
Browse files

mac80211: Minor optimization in tx status handling



ieee80211_tx_status iterates over all tx rates the driver reports back
in order to
1) mark tx rates as invalid if the driver cannot have tried that rate
2) find the actually used tx rate for the final retransmission

By leaving the for loop when the first invalid rate index is found we
can move the rates_idx assignment after the loop and therefore save
a few assignments and conditionals.

Signed-off-by: default avatarHelmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent a9cbe96d
Loading
Loading
Loading
Loading
+7 −4
Original line number Original line Diff line number Diff line
@@ -189,16 +189,19 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
	bool acked;
	bool acked;


	for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
	for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
		if (info->status.rates[i].idx < 0) {
			break;
		} else if (i >= hw->max_report_rates) {
			/* the HW cannot have attempted that rate */
			/* the HW cannot have attempted that rate */
		if (i >= hw->max_report_rates) {
			info->status.rates[i].idx = -1;
			info->status.rates[i].idx = -1;
			info->status.rates[i].count = 0;
			info->status.rates[i].count = 0;
		} else if (info->status.rates[i].idx >= 0) {
			break;
			rates_idx = i;
		}
		}


		retry_count += info->status.rates[i].count;
		retry_count += info->status.rates[i].count;
	}
	}
	rates_idx = i - 1;

	if (retry_count < 0)
	if (retry_count < 0)
		retry_count = 0;
		retry_count = 0;