From: Johannes Berg <johannes@sipsolutions.net>
To: John Linville <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH 7/8] mac80211: move some code into ieee80211_invoke_rx_handlers
Date: Thu, 31 Jan 2008 19:48:26 +0100 [thread overview]
Message-ID: <20080131185054.684023000@sipsolutions.net> (raw)
In-Reply-To: 20080131184819.103174000@sipsolutions.net
There is some duplicated code that sits in front of each function
call to ieee80211_invoke_rx_handlers() that can very well be part
of that function if it gets slightly different arguments.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
net/mac80211/rx.c | 42 ++++++++++++++++++------------------------
1 file changed, 18 insertions(+), 24 deletions(-)
--- everything.orig/net/mac80211/rx.c 2008-01-31 15:46:13.135794379 +0100
+++ everything/net/mac80211/rx.c 2008-01-31 19:26:11.032266928 +0100
@@ -1450,7 +1450,6 @@ ieee80211_rx_h_mgmt(struct ieee80211_txr
static void ieee80211_rx_michael_mic_report(struct net_device *dev,
struct ieee80211_hdr *hdr,
- struct sta_info *sta,
struct ieee80211_txrx_data *rx)
{
int keyidx, hdrlen;
@@ -1469,7 +1468,7 @@ static void ieee80211_rx_michael_mic_rep
dev->name, print_mac(mac, hdr->addr2),
print_mac(mac2, hdr->addr1), keyidx);
- if (!sta) {
+ if (!rx->sta) {
/*
* Some hardware seem to generate incorrect Michael MIC
* reports; ignore them to avoid triggering countermeasures.
@@ -1544,13 +1543,17 @@ static ieee80211_rx_handler ieee80211_rx
NULL
};
-static void ieee80211_invoke_rx_handlers(struct ieee80211_local *local,
+static void ieee80211_invoke_rx_handlers(struct ieee80211_sub_if_data *sdata,
struct ieee80211_txrx_data *rx,
- struct sta_info *sta)
+ struct sk_buff *skb)
{
ieee80211_rx_handler *handler;
ieee80211_rx_result res = RX_DROP_MONITOR;
+ rx->skb = skb;
+ rx->sdata = sdata;
+ rx->dev = sdata->dev;
+
for (handler = ieee80211_rx_handlers; *handler != NULL; handler++) {
res = (*handler)(rx);
@@ -1559,12 +1562,12 @@ static void ieee80211_invoke_rx_handlers
continue;
case RX_DROP_UNUSABLE:
case RX_DROP_MONITOR:
- I802_DEBUG_INC(local->rx_handlers_drop);
- if (sta)
- sta->rx_dropped++;
+ I802_DEBUG_INC(sdata->local->rx_handlers_drop);
+ if (rx->sta)
+ rx->sta->rx_dropped++;
break;
case RX_QUEUED:
- I802_DEBUG_INC(local->rx_handlers_queued);
+ I802_DEBUG_INC(sdata->local->rx_handlers_queued);
break;
}
break;
@@ -1669,7 +1672,6 @@ static void __ieee80211_rx_handle_packet
{
struct ieee80211_local *local = hw_to_local(hw);
struct ieee80211_sub_if_data *sdata;
- struct sta_info *sta;
struct ieee80211_hdr *hdr;
struct ieee80211_txrx_data rx;
u16 type;
@@ -1692,14 +1694,14 @@ static void __ieee80211_rx_handle_packet
if (type == IEEE80211_FTYPE_DATA || type == IEEE80211_FTYPE_MGMT)
local->dot11ReceivedFragmentCount++;
- sta = rx.sta = sta_info_get(local, hdr->addr2);
- if (sta) {
+ rx.sta = sta_info_get(local, hdr->addr2);
+ if (rx.sta) {
rx.dev = rx.sta->dev;
rx.sdata = IEEE80211_DEV_TO_SUB_IF(rx.dev);
}
if ((status->flag & RX_FLAG_MMIC_ERROR)) {
- ieee80211_rx_michael_mic_report(local->mdev, hdr, sta, &rx);
+ ieee80211_rx_michael_mic_report(local->mdev, hdr, &rx);
goto end;
}
@@ -1721,8 +1723,6 @@ static void __ieee80211_rx_handle_packet
bssid = ieee80211_get_bssid(hdr, skb->len, sdata->vif.type);
rx.flags |= IEEE80211_TXRXD_RXRA_MATCH;
prepares = prepare_for_handlers(sdata, bssid, &rx, hdr);
- /* prepare_for_handlers can change sta */
- sta = rx.sta;
if (!prepares)
continue;
@@ -1753,24 +1753,18 @@ static void __ieee80211_rx_handle_packet
continue;
}
rx.fc = le16_to_cpu(hdr->frame_control);
- rx.skb = skb_new;
- rx.dev = prev->dev;
- rx.sdata = prev;
- ieee80211_invoke_rx_handlers(local, &rx, sta);
+ ieee80211_invoke_rx_handlers(prev, &rx, skb_new);
prev = sdata;
}
if (prev) {
rx.fc = le16_to_cpu(hdr->frame_control);
- rx.skb = skb;
- rx.dev = prev->dev;
- rx.sdata = prev;
- ieee80211_invoke_rx_handlers(local, &rx, sta);
+ ieee80211_invoke_rx_handlers(prev, &rx, skb);
} else
dev_kfree_skb(skb);
end:
- if (sta)
- sta_info_put(sta);
+ if (rx.sta)
+ sta_info_put(rx.sta);
}
#define SEQ_MODULO 0x1000
--
next prev parent reply other threads:[~2008-02-01 12:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-31 18:48 [PATCH 0/8] AP mode is coming Johannes Berg
2008-01-31 18:48 ` [PATCH 1/8] mac80211: split ieee80211_txrx_result Johannes Berg
2008-01-31 18:48 ` [PATCH 2/8] mac80211: split RX_DROP Johannes Berg
2008-01-31 18:48 ` [PATCH 3/8] nl80211: Add monitor interface configuration flags Johannes Berg
2008-01-31 18:48 ` [PATCH 4/8] mac80211: Use monitor " Johannes Berg
2008-01-31 18:48 ` [PATCH 5/8] mac80211: clean up some things in the RX path Johannes Berg
2008-01-31 18:48 ` [PATCH 6/8] mac80211: remove "dynamic" RX/TX handlers Johannes Berg
2008-01-31 18:48 ` Johannes Berg [this message]
2008-01-31 18:48 ` [PATCH 8/8] mac80211: Add cooked monitor mode support 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=20080131185054.684023000@sipsolutions.net \
--to=johannes@sipsolutions.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.