#define pr_fmt(fmt) …
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/dma-mapping.h>
#include <linux/delay.h>
#include <linux/sched.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include <linux/firmware.h>
#include <linux/etherdevice.h>
#include <linux/if_arp.h>
#include <linux/units.h>
#include <net/mac80211.h>
#include <asm/div64.h>
#define DRV_NAME …
#include "common.h"
#include "4965.h"
#define DRV_DESCRIPTION …
#ifdef CONFIG_IWLEGACY_DEBUG
#define VD …
#else
#define VD
#endif
#define DRV_VERSION …
MODULE_DESCRIPTION(…);
MODULE_VERSION(…);
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;
MODULE_ALIAS(…) …;
void
il4965_check_abort_status(struct il_priv *il, u8 frame_count, u32 status)
{ … }
struct il_mod_params il4965_mod_params = …;
void
il4965_rx_queue_reset(struct il_priv *il, struct il_rx_queue *rxq)
{ … }
int
il4965_rx_init(struct il_priv *il, struct il_rx_queue *rxq)
{ … }
static void
il4965_set_pwr_vmain(struct il_priv *il)
{ … }
int
il4965_hw_nic_init(struct il_priv *il)
{ … }
static inline __le32
il4965_dma_addr2rbd_ptr(struct il_priv *il, dma_addr_t dma_addr)
{ … }
void
il4965_rx_queue_restock(struct il_priv *il)
{ … }
static void
il4965_rx_allocate(struct il_priv *il, gfp_t priority)
{ … }
void
il4965_rx_replenish(struct il_priv *il)
{ … }
void
il4965_rx_replenish_now(struct il_priv *il)
{ … }
void
il4965_rx_queue_free(struct il_priv *il, struct il_rx_queue *rxq)
{ … }
int
il4965_rxq_stop(struct il_priv *il)
{ … }
int
il4965_hwrate_to_mac80211_idx(u32 rate_n_flags, enum nl80211_band band)
{ … }
static int
il4965_calc_rssi(struct il_priv *il, struct il_rx_phy_res *rx_resp)
{ … }
static u32
il4965_translate_rx_status(struct il_priv *il, u32 decrypt_in)
{ … }
#define SMALL_PACKET_SIZE …
static void
il4965_pass_packet_to_mac80211(struct il_priv *il, struct ieee80211_hdr *hdr,
u32 len, u32 ampdu_status, struct il_rx_buf *rxb,
struct ieee80211_rx_status *stats)
{ … }
static void
il4965_hdl_rx(struct il_priv *il, struct il_rx_buf *rxb)
{ … }
static void
il4965_hdl_rx_phy(struct il_priv *il, struct il_rx_buf *rxb)
{ … }
static int
il4965_get_channels_for_scan(struct il_priv *il, struct ieee80211_vif *vif,
enum nl80211_band band, u8 is_active,
u8 n_probes, struct il_scan_channel *scan_ch)
{ … }
static void
il4965_toggle_tx_ant(struct il_priv *il, u8 *ant, u8 valid)
{ … }
int
il4965_request_scan(struct il_priv *il, struct ieee80211_vif *vif)
{ … }
int
il4965_manage_ibss_station(struct il_priv *il, struct ieee80211_vif *vif,
bool add)
{ … }
void
il4965_free_tfds_in_queue(struct il_priv *il, int sta_id, int tid, int freed)
{ … }
#define IL_TX_QUEUE_MSK …
static bool
il4965_is_single_rx_stream(struct il_priv *il)
{ … }
#define IL_NUM_RX_CHAINS_MULTIPLE …
#define IL_NUM_RX_CHAINS_SINGLE …
#define IL_NUM_IDLE_CHAINS_DUAL …
#define IL_NUM_IDLE_CHAINS_SINGLE …
static int
il4965_get_active_rx_chain_count(struct il_priv *il)
{ … }
static int
il4965_get_idle_rx_chain_count(struct il_priv *il, int active_cnt)
{ … }
static u8
il4965_count_chain_bitmap(u32 chain_bitmap)
{ … }
void
il4965_set_rxon_chain(struct il_priv *il)
{ … }
static const char *
il4965_get_fh_string(int cmd)
{ … }
int
il4965_dump_fh(struct il_priv *il, char **buf, bool display)
{ … }
static void
il4965_hdl_missed_beacon(struct il_priv *il, struct il_rx_buf *rxb)
{ … }
static void
il4965_rx_calc_noise(struct il_priv *il)
{ … }
#ifdef CONFIG_IWLEGACY_DEBUGFS
static void
il4965_accumulative_stats(struct il_priv *il, __le32 * stats)
{ … }
#endif
static void
il4965_hdl_stats(struct il_priv *il, struct il_rx_buf *rxb)
{ … }
static void
il4965_hdl_c_stats(struct il_priv *il, struct il_rx_buf *rxb)
{ … }
static const u8 tid_to_ac[] = …;
static inline int
il4965_get_ac_from_tid(u16 tid)
{ … }
static inline int
il4965_get_fifo_from_tid(u16 tid)
{ … }
static void
il4965_tx_cmd_build_basic(struct il_priv *il, struct sk_buff *skb,
struct il_tx_cmd *tx_cmd,
struct ieee80211_tx_info *info,
struct ieee80211_hdr *hdr, u8 std_id)
{ … }
static void
il4965_tx_cmd_build_rate(struct il_priv *il,
struct il_tx_cmd *tx_cmd,
struct ieee80211_tx_info *info,
struct ieee80211_sta *sta,
__le16 fc)
{ … }
static void
il4965_tx_cmd_build_hwcrypto(struct il_priv *il, struct ieee80211_tx_info *info,
struct il_tx_cmd *tx_cmd, struct sk_buff *skb_frag,
int sta_id)
{ … }
int
il4965_tx_skb(struct il_priv *il,
struct ieee80211_sta *sta,
struct sk_buff *skb)
{ … }
static inline int
il4965_alloc_dma_ptr(struct il_priv *il, struct il_dma_ptr *ptr, size_t size)
{ … }
static inline void
il4965_free_dma_ptr(struct il_priv *il, struct il_dma_ptr *ptr)
{ … }
void
il4965_hw_txq_ctx_free(struct il_priv *il)
{ … }
int
il4965_txq_ctx_alloc(struct il_priv *il)
{ … }
void
il4965_txq_ctx_reset(struct il_priv *il)
{ … }
static void
il4965_txq_ctx_unmap(struct il_priv *il)
{ … }
void
il4965_txq_ctx_stop(struct il_priv *il)
{ … }
static int
il4965_txq_ctx_activate_free(struct il_priv *il)
{ … }
static void
il4965_tx_queue_stop_scheduler(struct il_priv *il, u16 txq_id)
{ … }
static int
il4965_tx_queue_set_q2ratid(struct il_priv *il, u16 ra_tid, u16 txq_id)
{ … }
static int
il4965_txq_agg_enable(struct il_priv *il, int txq_id, int tx_fifo, int sta_id,
int tid, u16 ssn_idx)
{ … }
int
il4965_tx_agg_start(struct il_priv *il, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, u16 tid, u16 * ssn)
{ … }
static int
il4965_txq_agg_disable(struct il_priv *il, u16 txq_id, u16 ssn_idx, u8 tx_fifo)
{ … }
int
il4965_tx_agg_stop(struct il_priv *il, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, u16 tid)
{ … }
int
il4965_txq_check_empty(struct il_priv *il, int sta_id, u8 tid, int txq_id)
{ … }
static void
il4965_non_agg_tx_status(struct il_priv *il, const u8 *addr1)
{ … }
static void
il4965_tx_status(struct il_priv *il, struct sk_buff *skb, bool is_agg)
{ … }
int
il4965_tx_queue_reclaim(struct il_priv *il, int txq_id, int idx)
{ … }
static int
il4965_tx_status_reply_compressed_ba(struct il_priv *il, struct il_ht_agg *agg,
struct il_compressed_ba_resp *ba_resp)
{ … }
static inline bool
il4965_is_tx_success(u32 status)
{ … }
static u8
il4965_find_station(struct il_priv *il, const u8 *addr)
{ … }
static int
il4965_get_ra_sta_id(struct il_priv *il, struct ieee80211_hdr *hdr)
{ … }
static inline u32
il4965_get_scd_ssn(struct il4965_tx_resp *tx_resp)
{ … }
static inline u32
il4965_tx_status_to_mac80211(u32 status)
{ … }
static int
il4965_tx_status_reply_tx(struct il_priv *il, struct il_ht_agg *agg,
struct il4965_tx_resp *tx_resp, int txq_id,
u16 start_idx)
{ … }
static void
il4965_hdl_tx(struct il_priv *il, struct il_rx_buf *rxb)
{ … }
void
il4965_hwrate_to_tx_control(struct il_priv *il, u32 rate_n_flags,
struct ieee80211_tx_info *info)
{ … }
static void
il4965_hdl_compressed_ba(struct il_priv *il, struct il_rx_buf *rxb)
{ … }
#ifdef CONFIG_IWLEGACY_DEBUG
const char *
il4965_get_tx_fail_reason(u32 status)
{ … }
#endif
static struct il_link_quality_cmd *
il4965_sta_alloc_lq(struct il_priv *il, u8 sta_id)
{ … }
int
il4965_add_bssid_station(struct il_priv *il, const u8 *addr, u8 *sta_id_r)
{ … }
static int
il4965_static_wepkey_cmd(struct il_priv *il, bool send_if_empty)
{ … }
int
il4965_restore_default_wep_keys(struct il_priv *il)
{ … }
int
il4965_remove_default_wep_key(struct il_priv *il,
struct ieee80211_key_conf *keyconf)
{ … }
int
il4965_set_default_wep_key(struct il_priv *il,
struct ieee80211_key_conf *keyconf)
{ … }
static int
il4965_set_wep_dynamic_key_info(struct il_priv *il,
struct ieee80211_key_conf *keyconf, u8 sta_id)
{ … }
static int
il4965_set_ccmp_dynamic_key_info(struct il_priv *il,
struct ieee80211_key_conf *keyconf, u8 sta_id)
{ … }
static int
il4965_set_tkip_dynamic_key_info(struct il_priv *il,
struct ieee80211_key_conf *keyconf, u8 sta_id)
{ … }
void
il4965_update_tkip_key(struct il_priv *il, struct ieee80211_key_conf *keyconf,
struct ieee80211_sta *sta, u32 iv32, u16 *phase1key)
{ … }
int
il4965_remove_dynamic_key(struct il_priv *il,
struct ieee80211_key_conf *keyconf, u8 sta_id)
{ … }
int
il4965_set_dynamic_key(struct il_priv *il, struct ieee80211_key_conf *keyconf,
u8 sta_id)
{ … }
int
il4965_alloc_bcast_station(struct il_priv *il)
{ … }
static int
il4965_update_bcast_station(struct il_priv *il)
{ … }
int
il4965_update_bcast_stations(struct il_priv *il)
{ … }
int
il4965_sta_tx_modify_enable_tid(struct il_priv *il, int sta_id, int tid)
{ … }
int
il4965_sta_rx_agg_start(struct il_priv *il, struct ieee80211_sta *sta, int tid,
u16 ssn)
{ … }
int
il4965_sta_rx_agg_stop(struct il_priv *il, struct ieee80211_sta *sta, int tid)
{ … }
void
il4965_sta_modify_sleep_tx_count(struct il_priv *il, int sta_id, int cnt)
{ … }
void
il4965_update_chain_flags(struct il_priv *il)
{ … }
static void
il4965_clear_free_frames(struct il_priv *il)
{ … }
static struct il_frame *
il4965_get_free_frame(struct il_priv *il)
{ … }
static void
il4965_free_frame(struct il_priv *il, struct il_frame *frame)
{ … }
static u32
il4965_fill_beacon_frame(struct il_priv *il, struct ieee80211_hdr *hdr,
int left)
{ … }
static void
il4965_set_beacon_tim(struct il_priv *il,
struct il_tx_beacon_cmd *tx_beacon_cmd, u8 * beacon,
u32 frame_size)
{ … }
static unsigned int
il4965_hw_get_beacon_cmd(struct il_priv *il, struct il_frame *frame)
{ … }
int
il4965_send_beacon_cmd(struct il_priv *il)
{ … }
static inline dma_addr_t
il4965_tfd_tb_get_addr(struct il_tfd *tfd, u8 idx)
{ … }
static inline u16
il4965_tfd_tb_get_len(struct il_tfd *tfd, u8 idx)
{ … }
static inline void
il4965_tfd_set_tb(struct il_tfd *tfd, u8 idx, dma_addr_t addr, u16 len)
{ … }
static inline u8
il4965_tfd_get_num_tbs(struct il_tfd *tfd)
{ … }
void
il4965_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq)
{ … }
int
il4965_hw_txq_attach_buf_to_tfd(struct il_priv *il, struct il_tx_queue *txq,
dma_addr_t addr, u16 len, u8 reset, u8 pad)
{ … }
int
il4965_hw_tx_queue_init(struct il_priv *il, struct il_tx_queue *txq)
{ … }
static void
il4965_hdl_alive(struct il_priv *il, struct il_rx_buf *rxb)
{ … }
static void
il4965_bg_stats_periodic(struct timer_list *t)
{ … }
static void
il4965_hdl_beacon(struct il_priv *il, struct il_rx_buf *rxb)
{ … }
static void
il4965_perform_ct_kill_task(struct il_priv *il)
{ … }
static void
il4965_hdl_card_state(struct il_priv *il, struct il_rx_buf *rxb)
{ … }
static void
il4965_setup_handlers(struct il_priv *il)
{ … }
void
il4965_rx_handle(struct il_priv *il)
{ … }
static inline void
il4965_synchronize_irq(struct il_priv *il)
{ … }
static void
il4965_irq_tasklet(struct tasklet_struct *t)
{ … }
#ifdef CONFIG_IWLEGACY_DEBUG
static ssize_t
il4965_show_debug_level(struct device *d, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t
il4965_store_debug_level(struct device *d, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static DEVICE_ATTR(debug_level, 0644, il4965_show_debug_level,
il4965_store_debug_level);
#endif
static ssize_t
il4965_show_temperature(struct device *d, struct device_attribute *attr,
char *buf)
{ … }
static DEVICE_ATTR(temperature, 0444, il4965_show_temperature, NULL);
static ssize_t
il4965_show_tx_power(struct device *d, struct device_attribute *attr, char *buf)
{ … }
static ssize_t
il4965_store_tx_power(struct device *d, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static DEVICE_ATTR(tx_power, 0644, il4965_show_tx_power,
il4965_store_tx_power);
static struct attribute *il_sysfs_entries[] = …;
static const struct attribute_group il_attribute_group = …;
static void
il4965_dealloc_ucode_pci(struct il_priv *il)
{ … }
static void
il4965_nic_start(struct il_priv *il)
{ … }
static void il4965_ucode_callback(const struct firmware *ucode_raw,
void *context);
static int il4965_mac_setup_register(struct il_priv *il, u32 max_probe_length);
static int __must_check
il4965_request_firmware(struct il_priv *il, bool first)
{ … }
struct il4965_firmware_pieces { … };
static int
il4965_load_firmware(struct il_priv *il, const struct firmware *ucode_raw,
struct il4965_firmware_pieces *pieces)
{ … }
static void
il4965_ucode_callback(const struct firmware *ucode_raw, void *context)
{ … }
static const char *const desc_lookup_text[] = …;
static struct { … } advanced_lookup[] = …;
static const char *
il4965_desc_lookup(u32 num)
{ … }
#define ERROR_START_OFFSET …
#define ERROR_ELEM_SIZE …
void
il4965_dump_nic_error_log(struct il_priv *il)
{ … }
static void
il4965_rf_kill_ct_config(struct il_priv *il)
{ … }
static const s8 default_queue_to_tx_fifo[] = …;
#define IL_MASK(lo, hi) …
static int
il4965_alive_notify(struct il_priv *il)
{ … }
static void
il4965_alive_start(struct il_priv *il)
{ … }
static void il4965_cancel_deferred_work(struct il_priv *il);
static void
__il4965_down(struct il_priv *il)
{ … }
static void
il4965_down(struct il_priv *il)
{ … }
static void
il4965_set_hw_ready(struct il_priv *il)
{ … }
static void
il4965_prepare_card_hw(struct il_priv *il)
{ … }
#define MAX_HW_RESTARTS …
static int
__il4965_up(struct il_priv *il)
{ … }
static void
il4965_bg_init_alive_start(struct work_struct *data)
{ … }
static void
il4965_bg_alive_start(struct work_struct *data)
{ … }
static void
il4965_bg_run_time_calib_work(struct work_struct *work)
{ … }
static void
il4965_bg_restart(struct work_struct *data)
{ … }
static void
il4965_bg_rx_replenish(struct work_struct *data)
{ … }
#define UCODE_READY_TIMEOUT …
static int
il4965_mac_setup_register(struct il_priv *il, u32 max_probe_length)
{ … }
int
il4965_mac_start(struct ieee80211_hw *hw)
{ … }
void
il4965_mac_stop(struct ieee80211_hw *hw, bool suspend)
{ … }
void
il4965_mac_tx(struct ieee80211_hw *hw,
struct ieee80211_tx_control *control,
struct sk_buff *skb)
{ … }
void
il4965_mac_update_tkip_key(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_key_conf *keyconf,
struct ieee80211_sta *sta, u32 iv32, u16 * phase1key)
{ … }
int
il4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
struct ieee80211_vif *vif, struct ieee80211_sta *sta,
struct ieee80211_key_conf *key)
{ … }
int
il4965_mac_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_ampdu_params *params)
{ … }
int
il4965_mac_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_sta *sta)
{ … }
void
il4965_mac_channel_switch(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_channel_switch *ch_switch)
{ … }
void
il4965_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags,
unsigned int *total_flags, u64 multicast)
{ … }
static void
il4965_bg_txpower_work(struct work_struct *work)
{ … }
static int
il4965_setup_deferred_work(struct il_priv *il)
{ … }
static void
il4965_cancel_deferred_work(struct il_priv *il)
{ … }
static void
il4965_init_hw_rates(struct il_priv *il, struct ieee80211_rate *rates)
{ … }
void
il4965_set_wr_ptrs(struct il_priv *il, int txq_id, u32 idx)
{ … }
void
il4965_tx_queue_set_status(struct il_priv *il, struct il_tx_queue *txq,
int tx_fifo_id, int scd_retry)
{ … }
static const struct ieee80211_ops il4965_mac_ops = …;
static int
il4965_init_drv(struct il_priv *il)
{ … }
static void
il4965_uninit_drv(struct il_priv *il)
{ … }
static void
il4965_hw_detect(struct il_priv *il)
{ … }
static const struct il_sensitivity_ranges il4965_sensitivity = …;
static void
il4965_set_hw_params(struct il_priv *il)
{ … }
static int
il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{ … }
static void
il4965_pci_remove(struct pci_dev *pdev)
{ … }
void
il4965_txq_set_sched(struct il_priv *il, u32 mask)
{ … }
static const struct pci_device_id il4965_hw_card_ids[] = …;
MODULE_DEVICE_TABLE(pci, il4965_hw_card_ids);
static struct pci_driver il4965_driver = …;
static int __init
il4965_init(void)
{ … }
static void __exit
il4965_exit(void)
{ … }
module_exit(il4965_exit);
module_init(…) …;
#ifdef CONFIG_IWLEGACY_DEBUG
module_param_named(debug, il_debug_level, uint, 0644);
MODULE_PARM_DESC(…) …;
#endif
module_param_named(swcrypto, il4965_mod_params.sw_crypto, int, 0444);
MODULE_PARM_DESC(…) …;
module_param_named(queues_num, il4965_mod_params.num_of_queues, int, 0444);
MODULE_PARM_DESC(…) …;
module_param_named(11n_disable, il4965_mod_params.disable_11n, int, 0444);
MODULE_PARM_DESC(…) …;
module_param_named(amsdu_size_8K, il4965_mod_params.amsdu_size_8K, int, 0444);
MODULE_PARM_DESC(…) …;
module_param_named(fw_restart, il4965_mod_params.restart_fw, int, 0444);
MODULE_PARM_DESC(…) …;