From patchwork Fri Sep 24 09:21:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 204052 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o8O9Nq36006626 for ; Fri, 24 Sep 2010 09:23:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755176Ab0IXJXu (ORCPT ); Fri, 24 Sep 2010 05:23:50 -0400 Received: from he.sipsolutions.net ([78.46.109.217]:39978 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752960Ab0IXJXt (ORCPT ); Fri, 24 Sep 2010 05:23:49 -0400 Received: by sipsolutions.net with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1Oz4VQ-0003Bc-KK; Fri, 24 Sep 2010 11:23:48 +0200 Message-Id: <20100924092305.834557819@sipsolutions.net> User-Agent: quilt/0.48-1 Date: Fri, 24 Sep 2010 11:21:07 +0200 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: John Linville , Johannes Berg Subject: [PATCH 3/5] mac80211: clean up rx handling wrt. found_sta References: <20100924092104.384954781@sipsolutions.net> Content-Disposition: inline; filename=012-mac80211-cleanup-found-sta.patch Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Fri, 24 Sep 2010 09:23:52 +0000 (UTC) --- 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);