Commit eaf55530 authored by Felix Fietkau's avatar Felix Fietkau Committed by John W. Linville

mac80211: optimize tx status processing

When a cooked monitor interface is active, ieee80211_tx_status()
generates a radiotap header for every single frame, even if it wasn't
injected and thus won't be sent to a monitor interface.
This patch reduces cpu utilization by moving the cooked monitor check a
bit earlier, before it generates the rtap header.
Signed-off-by: default avatarFelix Fietkau <nbd@openwrt.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 819cf15e
...@@ -171,7 +171,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) ...@@ -171,7 +171,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
struct net_device *prev_dev = NULL; struct net_device *prev_dev = NULL;
struct sta_info *sta, *tmp; struct sta_info *sta, *tmp;
int retry_count = -1, i; int retry_count = -1, i;
bool injected; bool send_to_cooked;
for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
/* the HW cannot have attempted that rate */ /* the HW cannot have attempted that rate */
...@@ -296,11 +296,15 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) ...@@ -296,11 +296,15 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
/* this was a transmitted frame, but now we want to reuse it */ /* this was a transmitted frame, but now we want to reuse it */
skb_orphan(skb); skb_orphan(skb);
/* Need to make a copy before skb->cb gets cleared */
send_to_cooked = !!(info->flags & IEEE80211_TX_CTL_INJECTED) ||
(type != IEEE80211_FTYPE_DATA);
/* /*
* This is a bit racy but we can avoid a lot of work * This is a bit racy but we can avoid a lot of work
* with this test... * with this test...
*/ */
if (!local->monitors && !local->cooked_mntrs) { if (!local->monitors && (!send_to_cooked || !local->cooked_mntrs)) {
dev_kfree_skb(skb); dev_kfree_skb(skb);
return; return;
} }
...@@ -345,9 +349,6 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) ...@@ -345,9 +349,6 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
/* for now report the total retry_count */ /* for now report the total retry_count */
rthdr->data_retries = retry_count; rthdr->data_retries = retry_count;
/* Need to make a copy before skb->cb gets cleared */
injected = !!(info->flags & IEEE80211_TX_CTL_INJECTED);
/* XXX: is this sufficient for BPF? */ /* XXX: is this sufficient for BPF? */
skb_set_mac_header(skb, 0); skb_set_mac_header(skb, 0);
skb->ip_summed = CHECKSUM_UNNECESSARY; skb->ip_summed = CHECKSUM_UNNECESSARY;
...@@ -362,8 +363,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) ...@@ -362,8 +363,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
continue; continue;
if ((sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) && if ((sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) &&
!injected && !send_to_cooked)
(type == IEEE80211_FTYPE_DATA))
continue; continue;
if (prev_dev) { if (prev_dev) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment