From: Johannes Berg <johannes@sipsolutions.net>
To: linux-wireless@vger.kernel.org
Cc: John Linville <linville@tuxdriver.com>,
Johannes Berg <johannes.berg@intel.com>
Subject: [PATCH 3/5] mac80211: clean up rx handling wrt. found_sta
Date: Fri, 24 Sep 2010 11:21:07 +0200 [thread overview]
Message-ID: <20100924092305.834557819@sipsolutions.net> (raw)
In-Reply-To: 20100924092104.384954781@sipsolutions.net
From: Johannes Berg <johannes.berg@intel.com>
If a station was found, then we'll have exited
the function already, so it is not necessary to
have a variable keeping track of it.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
net/mac80211/rx.c | 60 ++++++++++++++++++++++++------------------------------
1 file changed, 27 insertions(+), 33 deletions(-)
--- wireless-testing.orig/net/mac80211/rx.c 2010-09-24 11:02:53.000000000 +0200
+++ wireless-testing/net/mac80211/rx.c 2010-09-24 11:03:09.000000000 +0200
@@ -2651,7 +2651,6 @@ static void __ieee80211_rx_handle_packet
struct ieee80211_rx_data rx;
struct ieee80211_sub_if_data *prev;
struct sta_info *sta, *tmp, *prev_sta;
- bool found_sta = false;
int err = 0;
fc = ((struct ieee80211_hdr *)skb->data)->frame_control;
@@ -2684,8 +2683,6 @@ static void __ieee80211_rx_handle_packet
prev_sta = NULL;
for_each_sta_info(local, hdr->addr2, sta, tmp) {
- found_sta = true;
-
if (!prev_sta) {
prev_sta = sta;
continue;
@@ -2707,43 +2704,40 @@ static void __ieee80211_rx_handle_packet
}
}
- if (!found_sta) {
- prev = NULL;
-
- list_for_each_entry_rcu(sdata, &local->interfaces, list) {
- if (!ieee80211_sdata_running(sdata))
- continue;
-
- if (sdata->vif.type == NL80211_IFTYPE_MONITOR ||
- sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
- continue;
-
- /*
- * frame is destined for this interface, but if it's
- * not also for the previous one we handle that after
- * the loop to avoid copying the SKB once too much
- */
+ prev = NULL;
- if (!prev) {
- prev = sdata;
- continue;
- }
-
- rx.sta = sta_info_get_bss(prev, hdr->addr2);
- rx.sdata = prev;
- ieee80211_prepare_and_rx_handle(&rx, skb, false);
+ list_for_each_entry_rcu(sdata, &local->interfaces, list) {
+ if (!ieee80211_sdata_running(sdata))
+ continue;
+
+ if (sdata->vif.type == NL80211_IFTYPE_MONITOR ||
+ sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
+ continue;
+
+ /*
+ * frame is destined for this interface, but if it's
+ * not also for the previous one we handle that after
+ * the loop to avoid copying the SKB once too much
+ */
+ if (!prev) {
prev = sdata;
+ continue;
}
- if (prev) {
- rx.sta = sta_info_get_bss(prev, hdr->addr2);
- rx.sdata = prev;
+ rx.sta = sta_info_get_bss(prev, hdr->addr2);
+ rx.sdata = prev;
+ ieee80211_prepare_and_rx_handle(&rx, skb, false);
- if (ieee80211_prepare_and_rx_handle(&rx, skb, true))
- return;
- }
+ prev = sdata;
+ }
+
+ if (prev) {
+ rx.sta = sta_info_get_bss(prev, hdr->addr2);
+ rx.sdata = prev;
+ if (ieee80211_prepare_and_rx_handle(&rx, skb, true))
+ return;
}
dev_kfree_skb(skb);
next prev parent reply other threads:[~2010-09-24 9:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-24 9:21 [PATCH 0/5] mac80211 cleanups & fixes Johannes Berg
2010-09-24 9:21 ` [PATCH 1/5] mac80211: remove prepare_for_handlers sdata argument Johannes Berg
2010-09-24 9:21 ` [PATCH 2/5] mac80211: consolidate packet processing Johannes Berg
2010-09-24 9:21 ` Johannes Berg [this message]
2010-09-24 9:21 ` [PATCH 4/5] mac80211: fix release_reorder_timeout in scan Johannes Berg
2010-09-24 9:21 ` [PATCH 5/5] mac80211: move packet flags into packet Johannes Berg
2010-09-24 10:38 ` [PATCH 5/5 v2] " Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100924092305.834557819@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=johannes.berg@intel.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).