diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2008-01-31 13:48:25 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-02-29 15:37:03 -0500 |
commit | 589052904a60f00dd2cbc1d3488ee3f520a7de21 (patch) | |
tree | 7fa7c83895b38ae84ec12ff035862bb3291952d9 /net | |
parent | 2c9745e5684ad75d02020bcaa31ab6d4b498e1e1 (diff) |
mac80211: remove "dynamic" RX/TX handlers
It doesn't really make sense to have extra pointers to the RX/TX
handler arrays instead of just using the arrays directly, that
also allows us to make them static.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/ieee80211.c | 2 | ||||
-rw-r--r-- | net/mac80211/ieee80211_i.h | 13 | ||||
-rw-r--r-- | net/mac80211/rx.c | 80 | ||||
-rw-r--r-- | net/mac80211/tx.c | 9 |
4 files changed, 43 insertions, 61 deletions
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c index 83694fb49734..78fd91895c80 100644 --- a/net/mac80211/ieee80211.c +++ b/net/mac80211/ieee80211.c | |||
@@ -1429,8 +1429,6 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, | |||
1429 | local->hw.queues = 1; /* default */ | 1429 | local->hw.queues = 1; /* default */ |
1430 | 1430 | ||
1431 | local->mdev = mdev; | 1431 | local->mdev = mdev; |
1432 | local->rx_handlers = ieee80211_rx_handlers; | ||
1433 | local->tx_handlers = ieee80211_tx_handlers; | ||
1434 | 1432 | ||
1435 | local->bridge_packets = 1; | 1433 | local->bridge_packets = 1; |
1436 | 1434 | ||
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 21d54b27ccc1..1129a4299de7 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -190,12 +190,6 @@ struct ieee80211_tx_stored_packet { | |||
190 | unsigned int last_frag_rate_ctrl_probe; | 190 | unsigned int last_frag_rate_ctrl_probe; |
191 | }; | 191 | }; |
192 | 192 | ||
193 | typedef ieee80211_tx_result (*ieee80211_tx_handler) | ||
194 | (struct ieee80211_txrx_data *tx); | ||
195 | |||
196 | typedef ieee80211_rx_result (*ieee80211_rx_handler) | ||
197 | (struct ieee80211_txrx_data *rx); | ||
198 | |||
199 | struct beacon_data { | 193 | struct beacon_data { |
200 | u8 *head, *tail; | 194 | u8 *head, *tail; |
201 | int head_len, tail_len; | 195 | int head_len, tail_len; |
@@ -477,9 +471,6 @@ struct ieee80211_local { | |||
477 | * deliver multicast frames both back to wireless | 471 | * deliver multicast frames both back to wireless |
478 | * media and to the local net stack */ | 472 | * media and to the local net stack */ |
479 | 473 | ||
480 | ieee80211_rx_handler *rx_handlers; | ||
481 | ieee80211_tx_handler *tx_handlers; | ||
482 | |||
483 | struct list_head interfaces; | 474 | struct list_head interfaces; |
484 | 475 | ||
485 | bool sta_sw_scanning; | 476 | bool sta_sw_scanning; |
@@ -779,11 +770,7 @@ int ieee80211_if_remove(struct net_device *dev, const char *name, int id); | |||
779 | void ieee80211_if_free(struct net_device *dev); | 770 | void ieee80211_if_free(struct net_device *dev); |
780 | void ieee80211_if_sdata_init(struct ieee80211_sub_if_data *sdata); | 771 | void ieee80211_if_sdata_init(struct ieee80211_sub_if_data *sdata); |
781 | 772 | ||
782 | /* rx handling */ | ||
783 | extern ieee80211_rx_handler ieee80211_rx_handlers[]; | ||
784 | |||
785 | /* tx handling */ | 773 | /* tx handling */ |
786 | extern ieee80211_tx_handler ieee80211_tx_handlers[]; | ||
787 | void ieee80211_clear_tx_pending(struct ieee80211_local *local); | 774 | void ieee80211_clear_tx_pending(struct ieee80211_local *local); |
788 | void ieee80211_tx_pending(unsigned long data); | 775 | void ieee80211_tx_pending(unsigned long data); |
789 | int ieee80211_master_start_xmit(struct sk_buff *skb, struct net_device *dev); | 776 | int ieee80211_master_start_xmit(struct sk_buff *skb, struct net_device *dev); |
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 | ||
1451 | static 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 | |||
1487 | static void ieee80211_rx_michael_mic_report(struct net_device *dev, | 1451 | static 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 | ||
1560 | ieee80211_rx_handler ieee80211_rx_handlers[] = | 1524 | typedef ieee80211_rx_result (*ieee80211_rx_handler)(struct ieee80211_txrx_data *); |
1525 | static 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 | ||
1547 | static 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 | ||
1584 | static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, | 1584 | static 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 | ||
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 0cba4a214876..181d97015f61 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -813,10 +813,9 @@ ieee80211_tx_h_load_stats(struct ieee80211_txrx_data *tx) | |||
813 | return TX_CONTINUE; | 813 | return TX_CONTINUE; |
814 | } | 814 | } |
815 | 815 | ||
816 | /* TODO: implement register/unregister functions for adding TX/RX handlers | ||
817 | * into ordered list */ | ||
818 | 816 | ||
819 | ieee80211_tx_handler ieee80211_tx_handlers[] = | 817 | typedef ieee80211_tx_result (*ieee80211_tx_handler)(struct ieee80211_txrx_data *); |
818 | static ieee80211_tx_handler ieee80211_tx_handlers[] = | ||
820 | { | 819 | { |
821 | ieee80211_tx_h_check_assoc, | 820 | ieee80211_tx_h_check_assoc, |
822 | ieee80211_tx_h_sequence, | 821 | ieee80211_tx_h_sequence, |
@@ -1158,7 +1157,7 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb, | |||
1158 | sta = tx.sta; | 1157 | sta = tx.sta; |
1159 | tx.u.tx.channel = local->hw.conf.channel; | 1158 | tx.u.tx.channel = local->hw.conf.channel; |
1160 | 1159 | ||
1161 | for (handler = local->tx_handlers; *handler != NULL; | 1160 | for (handler = ieee80211_tx_handlers; *handler != NULL; |
1162 | handler++) { | 1161 | handler++) { |
1163 | res = (*handler)(&tx); | 1162 | res = (*handler)(&tx); |
1164 | if (res != TX_CONTINUE) | 1163 | if (res != TX_CONTINUE) |
@@ -1914,7 +1913,7 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, | |||
1914 | tx.flags |= IEEE80211_TXRXD_TXPS_BUFFERED; | 1913 | tx.flags |= IEEE80211_TXRXD_TXPS_BUFFERED; |
1915 | tx.u.tx.channel = local->hw.conf.channel; | 1914 | tx.u.tx.channel = local->hw.conf.channel; |
1916 | 1915 | ||
1917 | for (handler = local->tx_handlers; *handler != NULL; handler++) { | 1916 | for (handler = ieee80211_tx_handlers; *handler != NULL; handler++) { |
1918 | res = (*handler)(&tx); | 1917 | res = (*handler)(&tx); |
1919 | if (res == TX_DROP || res == TX_QUEUED) | 1918 | if (res == TX_DROP || res == TX_QUEUED) |
1920 | break; | 1919 | break; |