/* * Copyright (c) 2014 Redpine Signals Inc. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include <linux/etherdevice.h> #include "rsi_debugfs.h" #include "rsi_mgmt.h" #include "rsi_sdio.h" #include "rsi_common.h" #include "rsi_ps.h" static const struct ieee80211_channel rsi_2ghz_channels[] = …; static const struct ieee80211_channel rsi_5ghz_channels[] = …; struct ieee80211_rate rsi_rates[12] = …; const u16 rsi_mcsrates[8] = …; static const u32 rsi_max_ap_stas[16] = …; static const struct ieee80211_iface_limit rsi_iface_limits[] = …; static const struct ieee80211_iface_combination rsi_iface_combinations[] = …; /** * rsi_is_cipher_wep() - This function determines if the cipher is WEP or not. * @common: Pointer to the driver private structure. * * Return: If cipher type is WEP, a value of 1 is returned, else 0. */ bool rsi_is_cipher_wep(struct rsi_common *common) { … } /** * rsi_register_rates_channels() - This function registers channels and rates. * @adapter: Pointer to the adapter structure. * @band: Operating band to be set. * * Return: int - 0 on success, negative error on failure. */ static int rsi_register_rates_channels(struct rsi_hw *adapter, int band) { … } static int rsi_mac80211_hw_scan_start(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_scan_request *hw_req) { … } static void rsi_mac80211_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { … } /** * rsi_mac80211_detach() - This function is used to de-initialize the * Mac80211 stack. * @adapter: Pointer to the adapter structure. * * Return: None. */ void rsi_mac80211_detach(struct rsi_hw *adapter) { … } EXPORT_SYMBOL_GPL(…); /** * rsi_indicate_tx_status() - This function indicates the transmit status. * @adapter: Pointer to the adapter structure. * @skb: Pointer to the socket buffer structure. * @status: Status * * Return: None. */ void rsi_indicate_tx_status(struct rsi_hw *adapter, struct sk_buff *skb, int status) { … } /** * rsi_mac80211_tx() - This is the handler that 802.11 module calls for each * transmitted frame.SKB contains the buffer starting * from the IEEE 802.11 header. * @hw: Pointer to the ieee80211_hw structure. * @control: Pointer to the ieee80211_tx_control structure * @skb: Pointer to the socket buffer structure. * * Return: None */ static void rsi_mac80211_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, struct sk_buff *skb) { … } /** * rsi_mac80211_start() - This is first handler that 802.11 module calls, since * the driver init is complete by then, just * returns success. * @hw: Pointer to the ieee80211_hw structure. * * Return: 0 as success. */ static int rsi_mac80211_start(struct ieee80211_hw *hw) { … } /** * rsi_mac80211_stop() - This is the last handler that 802.11 module calls. * @hw: Pointer to the ieee80211_hw structure. * @suspend: true if the this was called from suspend flow. * * Return: None. */ static void rsi_mac80211_stop(struct ieee80211_hw *hw, bool suspend) { … } static int rsi_map_intf_mode(enum nl80211_iftype vif_type) { … } /** * rsi_mac80211_add_interface() - This function is called when a netdevice * attached to the hardware is enabled. * @hw: Pointer to the ieee80211_hw structure. * @vif: Pointer to the ieee80211_vif structure. * * Return: ret: 0 on success, negative error code on failure. */ static int rsi_mac80211_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { … } /** * rsi_mac80211_remove_interface() - This function notifies driver that an * interface is going down. * @hw: Pointer to the ieee80211_hw structure. * @vif: Pointer to the ieee80211_vif structure. * * Return: None. */ static void rsi_mac80211_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { … } /** * rsi_channel_change() - This function is a performs the checks * required for changing a channel and sets * the channel accordingly. * @hw: Pointer to the ieee80211_hw structure. * * Return: 0 on success, negative error code on failure. */ static int rsi_channel_change(struct ieee80211_hw *hw) { … } /** * rsi_config_power() - This function configures tx power to device * @hw: Pointer to the ieee80211_hw structure. * * Return: 0 on success, negative error code on failure. */ static int rsi_config_power(struct ieee80211_hw *hw) { … } /** * rsi_mac80211_config() - This function is a handler for configuration * requests. The stack calls this function to * change hardware configuration, e.g., channel. * @hw: Pointer to the ieee80211_hw structure. * @changed: Changed flags set. * * Return: 0 on success, negative error code on failure. */ static int rsi_mac80211_config(struct ieee80211_hw *hw, u32 changed) { … } /** * rsi_get_connected_channel() - This function is used to get the current * connected channel number. * @vif: Pointer to the ieee80211_vif structure. * * Return: Current connected AP's channel number is returned. */ u16 rsi_get_connected_channel(struct ieee80211_vif *vif) { … } static void rsi_switch_channel(struct rsi_hw *adapter, struct ieee80211_vif *vif) { … } /** * rsi_mac80211_bss_info_changed() - This function is a handler for config * requests related to BSS parameters that * may vary during BSS's lifespan. * @hw: Pointer to the ieee80211_hw structure. * @vif: Pointer to the ieee80211_vif structure. * @bss_conf: Pointer to the ieee80211_bss_conf structure. * @changed: Changed flags set. * * Return: None. */ static void rsi_mac80211_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_bss_conf *bss_conf, u64 changed) { … } /** * rsi_mac80211_conf_filter() - This function configure the device's RX filter. * @hw: Pointer to the ieee80211_hw structure. * @changed_flags: Changed flags set. * @total_flags: Total initial flags set. * @multicast: Multicast. * * Return: None. */ static void rsi_mac80211_conf_filter(struct ieee80211_hw *hw, u32 changed_flags, u32 *total_flags, u64 multicast) { … } /** * rsi_mac80211_conf_tx() - This function configures TX queue parameters * (EDCF (aifs, cw_min, cw_max), bursting) * for a hardware TX queue. * @hw: Pointer to the ieee80211_hw structure * @vif: Pointer to the ieee80211_vif structure. * @link_id: the link ID if MLO is used, otherwise 0 * @queue: Queue number. * @params: Pointer to ieee80211_tx_queue_params structure. * * Return: 0 on success, negative error code on failure. */ static int rsi_mac80211_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, unsigned int link_id, u16 queue, const struct ieee80211_tx_queue_params *params) { … } /** * rsi_hal_key_config() - This function loads the keys into the firmware. * @hw: Pointer to the ieee80211_hw structure. * @vif: Pointer to the ieee80211_vif structure. * @key: Pointer to the ieee80211_key_conf structure. * @sta: Pointer to the ieee80211_sta structure. * * Return: status: 0 on success, negative error codes on failure. */ static int rsi_hal_key_config(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_key_conf *key, struct ieee80211_sta *sta) { … } /** * rsi_mac80211_set_key() - This function sets type of key to be loaded. * @hw: Pointer to the ieee80211_hw structure. * @cmd: enum set_key_cmd. * @vif: Pointer to the ieee80211_vif structure. * @sta: Pointer to the ieee80211_sta structure. * @key: Pointer to the ieee80211_key_conf structure. * * Return: status: 0 on success, negative error code on failure. */ static int rsi_mac80211_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct ieee80211_key_conf *key) { … } /** * rsi_mac80211_ampdu_action() - This function selects the AMPDU action for * the corresponding mlme_action flag and * informs the f/w regarding this. * @hw: Pointer to the ieee80211_hw structure. * @vif: Pointer to the ieee80211_vif structure. * @params: Pointer to A-MPDU action parameters * * Return: status: 0 on success, negative error code on failure. */ static int rsi_mac80211_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_ampdu_params *params) { … } /** * rsi_mac80211_set_rts_threshold() - This function sets rts threshold value. * @hw: Pointer to the ieee80211_hw structure. * @value: Rts threshold value. * * Return: 0 on success. */ static int rsi_mac80211_set_rts_threshold(struct ieee80211_hw *hw, u32 value) { … } /** * rsi_mac80211_set_rate_mask() - This function sets bitrate_mask to be used. * @hw: Pointer to the ieee80211_hw structure * @vif: Pointer to the ieee80211_vif structure. * @mask: Pointer to the cfg80211_bitrate_mask structure. * * Return: 0 on success. */ static int rsi_mac80211_set_rate_mask(struct ieee80211_hw *hw, struct ieee80211_vif *vif, const struct cfg80211_bitrate_mask *mask) { … } /** * rsi_perform_cqm() - This function performs cqm. * @common: Pointer to the driver private structure. * @bssid: pointer to the bssid. * @rssi: RSSI value. * @vif: Pointer to the ieee80211_vif structure. */ static void rsi_perform_cqm(struct rsi_common *common, u8 *bssid, s8 rssi, struct ieee80211_vif *vif) { … } /** * rsi_fill_rx_status() - This function fills rx status in * ieee80211_rx_status structure. * @hw: Pointer to the ieee80211_hw structure. * @skb: Pointer to the socket buffer structure. * @common: Pointer to the driver private structure. * @rxs: Pointer to the ieee80211_rx_status structure. * * Return: None. */ static void rsi_fill_rx_status(struct ieee80211_hw *hw, struct sk_buff *skb, struct rsi_common *common, struct ieee80211_rx_status *rxs) { … } /** * rsi_indicate_pkt_to_os() - This function sends received packet to mac80211. * @common: Pointer to the driver private structure. * @skb: Pointer to the socket buffer structure. * * Return: None. */ void rsi_indicate_pkt_to_os(struct rsi_common *common, struct sk_buff *skb) { … } /** * rsi_mac80211_sta_add() - This function notifies driver about a peer getting * connected. * @hw: pointer to the ieee80211_hw structure. * @vif: Pointer to the ieee80211_vif structure. * @sta: Pointer to the ieee80211_sta structure. * * Return: 0 on success, negative error codes on failure. */ static int rsi_mac80211_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { … } /** * rsi_mac80211_sta_remove() - This function notifies driver about a peer * getting disconnected. * @hw: Pointer to the ieee80211_hw structure. * @vif: Pointer to the ieee80211_vif structure. * @sta: Pointer to the ieee80211_sta structure. * * Return: 0 on success, negative error codes on failure. */ static int rsi_mac80211_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { … } /** * rsi_mac80211_set_antenna() - This function is used to configure * tx and rx antennas. * @hw: Pointer to the ieee80211_hw structure. * @tx_ant: Bitmap for tx antenna * @rx_ant: Bitmap for rx antenna * * Return: 0 on success, Negative error code on failure. */ static int rsi_mac80211_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant) { … } /** * rsi_mac80211_get_antenna() - This function is used to configure * tx and rx antennas. * * @hw: Pointer to the ieee80211_hw structure. * @tx_ant: Bitmap for tx antenna * @rx_ant: Bitmap for rx antenna * * Return: 0 on success, negative error codes on failure. */ static int rsi_mac80211_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant) { … } static int rsi_map_region_code(enum nl80211_dfs_regions region_code) { … } static void rsi_reg_notify(struct wiphy *wiphy, struct regulatory_request *request) { … } static void rsi_mac80211_rfkill_poll(struct ieee80211_hw *hw) { … } static void rsi_resume_conn_channel(struct rsi_common *common) { … } void rsi_roc_timeout(struct timer_list *t) { … } static int rsi_mac80211_roc(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_channel *chan, int duration, enum ieee80211_roc_type type) { … } static int rsi_mac80211_cancel_roc(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { … } #ifdef CONFIG_PM static const struct wiphy_wowlan_support rsi_wowlan_support = …; static u16 rsi_wow_map_triggers(struct rsi_common *common, struct cfg80211_wowlan *wowlan) { … } int rsi_config_wowlan(struct rsi_hw *adapter, struct cfg80211_wowlan *wowlan) { … } EXPORT_SYMBOL(…); static int rsi_mac80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) { … } static int rsi_mac80211_resume(struct ieee80211_hw *hw) { … } #endif static const struct ieee80211_ops mac80211_ops = …; /** * rsi_mac80211_attach() - This function is used to initialize Mac80211 stack. * @common: Pointer to the driver private structure. * * Return: 0 on success, negative error codes on failure. */ int rsi_mac80211_attach(struct rsi_common *common) { … }