mac80211: fix throughput LED trigger

The codepaths for rx with decap offload and tx with itxq were not updating
the counters for the throughput led trigger.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Link: https://lore.kernel.org/r/20211113063415.55147-1-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Felix Fietkau 2021-11-13 07:34:15 +01:00 committed by Johannes Berg
parent 6dd2360334
commit 30f6cf9691
3 changed files with 23 additions and 26 deletions

View File

@ -72,19 +72,19 @@ static inline void ieee80211_mod_tpt_led_trig(struct ieee80211_local *local,
#endif #endif
static inline void static inline void
ieee80211_tpt_led_trig_tx(struct ieee80211_local *local, __le16 fc, int bytes) ieee80211_tpt_led_trig_tx(struct ieee80211_local *local, int bytes)
{ {
#ifdef CONFIG_MAC80211_LEDS #ifdef CONFIG_MAC80211_LEDS
if (ieee80211_is_data(fc) && atomic_read(&local->tpt_led_active)) if (atomic_read(&local->tpt_led_active))
local->tpt_led_trigger->tx_bytes += bytes; local->tpt_led_trigger->tx_bytes += bytes;
#endif #endif
} }
static inline void static inline void
ieee80211_tpt_led_trig_rx(struct ieee80211_local *local, __le16 fc, int bytes) ieee80211_tpt_led_trig_rx(struct ieee80211_local *local, int bytes)
{ {
#ifdef CONFIG_MAC80211_LEDS #ifdef CONFIG_MAC80211_LEDS
if (ieee80211_is_data(fc) && atomic_read(&local->tpt_led_active)) if (atomic_read(&local->tpt_led_active))
local->tpt_led_trigger->rx_bytes += bytes; local->tpt_led_trigger->rx_bytes += bytes;
#endif #endif
} }

View File

@ -4864,6 +4864,7 @@ void ieee80211_rx_list(struct ieee80211_hw *hw, struct ieee80211_sta *pubsta,
struct ieee80211_rate *rate = NULL; struct ieee80211_rate *rate = NULL;
struct ieee80211_supported_band *sband; struct ieee80211_supported_band *sband;
struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
WARN_ON_ONCE(softirq_count() == 0); WARN_ON_ONCE(softirq_count() == 0);
@ -4960,9 +4961,9 @@ void ieee80211_rx_list(struct ieee80211_hw *hw, struct ieee80211_sta *pubsta,
if (!(status->flag & RX_FLAG_8023)) if (!(status->flag & RX_FLAG_8023))
skb = ieee80211_rx_monitor(local, skb, rate); skb = ieee80211_rx_monitor(local, skb, rate);
if (skb) { if (skb) {
ieee80211_tpt_led_trig_rx(local, if ((status->flag & RX_FLAG_8023) ||
((struct ieee80211_hdr *)skb->data)->frame_control, ieee80211_is_data_present(hdr->frame_control))
skb->len); ieee80211_tpt_led_trig_rx(local, skb->len);
if (status->flag & RX_FLAG_8023) if (status->flag & RX_FLAG_8023)
__ieee80211_rx_handle_8023(hw, pubsta, skb, list); __ieee80211_rx_handle_8023(hw, pubsta, skb, list);

View File

@ -1721,21 +1721,19 @@ static bool ieee80211_tx_frags(struct ieee80211_local *local,
* Returns false if the frame couldn't be transmitted but was queued instead. * Returns false if the frame couldn't be transmitted but was queued instead.
*/ */
static bool __ieee80211_tx(struct ieee80211_local *local, static bool __ieee80211_tx(struct ieee80211_local *local,
struct sk_buff_head *skbs, int led_len, struct sk_buff_head *skbs, struct sta_info *sta,
struct sta_info *sta, bool txpending) bool txpending)
{ {
struct ieee80211_tx_info *info; struct ieee80211_tx_info *info;
struct ieee80211_sub_if_data *sdata; struct ieee80211_sub_if_data *sdata;
struct ieee80211_vif *vif; struct ieee80211_vif *vif;
struct sk_buff *skb; struct sk_buff *skb;
bool result; bool result;
__le16 fc;
if (WARN_ON(skb_queue_empty(skbs))) if (WARN_ON(skb_queue_empty(skbs)))
return true; return true;
skb = skb_peek(skbs); skb = skb_peek(skbs);
fc = ((struct ieee80211_hdr *)skb->data)->frame_control;
info = IEEE80211_SKB_CB(skb); info = IEEE80211_SKB_CB(skb);
sdata = vif_to_sdata(info->control.vif); sdata = vif_to_sdata(info->control.vif);
if (sta && !sta->uploaded) if (sta && !sta->uploaded)
@ -1769,8 +1767,6 @@ static bool __ieee80211_tx(struct ieee80211_local *local,
result = ieee80211_tx_frags(local, vif, sta, skbs, txpending); result = ieee80211_tx_frags(local, vif, sta, skbs, txpending);
ieee80211_tpt_led_trig_tx(local, fc, led_len);
WARN_ON_ONCE(!skb_queue_empty(skbs)); WARN_ON_ONCE(!skb_queue_empty(skbs));
return result; return result;
@ -1920,7 +1916,6 @@ static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata,
ieee80211_tx_result res_prepare; ieee80211_tx_result res_prepare;
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
bool result = true; bool result = true;
int led_len;
if (unlikely(skb->len < 10)) { if (unlikely(skb->len < 10)) {
dev_kfree_skb(skb); dev_kfree_skb(skb);
@ -1928,7 +1923,6 @@ static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata,
} }
/* initialises tx */ /* initialises tx */
led_len = skb->len;
res_prepare = ieee80211_tx_prepare(sdata, &tx, sta, skb); res_prepare = ieee80211_tx_prepare(sdata, &tx, sta, skb);
if (unlikely(res_prepare == TX_DROP)) { if (unlikely(res_prepare == TX_DROP)) {
@ -1951,8 +1945,7 @@ static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata,
return true; return true;
if (!invoke_tx_handlers_late(&tx)) if (!invoke_tx_handlers_late(&tx))
result = __ieee80211_tx(local, &tx.skbs, led_len, result = __ieee80211_tx(local, &tx.skbs, tx.sta, txpending);
tx.sta, txpending);
return result; return result;
} }
@ -4175,6 +4168,7 @@ void __ieee80211_subif_start_xmit(struct sk_buff *skb,
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
struct sta_info *sta; struct sta_info *sta;
struct sk_buff *next; struct sk_buff *next;
int len = skb->len;
if (unlikely(skb->len < ETH_HLEN)) { if (unlikely(skb->len < ETH_HLEN)) {
kfree_skb(skb); kfree_skb(skb);
@ -4221,10 +4215,8 @@ void __ieee80211_subif_start_xmit(struct sk_buff *skb,
} }
} else { } else {
/* we cannot process non-linear frames on this path */ /* we cannot process non-linear frames on this path */
if (skb_linearize(skb)) { if (skb_linearize(skb))
kfree_skb(skb); goto out_free;
goto out;
}
/* the frame could be fragmented, software-encrypted, and other /* the frame could be fragmented, software-encrypted, and other
* things so we cannot really handle checksum offload with it - * things so we cannot really handle checksum offload with it -
@ -4258,7 +4250,10 @@ void __ieee80211_subif_start_xmit(struct sk_buff *skb,
goto out; goto out;
out_free: out_free:
kfree_skb(skb); kfree_skb(skb);
len = 0;
out: out:
if (len)
ieee80211_tpt_led_trig_tx(local, len);
rcu_read_unlock(); rcu_read_unlock();
} }
@ -4396,8 +4391,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
} }
static bool ieee80211_tx_8023(struct ieee80211_sub_if_data *sdata, static bool ieee80211_tx_8023(struct ieee80211_sub_if_data *sdata,
struct sk_buff *skb, int led_len, struct sk_buff *skb, struct sta_info *sta,
struct sta_info *sta,
bool txpending) bool txpending)
{ {
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
@ -4410,6 +4404,8 @@ static bool ieee80211_tx_8023(struct ieee80211_sub_if_data *sdata,
if (sta) if (sta)
sk_pacing_shift_update(skb->sk, local->hw.tx_sk_pacing_shift); sk_pacing_shift_update(skb->sk, local->hw.tx_sk_pacing_shift);
ieee80211_tpt_led_trig_tx(local, skb->len);
if (ieee80211_queue_skb(local, sdata, sta, skb)) if (ieee80211_queue_skb(local, sdata, sta, skb))
return true; return true;
@ -4498,7 +4494,7 @@ static void ieee80211_8023_xmit(struct ieee80211_sub_if_data *sdata,
if (key) if (key)
info->control.hw_key = &key->conf; info->control.hw_key = &key->conf;
ieee80211_tx_8023(sdata, skb, skb->len, sta, false); ieee80211_tx_8023(sdata, skb, sta, false);
return; return;
@ -4637,7 +4633,7 @@ static bool ieee80211_tx_pending_skb(struct ieee80211_local *local,
if (IS_ERR(sta) || (sta && !sta->uploaded)) if (IS_ERR(sta) || (sta && !sta->uploaded))
sta = NULL; sta = NULL;
result = ieee80211_tx_8023(sdata, skb, skb->len, sta, true); result = ieee80211_tx_8023(sdata, skb, sta, true);
} else { } else {
struct sk_buff_head skbs; struct sk_buff_head skbs;
@ -4647,7 +4643,7 @@ static bool ieee80211_tx_pending_skb(struct ieee80211_local *local,
hdr = (struct ieee80211_hdr *)skb->data; hdr = (struct ieee80211_hdr *)skb->data;
sta = sta_info_get(sdata, hdr->addr1); sta = sta_info_get(sdata, hdr->addr1);
result = __ieee80211_tx(local, &skbs, skb->len, sta, true); result = __ieee80211_tx(local, &skbs, sta, true);
} }
return result; return result;