diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2007-09-18 17:29:20 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:52:59 -0400 |
commit | 75a5f0ccfdbc0151ee40bb742f7b5c8eba493c0e (patch) | |
tree | f82e329ec030e767d65b767914fd501c955de4f9 /include | |
parent | 1bc0826c8f5f3fa26644a8e878aae0be304a670f (diff) |
[PATCH] mac80211: document a lot more
This patch adds a lot more documentation (in kernel-doc format)
to include/net/mac80211.h
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/mac80211.h | 792 |
1 files changed, 499 insertions, 293 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index c5554ad87a17..d2cf734402e3 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -22,29 +22,51 @@ | |||
22 | #include <net/wireless.h> | 22 | #include <net/wireless.h> |
23 | #include <net/cfg80211.h> | 23 | #include <net/cfg80211.h> |
24 | 24 | ||
25 | /* Note! Only ieee80211_tx_status_irqsafe() and ieee80211_rx_irqsafe() can be | 25 | /** |
26 | * DOC: Introduction | ||
27 | * | ||
28 | * mac80211 is the Linux stack for 802.11 hardware that implements | ||
29 | * only partial functionality in hard- or firmware. This document | ||
30 | * defines the interface between mac80211 and low-level hardware | ||
31 | * drivers. | ||
32 | */ | ||
33 | |||
34 | /** | ||
35 | * DOC: Calling mac80211 from interrupts | ||
36 | * | ||
37 | * Only ieee80211_tx_status_irqsafe() and ieee80211_rx_irqsafe() can be | ||
26 | * called in hardware interrupt context. The low-level driver must not call any | 38 | * called in hardware interrupt context. The low-level driver must not call any |
27 | * other functions in hardware interrupt context. If there is a need for such | 39 | * other functions in hardware interrupt context. If there is a need for such |
28 | * call, the low-level driver should first ACK the interrupt and perform the | 40 | * call, the low-level driver should first ACK the interrupt and perform the |
29 | * IEEE 802.11 code call after this, e.g., from a scheduled tasklet (in | 41 | * IEEE 802.11 code call after this, e.g. from a scheduled workqueue function. |
30 | * software interrupt context). | ||
31 | */ | 42 | */ |
32 | 43 | ||
33 | /* | 44 | /** |
34 | * Frame format used when passing frame between low-level hardware drivers | 45 | * DOC: Warning |
35 | * and IEEE 802.11 driver the same as used in the wireless media, i.e., | 46 | * |
36 | * buffers start with IEEE 802.11 header and include the same octets that | 47 | * If you're reading this document and not the header file itself, it will |
37 | * are sent over air. | 48 | * be incomplete because not all documentation has been converted yet. |
38 | * | 49 | */ |
39 | * If hardware uses IEEE 802.3 headers (and perform 802.3 <-> 802.11 | 50 | |
40 | * conversion in firmware), upper layer 802.11 code needs to be changed to | 51 | /** |
41 | * support this. | 52 | * DOC: Frame format |
42 | * | 53 | * |
43 | * If the receive frame format is not the same as the real frame sent | 54 | * As a general rule, when frames are passed between mac80211 and the driver, |
44 | * on the wireless media (e.g., due to padding etc.), upper layer 802.11 code | 55 | * they start with the IEEE 802.11 header and include the same octets that are |
45 | * could be updated to provide support for such format assuming this would | 56 | * sent over the air except for the FCS which should be calculated by the |
46 | * optimize the performance, e.g., by removing need to re-allocation and | 57 | * hardware. |
47 | * copying of the data. | 58 | * |
59 | * There are, however, various exceptions to this rule for advanced features: | ||
60 | * | ||
61 | * The first exception is for hardware encryption and decryption offload | ||
62 | * where the IV/ICV may or may not be generated in hardware. | ||
63 | * | ||
64 | * Secondly, when the hardware handles fragmentation, the frame handed to | ||
65 | * the driver from mac80211 is the MSDU, not the MPDU. | ||
66 | * | ||
67 | * Finally, for received frames, the driver is able to indicate that it has | ||
68 | * filled a radiotap header and put that in front of the frame; if it does | ||
69 | * not do so then mac80211 may add this under certain circumstances. | ||
48 | */ | 70 | */ |
49 | 71 | ||
50 | #define IEEE80211_CHAN_W_SCAN 0x00000001 | 72 | #define IEEE80211_CHAN_W_SCAN 0x00000001 |
@@ -480,7 +502,7 @@ enum ieee80211_if_types { | |||
480 | */ | 502 | */ |
481 | struct ieee80211_if_init_conf { | 503 | struct ieee80211_if_init_conf { |
482 | int if_id; | 504 | int if_id; |
483 | int type; | 505 | enum ieee80211_if_types type; |
484 | void *mac_addr; | 506 | void *mac_addr; |
485 | }; | 507 | }; |
486 | 508 | ||
@@ -645,351 +667,426 @@ enum ieee80211_hw_flags { | |||
645 | 667 | ||
646 | /** | 668 | /** |
647 | * struct ieee80211_hw - hardware information and state | 669 | * struct ieee80211_hw - hardware information and state |
648 | * TODO: move documentation into kernel-doc format | 670 | * |
671 | * This structure contains the configuration and hardware | ||
672 | * information for an 802.11 PHY. | ||
673 | * | ||
674 | * @wiphy: This points to the &struct wiphy allocated for this | ||
675 | * 802.11 PHY. You must fill in the @perm_addr and @dev | ||
676 | * members of this structure using SET_IEEE80211_DEV() | ||
677 | * and SET_IEEE80211_PERM_ADDR(). | ||
678 | * | ||
679 | * @conf: &struct ieee80211_conf, device configuration, don't use. | ||
680 | * | ||
681 | * @workqueue: single threaded workqueue available for driver use, | ||
682 | * allocated by mac80211 on registration and flushed on | ||
683 | * unregistration. | ||
684 | * | ||
685 | * @priv: pointer to private area that was allocated for driver use | ||
686 | * along with this structure. | ||
687 | * | ||
688 | * @flags: hardware flags, see &enum ieee80211_hw_flags. | ||
689 | * | ||
690 | * @extra_tx_headroom: headroom to reserve in each transmit skb | ||
691 | * for use by the driver (e.g. for transmit headers.) | ||
692 | * | ||
693 | * @channel_change_time: time (in microseconds) it takes to change channels. | ||
694 | * | ||
695 | * @max_rssi: Maximum value for ssi in RX information, use | ||
696 | * negative numbers for dBm and 0 to indicate no support. | ||
697 | * | ||
698 | * @max_signal: like @max_rssi, but for the signal value. | ||
699 | * | ||
700 | * @max_noise: like @max_rssi, but for the noise value. | ||
701 | * | ||
702 | * @queues: number of available hardware transmit queues for | ||
703 | * data packets. WMM/QoS requires at least four. | ||
649 | */ | 704 | */ |
650 | struct ieee80211_hw { | 705 | struct ieee80211_hw { |
651 | /* points to the cfg80211 wiphy for this piece. Note | ||
652 | * that you must fill in the perm_addr and dev fields | ||
653 | * of this structure, use the macros provided below. */ | ||
654 | struct wiphy *wiphy; | ||
655 | |||
656 | /* assigned by mac80211, don't write */ | ||
657 | struct ieee80211_conf conf; | 706 | struct ieee80211_conf conf; |
658 | 707 | struct wiphy *wiphy; | |
659 | /* Single thread workqueue available for driver use | ||
660 | * Allocated by mac80211 on registration */ | ||
661 | struct workqueue_struct *workqueue; | 708 | struct workqueue_struct *workqueue; |
662 | |||
663 | /* Pointer to the private area that was | ||
664 | * allocated with this struct for you. */ | ||
665 | void *priv; | 709 | void *priv; |
666 | 710 | u32 flags; | |
667 | /* The rest is information about your hardware */ | ||
668 | |||
669 | u32 flags; /* hardware flags defined above */ | ||
670 | |||
671 | /* Set to the size of a needed device specific skb headroom for TX skbs. */ | ||
672 | unsigned int extra_tx_headroom; | 711 | unsigned int extra_tx_headroom; |
673 | |||
674 | /* This is the time in us to change channels | ||
675 | */ | ||
676 | int channel_change_time; | 712 | int channel_change_time; |
677 | /* Maximum values for various statistics. | 713 | u8 queues; |
678 | * Leave at 0 to indicate no support. Use negative numbers for dBm. */ | ||
679 | s8 max_rssi; | 714 | s8 max_rssi; |
680 | s8 max_signal; | 715 | s8 max_signal; |
681 | s8 max_noise; | 716 | s8 max_noise; |
682 | |||
683 | /* Number of available hardware TX queues for data packets. | ||
684 | * WMM requires at least four queues. */ | ||
685 | int queues; | ||
686 | }; | 717 | }; |
687 | 718 | ||
719 | /** | ||
720 | * SET_IEEE80211_DEV - set device for 802.11 hardware | ||
721 | * | ||
722 | * @hw: the &struct ieee80211_hw to set the device for | ||
723 | * @dev: the &struct device of this 802.11 device | ||
724 | */ | ||
688 | static inline void SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev) | 725 | static inline void SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev) |
689 | { | 726 | { |
690 | set_wiphy_dev(hw->wiphy, dev); | 727 | set_wiphy_dev(hw->wiphy, dev); |
691 | } | 728 | } |
692 | 729 | ||
730 | /** | ||
731 | * SET_IEEE80211_PERM_ADDR - set the permanenet MAC address for 802.11 hardware | ||
732 | * | ||
733 | * @hw: the &struct ieee80211_hw to set the MAC address for | ||
734 | * @addr: the address to set | ||
735 | */ | ||
693 | static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, u8 *addr) | 736 | static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, u8 *addr) |
694 | { | 737 | { |
695 | memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN); | 738 | memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN); |
696 | } | 739 | } |
697 | 740 | ||
698 | /* | 741 | /** |
699 | * flags for change_filter_flags() | 742 | * DOC: Hardware crypto acceleration |
743 | * | ||
744 | * mac80211 is capable of taking advantage of many hardware | ||
745 | * acceleration designs for encryption and decryption operations. | ||
746 | * | ||
747 | * The set_key() callback in the &struct ieee80211_ops for a given | ||
748 | * device is called to enable hardware acceleration of encryption and | ||
749 | * decryption. The callback takes an @address parameter that will be | ||
750 | * the broadcast address for default keys, the other station's hardware | ||
751 | * address for individual keys or the zero address for keys that will | ||
752 | * be used only for transmission. | ||
753 | * Multiple transmission keys with the same key index may be used when | ||
754 | * VLANs are configured for an access point. | ||
700 | * | 755 | * |
701 | * Note that e.g. if PROMISC_IN_BSS is unset then | 756 | * The @local_address parameter will always be set to our own address, |
702 | * you should still do MAC address filtering if | 757 | * this is only relevant if you support multiple local addresses. |
703 | * possible even if OTHER_BSS is set to indicate | 758 | * |
704 | * no BSSID filtering should be done. | 759 | * When transmitting, the TX control data will use the @hw_key_idx |
760 | * selected by the driver by modifying the &struct ieee80211_key_conf | ||
761 | * pointed to by the @key parameter to the set_key() function. | ||
762 | * | ||
763 | * The set_key() call for the %SET_KEY command should return 0 if | ||
764 | * the key is now in use, -%EOPNOTSUPP or -%ENOSPC if it couldn't be | ||
765 | * added; if you return 0 then hw_key_idx must be assigned to the | ||
766 | * hardware key index, you are free to use the full u8 range. | ||
767 | * | ||
768 | * When the cmd is %DISABLE_KEY then it must succeed. | ||
769 | * | ||
770 | * Note that it is permissible to not decrypt a frame even if a key | ||
771 | * for it has been uploaded to hardware, the stack will not make any | ||
772 | * decision based on whether a key has been uploaded or not but rather | ||
773 | * based on the receive flags. | ||
774 | * | ||
775 | * The &struct ieee80211_key_conf structure pointed to by the @key | ||
776 | * parameter is guaranteed to be valid until another call to set_key() | ||
777 | * removes it, but it can only be used as a cookie to differentiate | ||
778 | * keys. | ||
705 | */ | 779 | */ |
706 | /* | 780 | |
707 | * promiscuous mode within your BSS, | 781 | /** |
708 | * think of the BSS as your network segment and then this corresponds | 782 | * DOC: Frame filtering |
709 | * to the regular ethernet device promiscuous mode | 783 | * |
784 | * mac80211 requires to see many management frames for proper | ||
785 | * operation, and users may want to see many more frames when | ||
786 | * in monitor mode. However, for best CPU usage and power consumption, | ||
787 | * having as few frames as possible percolate through the stack is | ||
788 | * desirable. Hence, the hardware should filter as much as possible. | ||
789 | * | ||
790 | * To achieve this, mac80211 uses filter flags (see below) to tell | ||
791 | * the driver's configure_filter() function which frames should be | ||
792 | * passed to mac80211 and which should be filtered out. | ||
793 | * | ||
794 | * The configure_filter() callback is invoked with the parameters | ||
795 | * @mc_count and @mc_list for the combined multicast address list | ||
796 | * of all virtual interfaces, @changed_flags telling which flags | ||
797 | * were changed and @total_flags with the new flag states. | ||
798 | * | ||
799 | * If your device has no multicast address filters your driver will | ||
800 | * need to check both the %FIF_ALLMULTI flag and the @mc_count | ||
801 | * parameter to see whether multicast frames should be accepted | ||
802 | * or dropped. | ||
803 | * | ||
804 | * All unsupported flags in @total_flags must be cleared, i.e. you | ||
805 | * should clear all bits except those you honoured. | ||
710 | */ | 806 | */ |
711 | #define FIF_PROMISC_IN_BSS 0x01 | 807 | |
712 | /* show all multicast frames */ | 808 | /** |
713 | #define FIF_ALLMULTI 0x02 | 809 | * enum ieee80211_filter_flags - hardware filter flags |
714 | /* show frames with failed FCS, but set RX_FLAG_FAILED_FCS_CRC for them */ | 810 | * |
715 | #define FIF_FCSFAIL 0x04 | 811 | * These flags determine what the filter in hardware should be |
716 | /* show frames with failed PLCP CRC, but set RX_FLAG_FAILED_PLCP_CRC for them */ | 812 | * programmed to let through and what should not be passed to the |
717 | #define FIF_PLCPFAIL 0x08 | 813 | * stack. It is always safe to pass more frames than requested, |
718 | /* | 814 | * but this has negative impact on power consumption. |
719 | * This flag is set during scanning to indicate to the hardware | 815 | * |
720 | * that it should not filter beacons or probe responses by BSSID. | 816 | * @FIF_PROMISC_IN_BSS: promiscuous mode within your BSS, |
817 | * think of the BSS as your network segment and then this corresponds | ||
818 | * to the regular ethernet device promiscuous mode. | ||
819 | * | ||
820 | * @FIF_ALLMULTI: pass all multicast frames, this is used if requested | ||
821 | * by the user or if the hardware is not capable of filtering by | ||
822 | * multicast address. | ||
823 | * | ||
824 | * @FIF_FCSFAIL: pass frames with failed FCS (but you need to set the | ||
825 | * %RX_FLAG_FAILED_FCS_CRC for them) | ||
826 | * | ||
827 | * @FIF_PLCPFAIL: pass frames with failed PLCP CRC (but you need to set | ||
828 | * the %RX_FLAG_FAILED_PLCP_CRC for them | ||
829 | * | ||
830 | * @FIF_BCN_PRBRESP_PROMISC: This flag is set during scanning to indicate | ||
831 | * to the hardware that it should not filter beacons or probe responses | ||
832 | * by BSSID. Filtering them can greatly reduce the amount of processing | ||
833 | * mac80211 needs to do and the amount of CPU wakeups, so you should | ||
834 | * honour this flag if possible. | ||
835 | * | ||
836 | * @FIF_CONTROL: pass control frames, if PROMISC_IN_BSS is not set then | ||
837 | * only those addressed to this station | ||
838 | * | ||
839 | * @FIF_OTHER_BSS: pass frames destined to other BSSes | ||
721 | */ | 840 | */ |
722 | #define FIF_BCN_PRBRESP_PROMISC 0x10 | 841 | enum ieee80211_filter_flags { |
723 | /* | 842 | FIF_PROMISC_IN_BSS = 1<<0, |
724 | * show control frames, if PROMISC_IN_BSS is not set then | 843 | FIF_ALLMULTI = 1<<1, |
725 | * only those addressed to this station | 844 | FIF_FCSFAIL = 1<<2, |
845 | FIF_PLCPFAIL = 1<<3, | ||
846 | FIF_BCN_PRBRESP_PROMISC = 1<<4, | ||
847 | FIF_CONTROL = 1<<5, | ||
848 | FIF_OTHER_BSS = 1<<6, | ||
849 | }; | ||
850 | |||
851 | /** | ||
852 | * enum ieee80211_erp_change_flags - erp change flags | ||
853 | * | ||
854 | * These flags are used with the erp_ie_changed() callback in | ||
855 | * &struct ieee80211_ops to indicate which parameter(s) changed. | ||
856 | * @IEEE80211_ERP_CHANGE_PROTECTION: protection changed | ||
857 | * @IEEE80211_ERP_CHANGE_PREAMBLE: barker preamble mode changed | ||
726 | */ | 858 | */ |
727 | #define FIF_CONTROL 0x20 | 859 | enum ieee80211_erp_change_flags { |
728 | /* show frames from other BSSes */ | 860 | IEEE80211_ERP_CHANGE_PROTECTION = 1<<0, |
729 | #define FIF_OTHER_BSS 0x40 | 861 | IEEE80211_ERP_CHANGE_PREAMBLE = 1<<1, |
862 | }; | ||
730 | 863 | ||
731 | /* Configuration block used by the low-level driver to tell the 802.11 code | 864 | |
732 | * about supported hardware features and to pass function pointers to callback | 865 | /** |
733 | * functions. */ | 866 | * struct ieee80211_ops - callbacks from mac80211 to the driver |
867 | * | ||
868 | * This structure contains various callbacks that the driver may | ||
869 | * handle or, in some cases, must handle, for example to configure | ||
870 | * the hardware to a new channel or to transmit a frame. | ||
871 | * | ||
872 | * @tx: Handler that 802.11 module calls for each transmitted frame. | ||
873 | * skb contains the buffer starting from the IEEE 802.11 header. | ||
874 | * The low-level driver should send the frame out based on | ||
875 | * configuration in the TX control data. Must be implemented and | ||
876 | * atomic. | ||
877 | * | ||
878 | * @start: Called before the first netdevice attached to the hardware | ||
879 | * is enabled. This should turn on the hardware and must turn on | ||
880 | * frame reception (for possibly enabled monitor interfaces.) | ||
881 | * Returns negative error codes, these may be seen in userspace, | ||
882 | * or zero. | ||
883 | * When the device is started it should not have a MAC address | ||
884 | * to avoid acknowledging frames before a non-monitor device | ||
885 | * is added. | ||
886 | * Must be implemented. | ||
887 | * | ||
888 | * @stop: Called after last netdevice attached to the hardware | ||
889 | * is disabled. This should turn off the hardware (at least | ||
890 | * it must turn off frame reception.) | ||
891 | * May be called right after add_interface if that rejects | ||
892 | * an interface. | ||
893 | * Must be implemented. | ||
894 | * | ||
895 | * @add_interface: Called when a netdevice attached to the hardware is | ||
896 | * enabled. Because it is not called for monitor mode devices, @open | ||
897 | * and @stop must be implemented. | ||
898 | * The driver should perform any initialization it needs before | ||
899 | * the device can be enabled. The initial configuration for the | ||
900 | * interface is given in the conf parameter. | ||
901 | * The callback may refuse to add an interface by returning a | ||
902 | * negative error code (which will be seen in userspace.) | ||
903 | * Must be implemented. | ||
904 | * | ||
905 | * @remove_interface: Notifies a driver that an interface is going down. | ||
906 | * The @stop callback is called after this if it is the last interface | ||
907 | * and no monitor interfaces are present. | ||
908 | * When all interfaces are removed, the MAC address in the hardware | ||
909 | * must be cleared so the device no longer acknowledges packets, | ||
910 | * the mac_addr member of the conf structure is, however, set to the | ||
911 | * MAC address of the device going away. | ||
912 | * Hence, this callback must be implemented. | ||
913 | * | ||
914 | * @config: Handler for configuration requests. IEEE 802.11 code calls this | ||
915 | * function to change hardware configuration, e.g., channel. | ||
916 | * | ||
917 | * @config_interface: Handler for configuration requests related to interfaces | ||
918 | * (e.g. BSSID changes.) | ||
919 | * | ||
920 | * @configure_filter: Configure the device's RX filter. | ||
921 | * See the section "Frame filtering" for more information. | ||
922 | * This callback must be implemented and atomic. | ||
923 | * | ||
924 | * @set_tim: Set TIM bit. If the hardware/firmware takes care of beacon | ||
925 | * generation (that is, %IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE is set) | ||
926 | * mac80211 calls this function when a TIM bit must be set or cleared | ||
927 | * for a given AID. Must be atomic. | ||
928 | * | ||
929 | * @set_key: See the section "Hardware crypto acceleration" | ||
930 | * This callback can sleep, and is only called between add_interface | ||
931 | * and remove_interface calls, i.e. while the interface with the | ||
932 | * given local_address is enabled. | ||
933 | * | ||
934 | * @set_ieee8021x: Enable/disable IEEE 802.1X. This item requests wlan card | ||
935 | * to pass unencrypted EAPOL-Key frames even when encryption is | ||
936 | * configured. If the wlan card does not require such a configuration, | ||
937 | * this function pointer can be set to NULL. | ||
938 | * | ||
939 | * @set_port_auth: Set port authorization state (IEEE 802.1X PAE) to be | ||
940 | * authorized (@authorized=1) or unauthorized (=0). This function can be | ||
941 | * used if the wlan hardware or low-level driver implements PAE. | ||
942 | * mac80211 will filter frames based on authorization state in any case, | ||
943 | * so this function pointer can be NULL if low-level driver does not | ||
944 | * require event notification about port state changes. | ||
945 | * | ||
946 | * @hw_scan: Ask the hardware to service the scan request, no need to start | ||
947 | * the scan state machine in stack. | ||
948 | * | ||
949 | * @get_stats: return low-level statistics | ||
950 | * | ||
951 | * @set_privacy_invoked: For devices that generate their own beacons and probe | ||
952 | * response or association responses this updates the state of privacy_invoked | ||
953 | * returns 0 for success or an error number. | ||
954 | * | ||
955 | * @get_sequence_counter: For devices that have internal sequence counters this | ||
956 | * callback allows mac80211 to access the current value of a counter. | ||
957 | * This callback seems not well-defined, tell us if you need it. | ||
958 | * | ||
959 | * @set_rts_threshold: Configuration of RTS threshold (if device needs it) | ||
960 | * | ||
961 | * @set_frag_threshold: Configuration of fragmentation threshold. Assign this if | ||
962 | * the device does fragmentation by itself; if this method is assigned then | ||
963 | * the stack will not do fragmentation. | ||
964 | * | ||
965 | * @set_retry_limit: Configuration of retry limits (if device needs it) | ||
966 | * | ||
967 | * @sta_table_notification: Number of STAs in STA table notification. Must | ||
968 | * be atomic. | ||
969 | * | ||
970 | * @erp_ie_changed: Handle ERP IE change notifications. Must be atomic. | ||
971 | * | ||
972 | * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), | ||
973 | * bursting) for a hardware TX queue. The @queue parameter uses the | ||
974 | * %IEEE80211_TX_QUEUE_* constants. Must be atomic. | ||
975 | * | ||
976 | * @get_tx_stats: Get statistics of the current TX queue status. This is used | ||
977 | * to get number of currently queued packets (queue length), maximum queue | ||
978 | * size (limit), and total number of packets sent using each TX queue | ||
979 | * (count). This information is used for WMM to find out which TX | ||
980 | * queues have room for more packets and by hostapd to provide | ||
981 | * statistics about the current queueing state to external programs. | ||
982 | * | ||
983 | * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently, | ||
984 | * this is only used for IBSS mode debugging and, as such, is not a | ||
985 | * required function. Must be atomic. | ||
986 | * | ||
987 | * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize | ||
988 | * with other STAs in the IBSS. This is only used in IBSS mode. This | ||
989 | * function is optional if the firmware/hardware takes full care of | ||
990 | * TSF synchronization. | ||
991 | * | ||
992 | * @beacon_update: Setup beacon data for IBSS beacons. Unlike access point, | ||
993 | * IBSS uses a fixed beacon frame which is configured using this | ||
994 | * function. This handler is required only for IBSS mode. | ||
995 | * | ||
996 | * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us. | ||
997 | * This is needed only for IBSS mode and the result of this function is | ||
998 | * used to determine whether to reply to Probe Requests. | ||
999 | */ | ||
734 | struct ieee80211_ops { | 1000 | struct ieee80211_ops { |
735 | /* Handler that 802.11 module calls for each transmitted frame. | ||
736 | * skb contains the buffer starting from the IEEE 802.11 header. | ||
737 | * The low-level driver should send the frame out based on | ||
738 | * configuration in the TX control data. | ||
739 | * Must be atomic. */ | ||
740 | int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb, | 1001 | int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb, |
741 | struct ieee80211_tx_control *control); | 1002 | struct ieee80211_tx_control *control); |
742 | |||
743 | /* | ||
744 | * Called before the first netdevice attached to the hardware | ||
745 | * is enabled. This should turn on the hardware and must turn on | ||
746 | * frame reception (for possibly enabled monitor interfaces.) | ||
747 | * Returns negative error codes, these may be seen in userspace, | ||
748 | * or zero. | ||
749 | * When the device is started it should not have a MAC address | ||
750 | * to avoid acknowledging frames before a non-monitor device | ||
751 | * is added. | ||
752 | * | ||
753 | * Must be implemented. | ||
754 | */ | ||
755 | int (*start)(struct ieee80211_hw *hw); | 1003 | int (*start)(struct ieee80211_hw *hw); |
756 | |||
757 | /* | ||
758 | * Called after last netdevice attached to the hardware | ||
759 | * is disabled. This should turn off the hardware (at least | ||
760 | * it must turn off frame reception.) | ||
761 | * May be called right after add_interface if that rejects | ||
762 | * an interface. | ||
763 | * | ||
764 | * Must be implemented. | ||
765 | */ | ||
766 | void (*stop)(struct ieee80211_hw *hw); | 1004 | void (*stop)(struct ieee80211_hw *hw); |
767 | |||
768 | /* | ||
769 | * Called when a netdevice attached to the hardware is enabled. | ||
770 | * Because it is not called for monitor mode devices, open() | ||
771 | * and stop() must be implemented. | ||
772 | * The driver should perform any initialization it needs before | ||
773 | * the device can be enabled. The initial configuration for the | ||
774 | * interface is given in the conf parameter. | ||
775 | * | ||
776 | * Must be implemented. | ||
777 | */ | ||
778 | int (*add_interface)(struct ieee80211_hw *hw, | 1005 | int (*add_interface)(struct ieee80211_hw *hw, |
779 | struct ieee80211_if_init_conf *conf); | 1006 | struct ieee80211_if_init_conf *conf); |
780 | |||
781 | /* | ||
782 | * Notifies a driver that an interface is going down. The stop() handler | ||
783 | * is called after this if it is the last interface and no monitor | ||
784 | * interfaces are present. | ||
785 | * When all interfaces are removed, the MAC address in the hardware | ||
786 | * must be cleared so the device no longer acknowledges packets, | ||
787 | * the mac_addr member of the conf structure is, however, set to the | ||
788 | * MAC address of the device going away. | ||
789 | * | ||
790 | * Hence, this callback must be implemented. | ||
791 | */ | ||
792 | void (*remove_interface)(struct ieee80211_hw *hw, | 1007 | void (*remove_interface)(struct ieee80211_hw *hw, |
793 | struct ieee80211_if_init_conf *conf); | 1008 | struct ieee80211_if_init_conf *conf); |
794 | |||
795 | /* Handler for configuration requests. IEEE 802.11 code calls this | ||
796 | * function to change hardware configuration, e.g., channel. */ | ||
797 | int (*config)(struct ieee80211_hw *hw, struct ieee80211_conf *conf); | 1009 | int (*config)(struct ieee80211_hw *hw, struct ieee80211_conf *conf); |
798 | |||
799 | /* Handler for configuration requests related to interfaces (e.g. | ||
800 | * BSSID). */ | ||
801 | int (*config_interface)(struct ieee80211_hw *hw, | 1010 | int (*config_interface)(struct ieee80211_hw *hw, |
802 | int if_id, struct ieee80211_if_conf *conf); | 1011 | int if_id, struct ieee80211_if_conf *conf); |
803 | |||
804 | /* | ||
805 | * Configure the device's RX filter. | ||
806 | * | ||
807 | * The multicast address filter must be changed if the hardware flags | ||
808 | * indicate that one is present. | ||
809 | * | ||
810 | * All unsupported flags in 'total_flags' must be cleared, | ||
811 | * clear all bits except those you honoured. | ||
812 | * | ||
813 | * The callback must be implemented and must be atomic. | ||
814 | */ | ||
815 | void (*configure_filter)(struct ieee80211_hw *hw, | 1012 | void (*configure_filter)(struct ieee80211_hw *hw, |
816 | unsigned int changed_flags, | 1013 | unsigned int changed_flags, |
817 | unsigned int *total_flags, | 1014 | unsigned int *total_flags, |
818 | int mc_count, struct dev_addr_list *mc_list); | 1015 | int mc_count, struct dev_addr_list *mc_list); |
819 | |||
820 | /* Set TIM bit handler. If the hardware/firmware takes care of beacon | ||
821 | * generation, IEEE 802.11 code uses this function to tell the | ||
822 | * low-level to set (or clear if set==0) TIM bit for the given aid. If | ||
823 | * host system is used to generate beacons, this handler is not used | ||
824 | * and low-level driver should set it to NULL. | ||
825 | * Must be atomic. */ | ||
826 | int (*set_tim)(struct ieee80211_hw *hw, int aid, int set); | 1016 | int (*set_tim)(struct ieee80211_hw *hw, int aid, int set); |
827 | |||
828 | /* | ||
829 | * Set encryption key. | ||
830 | * | ||
831 | * This is called to enable hardware acceleration of encryption and | ||
832 | * decryption. The address will be the broadcast address for default | ||
833 | * keys, the other station's hardware address for individual keys or | ||
834 | * the zero address for keys that will be used only for transmission. | ||
835 | * | ||
836 | * The local_address parameter will always be set to our own address, | ||
837 | * this is only relevant if you support multiple local addresses. | ||
838 | * | ||
839 | * When transmitting, the TX control data will use the hw_key_idx | ||
840 | * selected by the low-level driver. | ||
841 | * | ||
842 | * Return 0 if the key is now in use, -EOPNOTSUPP or -ENOSPC if it | ||
843 | * couldn't be added; if you return 0 then hw_key_idx must be assigned | ||
844 | * to the hardware key index, you are free to use the full u8 range. | ||
845 | * | ||
846 | * When the cmd is DISABLE_KEY then it must succeed. | ||
847 | * | ||
848 | * Note that it is permissible to not decrypt a frame even if a key | ||
849 | * for it has been uploaded to hardware, the stack will not make any | ||
850 | * decision based on whether a key has been uploaded or not but rather | ||
851 | * based on the receive flags. | ||
852 | * | ||
853 | * This callback can sleep, and is only called between add_interface | ||
854 | * and remove_interface calls, i.e. while the interface with the | ||
855 | * given local_address is enabled. | ||
856 | * | ||
857 | * The ieee80211_key_conf structure pointed to by the key parameter | ||
858 | * is guaranteed to be valid until another call to set_key removes | ||
859 | * it, but it can only be used as a cookie to differentiate keys. | ||
860 | */ | ||
861 | int (*set_key)(struct ieee80211_hw *hw, set_key_cmd cmd, | 1017 | int (*set_key)(struct ieee80211_hw *hw, set_key_cmd cmd, |
862 | const u8 *local_address, const u8 *address, | 1018 | const u8 *local_address, const u8 *address, |
863 | struct ieee80211_key_conf *key); | 1019 | struct ieee80211_key_conf *key); |
864 | |||
865 | /* Enable/disable IEEE 802.1X. This item requests wlan card to pass | ||
866 | * unencrypted EAPOL-Key frames even when encryption is configured. | ||
867 | * If the wlan card does not require such a configuration, this | ||
868 | * function pointer can be set to NULL. */ | ||
869 | int (*set_ieee8021x)(struct ieee80211_hw *hw, int use_ieee8021x); | 1020 | int (*set_ieee8021x)(struct ieee80211_hw *hw, int use_ieee8021x); |
870 | |||
871 | /* Set port authorization state (IEEE 802.1X PAE) to be authorized | ||
872 | * (authorized=1) or unauthorized (authorized=0). This function can be | ||
873 | * used if the wlan hardware or low-level driver implements PAE. | ||
874 | * 80211.o module will anyway filter frames based on authorization | ||
875 | * state, so this function pointer can be NULL if low-level driver does | ||
876 | * not require event notification about port state changes. | ||
877 | * Currently unused. */ | ||
878 | int (*set_port_auth)(struct ieee80211_hw *hw, u8 *addr, | 1021 | int (*set_port_auth)(struct ieee80211_hw *hw, u8 *addr, |
879 | int authorized); | 1022 | int authorized); |
880 | |||
881 | /* Ask the hardware to service the scan request, no need to start | ||
882 | * the scan state machine in stack. */ | ||
883 | int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len); | 1023 | int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len); |
884 | |||
885 | /* return low-level statistics */ | ||
886 | int (*get_stats)(struct ieee80211_hw *hw, | 1024 | int (*get_stats)(struct ieee80211_hw *hw, |
887 | struct ieee80211_low_level_stats *stats); | 1025 | struct ieee80211_low_level_stats *stats); |
888 | |||
889 | /* For devices that generate their own beacons and probe response | ||
890 | * or association responses this updates the state of privacy_invoked | ||
891 | * returns 0 for success or an error number */ | ||
892 | int (*set_privacy_invoked)(struct ieee80211_hw *hw, | 1026 | int (*set_privacy_invoked)(struct ieee80211_hw *hw, |
893 | int privacy_invoked); | 1027 | int privacy_invoked); |
894 | |||
895 | /* For devices that have internal sequence counters, allow 802.11 | ||
896 | * code to access the current value of a counter */ | ||
897 | int (*get_sequence_counter)(struct ieee80211_hw *hw, | 1028 | int (*get_sequence_counter)(struct ieee80211_hw *hw, |
898 | u8* addr, u8 keyidx, u8 txrx, | 1029 | u8* addr, u8 keyidx, u8 txrx, |
899 | u32* iv32, u16* iv16); | 1030 | u32* iv32, u16* iv16); |
900 | |||
901 | /* Configuration of RTS threshold (if device needs it) */ | ||
902 | int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value); | 1031 | int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value); |
903 | |||
904 | /* Configuration of fragmentation threshold. | ||
905 | * Assign this if the device does fragmentation by itself, | ||
906 | * if this method is assigned then the stack will not do | ||
907 | * fragmentation. */ | ||
908 | int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value); | 1032 | int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value); |
909 | |||
910 | /* Configuration of retry limits (if device needs it) */ | ||
911 | int (*set_retry_limit)(struct ieee80211_hw *hw, | 1033 | int (*set_retry_limit)(struct ieee80211_hw *hw, |
912 | u32 short_retry, u32 long_retr); | 1034 | u32 short_retry, u32 long_retr); |
913 | |||
914 | /* Number of STAs in STA table notification (NULL = disabled). | ||
915 | * Must be atomic. */ | ||
916 | void (*sta_table_notification)(struct ieee80211_hw *hw, | 1035 | void (*sta_table_notification)(struct ieee80211_hw *hw, |
917 | int num_sta); | 1036 | int num_sta); |
918 | |||
919 | /* Handle ERP IE change notifications. Must be atomic. */ | ||
920 | void (*erp_ie_changed)(struct ieee80211_hw *hw, u8 changes, | 1037 | void (*erp_ie_changed)(struct ieee80211_hw *hw, u8 changes, |
921 | int cts_protection, int preamble); | 1038 | int cts_protection, int preamble); |
922 | |||
923 | /* Flags for the erp_ie_changed changes parameter */ | ||
924 | #define IEEE80211_ERP_CHANGE_PROTECTION (1<<0) /* protection flag changed */ | ||
925 | #define IEEE80211_ERP_CHANGE_PREAMBLE (1<<1) /* barker preamble mode changed */ | ||
926 | |||
927 | /* Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), | ||
928 | * bursting) for a hardware TX queue. | ||
929 | * queue = IEEE80211_TX_QUEUE_*. | ||
930 | * Must be atomic. */ | ||
931 | int (*conf_tx)(struct ieee80211_hw *hw, int queue, | 1039 | int (*conf_tx)(struct ieee80211_hw *hw, int queue, |
932 | const struct ieee80211_tx_queue_params *params); | 1040 | const struct ieee80211_tx_queue_params *params); |
933 | |||
934 | /* Get statistics of the current TX queue status. This is used to get | ||
935 | * number of currently queued packets (queue length), maximum queue | ||
936 | * size (limit), and total number of packets sent using each TX queue | ||
937 | * (count). | ||
938 | * Currently unused. */ | ||
939 | int (*get_tx_stats)(struct ieee80211_hw *hw, | 1041 | int (*get_tx_stats)(struct ieee80211_hw *hw, |
940 | struct ieee80211_tx_queue_stats *stats); | 1042 | struct ieee80211_tx_queue_stats *stats); |
941 | |||
942 | /* Get the current TSF timer value from firmware/hardware. Currently, | ||
943 | * this is only used for IBSS mode debugging and, as such, is not a | ||
944 | * required function. | ||
945 | * Must be atomic. */ | ||
946 | u64 (*get_tsf)(struct ieee80211_hw *hw); | 1043 | u64 (*get_tsf)(struct ieee80211_hw *hw); |
947 | |||
948 | /* Reset the TSF timer and allow firmware/hardware to synchronize with | ||
949 | * other STAs in the IBSS. This is only used in IBSS mode. This | ||
950 | * function is optional if the firmware/hardware takes full care of | ||
951 | * TSF synchronization. */ | ||
952 | void (*reset_tsf)(struct ieee80211_hw *hw); | 1044 | void (*reset_tsf)(struct ieee80211_hw *hw); |
953 | |||
954 | /* Setup beacon data for IBSS beacons. Unlike access point (Master), | ||
955 | * IBSS uses a fixed beacon frame which is configured using this | ||
956 | * function. This handler is required only for IBSS mode. */ | ||
957 | int (*beacon_update)(struct ieee80211_hw *hw, | 1045 | int (*beacon_update)(struct ieee80211_hw *hw, |
958 | struct sk_buff *skb, | 1046 | struct sk_buff *skb, |
959 | struct ieee80211_tx_control *control); | 1047 | struct ieee80211_tx_control *control); |
960 | |||
961 | /* Determine whether the last IBSS beacon was sent by us. This is | ||
962 | * needed only for IBSS mode and the result of this function is used to | ||
963 | * determine whether to reply to Probe Requests. */ | ||
964 | int (*tx_last_beacon)(struct ieee80211_hw *hw); | 1048 | int (*tx_last_beacon)(struct ieee80211_hw *hw); |
965 | }; | 1049 | }; |
966 | 1050 | ||
967 | /* Allocate a new hardware device. This must be called once for each | 1051 | /** |
968 | * hardware device. The returned pointer must be used to refer to this | 1052 | * ieee80211_alloc_hw - Allocate a new hardware device |
969 | * device when calling other functions. 802.11 code allocates a private data | 1053 | * |
970 | * area for the low-level driver. The size of this area is given as | 1054 | * This must be called once for each hardware device. The returned pointer |
971 | * priv_data_len. | 1055 | * must be used to refer to this device when calling other functions. |
1056 | * mac80211 allocates a private data area for the driver pointed to by | ||
1057 | * @priv in &struct ieee80211_hw, the size of this area is given as | ||
1058 | * @priv_data_len. | ||
1059 | * | ||
1060 | * @priv_data_len: length of private data | ||
1061 | * @ops: callbacks for this device | ||
972 | */ | 1062 | */ |
973 | struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, | 1063 | struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, |
974 | const struct ieee80211_ops *ops); | 1064 | const struct ieee80211_ops *ops); |
975 | 1065 | ||
976 | /* Register hardware device to the IEEE 802.11 code and kernel. Low-level | 1066 | /** |
977 | * drivers must call this function before using any other IEEE 802.11 | 1067 | * ieee80211_register_hw - Register hardware device |
978 | * function except ieee80211_register_hwmode. */ | 1068 | * |
1069 | * You must call this function before any other functions | ||
1070 | * except ieee80211_register_hwmode. | ||
1071 | * | ||
1072 | * @hw: the device to register as returned by ieee80211_alloc_hw() | ||
1073 | */ | ||
979 | int ieee80211_register_hw(struct ieee80211_hw *hw); | 1074 | int ieee80211_register_hw(struct ieee80211_hw *hw); |
980 | 1075 | ||
981 | /* driver can use this and ieee80211_get_rx_led_name to get the | ||
982 | * name of the registered LEDs after ieee80211_register_hw | ||
983 | * was called. | ||
984 | * This is useful to set the default trigger on the LED class | ||
985 | * device that your driver should export for each LED the device | ||
986 | * has, that way the default behaviour will be as expected but | ||
987 | * the user can still change it/turn off the LED etc. | ||
988 | */ | ||
989 | #ifdef CONFIG_MAC80211_LEDS | 1076 | #ifdef CONFIG_MAC80211_LEDS |
990 | extern char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw); | 1077 | extern char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw); |
991 | extern char *__ieee80211_get_rx_led_name(struct ieee80211_hw *hw); | 1078 | extern char *__ieee80211_get_rx_led_name(struct ieee80211_hw *hw); |
992 | #endif | 1079 | #endif |
1080 | /** | ||
1081 | * ieee80211_get_tx_led_name - get name of TX LED | ||
1082 | * | ||
1083 | * mac80211 creates a transmit LED trigger for each wireless hardware | ||
1084 | * that can be used to drive LEDs if your driver registers a LED device. | ||
1085 | * This function returns the name (or %NULL if not configured for LEDs) | ||
1086 | * of the trigger so you can automatically link the LED device. | ||
1087 | * | ||
1088 | * @hw: the hardware to get the LED trigger name for | ||
1089 | */ | ||
993 | static inline char *ieee80211_get_tx_led_name(struct ieee80211_hw *hw) | 1090 | static inline char *ieee80211_get_tx_led_name(struct ieee80211_hw *hw) |
994 | { | 1091 | { |
995 | #ifdef CONFIG_MAC80211_LEDS | 1092 | #ifdef CONFIG_MAC80211_LEDS |
@@ -999,6 +1096,16 @@ static inline char *ieee80211_get_tx_led_name(struct ieee80211_hw *hw) | |||
999 | #endif | 1096 | #endif |
1000 | } | 1097 | } |
1001 | 1098 | ||
1099 | /** | ||
1100 | * ieee80211_get_rx_led_name - get name of RX LED | ||
1101 | * | ||
1102 | * mac80211 creates a receive LED trigger for each wireless hardware | ||
1103 | * that can be used to drive LEDs if your driver registers a LED device. | ||
1104 | * This function returns the name (or %NULL if not configured for LEDs) | ||
1105 | * of the trigger so you can automatically link the LED device. | ||
1106 | * | ||
1107 | * @hw: the hardware to get the LED trigger name for | ||
1108 | */ | ||
1002 | static inline char *ieee80211_get_rx_led_name(struct ieee80211_hw *hw) | 1109 | static inline char *ieee80211_get_rx_led_name(struct ieee80211_hw *hw) |
1003 | { | 1110 | { |
1004 | #ifdef CONFIG_MAC80211_LEDS | 1111 | #ifdef CONFIG_MAC80211_LEDS |
@@ -1012,29 +1119,80 @@ static inline char *ieee80211_get_rx_led_name(struct ieee80211_hw *hw) | |||
1012 | int ieee80211_register_hwmode(struct ieee80211_hw *hw, | 1119 | int ieee80211_register_hwmode(struct ieee80211_hw *hw, |
1013 | struct ieee80211_hw_mode *mode); | 1120 | struct ieee80211_hw_mode *mode); |
1014 | 1121 | ||
1015 | /* Unregister a hardware device. This function instructs 802.11 code to free | 1122 | /** |
1016 | * allocated resources and unregister netdevices from the kernel. */ | 1123 | * ieee80211_unregister_hw - Unregister a hardware device |
1124 | * | ||
1125 | * This function instructs mac80211 to free allocated resources | ||
1126 | * and unregister netdevices from the networking subsystem. | ||
1127 | * | ||
1128 | * @hw: the hardware to unregister | ||
1129 | */ | ||
1017 | void ieee80211_unregister_hw(struct ieee80211_hw *hw); | 1130 | void ieee80211_unregister_hw(struct ieee80211_hw *hw); |
1018 | 1131 | ||
1019 | /* Free everything that was allocated including private data of a driver. */ | 1132 | /** |
1133 | * ieee80211_free_hw - free hardware descriptor | ||
1134 | * | ||
1135 | * This function frees everything that was allocated, including the | ||
1136 | * private data for the driver. You must call ieee80211_unregister_hw() | ||
1137 | * before calling this function | ||
1138 | * | ||
1139 | * @hw: the hardware to free | ||
1140 | */ | ||
1020 | void ieee80211_free_hw(struct ieee80211_hw *hw); | 1141 | void ieee80211_free_hw(struct ieee80211_hw *hw); |
1021 | 1142 | ||
1022 | /* Receive frame callback function. The low-level driver uses this function to | 1143 | /* trick to avoid symbol clashes with the ieee80211 subsystem */ |
1023 | * send received frames to the IEEE 802.11 code. Receive buffer (skb) must | ||
1024 | * start with IEEE 802.11 header. */ | ||
1025 | void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, | 1144 | void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, |
1026 | struct ieee80211_rx_status *status); | 1145 | struct ieee80211_rx_status *status); |
1146 | |||
1147 | /** | ||
1148 | * ieee80211_rx - receive frame | ||
1149 | * | ||
1150 | * Use this function to hand received frames to mac80211. The receive | ||
1151 | * buffer in @skb must start with an IEEE 802.11 header or a radiotap | ||
1152 | * header if %RX_FLAG_RADIOTAP is set in the @status flags. | ||
1153 | * | ||
1154 | * This function may not be called in IRQ context. | ||
1155 | * | ||
1156 | * @hw: the hardware this frame came in on | ||
1157 | * @skb: the buffer to receive, owned by mac80211 after this call | ||
1158 | * @status: status of this frame; the status pointer need not be valid | ||
1159 | * after this function returns | ||
1160 | */ | ||
1161 | static inline void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, | ||
1162 | struct ieee80211_rx_status *status) | ||
1163 | { | ||
1164 | __ieee80211_rx(hw, skb, status); | ||
1165 | } | ||
1166 | |||
1167 | /** | ||
1168 | * ieee80211_rx_irqsafe - receive frame | ||
1169 | * | ||
1170 | * Like ieee80211_rx() but can be called in IRQ context | ||
1171 | * (internally defers to a workqueue.) | ||
1172 | * | ||
1173 | * @hw: the hardware this frame came in on | ||
1174 | * @skb: the buffer to receive, owned by mac80211 after this call | ||
1175 | * @status: status of this frame; the status pointer need not be valid | ||
1176 | * after this function returns and is not freed by mac80211, | ||
1177 | * it is recommended that it points to a stack area | ||
1178 | */ | ||
1027 | void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, | 1179 | void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, |
1028 | struct sk_buff *skb, | 1180 | struct sk_buff *skb, |
1029 | struct ieee80211_rx_status *status); | 1181 | struct ieee80211_rx_status *status); |
1030 | 1182 | ||
1031 | /* Transmit status callback function. The low-level driver must call this | 1183 | /** |
1032 | * function to report transmit status for all the TX frames that had | 1184 | * ieee80211_tx_status - transmit status callback |
1033 | * req_tx_status set in the transmit control fields. In addition, this should | 1185 | * |
1034 | * be called at least for all unicast frames to provide information for TX rate | 1186 | * Call this function for all transmitted frames after they have been |
1035 | * control algorithm. In order to maintain all statistics, this function is | 1187 | * transmitted. It is permissible to not call this function for |
1036 | * recommended to be called after each frame, including multicast/broadcast, is | 1188 | * multicast frames but this can affect statistics. |
1037 | * sent. */ | 1189 | * |
1190 | * @hw: the hardware the frame was transmitted by | ||
1191 | * @skb: the frame that was transmitted, owned by mac80211 after this call | ||
1192 | * @status: status information for this frame; the status pointer need not | ||
1193 | * be valid after this function returns and is not freed by mac80211, | ||
1194 | * it is recommended that it points to a stack area | ||
1195 | */ | ||
1038 | void ieee80211_tx_status(struct ieee80211_hw *hw, | 1196 | void ieee80211_tx_status(struct ieee80211_hw *hw, |
1039 | struct sk_buff *skb, | 1197 | struct sk_buff *skb, |
1040 | struct ieee80211_tx_status *status); | 1198 | struct ieee80211_tx_status *status); |
@@ -1166,14 +1324,26 @@ struct sk_buff * | |||
1166 | ieee80211_get_buffered_bc(struct ieee80211_hw *hw, int if_id, | 1324 | ieee80211_get_buffered_bc(struct ieee80211_hw *hw, int if_id, |
1167 | struct ieee80211_tx_control *control); | 1325 | struct ieee80211_tx_control *control); |
1168 | 1326 | ||
1169 | /* Given an sk_buff with a raw 802.11 header at the data pointer this function | 1327 | /** |
1328 | * ieee80211_get_hdrlen_from_skb - get header length from data | ||
1329 | * | ||
1330 | * Given an skb with a raw 802.11 header at the data pointer this function | ||
1170 | * returns the 802.11 header length in bytes (not including encryption | 1331 | * returns the 802.11 header length in bytes (not including encryption |
1171 | * headers). If the data in the sk_buff is too short to contain a valid 802.11 | 1332 | * headers). If the data in the sk_buff is too short to contain a valid 802.11 |
1172 | * header the function returns 0. | 1333 | * header the function returns 0. |
1334 | * | ||
1335 | * @skb: the frame | ||
1173 | */ | 1336 | */ |
1174 | int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); | 1337 | int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); |
1175 | 1338 | ||
1176 | /* Like ieee80211_get_hdrlen_from_skb() but takes a FC in CPU order. */ | 1339 | /** |
1340 | * ieee80211_get_hdrlen - get header length from frame control | ||
1341 | * | ||
1342 | * This function returns the 802.11 header length in bytes (not including | ||
1343 | * encryption headers.) | ||
1344 | * | ||
1345 | * @fc: the frame control field (in CPU endianness) | ||
1346 | */ | ||
1177 | int ieee80211_get_hdrlen(u16 fc); | 1347 | int ieee80211_get_hdrlen(u16 fc); |
1178 | 1348 | ||
1179 | /** | 1349 | /** |
@@ -1218,10 +1388,28 @@ void ieee80211_stop_queues(struct ieee80211_hw *hw); | |||
1218 | */ | 1388 | */ |
1219 | void ieee80211_wake_queues(struct ieee80211_hw *hw); | 1389 | void ieee80211_wake_queues(struct ieee80211_hw *hw); |
1220 | 1390 | ||
1221 | /* called by driver to notify scan status completed */ | 1391 | /** |
1392 | * ieee80211_scan_completed - completed hardware scan | ||
1393 | * | ||
1394 | * When hardware scan offload is used (i.e. the hw_scan() callback is | ||
1395 | * assigned) this function needs to be called by the driver to notify | ||
1396 | * mac80211 that the scan finished. | ||
1397 | * | ||
1398 | * @hw: the hardware that finished the scan | ||
1399 | */ | ||
1222 | void ieee80211_scan_completed(struct ieee80211_hw *hw); | 1400 | void ieee80211_scan_completed(struct ieee80211_hw *hw); |
1223 | 1401 | ||
1224 | /* return a pointer to the source address (SA) */ | 1402 | /** |
1403 | * ieee80211_get_SA - get pointer to SA | ||
1404 | * | ||
1405 | * Given an 802.11 frame, this function returns the offset | ||
1406 | * to the source address (SA). It does not verify that the | ||
1407 | * header is long enough to contain the address, and the | ||
1408 | * header must be long enough to contain the frame control | ||
1409 | * field. | ||
1410 | * | ||
1411 | * @hdr: the frame | ||
1412 | */ | ||
1225 | static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr) | 1413 | static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr) |
1226 | { | 1414 | { |
1227 | u8 *raw = (u8 *) hdr; | 1415 | u8 *raw = (u8 *) hdr; |
@@ -1236,7 +1424,17 @@ static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr) | |||
1236 | return hdr->addr2; | 1424 | return hdr->addr2; |
1237 | } | 1425 | } |
1238 | 1426 | ||
1239 | /* return a pointer to the destination address (DA) */ | 1427 | /** |
1428 | * ieee80211_get_DA - get pointer to DA | ||
1429 | * | ||
1430 | * Given an 802.11 frame, this function returns the offset | ||
1431 | * to the destination address (DA). It does not verify that | ||
1432 | * the header is long enough to contain the address, and the | ||
1433 | * header must be long enough to contain the frame control | ||
1434 | * field. | ||
1435 | * | ||
1436 | * @hdr: the frame | ||
1437 | */ | ||
1240 | static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr) | 1438 | static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr) |
1241 | { | 1439 | { |
1242 | u8 *raw = (u8 *) hdr; | 1440 | u8 *raw = (u8 *) hdr; |
@@ -1247,6 +1445,14 @@ static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr) | |||
1247 | return hdr->addr1; | 1445 | return hdr->addr1; |
1248 | } | 1446 | } |
1249 | 1447 | ||
1448 | /** | ||
1449 | * ieee80211_get_morefrag - determine whether the MOREFRAGS bit is set | ||
1450 | * | ||
1451 | * This function determines whether the "more fragments" bit is set | ||
1452 | * in the frame. | ||
1453 | * | ||
1454 | * @hdr: the frame | ||
1455 | */ | ||
1250 | static inline int ieee80211_get_morefrag(struct ieee80211_hdr *hdr) | 1456 | static inline int ieee80211_get_morefrag(struct ieee80211_hdr *hdr) |
1251 | { | 1457 | { |
1252 | return (le16_to_cpu(hdr->frame_control) & | 1458 | return (le16_to_cpu(hdr->frame_control) & |