aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/rx.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/rx.c')
-rw-r--r--net/mac80211/rx.c80
1 files changed, 39 insertions, 41 deletions
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 794917fccd9b..0ab9fef8ea8b 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1448,42 +1448,6 @@ ieee80211_rx_h_mgmt(struct ieee80211_txrx_data *rx)
1448 return RX_QUEUED; 1448 return RX_QUEUED;
1449} 1449}
1450 1450
1451static void ieee80211_invoke_rx_handlers(struct ieee80211_local *local,
1452 ieee80211_rx_handler *handlers,
1453 struct ieee80211_txrx_data *rx,
1454 struct sta_info *sta)
1455{
1456 ieee80211_rx_handler *handler;
1457 ieee80211_rx_result res = RX_DROP_MONITOR;
1458
1459 for (handler = handlers; *handler != NULL; handler++) {
1460 res = (*handler)(rx);
1461
1462 switch (res) {
1463 case RX_CONTINUE:
1464 continue;
1465 case RX_DROP_UNUSABLE:
1466 case RX_DROP_MONITOR:
1467 I802_DEBUG_INC(local->rx_handlers_drop);
1468 if (sta)
1469 sta->rx_dropped++;
1470 break;
1471 case RX_QUEUED:
1472 I802_DEBUG_INC(local->rx_handlers_queued);
1473 break;
1474 }
1475 break;
1476 }
1477
1478 switch (res) {
1479 case RX_DROP_MONITOR:
1480 case RX_DROP_UNUSABLE:
1481 case RX_CONTINUE:
1482 dev_kfree_skb(rx->skb);
1483 break;
1484 }
1485}
1486
1487static void ieee80211_rx_michael_mic_report(struct net_device *dev, 1451static void ieee80211_rx_michael_mic_report(struct net_device *dev,
1488 struct ieee80211_hdr *hdr, 1452 struct ieee80211_hdr *hdr,
1489 struct sta_info *sta, 1453 struct sta_info *sta,
@@ -1557,7 +1521,8 @@ static void ieee80211_rx_michael_mic_report(struct net_device *dev,
1557 rx->skb = NULL; 1521 rx->skb = NULL;
1558} 1522}
1559 1523
1560ieee80211_rx_handler ieee80211_rx_handlers[] = 1524typedef ieee80211_rx_result (*ieee80211_rx_handler)(struct ieee80211_txrx_data *);
1525static ieee80211_rx_handler ieee80211_rx_handlers[] =
1561{ 1526{
1562 ieee80211_rx_h_if_stats, 1527 ieee80211_rx_h_if_stats,
1563 ieee80211_rx_h_passive_scan, 1528 ieee80211_rx_h_passive_scan,
@@ -1579,6 +1544,41 @@ ieee80211_rx_handler ieee80211_rx_handlers[] =
1579 NULL 1544 NULL
1580}; 1545};
1581 1546
1547static void ieee80211_invoke_rx_handlers(struct ieee80211_local *local,
1548 struct ieee80211_txrx_data *rx,
1549 struct sta_info *sta)
1550{
1551 ieee80211_rx_handler *handler;
1552 ieee80211_rx_result res = RX_DROP_MONITOR;
1553
1554 for (handler = ieee80211_rx_handlers; *handler != NULL; handler++) {
1555 res = (*handler)(rx);
1556
1557 switch (res) {
1558 case RX_CONTINUE:
1559 continue;
1560 case RX_DROP_UNUSABLE:
1561 case RX_DROP_MONITOR:
1562 I802_DEBUG_INC(local->rx_handlers_drop);
1563 if (sta)
1564 sta->rx_dropped++;
1565 break;
1566 case RX_QUEUED:
1567 I802_DEBUG_INC(local->rx_handlers_queued);
1568 break;
1569 }
1570 break;
1571 }
1572
1573 switch (res) {
1574 case RX_DROP_MONITOR:
1575 case RX_DROP_UNUSABLE:
1576 case RX_CONTINUE:
1577 dev_kfree_skb(rx->skb);
1578 break;
1579 }
1580}
1581
1582/* main receive path */ 1582/* main receive path */
1583 1583
1584static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, 1584static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
@@ -1756,8 +1756,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
1756 rx.skb = skb_new; 1756 rx.skb = skb_new;
1757 rx.dev = prev->dev; 1757 rx.dev = prev->dev;
1758 rx.sdata = prev; 1758 rx.sdata = prev;
1759 ieee80211_invoke_rx_handlers(local, local->rx_handlers, 1759 ieee80211_invoke_rx_handlers(local, &rx, sta);
1760 &rx, sta);
1761 prev = sdata; 1760 prev = sdata;
1762 } 1761 }
1763 if (prev) { 1762 if (prev) {
@@ -1765,8 +1764,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
1765 rx.skb = skb; 1764 rx.skb = skb;
1766 rx.dev = prev->dev; 1765 rx.dev = prev->dev;
1767 rx.sdata = prev; 1766 rx.sdata = prev;
1768 ieee80211_invoke_rx_handlers(local, local->rx_handlers, 1767 ieee80211_invoke_rx_handlers(local, &rx, sta);
1769 &rx, sta);
1770 } else 1768 } else
1771 dev_kfree_skb(skb); 1769 dev_kfree_skb(skb);
1772 1770