diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2007-09-17 01:29:23 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:52:57 -0400 |
commit | 4150c57212ad134765dd78c654a4b9906252b66d (patch) | |
tree | c37ab7a3f75532a623ed00339782d769514422d2 /include/net | |
parent | 070ac3a2651e3c1c4d277c5f1981517427c386a7 (diff) |
[PATCH] mac80211: revamp interface and filter configuration
Drivers are currently supposed to keep track of monitor
interfaces if they allow so-called "hard" monitor, and
they are also supposed to keep track of multicast etc.
This patch changes that, replaces the set_multicast_list()
callback with a new configure_filter() callback that takes
filter flags (FIF_*) instead of interface flags (IFF_*).
For a driver, this means it should open the filter as much
as necessary to get all frames requested by the filter flags.
Accordingly, the filter flags are named "positively", e.g.
FIF_ALLMULTI.
Multicast filtering is a bit special in that drivers that
have no multicast address filters need to allow multicast
frames through when either the FIF_ALLMULTI flag is set or
when the mc_count value is positive.
At the same time, drivers are no longer notified about
monitor interfaces at all, this means they now need to
implement the start() and stop() callbacks and the new
change_filter_flags() callback. Also, the start()/stop()
ordering changed, start() is now called *before* any
add_interface() as it really should be, and stop() after
any remove_interface().
The patch also changes the behaviour of setting the bssid
to multicast for scanning when IEEE80211_HW_NO_PROBE_FILTERING
is set; the IEEE80211_HW_NO_PROBE_FILTERING flag is removed
and the filter flag FIF_BCN_PRBRESP_PROMISC introduced.
This is a lot more efficient for hardware like b43 that
supports it and other hardware can still set the BSSID
to all-ones.
Driver modifications by Johannes Berg (b43 & iwlwifi), Michael Wu
(rtl8187, adm8211, and p54), Larry Finger (b43legacy), and
Ivo van Doorn (rt2x00).
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/mac80211.h | 151 |
1 files changed, 95 insertions, 56 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 5ff45553a985..855754d4c50d 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -467,7 +467,6 @@ enum ieee80211_if_types { | |||
467 | * @mac_addr: pointer to MAC address of the interface. This pointer is valid | 467 | * @mac_addr: pointer to MAC address of the interface. This pointer is valid |
468 | * until the interface is removed (i.e. it cannot be used after | 468 | * until the interface is removed (i.e. it cannot be used after |
469 | * remove_interface() callback was called for this interface). | 469 | * remove_interface() callback was called for this interface). |
470 | * This pointer will be %NULL for monitor interfaces, be careful. | ||
471 | * | 470 | * |
472 | * This structure is used in add_interface() and remove_interface() | 471 | * This structure is used in add_interface() and remove_interface() |
473 | * callbacks of &struct ieee80211_hw. | 472 | * callbacks of &struct ieee80211_hw. |
@@ -653,13 +652,9 @@ struct ieee80211_hw { | |||
653 | 652 | ||
654 | /* hole at 8 */ | 653 | /* hole at 8 */ |
655 | 654 | ||
656 | /* Device is capable of performing full monitor mode even during | 655 | /* hole at 9 */ |
657 | * normal operation. */ | ||
658 | #define IEEE80211_HW_MONITOR_DURING_OPER (1<<9) | ||
659 | 656 | ||
660 | /* Device does not need BSSID filter set to broadcast in order to | 657 | /* hole at 10 */ |
661 | * receive all probe responses while scanning */ | ||
662 | #define IEEE80211_HW_NO_PROBE_FILTERING (1<<10) | ||
663 | 658 | ||
664 | /* Channels are already configured to the default regulatory domain | 659 | /* Channels are already configured to the default regulatory domain |
665 | * specified in the device's EEPROM */ | 660 | * specified in the device's EEPROM */ |
@@ -694,6 +689,39 @@ static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, u8 *addr) | |||
694 | memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN); | 689 | memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN); |
695 | } | 690 | } |
696 | 691 | ||
692 | /* | ||
693 | * flags for change_filter_flags() | ||
694 | * | ||
695 | * Note that e.g. if PROMISC_IN_BSS is unset then | ||
696 | * you should still do MAC address filtering if | ||
697 | * possible even if OTHER_BSS is set to indicate | ||
698 | * no BSSID filtering should be done. | ||
699 | */ | ||
700 | /* | ||
701 | * promiscuous mode within your BSS, | ||
702 | * think of the BSS as your network segment and then this corresponds | ||
703 | * to the regular ethernet device promiscuous mode | ||
704 | */ | ||
705 | #define FIF_PROMISC_IN_BSS 0x01 | ||
706 | /* show all multicast frames */ | ||
707 | #define FIF_ALLMULTI 0x02 | ||
708 | /* show frames with failed FCS, but set RX_FLAG_FAILED_FCS_CRC for them */ | ||
709 | #define FIF_FCSFAIL 0x04 | ||
710 | /* show frames with failed PLCP CRC, but set RX_FLAG_FAILED_PLCP_CRC for them */ | ||
711 | #define FIF_PLCPFAIL 0x08 | ||
712 | /* | ||
713 | * This flag is set during scanning to indicate to the hardware | ||
714 | * that it should not filter beacons or probe responses by BSSID. | ||
715 | */ | ||
716 | #define FIF_BCN_PRBRESP_PROMISC 0x10 | ||
717 | /* | ||
718 | * show control frames, if PROMISC_IN_BSS is not set then | ||
719 | * only those addressed to this station | ||
720 | */ | ||
721 | #define FIF_CONTROL 0x20 | ||
722 | /* show frames from other BSSes */ | ||
723 | #define FIF_OTHER_BSS 0x40 | ||
724 | |||
697 | /* Configuration block used by the low-level driver to tell the 802.11 code | 725 | /* Configuration block used by the low-level driver to tell the 802.11 code |
698 | * about supported hardware features and to pass function pointers to callback | 726 | * about supported hardware features and to pass function pointers to callback |
699 | * functions. */ | 727 | * functions. */ |
@@ -706,32 +734,55 @@ struct ieee80211_ops { | |||
706 | int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb, | 734 | int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb, |
707 | struct ieee80211_tx_control *control); | 735 | struct ieee80211_tx_control *control); |
708 | 736 | ||
709 | /* Handler that is called when any netdevice attached to the hardware | 737 | /* |
710 | * device is set UP for the first time. This can be used, e.g., to | 738 | * Called before the first netdevice attached to the hardware |
711 | * enable interrupts and beacon sending. */ | 739 | * is enabled. This should turn on the hardware and must turn on |
712 | int (*open)(struct ieee80211_hw *hw); | 740 | * frame reception (for possibly enabled monitor interfaces.) |
713 | 741 | * Returns negative error codes, these may be seen in userspace, | |
714 | /* Handler that is called when the last netdevice attached to the | 742 | * or zero. |
715 | * hardware device is set DOWN. This can be used, e.g., to disable | 743 | * When the device is started it should not have a MAC address |
716 | * interrupts and beacon sending. */ | 744 | * to avoid acknowledging frames before a non-monitor device |
717 | int (*stop)(struct ieee80211_hw *hw); | 745 | * is added. |
718 | 746 | * | |
719 | /* Handler for asking a driver if a new interface can be added (or, | 747 | * Must be implemented. |
720 | * more exactly, set UP). If the handler returns zero, the interface | 748 | */ |
721 | * is added. Driver should perform any initialization it needs prior | 749 | int (*start)(struct ieee80211_hw *hw); |
722 | * to returning zero. By returning non-zero addition of the interface | 750 | |
723 | * is inhibited. Unless monitor_during_oper is set, it is guaranteed | 751 | /* |
724 | * that monitor interfaces and normal interfaces are mutually | 752 | * Called after last netdevice attached to the hardware |
725 | * exclusive. If assigned, the open() handler is called after | 753 | * is disabled. This should turn off the hardware (at least |
726 | * add_interface() if this is the first device added. The | 754 | * it must turn off frame reception.) |
727 | * add_interface() callback has to be assigned because it is the only | 755 | * May be called right after add_interface if that rejects |
728 | * way to obtain the requested MAC address for any interface. | 756 | * an interface. |
757 | * | ||
758 | * Must be implemented. | ||
759 | */ | ||
760 | void (*stop)(struct ieee80211_hw *hw); | ||
761 | |||
762 | /* | ||
763 | * Called when a netdevice attached to the hardware is enabled. | ||
764 | * Because it is not called for monitor mode devices, open() | ||
765 | * and stop() must be implemented. | ||
766 | * The driver should perform any initialization it needs before | ||
767 | * the device can be enabled. The initial configuration for the | ||
768 | * interface is given in the conf parameter. | ||
769 | * | ||
770 | * Must be implemented. | ||
729 | */ | 771 | */ |
730 | int (*add_interface)(struct ieee80211_hw *hw, | 772 | int (*add_interface)(struct ieee80211_hw *hw, |
731 | struct ieee80211_if_init_conf *conf); | 773 | struct ieee80211_if_init_conf *conf); |
732 | 774 | ||
733 | /* Notify a driver that an interface is going down. The stop() handler | 775 | /* |
734 | * is called prior to this if this is a last interface. */ | 776 | * Notifies a driver that an interface is going down. The stop() handler |
777 | * is called after this if it is the last interface and no monitor | ||
778 | * interfaces are present. | ||
779 | * When all interfaces are removed, the MAC address in the hardware | ||
780 | * must be cleared so the device no longer acknowledges packets, | ||
781 | * the mac_addr member of the conf structure is, however, set to the | ||
782 | * MAC address of the device going away. | ||
783 | * | ||
784 | * Hence, this callback must be implemented. | ||
785 | */ | ||
735 | void (*remove_interface)(struct ieee80211_hw *hw, | 786 | void (*remove_interface)(struct ieee80211_hw *hw, |
736 | struct ieee80211_if_init_conf *conf); | 787 | struct ieee80211_if_init_conf *conf); |
737 | 788 | ||
@@ -744,15 +795,21 @@ struct ieee80211_ops { | |||
744 | int (*config_interface)(struct ieee80211_hw *hw, | 795 | int (*config_interface)(struct ieee80211_hw *hw, |
745 | int if_id, struct ieee80211_if_conf *conf); | 796 | int if_id, struct ieee80211_if_conf *conf); |
746 | 797 | ||
747 | /* ieee80211 drivers do not have access to the &struct net_device | 798 | /* |
748 | * that is (are) connected with their device. Hence (and because | 799 | * Configure the device's RX filter. |
749 | * we need to combine the multicast lists and flags for multiple | 800 | * |
750 | * virtual interfaces), they cannot assign set_multicast_list. | 801 | * The multicast address filter must be changed if the hardware flags |
751 | * The parameters here replace dev->flags and dev->mc_count, | 802 | * indicate that one is present. |
752 | * dev->mc_list is replaced by calling ieee80211_get_mc_list_item. | 803 | * |
753 | * Must be atomic. */ | 804 | * All unsupported flags in 'total_flags' must be cleared, |
754 | void (*set_multicast_list)(struct ieee80211_hw *hw, | 805 | * clear all bits except those you honoured. |
755 | unsigned short flags, int mc_count); | 806 | * |
807 | * The callback must be implemented and must be atomic. | ||
808 | */ | ||
809 | void (*configure_filter)(struct ieee80211_hw *hw, | ||
810 | unsigned int changed_flags, | ||
811 | unsigned int *total_flags, | ||
812 | int mc_count, struct dev_addr_list *mc_list); | ||
756 | 813 | ||
757 | /* Set TIM bit handler. If the hardware/firmware takes care of beacon | 814 | /* Set TIM bit handler. If the hardware/firmware takes care of beacon |
758 | * generation, IEEE 802.11 code uses this function to tell the | 815 | * generation, IEEE 802.11 code uses this function to tell the |
@@ -1155,24 +1212,6 @@ void ieee80211_stop_queues(struct ieee80211_hw *hw); | |||
1155 | */ | 1212 | */ |
1156 | void ieee80211_wake_queues(struct ieee80211_hw *hw); | 1213 | void ieee80211_wake_queues(struct ieee80211_hw *hw); |
1157 | 1214 | ||
1158 | /** | ||
1159 | * ieee80211_get_mc_list_item - iteration over items in multicast list | ||
1160 | * @hw: pointer as obtained from ieee80211_alloc_hw(). | ||
1161 | * @prev: value returned by previous call to ieee80211_get_mc_list_item() or | ||
1162 | * NULL to start a new iteration. | ||
1163 | * @ptr: pointer to buffer of void * type for internal usage of | ||
1164 | * ieee80211_get_mc_list_item(). | ||
1165 | * | ||
1166 | * Iterates over items in multicast list of given device. To get the first | ||
1167 | * item, pass NULL in @prev and in *@ptr. In subsequent calls, pass the | ||
1168 | * value returned by previous call in @prev. Don't alter *@ptr during | ||
1169 | * iteration. When there are no more items, NULL is returned. | ||
1170 | */ | ||
1171 | struct dev_mc_list * | ||
1172 | ieee80211_get_mc_list_item(struct ieee80211_hw *hw, | ||
1173 | struct dev_mc_list *prev, | ||
1174 | void **ptr); | ||
1175 | |||
1176 | /* called by driver to notify scan status completed */ | 1215 | /* called by driver to notify scan status completed */ |
1177 | void ieee80211_scan_completed(struct ieee80211_hw *hw); | 1216 | void ieee80211_scan_completed(struct ieee80211_hw *hw); |
1178 | 1217 | ||