aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/rx.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-01-31 13:48:26 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-02-29 15:37:03 -0500
commit8944b79fe9b1fe249c599e7e51f1bfad539aab6d (patch)
tree3a3b0e66b44c874306ca81f1ff24177c74a19354 /net/mac80211/rx.c
parent589052904a60f00dd2cbc1d3488ee3f520a7de21 (diff)
mac80211: move some code into ieee80211_invoke_rx_handlers
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> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/rx.c')
-rw-r--r--net/mac80211/rx.c42
1 files changed, 18 insertions, 24 deletions
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 0ab9fef8ea8b..3a3112f17832 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1450,7 +1450,6 @@ ieee80211_rx_h_mgmt(struct ieee80211_txrx_data *rx)
1450 1450
1451static void ieee80211_rx_michael_mic_report(struct net_device *dev, 1451static void ieee80211_rx_michael_mic_report(struct net_device *dev,
1452 struct ieee80211_hdr *hdr, 1452 struct ieee80211_hdr *hdr,
1453 struct sta_info *sta,
1454 struct ieee80211_txrx_data *rx) 1453 struct ieee80211_txrx_data *rx)
1455{ 1454{
1456 int keyidx, hdrlen; 1455 int keyidx, hdrlen;
@@ -1469,7 +1468,7 @@ static void ieee80211_rx_michael_mic_report(struct net_device *dev,
1469 dev->name, print_mac(mac, hdr->addr2), 1468 dev->name, print_mac(mac, hdr->addr2),
1470 print_mac(mac2, hdr->addr1), keyidx); 1469 print_mac(mac2, hdr->addr1), keyidx);
1471 1470
1472 if (!sta) { 1471 if (!rx->sta) {
1473 /* 1472 /*
1474 * Some hardware seem to generate incorrect Michael MIC 1473 * Some hardware seem to generate incorrect Michael MIC
1475 * reports; ignore them to avoid triggering countermeasures. 1474 * reports; ignore them to avoid triggering countermeasures.
@@ -1544,13 +1543,17 @@ static ieee80211_rx_handler ieee80211_rx_handlers[] =
1544 NULL 1543 NULL
1545}; 1544};
1546 1545
1547static void ieee80211_invoke_rx_handlers(struct ieee80211_local *local, 1546static void ieee80211_invoke_rx_handlers(struct ieee80211_sub_if_data *sdata,
1548 struct ieee80211_txrx_data *rx, 1547 struct ieee80211_txrx_data *rx,
1549 struct sta_info *sta) 1548 struct sk_buff *skb)
1550{ 1549{
1551 ieee80211_rx_handler *handler; 1550 ieee80211_rx_handler *handler;
1552 ieee80211_rx_result res = RX_DROP_MONITOR; 1551 ieee80211_rx_result res = RX_DROP_MONITOR;
1553 1552
1553 rx->skb = skb;
1554 rx->sdata = sdata;
1555 rx->dev = sdata->dev;
1556
1554 for (handler = ieee80211_rx_handlers; *handler != NULL; handler++) { 1557 for (handler = ieee80211_rx_handlers; *handler != NULL; handler++) {
1555 res = (*handler)(rx); 1558 res = (*handler)(rx);
1556 1559
@@ -1559,12 +1562,12 @@ static void ieee80211_invoke_rx_handlers(struct ieee80211_local *local,
1559 continue; 1562 continue;
1560 case RX_DROP_UNUSABLE: 1563 case RX_DROP_UNUSABLE:
1561 case RX_DROP_MONITOR: 1564 case RX_DROP_MONITOR:
1562 I802_DEBUG_INC(local->rx_handlers_drop); 1565 I802_DEBUG_INC(sdata->local->rx_handlers_drop);
1563 if (sta) 1566 if (rx->sta)
1564 sta->rx_dropped++; 1567 rx->sta->rx_dropped++;
1565 break; 1568 break;
1566 case RX_QUEUED: 1569 case RX_QUEUED:
1567 I802_DEBUG_INC(local->rx_handlers_queued); 1570 I802_DEBUG_INC(sdata->local->rx_handlers_queued);
1568 break; 1571 break;
1569 } 1572 }
1570 break; 1573 break;
@@ -1669,7 +1672,6 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
1669{ 1672{
1670 struct ieee80211_local *local = hw_to_local(hw); 1673 struct ieee80211_local *local = hw_to_local(hw);
1671 struct ieee80211_sub_if_data *sdata; 1674 struct ieee80211_sub_if_data *sdata;
1672 struct sta_info *sta;
1673 struct ieee80211_hdr *hdr; 1675 struct ieee80211_hdr *hdr;
1674 struct ieee80211_txrx_data rx; 1676 struct ieee80211_txrx_data rx;
1675 u16 type; 1677 u16 type;
@@ -1692,14 +1694,14 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
1692 if (type == IEEE80211_FTYPE_DATA || type == IEEE80211_FTYPE_MGMT) 1694 if (type == IEEE80211_FTYPE_DATA || type == IEEE80211_FTYPE_MGMT)
1693 local->dot11ReceivedFragmentCount++; 1695 local->dot11ReceivedFragmentCount++;
1694 1696
1695 sta = rx.sta = sta_info_get(local, hdr->addr2); 1697 rx.sta = sta_info_get(local, hdr->addr2);
1696 if (sta) { 1698 if (rx.sta) {
1697 rx.dev = rx.sta->dev; 1699 rx.dev = rx.sta->dev;
1698 rx.sdata = IEEE80211_DEV_TO_SUB_IF(rx.dev); 1700 rx.sdata = IEEE80211_DEV_TO_SUB_IF(rx.dev);
1699 } 1701 }
1700 1702
1701 if ((status->flag & RX_FLAG_MMIC_ERROR)) { 1703 if ((status->flag & RX_FLAG_MMIC_ERROR)) {
1702 ieee80211_rx_michael_mic_report(local->mdev, hdr, sta, &rx); 1704 ieee80211_rx_michael_mic_report(local->mdev, hdr, &rx);
1703 goto end; 1705 goto end;
1704 } 1706 }
1705 1707
@@ -1721,8 +1723,6 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
1721 bssid = ieee80211_get_bssid(hdr, skb->len, sdata->vif.type); 1723 bssid = ieee80211_get_bssid(hdr, skb->len, sdata->vif.type);
1722 rx.flags |= IEEE80211_TXRXD_RXRA_MATCH; 1724 rx.flags |= IEEE80211_TXRXD_RXRA_MATCH;
1723 prepares = prepare_for_handlers(sdata, bssid, &rx, hdr); 1725 prepares = prepare_for_handlers(sdata, bssid, &rx, hdr);
1724 /* prepare_for_handlers can change sta */
1725 sta = rx.sta;
1726 1726
1727 if (!prepares) 1727 if (!prepares)
1728 continue; 1728 continue;
@@ -1753,24 +1753,18 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
1753 continue; 1753 continue;
1754 } 1754 }
1755 rx.fc = le16_to_cpu(hdr->frame_control); 1755 rx.fc = le16_to_cpu(hdr->frame_control);
1756 rx.skb = skb_new; 1756 ieee80211_invoke_rx_handlers(prev, &rx, skb_new);
1757 rx.dev = prev->dev;
1758 rx.sdata = prev;
1759 ieee80211_invoke_rx_handlers(local, &rx, sta);
1760 prev = sdata; 1757 prev = sdata;
1761 } 1758 }
1762 if (prev) { 1759 if (prev) {
1763 rx.fc = le16_to_cpu(hdr->frame_control); 1760 rx.fc = le16_to_cpu(hdr->frame_control);
1764 rx.skb = skb; 1761 ieee80211_invoke_rx_handlers(prev, &rx, skb);
1765 rx.dev = prev->dev;
1766 rx.sdata = prev;
1767 ieee80211_invoke_rx_handlers(local, &rx, sta);
1768 } else 1762 } else
1769 dev_kfree_skb(skb); 1763 dev_kfree_skb(skb);
1770 1764
1771 end: 1765 end:
1772 if (sta) 1766 if (rx.sta)
1773 sta_info_put(sta); 1767 sta_info_put(rx.sta);
1774} 1768}
1775 1769
1776#define SEQ_MODULO 0x1000 1770#define SEQ_MODULO 0x1000