Skip to content

Commit 7e1cdcb

Browse files
Felix Fietkaujmberg-intel
authored andcommitted
mac0211: add a helper function for fixing up tx status rates
Signed-off-by: Felix Fietkau <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
1 parent ad9dda6 commit 7e1cdcb

File tree

1 file changed

+33
-19
lines changed

1 file changed

+33
-19
lines changed

net/mac80211/status.c

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -621,24 +621,13 @@ static void ieee80211_lost_packet(struct sta_info *sta,
621621
sta->lost_packets = 0;
622622
}
623623

624-
void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
624+
static int ieee80211_tx_get_rates(struct ieee80211_hw *hw,
625+
struct ieee80211_tx_info *info,
626+
int *retry_count)
625627
{
626-
struct sk_buff *skb2;
627-
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
628-
struct ieee80211_local *local = hw_to_local(hw);
629-
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
630-
__le16 fc;
631-
struct ieee80211_supported_band *sband;
632-
struct ieee80211_sub_if_data *sdata;
633-
struct net_device *prev_dev = NULL;
634-
struct sta_info *sta, *tmp;
635-
int retry_count = -1, i;
636628
int rates_idx = -1;
637-
bool send_to_cooked;
638-
bool acked;
639-
struct ieee80211_bar *bar;
640-
int rtap_len;
641-
int shift = 0;
629+
int count = -1;
630+
int i;
642631

643632
for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
644633
if ((info->flags & IEEE80211_TX_CTL_AMPDU) &&
@@ -656,12 +645,37 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
656645
break;
657646
}
658647

659-
retry_count += info->status.rates[i].count;
648+
count += info->status.rates[i].count;
660649
}
661650
rates_idx = i - 1;
662651

663-
if (retry_count < 0)
664-
retry_count = 0;
652+
if (count < 0)
653+
count = 0;
654+
655+
*retry_count = count;
656+
return rates_idx;
657+
}
658+
659+
void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
660+
{
661+
struct sk_buff *skb2;
662+
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
663+
struct ieee80211_local *local = hw_to_local(hw);
664+
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
665+
__le16 fc;
666+
struct ieee80211_supported_band *sband;
667+
struct ieee80211_sub_if_data *sdata;
668+
struct net_device *prev_dev = NULL;
669+
struct sta_info *sta, *tmp;
670+
int retry_count;
671+
int rates_idx;
672+
bool send_to_cooked;
673+
bool acked;
674+
struct ieee80211_bar *bar;
675+
int rtap_len;
676+
int shift = 0;
677+
678+
rates_idx = ieee80211_tx_get_rates(hw, info, &retry_count);
665679

666680
rcu_read_lock();
667681

0 commit comments

Comments
 (0)