mac80211: clean up rx handling wrt. found_sta

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>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Johannes Berg 2010-09-24 11:21:07 +02:00 committed by John W. Linville
parent 4406c37689
commit 4b0dd98e70
1 changed files with 25 additions and 31 deletions

View File

@ -2651,7 +2651,6 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
struct ieee80211_rx_data rx; struct ieee80211_rx_data rx;
struct ieee80211_sub_if_data *prev; struct ieee80211_sub_if_data *prev;
struct sta_info *sta, *tmp, *prev_sta; struct sta_info *sta, *tmp, *prev_sta;
bool found_sta = false;
int err = 0; int err = 0;
fc = ((struct ieee80211_hdr *)skb->data)->frame_control; fc = ((struct ieee80211_hdr *)skb->data)->frame_control;
@ -2684,8 +2683,6 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
prev_sta = NULL; prev_sta = NULL;
for_each_sta_info(local, hdr->addr2, sta, tmp) { for_each_sta_info(local, hdr->addr2, sta, tmp) {
found_sta = true;
if (!prev_sta) { if (!prev_sta) {
prev_sta = sta; prev_sta = sta;
continue; continue;
@ -2707,43 +2704,40 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
} }
} }
if (!found_sta) { prev = NULL;
prev = NULL;
list_for_each_entry_rcu(sdata, &local->interfaces, list) { list_for_each_entry_rcu(sdata, &local->interfaces, list) {
if (!ieee80211_sdata_running(sdata)) if (!ieee80211_sdata_running(sdata))
continue; continue;
if (sdata->vif.type == NL80211_IFTYPE_MONITOR || if (sdata->vif.type == NL80211_IFTYPE_MONITOR ||
sdata->vif.type == NL80211_IFTYPE_AP_VLAN) sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
continue; continue;
/* /*
* frame is destined for this interface, but if it's * frame is destined for this interface, but if it's
* not also for the previous one we handle that after * not also for the previous one we handle that after
* the loop to avoid copying the SKB once too much * the loop to avoid copying the SKB once too much
*/ */
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);
if (!prev) {
prev = sdata; prev = sdata;
continue;
} }
if (prev) { rx.sta = sta_info_get_bss(prev, hdr->addr2);
rx.sta = sta_info_get_bss(prev, hdr->addr2); rx.sdata = prev;
rx.sdata = prev; ieee80211_prepare_and_rx_handle(&rx, skb, false);
if (ieee80211_prepare_and_rx_handle(&rx, skb, true)) prev = sdata;
return; }
}
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); dev_kfree_skb(skb);