Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6.26
This commit is contained in:
commit
f89e6e3834
62 changed files with 3206 additions and 2575 deletions
|
@ -87,7 +87,7 @@ static inline int wpa2_capable(void)
|
|||
|
||||
static inline int precise_ie(void)
|
||||
{
|
||||
return 0; /* FIXME */
|
||||
return (0 <= ps3_compare_firmware_version(2, 2, 0));
|
||||
}
|
||||
/*
|
||||
* post_eurus_cmd helpers
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
b43-y += main.o
|
||||
b43-y += tables.o
|
||||
b43-y += tables_nphy.o
|
||||
b43-$(CONFIG_B43_NPHY) += tables_nphy.o
|
||||
b43-y += phy.o
|
||||
b43-y += nphy.o
|
||||
b43-$(CONFIG_B43_NPHY) += nphy.o
|
||||
b43-y += sysfs.o
|
||||
b43-y += xmit.o
|
||||
b43-y += lo.o
|
||||
|
|
|
@ -919,6 +919,10 @@
|
|||
|
||||
struct b43_wldev;
|
||||
|
||||
|
||||
#ifdef CONFIG_B43_NPHY
|
||||
/* N-PHY support enabled */
|
||||
|
||||
int b43_phy_initn(struct b43_wldev *dev);
|
||||
|
||||
void b43_nphy_radio_turn_on(struct b43_wldev *dev);
|
||||
|
@ -929,4 +933,40 @@ int b43_nphy_selectchannel(struct b43_wldev *dev, u8 channel);
|
|||
void b43_nphy_xmitpower(struct b43_wldev *dev);
|
||||
void b43_nphy_set_rxantenna(struct b43_wldev *dev, int antenna);
|
||||
|
||||
|
||||
#else /* CONFIG_B43_NPHY */
|
||||
/* N-PHY support disabled */
|
||||
|
||||
|
||||
static inline
|
||||
int b43_phy_initn(struct b43_wldev *dev)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline
|
||||
void b43_nphy_radio_turn_on(struct b43_wldev *dev)
|
||||
{
|
||||
}
|
||||
static inline
|
||||
void b43_nphy_radio_turn_off(struct b43_wldev *dev)
|
||||
{
|
||||
}
|
||||
|
||||
static inline
|
||||
int b43_nphy_selectchannel(struct b43_wldev *dev, u8 channel)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static inline
|
||||
void b43_nphy_xmitpower(struct b43_wldev *dev)
|
||||
{
|
||||
}
|
||||
static inline
|
||||
void b43_nphy_set_rxantenna(struct b43_wldev *dev, int antenna)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* CONFIG_B43_NPHY */
|
||||
#endif /* B43_NPHY_H_ */
|
||||
|
|
|
@ -4495,9 +4495,9 @@ static void ipw_rx_notification(struct ipw_priv *priv,
|
|||
priv->
|
||||
essid_len),
|
||||
print_mac(mac, priv->bssid),
|
||||
ntohs(auth->status),
|
||||
le16_to_cpu(auth->status),
|
||||
ipw_get_status_code
|
||||
(ntohs
|
||||
(le16_to_cpu
|
||||
(auth->status)));
|
||||
|
||||
priv->status &=
|
||||
|
@ -4532,9 +4532,9 @@ static void ipw_rx_notification(struct ipw_priv *priv,
|
|||
IPW_DL_STATE |
|
||||
IPW_DL_ASSOC,
|
||||
"association failed (0x%04X): %s\n",
|
||||
ntohs(resp->status),
|
||||
le16_to_cpu(resp->status),
|
||||
ipw_get_status_code
|
||||
(ntohs
|
||||
(le16_to_cpu
|
||||
(resp->status)));
|
||||
}
|
||||
|
||||
|
@ -4591,8 +4591,8 @@ static void ipw_rx_notification(struct ipw_priv *priv,
|
|||
IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE |
|
||||
IPW_DL_ASSOC,
|
||||
"authentication failed (0x%04X): %s\n",
|
||||
ntohs(auth->status),
|
||||
ipw_get_status_code(ntohs
|
||||
le16_to_cpu(auth->status),
|
||||
ipw_get_status_code(le16_to_cpu
|
||||
(auth->
|
||||
status)));
|
||||
}
|
||||
|
|
|
@ -385,73 +385,73 @@ struct clx2_queue {
|
|||
dma_addr_t dma_addr; /**< physical addr for BD's */
|
||||
int low_mark; /**< low watermark, resume queue if free space more than this */
|
||||
int high_mark; /**< high watermark, stop queue if free space less than this */
|
||||
} __attribute__ ((packed));
|
||||
} __attribute__ ((packed)); /* XXX */
|
||||
|
||||
struct machdr32 {
|
||||
__le16 frame_ctl;
|
||||
u16 duration; // watch out for endians!
|
||||
__le16 duration; // watch out for endians!
|
||||
u8 addr1[MACADRR_BYTE_LEN];
|
||||
u8 addr2[MACADRR_BYTE_LEN];
|
||||
u8 addr3[MACADRR_BYTE_LEN];
|
||||
u16 seq_ctrl; // more endians!
|
||||
__le16 seq_ctrl; // more endians!
|
||||
u8 addr4[MACADRR_BYTE_LEN];
|
||||
__le16 qos_ctrl;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct machdr30 {
|
||||
__le16 frame_ctl;
|
||||
u16 duration; // watch out for endians!
|
||||
__le16 duration; // watch out for endians!
|
||||
u8 addr1[MACADRR_BYTE_LEN];
|
||||
u8 addr2[MACADRR_BYTE_LEN];
|
||||
u8 addr3[MACADRR_BYTE_LEN];
|
||||
u16 seq_ctrl; // more endians!
|
||||
__le16 seq_ctrl; // more endians!
|
||||
u8 addr4[MACADRR_BYTE_LEN];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct machdr26 {
|
||||
__le16 frame_ctl;
|
||||
u16 duration; // watch out for endians!
|
||||
__le16 duration; // watch out for endians!
|
||||
u8 addr1[MACADRR_BYTE_LEN];
|
||||
u8 addr2[MACADRR_BYTE_LEN];
|
||||
u8 addr3[MACADRR_BYTE_LEN];
|
||||
u16 seq_ctrl; // more endians!
|
||||
__le16 seq_ctrl; // more endians!
|
||||
__le16 qos_ctrl;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct machdr24 {
|
||||
__le16 frame_ctl;
|
||||
u16 duration; // watch out for endians!
|
||||
__le16 duration; // watch out for endians!
|
||||
u8 addr1[MACADRR_BYTE_LEN];
|
||||
u8 addr2[MACADRR_BYTE_LEN];
|
||||
u8 addr3[MACADRR_BYTE_LEN];
|
||||
u16 seq_ctrl; // more endians!
|
||||
__le16 seq_ctrl; // more endians!
|
||||
} __attribute__ ((packed));
|
||||
|
||||
// TX TFD with 32 byte MAC Header
|
||||
struct tx_tfd_32 {
|
||||
struct machdr32 mchdr; // 32
|
||||
u32 uivplaceholder[2]; // 8
|
||||
__le32 uivplaceholder[2]; // 8
|
||||
} __attribute__ ((packed));
|
||||
|
||||
// TX TFD with 30 byte MAC Header
|
||||
struct tx_tfd_30 {
|
||||
struct machdr30 mchdr; // 30
|
||||
u8 reserved[2]; // 2
|
||||
u32 uivplaceholder[2]; // 8
|
||||
__le32 uivplaceholder[2]; // 8
|
||||
} __attribute__ ((packed));
|
||||
|
||||
// tx tfd with 26 byte mac header
|
||||
struct tx_tfd_26 {
|
||||
struct machdr26 mchdr; // 26
|
||||
u8 reserved1[2]; // 2
|
||||
u32 uivplaceholder[2]; // 8
|
||||
__le32 uivplaceholder[2]; // 8
|
||||
u8 reserved2[4]; // 4
|
||||
} __attribute__ ((packed));
|
||||
|
||||
// tx tfd with 24 byte mac header
|
||||
struct tx_tfd_24 {
|
||||
struct machdr24 mchdr; // 24
|
||||
u32 uivplaceholder[2]; // 8
|
||||
__le32 uivplaceholder[2]; // 8
|
||||
u8 reserved[8]; // 8
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
@ -460,7 +460,7 @@ struct tx_tfd_24 {
|
|||
struct tfd_command {
|
||||
u8 index;
|
||||
u8 length;
|
||||
u16 reserved;
|
||||
__le16 reserved;
|
||||
u8 payload[0];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
@ -562,27 +562,27 @@ struct rate_histogram {
|
|||
struct ipw_cmd_stats {
|
||||
u8 cmd_id;
|
||||
u8 seq_num;
|
||||
u16 good_sfd;
|
||||
u16 bad_plcp;
|
||||
u16 wrong_bssid;
|
||||
u16 valid_mpdu;
|
||||
u16 bad_mac_header;
|
||||
u16 reserved_frame_types;
|
||||
u16 rx_ina;
|
||||
u16 bad_crc32;
|
||||
u16 invalid_cts;
|
||||
u16 invalid_acks;
|
||||
u16 long_distance_ina_fina;
|
||||
u16 dsp_silence_unreachable;
|
||||
u16 accumulated_rssi;
|
||||
u16 rx_ovfl_frame_tossed;
|
||||
u16 rssi_silence_threshold;
|
||||
u16 rx_ovfl_frame_supplied;
|
||||
u16 last_rx_frame_signal;
|
||||
u16 last_rx_frame_noise;
|
||||
u16 rx_autodetec_no_ofdm;
|
||||
u16 rx_autodetec_no_barker;
|
||||
u16 reserved;
|
||||
__le16 good_sfd;
|
||||
__le16 bad_plcp;
|
||||
__le16 wrong_bssid;
|
||||
__le16 valid_mpdu;
|
||||
__le16 bad_mac_header;
|
||||
__le16 reserved_frame_types;
|
||||
__le16 rx_ina;
|
||||
__le16 bad_crc32;
|
||||
__le16 invalid_cts;
|
||||
__le16 invalid_acks;
|
||||
__le16 long_distance_ina_fina;
|
||||
__le16 dsp_silence_unreachable;
|
||||
__le16 accumulated_rssi;
|
||||
__le16 rx_ovfl_frame_tossed;
|
||||
__le16 rssi_silence_threshold;
|
||||
__le16 rx_ovfl_frame_supplied;
|
||||
__le16 last_rx_frame_signal;
|
||||
__le16 last_rx_frame_noise;
|
||||
__le16 rx_autodetec_no_ofdm;
|
||||
__le16 rx_autodetec_no_barker;
|
||||
__le16 reserved;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct notif_channel_result {
|
||||
|
@ -637,7 +637,7 @@ struct notif_association {
|
|||
struct notif_authenticate {
|
||||
u8 state;
|
||||
struct machdr24 addr;
|
||||
u16 status;
|
||||
__le16 status;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct notif_calibration {
|
||||
|
@ -732,14 +732,14 @@ struct ipw_rx_queue {
|
|||
struct alive_command_responce {
|
||||
u8 alive_command;
|
||||
u8 sequence_number;
|
||||
u16 software_revision;
|
||||
__le16 software_revision;
|
||||
u8 device_identifier;
|
||||
u8 reserved1[5];
|
||||
u16 reserved2;
|
||||
u16 reserved3;
|
||||
u16 clock_settle_time;
|
||||
u16 powerup_settle_time;
|
||||
u16 reserved4;
|
||||
__le16 reserved2;
|
||||
__le16 reserved3;
|
||||
__le16 clock_settle_time;
|
||||
__le16 powerup_settle_time;
|
||||
__le16 reserved4;
|
||||
u8 time_stamp[5]; /* month, day, year, hours, minutes */
|
||||
u8 ucode_valid;
|
||||
} __attribute__ ((packed));
|
||||
|
@ -878,7 +878,11 @@ static inline void ipw_set_scan_type(struct ipw_scan_request_ext *scan,
|
|||
|
||||
struct ipw_associate {
|
||||
u8 channel;
|
||||
#ifdef __LITTLE_ENDIAN_BITFIELD
|
||||
u8 auth_type:4, auth_key:4;
|
||||
#else
|
||||
u8 auth_key:4, auth_type:4;
|
||||
#endif
|
||||
u8 assoc_type;
|
||||
u8 reserved;
|
||||
__le16 policy_support;
|
||||
|
@ -918,12 +922,12 @@ struct ipw_frag_threshold {
|
|||
struct ipw_retry_limit {
|
||||
u8 short_retry_limit;
|
||||
u8 long_retry_limit;
|
||||
u16 reserved;
|
||||
__le16 reserved;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ipw_dino_config {
|
||||
u32 dino_config_addr;
|
||||
u16 dino_config_size;
|
||||
__le32 dino_config_addr;
|
||||
__le16 dino_config_size;
|
||||
u8 dino_response;
|
||||
u8 reserved;
|
||||
} __attribute__ ((packed));
|
||||
|
@ -998,7 +1002,7 @@ struct ipw_sensitivity_calib {
|
|||
* - \a status contains status;
|
||||
* - \a param filled with status parameters.
|
||||
*/
|
||||
struct ipw_cmd {
|
||||
struct ipw_cmd { /* XXX */
|
||||
u32 cmd; /**< Host command */
|
||||
u32 status;/**< Status */
|
||||
u32 status_len;
|
||||
|
@ -1092,7 +1096,7 @@ struct ipw_ibss_seq {
|
|||
struct list_head list;
|
||||
};
|
||||
|
||||
struct ipw_error_elem {
|
||||
struct ipw_error_elem { /* XXX */
|
||||
u32 desc;
|
||||
u32 time;
|
||||
u32 blink1;
|
||||
|
@ -1102,13 +1106,13 @@ struct ipw_error_elem {
|
|||
u32 data;
|
||||
};
|
||||
|
||||
struct ipw_event {
|
||||
struct ipw_event { /* XXX */
|
||||
u32 event;
|
||||
u32 time;
|
||||
u32 data;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct ipw_fw_error {
|
||||
struct ipw_fw_error { /* XXX */
|
||||
unsigned long jiffies;
|
||||
u32 status;
|
||||
u32 config;
|
||||
|
@ -1153,7 +1157,7 @@ struct ipw_prom_priv {
|
|||
*/
|
||||
struct ipw_rt_hdr {
|
||||
struct ieee80211_radiotap_header rt_hdr;
|
||||
u64 rt_tsf; /* TSF */
|
||||
u64 rt_tsf; /* TSF */ /* XXX */
|
||||
u8 rt_flags; /* radiotap packet flags */
|
||||
u8 rt_rate; /* rate in 500kb/s */
|
||||
__le16 rt_channel; /* channel in mhz */
|
||||
|
@ -1940,8 +1944,8 @@ enum {
|
|||
#define IPW_MEM_FIXED_OVERRIDE (IPW_SHARED_LOWER_BOUND + 0x41C)
|
||||
|
||||
struct ipw_fixed_rate {
|
||||
u16 tx_rates;
|
||||
u16 reserved;
|
||||
__le16 tx_rates;
|
||||
__le16 reserved;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define IPW_INDIRECT_ADDR_MASK (~0x3ul)
|
||||
|
@ -1951,12 +1955,12 @@ struct host_cmd {
|
|||
u8 len;
|
||||
u16 reserved;
|
||||
u32 *param;
|
||||
} __attribute__ ((packed));
|
||||
} __attribute__ ((packed)); /* XXX */
|
||||
|
||||
struct cmdlog_host_cmd {
|
||||
u8 cmd;
|
||||
u8 len;
|
||||
u16 reserved;
|
||||
__le16 reserved;
|
||||
char param[124];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ config IWL4965_SENSITIVITY
|
|||
This option will enable sensitivity calibration for the iwl4965
|
||||
driver.
|
||||
|
||||
config IWL4965_DEBUG
|
||||
config IWLWIFI_DEBUG
|
||||
bool "Enable full debugging output in iwl4965 driver"
|
||||
depends on IWL4965
|
||||
---help---
|
||||
|
@ -76,6 +76,12 @@ config IWL4965_DEBUG
|
|||
as the debug information can assist others in helping you resolve
|
||||
any problems you may encounter.
|
||||
|
||||
config IWLWIFI_DEBUGFS
|
||||
bool "Iwlwifi debugfs support"
|
||||
depends on IWLCORE && IWLWIFI_DEBUG && MAC80211_DEBUGFS
|
||||
---help---
|
||||
Enable creation of debugfs files for the iwlwifi drivers.
|
||||
|
||||
config IWL3945
|
||||
tristate "Intel PRO/Wireless 3945ABG/BG Network Connection"
|
||||
depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
obj-$(CONFIG_IWLCORE) += iwlcore.o
|
||||
iwlcore-objs = iwl-core.o iwl-eeprom.o
|
||||
iwlcore-objs = iwl-core.o iwl-eeprom.o iwl-hcmd.o
|
||||
|
||||
ifeq ($(CONFIG_IWLWIFI_DEBUGFS),y)
|
||||
iwlcore-objs += iwl-debugfs.o
|
||||
endif
|
||||
|
||||
obj-$(CONFIG_IWL3945) += iwl3945.o
|
||||
iwl3945-objs = iwl3945-base.o iwl-3945.o iwl-3945-rs.o
|
||||
|
|
|
@ -707,45 +707,6 @@ struct iwl3945_rx_frame {
|
|||
struct iwl3945_rx_frame_end end;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Fixed (non-configurable) rx data from phy */
|
||||
#define RX_PHY_FLAGS_ANTENNAE_OFFSET (4)
|
||||
#define RX_PHY_FLAGS_ANTENNAE_MASK (0x70)
|
||||
#define IWL_AGC_DB_MASK (0x3f80) /* MASK(7,13) */
|
||||
#define IWL_AGC_DB_POS (7)
|
||||
struct iwl4965_rx_non_cfg_phy {
|
||||
__le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */
|
||||
__le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */
|
||||
u8 rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */
|
||||
u8 pad[0];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/*
|
||||
* REPLY_4965_RX = 0xc3 (response only, not a command)
|
||||
* Used only for legacy (non 11n) frames.
|
||||
*/
|
||||
#define RX_RES_PHY_CNT 14
|
||||
struct iwl4965_rx_phy_res {
|
||||
u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */
|
||||
u8 cfg_phy_cnt; /* configurable DSP phy data byte count */
|
||||
u8 stat_id; /* configurable DSP phy data set ID */
|
||||
u8 reserved1;
|
||||
__le64 timestamp; /* TSF at on air rise */
|
||||
__le32 beacon_time_stamp; /* beacon at on-air rise */
|
||||
__le16 phy_flags; /* general phy flags: band, modulation, ... */
|
||||
__le16 channel; /* channel number */
|
||||
__le16 non_cfg_phy[RX_RES_PHY_CNT]; /* upto 14 phy entries */
|
||||
__le32 reserved2;
|
||||
__le32 rate_n_flags;
|
||||
__le16 byte_count; /* frame's byte-count */
|
||||
__le16 reserved3;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct iwl4965_rx_mpdu_res_start {
|
||||
__le16 byte_count;
|
||||
__le16 reserved;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* (5)
|
||||
* Tx Commands & Responses:
|
||||
|
|
|
@ -198,43 +198,27 @@ struct iwl3945_eeprom_temperature_corr {
|
|||
*/
|
||||
struct iwl3945_eeprom {
|
||||
u8 reserved0[16];
|
||||
#define EEPROM_DEVICE_ID (2*0x08) /* 2 bytes */
|
||||
u16 device_id; /* abs.ofs: 16 */
|
||||
u8 reserved1[2];
|
||||
#define EEPROM_PMC (2*0x0A) /* 2 bytes */
|
||||
u16 pmc; /* abs.ofs: 20 */
|
||||
u8 reserved2[20];
|
||||
#define EEPROM_MAC_ADDRESS (2*0x15) /* 6 bytes */
|
||||
u8 mac_address[6]; /* abs.ofs: 42 */
|
||||
u8 reserved3[58];
|
||||
#define EEPROM_BOARD_REVISION (2*0x35) /* 2 bytes */
|
||||
u16 board_revision; /* abs.ofs: 106 */
|
||||
u8 reserved4[11];
|
||||
#define EEPROM_BOARD_PBA_NUMBER (2*0x3B+1) /* 9 bytes */
|
||||
u8 board_pba_number[9]; /* abs.ofs: 119 */
|
||||
u8 reserved5[8];
|
||||
#define EEPROM_VERSION (2*0x44) /* 2 bytes */
|
||||
u16 version; /* abs.ofs: 136 */
|
||||
#define EEPROM_SKU_CAP (2*0x45) /* 1 bytes */
|
||||
u8 sku_cap; /* abs.ofs: 138 */
|
||||
#define EEPROM_LEDS_MODE (2*0x45+1) /* 1 bytes */
|
||||
u8 leds_mode; /* abs.ofs: 139 */
|
||||
#define EEPROM_OEM_MODE (2*0x46) /* 2 bytes */
|
||||
u16 oem_mode;
|
||||
#define EEPROM_WOWLAN_MODE (2*0x47) /* 2 bytes */
|
||||
u16 wowlan_mode; /* abs.ofs: 142 */
|
||||
#define EEPROM_LEDS_TIME_INTERVAL (2*0x48) /* 2 bytes */
|
||||
u16 leds_time_interval; /* abs.ofs: 144 */
|
||||
#define EEPROM_LEDS_OFF_TIME (2*0x49) /* 1 bytes */
|
||||
u8 leds_off_time; /* abs.ofs: 146 */
|
||||
#define EEPROM_LEDS_ON_TIME (2*0x49+1) /* 1 bytes */
|
||||
u8 leds_on_time; /* abs.ofs: 147 */
|
||||
#define EEPROM_ALMGOR_M_VERSION (2*0x4A) /* 1 bytes */
|
||||
u8 almgor_m_version; /* abs.ofs: 148 */
|
||||
#define EEPROM_ANTENNA_SWITCH_TYPE (2*0x4A+1) /* 1 bytes */
|
||||
u8 antenna_switch_type; /* abs.ofs: 149 */
|
||||
u8 reserved6[42];
|
||||
#define EEPROM_REGULATORY_SKU_ID (2*0x60) /* 4 bytes */
|
||||
u8 sku_id[4]; /* abs.ofs: 192 */
|
||||
|
||||
/*
|
||||
|
@ -249,9 +233,7 @@ struct iwl3945_eeprom {
|
|||
*
|
||||
* 2.4 GHz channels 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
|
||||
*/
|
||||
#define EEPROM_REGULATORY_BAND_1 (2*0x62) /* 2 bytes */
|
||||
u16 band_1_count; /* abs.ofs: 196 */
|
||||
#define EEPROM_REGULATORY_BAND_1_CHANNELS (2*0x63) /* 28 bytes */
|
||||
struct iwl3945_eeprom_channel band_1_channels[14]; /* abs.ofs: 196 */
|
||||
|
||||
/*
|
||||
|
@ -259,36 +241,28 @@ struct iwl3945_eeprom {
|
|||
* 5.0 GHz channels 7, 8, 11, 12, 16
|
||||
* (4915-5080MHz) (none of these is ever supported)
|
||||
*/
|
||||
#define EEPROM_REGULATORY_BAND_2 (2*0x71) /* 2 bytes */
|
||||
u16 band_2_count; /* abs.ofs: 226 */
|
||||
#define EEPROM_REGULATORY_BAND_2_CHANNELS (2*0x72) /* 26 bytes */
|
||||
struct iwl3945_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */
|
||||
|
||||
/*
|
||||
* 5.2 GHz channels 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64
|
||||
* (5170-5320MHz)
|
||||
*/
|
||||
#define EEPROM_REGULATORY_BAND_3 (2*0x7F) /* 2 bytes */
|
||||
u16 band_3_count; /* abs.ofs: 254 */
|
||||
#define EEPROM_REGULATORY_BAND_3_CHANNELS (2*0x80) /* 24 bytes */
|
||||
struct iwl3945_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */
|
||||
|
||||
/*
|
||||
* 5.5 GHz channels 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140
|
||||
* (5500-5700MHz)
|
||||
*/
|
||||
#define EEPROM_REGULATORY_BAND_4 (2*0x8C) /* 2 bytes */
|
||||
u16 band_4_count; /* abs.ofs: 280 */
|
||||
#define EEPROM_REGULATORY_BAND_4_CHANNELS (2*0x8D) /* 22 bytes */
|
||||
struct iwl3945_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */
|
||||
|
||||
/*
|
||||
* 5.7 GHz channels 145, 149, 153, 157, 161, 165
|
||||
* (5725-5825MHz)
|
||||
*/
|
||||
#define EEPROM_REGULATORY_BAND_5 (2*0x98) /* 2 bytes */
|
||||
u16 band_5_count; /* abs.ofs: 304 */
|
||||
#define EEPROM_REGULATORY_BAND_5_CHANNELS (2*0x99) /* 12 bytes */
|
||||
struct iwl3945_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */
|
||||
|
||||
u8 reserved9[194];
|
||||
|
@ -296,15 +270,9 @@ struct iwl3945_eeprom {
|
|||
/*
|
||||
* 3945 Txpower calibration data.
|
||||
*/
|
||||
#define EEPROM_TXPOWER_CALIB_GROUP0 0x200
|
||||
#define EEPROM_TXPOWER_CALIB_GROUP1 0x240
|
||||
#define EEPROM_TXPOWER_CALIB_GROUP2 0x280
|
||||
#define EEPROM_TXPOWER_CALIB_GROUP3 0x2c0
|
||||
#define EEPROM_TXPOWER_CALIB_GROUP4 0x300
|
||||
#define IWL_NUM_TX_CALIB_GROUPS 5
|
||||
struct iwl3945_eeprom_txpower_group groups[IWL_NUM_TX_CALIB_GROUPS];
|
||||
/* abs.ofs: 512 */
|
||||
#define EEPROM_CALIB_TEMPERATURE_CORRECT 0x340
|
||||
struct iwl3945_eeprom_temperature_corr corrections; /* abs.ofs: 832 */
|
||||
u8 reserved16[172]; /* fill out to full 1024 byte block */
|
||||
} __attribute__ ((packed));
|
||||
|
|
|
@ -139,7 +139,7 @@ enum {
|
|||
REPLY_PHY_CALIBRATION_CMD = 0xb0,
|
||||
REPLY_RX_PHY_CMD = 0xc0,
|
||||
REPLY_RX_MPDU_CMD = 0xc1,
|
||||
REPLY_4965_RX = 0xc3,
|
||||
REPLY_RX = 0xc3,
|
||||
REPLY_COMPRESSED_BA = 0xc5,
|
||||
REPLY_MAX = 0xff
|
||||
};
|
||||
|
@ -151,16 +151,16 @@ enum {
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/* iwl4965_cmd_header flags value */
|
||||
/* iwl_cmd_header flags value */
|
||||
#define IWL_CMD_FAILED_MSK 0x40
|
||||
|
||||
/**
|
||||
* struct iwl4965_cmd_header
|
||||
* struct iwl_cmd_header
|
||||
*
|
||||
* This header format appears in the beginning of each command sent from the
|
||||
* driver, and each response/notification received from uCode.
|
||||
*/
|
||||
struct iwl4965_cmd_header {
|
||||
struct iwl_cmd_header {
|
||||
u8 cmd; /* Command ID: REPLY_RXON, etc. */
|
||||
u8 flags; /* IWL_CMD_* */
|
||||
/*
|
||||
|
@ -194,7 +194,7 @@ struct iwl4965_cmd_header {
|
|||
* 4965 rate_n_flags bit fields
|
||||
*
|
||||
* rate_n_flags format is used in following 4965 commands:
|
||||
* REPLY_4965_RX (response only)
|
||||
* REPLY_RX (response only)
|
||||
* REPLY_TX (both command and response)
|
||||
* REPLY_TX_LINK_QUALITY_CMD
|
||||
*
|
||||
|
@ -741,6 +741,7 @@ struct iwl4965_qosparam_cmd {
|
|||
/* wep key in STA: 5-bytes (0) or 13-bytes (1) */
|
||||
#define STA_KEY_FLG_KEY_SIZE_MSK __constant_cpu_to_le16(0x1000)
|
||||
#define STA_KEY_MULTICAST_MSK __constant_cpu_to_le16(0x4000)
|
||||
#define STA_KEY_MAX_NUM 8
|
||||
|
||||
/* Flags indicate whether to modify vs. don't change various station params */
|
||||
#define STA_MODIFY_KEY_MASK 0x01
|
||||
|
@ -889,6 +890,10 @@ struct iwl4965_rx_frame_hdr {
|
|||
#define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8)
|
||||
#define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8)
|
||||
#define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8)
|
||||
#define RX_RES_STATUS_SEC_TYPE_ERR (0x7 << 8)
|
||||
|
||||
#define RX_RES_STATUS_STATION_FOUND (1<<6)
|
||||
#define RX_RES_STATUS_NO_STATION_INFO_MISMATCH (1<<7)
|
||||
|
||||
#define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11)
|
||||
#define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11)
|
||||
|
@ -896,6 +901,11 @@ struct iwl4965_rx_frame_hdr {
|
|||
#define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11)
|
||||
#define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11)
|
||||
|
||||
#define RX_MPDU_RES_STATUS_ICV_OK (0x20)
|
||||
#define RX_MPDU_RES_STATUS_MIC_OK (0x40)
|
||||
#define RX_MPDU_RES_STATUS_TTAK_OK (1 << 7)
|
||||
#define RX_MPDU_RES_STATUS_DEC_DONE_MSK (0x800)
|
||||
|
||||
struct iwl4965_rx_frame_end {
|
||||
__le32 status;
|
||||
__le64 timestamp;
|
||||
|
@ -929,7 +939,7 @@ struct iwl4965_rx_non_cfg_phy {
|
|||
} __attribute__ ((packed));
|
||||
|
||||
/*
|
||||
* REPLY_4965_RX = 0xc3 (response only, not a command)
|
||||
* REPLY_RX = 0xc3 (response only, not a command)
|
||||
* Used only for legacy (non 11n) frames.
|
||||
*/
|
||||
#define RX_RES_PHY_CNT 14
|
||||
|
@ -1045,6 +1055,10 @@ struct iwl4965_rx_mpdu_res_start {
|
|||
* MAC header) to DWORD boundary. */
|
||||
#define TX_CMD_FLG_MH_PAD_MSK __constant_cpu_to_le32(1 << 20)
|
||||
|
||||
/* accelerate aggregation support
|
||||
* 0 - no CCMP encryption; 1 - CCMP encryption */
|
||||
#define TX_CMD_FLG_AGG_CCMP_MSK __constant_cpu_to_le32(1 << 22)
|
||||
|
||||
/* HCCA-AP - disable duration overwriting. */
|
||||
#define TX_CMD_FLG_DUR_MSK __constant_cpu_to_le32(1 << 25)
|
||||
|
||||
|
@ -2650,7 +2664,7 @@ struct iwl4965_led_cmd {
|
|||
|
||||
struct iwl4965_rx_packet {
|
||||
__le32 len;
|
||||
struct iwl4965_cmd_header hdr;
|
||||
struct iwl_cmd_header hdr;
|
||||
union {
|
||||
struct iwl4965_alive_resp alive_frame;
|
||||
struct iwl4965_rx_frame rx_frame;
|
||||
|
|
|
@ -113,9 +113,6 @@
|
|||
#define TFD_TX_CMD_SLOTS 256
|
||||
#define TFD_CMD_SLOTS 32
|
||||
|
||||
#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl4965_cmd) - \
|
||||
sizeof(struct iwl4965_cmd_meta))
|
||||
|
||||
/*
|
||||
* RX related structures and functions
|
||||
*/
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include <linux/io.h>
|
||||
|
||||
#include "iwl-4965-debug.h"
|
||||
#include "iwl-debug.h"
|
||||
|
||||
/*
|
||||
* IO, register, and NIC memory access functions
|
||||
|
@ -60,8 +60,8 @@
|
|||
*/
|
||||
|
||||
#define _iwl4965_write32(priv, ofs, val) writel((val), (priv)->hw_base + (ofs))
|
||||
#ifdef CONFIG_IWL4965_DEBUG
|
||||
static inline void __iwl4965_write32(const char *f, u32 l, struct iwl4965_priv *priv,
|
||||
#ifdef CONFIG_IWLWIFI_DEBUG
|
||||
static inline void __iwl4965_write32(const char *f, u32 l, struct iwl_priv *priv,
|
||||
u32 ofs, u32 val)
|
||||
{
|
||||
IWL_DEBUG_IO("write32(0x%08X, 0x%08X) - %s %d\n", ofs, val, f, l);
|
||||
|
@ -74,8 +74,8 @@ static inline void __iwl4965_write32(const char *f, u32 l, struct iwl4965_priv *
|
|||
#endif
|
||||
|
||||
#define _iwl4965_read32(priv, ofs) readl((priv)->hw_base + (ofs))
|
||||
#ifdef CONFIG_IWL4965_DEBUG
|
||||
static inline u32 __iwl4965_read32(char *f, u32 l, struct iwl4965_priv *priv, u32 ofs)
|
||||
#ifdef CONFIG_IWLWIFI_DEBUG
|
||||
static inline u32 __iwl4965_read32(char *f, u32 l, struct iwl_priv *priv, u32 ofs)
|
||||
{
|
||||
IWL_DEBUG_IO("read_direct32(0x%08X) - %s %d\n", ofs, f, l);
|
||||
return _iwl4965_read32(priv, ofs);
|
||||
|
@ -85,7 +85,7 @@ static inline u32 __iwl4965_read32(char *f, u32 l, struct iwl4965_priv *priv, u3
|
|||
#define iwl4965_read32(p, o) _iwl4965_read32(p, o)
|
||||
#endif
|
||||
|
||||
static inline int _iwl4965_poll_bit(struct iwl4965_priv *priv, u32 addr,
|
||||
static inline int _iwl4965_poll_bit(struct iwl_priv *priv, u32 addr,
|
||||
u32 bits, u32 mask, int timeout)
|
||||
{
|
||||
int i = 0;
|
||||
|
@ -99,9 +99,9 @@ static inline int _iwl4965_poll_bit(struct iwl4965_priv *priv, u32 addr,
|
|||
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
#ifdef CONFIG_IWL4965_DEBUG
|
||||
#ifdef CONFIG_IWLWIFI_DEBUG
|
||||
static inline int __iwl4965_poll_bit(const char *f, u32 l,
|
||||
struct iwl4965_priv *priv, u32 addr,
|
||||
struct iwl_priv *priv, u32 addr,
|
||||
u32 bits, u32 mask, int timeout)
|
||||
{
|
||||
int ret = _iwl4965_poll_bit(priv, addr, bits, mask, timeout);
|
||||
|
@ -116,13 +116,13 @@ static inline int __iwl4965_poll_bit(const char *f, u32 l,
|
|||
#define iwl4965_poll_bit(p, a, b, m, t) _iwl4965_poll_bit(p, a, b, m, t)
|
||||
#endif
|
||||
|
||||
static inline void _iwl4965_set_bit(struct iwl4965_priv *priv, u32 reg, u32 mask)
|
||||
static inline void _iwl4965_set_bit(struct iwl_priv *priv, u32 reg, u32 mask)
|
||||
{
|
||||
_iwl4965_write32(priv, reg, _iwl4965_read32(priv, reg) | mask);
|
||||
}
|
||||
#ifdef CONFIG_IWL4965_DEBUG
|
||||
#ifdef CONFIG_IWLWIFI_DEBUG
|
||||
static inline void __iwl4965_set_bit(const char *f, u32 l,
|
||||
struct iwl4965_priv *priv, u32 reg, u32 mask)
|
||||
struct iwl_priv *priv, u32 reg, u32 mask)
|
||||
{
|
||||
u32 val = _iwl4965_read32(priv, reg) | mask;
|
||||
IWL_DEBUG_IO("set_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val);
|
||||
|
@ -133,13 +133,13 @@ static inline void __iwl4965_set_bit(const char *f, u32 l,
|
|||
#define iwl4965_set_bit(p, r, m) _iwl4965_set_bit(p, r, m)
|
||||
#endif
|
||||
|
||||
static inline void _iwl4965_clear_bit(struct iwl4965_priv *priv, u32 reg, u32 mask)
|
||||
static inline void _iwl4965_clear_bit(struct iwl_priv *priv, u32 reg, u32 mask)
|
||||
{
|
||||
_iwl4965_write32(priv, reg, _iwl4965_read32(priv, reg) & ~mask);
|
||||
}
|
||||
#ifdef CONFIG_IWL4965_DEBUG
|
||||
#ifdef CONFIG_IWLWIFI_DEBUG
|
||||
static inline void __iwl4965_clear_bit(const char *f, u32 l,
|
||||
struct iwl4965_priv *priv, u32 reg, u32 mask)
|
||||
struct iwl_priv *priv, u32 reg, u32 mask)
|
||||
{
|
||||
u32 val = _iwl4965_read32(priv, reg) & ~mask;
|
||||
IWL_DEBUG_IO("clear_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val);
|
||||
|
@ -150,12 +150,12 @@ static inline void __iwl4965_clear_bit(const char *f, u32 l,
|
|||
#define iwl4965_clear_bit(p, r, m) _iwl4965_clear_bit(p, r, m)
|
||||
#endif
|
||||
|
||||
static inline int _iwl4965_grab_nic_access(struct iwl4965_priv *priv)
|
||||
static inline int _iwl4965_grab_nic_access(struct iwl_priv *priv)
|
||||
{
|
||||
int ret;
|
||||
u32 gp_ctl;
|
||||
|
||||
#ifdef CONFIG_IWL4965_DEBUG
|
||||
#ifdef CONFIG_IWLWIFI_DEBUG
|
||||
if (atomic_read(&priv->restrict_refcnt))
|
||||
return 0;
|
||||
#endif
|
||||
|
@ -186,15 +186,15 @@ static inline int _iwl4965_grab_nic_access(struct iwl4965_priv *priv)
|
|||
return -EIO;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_IWL4965_DEBUG
|
||||
#ifdef CONFIG_IWLWIFI_DEBUG
|
||||
atomic_inc(&priv->restrict_refcnt);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_IWL4965_DEBUG
|
||||
#ifdef CONFIG_IWLWIFI_DEBUG
|
||||
static inline int __iwl4965_grab_nic_access(const char *f, u32 l,
|
||||
struct iwl4965_priv *priv)
|
||||
struct iwl_priv *priv)
|
||||
{
|
||||
if (atomic_read(&priv->restrict_refcnt))
|
||||
IWL_DEBUG_INFO("Grabbing access while already held at "
|
||||
|
@ -210,17 +210,17 @@ static inline int __iwl4965_grab_nic_access(const char *f, u32 l,
|
|||
_iwl4965_grab_nic_access(priv)
|
||||
#endif
|
||||
|
||||
static inline void _iwl4965_release_nic_access(struct iwl4965_priv *priv)
|
||||
static inline void _iwl4965_release_nic_access(struct iwl_priv *priv)
|
||||
{
|
||||
#ifdef CONFIG_IWL4965_DEBUG
|
||||
#ifdef CONFIG_IWLWIFI_DEBUG
|
||||
if (atomic_dec_and_test(&priv->restrict_refcnt))
|
||||
#endif
|
||||
_iwl4965_clear_bit(priv, CSR_GP_CNTRL,
|
||||
CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
|
||||
}
|
||||
#ifdef CONFIG_IWL4965_DEBUG
|
||||
#ifdef CONFIG_IWLWIFI_DEBUG
|
||||
static inline void __iwl4965_release_nic_access(const char *f, u32 l,
|
||||
struct iwl4965_priv *priv)
|
||||
struct iwl_priv *priv)
|
||||
{
|
||||
if (atomic_read(&priv->restrict_refcnt) <= 0)
|
||||
IWL_ERROR("Release unheld nic access at line %d.\n", l);
|
||||
|
@ -235,13 +235,13 @@ static inline void __iwl4965_release_nic_access(const char *f, u32 l,
|
|||
_iwl4965_release_nic_access(priv)
|
||||
#endif
|
||||
|
||||
static inline u32 _iwl4965_read_direct32(struct iwl4965_priv *priv, u32 reg)
|
||||
static inline u32 _iwl4965_read_direct32(struct iwl_priv *priv, u32 reg)
|
||||
{
|
||||
return _iwl4965_read32(priv, reg);
|
||||
}
|
||||
#ifdef CONFIG_IWL4965_DEBUG
|
||||
#ifdef CONFIG_IWLWIFI_DEBUG
|
||||
static inline u32 __iwl4965_read_direct32(const char *f, u32 l,
|
||||
struct iwl4965_priv *priv, u32 reg)
|
||||
struct iwl_priv *priv, u32 reg)
|
||||
{
|
||||
u32 value = _iwl4965_read_direct32(priv, reg);
|
||||
if (!atomic_read(&priv->restrict_refcnt))
|
||||
|
@ -256,14 +256,14 @@ static inline u32 __iwl4965_read_direct32(const char *f, u32 l,
|
|||
#define iwl4965_read_direct32 _iwl4965_read_direct32
|
||||
#endif
|
||||
|
||||
static inline void _iwl4965_write_direct32(struct iwl4965_priv *priv,
|
||||
static inline void _iwl4965_write_direct32(struct iwl_priv *priv,
|
||||
u32 reg, u32 value)
|
||||
{
|
||||
_iwl4965_write32(priv, reg, value);
|
||||
}
|
||||
#ifdef CONFIG_IWL4965_DEBUG
|
||||
#ifdef CONFIG_IWLWIFI_DEBUG
|
||||
static void __iwl4965_write_direct32(u32 line,
|
||||
struct iwl4965_priv *priv, u32 reg, u32 value)
|
||||
struct iwl_priv *priv, u32 reg, u32 value)
|
||||
{
|
||||
if (!atomic_read(&priv->restrict_refcnt))
|
||||
IWL_ERROR("Nic access not held from line %d\n", line);
|
||||
|
@ -275,7 +275,7 @@ static void __iwl4965_write_direct32(u32 line,
|
|||
#define iwl4965_write_direct32 _iwl4965_write_direct32
|
||||
#endif
|
||||
|
||||
static inline void iwl4965_write_reg_buf(struct iwl4965_priv *priv,
|
||||
static inline void iwl4965_write_reg_buf(struct iwl_priv *priv,
|
||||
u32 reg, u32 len, u32 *values)
|
||||
{
|
||||
u32 count = sizeof(u32);
|
||||
|
@ -286,7 +286,7 @@ static inline void iwl4965_write_reg_buf(struct iwl4965_priv *priv,
|
|||
}
|
||||
}
|
||||
|
||||
static inline int _iwl4965_poll_direct_bit(struct iwl4965_priv *priv,
|
||||
static inline int _iwl4965_poll_direct_bit(struct iwl_priv *priv,
|
||||
u32 addr, u32 mask, int timeout)
|
||||
{
|
||||
int i = 0;
|
||||
|
@ -301,9 +301,9 @@ static inline int _iwl4965_poll_direct_bit(struct iwl4965_priv *priv,
|
|||
return -ETIMEDOUT;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_IWL4965_DEBUG
|
||||
#ifdef CONFIG_IWLWIFI_DEBUG
|
||||
static inline int __iwl4965_poll_direct_bit(const char *f, u32 l,
|
||||
struct iwl4965_priv *priv,
|
||||
struct iwl_priv *priv,
|
||||
u32 addr, u32 mask, int timeout)
|
||||
{
|
||||
int ret = _iwl4965_poll_direct_bit(priv, addr, mask, timeout);
|
||||
|
@ -322,13 +322,13 @@ static inline int __iwl4965_poll_direct_bit(const char *f, u32 l,
|
|||
#define iwl4965_poll_direct_bit _iwl4965_poll_direct_bit
|
||||
#endif
|
||||
|
||||
static inline u32 _iwl4965_read_prph(struct iwl4965_priv *priv, u32 reg)
|
||||
static inline u32 _iwl4965_read_prph(struct iwl_priv *priv, u32 reg)
|
||||
{
|
||||
_iwl4965_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24));
|
||||
return _iwl4965_read_direct32(priv, HBUS_TARG_PRPH_RDAT);
|
||||
}
|
||||
#ifdef CONFIG_IWL4965_DEBUG
|
||||
static inline u32 __iwl4965_read_prph(u32 line, struct iwl4965_priv *priv, u32 reg)
|
||||
#ifdef CONFIG_IWLWIFI_DEBUG
|
||||
static inline u32 __iwl4965_read_prph(u32 line, struct iwl_priv *priv, u32 reg)
|
||||
{
|
||||
if (!atomic_read(&priv->restrict_refcnt))
|
||||
IWL_ERROR("Nic access not held from line %d\n", line);
|
||||
|
@ -341,15 +341,15 @@ static inline u32 __iwl4965_read_prph(u32 line, struct iwl4965_priv *priv, u32 r
|
|||
#define iwl4965_read_prph _iwl4965_read_prph
|
||||
#endif
|
||||
|
||||
static inline void _iwl4965_write_prph(struct iwl4965_priv *priv,
|
||||
static inline void _iwl4965_write_prph(struct iwl_priv *priv,
|
||||
u32 addr, u32 val)
|
||||
{
|
||||
_iwl4965_write_direct32(priv, HBUS_TARG_PRPH_WADDR,
|
||||
((addr & 0x0000FFFF) | (3 << 24)));
|
||||
_iwl4965_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val);
|
||||
}
|
||||
#ifdef CONFIG_IWL4965_DEBUG
|
||||
static inline void __iwl4965_write_prph(u32 line, struct iwl4965_priv *priv,
|
||||
#ifdef CONFIG_IWLWIFI_DEBUG
|
||||
static inline void __iwl4965_write_prph(u32 line, struct iwl_priv *priv,
|
||||
u32 addr, u32 val)
|
||||
{
|
||||
if (!atomic_read(&priv->restrict_refcnt))
|
||||
|
@ -365,8 +365,8 @@ static inline void __iwl4965_write_prph(u32 line, struct iwl4965_priv *priv,
|
|||
|
||||
#define _iwl4965_set_bits_prph(priv, reg, mask) \
|
||||
_iwl4965_write_prph(priv, reg, (_iwl4965_read_prph(priv, reg) | mask))
|
||||
#ifdef CONFIG_IWL4965_DEBUG
|
||||
static inline void __iwl4965_set_bits_prph(u32 line, struct iwl4965_priv *priv,
|
||||
#ifdef CONFIG_IWLWIFI_DEBUG
|
||||
static inline void __iwl4965_set_bits_prph(u32 line, struct iwl_priv *priv,
|
||||
u32 reg, u32 mask)
|
||||
{
|
||||
if (!atomic_read(&priv->restrict_refcnt))
|
||||
|
@ -383,9 +383,9 @@ static inline void __iwl4965_set_bits_prph(u32 line, struct iwl4965_priv *priv,
|
|||
#define _iwl4965_set_bits_mask_prph(priv, reg, bits, mask) \
|
||||
_iwl4965_write_prph(priv, reg, ((_iwl4965_read_prph(priv, reg) & mask) | bits))
|
||||
|
||||
#ifdef CONFIG_IWL4965_DEBUG
|
||||
#ifdef CONFIG_IWLWIFI_DEBUG
|
||||
static inline void __iwl4965_set_bits_mask_prph(u32 line,
|
||||
struct iwl4965_priv *priv, u32 reg, u32 bits, u32 mask)
|
||||
struct iwl_priv *priv, u32 reg, u32 bits, u32 mask)
|
||||
{
|
||||
if (!atomic_read(&priv->restrict_refcnt))
|
||||
IWL_ERROR("Nic access not held from line %d\n", line);
|
||||
|
@ -397,26 +397,26 @@ static inline void __iwl4965_set_bits_mask_prph(u32 line,
|
|||
#define iwl4965_set_bits_mask_prph _iwl4965_set_bits_mask_prph
|
||||
#endif
|
||||
|
||||
static inline void iwl4965_clear_bits_prph(struct iwl4965_priv
|
||||
static inline void iwl4965_clear_bits_prph(struct iwl_priv
|
||||
*priv, u32 reg, u32 mask)
|
||||
{
|
||||
u32 val = _iwl4965_read_prph(priv, reg);
|
||||
_iwl4965_write_prph(priv, reg, (val & ~mask));
|
||||
}
|
||||
|
||||
static inline u32 iwl4965_read_targ_mem(struct iwl4965_priv *priv, u32 addr)
|
||||
static inline u32 iwl4965_read_targ_mem(struct iwl_priv *priv, u32 addr)
|
||||
{
|
||||
iwl4965_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr);
|
||||
return iwl4965_read_direct32(priv, HBUS_TARG_MEM_RDAT);
|
||||
}
|
||||
|
||||
static inline void iwl4965_write_targ_mem(struct iwl4965_priv *priv, u32 addr, u32 val)
|
||||
static inline void iwl4965_write_targ_mem(struct iwl_priv *priv, u32 addr, u32 val)
|
||||
{
|
||||
iwl4965_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr);
|
||||
iwl4965_write_direct32(priv, HBUS_TARG_MEM_WDAT, val);
|
||||
}
|
||||
|
||||
static inline void iwl4965_write_targ_mem_buf(struct iwl4965_priv *priv, u32 addr,
|
||||
static inline void iwl4965_write_targ_mem_buf(struct iwl_priv *priv, u32 addr,
|
||||
u32 len, u32 *values)
|
||||
{
|
||||
iwl4965_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr);
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "../net/mac80211/ieee80211_rate.h"
|
||||
|
||||
#include "iwl-4965.h"
|
||||
#include "iwl-core.h"
|
||||
#include "iwl-helpers.h"
|
||||
|
||||
#define RS_NAME "iwl-4965-rs"
|
||||
|
@ -162,11 +163,11 @@ struct iwl4965_lq_sta {
|
|||
struct dentry *rs_sta_dbgfs_tx_agg_tid_en_file;
|
||||
#endif
|
||||
struct iwl4965_rate dbg_fixed;
|
||||
struct iwl4965_priv *drv;
|
||||
struct iwl_priv *drv;
|
||||
#endif
|
||||
};
|
||||
|
||||
static void rs_rate_scale_perform(struct iwl4965_priv *priv,
|
||||
static void rs_rate_scale_perform(struct iwl_priv *priv,
|
||||
struct net_device *dev,
|
||||
struct ieee80211_hdr *hdr,
|
||||
struct sta_info *sta);
|
||||
|
@ -229,8 +230,8 @@ static s32 expected_tpt_mimo40MHzSGI[IWL_RATE_COUNT] = {
|
|||
0, 0, 0, 0, 131, 131, 191, 222, 242, 270, 284, 289, 293
|
||||
};
|
||||
|
||||
static int iwl4965_lq_sync_callback(struct iwl4965_priv *priv,
|
||||
struct iwl4965_cmd *cmd, struct sk_buff *skb)
|
||||
static int iwl4965_lq_sync_callback(struct iwl_priv *priv,
|
||||
struct iwl_cmd *cmd, struct sk_buff *skb)
|
||||
{
|
||||
/*We didn't cache the SKB; let the caller free it */
|
||||
return 1;
|
||||
|
@ -241,13 +242,13 @@ static inline u8 iwl4965_rate_get_rate(u32 rate_n_flags)
|
|||
return (u8)(rate_n_flags & 0xFF);
|
||||
}
|
||||
|
||||
static int rs_send_lq_cmd(struct iwl4965_priv *priv,
|
||||
static int rs_send_lq_cmd(struct iwl_priv *priv,
|
||||
struct iwl4965_link_quality_cmd *lq, u8 flags)
|
||||
{
|
||||
#ifdef CONFIG_IWL4965_DEBUG
|
||||
#ifdef CONFIG_IWLWIFI_DEBUG
|
||||
int i;
|
||||
#endif
|
||||
struct iwl4965_host_cmd cmd = {
|
||||
struct iwl_host_cmd cmd = {
|
||||
.id = REPLY_TX_LINK_QUALITY_CMD,
|
||||
.len = sizeof(struct iwl4965_link_quality_cmd),
|
||||
.meta.flags = flags,
|
||||
|
@ -265,7 +266,7 @@ static int rs_send_lq_cmd(struct iwl4965_priv *priv,
|
|||
IWL_DEBUG_RATE("lq dta 0x%X 0x%X\n",
|
||||
lq->general_params.single_stream_ant_msk,
|
||||
lq->general_params.dual_stream_ant_msk);
|
||||
#ifdef CONFIG_IWL4965_DEBUG
|
||||
#ifdef CONFIG_IWLWIFI_DEBUG
|
||||
for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++)
|
||||
IWL_DEBUG_RATE("lq index %d 0x%X\n",
|
||||
i, lq->rs_table[i].rate_n_flags);
|
||||
|
@ -276,7 +277,7 @@ static int rs_send_lq_cmd(struct iwl4965_priv *priv,
|
|||
|
||||
if (iwl4965_is_associated(priv) && priv->assoc_station_added &&
|
||||
priv->lq_mngr.lq_ready)
|
||||
return iwl4965_send_cmd(priv, &cmd);
|
||||
return iwl_send_cmd(priv, &cmd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -388,7 +389,7 @@ static u32 rs_tl_get_load(struct iwl4965_lq_sta *lq_data, u8 tid)
|
|||
return tl->total;
|
||||
}
|
||||
|
||||
static void rs_tl_turn_on_agg_for_tid(struct iwl4965_priv *priv,
|
||||
static void rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv,
|
||||
struct iwl4965_lq_sta *lq_data, u8 tid,
|
||||
struct sta_info *sta)
|
||||
{
|
||||
|
@ -407,7 +408,7 @@ static void rs_tl_turn_on_agg_for_tid(struct iwl4965_priv *priv,
|
|||
}
|
||||
}
|
||||
|
||||
static void rs_tl_turn_on_agg(struct iwl4965_priv *priv, u8 tid,
|
||||
static void rs_tl_turn_on_agg(struct iwl_priv *priv, u8 tid,
|
||||
struct iwl4965_lq_sta *lq_data,
|
||||
struct sta_info *sta)
|
||||
{
|
||||
|
@ -658,7 +659,7 @@ static inline void rs_toggle_antenna(struct iwl4965_rate *new_rate,
|
|||
}
|
||||
}
|
||||
|
||||
static inline u8 rs_use_green(struct iwl4965_priv *priv,
|
||||
static inline u8 rs_use_green(struct iwl_priv *priv,
|
||||
struct ieee80211_conf *conf)
|
||||
{
|
||||
#ifdef CONFIG_IWL4965_HT
|
||||
|
@ -821,7 +822,7 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev,
|
|||
struct iwl4965_link_quality_cmd *table;
|
||||
struct sta_info *sta;
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
|
||||
struct iwl4965_priv *priv = (struct iwl4965_priv *)priv_rate;
|
||||
struct iwl_priv *priv = (struct iwl_priv *)priv_rate;
|
||||
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
|
||||
struct ieee80211_hw *hw = local_to_hw(local);
|
||||
struct iwl4965_rate_scale_data *window = NULL;
|
||||
|
@ -1128,7 +1129,7 @@ static void rs_get_expected_tpt_table(struct iwl4965_lq_sta *lq_sta,
|
|||
* to decrease to match "active" throughput. When moving from MIMO to SISO,
|
||||
* bit rate will typically need to increase, but not if performance was bad.
|
||||
*/
|
||||
static s32 rs_get_best_rate(struct iwl4965_priv *priv,
|
||||
static s32 rs_get_best_rate(struct iwl_priv *priv,
|
||||
struct iwl4965_lq_sta *lq_sta,
|
||||
struct iwl4965_scale_tbl_info *tbl, /* "search" */
|
||||
u16 rate_mask, s8 index, s8 rate)
|
||||
|
@ -1226,7 +1227,7 @@ static inline u8 rs_is_both_ant_supp(u8 valid_antenna)
|
|||
/*
|
||||
* Set up search table for MIMO
|
||||
*/
|
||||
static int rs_switch_to_mimo(struct iwl4965_priv *priv,
|
||||
static int rs_switch_to_mimo(struct iwl_priv *priv,
|
||||
struct iwl4965_lq_sta *lq_sta,
|
||||
struct ieee80211_conf *conf,
|
||||
struct sta_info *sta,
|
||||
|
@ -1291,7 +1292,7 @@ static int rs_switch_to_mimo(struct iwl4965_priv *priv,
|
|||
/*
|
||||
* Set up search table for SISO
|
||||
*/
|
||||
static int rs_switch_to_siso(struct iwl4965_priv *priv,
|
||||
static int rs_switch_to_siso(struct iwl_priv *priv,
|
||||
struct iwl4965_lq_sta *lq_sta,
|
||||
struct ieee80211_conf *conf,
|
||||
struct sta_info *sta,
|
||||
|
@ -1354,7 +1355,7 @@ static int rs_switch_to_siso(struct iwl4965_priv *priv,
|
|||
/*
|
||||
* Try to switch to new modulation mode from legacy
|
||||
*/
|
||||
static int rs_move_legacy_other(struct iwl4965_priv *priv,
|
||||
static int rs_move_legacy_other(struct iwl_priv *priv,
|
||||
struct iwl4965_lq_sta *lq_sta,
|
||||
struct ieee80211_conf *conf,
|
||||
struct sta_info *sta,
|
||||
|
@ -1452,7 +1453,7 @@ static int rs_move_legacy_other(struct iwl4965_priv *priv,
|
|||
/*
|
||||
* Try to switch to new modulation mode from SISO
|
||||
*/
|
||||
static int rs_move_siso_to_other(struct iwl4965_priv *priv,
|
||||
static int rs_move_siso_to_other(struct iwl_priv *priv,
|
||||
struct iwl4965_lq_sta *lq_sta,
|
||||
struct ieee80211_conf *conf,
|
||||
struct sta_info *sta,
|
||||
|
@ -1548,7 +1549,7 @@ static int rs_move_siso_to_other(struct iwl4965_priv *priv,
|
|||
/*
|
||||
* Try to switch to new modulation mode from MIMO
|
||||
*/
|
||||
static int rs_move_mimo_to_other(struct iwl4965_priv *priv,
|
||||
static int rs_move_mimo_to_other(struct iwl_priv *priv,
|
||||
struct iwl4965_lq_sta *lq_sta,
|
||||
struct ieee80211_conf *conf,
|
||||
struct sta_info *sta,
|
||||
|
@ -1728,7 +1729,7 @@ static void rs_stay_in_table(struct iwl4965_lq_sta *lq_sta)
|
|||
/*
|
||||
* Do rate scaling and search for new modulation mode.
|
||||
*/
|
||||
static void rs_rate_scale_perform(struct iwl4965_priv *priv,
|
||||
static void rs_rate_scale_perform(struct iwl_priv *priv,
|
||||
struct net_device *dev,
|
||||
struct ieee80211_hdr *hdr,
|
||||
struct sta_info *sta)
|
||||
|
@ -2148,7 +2149,7 @@ out:
|
|||
}
|
||||
|
||||
|
||||
static void rs_initialize_lq(struct iwl4965_priv *priv,
|
||||
static void rs_initialize_lq(struct iwl_priv *priv,
|
||||
struct ieee80211_conf *conf,
|
||||
struct sta_info *sta)
|
||||
{
|
||||
|
@ -2213,7 +2214,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
|
|||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
|
||||
struct sta_info *sta;
|
||||
u16 fc;
|
||||
struct iwl4965_priv *priv = (struct iwl4965_priv *)priv_rate;
|
||||
struct iwl_priv *priv = (struct iwl_priv *)priv_rate;
|
||||
struct iwl4965_lq_sta *lq_sta;
|
||||
|
||||
IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n");
|
||||
|
@ -2294,7 +2295,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
|
|||
int i, j;
|
||||
struct ieee80211_conf *conf = &local->hw.conf;
|
||||
struct ieee80211_supported_band *sband;
|
||||
struct iwl4965_priv *priv = (struct iwl4965_priv *)priv_rate;
|
||||
struct iwl_priv *priv = (struct iwl_priv *)priv_rate;
|
||||
struct iwl4965_lq_sta *lq_sta = priv_sta;
|
||||
|
||||
sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
|
||||
|
@ -2516,7 +2517,7 @@ static void rs_free(void *priv_rate)
|
|||
|
||||
static void rs_clear(void *priv_rate)
|
||||
{
|
||||
struct iwl4965_priv *priv = (struct iwl4965_priv *) priv_rate;
|
||||
struct iwl_priv *priv = (struct iwl_priv *) priv_rate;
|
||||
|
||||
IWL_DEBUG_RATE("enter\n");
|
||||
|
||||
|
@ -2726,7 +2727,7 @@ static struct rate_control_ops rs_ops = {
|
|||
int iwl4965_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
|
||||
{
|
||||
struct ieee80211_local *local = hw_to_local(hw);
|
||||
struct iwl4965_priv *priv = hw->priv;
|
||||
struct iwl_priv *priv = hw->priv;
|
||||
struct iwl4965_lq_sta *lq_sta;
|
||||
struct sta_info *sta;
|
||||
int cnt = 0, i;
|
||||
|
@ -2816,7 +2817,7 @@ int iwl4965_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
|
|||
|
||||
void iwl4965_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
|
||||
{
|
||||
struct iwl4965_priv *priv = hw->priv;
|
||||
struct iwl_priv *priv = hw->priv;
|
||||
|
||||
priv->lq_mngr.lq_ready = 1;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -44,7 +44,7 @@ extern struct pci_device_id iwl4965_hw_card_ids[];
|
|||
#include "iwl-4965-hw.h"
|
||||
#include "iwl-csr.h"
|
||||
#include "iwl-prph.h"
|
||||
#include "iwl-4965-debug.h"
|
||||
#include "iwl-debug.h"
|
||||
|
||||
/* Change firmware file name, using "-" and incrementing number,
|
||||
* *only* when uCode interface or architecture changes so that it
|
||||
|
@ -66,11 +66,6 @@ extern struct pci_device_id iwl4965_hw_card_ids[];
|
|||
* averages within an s8's (used in some apps) range of negative values. */
|
||||
#define IWL_NOISE_MEAS_NOT_AVAILABLE (-127)
|
||||
|
||||
/* Module parameters accessible from iwl-*.c */
|
||||
extern int iwl4965_param_hwcrypto;
|
||||
extern int iwl4965_param_queues_num;
|
||||
extern int iwl4965_param_amsdu_size_8K;
|
||||
|
||||
enum iwl4965_antenna {
|
||||
IWL_ANTENNA_DIVERSITY,
|
||||
IWL_ANTENNA_MAIN,
|
||||
|
@ -142,7 +137,7 @@ struct iwl4965_tx_info {
|
|||
struct iwl4965_tx_queue {
|
||||
struct iwl4965_queue q;
|
||||
struct iwl4965_tfd_frame *bd;
|
||||
struct iwl4965_cmd *cmd;
|
||||
struct iwl_cmd *cmd;
|
||||
dma_addr_t dma_addr_cmd;
|
||||
struct iwl4965_tx_info *txb;
|
||||
int need_update;
|
||||
|
@ -199,7 +194,7 @@ enum {
|
|||
*/
|
||||
#define IWL4965_MAX_RATE (33)
|
||||
|
||||
struct iwl4965_channel_info {
|
||||
struct iwl_channel_info {
|
||||
struct iwl4965_channel_tgd_info tgd;
|
||||
struct iwl4965_channel_tgh_info tgh;
|
||||
struct iwl4965_eeprom_channel eeprom; /* EEPROM regulatory limit */
|
||||
|
@ -314,15 +309,15 @@ enum {
|
|||
CMD_WANT_SKB = (1 << 2),
|
||||
};
|
||||
|
||||
struct iwl4965_cmd;
|
||||
struct iwl4965_priv;
|
||||
struct iwl_cmd;
|
||||
struct iwl_priv;
|
||||
|
||||
struct iwl4965_cmd_meta {
|
||||
struct iwl4965_cmd_meta *source;
|
||||
struct iwl_cmd_meta {
|
||||
struct iwl_cmd_meta *source;
|
||||
union {
|
||||
struct sk_buff *skb;
|
||||
int (*callback)(struct iwl4965_priv *priv,
|
||||
struct iwl4965_cmd *cmd, struct sk_buff *skb);
|
||||
int (*callback)(struct iwl_priv *priv,
|
||||
struct iwl_cmd *cmd, struct sk_buff *skb);
|
||||
} __attribute__ ((packed)) u;
|
||||
|
||||
/* The CMD_SIZE_HUGE flag bit indicates that the command
|
||||
|
@ -332,15 +327,15 @@ struct iwl4965_cmd_meta {
|
|||
} __attribute__ ((packed));
|
||||
|
||||
/**
|
||||
* struct iwl4965_cmd
|
||||
* struct iwl_cmd
|
||||
*
|
||||
* For allocation of the command and tx queues, this establishes the overall
|
||||
* size of the largest command we send to uCode, except for a scan command
|
||||
* (which is relatively huge; space is allocated separately).
|
||||
*/
|
||||
struct iwl4965_cmd {
|
||||
struct iwl4965_cmd_meta meta; /* driver data */
|
||||
struct iwl4965_cmd_header hdr; /* uCode API */
|
||||
struct iwl_cmd {
|
||||
struct iwl_cmd_meta meta; /* driver data */
|
||||
struct iwl_cmd_header hdr; /* uCode API */
|
||||
union {
|
||||
struct iwl4965_addsta_cmd addsta;
|
||||
struct iwl4965_led_cmd led;
|
||||
|
@ -360,15 +355,15 @@ struct iwl4965_cmd {
|
|||
} __attribute__ ((packed)) cmd;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct iwl4965_host_cmd {
|
||||
struct iwl_host_cmd {
|
||||
u8 id;
|
||||
u16 len;
|
||||
struct iwl4965_cmd_meta meta;
|
||||
struct iwl_cmd_meta meta;
|
||||
const void *data;
|
||||
};
|
||||
|
||||
#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl4965_cmd) - \
|
||||
sizeof(struct iwl4965_cmd_meta))
|
||||
#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_cmd) - \
|
||||
sizeof(struct iwl_cmd_meta))
|
||||
|
||||
/*
|
||||
* RX related structures and functions
|
||||
|
@ -483,6 +478,7 @@ struct iwl4965_tid_data {
|
|||
struct iwl4965_hw_key {
|
||||
enum ieee80211_key_alg alg;
|
||||
int keylen;
|
||||
struct ieee80211_key_conf *conf;
|
||||
u8 key[32];
|
||||
};
|
||||
|
||||
|
@ -634,51 +630,50 @@ struct iwl4965_driver_hw_info {
|
|||
*
|
||||
*****************************************************************************/
|
||||
struct iwl4965_addsta_cmd;
|
||||
extern int iwl4965_send_add_station(struct iwl4965_priv *priv,
|
||||
extern int iwl4965_send_add_station(struct iwl_priv *priv,
|
||||
struct iwl4965_addsta_cmd *sta, u8 flags);
|
||||
extern u8 iwl4965_add_station_flags(struct iwl4965_priv *priv, const u8 *addr,
|
||||
extern u8 iwl4965_add_station_flags(struct iwl_priv *priv, const u8 *addr,
|
||||
int is_ap, u8 flags, void *ht_data);
|
||||
extern int iwl4965_is_network_packet(struct iwl4965_priv *priv,
|
||||
extern int iwl4965_is_network_packet(struct iwl_priv *priv,
|
||||
struct ieee80211_hdr *header);
|
||||
extern int iwl4965_power_init_handle(struct iwl4965_priv *priv);
|
||||
extern void iwl4965_handle_data_packet_monitor(struct iwl4965_priv *priv,
|
||||
extern int iwl4965_power_init_handle(struct iwl_priv *priv);
|
||||
extern void iwl4965_handle_data_packet_monitor(struct iwl_priv *priv,
|
||||
struct iwl4965_rx_mem_buffer *rxb,
|
||||
void *data, short len,
|
||||
struct ieee80211_rx_status *stats,
|
||||
u16 phy_flags);
|
||||
extern int iwl4965_is_duplicate_packet(struct iwl4965_priv *priv,
|
||||
extern int iwl4965_is_duplicate_packet(struct iwl_priv *priv,
|
||||
struct ieee80211_hdr *header);
|
||||
extern int iwl4965_rx_queue_alloc(struct iwl4965_priv *priv);
|
||||
extern void iwl4965_rx_queue_reset(struct iwl4965_priv *priv,
|
||||
extern int iwl4965_rx_queue_alloc(struct iwl_priv *priv);
|
||||
extern void iwl4965_rx_queue_reset(struct iwl_priv *priv,
|
||||
struct iwl4965_rx_queue *rxq);
|
||||
extern int iwl4965_calc_db_from_ratio(int sig_ratio);
|
||||
extern int iwl4965_calc_sig_qual(int rssi_dbm, int noise_dbm);
|
||||
extern int iwl4965_tx_queue_init(struct iwl4965_priv *priv,
|
||||
extern int iwl4965_tx_queue_init(struct iwl_priv *priv,
|
||||
struct iwl4965_tx_queue *txq, int count, u32 id);
|
||||
extern void iwl4965_rx_replenish(void *data);
|
||||
extern void iwl4965_tx_queue_free(struct iwl4965_priv *priv, struct iwl4965_tx_queue *txq);
|
||||
extern int iwl4965_send_cmd_pdu(struct iwl4965_priv *priv, u8 id, u16 len,
|
||||
const void *data);
|
||||
extern int __must_check iwl4965_send_cmd(struct iwl4965_priv *priv,
|
||||
struct iwl4965_host_cmd *cmd);
|
||||
extern unsigned int iwl4965_fill_beacon_frame(struct iwl4965_priv *priv,
|
||||
extern void iwl4965_tx_queue_free(struct iwl_priv *priv, struct iwl4965_tx_queue *txq);
|
||||
extern unsigned int iwl4965_fill_beacon_frame(struct iwl_priv *priv,
|
||||
struct ieee80211_hdr *hdr,
|
||||
const u8 *dest, int left);
|
||||
extern int iwl4965_rx_queue_update_write_ptr(struct iwl4965_priv *priv,
|
||||
extern int iwl4965_rx_queue_update_write_ptr(struct iwl_priv *priv,
|
||||
struct iwl4965_rx_queue *q);
|
||||
extern int iwl4965_send_statistics_request(struct iwl4965_priv *priv);
|
||||
extern void iwl4965_set_decrypted_flag(struct iwl4965_priv *priv, struct sk_buff *skb,
|
||||
extern int iwl4965_send_statistics_request(struct iwl_priv *priv);
|
||||
extern void iwl4965_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb,
|
||||
u32 decrypt_res,
|
||||
struct ieee80211_rx_status *stats);
|
||||
extern __le16 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr);
|
||||
int iwl4965_init_geos(struct iwl_priv *priv);
|
||||
void iwl4965_free_geos(struct iwl_priv *priv);
|
||||
|
||||
extern const u8 iwl4965_broadcast_addr[ETH_ALEN];
|
||||
int iwl4965_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd);
|
||||
|
||||
/*
|
||||
* Currently used by iwl-3945-rs... look at restructuring so that it doesn't
|
||||
* call this... todo... fix that.
|
||||
*/
|
||||
extern u8 iwl4965_sync_station(struct iwl4965_priv *priv, int sta_id,
|
||||
extern u8 iwl4965_sync_station(struct iwl_priv *priv, int sta_id,
|
||||
u16 tx_rate, u8 flags);
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -697,36 +692,36 @@ extern u8 iwl4965_sync_station(struct iwl4965_priv *priv, int sta_id,
|
|||
* iwl4965_mac_ <-- mac80211 callback
|
||||
*
|
||||
****************************************************************************/
|
||||
extern void iwl4965_hw_rx_handler_setup(struct iwl4965_priv *priv);
|
||||
extern void iwl4965_hw_setup_deferred_work(struct iwl4965_priv *priv);
|
||||
extern void iwl4965_hw_cancel_deferred_work(struct iwl4965_priv *priv);
|
||||
extern int iwl4965_hw_rxq_stop(struct iwl4965_priv *priv);
|
||||
extern int iwl4965_hw_set_hw_setting(struct iwl4965_priv *priv);
|
||||
extern int iwl4965_hw_nic_init(struct iwl4965_priv *priv);
|
||||
extern int iwl4965_hw_nic_stop_master(struct iwl4965_priv *priv);
|
||||
extern void iwl4965_hw_txq_ctx_free(struct iwl4965_priv *priv);
|
||||
extern void iwl4965_hw_txq_ctx_stop(struct iwl4965_priv *priv);
|
||||
extern int iwl4965_hw_nic_reset(struct iwl4965_priv *priv);
|
||||
extern int iwl4965_hw_txq_attach_buf_to_tfd(struct iwl4965_priv *priv, void *tfd,
|
||||
extern void iwl4965_hw_rx_handler_setup(struct iwl_priv *priv);
|
||||
extern void iwl4965_hw_setup_deferred_work(struct iwl_priv *priv);
|
||||
extern void iwl4965_hw_cancel_deferred_work(struct iwl_priv *priv);
|
||||
extern int iwl4965_hw_rxq_stop(struct iwl_priv *priv);
|
||||
extern int iwl4965_hw_set_hw_setting(struct iwl_priv *priv);
|
||||
extern int iwl4965_hw_nic_init(struct iwl_priv *priv);
|
||||
extern int iwl4965_hw_nic_stop_master(struct iwl_priv *priv);
|
||||
extern void iwl4965_hw_txq_ctx_free(struct iwl_priv *priv);
|
||||
extern void iwl4965_hw_txq_ctx_stop(struct iwl_priv *priv);
|
||||
extern int iwl4965_hw_nic_reset(struct iwl_priv *priv);
|
||||
extern int iwl4965_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *tfd,
|
||||
dma_addr_t addr, u16 len);
|
||||
extern int iwl4965_hw_txq_free_tfd(struct iwl4965_priv *priv, struct iwl4965_tx_queue *txq);
|
||||
extern int iwl4965_hw_get_temperature(struct iwl4965_priv *priv);
|
||||
extern int iwl4965_hw_tx_queue_init(struct iwl4965_priv *priv,
|
||||
extern int iwl4965_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl4965_tx_queue *txq);
|
||||
extern int iwl4965_hw_get_temperature(struct iwl_priv *priv);
|
||||
extern int iwl4965_hw_tx_queue_init(struct iwl_priv *priv,
|
||||
struct iwl4965_tx_queue *txq);
|
||||
extern unsigned int iwl4965_hw_get_beacon_cmd(struct iwl4965_priv *priv,
|
||||
extern unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv,
|
||||
struct iwl4965_frame *frame, u8 rate);
|
||||
extern int iwl4965_hw_get_rx_read(struct iwl4965_priv *priv);
|
||||
extern void iwl4965_hw_build_tx_cmd_rate(struct iwl4965_priv *priv,
|
||||
struct iwl4965_cmd *cmd,
|
||||
extern int iwl4965_hw_get_rx_read(struct iwl_priv *priv);
|
||||
extern void iwl4965_hw_build_tx_cmd_rate(struct iwl_priv *priv,
|
||||
struct iwl_cmd *cmd,
|
||||
struct ieee80211_tx_control *ctrl,
|
||||
struct ieee80211_hdr *hdr,
|
||||
int sta_id, int tx_id);
|
||||
extern int iwl4965_hw_reg_send_txpower(struct iwl4965_priv *priv);
|
||||
extern int iwl4965_hw_reg_set_txpower(struct iwl4965_priv *priv, s8 power);
|
||||
extern void iwl4965_hw_rx_statistics(struct iwl4965_priv *priv,
|
||||
extern int iwl4965_hw_reg_send_txpower(struct iwl_priv *priv);
|
||||
extern int iwl4965_hw_reg_set_txpower(struct iwl_priv *priv, s8 power);
|
||||
extern void iwl4965_hw_rx_statistics(struct iwl_priv *priv,
|
||||
struct iwl4965_rx_mem_buffer *rxb);
|
||||
extern void iwl4965_disable_events(struct iwl4965_priv *priv);
|
||||
extern int iwl4965_get_temperature(const struct iwl4965_priv *priv);
|
||||
extern void iwl4965_disable_events(struct iwl_priv *priv);
|
||||
extern int iwl4965_get_temperature(const struct iwl_priv *priv);
|
||||
|
||||
/**
|
||||
* iwl4965_hw_find_station - Find station id for a given BSSID
|
||||
|
@ -736,51 +731,48 @@ extern int iwl4965_get_temperature(const struct iwl4965_priv *priv);
|
|||
* not yet been merged into a single common layer for managing the
|
||||
* station tables.
|
||||
*/
|
||||
extern u8 iwl4965_hw_find_station(struct iwl4965_priv *priv, const u8 *bssid);
|
||||
extern u8 iwl4965_hw_find_station(struct iwl_priv *priv, const u8 *bssid);
|
||||
|
||||
extern int iwl4965_hw_channel_switch(struct iwl4965_priv *priv, u16 channel);
|
||||
extern int iwl4965_tx_queue_reclaim(struct iwl4965_priv *priv, int txq_id, int index);
|
||||
extern int iwl4965_hw_channel_switch(struct iwl_priv *priv, u16 channel);
|
||||
extern int iwl4965_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index);
|
||||
extern int iwl4965_queue_space(const struct iwl4965_queue *q);
|
||||
struct iwl4965_priv;
|
||||
struct iwl_priv;
|
||||
|
||||
/*
|
||||
* Forward declare iwl-4965.c functions for iwl-base.c
|
||||
*/
|
||||
extern int iwl4965_tx_queue_update_wr_ptr(struct iwl4965_priv *priv,
|
||||
extern int iwl4965_tx_queue_update_wr_ptr(struct iwl_priv *priv,
|
||||
struct iwl4965_tx_queue *txq,
|
||||
u16 byte_cnt);
|
||||
extern void iwl4965_add_station(struct iwl4965_priv *priv, const u8 *addr,
|
||||
extern void iwl4965_add_station(struct iwl_priv *priv, const u8 *addr,
|
||||
int is_ap);
|
||||
extern void iwl4965_set_rxon_chain(struct iwl4965_priv *priv);
|
||||
extern int iwl4965_alive_notify(struct iwl4965_priv *priv);
|
||||
extern void iwl4965_update_rate_scaling(struct iwl4965_priv *priv, u8 mode);
|
||||
extern void iwl4965_chain_noise_reset(struct iwl4965_priv *priv);
|
||||
extern void iwl4965_init_sensitivity(struct iwl4965_priv *priv, u8 flags,
|
||||
extern void iwl4965_set_rxon_chain(struct iwl_priv *priv);
|
||||
extern int iwl4965_alive_notify(struct iwl_priv *priv);
|
||||
extern void iwl4965_update_rate_scaling(struct iwl_priv *priv, u8 mode);
|
||||
extern void iwl4965_chain_noise_reset(struct iwl_priv *priv);
|
||||
extern void iwl4965_init_sensitivity(struct iwl_priv *priv, u8 flags,
|
||||
u8 force);
|
||||
extern int iwl4965_set_fat_chan_info(struct iwl4965_priv *priv,
|
||||
enum ieee80211_band band,
|
||||
u16 channel,
|
||||
const struct iwl4965_eeprom_channel *eeprom_ch,
|
||||
u8 fat_extension_channel);
|
||||
extern void iwl4965_rf_kill_ct_config(struct iwl4965_priv *priv);
|
||||
extern void iwl4965_hwrate_to_tx_control(struct iwl4965_priv *priv,
|
||||
extern void iwl4965_rf_kill_ct_config(struct iwl_priv *priv);
|
||||
extern void iwl4965_hwrate_to_tx_control(struct iwl_priv *priv,
|
||||
u32 rate_n_flags,
|
||||
struct ieee80211_tx_control *control);
|
||||
|
||||
#ifdef CONFIG_IWL4965_HT
|
||||
void iwl4965_init_ht_hw_capab(struct ieee80211_ht_info *ht_info,
|
||||
void iwl4965_init_ht_hw_capab(struct iwl_priv *priv,
|
||||
struct ieee80211_ht_info *ht_info,
|
||||
enum ieee80211_band band);
|
||||
void iwl4965_set_rxon_ht(struct iwl4965_priv *priv,
|
||||
void iwl4965_set_rxon_ht(struct iwl_priv *priv,
|
||||
struct iwl_ht_info *ht_info);
|
||||
void iwl4965_set_ht_add_station(struct iwl4965_priv *priv, u8 index,
|
||||
void iwl4965_set_ht_add_station(struct iwl_priv *priv, u8 index,
|
||||
struct ieee80211_ht_info *sta_ht_inf);
|
||||
int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw,
|
||||
enum ieee80211_ampdu_mlme_action action,
|
||||
const u8 *addr, u16 tid, u16 *ssn);
|
||||
int iwl4965_check_empty_hw_queue(struct iwl4965_priv *priv, int sta_id,
|
||||
int iwl4965_check_empty_hw_queue(struct iwl_priv *priv, int sta_id,
|
||||
u8 tid, int txq_id);
|
||||
#else
|
||||
static inline void iwl4965_init_ht_hw_capab(struct ieee80211_ht_info *ht_info,
|
||||
static inline void iwl4965_init_ht_hw_capab(struct iwl_priv *priv,
|
||||
struct ieee80211_ht_info *ht_info,
|
||||
enum ieee80211_band band) {}
|
||||
|
||||
#endif /*CONFIG_IWL4965_HT */
|
||||
|
@ -966,7 +958,7 @@ enum {
|
|||
|
||||
#endif
|
||||
|
||||
struct iwl4965_priv {
|
||||
struct iwl_priv {
|
||||
|
||||
/* ieee device used by generic ieee processing code */
|
||||
struct ieee80211_hw *hw;
|
||||
|
@ -982,7 +974,7 @@ struct iwl4965_priv {
|
|||
int alloc_rxb_skb;
|
||||
bool add_radiotap;
|
||||
|
||||
void (*rx_handlers[REPLY_MAX])(struct iwl4965_priv *priv,
|
||||
void (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv,
|
||||
struct iwl4965_rx_mem_buffer *rxb);
|
||||
|
||||
struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
|
||||
|
@ -997,7 +989,7 @@ struct iwl4965_priv {
|
|||
|
||||
/* we allocate array of iwl4965_channel_info for NIC's valid channels.
|
||||
* Access via channel # using indirect index array */
|
||||
struct iwl4965_channel_info *channel_info; /* channel info array */
|
||||
struct iwl_channel_info *channel_info; /* channel info array */
|
||||
u8 channel_count; /* # of channels */
|
||||
|
||||
/* each calibration channel group in the EEPROM has a derived
|
||||
|
@ -1107,6 +1099,12 @@ struct iwl4965_priv {
|
|||
int last_rx_rssi; /* From Rx packet statisitics */
|
||||
int last_rx_noise; /* From beacon statistics */
|
||||
|
||||
/* counts mgmt, ctl, and data packets */
|
||||
struct traffic_stats {
|
||||
u32 cnt;
|
||||
u64 bytes;
|
||||
} tx_stats[3], rx_stats[3];
|
||||
|
||||
struct iwl4965_power_mgr power_data;
|
||||
|
||||
struct iwl4965_notif_statistics statistics;
|
||||
|
@ -1202,11 +1200,15 @@ struct iwl4965_priv {
|
|||
u32 pm_state[16];
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_IWL4965_DEBUG
|
||||
#ifdef CONFIG_IWLWIFI_DEBUG
|
||||
/* debugging info */
|
||||
u32 framecnt_to_us;
|
||||
atomic_t restrict_refcnt;
|
||||
#endif
|
||||
#ifdef CONFIG_IWLWIFI_DEBUGFS
|
||||
/* debugfs */
|
||||
struct iwl_debugfs *dbgfs;
|
||||
#endif /* CONFIG_IWLWIFI_DEBUGFS */
|
||||
#endif /* CONFIG_IWLWIFI_DEBUG */
|
||||
|
||||
struct work_struct txpower_work;
|
||||
#ifdef CONFIG_IWL4965_SENSITIVITY
|
||||
|
@ -1214,54 +1216,54 @@ struct iwl4965_priv {
|
|||
#endif
|
||||
struct work_struct statistics_work;
|
||||
struct timer_list statistics_periodic;
|
||||
}; /*iwl4965_priv */
|
||||
}; /*iwl_priv */
|
||||
|
||||
static inline int iwl4965_is_associated(struct iwl4965_priv *priv)
|
||||
static inline int iwl4965_is_associated(struct iwl_priv *priv)
|
||||
{
|
||||
return (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0;
|
||||
}
|
||||
|
||||
static inline int is_channel_valid(const struct iwl4965_channel_info *ch_info)
|
||||
static inline int is_channel_valid(const struct iwl_channel_info *ch_info)
|
||||
{
|
||||
if (ch_info == NULL)
|
||||
return 0;
|
||||
return (ch_info->flags & EEPROM_CHANNEL_VALID) ? 1 : 0;
|
||||
}
|
||||
|
||||
static inline int is_channel_narrow(const struct iwl4965_channel_info *ch_info)
|
||||
static inline int is_channel_narrow(const struct iwl_channel_info *ch_info)
|
||||
{
|
||||
return (ch_info->flags & EEPROM_CHANNEL_NARROW) ? 1 : 0;
|
||||
}
|
||||
|
||||
static inline int is_channel_radar(const struct iwl4965_channel_info *ch_info)
|
||||
static inline int is_channel_radar(const struct iwl_channel_info *ch_info)
|
||||
{
|
||||
return (ch_info->flags & EEPROM_CHANNEL_RADAR) ? 1 : 0;
|
||||
}
|
||||
|
||||
static inline u8 is_channel_a_band(const struct iwl4965_channel_info *ch_info)
|
||||
static inline u8 is_channel_a_band(const struct iwl_channel_info *ch_info)
|
||||
{
|
||||
return ch_info->band == IEEE80211_BAND_5GHZ;
|
||||
}
|
||||
|
||||
static inline u8 is_channel_bg_band(const struct iwl4965_channel_info *ch_info)
|
||||
static inline u8 is_channel_bg_band(const struct iwl_channel_info *ch_info)
|
||||
{
|
||||
return ch_info->band == IEEE80211_BAND_2GHZ;
|
||||
}
|
||||
|
||||
static inline int is_channel_passive(const struct iwl4965_channel_info *ch)
|
||||
static inline int is_channel_passive(const struct iwl_channel_info *ch)
|
||||
{
|
||||
return (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) ? 1 : 0;
|
||||
}
|
||||
|
||||
static inline int is_channel_ibss(const struct iwl4965_channel_info *ch)
|
||||
static inline int is_channel_ibss(const struct iwl_channel_info *ch)
|
||||
{
|
||||
return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0;
|
||||
}
|
||||
|
||||
extern const struct iwl4965_channel_info *iwl4965_get_channel_info(
|
||||
const struct iwl4965_priv *priv, enum ieee80211_band band, u16 channel);
|
||||
extern const struct iwl_channel_info *iwl_get_channel_info(
|
||||
const struct iwl_priv *priv, enum ieee80211_band band, u16 channel);
|
||||
|
||||
/* Requires full declaration of iwl4965_priv before including */
|
||||
/* Requires full declaration of iwl_priv before including */
|
||||
#include "iwl-4965-io.h"
|
||||
|
||||
#endif /* __iwl4965_4965_h__ */
|
||||
|
|
|
@ -29,17 +29,223 @@
|
|||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/version.h>
|
||||
#include <net/mac80211.h>
|
||||
|
||||
#include "iwl-4965-debug.h"
|
||||
struct iwl_priv; /* FIXME: remove */
|
||||
#include "iwl-debug.h"
|
||||
#include "iwl-eeprom.h"
|
||||
#include "iwl-core.h"
|
||||
|
||||
#include "iwl-4965.h" /* FIXME: remove */
|
||||
|
||||
MODULE_DESCRIPTION("iwl core");
|
||||
MODULE_VERSION(IWLWIFI_VERSION);
|
||||
MODULE_AUTHOR(DRV_COPYRIGHT);
|
||||
MODULE_LICENSE("GPL/BSD");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
#ifdef CONFIG_IWL4965_DEBUG
|
||||
u32 iwl4965_debug_level;
|
||||
EXPORT_SYMBOL(iwl4965_debug_level);
|
||||
#ifdef CONFIG_IWLWIFI_DEBUG
|
||||
u32 iwl_debug_level;
|
||||
EXPORT_SYMBOL(iwl_debug_level);
|
||||
#endif
|
||||
|
||||
/* This function both allocates and initializes hw and priv. */
|
||||
struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg,
|
||||
struct ieee80211_ops *hw_ops)
|
||||
{
|
||||
struct iwl_priv *priv;
|
||||
|
||||
/* mac80211 allocates memory for this device instance, including
|
||||
* space for this driver's private structure */
|
||||
struct ieee80211_hw *hw =
|
||||
ieee80211_alloc_hw(sizeof(struct iwl_priv), hw_ops);
|
||||
if (hw == NULL) {
|
||||
IWL_ERROR("Can not allocate network device\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
priv = hw->priv;
|
||||
priv->hw = hw;
|
||||
|
||||
out:
|
||||
return hw;
|
||||
}
|
||||
EXPORT_SYMBOL(iwl_alloc_all);
|
||||
|
||||
/**
|
||||
* iwlcore_clear_stations_table - Clear the driver's station table
|
||||
*
|
||||
* NOTE: This does not clear or otherwise alter the device's station table.
|
||||
*/
|
||||
void iwlcore_clear_stations_table(struct iwl_priv *priv)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&priv->sta_lock, flags);
|
||||
|
||||
priv->num_stations = 0;
|
||||
memset(priv->stations, 0, sizeof(priv->stations));
|
||||
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags);
|
||||
}
|
||||
EXPORT_SYMBOL(iwlcore_clear_stations_table);
|
||||
|
||||
void iwlcore_reset_qos(struct iwl_priv *priv)
|
||||
{
|
||||
u16 cw_min = 15;
|
||||
u16 cw_max = 1023;
|
||||
u8 aifs = 2;
|
||||
u8 is_legacy = 0;
|
||||
unsigned long flags;
|
||||
int i;
|
||||
|
||||
spin_lock_irqsave(&priv->lock, flags);
|
||||
priv->qos_data.qos_active = 0;
|
||||
|
||||
if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS) {
|
||||
if (priv->qos_data.qos_enable)
|
||||
priv->qos_data.qos_active = 1;
|
||||
if (!(priv->active_rate & 0xfff0)) {
|
||||
cw_min = 31;
|
||||
is_legacy = 1;
|
||||
}
|
||||
} else if (priv->iw_mode == IEEE80211_IF_TYPE_AP) {
|
||||
if (priv->qos_data.qos_enable)
|
||||
priv->qos_data.qos_active = 1;
|
||||
} else if (!(priv->staging_rxon.flags & RXON_FLG_SHORT_SLOT_MSK)) {
|
||||
cw_min = 31;
|
||||
is_legacy = 1;
|
||||
}
|
||||
|
||||
if (priv->qos_data.qos_active)
|
||||
aifs = 3;
|
||||
|
||||
priv->qos_data.def_qos_parm.ac[0].cw_min = cpu_to_le16(cw_min);
|
||||
priv->qos_data.def_qos_parm.ac[0].cw_max = cpu_to_le16(cw_max);
|
||||
priv->qos_data.def_qos_parm.ac[0].aifsn = aifs;
|
||||
priv->qos_data.def_qos_parm.ac[0].edca_txop = 0;
|
||||
priv->qos_data.def_qos_parm.ac[0].reserved1 = 0;
|
||||
|
||||
if (priv->qos_data.qos_active) {
|
||||
i = 1;
|
||||
priv->qos_data.def_qos_parm.ac[i].cw_min = cpu_to_le16(cw_min);
|
||||
priv->qos_data.def_qos_parm.ac[i].cw_max = cpu_to_le16(cw_max);
|
||||
priv->qos_data.def_qos_parm.ac[i].aifsn = 7;
|
||||
priv->qos_data.def_qos_parm.ac[i].edca_txop = 0;
|
||||
priv->qos_data.def_qos_parm.ac[i].reserved1 = 0;
|
||||
|
||||
i = 2;
|
||||
priv->qos_data.def_qos_parm.ac[i].cw_min =
|
||||
cpu_to_le16((cw_min + 1) / 2 - 1);
|
||||
priv->qos_data.def_qos_parm.ac[i].cw_max =
|
||||
cpu_to_le16(cw_max);
|
||||
priv->qos_data.def_qos_parm.ac[i].aifsn = 2;
|
||||
if (is_legacy)
|
||||
priv->qos_data.def_qos_parm.ac[i].edca_txop =
|
||||
cpu_to_le16(6016);
|
||||
else
|
||||
priv->qos_data.def_qos_parm.ac[i].edca_txop =
|
||||
cpu_to_le16(3008);
|
||||
priv->qos_data.def_qos_parm.ac[i].reserved1 = 0;
|
||||
|
||||
i = 3;
|
||||
priv->qos_data.def_qos_parm.ac[i].cw_min =
|
||||
cpu_to_le16((cw_min + 1) / 4 - 1);
|
||||
priv->qos_data.def_qos_parm.ac[i].cw_max =
|
||||
cpu_to_le16((cw_max + 1) / 2 - 1);
|
||||
priv->qos_data.def_qos_parm.ac[i].aifsn = 2;
|
||||
priv->qos_data.def_qos_parm.ac[i].reserved1 = 0;
|
||||
if (is_legacy)
|
||||
priv->qos_data.def_qos_parm.ac[i].edca_txop =
|
||||
cpu_to_le16(3264);
|
||||
else
|
||||
priv->qos_data.def_qos_parm.ac[i].edca_txop =
|
||||
cpu_to_le16(1504);
|
||||
} else {
|
||||
for (i = 1; i < 4; i++) {
|
||||
priv->qos_data.def_qos_parm.ac[i].cw_min =
|
||||
cpu_to_le16(cw_min);
|
||||
priv->qos_data.def_qos_parm.ac[i].cw_max =
|
||||
cpu_to_le16(cw_max);
|
||||
priv->qos_data.def_qos_parm.ac[i].aifsn = aifs;
|
||||
priv->qos_data.def_qos_parm.ac[i].edca_txop = 0;
|
||||
priv->qos_data.def_qos_parm.ac[i].reserved1 = 0;
|
||||
}
|
||||
}
|
||||
IWL_DEBUG_QOS("set QoS to default \n");
|
||||
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
}
|
||||
EXPORT_SYMBOL(iwlcore_reset_qos);
|
||||
|
||||
/**
|
||||
* iwlcore_set_rxon_channel - Set the phymode and channel values in staging RXON
|
||||
* @phymode: MODE_IEEE80211A sets to 5.2GHz; all else set to 2.4GHz
|
||||
* @channel: Any channel valid for the requested phymode
|
||||
|
||||
* In addition to setting the staging RXON, priv->phymode is also set.
|
||||
*
|
||||
* NOTE: Does not commit to the hardware; it sets appropriate bit fields
|
||||
* in the staging RXON flag structure based on the phymode
|
||||
*/
|
||||
int iwlcore_set_rxon_channel(struct iwl_priv *priv,
|
||||
enum ieee80211_band band,
|
||||
u16 channel)
|
||||
{
|
||||
if (!iwl_get_channel_info(priv, band, channel)) {
|
||||
IWL_DEBUG_INFO("Could not set channel to %d [%d]\n",
|
||||
channel, band);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if ((le16_to_cpu(priv->staging_rxon.channel) == channel) &&
|
||||
(priv->band == band))
|
||||
return 0;
|
||||
|
||||
priv->staging_rxon.channel = cpu_to_le16(channel);
|
||||
if (band == IEEE80211_BAND_5GHZ)
|
||||
priv->staging_rxon.flags &= ~RXON_FLG_BAND_24G_MSK;
|
||||
else
|
||||
priv->staging_rxon.flags |= RXON_FLG_BAND_24G_MSK;
|
||||
|
||||
priv->band = band;
|
||||
|
||||
IWL_DEBUG_INFO("Staging channel set to %d [%d]\n", channel, band);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(iwlcore_set_rxon_channel);
|
||||
|
||||
static void iwlcore_init_hw(struct iwl_priv *priv)
|
||||
{
|
||||
struct ieee80211_hw *hw = priv->hw;
|
||||
hw->rate_control_algorithm = "iwl-4965-rs";
|
||||
|
||||
/* Tell mac80211 and its clients (e.g. Wireless Extensions)
|
||||
* the range of signal quality values that we'll provide.
|
||||
* Negative values for level/noise indicate that we'll provide dBm.
|
||||
* For WE, at least, non-0 values here *enable* display of values
|
||||
* in app (iwconfig). */
|
||||
hw->max_rssi = -20; /* signal level, negative indicates dBm */
|
||||
hw->max_noise = -20; /* noise level, negative indicates dBm */
|
||||
hw->max_signal = 100; /* link quality indication (%) */
|
||||
|
||||
/* Tell mac80211 our Tx characteristics */
|
||||
hw->flags = IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE;
|
||||
|
||||
/* Default value; 4 EDCA QOS priorities */
|
||||
hw->queues = 4;
|
||||
#ifdef CONFIG_IWL4965_HT
|
||||
/* Enhanced value; more queues, to support 11n aggregation */
|
||||
hw->queues = 16;
|
||||
#endif /* CONFIG_IWL4965_HT */
|
||||
}
|
||||
|
||||
int iwl_setup(struct iwl_priv *priv)
|
||||
{
|
||||
int ret = 0;
|
||||
iwlcore_init_hw(priv);
|
||||
ret = priv->cfg->ops->lib->init_drv(priv);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(iwl_setup);
|
||||
|
||||
|
|
|
@ -63,6 +63,13 @@
|
|||
#ifndef __iwl_core_h__
|
||||
#define __iwl_core_h__
|
||||
|
||||
/************************
|
||||
* forward declarations *
|
||||
************************/
|
||||
struct iwl_host_cmd;
|
||||
struct iwl_cmd;
|
||||
|
||||
|
||||
#define IWLWIFI_VERSION "1.2.26k"
|
||||
#define DRV_COPYRIGHT "Copyright(c) 2003-2008 Intel Corporation"
|
||||
|
||||
|
@ -75,13 +82,31 @@
|
|||
#define IWL_SKU_A 0x2
|
||||
#define IWL_SKU_N 0x8
|
||||
|
||||
struct iwl_hcmd_utils_ops {
|
||||
int (*enqueue_hcmd)(struct iwl_priv *priv, struct iwl_host_cmd *cmd);
|
||||
};
|
||||
|
||||
struct iwl_lib_ops {
|
||||
/* iwlwifi driver (priv) init */
|
||||
int (*init_drv)(struct iwl_priv *priv);
|
||||
/* eeprom operations (as defined in iwl-eeprom.h) */
|
||||
struct iwl_eeprom_ops eeprom_ops;
|
||||
};
|
||||
|
||||
struct iwl_ops {
|
||||
const struct iwl_lib_ops *lib;
|
||||
const struct iwl_hcmd_utils_ops *utils;
|
||||
};
|
||||
|
||||
struct iwl_mod_params {
|
||||
int disable; /* def: 0 = enable radio */
|
||||
int hw_crypto; /* def: 0 = using software encryption */
|
||||
int debug; /* def: 0 = minimal debug log messages */
|
||||
int disable_hw_scan; /* def: 0 = use h/w scan */
|
||||
int num_of_queues; /* def: HW dependent */
|
||||
int enable_qos; /* def: 1 = use quality of service */
|
||||
int amsdu_size_8K; /* def: 1 = enable 8K amsdu size */
|
||||
int antenna; /* def: 0 = both antennas (use diversity) */
|
||||
};
|
||||
|
||||
struct iwl_cfg {
|
||||
|
@ -89,6 +114,36 @@ struct iwl_cfg {
|
|||
const char *fw_name;
|
||||
unsigned int sku;
|
||||
const struct iwl_ops *ops;
|
||||
const struct iwl_mod_params *mod_params;
|
||||
};
|
||||
|
||||
/***************************
|
||||
* L i b *
|
||||
***************************/
|
||||
|
||||
struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg,
|
||||
struct ieee80211_ops *hw_ops);
|
||||
|
||||
void iwlcore_clear_stations_table(struct iwl_priv *priv);
|
||||
void iwlcore_reset_qos(struct iwl_priv *priv);
|
||||
int iwlcore_set_rxon_channel(struct iwl_priv *priv,
|
||||
enum ieee80211_band band,
|
||||
u16 channel);
|
||||
|
||||
int iwl_setup(struct iwl_priv *priv);
|
||||
|
||||
/*****************************************************
|
||||
* S e n d i n g H o s t C o m m a n d s *
|
||||
*****************************************************/
|
||||
|
||||
const char *get_cmd_string(u8 cmd);
|
||||
int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd);
|
||||
int iwl_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd);
|
||||
int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, const void *data);
|
||||
int iwl_send_cmd_pdu_async(struct iwl_priv *priv, u8 id, u16 len,
|
||||
const void *data,
|
||||
int (*callback)(struct iwl_priv *priv,
|
||||
struct iwl_cmd *cmd,
|
||||
struct sk_buff *skb));
|
||||
|
||||
#endif /* __iwl_core_h__ */
|
||||
|
|
|
@ -26,44 +26,73 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __iwl4965_debug_h__
|
||||
#define __iwl4965_debug_h__
|
||||
#ifndef __iwl_debug_h__
|
||||
#define __iwl_debug_h__
|
||||
|
||||
#ifdef CONFIG_IWL4965_DEBUG
|
||||
extern u32 iwl4965_debug_level;
|
||||
#ifdef CONFIG_IWLWIFI_DEBUG
|
||||
extern u32 iwl_debug_level;
|
||||
#define IWL_DEBUG(level, fmt, args...) \
|
||||
do { if (iwl4965_debug_level & (level)) \
|
||||
do { if (iwl_debug_level & (level)) \
|
||||
printk(KERN_ERR DRV_NAME": %c %s " fmt, \
|
||||
in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0)
|
||||
|
||||
#define IWL_DEBUG_LIMIT(level, fmt, args...) \
|
||||
do { if ((iwl4965_debug_level & (level)) && net_ratelimit()) \
|
||||
do { if ((iwl_debug_level & (level)) && net_ratelimit()) \
|
||||
printk(KERN_ERR DRV_NAME": %c %s " fmt, \
|
||||
in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0)
|
||||
|
||||
static inline void iwl4965_print_hex_dump(int level, void *p, u32 len)
|
||||
static inline void iwl_print_hex_dump(int level, void *p, u32 len)
|
||||
{
|
||||
if (!(iwl4965_debug_level & level))
|
||||
if (!(iwl_debug_level & level))
|
||||
return;
|
||||
|
||||
print_hex_dump(KERN_DEBUG, "iwl data: ", DUMP_PREFIX_OFFSET, 16, 1,
|
||||
p, len, 1);
|
||||
}
|
||||
#else
|
||||
|
||||
#ifdef CONFIG_IWLWIFI_DEBUGFS
|
||||
struct iwl_debugfs {
|
||||
const char *name;
|
||||
struct dentry *dir_drv;
|
||||
struct dentry *dir_data;
|
||||
struct dir_data_files{
|
||||
struct dentry *file_sram;
|
||||
struct dentry *file_stations;
|
||||
struct dentry *file_rx_statistics;
|
||||
struct dentry *file_tx_statistics;
|
||||
} dbgfs_data_files;
|
||||
u32 sram_offset;
|
||||
u32 sram_len;
|
||||
};
|
||||
|
||||
int iwl_dbgfs_register(struct iwl_priv *priv, const char *name);
|
||||
void iwl_dbgfs_unregister(struct iwl_priv *priv);
|
||||
#endif
|
||||
|
||||
#else
|
||||
static inline void IWL_DEBUG(int level, const char *fmt, ...)
|
||||
{
|
||||
}
|
||||
static inline void IWL_DEBUG_LIMIT(int level, const char *fmt, ...)
|
||||
{
|
||||
}
|
||||
static inline void iwl4965_print_hex_dump(int level, void *p, u32 len)
|
||||
static inline void iwl_print_hex_dump(int level, void *p, u32 len)
|
||||
{
|
||||
}
|
||||
#endif /* CONFIG_IWL4965_DEBUG */
|
||||
#endif /* CONFIG_IWLWIFI_DEBUG */
|
||||
|
||||
|
||||
|
||||
#ifndef CONFIG_IWLWIFI_DEBUGFS
|
||||
static inline int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline void iwl_dbgfs_unregister(struct iwl_priv *priv)
|
||||
{
|
||||
}
|
||||
#endif /* CONFIG_IWLWIFI_DEBUGFS */
|
||||
|
||||
/*
|
||||
* To use the debug system;
|
||||
*
|
||||
|
@ -83,10 +112,10 @@ static inline void iwl4965_print_hex_dump(int level, void *p, u32 len)
|
|||
*
|
||||
* % cat /proc/net/iwl/debug_level
|
||||
*
|
||||
* you simply need to add your entry to the iwl4965_debug_levels array.
|
||||
* you simply need to add your entry to the iwl_debug_levels array.
|
||||
*
|
||||
* If you do not see debug_level in /proc/net/iwl then you do not have
|
||||
* CONFIG_IWL4965_DEBUG defined in your kernel configuration
|
||||
* CONFIG_IWLWIFI_DEBUG defined in your kernel configuration
|
||||
*
|
||||
*/
|
||||
|
319
drivers/net/wireless/iwlwifi/iwl-debugfs.c
Normal file
319
drivers/net/wireless/iwlwifi/iwl-debugfs.c
Normal file
|
@ -0,0 +1,319 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* GPL LICENSE SUMMARY
|
||||
*
|
||||
* Copyright(c) 2008 Intel Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
|
||||
* USA
|
||||
*
|
||||
* The full GNU General Public License is included in this distribution
|
||||
* in the file called LICENSE.GPL.
|
||||
*
|
||||
* Contact Information:
|
||||
* Tomas Winkler <tomas.winkler@intel.com>
|
||||
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
|
||||
*****************************************************************************/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/debugfs.h>
|
||||
|
||||
#include <linux/ieee80211.h>
|
||||
#include <net/mac80211.h>
|
||||
|
||||
|
||||
#include "iwl-4965.h"
|
||||
#include "iwl-debug.h"
|
||||
#include "iwl-4965-io.h"
|
||||
|
||||
|
||||
/* create and remove of files */
|
||||
#define DEBUGFS_ADD_DIR(name, parent) do { \
|
||||
dbgfs->dir_##name = debugfs_create_dir(#name, parent); \
|
||||
if (!(dbgfs->dir_##name)) \
|
||||
goto err; \
|
||||
} while (0)
|
||||
|
||||
#define DEBUGFS_ADD_FILE(name, parent) do { \
|
||||
dbgfs->dbgfs_##parent##_files.file_##name = \
|
||||
debugfs_create_file(#name, 0644, dbgfs->dir_##parent, priv, \
|
||||
&iwl_dbgfs_##name##_ops); \
|
||||
if (!(dbgfs->dbgfs_##parent##_files.file_##name)) \
|
||||
goto err; \
|
||||
} while (0)
|
||||
|
||||
#define DEBUGFS_REMOVE(name) do { \
|
||||
debugfs_remove(name); \
|
||||
name = NULL; \
|
||||
} while (0);
|
||||
|
||||
/* file operation */
|
||||
#define DEBUGFS_READ_FUNC(name) \
|
||||
static ssize_t iwl_dbgfs_##name##_read(struct file *file, \
|
||||
char __user *user_buf, \
|
||||
size_t count, loff_t *ppos);
|
||||
|
||||
#define DEBUGFS_WRITE_FUNC(name) \
|
||||
static ssize_t iwl_dbgfs_##name##_write(struct file *file, \
|
||||
const char __user *user_buf, \
|
||||
size_t count, loff_t *ppos);
|
||||
|
||||
|
||||
static int iwl_dbgfs_open_file_generic(struct inode *inode, struct file *file)
|
||||
{
|
||||
file->private_data = inode->i_private;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define DEBUGFS_READ_FILE_OPS(name) \
|
||||
DEBUGFS_READ_FUNC(name); \
|
||||
static const struct file_operations iwl_dbgfs_##name##_ops = { \
|
||||
.read = iwl_dbgfs_##name##_read, \
|
||||
.open = iwl_dbgfs_open_file_generic, \
|
||||
};
|
||||
|
||||
#define DEBUGFS_READ_WRITE_FILE_OPS(name) \
|
||||
DEBUGFS_READ_FUNC(name); \
|
||||
DEBUGFS_WRITE_FUNC(name); \
|
||||
static const struct file_operations iwl_dbgfs_##name##_ops = { \
|
||||
.write = iwl_dbgfs_##name##_write, \
|
||||
.read = iwl_dbgfs_##name##_read, \
|
||||
.open = iwl_dbgfs_open_file_generic, \
|
||||
};
|
||||
|
||||
|
||||
static ssize_t iwl_dbgfs_tx_statistics_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos) {
|
||||
|
||||
struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
|
||||
char buf[256];
|
||||
int pos = 0;
|
||||
|
||||
pos += sprintf(buf+pos, "mgmt: %u\n", priv->tx_stats[0].cnt);
|
||||
pos += sprintf(buf+pos, "ctrl: %u\n", priv->tx_stats[1].cnt);
|
||||
pos += sprintf(buf+pos, "data: %u\n", priv->tx_stats[2].cnt);
|
||||
|
||||
return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
||||
}
|
||||
|
||||
static ssize_t iwl_dbgfs_rx_statistics_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos) {
|
||||
|
||||
struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
|
||||
char buf[256];
|
||||
int pos = 0;
|
||||
|
||||
pos += sprintf(buf+pos, "mgmt: %u\n", priv->rx_stats[0].cnt);
|
||||
pos += sprintf(buf+pos, "ctrl: %u\n", priv->rx_stats[1].cnt);
|
||||
pos += sprintf(buf+pos, "data: %u\n", priv->rx_stats[2].cnt);
|
||||
|
||||
return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
||||
}
|
||||
|
||||
#define BYTE1_MASK 0x000000ff;
|
||||
#define BYTE2_MASK 0x0000ffff;
|
||||
#define BYTE3_MASK 0x00ffffff;
|
||||
static ssize_t iwl_dbgfs_sram_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
u32 val;
|
||||
char buf[1024];
|
||||
ssize_t ret;
|
||||
int i;
|
||||
int pos = 0;
|
||||
struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
|
||||
|
||||
printk(KERN_DEBUG "offset is: 0x%x\tlen is: 0x%x\n",
|
||||
priv->dbgfs->sram_offset, priv->dbgfs->sram_len);
|
||||
|
||||
iwl4965_grab_nic_access(priv);
|
||||
for (i = priv->dbgfs->sram_len; i > 0; i -= 4) {
|
||||
val = iwl4965_read_targ_mem(priv, priv->dbgfs->sram_offset + \
|
||||
priv->dbgfs->sram_len - i);
|
||||
if (i < 4) {
|
||||
switch (i) {
|
||||
case 1:
|
||||
val &= BYTE1_MASK;
|
||||
break;
|
||||
case 2:
|
||||
val &= BYTE2_MASK;
|
||||
break;
|
||||
case 3:
|
||||
val &= BYTE3_MASK;
|
||||
break;
|
||||
}
|
||||
}
|
||||
pos += sprintf(buf+pos, "0x%08x ", val);
|
||||
}
|
||||
pos += sprintf(buf+pos, "\n");
|
||||
iwl4965_release_nic_access(priv);
|
||||
|
||||
ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t iwl_dbgfs_sram_write(struct file *file,
|
||||
const char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct iwl_priv *priv = file->private_data;
|
||||
char buf[64];
|
||||
int buf_size;
|
||||
u32 offset, len;
|
||||
|
||||
memset(buf, 0, sizeof(buf));
|
||||
buf_size = min(count, sizeof(buf) - 1);
|
||||
if (copy_from_user(buf, user_buf, buf_size))
|
||||
return -EFAULT;
|
||||
|
||||
if (sscanf(buf, "%x,%x", &offset, &len) == 2) {
|
||||
priv->dbgfs->sram_offset = offset;
|
||||
priv->dbgfs->sram_len = len;
|
||||
} else {
|
||||
priv->dbgfs->sram_offset = 0;
|
||||
priv->dbgfs->sram_len = 0;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
|
||||
struct iwl4965_station_entry *station;
|
||||
int max_sta = priv->hw_setting.max_stations;
|
||||
char *buf;
|
||||
int i, j, pos = 0;
|
||||
ssize_t ret;
|
||||
/* Add 30 for initial string */
|
||||
const size_t bufsz = 30 + sizeof(char) * 500 * (priv->num_stations);
|
||||
DECLARE_MAC_BUF(mac);
|
||||
|
||||
buf = kmalloc(bufsz, GFP_KERNEL);
|
||||
if(!buf)
|
||||
return -ENOMEM;
|
||||
|
||||
pos += sprintf(buf+pos, "num of stations: %d\n\n",
|
||||
priv->num_stations);
|
||||
|
||||
for (i = 0; i < max_sta; i++) {
|
||||
station = &priv->stations[i];
|
||||
if (station->used) {
|
||||
pos += sprintf(buf+pos, "station %d:\ngeneral data:\n",
|
||||
i+1);
|
||||
print_mac(mac, station->sta.sta.addr);
|
||||
pos += sprintf(buf+pos, "id: %u\n",
|
||||
station->sta.sta.sta_id);
|
||||
pos += sprintf(buf+pos, "mode: %u\n",
|
||||
station->sta.mode);
|
||||
pos += sprintf(buf+pos, "flags: 0x%x\n",
|
||||
station->sta.station_flags_msk);
|
||||
pos += sprintf(buf+pos, "ps_status: %u\n",
|
||||
station->ps_status);
|
||||
|
||||
pos += sprintf(buf+pos, "tid data:\n");
|
||||
|
||||
pos += sprintf(buf+pos, "seq_num\t\ttxq_id\t");
|
||||
pos += sprintf(buf+pos, "frame_count\twait_for_ba\t");
|
||||
pos += sprintf(buf+pos, "start_idx\tbitmap0\t");
|
||||
pos += sprintf(buf+pos, "bitmap1\trate_n_flags\n");
|
||||
|
||||
for (j = 0; j < MAX_TID_COUNT; j++) {
|
||||
pos += sprintf(buf+pos, "[%d]:\t\t%u\t",
|
||||
j, station->tid[j].seq_number);
|
||||
pos += sprintf(buf+pos, "%u\t\t%u\t\t%u\t\t",
|
||||
station->tid[j].agg.txq_id,
|
||||
station->tid[j].agg.frame_count,
|
||||
station->tid[j].agg.wait_for_ba);
|
||||
pos += sprintf(buf+pos, "%u\t%llu\t%u\n",
|
||||
station->tid[j].agg.start_idx,
|
||||
station->tid[j].agg.bitmap,
|
||||
station->tid[j].agg.rate_n_flags);
|
||||
}
|
||||
pos += sprintf(buf+pos, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
|
||||
kfree(buf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
DEBUGFS_READ_WRITE_FILE_OPS(sram);
|
||||
DEBUGFS_READ_FILE_OPS(stations);
|
||||
DEBUGFS_READ_FILE_OPS(rx_statistics);
|
||||
DEBUGFS_READ_FILE_OPS(tx_statistics);
|
||||
|
||||
/*
|
||||
* Create the debugfs files and directories
|
||||
*
|
||||
*/
|
||||
int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
|
||||
{
|
||||
struct iwl_debugfs *dbgfs;
|
||||
|
||||
dbgfs = kzalloc(sizeof(struct iwl_debugfs), GFP_KERNEL);
|
||||
if (!dbgfs) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
priv->dbgfs = dbgfs;
|
||||
dbgfs->name = name;
|
||||
dbgfs->dir_drv = debugfs_create_dir(name, NULL);
|
||||
if (!dbgfs->dir_drv || IS_ERR(dbgfs->dir_drv)){
|
||||
goto err;
|
||||
}
|
||||
|
||||
DEBUGFS_ADD_DIR(data, dbgfs->dir_drv);
|
||||
DEBUGFS_ADD_FILE(sram, data);
|
||||
DEBUGFS_ADD_FILE(stations, data);
|
||||
DEBUGFS_ADD_FILE(rx_statistics, data);
|
||||
DEBUGFS_ADD_FILE(tx_statistics, data);
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
IWL_ERROR("Can't open the debugfs directory\n");
|
||||
iwl_dbgfs_unregister(priv);
|
||||
return -ENOENT;
|
||||
}
|
||||
EXPORT_SYMBOL(iwl_dbgfs_register);
|
||||
|
||||
/**
|
||||
* Remove the debugfs files and directories
|
||||
*
|
||||
*/
|
||||
void iwl_dbgfs_unregister(struct iwl_priv *priv)
|
||||
{
|
||||
if (!(priv->dbgfs))
|
||||
return;
|
||||
|
||||
DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_rx_statistics);
|
||||
DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_tx_statistics);
|
||||
DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_sram);
|
||||
DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_stations);
|
||||
DEBUGFS_REMOVE(priv->dbgfs->dir_data);
|
||||
DEBUGFS_REMOVE(priv->dbgfs->dir_drv);
|
||||
kfree(priv->dbgfs);
|
||||
priv->dbgfs = NULL;
|
||||
}
|
||||
EXPORT_SYMBOL(iwl_dbgfs_unregister);
|
||||
|
||||
|
|
@ -71,17 +71,78 @@
|
|||
#include "iwl-4965-commands.h"
|
||||
#include "iwl-4965.h"
|
||||
#include "iwl-core.h"
|
||||
#include "iwl-4965-debug.h"
|
||||
#include "iwl-debug.h"
|
||||
#include "iwl-eeprom.h"
|
||||
#include "iwl-4965-io.h"
|
||||
|
||||
/************************** EEPROM BANDS ****************************
|
||||
*
|
||||
* The iwl_eeprom_band definitions below provide the mapping from the
|
||||
* EEPROM contents to the specific channel number supported for each
|
||||
* band.
|
||||
*
|
||||
* For example, iwl_priv->eeprom.band_3_channels[4] from the band_3
|
||||
* definition below maps to physical channel 42 in the 5.2GHz spectrum.
|
||||
* The specific geography and calibration information for that channel
|
||||
* is contained in the eeprom map itself.
|
||||
*
|
||||
* During init, we copy the eeprom information and channel map
|
||||
* information into priv->channel_info_24/52 and priv->channel_map_24/52
|
||||
*
|
||||
* channel_map_24/52 provides the index in the channel_info array for a
|
||||
* given channel. We have to have two separate maps as there is channel
|
||||
* overlap with the 2.4GHz and 5.2GHz spectrum as seen in band_1 and
|
||||
* band_2
|
||||
*
|
||||
* A value of 0xff stored in the channel_map indicates that the channel
|
||||
* is not supported by the hardware at all.
|
||||
*
|
||||
* A value of 0xfe in the channel_map indicates that the channel is not
|
||||
* valid for Tx with the current hardware. This means that
|
||||
* while the system can tune and receive on a given channel, it may not
|
||||
* be able to associate or transmit any frames on that
|
||||
* channel. There is no corresponding channel information for that
|
||||
* entry.
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
/* 2.4 GHz */
|
||||
const u8 iwl_eeprom_band_1[14] = {
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
|
||||
};
|
||||
|
||||
/* 5.2 GHz bands */
|
||||
static const u8 iwl_eeprom_band_2[] = { /* 4915-5080MHz */
|
||||
183, 184, 185, 187, 188, 189, 192, 196, 7, 8, 11, 12, 16
|
||||
};
|
||||
|
||||
static const u8 iwl_eeprom_band_3[] = { /* 5170-5320MHz */
|
||||
34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64
|
||||
};
|
||||
|
||||
static const u8 iwl_eeprom_band_4[] = { /* 5500-5700MHz */
|
||||
100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140
|
||||
};
|
||||
|
||||
static const u8 iwl_eeprom_band_5[] = { /* 5725-5825MHz */
|
||||
145, 149, 153, 157, 161, 165
|
||||
};
|
||||
|
||||
static const u8 iwl_eeprom_band_6[] = { /* 2.4 FAT channel */
|
||||
1, 2, 3, 4, 5, 6, 7
|
||||
};
|
||||
|
||||
static const u8 iwl_eeprom_band_7[] = { /* 5.2 FAT channel */
|
||||
36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* EEPROM related functions
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
int iwlcore_eeprom_verify_signature(struct iwl4965_priv *priv)
|
||||
int iwlcore_eeprom_verify_signature(struct iwl_priv *priv)
|
||||
{
|
||||
u32 gp = iwl4965_read32(priv, CSR_EEPROM_GP);
|
||||
if ((gp & CSR_EEPROM_GP_VALID_MSK) == CSR_EEPROM_GP_BAD_SIGNATURE) {
|
||||
|
@ -98,7 +159,7 @@ EXPORT_SYMBOL(iwlcore_eeprom_verify_signature);
|
|||
* EEPROM chip, not a single event, so even reads could conflict if they
|
||||
* weren't arbitrated by the semaphore.
|
||||
*/
|
||||
int iwlcore_eeprom_acquire_semaphore(struct iwl4965_priv *priv)
|
||||
int iwlcore_eeprom_acquire_semaphore(struct iwl_priv *priv)
|
||||
{
|
||||
u16 count;
|
||||
int ret;
|
||||
|
@ -124,7 +185,7 @@ int iwlcore_eeprom_acquire_semaphore(struct iwl4965_priv *priv)
|
|||
}
|
||||
EXPORT_SYMBOL(iwlcore_eeprom_acquire_semaphore);
|
||||
|
||||
void iwlcore_eeprom_release_semaphore(struct iwl4965_priv *priv)
|
||||
void iwlcore_eeprom_release_semaphore(struct iwl_priv *priv)
|
||||
{
|
||||
iwl4965_clear_bit(priv, CSR_HW_IF_CONFIG_REG,
|
||||
CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM);
|
||||
|
@ -140,7 +201,7 @@ EXPORT_SYMBOL(iwlcore_eeprom_release_semaphore);
|
|||
*
|
||||
* NOTE: This routine uses the non-debug IO access functions.
|
||||
*/
|
||||
int iwl_eeprom_init(struct iwl4965_priv *priv)
|
||||
int iwl_eeprom_init(struct iwl_priv *priv)
|
||||
{
|
||||
u16 *e = (u16 *)&priv->eeprom;
|
||||
u32 gp = iwl4965_read32(priv, CSR_EEPROM_GP);
|
||||
|
@ -197,9 +258,304 @@ done:
|
|||
EXPORT_SYMBOL(iwl_eeprom_init);
|
||||
|
||||
|
||||
void iwl_eeprom_get_mac(const struct iwl4965_priv *priv, u8 *mac)
|
||||
void iwl_eeprom_get_mac(const struct iwl_priv *priv, u8 *mac)
|
||||
{
|
||||
memcpy(mac, priv->eeprom.mac_address, 6);
|
||||
}
|
||||
EXPORT_SYMBOL(iwl_eeprom_get_mac);
|
||||
|
||||
static void iwl_init_band_reference(const struct iwl_priv *priv,
|
||||
int band,
|
||||
int *eeprom_ch_count,
|
||||
const struct iwl4965_eeprom_channel
|
||||
**eeprom_ch_info,
|
||||
const u8 **eeprom_ch_index)
|
||||
{
|
||||
switch (band) {
|
||||
case 1: /* 2.4GHz band */
|
||||
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_1);
|
||||
*eeprom_ch_info = priv->eeprom.band_1_channels;
|
||||
*eeprom_ch_index = iwl_eeprom_band_1;
|
||||
break;
|
||||
case 2: /* 4.9GHz band */
|
||||
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_2);
|
||||
*eeprom_ch_info = priv->eeprom.band_2_channels;
|
||||
*eeprom_ch_index = iwl_eeprom_band_2;
|
||||
break;
|
||||
case 3: /* 5.2GHz band */
|
||||
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_3);
|
||||
*eeprom_ch_info = priv->eeprom.band_3_channels;
|
||||
*eeprom_ch_index = iwl_eeprom_band_3;
|
||||
break;
|
||||
case 4: /* 5.5GHz band */
|
||||
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_4);
|
||||
*eeprom_ch_info = priv->eeprom.band_4_channels;
|
||||
*eeprom_ch_index = iwl_eeprom_band_4;
|
||||
break;
|
||||
case 5: /* 5.7GHz band */
|
||||
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_5);
|
||||
*eeprom_ch_info = priv->eeprom.band_5_channels;
|
||||
*eeprom_ch_index = iwl_eeprom_band_5;
|
||||
break;
|
||||
case 6: /* 2.4GHz FAT channels */
|
||||
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_6);
|
||||
*eeprom_ch_info = priv->eeprom.band_24_channels;
|
||||
*eeprom_ch_index = iwl_eeprom_band_6;
|
||||
break;
|
||||
case 7: /* 5 GHz FAT channels */
|
||||
*eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_7);
|
||||
*eeprom_ch_info = priv->eeprom.band_52_channels;
|
||||
*eeprom_ch_index = iwl_eeprom_band_7;
|
||||
break;
|
||||
default:
|
||||
BUG();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#define CHECK_AND_PRINT(x) ((eeprom_ch->flags & EEPROM_CHANNEL_##x) \
|
||||
? # x " " : "")
|
||||
|
||||
/**
|
||||
* iwl4965_set_fat_chan_info - Copy fat channel info into driver's priv.
|
||||
*
|
||||
* Does not set up a command, or touch hardware.
|
||||
*/
|
||||
static int iwl4965_set_fat_chan_info(struct iwl_priv *priv,
|
||||
enum ieee80211_band band, u16 channel,
|
||||
const struct iwl4965_eeprom_channel *eeprom_ch,
|
||||
u8 fat_extension_channel)
|
||||
{
|
||||
struct iwl_channel_info *ch_info;
|
||||
|
||||
ch_info = (struct iwl_channel_info *)
|
||||
iwl_get_channel_info(priv, band, channel);
|
||||
|
||||
if (!is_channel_valid(ch_info))
|
||||
return -1;
|
||||
|
||||
IWL_DEBUG_INFO("FAT Ch. %d [%sGHz] %s%s%s%s%s%s(0x%02x"
|
||||
" %ddBm): Ad-Hoc %ssupported\n",
|
||||
ch_info->channel,
|
||||
is_channel_a_band(ch_info) ?
|
||||
"5.2" : "2.4",
|
||||
CHECK_AND_PRINT(IBSS),
|
||||
CHECK_AND_PRINT(ACTIVE),
|
||||
CHECK_AND_PRINT(RADAR),
|
||||
CHECK_AND_PRINT(WIDE),
|
||||
CHECK_AND_PRINT(NARROW),
|
||||
CHECK_AND_PRINT(DFS),
|
||||
eeprom_ch->flags,
|
||||
eeprom_ch->max_power_avg,
|
||||
((eeprom_ch->flags & EEPROM_CHANNEL_IBSS)
|
||||
&& !(eeprom_ch->flags & EEPROM_CHANNEL_RADAR)) ?
|
||||
"" : "not ");
|
||||
|
||||
ch_info->fat_eeprom = *eeprom_ch;
|
||||
ch_info->fat_max_power_avg = eeprom_ch->max_power_avg;
|
||||
ch_info->fat_curr_txpow = eeprom_ch->max_power_avg;
|
||||
ch_info->fat_min_power = 0;
|
||||
ch_info->fat_scan_power = eeprom_ch->max_power_avg;
|
||||
ch_info->fat_flags = eeprom_ch->flags;
|
||||
ch_info->fat_extension_channel = fat_extension_channel;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define CHECK_AND_PRINT_I(x) ((eeprom_ch_info[ch].flags & EEPROM_CHANNEL_##x) \
|
||||
? # x " " : "")
|
||||
|
||||
/**
|
||||
* iwl_init_channel_map - Set up driver's info for all possible channels
|
||||
*/
|
||||
int iwl_init_channel_map(struct iwl_priv *priv)
|
||||
{
|
||||
int eeprom_ch_count = 0;
|
||||
const u8 *eeprom_ch_index = NULL;
|
||||
const struct iwl4965_eeprom_channel *eeprom_ch_info = NULL;
|
||||
int band, ch;
|
||||
struct iwl_channel_info *ch_info;
|
||||
|
||||
if (priv->channel_count) {
|
||||
IWL_DEBUG_INFO("Channel map already initialized.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (priv->eeprom.version < 0x2f) {
|
||||
IWL_WARNING("Unsupported EEPROM version: 0x%04X\n",
|
||||
priv->eeprom.version);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
IWL_DEBUG_INFO("Initializing regulatory info from EEPROM\n");
|
||||
|
||||
priv->channel_count =
|
||||
ARRAY_SIZE(iwl_eeprom_band_1) +
|
||||
ARRAY_SIZE(iwl_eeprom_band_2) +
|
||||
ARRAY_SIZE(iwl_eeprom_band_3) +
|
||||
ARRAY_SIZE(iwl_eeprom_band_4) +
|
||||
ARRAY_SIZE(iwl_eeprom_band_5);
|
||||
|
||||
IWL_DEBUG_INFO("Parsing data for %d channels.\n", priv->channel_count);
|
||||
|
||||
priv->channel_info = kzalloc(sizeof(struct iwl_channel_info) *
|
||||
priv->channel_count, GFP_KERNEL);
|
||||
if (!priv->channel_info) {
|
||||
IWL_ERROR("Could not allocate channel_info\n");
|
||||
priv->channel_count = 0;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
ch_info = priv->channel_info;
|
||||
|
||||
/* Loop through the 5 EEPROM bands adding them in order to the
|
||||
* channel map we maintain (that contains additional information than
|
||||
* what just in the EEPROM) */
|
||||
for (band = 1; band <= 5; band++) {
|
||||
|
||||
iwl_init_band_reference(priv, band, &eeprom_ch_count,
|
||||
&eeprom_ch_info, &eeprom_ch_index);
|
||||
|
||||
/* Loop through each band adding each of the channels */
|
||||
for (ch = 0; ch < eeprom_ch_count; ch++) {
|
||||
ch_info->channel = eeprom_ch_index[ch];
|
||||
ch_info->band = (band == 1) ? IEEE80211_BAND_2GHZ :
|
||||
IEEE80211_BAND_5GHZ;
|
||||
|
||||
/* permanently store EEPROM's channel regulatory flags
|
||||
* and max power in channel info database. */
|
||||
ch_info->eeprom = eeprom_ch_info[ch];
|
||||
|
||||
/* Copy the run-time flags so they are there even on
|
||||
* invalid channels */
|
||||
ch_info->flags = eeprom_ch_info[ch].flags;
|
||||
|
||||
if (!(is_channel_valid(ch_info))) {
|
||||
IWL_DEBUG_INFO("Ch. %d Flags %x [%sGHz] - "
|
||||
"No traffic\n",
|
||||
ch_info->channel,
|
||||
ch_info->flags,
|
||||
is_channel_a_band(ch_info) ?
|
||||
"5.2" : "2.4");
|
||||
ch_info++;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Initialize regulatory-based run-time data */
|
||||
ch_info->max_power_avg = ch_info->curr_txpow =
|
||||
eeprom_ch_info[ch].max_power_avg;
|
||||
ch_info->scan_power = eeprom_ch_info[ch].max_power_avg;
|
||||
ch_info->min_power = 0;
|
||||
|
||||
IWL_DEBUG_INFO("Ch. %d [%sGHz] %s%s%s%s%s%s%s(0x%02x"
|
||||
" %ddBm): Ad-Hoc %ssupported\n",
|
||||
ch_info->channel,
|
||||
is_channel_a_band(ch_info) ?
|
||||
"5.2" : "2.4",
|
||||
CHECK_AND_PRINT_I(VALID),
|
||||
CHECK_AND_PRINT_I(IBSS),
|
||||
CHECK_AND_PRINT_I(ACTIVE),
|
||||
CHECK_AND_PRINT_I(RADAR),
|
||||
CHECK_AND_PRINT_I(WIDE),
|
||||
CHECK_AND_PRINT_I(NARROW),
|
||||
CHECK_AND_PRINT_I(DFS),
|
||||
eeprom_ch_info[ch].flags,
|
||||
eeprom_ch_info[ch].max_power_avg,
|
||||
((eeprom_ch_info[ch].
|
||||
flags & EEPROM_CHANNEL_IBSS)
|
||||
&& !(eeprom_ch_info[ch].
|
||||
flags & EEPROM_CHANNEL_RADAR))
|
||||
? "" : "not ");
|
||||
|
||||
/* Set the user_txpower_limit to the highest power
|
||||
* supported by any channel */
|
||||
if (eeprom_ch_info[ch].max_power_avg >
|
||||
priv->user_txpower_limit)
|
||||
priv->user_txpower_limit =
|
||||
eeprom_ch_info[ch].max_power_avg;
|
||||
|
||||
ch_info++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Two additional EEPROM bands for 2.4 and 5 GHz FAT channels */
|
||||
for (band = 6; band <= 7; band++) {
|
||||
enum ieee80211_band ieeeband;
|
||||
u8 fat_extension_chan;
|
||||
|
||||
iwl_init_band_reference(priv, band, &eeprom_ch_count,
|
||||
&eeprom_ch_info, &eeprom_ch_index);
|
||||
|
||||
/* EEPROM band 6 is 2.4, band 7 is 5 GHz */
|
||||
ieeeband =
|
||||
(band == 6) ? IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
|
||||
|
||||
/* Loop through each band adding each of the channels */
|
||||
for (ch = 0; ch < eeprom_ch_count; ch++) {
|
||||
|
||||
if ((band == 6) &&
|
||||
((eeprom_ch_index[ch] == 5) ||
|
||||
(eeprom_ch_index[ch] == 6) ||
|
||||
(eeprom_ch_index[ch] == 7)))
|
||||
fat_extension_chan = HT_IE_EXT_CHANNEL_MAX;
|
||||
else
|
||||
fat_extension_chan = HT_IE_EXT_CHANNEL_ABOVE;
|
||||
|
||||
/* Set up driver's info for lower half */
|
||||
iwl4965_set_fat_chan_info(priv, ieeeband,
|
||||
eeprom_ch_index[ch],
|
||||
&(eeprom_ch_info[ch]),
|
||||
fat_extension_chan);
|
||||
|
||||
/* Set up driver's info for upper half */
|
||||
iwl4965_set_fat_chan_info(priv, ieeeband,
|
||||
(eeprom_ch_index[ch] + 4),
|
||||
&(eeprom_ch_info[ch]),
|
||||
HT_IE_EXT_CHANNEL_BELOW);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(iwl_init_channel_map);
|
||||
|
||||
/*
|
||||
* iwl_free_channel_map - undo allocations in iwl4965_init_channel_map
|
||||
*/
|
||||
void iwl_free_channel_map(struct iwl_priv *priv)
|
||||
{
|
||||
kfree(priv->channel_info);
|
||||
priv->channel_count = 0;
|
||||
}
|
||||
EXPORT_SYMBOL(iwl_free_channel_map);
|
||||
|
||||
/**
|
||||
* iwl_get_channel_info - Find driver's private channel info
|
||||
*
|
||||
* Based on band and channel number.
|
||||
*/
|
||||
const struct iwl_channel_info *iwl_get_channel_info(
|
||||
const struct iwl_priv *priv,
|
||||
enum ieee80211_band band, u16 channel)
|
||||
{
|
||||
int i;
|
||||
|
||||
switch (band) {
|
||||
case IEEE80211_BAND_5GHZ:
|
||||
for (i = 14; i < priv->channel_count; i++) {
|
||||
if (priv->channel_info[i].channel == channel)
|
||||
return &priv->channel_info[i];
|
||||
}
|
||||
break;
|
||||
case IEEE80211_BAND_2GHZ:
|
||||
if (channel >= 1 && channel <= 14)
|
||||
return &priv->channel_info[channel - 1];
|
||||
break;
|
||||
default:
|
||||
BUG();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL(iwl_get_channel_info);
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
#ifndef __iwl_eeprom_h__
|
||||
#define __iwl_eeprom_h__
|
||||
|
||||
struct iwl4965_priv;
|
||||
struct iwl_priv;
|
||||
|
||||
/*
|
||||
* EEPROM access time values:
|
||||
|
@ -137,6 +137,8 @@ struct iwl4965_eeprom_channel {
|
|||
* Look for this in calib_version member of struct iwl4965_eeprom. */
|
||||
#define EEPROM_TX_POWER_VERSION_NEW (5)
|
||||
|
||||
/* 2.4 GHz */
|
||||
extern const u8 iwl_eeprom_band_1[14];
|
||||
|
||||
/*
|
||||
* 4965 factory calibration data for one txpower level, on one channel,
|
||||
|
@ -228,49 +230,31 @@ struct iwl4965_eeprom_calib_info {
|
|||
*/
|
||||
struct iwl4965_eeprom {
|
||||
u8 reserved0[16];
|
||||
#define EEPROM_DEVICE_ID (2*0x08) /* 2 bytes */
|
||||
u16 device_id; /* abs.ofs: 16 */
|
||||
u8 reserved1[2];
|
||||
#define EEPROM_PMC (2*0x0A) /* 2 bytes */
|
||||
u16 pmc; /* abs.ofs: 20 */
|
||||
u8 reserved2[20];
|
||||
#define EEPROM_MAC_ADDRESS (2*0x15) /* 6 bytes */
|
||||
u8 mac_address[6]; /* abs.ofs: 42 */
|
||||
u8 reserved3[58];
|
||||
#define EEPROM_BOARD_REVISION (2*0x35) /* 2 bytes */
|
||||
u16 board_revision; /* abs.ofs: 106 */
|
||||
u8 reserved4[11];
|
||||
#define EEPROM_BOARD_PBA_NUMBER (2*0x3B+1) /* 9 bytes */
|
||||
u8 board_pba_number[9]; /* abs.ofs: 119 */
|
||||
u8 reserved5[8];
|
||||
#define EEPROM_VERSION (2*0x44) /* 2 bytes */
|
||||
u16 version; /* abs.ofs: 136 */
|
||||
#define EEPROM_SKU_CAP (2*0x45) /* 1 bytes */
|
||||
u8 sku_cap; /* abs.ofs: 138 */
|
||||
#define EEPROM_LEDS_MODE (2*0x45+1) /* 1 bytes */
|
||||
u8 leds_mode; /* abs.ofs: 139 */
|
||||
#define EEPROM_OEM_MODE (2*0x46) /* 2 bytes */
|
||||
u16 oem_mode;
|
||||
#define EEPROM_WOWLAN_MODE (2*0x47) /* 2 bytes */
|
||||
u16 wowlan_mode; /* abs.ofs: 142 */
|
||||
#define EEPROM_LEDS_TIME_INTERVAL (2*0x48) /* 2 bytes */
|
||||
u16 leds_time_interval; /* abs.ofs: 144 */
|
||||
#define EEPROM_LEDS_OFF_TIME (2*0x49) /* 1 bytes */
|
||||
u8 leds_off_time; /* abs.ofs: 146 */
|
||||
#define EEPROM_LEDS_ON_TIME (2*0x49+1) /* 1 bytes */
|
||||
u8 leds_on_time; /* abs.ofs: 147 */
|
||||
#define EEPROM_ALMGOR_M_VERSION (2*0x4A) /* 1 bytes */
|
||||
u8 almgor_m_version; /* abs.ofs: 148 */
|
||||
#define EEPROM_ANTENNA_SWITCH_TYPE (2*0x4A+1) /* 1 bytes */
|
||||
u8 antenna_switch_type; /* abs.ofs: 149 */
|
||||
u8 reserved6[8];
|
||||
#define EEPROM_4965_BOARD_REVISION (2*0x4F) /* 2 bytes */
|
||||
u16 board_revision_4965; /* abs.ofs: 158 */
|
||||
u8 reserved7[13];
|
||||
#define EEPROM_4965_BOARD_PBA (2*0x56+1) /* 9 bytes */
|
||||
u8 board_pba_number_4965[9]; /* abs.ofs: 173 */
|
||||
u8 reserved8[10];
|
||||
#define EEPROM_REGULATORY_SKU_ID (2*0x60) /* 4 bytes */
|
||||
u8 sku_id[4]; /* abs.ofs: 192 */
|
||||
|
||||
/*
|
||||
|
@ -285,9 +269,7 @@ struct iwl4965_eeprom {
|
|||
*
|
||||
* 2.4 GHz channels 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
|
||||
*/
|
||||
#define EEPROM_REGULATORY_BAND_1 (2*0x62) /* 2 bytes */
|
||||
u16 band_1_count; /* abs.ofs: 196 */
|
||||
#define EEPROM_REGULATORY_BAND_1_CHANNELS (2*0x63) /* 28 bytes */
|
||||
struct iwl4965_eeprom_channel band_1_channels[14]; /* abs.ofs: 196 */
|
||||
|
||||
/*
|
||||
|
@ -295,36 +277,28 @@ struct iwl4965_eeprom {
|
|||
* 5.0 GHz channels 7, 8, 11, 12, 16
|
||||
* (4915-5080MHz) (none of these is ever supported)
|
||||
*/
|
||||
#define EEPROM_REGULATORY_BAND_2 (2*0x71) /* 2 bytes */
|
||||
u16 band_2_count; /* abs.ofs: 226 */
|
||||
#define EEPROM_REGULATORY_BAND_2_CHANNELS (2*0x72) /* 26 bytes */
|
||||
struct iwl4965_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */
|
||||
|
||||
/*
|
||||
* 5.2 GHz channels 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64
|
||||
* (5170-5320MHz)
|
||||
*/
|
||||
#define EEPROM_REGULATORY_BAND_3 (2*0x7F) /* 2 bytes */
|
||||
u16 band_3_count; /* abs.ofs: 254 */
|
||||
#define EEPROM_REGULATORY_BAND_3_CHANNELS (2*0x80) /* 24 bytes */
|
||||
struct iwl4965_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */
|
||||
|
||||
/*
|
||||
* 5.5 GHz channels 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140
|
||||
* (5500-5700MHz)
|
||||
*/
|
||||
#define EEPROM_REGULATORY_BAND_4 (2*0x8C) /* 2 bytes */
|
||||
u16 band_4_count; /* abs.ofs: 280 */
|
||||
#define EEPROM_REGULATORY_BAND_4_CHANNELS (2*0x8D) /* 22 bytes */
|
||||
struct iwl4965_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */
|
||||
|
||||
/*
|
||||
* 5.7 GHz channels 145, 149, 153, 157, 161, 165
|
||||
* (5725-5825MHz)
|
||||
*/
|
||||
#define EEPROM_REGULATORY_BAND_5 (2*0x98) /* 2 bytes */
|
||||
u16 band_5_count; /* abs.ofs: 304 */
|
||||
#define EEPROM_REGULATORY_BAND_5_CHANNELS (2*0x99) /* 12 bytes */
|
||||
struct iwl4965_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */
|
||||
|
||||
u8 reserved10[2];
|
||||
|
@ -345,7 +319,6 @@ struct iwl4965_eeprom {
|
|||
*
|
||||
* NOTE: 4965 does not support FAT channels on 2.4 GHz.
|
||||
*/
|
||||
#define EEPROM_REGULATORY_BAND_24_FAT_CHANNELS (2*0xA0) /* 14 bytes */
|
||||
struct iwl4965_eeprom_channel band_24_channels[7]; /* abs.ofs: 320 */
|
||||
u8 reserved11[2];
|
||||
|
||||
|
@ -353,7 +326,6 @@ struct iwl4965_eeprom {
|
|||
* 5.2 GHz FAT channels 36 (40), 44 (48), 52 (56), 60 (64),
|
||||
* 100 (104), 108 (112), 116 (120), 124 (128), 132 (136), 149 (153), 157 (161)
|
||||
*/
|
||||
#define EEPROM_REGULATORY_BAND_52_FAT_CHANNELS (2*0xA8) /* 22 bytes */
|
||||
struct iwl4965_eeprom_channel band_52_channels[11]; /* abs.ofs: 336 */
|
||||
u8 reserved12[6];
|
||||
|
||||
|
@ -362,7 +334,6 @@ struct iwl4965_eeprom {
|
|||
* Driver does not work with txpower calibration version < 5.
|
||||
* This value is simply a 16-bit number, no major/minor versions here.
|
||||
*/
|
||||
#define EEPROM_CALIB_VERSION_OFFSET (2*0xB6) /* 2 bytes */
|
||||
u16 calib_version; /* abs.ofs: 364 */
|
||||
u8 reserved13[2];
|
||||
u8 reserved14[96]; /* abs.ofs: 368 */
|
||||
|
@ -370,7 +341,6 @@ struct iwl4965_eeprom {
|
|||
/*
|
||||
* 4965 Txpower calibration data.
|
||||
*/
|
||||
#define EEPROM_IWL_CALIB_TXPOWER_OFFSET (2*0xE8) /* 48 bytes */
|
||||
struct iwl4965_eeprom_calib_info calib_info; /* abs.ofs: 464 */
|
||||
|
||||
u8 reserved16[140]; /* fill out to full 1024 byte block */
|
||||
|
@ -383,17 +353,23 @@ struct iwl4965_eeprom {
|
|||
/* End of EEPROM */
|
||||
|
||||
struct iwl_eeprom_ops {
|
||||
int (*verify_signature) (struct iwl4965_priv *priv);
|
||||
int (*acquire_semaphore) (struct iwl4965_priv *priv);
|
||||
void (*release_semaphore) (struct iwl4965_priv *priv);
|
||||
int (*verify_signature) (struct iwl_priv *priv);
|
||||
int (*acquire_semaphore) (struct iwl_priv *priv);
|
||||
void (*release_semaphore) (struct iwl_priv *priv);
|
||||
};
|
||||
|
||||
|
||||
void iwl_eeprom_get_mac(const struct iwl4965_priv *priv, u8 *mac);
|
||||
int iwl_eeprom_init(struct iwl4965_priv *priv);
|
||||
void iwl_eeprom_get_mac(const struct iwl_priv *priv, u8 *mac);
|
||||
int iwl_eeprom_init(struct iwl_priv *priv);
|
||||
|
||||
int iwlcore_eeprom_verify_signature(struct iwl4965_priv *priv);
|
||||
int iwlcore_eeprom_acquire_semaphore(struct iwl4965_priv *priv);
|
||||
void iwlcore_eeprom_release_semaphore(struct iwl4965_priv *priv);
|
||||
int iwlcore_eeprom_verify_signature(struct iwl_priv *priv);
|
||||
int iwlcore_eeprom_acquire_semaphore(struct iwl_priv *priv);
|
||||
void iwlcore_eeprom_release_semaphore(struct iwl_priv *priv);
|
||||
|
||||
int iwl_init_channel_map(struct iwl_priv *priv);
|
||||
void iwl_free_channel_map(struct iwl_priv *priv);
|
||||
const struct iwl_channel_info *iwl_get_channel_info(
|
||||
const struct iwl_priv *priv,
|
||||
enum ieee80211_band band, u16 channel);
|
||||
|
||||
#endif /* __iwl_eeprom_h__ */
|
||||
|
|
251
drivers/net/wireless/iwlwifi/iwl-hcmd.c
Normal file
251
drivers/net/wireless/iwlwifi/iwl-hcmd.c
Normal file
|
@ -0,0 +1,251 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* GPL LICENSE SUMMARY
|
||||
*
|
||||
* Copyright(c) 2008 Intel Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
|
||||
* USA
|
||||
*
|
||||
* The full GNU General Public License is included in this distribution
|
||||
* in the file called LICENSE.GPL.
|
||||
*
|
||||
* Contact Information:
|
||||
* Tomas Winkler <tomas.winkler@intel.com>
|
||||
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
|
||||
*****************************************************************************/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/version.h>
|
||||
#include <net/mac80211.h>
|
||||
|
||||
#include "iwl-4965.h" /* FIXME: remove */
|
||||
#include "iwl-debug.h"
|
||||
#include "iwl-eeprom.h"
|
||||
#include "iwl-core.h"
|
||||
|
||||
|
||||
#define IWL_CMD(x) case x : return #x
|
||||
|
||||
const char *get_cmd_string(u8 cmd)
|
||||
{
|
||||
switch (cmd) {
|
||||
IWL_CMD(REPLY_ALIVE);
|
||||
IWL_CMD(REPLY_ERROR);
|
||||
IWL_CMD(REPLY_RXON);
|
||||
IWL_CMD(REPLY_RXON_ASSOC);
|
||||
IWL_CMD(REPLY_QOS_PARAM);
|
||||
IWL_CMD(REPLY_RXON_TIMING);
|
||||
IWL_CMD(REPLY_ADD_STA);
|
||||
IWL_CMD(REPLY_REMOVE_STA);
|
||||
IWL_CMD(REPLY_REMOVE_ALL_STA);
|
||||
IWL_CMD(REPLY_TX);
|
||||
IWL_CMD(REPLY_RATE_SCALE);
|
||||
IWL_CMD(REPLY_LEDS_CMD);
|
||||
IWL_CMD(REPLY_TX_LINK_QUALITY_CMD);
|
||||
IWL_CMD(RADAR_NOTIFICATION);
|
||||
IWL_CMD(REPLY_QUIET_CMD);
|
||||
IWL_CMD(REPLY_CHANNEL_SWITCH);
|
||||
IWL_CMD(CHANNEL_SWITCH_NOTIFICATION);
|
||||
IWL_CMD(REPLY_SPECTRUM_MEASUREMENT_CMD);
|
||||
IWL_CMD(SPECTRUM_MEASURE_NOTIFICATION);
|
||||
IWL_CMD(POWER_TABLE_CMD);
|
||||
IWL_CMD(PM_SLEEP_NOTIFICATION);
|
||||
IWL_CMD(PM_DEBUG_STATISTIC_NOTIFIC);
|
||||
IWL_CMD(REPLY_SCAN_CMD);
|
||||
IWL_CMD(REPLY_SCAN_ABORT_CMD);
|
||||
IWL_CMD(SCAN_START_NOTIFICATION);
|
||||
IWL_CMD(SCAN_RESULTS_NOTIFICATION);
|
||||
IWL_CMD(SCAN_COMPLETE_NOTIFICATION);
|
||||
IWL_CMD(BEACON_NOTIFICATION);
|
||||
IWL_CMD(REPLY_TX_BEACON);
|
||||
IWL_CMD(WHO_IS_AWAKE_NOTIFICATION);
|
||||
IWL_CMD(QUIET_NOTIFICATION);
|
||||
IWL_CMD(REPLY_TX_PWR_TABLE_CMD);
|
||||
IWL_CMD(MEASURE_ABORT_NOTIFICATION);
|
||||
IWL_CMD(REPLY_BT_CONFIG);
|
||||
IWL_CMD(REPLY_STATISTICS_CMD);
|
||||
IWL_CMD(STATISTICS_NOTIFICATION);
|
||||
IWL_CMD(REPLY_CARD_STATE_CMD);
|
||||
IWL_CMD(CARD_STATE_NOTIFICATION);
|
||||
IWL_CMD(MISSED_BEACONS_NOTIFICATION);
|
||||
IWL_CMD(REPLY_CT_KILL_CONFIG_CMD);
|
||||
IWL_CMD(SENSITIVITY_CMD);
|
||||
IWL_CMD(REPLY_PHY_CALIBRATION_CMD);
|
||||
IWL_CMD(REPLY_RX_PHY_CMD);
|
||||
IWL_CMD(REPLY_RX_MPDU_CMD);
|
||||
IWL_CMD(REPLY_RX);
|
||||
IWL_CMD(REPLY_COMPRESSED_BA);
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(get_cmd_string);
|
||||
|
||||
#define HOST_COMPLETE_TIMEOUT (HZ / 2)
|
||||
|
||||
static int iwl_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
|
||||
{
|
||||
int ret;
|
||||
|
||||
BUG_ON(!(cmd->meta.flags & CMD_ASYNC));
|
||||
|
||||
/* An asynchronous command can not expect an SKB to be set. */
|
||||
BUG_ON(cmd->meta.flags & CMD_WANT_SKB);
|
||||
|
||||
/* An asynchronous command MUST have a callback. */
|
||||
BUG_ON(!cmd->meta.u.callback);
|
||||
|
||||
if (test_bit(STATUS_EXIT_PENDING, &priv->status))
|
||||
return -EBUSY;
|
||||
|
||||
ret = priv->cfg->ops->utils->enqueue_hcmd(priv, cmd);
|
||||
if (ret < 0) {
|
||||
IWL_ERROR("Error sending %s: enqueue_hcmd failed: %d\n",
|
||||
get_cmd_string(cmd->id), ret);
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
|
||||
{
|
||||
int cmd_idx;
|
||||
int ret;
|
||||
static atomic_t entry = ATOMIC_INIT(0); /* reentrance protection */
|
||||
|
||||
BUG_ON(cmd->meta.flags & CMD_ASYNC);
|
||||
|
||||
/* A synchronous command can not have a callback set. */
|
||||
BUG_ON(cmd->meta.u.callback != NULL);
|
||||
|
||||
if (atomic_xchg(&entry, 1)) {
|
||||
IWL_ERROR("Error sending %s: Already sending a host command\n",
|
||||
get_cmd_string(cmd->id));
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
set_bit(STATUS_HCMD_ACTIVE, &priv->status);
|
||||
|
||||
if (cmd->meta.flags & CMD_WANT_SKB)
|
||||
cmd->meta.source = &cmd->meta;
|
||||
|
||||
cmd_idx = priv->cfg->ops->utils->enqueue_hcmd(priv, cmd);
|
||||
if (cmd_idx < 0) {
|
||||
ret = cmd_idx;
|
||||
IWL_ERROR("Error sending %s: enqueue_hcmd failed: %d\n",
|
||||
get_cmd_string(cmd->id), ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = wait_event_interruptible_timeout(priv->wait_command_queue,
|
||||
!test_bit(STATUS_HCMD_ACTIVE, &priv->status),
|
||||
HOST_COMPLETE_TIMEOUT);
|
||||
if (!ret) {
|
||||
if (test_bit(STATUS_HCMD_ACTIVE, &priv->status)) {
|
||||
IWL_ERROR("Error sending %s: time out after %dms.\n",
|
||||
get_cmd_string(cmd->id),
|
||||
jiffies_to_msecs(HOST_COMPLETE_TIMEOUT));
|
||||
|
||||
clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
|
||||
ret = -ETIMEDOUT;
|
||||
goto cancel;
|
||||
}
|
||||
}
|
||||
|
||||
if (test_bit(STATUS_RF_KILL_HW, &priv->status)) {
|
||||
IWL_DEBUG_INFO("Command %s aborted: RF KILL Switch\n",
|
||||
get_cmd_string(cmd->id));
|
||||
ret = -ECANCELED;
|
||||
goto fail;
|
||||
}
|
||||
if (test_bit(STATUS_FW_ERROR, &priv->status)) {
|
||||
IWL_DEBUG_INFO("Command %s failed: FW Error\n",
|
||||
get_cmd_string(cmd->id));
|
||||
ret = -EIO;
|
||||
goto fail;
|
||||
}
|
||||
if ((cmd->meta.flags & CMD_WANT_SKB) && !cmd->meta.u.skb) {
|
||||
IWL_ERROR("Error: Response NULL in '%s'\n",
|
||||
get_cmd_string(cmd->id));
|
||||
ret = -EIO;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
goto out;
|
||||
|
||||
cancel:
|
||||
if (cmd->meta.flags & CMD_WANT_SKB) {
|
||||
struct iwl_cmd *qcmd;
|
||||
|
||||
/* Cancel the CMD_WANT_SKB flag for the cmd in the
|
||||
* TX cmd queue. Otherwise in case the cmd comes
|
||||
* in later, it will possibly set an invalid
|
||||
* address (cmd->meta.source). */
|
||||
qcmd = &priv->txq[IWL_CMD_QUEUE_NUM].cmd[cmd_idx];
|
||||
qcmd->meta.flags &= ~CMD_WANT_SKB;
|
||||
}
|
||||
fail:
|
||||
if (cmd->meta.u.skb) {
|
||||
dev_kfree_skb_any(cmd->meta.u.skb);
|
||||
cmd->meta.u.skb = NULL;
|
||||
}
|
||||
out:
|
||||
atomic_set(&entry, 0);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(iwl_send_cmd_sync);
|
||||
|
||||
int iwl_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
|
||||
{
|
||||
if (cmd->meta.flags & CMD_ASYNC)
|
||||
return iwl_send_cmd_async(priv, cmd);
|
||||
|
||||
return iwl_send_cmd_sync(priv, cmd);
|
||||
}
|
||||
EXPORT_SYMBOL(iwl_send_cmd);
|
||||
|
||||
int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, const void *data)
|
||||
{
|
||||
struct iwl_host_cmd cmd = {
|
||||
.id = id,
|
||||
.len = len,
|
||||
.data = data,
|
||||
};
|
||||
|
||||
return iwl_send_cmd_sync(priv, &cmd);
|
||||
}
|
||||
EXPORT_SYMBOL(iwl_send_cmd_pdu);
|
||||
|
||||
int iwl_send_cmd_pdu_async(struct iwl_priv *priv,
|
||||
u8 id, u16 len, const void *data,
|
||||
int (*callback)(struct iwl_priv *priv,
|
||||
struct iwl_cmd *cmd,
|
||||
struct sk_buff *skb))
|
||||
{
|
||||
struct iwl_host_cmd cmd = {
|
||||
.id = id,
|
||||
.len = len,
|
||||
.data = data,
|
||||
};
|
||||
|
||||
cmd.meta.flags |= CMD_ASYNC;
|
||||
cmd.meta.u.callback = callback;
|
||||
|
||||
return iwl_send_cmd_async(priv, &cmd);
|
||||
}
|
||||
EXPORT_SYMBOL(iwl_send_cmd_pdu_async);
|
File diff suppressed because it is too large
Load diff
|
@ -79,7 +79,7 @@ static u8 *lbs_code_2_region(u8 code)
|
|||
* @param nrchan number of channels
|
||||
* @return the nrchan-th chan number
|
||||
*/
|
||||
static u8 lbs_get_chan_11d(u8 band, u8 firstchan, u8 nrchan, u8 *chan)
|
||||
static u8 lbs_get_chan_11d(u8 firstchan, u8 nrchan, u8 *chan)
|
||||
/*find the nrchan-th chan after the firstchan*/
|
||||
{
|
||||
u8 i;
|
||||
|
@ -134,7 +134,7 @@ static u8 lbs_channel_known_11d(u8 chan,
|
|||
return 0;
|
||||
}
|
||||
|
||||
u32 lbs_chan_2_freq(u8 chan, u8 band)
|
||||
u32 lbs_chan_2_freq(u8 chan)
|
||||
{
|
||||
struct chan_freq_power *cf;
|
||||
u16 i;
|
||||
|
@ -264,7 +264,7 @@ static void lbs_generate_parsed_region_chan_11d(struct region_channel *region_ch
|
|||
* @param chan chan
|
||||
* @return TRUE;FALSE
|
||||
*/
|
||||
static u8 lbs_region_chan_supported_11d(u8 region, u8 band, u8 chan)
|
||||
static u8 lbs_region_chan_supported_11d(u8 region, u8 chan)
|
||||
{
|
||||
struct chan_freq_power *cfp;
|
||||
int cfp_no;
|
||||
|
@ -273,7 +273,7 @@ static u8 lbs_region_chan_supported_11d(u8 region, u8 band, u8 chan)
|
|||
|
||||
lbs_deb_enter(LBS_DEB_11D);
|
||||
|
||||
cfp = lbs_get_region_cfp_table(region, band, &cfp_no);
|
||||
cfp = lbs_get_region_cfp_table(region, &cfp_no);
|
||||
if (cfp == NULL)
|
||||
return 0;
|
||||
|
||||
|
@ -367,7 +367,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
|
|||
for (i = 0; idx < MAX_NO_OF_CHAN && i < nrchan; i++) {
|
||||
/*step4: channel is supported? */
|
||||
|
||||
if (!lbs_get_chan_11d(band, firstchan, i, &curchan)) {
|
||||
if (!lbs_get_chan_11d(firstchan, i, &curchan)) {
|
||||
/* Chan is not found in UN table */
|
||||
lbs_deb_11d("chan is not supported: %d \n", i);
|
||||
break;
|
||||
|
@ -375,8 +375,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
|
|||
|
||||
lastchan = curchan;
|
||||
|
||||
if (lbs_region_chan_supported_11d
|
||||
(region, band, curchan)) {
|
||||
if (lbs_region_chan_supported_11d(region, curchan)) {
|
||||
/*step5: Check if curchan is supported by mrvl in region */
|
||||
parsed_region_chan->chanpwr[idx].chan = curchan;
|
||||
parsed_region_chan->chanpwr[idx].pwr =
|
||||
|
@ -554,8 +553,7 @@ done:
|
|||
* @param resp pointer to command response buffer
|
||||
* @return 0; -1
|
||||
*/
|
||||
int lbs_ret_802_11d_domain_info(struct lbs_private *priv,
|
||||
struct cmd_ds_command *resp)
|
||||
int lbs_ret_802_11d_domain_info(struct cmd_ds_command *resp)
|
||||
{
|
||||
struct cmd_ds_802_11d_domain_info *domaininfo = &resp->params.domaininforesp;
|
||||
struct mrvlietypes_domainparamset *domain = &domaininfo->domain;
|
||||
|
|
|
@ -83,7 +83,7 @@ struct lbs_private;
|
|||
u8 lbs_get_scan_type_11d(u8 chan,
|
||||
struct parsed_region_chan_11d *parsed_region_chan);
|
||||
|
||||
u32 lbs_chan_2_freq(u8 chan, u8 band);
|
||||
u32 lbs_chan_2_freq(u8 chan);
|
||||
|
||||
void lbs_init_11d(struct lbs_private *priv);
|
||||
|
||||
|
@ -93,8 +93,7 @@ int lbs_cmd_802_11d_domain_info(struct lbs_private *priv,
|
|||
struct cmd_ds_command *cmd, u16 cmdno,
|
||||
u16 cmdOption);
|
||||
|
||||
int lbs_ret_802_11d_domain_info(struct lbs_private *priv,
|
||||
struct cmd_ds_command *resp);
|
||||
int lbs_ret_802_11d_domain_info(struct cmd_ds_command *resp);
|
||||
|
||||
struct bss_descriptor;
|
||||
int lbs_parse_dnld_countryinfo_11d(struct lbs_private *priv,
|
||||
|
|
|
@ -268,13 +268,11 @@ static int assoc_helper_wep_keys(struct lbs_private *priv,
|
|||
|
||||
/* enable/disable the MAC's WEP packet filter */
|
||||
if (assoc_req->secinfo.wep_enabled)
|
||||
priv->currentpacketfilter |= CMD_ACT_MAC_WEP_ENABLE;
|
||||
priv->mac_control |= CMD_ACT_MAC_WEP_ENABLE;
|
||||
else
|
||||
priv->currentpacketfilter &= ~CMD_ACT_MAC_WEP_ENABLE;
|
||||
priv->mac_control &= ~CMD_ACT_MAC_WEP_ENABLE;
|
||||
|
||||
ret = lbs_set_mac_packet_filter(priv);
|
||||
if (ret)
|
||||
goto out;
|
||||
lbs_set_mac_control(priv);
|
||||
|
||||
mutex_lock(&priv->lock);
|
||||
|
||||
|
@ -304,9 +302,7 @@ static int assoc_helper_secinfo(struct lbs_private *priv,
|
|||
memcpy(&priv->secinfo, &assoc_req->secinfo,
|
||||
sizeof(struct lbs_802_11_security));
|
||||
|
||||
ret = lbs_set_mac_packet_filter(priv);
|
||||
if (ret)
|
||||
goto out;
|
||||
lbs_set_mac_control(priv);
|
||||
|
||||
/* If RSN is already enabled, don't try to enable it again, since
|
||||
* ENABLE_RSN resets internal state machines and will clobber the
|
||||
|
@ -628,10 +624,6 @@ void lbs_association_worker(struct work_struct *work)
|
|||
lbs_prepare_and_send_command(priv,
|
||||
CMD_802_11_RSSI,
|
||||
0, CMD_OPTION_WAITFORRSP, 0, NULL);
|
||||
|
||||
lbs_prepare_and_send_command(priv,
|
||||
CMD_802_11_GET_LOG,
|
||||
0, CMD_OPTION_WAITFORRSP, 0, NULL);
|
||||
} else {
|
||||
ret = -1;
|
||||
}
|
||||
|
|
|
@ -14,9 +14,46 @@
|
|||
#include "cmd.h"
|
||||
|
||||
static struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv);
|
||||
static void lbs_set_cmd_ctrl_node(struct lbs_private *priv,
|
||||
struct cmd_ctrl_node *ptempnode,
|
||||
void *pdata_buf);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Simple callback that copies response back into command
|
||||
*
|
||||
* @param priv A pointer to struct lbs_private structure
|
||||
* @param extra A pointer to the original command structure for which
|
||||
* 'resp' is a response
|
||||
* @param resp A pointer to the command response
|
||||
*
|
||||
* @return 0 on success, error on failure
|
||||
*/
|
||||
int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra,
|
||||
struct cmd_header *resp)
|
||||
{
|
||||
struct cmd_header *buf = (void *)extra;
|
||||
uint16_t copy_len;
|
||||
|
||||
copy_len = min(le16_to_cpu(buf->size), le16_to_cpu(resp->size));
|
||||
memcpy(buf, resp, copy_len);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(lbs_cmd_copyback);
|
||||
|
||||
/**
|
||||
* @brief Simple callback that ignores the result. Use this if
|
||||
* you just want to send a command to the hardware, but don't
|
||||
* care for the result.
|
||||
*
|
||||
* @param priv ignored
|
||||
* @param extra ignored
|
||||
* @param resp ignored
|
||||
*
|
||||
* @return 0 for success
|
||||
*/
|
||||
static int lbs_cmd_async_callback(struct lbs_private *priv, unsigned long extra,
|
||||
struct cmd_header *resp)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -143,8 +180,7 @@ int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(lbs_host_sleep_cfg);
|
||||
|
||||
static int lbs_cmd_802_11_ps_mode(struct lbs_private *priv,
|
||||
struct cmd_ds_command *cmd,
|
||||
static int lbs_cmd_802_11_ps_mode(struct cmd_ds_command *cmd,
|
||||
u16 cmd_action)
|
||||
{
|
||||
struct cmd_ds_802_11_ps_mode *psm = &cmd->params.psmode;
|
||||
|
@ -439,8 +475,7 @@ int lbs_cmd_802_11_key_material(struct lbs_private *priv, uint16_t cmd_action,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int lbs_cmd_802_11_reset(struct lbs_private *priv,
|
||||
struct cmd_ds_command *cmd, int cmd_action)
|
||||
static int lbs_cmd_802_11_reset(struct cmd_ds_command *cmd, int cmd_action)
|
||||
{
|
||||
struct cmd_ds_802_11_reset *reset = &cmd->params.reset;
|
||||
|
||||
|
@ -454,30 +489,6 @@ static int lbs_cmd_802_11_reset(struct lbs_private *priv,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lbs_cmd_802_11_get_log(struct lbs_private *priv,
|
||||
struct cmd_ds_command *cmd)
|
||||
{
|
||||
lbs_deb_enter(LBS_DEB_CMD);
|
||||
cmd->command = cpu_to_le16(CMD_802_11_GET_LOG);
|
||||
cmd->size =
|
||||
cpu_to_le16(sizeof(struct cmd_ds_802_11_get_log) + S_DS_GEN);
|
||||
|
||||
lbs_deb_leave(LBS_DEB_CMD);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lbs_cmd_802_11_get_stat(struct lbs_private *priv,
|
||||
struct cmd_ds_command *cmd)
|
||||
{
|
||||
lbs_deb_enter(LBS_DEB_CMD);
|
||||
cmd->command = cpu_to_le16(CMD_802_11_GET_STAT);
|
||||
cmd->size =
|
||||
cpu_to_le16(sizeof(struct cmd_ds_802_11_get_stat) + S_DS_GEN);
|
||||
|
||||
lbs_deb_leave(LBS_DEB_CMD);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lbs_cmd_802_11_snmp_mib(struct lbs_private *priv,
|
||||
struct cmd_ds_command *cmd,
|
||||
int cmd_action,
|
||||
|
@ -598,8 +609,7 @@ static int lbs_cmd_802_11_snmp_mib(struct lbs_private *priv,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lbs_cmd_802_11_rf_tx_power(struct lbs_private *priv,
|
||||
struct cmd_ds_command *cmd,
|
||||
static int lbs_cmd_802_11_rf_tx_power(struct cmd_ds_command *cmd,
|
||||
u16 cmd_action, void *pdata_buf)
|
||||
{
|
||||
|
||||
|
@ -642,8 +652,7 @@ static int lbs_cmd_802_11_rf_tx_power(struct lbs_private *priv,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lbs_cmd_802_11_monitor_mode(struct lbs_private *priv,
|
||||
struct cmd_ds_command *cmd,
|
||||
static int lbs_cmd_802_11_monitor_mode(struct cmd_ds_command *cmd,
|
||||
u16 cmd_action, void *pdata_buf)
|
||||
{
|
||||
struct cmd_ds_802_11_monitor_mode *monitor = &cmd->params.monitor;
|
||||
|
@ -870,8 +879,7 @@ static int lbs_cmd_802_11_rssi(struct lbs_private *priv,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lbs_cmd_reg_access(struct lbs_private *priv,
|
||||
struct cmd_ds_command *cmdptr,
|
||||
static int lbs_cmd_reg_access(struct cmd_ds_command *cmdptr,
|
||||
u8 cmd_action, void *pdata_buf)
|
||||
{
|
||||
struct lbs_offset_value *offval;
|
||||
|
@ -968,9 +976,8 @@ static int lbs_cmd_802_11_mac_address(struct lbs_private *priv,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lbs_cmd_802_11_eeprom_access(struct lbs_private *priv,
|
||||
struct cmd_ds_command *cmd,
|
||||
int cmd_action, void *pdata_buf)
|
||||
static int lbs_cmd_802_11_eeprom_access(struct cmd_ds_command *cmd,
|
||||
void *pdata_buf)
|
||||
{
|
||||
struct lbs_ioctl_regrdwr *ea = pdata_buf;
|
||||
|
||||
|
@ -990,8 +997,7 @@ static int lbs_cmd_802_11_eeprom_access(struct lbs_private *priv,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lbs_cmd_bt_access(struct lbs_private *priv,
|
||||
struct cmd_ds_command *cmd,
|
||||
static int lbs_cmd_bt_access(struct cmd_ds_command *cmd,
|
||||
u16 cmd_action, void *pdata_buf)
|
||||
{
|
||||
struct cmd_ds_bt_access *bt_access = &cmd->params.bt;
|
||||
|
@ -1028,8 +1034,7 @@ static int lbs_cmd_bt_access(struct lbs_private *priv,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lbs_cmd_fwt_access(struct lbs_private *priv,
|
||||
struct cmd_ds_command *cmd,
|
||||
static int lbs_cmd_fwt_access(struct cmd_ds_command *cmd,
|
||||
u16 cmd_action, void *pdata_buf)
|
||||
{
|
||||
struct cmd_ds_fwt_access *fwt_access = &cmd->params.fwt;
|
||||
|
@ -1200,24 +1205,6 @@ static void lbs_submit_command(struct lbs_private *priv,
|
|||
lbs_deb_leave(LBS_DEB_HOST);
|
||||
}
|
||||
|
||||
static int lbs_cmd_mac_control(struct lbs_private *priv,
|
||||
struct cmd_ds_command *cmd)
|
||||
{
|
||||
struct cmd_ds_mac_control *mac = &cmd->params.macctrl;
|
||||
|
||||
lbs_deb_enter(LBS_DEB_CMD);
|
||||
|
||||
cmd->command = cpu_to_le16(CMD_MAC_CONTROL);
|
||||
cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mac_control) + S_DS_GEN);
|
||||
mac->action = cpu_to_le16(priv->currentpacketfilter);
|
||||
|
||||
lbs_deb_cmd("MAC_CONTROL: action 0x%04x, size %d\n",
|
||||
le16_to_cpu(mac->action), le16_to_cpu(cmd->size));
|
||||
|
||||
lbs_deb_leave(LBS_DEB_CMD);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function inserts command node to cmdfreeq
|
||||
* after cleans it. Requires priv->driver_lock held.
|
||||
|
@ -1260,7 +1247,7 @@ void lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd,
|
|||
cmd->cmdwaitqwoken = 1;
|
||||
wake_up_interruptible(&cmd->cmdwait_q);
|
||||
|
||||
if (!cmd->callback)
|
||||
if (!cmd->callback || cmd->callback == lbs_cmd_async_callback)
|
||||
__lbs_cleanup_and_insert_cmd(priv, cmd);
|
||||
priv->cur_cmd = NULL;
|
||||
}
|
||||
|
@ -1304,18 +1291,20 @@ int lbs_set_radio_control(struct lbs_private *priv)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int lbs_set_mac_packet_filter(struct lbs_private *priv)
|
||||
void lbs_set_mac_control(struct lbs_private *priv)
|
||||
{
|
||||
int ret = 0;
|
||||
struct cmd_ds_mac_control cmd;
|
||||
|
||||
lbs_deb_enter(LBS_DEB_CMD);
|
||||
|
||||
/* Send MAC control command to station */
|
||||
ret = lbs_prepare_and_send_command(priv,
|
||||
CMD_MAC_CONTROL, 0, 0, 0, NULL);
|
||||
cmd.hdr.size = cpu_to_le16(sizeof(cmd));
|
||||
cmd.action = cpu_to_le16(priv->mac_control);
|
||||
cmd.reserved = 0;
|
||||
|
||||
lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
|
||||
return ret;
|
||||
lbs_cmd_async(priv, CMD_MAC_CONTROL,
|
||||
&cmd.hdr, sizeof(cmd));
|
||||
|
||||
lbs_deb_leave(LBS_DEB_CMD);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1364,7 +1353,8 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
|
|||
goto done;
|
||||
}
|
||||
|
||||
lbs_set_cmd_ctrl_node(priv, cmdnode, pdata_buf);
|
||||
cmdnode->callback = NULL;
|
||||
cmdnode->callback_arg = (unsigned long)pdata_buf;
|
||||
|
||||
cmdptr = (struct cmd_ds_command *)cmdnode->cmdbuf;
|
||||
|
||||
|
@ -1379,11 +1369,7 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
|
|||
|
||||
switch (cmd_no) {
|
||||
case CMD_802_11_PS_MODE:
|
||||
ret = lbs_cmd_802_11_ps_mode(priv, cmdptr, cmd_action);
|
||||
break;
|
||||
|
||||
case CMD_MAC_CONTROL:
|
||||
ret = lbs_cmd_mac_control(priv, cmdptr);
|
||||
ret = lbs_cmd_802_11_ps_mode(cmdptr, cmd_action);
|
||||
break;
|
||||
|
||||
case CMD_802_11_ASSOCIATE:
|
||||
|
@ -1398,25 +1384,15 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
|
|||
case CMD_802_11_AD_HOC_START:
|
||||
ret = lbs_cmd_80211_ad_hoc_start(priv, cmdptr, pdata_buf);
|
||||
break;
|
||||
case CMD_CODE_DNLD:
|
||||
break;
|
||||
|
||||
case CMD_802_11_RESET:
|
||||
ret = lbs_cmd_802_11_reset(priv, cmdptr, cmd_action);
|
||||
break;
|
||||
|
||||
case CMD_802_11_GET_LOG:
|
||||
ret = lbs_cmd_802_11_get_log(priv, cmdptr);
|
||||
ret = lbs_cmd_802_11_reset(cmdptr, cmd_action);
|
||||
break;
|
||||
|
||||
case CMD_802_11_AUTHENTICATE:
|
||||
ret = lbs_cmd_80211_authenticate(priv, cmdptr, pdata_buf);
|
||||
break;
|
||||
|
||||
case CMD_802_11_GET_STAT:
|
||||
ret = lbs_cmd_802_11_get_stat(priv, cmdptr);
|
||||
break;
|
||||
|
||||
case CMD_802_11_SNMP_MIB:
|
||||
ret = lbs_cmd_802_11_snmp_mib(priv, cmdptr,
|
||||
cmd_action, cmd_oid, pdata_buf);
|
||||
|
@ -1425,12 +1401,12 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
|
|||
case CMD_MAC_REG_ACCESS:
|
||||
case CMD_BBP_REG_ACCESS:
|
||||
case CMD_RF_REG_ACCESS:
|
||||
ret = lbs_cmd_reg_access(priv, cmdptr, cmd_action, pdata_buf);
|
||||
ret = lbs_cmd_reg_access(cmdptr, cmd_action, pdata_buf);
|
||||
break;
|
||||
|
||||
case CMD_802_11_RF_TX_POWER:
|
||||
ret = lbs_cmd_802_11_rf_tx_power(priv, cmdptr,
|
||||
cmd_action, pdata_buf);
|
||||
ret = lbs_cmd_802_11_rf_tx_power(cmdptr,
|
||||
cmd_action, pdata_buf);
|
||||
break;
|
||||
|
||||
case CMD_802_11_RATE_ADAPT_RATESET:
|
||||
|
@ -1443,7 +1419,7 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
|
|||
break;
|
||||
|
||||
case CMD_802_11_MONITOR_MODE:
|
||||
ret = lbs_cmd_802_11_monitor_mode(priv, cmdptr,
|
||||
ret = lbs_cmd_802_11_monitor_mode(cmdptr,
|
||||
cmd_action, pdata_buf);
|
||||
break;
|
||||
|
||||
|
@ -1456,12 +1432,7 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
|
|||
break;
|
||||
|
||||
case CMD_802_11_AD_HOC_STOP:
|
||||
ret = lbs_cmd_80211_ad_hoc_stop(priv, cmdptr);
|
||||
break;
|
||||
|
||||
case CMD_802_11_PAIRWISE_TSC:
|
||||
break;
|
||||
case CMD_802_11_GROUP_TSC:
|
||||
ret = lbs_cmd_80211_ad_hoc_stop(cmdptr);
|
||||
break;
|
||||
|
||||
case CMD_802_11_MAC_ADDRESS:
|
||||
|
@ -1469,8 +1440,7 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
|
|||
break;
|
||||
|
||||
case CMD_802_11_EEPROM_ACCESS:
|
||||
ret = lbs_cmd_802_11_eeprom_access(priv, cmdptr,
|
||||
cmd_action, pdata_buf);
|
||||
ret = lbs_cmd_802_11_eeprom_access(cmdptr, pdata_buf);
|
||||
break;
|
||||
|
||||
case CMD_802_11_SET_AFC:
|
||||
|
@ -1537,11 +1507,11 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
|
|||
ret = 0;
|
||||
break;
|
||||
case CMD_BT_ACCESS:
|
||||
ret = lbs_cmd_bt_access(priv, cmdptr, cmd_action, pdata_buf);
|
||||
ret = lbs_cmd_bt_access(cmdptr, cmd_action, pdata_buf);
|
||||
break;
|
||||
|
||||
case CMD_FWT_ACCESS:
|
||||
ret = lbs_cmd_fwt_access(priv, cmdptr, cmd_action, pdata_buf);
|
||||
ret = lbs_cmd_fwt_access(cmdptr, cmd_action, pdata_buf);
|
||||
break;
|
||||
|
||||
case CMD_GET_TSF:
|
||||
|
@ -1713,36 +1683,6 @@ static struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv)
|
|||
return tempnode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function cleans command node.
|
||||
*
|
||||
* @param ptempnode A pointer to cmdCtrlNode structure
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief This function initializes the command node.
|
||||
*
|
||||
* @param priv A pointer to struct lbs_private structure
|
||||
* @param ptempnode A pointer to cmd_ctrl_node structure
|
||||
* @param pdata_buf A pointer to informaion buffer
|
||||
* @return 0 or -1
|
||||
*/
|
||||
static void lbs_set_cmd_ctrl_node(struct lbs_private *priv,
|
||||
struct cmd_ctrl_node *ptempnode,
|
||||
void *pdata_buf)
|
||||
{
|
||||
lbs_deb_enter(LBS_DEB_HOST);
|
||||
|
||||
if (!ptempnode)
|
||||
return;
|
||||
|
||||
ptempnode->callback = NULL;
|
||||
ptempnode->callback_arg = (unsigned long)pdata_buf;
|
||||
|
||||
lbs_deb_leave(LBS_DEB_HOST);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function executes next command in command
|
||||
* pending queue. It will put fimware back to PS mode
|
||||
|
@ -1930,10 +1870,6 @@ static int sendconfirmsleep(struct lbs_private *priv, u8 *cmdptr, u16 size)
|
|||
int ret = 0;
|
||||
|
||||
lbs_deb_enter(LBS_DEB_HOST);
|
||||
|
||||
lbs_deb_host("SEND_SLEEPC_CMD: before download, cmd size %d\n",
|
||||
size);
|
||||
|
||||
lbs_deb_hex(LBS_DEB_HOST, "sleep confirm command", cmdptr, size);
|
||||
|
||||
ret = priv->hw_host_to_card(priv, MVMS_CMD, cmdptr, size);
|
||||
|
@ -1956,8 +1892,6 @@ static int sendconfirmsleep(struct lbs_private *priv, u8 *cmdptr, u16 size)
|
|||
priv->intcounter);
|
||||
}
|
||||
spin_unlock_irqrestore(&priv->driver_lock, flags);
|
||||
|
||||
lbs_deb_host("SEND_SLEEPC_CMD: sent confirm sleep\n");
|
||||
}
|
||||
|
||||
lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret);
|
||||
|
@ -2009,10 +1943,10 @@ void lbs_ps_wakeup(struct lbs_private *priv, int wait_option)
|
|||
* @param psmode Power Saving mode
|
||||
* @return n/a
|
||||
*/
|
||||
void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode)
|
||||
void lbs_ps_confirm_sleep(struct lbs_private *priv)
|
||||
{
|
||||
unsigned long flags =0;
|
||||
u8 allowed = 1;
|
||||
int allowed = 1;
|
||||
|
||||
lbs_deb_enter(LBS_DEB_HOST);
|
||||
|
||||
|
@ -2044,32 +1978,10 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Simple callback that copies response back into command
|
||||
*
|
||||
* @param priv A pointer to struct lbs_private structure
|
||||
* @param extra A pointer to the original command structure for which
|
||||
* 'resp' is a response
|
||||
* @param resp A pointer to the command response
|
||||
*
|
||||
* @return 0 on success, error on failure
|
||||
*/
|
||||
int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra,
|
||||
struct cmd_header *resp)
|
||||
{
|
||||
struct cmd_header *buf = (void *)extra;
|
||||
uint16_t copy_len;
|
||||
|
||||
copy_len = min(le16_to_cpu(buf->size), le16_to_cpu(resp->size));
|
||||
memcpy(buf, resp, copy_len);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(lbs_cmd_copyback);
|
||||
|
||||
struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv, uint16_t command,
|
||||
struct cmd_header *in_cmd, int in_cmd_size,
|
||||
int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),
|
||||
unsigned long callback_arg)
|
||||
static struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv,
|
||||
uint16_t command, struct cmd_header *in_cmd, int in_cmd_size,
|
||||
int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),
|
||||
unsigned long callback_arg)
|
||||
{
|
||||
struct cmd_ctrl_node *cmdnode;
|
||||
|
||||
|
@ -2106,9 +2018,6 @@ struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv, uint16_t command
|
|||
|
||||
lbs_deb_host("PREP_CMD: command 0x%04x\n", command);
|
||||
|
||||
/* here was the big old switch() statement, which is now obsolete,
|
||||
* because the caller of lbs_cmd() sets up all of *cmd for us. */
|
||||
|
||||
cmdnode->cmdwaitqwoken = 0;
|
||||
lbs_queue_cmd(priv, cmdnode);
|
||||
wake_up_interruptible(&priv->waitq);
|
||||
|
@ -2118,6 +2027,15 @@ struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv, uint16_t command
|
|||
return cmdnode;
|
||||
}
|
||||
|
||||
void lbs_cmd_async(struct lbs_private *priv, uint16_t command,
|
||||
struct cmd_header *in_cmd, int in_cmd_size)
|
||||
{
|
||||
lbs_deb_enter(LBS_DEB_CMD);
|
||||
__lbs_cmd_async(priv, command, in_cmd, in_cmd_size,
|
||||
lbs_cmd_async_callback, 0);
|
||||
lbs_deb_leave(LBS_DEB_CMD);
|
||||
}
|
||||
|
||||
int __lbs_cmd(struct lbs_private *priv, uint16_t command,
|
||||
struct cmd_header *in_cmd, int in_cmd_size,
|
||||
int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),
|
||||
|
|
|
@ -18,12 +18,9 @@
|
|||
#define lbs_cmd_with_response(priv, cmdnr, cmd) \
|
||||
lbs_cmd(priv, cmdnr, cmd, lbs_cmd_copyback, (unsigned long) (cmd))
|
||||
|
||||
/* __lbs_cmd() will free the cmdnode and return success/failure.
|
||||
__lbs_cmd_async() requires that the callback free the cmdnode */
|
||||
struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv, uint16_t command,
|
||||
struct cmd_header *in_cmd, int in_cmd_size,
|
||||
int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),
|
||||
unsigned long callback_arg);
|
||||
void lbs_cmd_async(struct lbs_private *priv, uint16_t command,
|
||||
struct cmd_header *in_cmd, int in_cmd_size);
|
||||
|
||||
int __lbs_cmd(struct lbs_private *priv, uint16_t command,
|
||||
struct cmd_header *in_cmd, int in_cmd_size,
|
||||
int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),
|
||||
|
|
|
@ -146,22 +146,6 @@ static int lbs_ret_reg_access(struct lbs_private *priv,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int lbs_ret_802_11_stat(struct lbs_private *priv,
|
||||
struct cmd_ds_command *resp)
|
||||
{
|
||||
lbs_deb_enter(LBS_DEB_CMD);
|
||||
/* currently priv->wlan802_11Stat is unused
|
||||
|
||||
struct cmd_ds_802_11_get_stat *p11Stat = &resp->params.gstat;
|
||||
|
||||
// TODO Convert it to Big endian befor copy
|
||||
memcpy(&priv->wlan802_11Stat,
|
||||
p11Stat, sizeof(struct cmd_ds_802_11_get_stat));
|
||||
*/
|
||||
lbs_deb_leave(LBS_DEB_CMD);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lbs_ret_802_11_snmp_mib(struct lbs_private *priv,
|
||||
struct cmd_ds_command *resp)
|
||||
{
|
||||
|
@ -303,20 +287,6 @@ static int lbs_ret_802_11_eeprom_access(struct lbs_private *priv,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lbs_ret_get_log(struct lbs_private *priv,
|
||||
struct cmd_ds_command *resp)
|
||||
{
|
||||
struct cmd_ds_802_11_get_log *logmessage = &resp->params.glog;
|
||||
|
||||
lbs_deb_enter(LBS_DEB_CMD);
|
||||
|
||||
/* Stored little-endian */
|
||||
memcpy(&priv->logmsg, logmessage, sizeof(struct cmd_ds_802_11_get_log));
|
||||
|
||||
lbs_deb_leave(LBS_DEB_CMD);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lbs_ret_802_11_bcn_ctrl(struct lbs_private * priv,
|
||||
struct cmd_ds_command *resp)
|
||||
{
|
||||
|
@ -335,7 +305,6 @@ static int lbs_ret_802_11_bcn_ctrl(struct lbs_private * priv,
|
|||
}
|
||||
|
||||
static inline int handle_cmd_response(struct lbs_private *priv,
|
||||
unsigned long dummy,
|
||||
struct cmd_header *cmd_response)
|
||||
{
|
||||
struct cmd_ds_command *resp = (struct cmd_ds_command *) cmd_response;
|
||||
|
@ -352,10 +321,6 @@ static inline int handle_cmd_response(struct lbs_private *priv,
|
|||
ret = lbs_ret_reg_access(priv, respcmd, resp);
|
||||
break;
|
||||
|
||||
case CMD_RET(CMD_802_11_GET_LOG):
|
||||
ret = lbs_ret_get_log(priv, resp);
|
||||
break;
|
||||
|
||||
case CMD_RET_802_11_ASSOCIATE:
|
||||
case CMD_RET(CMD_802_11_ASSOCIATE):
|
||||
case CMD_RET(CMD_802_11_REASSOCIATE):
|
||||
|
@ -364,7 +329,7 @@ static inline int handle_cmd_response(struct lbs_private *priv,
|
|||
|
||||
case CMD_RET(CMD_802_11_DISASSOCIATE):
|
||||
case CMD_RET(CMD_802_11_DEAUTHENTICATE):
|
||||
ret = lbs_ret_80211_disassociate(priv, resp);
|
||||
ret = lbs_ret_80211_disassociate(priv);
|
||||
break;
|
||||
|
||||
case CMD_RET(CMD_802_11_AD_HOC_START):
|
||||
|
@ -372,10 +337,6 @@ static inline int handle_cmd_response(struct lbs_private *priv,
|
|||
ret = lbs_ret_80211_ad_hoc_start(priv, resp);
|
||||
break;
|
||||
|
||||
case CMD_RET(CMD_802_11_GET_STAT):
|
||||
ret = lbs_ret_802_11_stat(priv, resp);
|
||||
break;
|
||||
|
||||
case CMD_RET(CMD_802_11_SNMP_MIB):
|
||||
ret = lbs_ret_802_11_snmp_mib(priv, resp);
|
||||
break;
|
||||
|
@ -394,7 +355,6 @@ static inline int handle_cmd_response(struct lbs_private *priv,
|
|||
break;
|
||||
|
||||
case CMD_RET(CMD_MAC_MULTICAST_ADR):
|
||||
case CMD_RET(CMD_MAC_CONTROL):
|
||||
case CMD_RET(CMD_802_11_RESET):
|
||||
case CMD_RET(CMD_802_11_AUTHENTICATE):
|
||||
case CMD_RET(CMD_802_11_BEACON_STOP):
|
||||
|
@ -413,7 +373,7 @@ static inline int handle_cmd_response(struct lbs_private *priv,
|
|||
break;
|
||||
|
||||
case CMD_RET(CMD_802_11_AD_HOC_STOP):
|
||||
ret = lbs_ret_80211_ad_hoc_stop(priv, resp);
|
||||
ret = lbs_ret_80211_ad_hoc_stop(priv);
|
||||
break;
|
||||
|
||||
case CMD_RET(CMD_802_11_EEPROM_ACCESS):
|
||||
|
@ -421,7 +381,7 @@ static inline int handle_cmd_response(struct lbs_private *priv,
|
|||
break;
|
||||
|
||||
case CMD_RET(CMD_802_11D_DOMAIN_INFO):
|
||||
ret = lbs_ret_802_11d_domain_info(priv, resp);
|
||||
ret = lbs_ret_802_11d_domain_info(resp);
|
||||
break;
|
||||
|
||||
case CMD_RET(CMD_802_11_TPC_CFG):
|
||||
|
@ -624,7 +584,7 @@ int lbs_process_rx_command(struct lbs_private *priv)
|
|||
ret = priv->cur_cmd->callback(priv, priv->cur_cmd->callback_arg,
|
||||
resp);
|
||||
} else
|
||||
ret = handle_cmd_response(priv, 0, resp);
|
||||
ret = handle_cmd_response(priv, resp);
|
||||
|
||||
spin_lock_irqsave(&priv->driver_lock, flags);
|
||||
|
||||
|
@ -675,11 +635,9 @@ int lbs_process_event(struct lbs_private *priv)
|
|||
eventcause = priv->eventcause >> SBI_EVENT_CAUSE_SHIFT;
|
||||
spin_unlock_irq(&priv->driver_lock);
|
||||
|
||||
lbs_deb_cmd("event cause %d\n", eventcause);
|
||||
|
||||
switch (eventcause) {
|
||||
case MACREG_INT_CODE_LINK_SENSED:
|
||||
lbs_deb_cmd("EVENT: MACREG_INT_CODE_LINK_SENSED\n");
|
||||
lbs_deb_cmd("EVENT: link sensed\n");
|
||||
break;
|
||||
|
||||
case MACREG_INT_CODE_DEAUTHENTICATED:
|
||||
|
@ -698,7 +656,7 @@ int lbs_process_event(struct lbs_private *priv)
|
|||
break;
|
||||
|
||||
case MACREG_INT_CODE_PS_SLEEP:
|
||||
lbs_deb_cmd("EVENT: sleep\n");
|
||||
lbs_deb_cmd("EVENT: ps sleep\n");
|
||||
|
||||
/* handle unexpected PS SLEEP event */
|
||||
if (priv->psstate == PS_STATE_FULL_POWER) {
|
||||
|
@ -708,17 +666,17 @@ int lbs_process_event(struct lbs_private *priv)
|
|||
}
|
||||
priv->psstate = PS_STATE_PRE_SLEEP;
|
||||
|
||||
lbs_ps_confirm_sleep(priv, (u16) priv->psmode);
|
||||
lbs_ps_confirm_sleep(priv);
|
||||
|
||||
break;
|
||||
|
||||
case MACREG_INT_CODE_HOST_AWAKE:
|
||||
lbs_deb_cmd("EVENT: HOST_AWAKE\n");
|
||||
lbs_deb_cmd("EVENT: host awake\n");
|
||||
lbs_send_confirmwake(priv);
|
||||
break;
|
||||
|
||||
case MACREG_INT_CODE_PS_AWAKE:
|
||||
lbs_deb_cmd("EVENT: awake\n");
|
||||
lbs_deb_cmd("EVENT: ps awake\n");
|
||||
/* handle unexpected PS AWAKE event */
|
||||
if (priv->psstate == PS_STATE_FULL_POWER) {
|
||||
lbs_deb_cmd(
|
||||
|
@ -749,14 +707,16 @@ int lbs_process_event(struct lbs_private *priv)
|
|||
lbs_deb_cmd("EVENT: MULTICAST MIC ERROR\n");
|
||||
handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_MULTICAST);
|
||||
break;
|
||||
case MACREG_INT_CODE_MIB_CHANGED:
|
||||
case MACREG_INT_CODE_INIT_DONE:
|
||||
break;
|
||||
|
||||
case MACREG_INT_CODE_MIB_CHANGED:
|
||||
lbs_deb_cmd("EVENT: MIB CHANGED\n");
|
||||
break;
|
||||
case MACREG_INT_CODE_INIT_DONE:
|
||||
lbs_deb_cmd("EVENT: INIT DONE\n");
|
||||
break;
|
||||
case MACREG_INT_CODE_ADHOC_BCN_LOST:
|
||||
lbs_deb_cmd("EVENT: ADHOC beacon lost\n");
|
||||
break;
|
||||
|
||||
case MACREG_INT_CODE_RSSI_LOW:
|
||||
lbs_pr_alert("EVENT: rssi low\n");
|
||||
break;
|
||||
|
|
|
@ -19,7 +19,7 @@ static char *szStates[] = {
|
|||
};
|
||||
|
||||
#ifdef PROC_DEBUG
|
||||
static void lbs_debug_init(struct lbs_private *priv, struct net_device *dev);
|
||||
static void lbs_debug_init(struct lbs_private *priv);
|
||||
#endif
|
||||
|
||||
static int open_file_generic(struct inode *inode, struct file *file)
|
||||
|
@ -78,7 +78,7 @@ static ssize_t lbs_getscantable(struct file *file, char __user *userbuf,
|
|||
u16 spectrum_mgmt = (iter_bss->capability & WLAN_CAPABILITY_SPECTRUM_MGMT);
|
||||
|
||||
pos += snprintf(buf+pos, len-pos,
|
||||
"%02u| %03d | %04ld | %s |",
|
||||
"%02u| %03d | %04d | %s |",
|
||||
numscansdone, iter_bss->channel, iter_bss->rssi,
|
||||
print_mac(mac, iter_bss->bssid));
|
||||
pos += snprintf(buf+pos, len-pos, " %04x-", iter_bss->capability);
|
||||
|
@ -778,7 +778,7 @@ void lbs_debugfs_init_one(struct lbs_private *priv, struct net_device *dev)
|
|||
}
|
||||
|
||||
#ifdef PROC_DEBUG
|
||||
lbs_debug_init(priv, dev);
|
||||
lbs_debug_init(priv);
|
||||
#endif
|
||||
exit:
|
||||
return;
|
||||
|
@ -952,7 +952,7 @@ static struct file_operations lbs_debug_fops = {
|
|||
* @param dev pointer net_device
|
||||
* @return N/A
|
||||
*/
|
||||
static void lbs_debug_init(struct lbs_private *priv, struct net_device *dev)
|
||||
static void lbs_debug_init(struct lbs_private *priv)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ struct net_device;
|
|||
struct cmd_ctrl_node;
|
||||
struct cmd_ds_command;
|
||||
|
||||
int lbs_set_mac_packet_filter(struct lbs_private *priv);
|
||||
void lbs_set_mac_control(struct lbs_private *priv);
|
||||
|
||||
void lbs_send_tx_feedback(struct lbs_private *priv);
|
||||
|
||||
|
@ -49,7 +49,7 @@ int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band);
|
|||
int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *);
|
||||
|
||||
void lbs_ps_sleep(struct lbs_private *priv, int wait_option);
|
||||
void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode);
|
||||
void lbs_ps_confirm_sleep(struct lbs_private *priv);
|
||||
void lbs_ps_wakeup(struct lbs_private *priv, int wait_option);
|
||||
|
||||
struct chan_freq_power *lbs_find_cfp_by_band_and_channel(
|
||||
|
@ -63,7 +63,6 @@ void lbs_send_iwevcustom_event(struct lbs_private *priv, s8 *str);
|
|||
|
||||
/* main.c */
|
||||
struct chan_freq_power *lbs_get_region_cfp_table(u8 region,
|
||||
u8 band,
|
||||
int *cfp_no);
|
||||
struct lbs_private *lbs_add_card(void *card, struct device *dmdev);
|
||||
int lbs_remove_card(struct lbs_private *priv);
|
||||
|
|
|
@ -252,7 +252,7 @@ struct lbs_private {
|
|||
struct sk_buff *currenttxskb;
|
||||
|
||||
/** NIC Operation characteristics */
|
||||
u16 currentpacketfilter;
|
||||
u16 mac_control;
|
||||
u32 connect_status;
|
||||
u32 mesh_connect_status;
|
||||
u16 regioncode;
|
||||
|
@ -323,8 +323,6 @@ struct lbs_private {
|
|||
u8 *prdeeprom;
|
||||
struct lbs_offset_value offsetvalue;
|
||||
|
||||
struct cmd_ds_802_11_get_log logmsg;
|
||||
|
||||
u32 monitormode;
|
||||
u8 fw_ready;
|
||||
};
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#define CMD_RET_802_11_ASSOCIATE 0x8012
|
||||
|
||||
/* Command codes */
|
||||
#define CMD_CODE_DNLD 0x0002
|
||||
#define CMD_GET_HW_SPEC 0x0003
|
||||
#define CMD_EEPROM_UPDATE 0x0004
|
||||
#define CMD_802_11_RESET 0x0005
|
||||
|
@ -68,8 +67,6 @@
|
|||
#define CMD_802_11_AD_HOC_JOIN 0x002c
|
||||
#define CMD_802_11_QUERY_TKIP_REPLY_CNTRS 0x002e
|
||||
#define CMD_802_11_ENABLE_RSN 0x002f
|
||||
#define CMD_802_11_PAIRWISE_TSC 0x0036
|
||||
#define CMD_802_11_GROUP_TSC 0x0037
|
||||
#define CMD_802_11_SET_AFC 0x003c
|
||||
#define CMD_802_11_GET_AFC 0x003d
|
||||
#define CMD_802_11_AD_HOC_STOP 0x0040
|
||||
|
|
|
@ -195,6 +195,8 @@ struct cmd_ds_802_11_scan_rsp {
|
|||
};
|
||||
|
||||
struct cmd_ds_802_11_get_log {
|
||||
struct cmd_header hdr;
|
||||
|
||||
__le32 mcasttxframe;
|
||||
__le32 failed;
|
||||
__le32 retry;
|
||||
|
@ -211,8 +213,9 @@ struct cmd_ds_802_11_get_log {
|
|||
};
|
||||
|
||||
struct cmd_ds_mac_control {
|
||||
struct cmd_header hdr;
|
||||
__le16 action;
|
||||
__le16 reserved;
|
||||
u16 reserved;
|
||||
};
|
||||
|
||||
struct cmd_ds_mac_multicast_adr {
|
||||
|
@ -695,13 +698,11 @@ struct cmd_ds_command {
|
|||
/* command Body */
|
||||
union {
|
||||
struct cmd_ds_802_11_ps_mode psmode;
|
||||
struct cmd_ds_mac_control macctrl;
|
||||
struct cmd_ds_802_11_associate associate;
|
||||
struct cmd_ds_802_11_deauthenticate deauth;
|
||||
struct cmd_ds_802_11_ad_hoc_start ads;
|
||||
struct cmd_ds_802_11_reset reset;
|
||||
struct cmd_ds_802_11_ad_hoc_result result;
|
||||
struct cmd_ds_802_11_get_log glog;
|
||||
struct cmd_ds_802_11_authenticate auth;
|
||||
struct cmd_ds_802_11_get_stat gstat;
|
||||
struct cmd_ds_802_3_get_stat gstat_8023;
|
||||
|
|
|
@ -882,6 +882,9 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
|
|||
goto out3;
|
||||
}
|
||||
|
||||
/* The firmware for the CF card supports powersave */
|
||||
priv->ps_supported = 1;
|
||||
|
||||
ret = 0;
|
||||
goto out;
|
||||
|
||||
|
|
|
@ -561,8 +561,7 @@ done:
|
|||
return ret;
|
||||
}
|
||||
|
||||
int lbs_cmd_80211_ad_hoc_stop(struct lbs_private *priv,
|
||||
struct cmd_ds_command *cmd)
|
||||
int lbs_cmd_80211_ad_hoc_stop(struct cmd_ds_command *cmd)
|
||||
{
|
||||
cmd->command = cpu_to_le16(CMD_802_11_AD_HOC_STOP);
|
||||
cmd->size = cpu_to_le16(S_DS_GEN);
|
||||
|
@ -773,8 +772,7 @@ done:
|
|||
return ret;
|
||||
}
|
||||
|
||||
int lbs_ret_80211_disassociate(struct lbs_private *priv,
|
||||
struct cmd_ds_command *resp)
|
||||
int lbs_ret_80211_disassociate(struct lbs_private *priv)
|
||||
{
|
||||
lbs_deb_enter(LBS_DEB_JOIN);
|
||||
|
||||
|
@ -863,8 +861,7 @@ done:
|
|||
return ret;
|
||||
}
|
||||
|
||||
int lbs_ret_80211_ad_hoc_stop(struct lbs_private *priv,
|
||||
struct cmd_ds_command *resp)
|
||||
int lbs_ret_80211_ad_hoc_stop(struct lbs_private *priv)
|
||||
{
|
||||
lbs_deb_enter(LBS_DEB_JOIN);
|
||||
|
||||
|
|
|
@ -18,8 +18,7 @@ int lbs_cmd_80211_authenticate(struct lbs_private *priv,
|
|||
int lbs_cmd_80211_ad_hoc_join(struct lbs_private *priv,
|
||||
struct cmd_ds_command *cmd,
|
||||
void *pdata_buf);
|
||||
int lbs_cmd_80211_ad_hoc_stop(struct lbs_private *priv,
|
||||
struct cmd_ds_command *cmd);
|
||||
int lbs_cmd_80211_ad_hoc_stop(struct cmd_ds_command *cmd);
|
||||
int lbs_cmd_80211_ad_hoc_start(struct lbs_private *priv,
|
||||
struct cmd_ds_command *cmd,
|
||||
void *pdata_buf);
|
||||
|
@ -31,10 +30,8 @@ int lbs_cmd_80211_associate(struct lbs_private *priv,
|
|||
|
||||
int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv,
|
||||
struct cmd_ds_command *resp);
|
||||
int lbs_ret_80211_ad_hoc_stop(struct lbs_private *priv,
|
||||
struct cmd_ds_command *resp);
|
||||
int lbs_ret_80211_disassociate(struct lbs_private *priv,
|
||||
struct cmd_ds_command *resp);
|
||||
int lbs_ret_80211_ad_hoc_stop(struct lbs_private *priv);
|
||||
int lbs_ret_80211_disassociate(struct lbs_private *priv);
|
||||
int lbs_ret_80211_associate(struct lbs_private *priv,
|
||||
struct cmd_ds_command *resp);
|
||||
|
||||
|
|
|
@ -581,45 +581,45 @@ static int lbs_copy_multicast_address(struct lbs_private *priv,
|
|||
static void lbs_set_multicast_list(struct net_device *dev)
|
||||
{
|
||||
struct lbs_private *priv = dev->priv;
|
||||
int oldpacketfilter;
|
||||
int old_mac_control;
|
||||
DECLARE_MAC_BUF(mac);
|
||||
|
||||
lbs_deb_enter(LBS_DEB_NET);
|
||||
|
||||
oldpacketfilter = priv->currentpacketfilter;
|
||||
old_mac_control = priv->mac_control;
|
||||
|
||||
if (dev->flags & IFF_PROMISC) {
|
||||
lbs_deb_net("enable promiscuous mode\n");
|
||||
priv->currentpacketfilter |=
|
||||
priv->mac_control |=
|
||||
CMD_ACT_MAC_PROMISCUOUS_ENABLE;
|
||||
priv->currentpacketfilter &=
|
||||
priv->mac_control &=
|
||||
~(CMD_ACT_MAC_ALL_MULTICAST_ENABLE |
|
||||
CMD_ACT_MAC_MULTICAST_ENABLE);
|
||||
} else {
|
||||
/* Multicast */
|
||||
priv->currentpacketfilter &=
|
||||
priv->mac_control &=
|
||||
~CMD_ACT_MAC_PROMISCUOUS_ENABLE;
|
||||
|
||||
if (dev->flags & IFF_ALLMULTI || dev->mc_count >
|
||||
MRVDRV_MAX_MULTICAST_LIST_SIZE) {
|
||||
lbs_deb_net( "enabling all multicast\n");
|
||||
priv->currentpacketfilter |=
|
||||
priv->mac_control |=
|
||||
CMD_ACT_MAC_ALL_MULTICAST_ENABLE;
|
||||
priv->currentpacketfilter &=
|
||||
priv->mac_control &=
|
||||
~CMD_ACT_MAC_MULTICAST_ENABLE;
|
||||
} else {
|
||||
priv->currentpacketfilter &=
|
||||
priv->mac_control &=
|
||||
~CMD_ACT_MAC_ALL_MULTICAST_ENABLE;
|
||||
|
||||
if (!dev->mc_count) {
|
||||
lbs_deb_net("no multicast addresses, "
|
||||
"disabling multicast\n");
|
||||
priv->currentpacketfilter &=
|
||||
priv->mac_control &=
|
||||
~CMD_ACT_MAC_MULTICAST_ENABLE;
|
||||
} else {
|
||||
int i;
|
||||
|
||||
priv->currentpacketfilter |=
|
||||
priv->mac_control |=
|
||||
CMD_ACT_MAC_MULTICAST_ENABLE;
|
||||
|
||||
priv->nr_of_multicastmacaddr =
|
||||
|
@ -642,9 +642,8 @@ static void lbs_set_multicast_list(struct net_device *dev)
|
|||
}
|
||||
}
|
||||
|
||||
if (priv->currentpacketfilter != oldpacketfilter) {
|
||||
lbs_set_mac_packet_filter(priv);
|
||||
}
|
||||
if (priv->mac_control != old_mac_control)
|
||||
lbs_set_mac_control(priv);
|
||||
|
||||
lbs_deb_leave(LBS_DEB_NET);
|
||||
}
|
||||
|
@ -804,7 +803,7 @@ static int lbs_thread(void *data)
|
|||
lbs_deb_thread("main_thread: PRE_SLEEP--intcounter=%d currenttxskb=%p dnld_sent=%d cur_cmd=%p, confirm now\n",
|
||||
priv->intcounter, priv->currenttxskb, priv->dnld_sent, priv->cur_cmd);
|
||||
|
||||
lbs_ps_confirm_sleep(priv, (u16) priv->psmode);
|
||||
lbs_ps_confirm_sleep(priv);
|
||||
} else {
|
||||
/* workaround for firmware sending
|
||||
* deauth/linkloss event immediately
|
||||
|
@ -945,7 +944,7 @@ static int lbs_setup_firmware(struct lbs_private *priv)
|
|||
goto done;
|
||||
}
|
||||
|
||||
lbs_set_mac_packet_filter(priv);
|
||||
lbs_set_mac_control(priv);
|
||||
|
||||
ret = lbs_get_data_rate(priv);
|
||||
if (ret < 0) {
|
||||
|
@ -1036,7 +1035,7 @@ static int lbs_init_adapter(struct lbs_private *priv)
|
|||
priv->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
|
||||
priv->mode = IW_MODE_INFRA;
|
||||
priv->curbssparams.channel = DEFAULT_AD_HOC_CHANNEL;
|
||||
priv->currentpacketfilter = CMD_ACT_MAC_RX_ON | CMD_ACT_MAC_TX_ON;
|
||||
priv->mac_control = CMD_ACT_MAC_RX_ON | CMD_ACT_MAC_TX_ON;
|
||||
priv->radioon = RADIO_ON;
|
||||
priv->auto_rate = 1;
|
||||
priv->capability = WLAN_CAPABILITY_SHORT_PREAMBLE;
|
||||
|
@ -1392,7 +1391,7 @@ static void lbs_remove_mesh(struct lbs_private *priv)
|
|||
* @param cfp_no A pointer to CFP number
|
||||
* @return A pointer to CFP
|
||||
*/
|
||||
struct chan_freq_power *lbs_get_region_cfp_table(u8 region, u8 band, int *cfp_no)
|
||||
struct chan_freq_power *lbs_get_region_cfp_table(u8 region, int *cfp_no)
|
||||
{
|
||||
int i, end;
|
||||
|
||||
|
@ -1426,7 +1425,7 @@ int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band)
|
|||
|
||||
memset(priv->region_channel, 0, sizeof(priv->region_channel));
|
||||
|
||||
cfp = lbs_get_region_cfp_table(region, band, &cfp_no);
|
||||
cfp = lbs_get_region_cfp_table(region, &cfp_no);
|
||||
if (cfp != NULL) {
|
||||
priv->region_channel[i].nrcfp = cfp_no;
|
||||
priv->region_channel[i].CFP = cfp;
|
||||
|
|
|
@ -602,7 +602,7 @@ static int lbs_scan_networks(struct lbs_private *priv, int full_scan)
|
|||
lbs_deb_scan("scan table:\n");
|
||||
list_for_each_entry(iter, &priv->network_list, list)
|
||||
lbs_deb_scan("%02d: BSSID %s, RSSI %d, SSID '%s'\n",
|
||||
i++, print_mac(mac, iter->bssid), (int)iter->rssi,
|
||||
i++, print_mac(mac, iter->bssid), iter->rssi,
|
||||
escape_essid(iter->ssid, iter->ssid_len));
|
||||
mutex_unlock(&priv->lock);
|
||||
#endif
|
||||
|
@ -948,7 +948,7 @@ struct bss_descriptor *lbs_find_ssid_in_list(struct lbs_private *priv,
|
|||
uint8_t *bssid, uint8_t mode,
|
||||
int channel)
|
||||
{
|
||||
uint8_t bestrssi = 0;
|
||||
u32 bestrssi = 0;
|
||||
struct bss_descriptor * iter_bss = NULL;
|
||||
struct bss_descriptor * found_bss = NULL;
|
||||
struct bss_descriptor * tmp_oldest = NULL;
|
||||
|
|
|
@ -34,14 +34,9 @@ struct bss_descriptor {
|
|||
u8 ssid_len;
|
||||
|
||||
u16 capability;
|
||||
|
||||
/* receive signal strength in dBm */
|
||||
long rssi;
|
||||
|
||||
u32 rssi;
|
||||
u32 channel;
|
||||
|
||||
u16 beaconperiod;
|
||||
|
||||
u32 atimwindow;
|
||||
|
||||
/* IW_MODE_AUTO, IW_MODE_ADHOC, IW_MODE_INFRA */
|
||||
|
|
|
@ -605,7 +605,7 @@ static int lbs_get_range(struct net_device *dev, struct iw_request_info *info,
|
|||
lbs_deb_wext("chan_no %d\n", chan_no);
|
||||
range->freq[range->num_frequency].i = (long)chan_no;
|
||||
range->freq[range->num_frequency].m =
|
||||
(long)lbs_chan_2_freq(chan_no, band) * 100000;
|
||||
(long)lbs_chan_2_freq(chan_no) * 100000;
|
||||
range->freq[range->num_frequency].e = 1;
|
||||
range->num_frequency++;
|
||||
}
|
||||
|
@ -656,13 +656,10 @@ static int lbs_get_range(struct net_device *dev, struct iw_request_info *info,
|
|||
range->num_encoding_sizes = 2;
|
||||
range->max_encoding_tokens = 4;
|
||||
|
||||
range->min_pmp = 1000000;
|
||||
range->max_pmp = 120000000;
|
||||
range->min_pmt = 1000;
|
||||
range->max_pmt = 1000000;
|
||||
range->pmp_flags = IW_POWER_PERIOD;
|
||||
range->pmt_flags = IW_POWER_TIMEOUT;
|
||||
range->pm_capa = IW_POWER_PERIOD | IW_POWER_TIMEOUT | IW_POWER_ALL_R;
|
||||
/*
|
||||
* Right now we support only "iwconfig ethX power on|off"
|
||||
*/
|
||||
range->pm_capa = IW_POWER_ON;
|
||||
|
||||
/*
|
||||
* Minimum version we recommend
|
||||
|
@ -784,21 +781,14 @@ static int lbs_get_power(struct net_device *dev, struct iw_request_info *info,
|
|||
struct iw_param *vwrq, char *extra)
|
||||
{
|
||||
struct lbs_private *priv = dev->priv;
|
||||
int mode;
|
||||
|
||||
lbs_deb_enter(LBS_DEB_WEXT);
|
||||
|
||||
mode = priv->psmode;
|
||||
|
||||
if ((vwrq->disabled = (mode == LBS802_11POWERMODECAM))
|
||||
|| priv->connect_status == LBS_DISCONNECTED)
|
||||
{
|
||||
goto out;
|
||||
}
|
||||
|
||||
vwrq->value = 0;
|
||||
vwrq->flags = 0;
|
||||
vwrq->disabled = priv->psmode == LBS802_11POWERMODECAM
|
||||
|| priv->connect_status == LBS_DISCONNECTED;
|
||||
|
||||
out:
|
||||
lbs_deb_leave(LBS_DEB_WEXT);
|
||||
return 0;
|
||||
}
|
||||
|
@ -820,6 +810,7 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
|
|||
int stats_valid = 0;
|
||||
u8 rssi;
|
||||
u32 tx_retries;
|
||||
struct cmd_ds_802_11_get_log log;
|
||||
|
||||
lbs_deb_enter(LBS_DEB_WEXT);
|
||||
|
||||
|
@ -863,7 +854,11 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
|
|||
/* Quality by TX errors */
|
||||
priv->wstats.discard.retries = priv->stats.tx_errors;
|
||||
|
||||
tx_retries = le32_to_cpu(priv->logmsg.retry);
|
||||
memset(&log, 0, sizeof(log));
|
||||
log.hdr.size = cpu_to_le16(sizeof(log));
|
||||
lbs_cmd_with_response(priv, CMD_802_11_GET_LOG, &log);
|
||||
|
||||
tx_retries = le32_to_cpu(log.retry);
|
||||
|
||||
if (tx_retries > 75)
|
||||
tx_qual = (90 - tx_retries) * POOR / 15;
|
||||
|
@ -879,10 +874,9 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
|
|||
(PERFECT - VERY_GOOD) / 50 + VERY_GOOD;
|
||||
quality = min(quality, tx_qual);
|
||||
|
||||
priv->wstats.discard.code = le32_to_cpu(priv->logmsg.wepundecryptable);
|
||||
priv->wstats.discard.fragment = le32_to_cpu(priv->logmsg.rxfrag);
|
||||
priv->wstats.discard.code = le32_to_cpu(log.wepundecryptable);
|
||||
priv->wstats.discard.retries = tx_retries;
|
||||
priv->wstats.discard.misc = le32_to_cpu(priv->logmsg.ackfailure);
|
||||
priv->wstats.discard.misc = le32_to_cpu(log.ackfailure);
|
||||
|
||||
/* Calculate quality */
|
||||
priv->wstats.qual.qual = min_t(u8, quality, 100);
|
||||
|
@ -892,8 +886,6 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
|
|||
/* update stats asynchronously for future calls */
|
||||
lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0,
|
||||
0, 0, NULL);
|
||||
lbs_prepare_and_send_command(priv, CMD_802_11_GET_LOG, 0,
|
||||
0, 0, NULL);
|
||||
out:
|
||||
if (!stats_valid) {
|
||||
priv->wstats.miss.beacon = 0;
|
||||
|
|
|
@ -134,7 +134,7 @@ config RT2500USB
|
|||
|
||||
config RT2500USB_LEDS
|
||||
bool "RT2500 leds support"
|
||||
depends on RT2500USB
|
||||
depends on RT2500USB && BROKEN
|
||||
select RT2X00_LIB_LEDS
|
||||
---help---
|
||||
This adds support for led triggers provided my mac80211.
|
||||
|
@ -152,7 +152,7 @@ config RT73USB
|
|||
|
||||
config RT73USB_LEDS
|
||||
bool "RT73 leds support"
|
||||
depends on RT73USB
|
||||
depends on RT73USB && BROKEN
|
||||
select RT2X00_LIB_LEDS
|
||||
---help---
|
||||
This adds support for led triggers provided my mac80211.
|
||||
|
|
|
@ -270,6 +270,31 @@ static void rt2400pci_led_brightness(struct led_classdev *led_cdev,
|
|||
/*
|
||||
* Configuration handlers.
|
||||
*/
|
||||
static void rt2400pci_config_filter(struct rt2x00_dev *rt2x00dev,
|
||||
const unsigned int filter_flags)
|
||||
{
|
||||
u32 reg;
|
||||
|
||||
/*
|
||||
* Start configuration steps.
|
||||
* Note that the version error will always be dropped
|
||||
* since there is no filter for it at this time.
|
||||
*/
|
||||
rt2x00pci_register_read(rt2x00dev, RXCSR0, ®);
|
||||
rt2x00_set_field32(®, RXCSR0_DROP_CRC,
|
||||
!(filter_flags & FIF_FCSFAIL));
|
||||
rt2x00_set_field32(®, RXCSR0_DROP_PHYSICAL,
|
||||
!(filter_flags & FIF_PLCPFAIL));
|
||||
rt2x00_set_field32(®, RXCSR0_DROP_CONTROL,
|
||||
!(filter_flags & FIF_CONTROL));
|
||||
rt2x00_set_field32(®, RXCSR0_DROP_NOT_TO_ME,
|
||||
!(filter_flags & FIF_PROMISC_IN_BSS));
|
||||
rt2x00_set_field32(®, RXCSR0_DROP_TODS,
|
||||
!(filter_flags & FIF_PROMISC_IN_BSS));
|
||||
rt2x00_set_field32(®, RXCSR0_DROP_VERSION_ERROR, 1);
|
||||
rt2x00pci_register_write(rt2x00dev, RXCSR0, reg);
|
||||
}
|
||||
|
||||
static void rt2400pci_config_intf(struct rt2x00_dev *rt2x00dev,
|
||||
struct rt2x00_intf *intf,
|
||||
struct rt2x00intf_conf *conf,
|
||||
|
@ -306,8 +331,8 @@ static void rt2400pci_config_intf(struct rt2x00_dev *rt2x00dev,
|
|||
conf->bssid, sizeof(conf->bssid));
|
||||
}
|
||||
|
||||
static int rt2400pci_config_erp(struct rt2x00_dev *rt2x00dev,
|
||||
struct rt2x00lib_erp *erp)
|
||||
static void rt2400pci_config_erp(struct rt2x00_dev *rt2x00dev,
|
||||
struct rt2x00lib_erp *erp)
|
||||
{
|
||||
int preamble_mask;
|
||||
u32 reg;
|
||||
|
@ -347,8 +372,6 @@ static int rt2400pci_config_erp(struct rt2x00_dev *rt2x00dev,
|
|||
rt2x00_set_field32(®, ARCSR5_SERVICE, 0x84);
|
||||
rt2x00_set_field32(®, ARCSR2_LENGTH, get_duration(ACK_SIZE, 110));
|
||||
rt2x00pci_register_write(rt2x00dev, ARCSR5, reg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void rt2400pci_config_phymode(struct rt2x00_dev *rt2x00dev,
|
||||
|
@ -1076,12 +1099,13 @@ static void rt2400pci_fill_rxdone(struct queue_entry *entry,
|
|||
* of the preamble bit (0x08).
|
||||
*/
|
||||
rxdesc->signal = rt2x00_get_field32(word2, RXD_W2_SIGNAL) & ~0x08;
|
||||
rxdesc->signal_plcp = 1;
|
||||
rxdesc->rssi = rt2x00_get_field32(word2, RXD_W3_RSSI) -
|
||||
entry->queue->rt2x00dev->rssi_offset;
|
||||
rxdesc->ofdm = 0;
|
||||
rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT);
|
||||
rxdesc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS);
|
||||
|
||||
rxdesc->dev_flags = RXDONE_SIGNAL_PLCP;
|
||||
if (rt2x00_get_field32(word0, RXD_W0_MY_BSS))
|
||||
rxdesc->dev_flags |= RXDONE_MY_BSS;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1396,64 +1420,6 @@ static int rt2400pci_probe_hw(struct rt2x00_dev *rt2x00dev)
|
|||
/*
|
||||
* IEEE80211 stack callback functions.
|
||||
*/
|
||||
static void rt2400pci_configure_filter(struct ieee80211_hw *hw,
|
||||
unsigned int changed_flags,
|
||||
unsigned int *total_flags,
|
||||
int mc_count,
|
||||
struct dev_addr_list *mc_list)
|
||||
{
|
||||
struct rt2x00_dev *rt2x00dev = hw->priv;
|
||||
u32 reg;
|
||||
|
||||
/*
|
||||
* Mask off any flags we are going to ignore from
|
||||
* the total_flags field.
|
||||
*/
|
||||
*total_flags &=
|
||||
FIF_ALLMULTI |
|
||||
FIF_FCSFAIL |
|
||||
FIF_PLCPFAIL |
|
||||
FIF_CONTROL |
|
||||
FIF_OTHER_BSS |
|
||||
FIF_PROMISC_IN_BSS;
|
||||
|
||||
/*
|
||||
* Apply some rules to the filters:
|
||||
* - Some filters imply different filters to be set.
|
||||
* - Some things we can't filter out at all.
|
||||
*/
|
||||
*total_flags |= FIF_ALLMULTI;
|
||||
if (*total_flags & FIF_OTHER_BSS ||
|
||||
*total_flags & FIF_PROMISC_IN_BSS)
|
||||
*total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS;
|
||||
|
||||
/*
|
||||
* Check if there is any work left for us.
|
||||
*/
|
||||
if (rt2x00dev->packet_filter == *total_flags)
|
||||
return;
|
||||
rt2x00dev->packet_filter = *total_flags;
|
||||
|
||||
/*
|
||||
* Start configuration steps.
|
||||
* Note that the version error will always be dropped
|
||||
* since there is no filter for it at this time.
|
||||
*/
|
||||
rt2x00pci_register_read(rt2x00dev, RXCSR0, ®);
|
||||
rt2x00_set_field32(®, RXCSR0_DROP_CRC,
|
||||
!(*total_flags & FIF_FCSFAIL));
|
||||
rt2x00_set_field32(®, RXCSR0_DROP_PHYSICAL,
|
||||
!(*total_flags & FIF_PLCPFAIL));
|
||||
rt2x00_set_field32(®, RXCSR0_DROP_CONTROL,
|
||||
!(*total_flags & FIF_CONTROL));
|
||||
rt2x00_set_field32(®, RXCSR0_DROP_NOT_TO_ME,
|
||||
!(*total_flags & FIF_PROMISC_IN_BSS));
|
||||
rt2x00_set_field32(®, RXCSR0_DROP_TODS,
|
||||
!(*total_flags & FIF_PROMISC_IN_BSS));
|
||||
rt2x00_set_field32(®, RXCSR0_DROP_VERSION_ERROR, 1);
|
||||
rt2x00pci_register_write(rt2x00dev, RXCSR0, reg);
|
||||
}
|
||||
|
||||
static int rt2400pci_set_retry_limit(struct ieee80211_hw *hw,
|
||||
u32 short_retry, u32 long_retry)
|
||||
{
|
||||
|
@ -1579,7 +1545,7 @@ static const struct ieee80211_ops rt2400pci_mac80211_ops = {
|
|||
.remove_interface = rt2x00mac_remove_interface,
|
||||
.config = rt2x00mac_config,
|
||||
.config_interface = rt2x00mac_config_interface,
|
||||
.configure_filter = rt2400pci_configure_filter,
|
||||
.configure_filter = rt2x00mac_configure_filter,
|
||||
.get_stats = rt2x00mac_get_stats,
|
||||
.set_retry_limit = rt2400pci_set_retry_limit,
|
||||
.bss_info_changed = rt2x00mac_bss_info_changed,
|
||||
|
@ -1607,6 +1573,7 @@ static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = {
|
|||
.write_tx_data = rt2x00pci_write_tx_data,
|
||||
.kick_tx_queue = rt2400pci_kick_tx_queue,
|
||||
.fill_rxdone = rt2400pci_fill_rxdone,
|
||||
.config_filter = rt2400pci_config_filter,
|
||||
.config_intf = rt2400pci_config_intf,
|
||||
.config_erp = rt2400pci_config_erp,
|
||||
.config = rt2400pci_config,
|
||||
|
|
|
@ -270,6 +270,35 @@ static void rt2500pci_led_brightness(struct led_classdev *led_cdev,
|
|||
/*
|
||||
* Configuration handlers.
|
||||
*/
|
||||
static void rt2500pci_config_filter(struct rt2x00_dev *rt2x00dev,
|
||||
const unsigned int filter_flags)
|
||||
{
|
||||
u32 reg;
|
||||
|
||||
/*
|
||||
* Start configuration steps.
|
||||
* Note that the version error will always be dropped
|
||||
* and broadcast frames will always be accepted since
|
||||
* there is no filter for it at this time.
|
||||
*/
|
||||
rt2x00pci_register_read(rt2x00dev, RXCSR0, ®);
|
||||
rt2x00_set_field32(®, RXCSR0_DROP_CRC,
|
||||
!(filter_flags & FIF_FCSFAIL));
|
||||
rt2x00_set_field32(®, RXCSR0_DROP_PHYSICAL,
|
||||
!(filter_flags & FIF_PLCPFAIL));
|
||||
rt2x00_set_field32(®, RXCSR0_DROP_CONTROL,
|
||||
!(filter_flags & FIF_CONTROL));
|
||||
rt2x00_set_field32(®, RXCSR0_DROP_NOT_TO_ME,
|
||||
!(filter_flags & FIF_PROMISC_IN_BSS));
|
||||
rt2x00_set_field32(®, RXCSR0_DROP_TODS,
|
||||
!(filter_flags & FIF_PROMISC_IN_BSS));
|
||||
rt2x00_set_field32(®, RXCSR0_DROP_VERSION_ERROR, 1);
|
||||
rt2x00_set_field32(®, RXCSR0_DROP_MCAST,
|
||||
!(filter_flags & FIF_ALLMULTI));
|
||||
rt2x00_set_field32(®, RXCSR0_DROP_BCAST, 0);
|
||||
rt2x00pci_register_write(rt2x00dev, RXCSR0, reg);
|
||||
}
|
||||
|
||||
static void rt2500pci_config_intf(struct rt2x00_dev *rt2x00dev,
|
||||
struct rt2x00_intf *intf,
|
||||
struct rt2x00intf_conf *conf,
|
||||
|
@ -309,8 +338,8 @@ static void rt2500pci_config_intf(struct rt2x00_dev *rt2x00dev,
|
|||
conf->bssid, sizeof(conf->bssid));
|
||||
}
|
||||
|
||||
static int rt2500pci_config_erp(struct rt2x00_dev *rt2x00dev,
|
||||
struct rt2x00lib_erp *erp)
|
||||
static void rt2500pci_config_erp(struct rt2x00_dev *rt2x00dev,
|
||||
struct rt2x00lib_erp *erp)
|
||||
{
|
||||
int preamble_mask;
|
||||
u32 reg;
|
||||
|
@ -350,8 +379,6 @@ static int rt2500pci_config_erp(struct rt2x00_dev *rt2x00dev,
|
|||
rt2x00_set_field32(®, ARCSR5_SERVICE, 0x84);
|
||||
rt2x00_set_field32(®, ARCSR2_LENGTH, get_duration(ACK_SIZE, 110));
|
||||
rt2x00pci_register_write(rt2x00dev, ARCSR5, reg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void rt2500pci_config_phymode(struct rt2x00_dev *rt2x00dev,
|
||||
|
@ -1225,13 +1252,16 @@ static void rt2500pci_fill_rxdone(struct queue_entry *entry,
|
|||
* the signal is the PLCP value. If it was received with
|
||||
* a CCK bitrate the signal is the rate in 100kbit/s.
|
||||
*/
|
||||
rxdesc->ofdm = rt2x00_get_field32(word0, RXD_W0_OFDM);
|
||||
rxdesc->signal = rt2x00_get_field32(word2, RXD_W2_SIGNAL);
|
||||
rxdesc->signal_plcp = rxdesc->ofdm;
|
||||
rxdesc->rssi = rt2x00_get_field32(word2, RXD_W2_RSSI) -
|
||||
entry->queue->rt2x00dev->rssi_offset;
|
||||
rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT);
|
||||
rxdesc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS);
|
||||
|
||||
rxdesc->dev_flags = 0;
|
||||
if (rt2x00_get_field32(word0, RXD_W0_OFDM))
|
||||
rxdesc->dev_flags |= RXDONE_SIGNAL_PLCP;
|
||||
if (rt2x00_get_field32(word0, RXD_W0_MY_BSS))
|
||||
rxdesc->dev_flags |= RXDONE_MY_BSS;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1728,69 +1758,6 @@ static int rt2500pci_probe_hw(struct rt2x00_dev *rt2x00dev)
|
|||
/*
|
||||
* IEEE80211 stack callback functions.
|
||||
*/
|
||||
static void rt2500pci_configure_filter(struct ieee80211_hw *hw,
|
||||
unsigned int changed_flags,
|
||||
unsigned int *total_flags,
|
||||
int mc_count,
|
||||
struct dev_addr_list *mc_list)
|
||||
{
|
||||
struct rt2x00_dev *rt2x00dev = hw->priv;
|
||||
u32 reg;
|
||||
|
||||
/*
|
||||
* Mask off any flags we are going to ignore from
|
||||
* the total_flags field.
|
||||
*/
|
||||
*total_flags &=
|
||||
FIF_ALLMULTI |
|
||||
FIF_FCSFAIL |
|
||||
FIF_PLCPFAIL |
|
||||
FIF_CONTROL |
|
||||
FIF_OTHER_BSS |
|
||||
FIF_PROMISC_IN_BSS;
|
||||
|
||||
/*
|
||||
* Apply some rules to the filters:
|
||||
* - Some filters imply different filters to be set.
|
||||
* - Some things we can't filter out at all.
|
||||
*/
|
||||
if (mc_count)
|
||||
*total_flags |= FIF_ALLMULTI;
|
||||
if (*total_flags & FIF_OTHER_BSS ||
|
||||
*total_flags & FIF_PROMISC_IN_BSS)
|
||||
*total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS;
|
||||
|
||||
/*
|
||||
* Check if there is any work left for us.
|
||||
*/
|
||||
if (rt2x00dev->packet_filter == *total_flags)
|
||||
return;
|
||||
rt2x00dev->packet_filter = *total_flags;
|
||||
|
||||
/*
|
||||
* Start configuration steps.
|
||||
* Note that the version error will always be dropped
|
||||
* and broadcast frames will always be accepted since
|
||||
* there is no filter for it at this time.
|
||||
*/
|
||||
rt2x00pci_register_read(rt2x00dev, RXCSR0, ®);
|
||||
rt2x00_set_field32(®, RXCSR0_DROP_CRC,
|
||||
!(*total_flags & FIF_FCSFAIL));
|
||||
rt2x00_set_field32(®, RXCSR0_DROP_PHYSICAL,
|
||||
!(*total_flags & FIF_PLCPFAIL));
|
||||
rt2x00_set_field32(®, RXCSR0_DROP_CONTROL,
|
||||
!(*total_flags & FIF_CONTROL));
|
||||
rt2x00_set_field32(®, RXCSR0_DROP_NOT_TO_ME,
|
||||
!(*total_flags & FIF_PROMISC_IN_BSS));
|
||||
rt2x00_set_field32(®, RXCSR0_DROP_TODS,
|
||||
!(*total_flags & FIF_PROMISC_IN_BSS));
|
||||
rt2x00_set_field32(®, RXCSR0_DROP_VERSION_ERROR, 1);
|
||||
rt2x00_set_field32(®, RXCSR0_DROP_MCAST,
|
||||
!(*total_flags & FIF_ALLMULTI));
|
||||
rt2x00_set_field32(®, RXCSR0_DROP_BCAST, 0);
|
||||
rt2x00pci_register_write(rt2x00dev, RXCSR0, reg);
|
||||
}
|
||||
|
||||
static int rt2500pci_set_retry_limit(struct ieee80211_hw *hw,
|
||||
u32 short_retry, u32 long_retry)
|
||||
{
|
||||
|
@ -1891,7 +1858,7 @@ static const struct ieee80211_ops rt2500pci_mac80211_ops = {
|
|||
.remove_interface = rt2x00mac_remove_interface,
|
||||
.config = rt2x00mac_config,
|
||||
.config_interface = rt2x00mac_config_interface,
|
||||
.configure_filter = rt2500pci_configure_filter,
|
||||
.configure_filter = rt2x00mac_configure_filter,
|
||||
.get_stats = rt2x00mac_get_stats,
|
||||
.set_retry_limit = rt2500pci_set_retry_limit,
|
||||
.bss_info_changed = rt2x00mac_bss_info_changed,
|
||||
|
@ -1919,6 +1886,7 @@ static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = {
|
|||
.write_tx_data = rt2x00pci_write_tx_data,
|
||||
.kick_tx_queue = rt2500pci_kick_tx_queue,
|
||||
.fill_rxdone = rt2500pci_fill_rxdone,
|
||||
.config_filter = rt2500pci_config_filter,
|
||||
.config_intf = rt2500pci_config_intf,
|
||||
.config_erp = rt2500pci_config_erp,
|
||||
.config = rt2500pci_config,
|
||||
|
|
|
@ -316,6 +316,35 @@ static void rt2500usb_led_brightness(struct led_classdev *led_cdev,
|
|||
/*
|
||||
* Configuration handlers.
|
||||
*/
|
||||
static void rt2500usb_config_filter(struct rt2x00_dev *rt2x00dev,
|
||||
const unsigned int filter_flags)
|
||||
{
|
||||
u16 reg;
|
||||
|
||||
/*
|
||||
* Start configuration steps.
|
||||
* Note that the version error will always be dropped
|
||||
* and broadcast frames will always be accepted since
|
||||
* there is no filter for it at this time.
|
||||
*/
|
||||
rt2500usb_register_read(rt2x00dev, TXRX_CSR2, ®);
|
||||
rt2x00_set_field16(®, TXRX_CSR2_DROP_CRC,
|
||||
!(filter_flags & FIF_FCSFAIL));
|
||||
rt2x00_set_field16(®, TXRX_CSR2_DROP_PHYSICAL,
|
||||
!(filter_flags & FIF_PLCPFAIL));
|
||||
rt2x00_set_field16(®, TXRX_CSR2_DROP_CONTROL,
|
||||
!(filter_flags & FIF_CONTROL));
|
||||
rt2x00_set_field16(®, TXRX_CSR2_DROP_NOT_TO_ME,
|
||||
!(filter_flags & FIF_PROMISC_IN_BSS));
|
||||
rt2x00_set_field16(®, TXRX_CSR2_DROP_TODS,
|
||||
!(filter_flags & FIF_PROMISC_IN_BSS));
|
||||
rt2x00_set_field16(®, TXRX_CSR2_DROP_VERSION_ERROR, 1);
|
||||
rt2x00_set_field16(®, TXRX_CSR2_DROP_MULTICAST,
|
||||
!(filter_flags & FIF_ALLMULTI));
|
||||
rt2x00_set_field16(®, TXRX_CSR2_DROP_BROADCAST, 0);
|
||||
rt2500usb_register_write(rt2x00dev, TXRX_CSR2, reg);
|
||||
}
|
||||
|
||||
static void rt2500usb_config_intf(struct rt2x00_dev *rt2x00dev,
|
||||
struct rt2x00_intf *intf,
|
||||
struct rt2x00intf_conf *conf,
|
||||
|
@ -358,18 +387,11 @@ static void rt2500usb_config_intf(struct rt2x00_dev *rt2x00dev,
|
|||
(3 * sizeof(__le16)));
|
||||
}
|
||||
|
||||
static int rt2500usb_config_erp(struct rt2x00_dev *rt2x00dev,
|
||||
struct rt2x00lib_erp *erp)
|
||||
static void rt2500usb_config_erp(struct rt2x00_dev *rt2x00dev,
|
||||
struct rt2x00lib_erp *erp)
|
||||
{
|
||||
u16 reg;
|
||||
|
||||
/*
|
||||
* When in atomic context, we should let rt2x00lib
|
||||
* try this configuration again later.
|
||||
*/
|
||||
if (in_atomic())
|
||||
return -EAGAIN;
|
||||
|
||||
rt2500usb_register_read(rt2x00dev, TXRX_CSR1, ®);
|
||||
rt2x00_set_field16(®, TXRX_CSR1_ACK_TIMEOUT, erp->ack_timeout);
|
||||
rt2500usb_register_write(rt2x00dev, TXRX_CSR1, reg);
|
||||
|
@ -378,8 +400,6 @@ static int rt2500usb_config_erp(struct rt2x00_dev *rt2x00dev,
|
|||
rt2x00_set_field16(®, TXRX_CSR10_AUTORESPOND_PREAMBLE,
|
||||
!!erp->short_preamble);
|
||||
rt2500usb_register_write(rt2x00dev, TXRX_CSR10, reg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void rt2500usb_config_phymode(struct rt2x00_dev *rt2x00dev,
|
||||
|
@ -1139,13 +1159,16 @@ static void rt2500usb_fill_rxdone(struct queue_entry *entry,
|
|||
* the signal is the PLCP value. If it was received with
|
||||
* a CCK bitrate the signal is the rate in 100kbit/s.
|
||||
*/
|
||||
rxdesc->ofdm = rt2x00_get_field32(word0, RXD_W0_OFDM);
|
||||
rxdesc->signal = rt2x00_get_field32(word1, RXD_W1_SIGNAL);
|
||||
rxdesc->signal_plcp = rxdesc->ofdm;
|
||||
rxdesc->rssi = rt2x00_get_field32(word1, RXD_W1_RSSI) -
|
||||
entry->queue->rt2x00dev->rssi_offset;
|
||||
rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT);
|
||||
rxdesc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS);
|
||||
|
||||
rxdesc->dev_flags = 0;
|
||||
if (rt2x00_get_field32(word0, RXD_W0_OFDM))
|
||||
rxdesc->dev_flags |= RXDONE_SIGNAL_PLCP;
|
||||
if (rt2x00_get_field32(word0, RXD_W0_MY_BSS))
|
||||
rxdesc->dev_flags |= RXDONE_MY_BSS;
|
||||
|
||||
/*
|
||||
* Adjust the skb memory window to the frame boundaries.
|
||||
|
@ -1641,6 +1664,7 @@ static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev)
|
|||
*/
|
||||
__set_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags);
|
||||
__set_bit(DRIVER_REQUIRE_BEACON_GUARD, &rt2x00dev->flags);
|
||||
__set_bit(DRIVER_REQUIRE_SCHEDULED, &rt2x00dev->flags);
|
||||
|
||||
/*
|
||||
* Set the rssi offset.
|
||||
|
@ -1653,78 +1677,6 @@ static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev)
|
|||
/*
|
||||
* IEEE80211 stack callback functions.
|
||||
*/
|
||||
static void rt2500usb_configure_filter(struct ieee80211_hw *hw,
|
||||
unsigned int changed_flags,
|
||||
unsigned int *total_flags,
|
||||
int mc_count,
|
||||
struct dev_addr_list *mc_list)
|
||||
{
|
||||
struct rt2x00_dev *rt2x00dev = hw->priv;
|
||||
u16 reg;
|
||||
|
||||
/*
|
||||
* Mask off any flags we are going to ignore from
|
||||
* the total_flags field.
|
||||
*/
|
||||
*total_flags &=
|
||||
FIF_ALLMULTI |
|
||||
FIF_FCSFAIL |
|
||||
FIF_PLCPFAIL |
|
||||
FIF_CONTROL |
|
||||
FIF_OTHER_BSS |
|
||||
FIF_PROMISC_IN_BSS;
|
||||
|
||||
/*
|
||||
* Apply some rules to the filters:
|
||||
* - Some filters imply different filters to be set.
|
||||
* - Some things we can't filter out at all.
|
||||
*/
|
||||
if (mc_count)
|
||||
*total_flags |= FIF_ALLMULTI;
|
||||
if (*total_flags & FIF_OTHER_BSS ||
|
||||
*total_flags & FIF_PROMISC_IN_BSS)
|
||||
*total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS;
|
||||
|
||||
/*
|
||||
* Check if there is any work left for us.
|
||||
*/
|
||||
if (rt2x00dev->packet_filter == *total_flags)
|
||||
return;
|
||||
rt2x00dev->packet_filter = *total_flags;
|
||||
|
||||
/*
|
||||
* When in atomic context, reschedule and let rt2x00lib
|
||||
* call this function again.
|
||||
*/
|
||||
if (in_atomic()) {
|
||||
queue_work(rt2x00dev->hw->workqueue, &rt2x00dev->filter_work);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Start configuration steps.
|
||||
* Note that the version error will always be dropped
|
||||
* and broadcast frames will always be accepted since
|
||||
* there is no filter for it at this time.
|
||||
*/
|
||||
rt2500usb_register_read(rt2x00dev, TXRX_CSR2, ®);
|
||||
rt2x00_set_field16(®, TXRX_CSR2_DROP_CRC,
|
||||
!(*total_flags & FIF_FCSFAIL));
|
||||
rt2x00_set_field16(®, TXRX_CSR2_DROP_PHYSICAL,
|
||||
!(*total_flags & FIF_PLCPFAIL));
|
||||
rt2x00_set_field16(®, TXRX_CSR2_DROP_CONTROL,
|
||||
!(*total_flags & FIF_CONTROL));
|
||||
rt2x00_set_field16(®, TXRX_CSR2_DROP_NOT_TO_ME,
|
||||
!(*total_flags & FIF_PROMISC_IN_BSS));
|
||||
rt2x00_set_field16(®, TXRX_CSR2_DROP_TODS,
|
||||
!(*total_flags & FIF_PROMISC_IN_BSS));
|
||||
rt2x00_set_field16(®, TXRX_CSR2_DROP_VERSION_ERROR, 1);
|
||||
rt2x00_set_field16(®, TXRX_CSR2_DROP_MULTICAST,
|
||||
!(*total_flags & FIF_ALLMULTI));
|
||||
rt2x00_set_field16(®, TXRX_CSR2_DROP_BROADCAST, 0);
|
||||
rt2500usb_register_write(rt2x00dev, TXRX_CSR2, reg);
|
||||
}
|
||||
|
||||
static int rt2500usb_beacon_update(struct ieee80211_hw *hw,
|
||||
struct sk_buff *skb,
|
||||
struct ieee80211_tx_control *control)
|
||||
|
@ -1821,7 +1773,7 @@ static const struct ieee80211_ops rt2500usb_mac80211_ops = {
|
|||
.remove_interface = rt2x00mac_remove_interface,
|
||||
.config = rt2x00mac_config,
|
||||
.config_interface = rt2x00mac_config_interface,
|
||||
.configure_filter = rt2500usb_configure_filter,
|
||||
.configure_filter = rt2x00mac_configure_filter,
|
||||
.get_stats = rt2x00mac_get_stats,
|
||||
.bss_info_changed = rt2x00mac_bss_info_changed,
|
||||
.conf_tx = rt2x00mac_conf_tx,
|
||||
|
@ -1845,6 +1797,7 @@ static const struct rt2x00lib_ops rt2500usb_rt2x00_ops = {
|
|||
.get_tx_data_len = rt2500usb_get_tx_data_len,
|
||||
.kick_tx_queue = rt2500usb_kick_tx_queue,
|
||||
.fill_rxdone = rt2500usb_fill_rxdone,
|
||||
.config_filter = rt2500usb_config_filter,
|
||||
.config_intf = rt2500usb_config_intf,
|
||||
.config_erp = rt2500usb_config_erp,
|
||||
.config = rt2500usb_config,
|
||||
|
|
|
@ -560,6 +560,8 @@ struct rt2x00lib_ops {
|
|||
/*
|
||||
* Configuration handlers.
|
||||
*/
|
||||
void (*config_filter) (struct rt2x00_dev *rt2x00dev,
|
||||
const unsigned int filter_flags);
|
||||
void (*config_intf) (struct rt2x00_dev *rt2x00dev,
|
||||
struct rt2x00_intf *intf,
|
||||
struct rt2x00intf_conf *conf,
|
||||
|
@ -568,8 +570,8 @@ struct rt2x00lib_ops {
|
|||
#define CONFIG_UPDATE_MAC ( 1 << 2 )
|
||||
#define CONFIG_UPDATE_BSSID ( 1 << 3 )
|
||||
|
||||
int (*config_erp) (struct rt2x00_dev *rt2x00dev,
|
||||
struct rt2x00lib_erp *erp);
|
||||
void (*config_erp) (struct rt2x00_dev *rt2x00dev,
|
||||
struct rt2x00lib_erp *erp);
|
||||
void (*config) (struct rt2x00_dev *rt2x00dev,
|
||||
struct rt2x00lib_conf *libconf,
|
||||
const unsigned int flags);
|
||||
|
@ -624,6 +626,7 @@ enum rt2x00_flags {
|
|||
DRIVER_REQUIRE_FIRMWARE,
|
||||
DRIVER_REQUIRE_BEACON_GUARD,
|
||||
DRIVER_REQUIRE_ATIM_QUEUE,
|
||||
DRIVER_REQUIRE_SCHEDULED,
|
||||
|
||||
/*
|
||||
* Driver configuration
|
||||
|
@ -987,6 +990,10 @@ int rt2x00mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf);
|
|||
int rt2x00mac_config_interface(struct ieee80211_hw *hw,
|
||||
struct ieee80211_vif *vif,
|
||||
struct ieee80211_if_conf *conf);
|
||||
void rt2x00mac_configure_filter(struct ieee80211_hw *hw,
|
||||
unsigned int changed_flags,
|
||||
unsigned int *total_flags,
|
||||
int mc_count, struct dev_addr_list *mc_list);
|
||||
int rt2x00mac_get_stats(struct ieee80211_hw *hw,
|
||||
struct ieee80211_low_level_stats *stats);
|
||||
int rt2x00mac_get_tx_stats(struct ieee80211_hw *hw,
|
||||
|
|
|
@ -80,7 +80,6 @@ void rt2x00lib_config_erp(struct rt2x00_dev *rt2x00dev,
|
|||
struct ieee80211_bss_conf *bss_conf)
|
||||
{
|
||||
struct rt2x00lib_erp erp;
|
||||
int retval;
|
||||
|
||||
memset(&erp, 0, sizeof(erp));
|
||||
|
||||
|
@ -101,14 +100,7 @@ void rt2x00lib_config_erp(struct rt2x00_dev *rt2x00dev,
|
|||
erp.ack_consume_time += PREAMBLE;
|
||||
}
|
||||
|
||||
retval = rt2x00dev->ops->lib->config_erp(rt2x00dev, &erp);
|
||||
|
||||
if (retval) {
|
||||
spin_lock(&intf->lock);
|
||||
intf->delayed_flags |= DELAYED_CONFIG_ERP;
|
||||
queue_work(rt2x00dev->hw->workqueue, &rt2x00dev->intf_work);
|
||||
spin_unlock(&intf->lock);
|
||||
}
|
||||
rt2x00dev->ops->lib->config_erp(rt2x00dev, &erp);
|
||||
}
|
||||
|
||||
void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev,
|
||||
|
|
|
@ -580,19 +580,28 @@ void rt2x00lib_rxdone(struct queue_entry *entry,
|
|||
for (i = 0; i < sband->n_bitrates; i++) {
|
||||
rate = rt2x00_get_rate(sband->bitrates[i].hw_value);
|
||||
|
||||
if ((rxdesc->signal_plcp && rate->plcp == rxdesc->signal) ||
|
||||
(!rxdesc->signal_plcp && rate->bitrate == rxdesc->signal)) {
|
||||
if (((rxdesc->dev_flags & RXDONE_SIGNAL_PLCP) &&
|
||||
(rate->plcp == rxdesc->signal)) ||
|
||||
(!(rxdesc->dev_flags & RXDONE_SIGNAL_PLCP) &&
|
||||
(rate->bitrate == rxdesc->signal))) {
|
||||
idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (idx < 0) {
|
||||
WARNING(rt2x00dev, "Frame received with unrecognized signal,"
|
||||
"signal=0x%.2x, plcp=%d.\n", rxdesc->signal,
|
||||
!!(rxdesc->dev_flags & RXDONE_SIGNAL_PLCP));
|
||||
idx = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Only update link status if this is a beacon frame carrying our bssid.
|
||||
*/
|
||||
hdr = (struct ieee80211_hdr *)entry->skb->data;
|
||||
fc = le16_to_cpu(hdr->frame_control);
|
||||
if (is_beacon(fc) && rxdesc->my_bss)
|
||||
if (is_beacon(fc) && (rxdesc->dev_flags & RXDONE_MY_BSS))
|
||||
rt2x00lib_update_link_stats(&rt2x00dev->link, rxdesc->rssi);
|
||||
|
||||
rt2x00dev->link.qual.rx_success++;
|
||||
|
|
|
@ -380,6 +380,50 @@ int rt2x00mac_config_interface(struct ieee80211_hw *hw,
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(rt2x00mac_config_interface);
|
||||
|
||||
void rt2x00mac_configure_filter(struct ieee80211_hw *hw,
|
||||
unsigned int changed_flags,
|
||||
unsigned int *total_flags,
|
||||
int mc_count, struct dev_addr_list *mc_list)
|
||||
{
|
||||
struct rt2x00_dev *rt2x00dev = hw->priv;
|
||||
|
||||
/*
|
||||
* Mask off any flags we are going to ignore
|
||||
* from the total_flags field.
|
||||
*/
|
||||
*total_flags &=
|
||||
FIF_ALLMULTI |
|
||||
FIF_FCSFAIL |
|
||||
FIF_PLCPFAIL |
|
||||
FIF_CONTROL |
|
||||
FIF_OTHER_BSS |
|
||||
FIF_PROMISC_IN_BSS;
|
||||
|
||||
/*
|
||||
* Apply some rules to the filters:
|
||||
* - Some filters imply different filters to be set.
|
||||
* - Some things we can't filter out at all.
|
||||
* - Multicast filter seems to kill broadcast traffic so never use it.
|
||||
*/
|
||||
*total_flags |= FIF_ALLMULTI;
|
||||
if (*total_flags & FIF_OTHER_BSS ||
|
||||
*total_flags & FIF_PROMISC_IN_BSS)
|
||||
*total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS;
|
||||
|
||||
/*
|
||||
* Check if there is any work left for us.
|
||||
*/
|
||||
if (rt2x00dev->packet_filter == *total_flags)
|
||||
return;
|
||||
rt2x00dev->packet_filter = *total_flags;
|
||||
|
||||
if (!test_bit(DRIVER_REQUIRE_SCHEDULED, &rt2x00dev->flags))
|
||||
queue_work(rt2x00dev->hw->workqueue, &rt2x00dev->filter_work);
|
||||
else
|
||||
rt2x00dev->ops->lib->config_filter(rt2x00dev, *total_flags);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rt2x00mac_configure_filter);
|
||||
|
||||
int rt2x00mac_get_stats(struct ieee80211_hw *hw,
|
||||
struct ieee80211_low_level_stats *stats)
|
||||
{
|
||||
|
@ -419,6 +463,7 @@ void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw,
|
|||
{
|
||||
struct rt2x00_dev *rt2x00dev = hw->priv;
|
||||
struct rt2x00_intf *intf = vif_to_intf(vif);
|
||||
unsigned int delayed = 0;
|
||||
|
||||
/*
|
||||
* When the association status has changed we must reset the link
|
||||
|
@ -439,11 +484,19 @@ void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw,
|
|||
* When the erp information has changed, we should perform
|
||||
* additional configuration steps. For all other changes we are done.
|
||||
*/
|
||||
if (changes & BSS_CHANGED_ERP_PREAMBLE)
|
||||
rt2x00lib_config_erp(rt2x00dev, intf, bss_conf);
|
||||
if (changes & BSS_CHANGED_ERP_PREAMBLE) {
|
||||
if (!test_bit(DRIVER_REQUIRE_SCHEDULED, &rt2x00dev->flags))
|
||||
rt2x00lib_config_erp(rt2x00dev, intf, bss_conf);
|
||||
else
|
||||
delayed |= DELAYED_CONFIG_ERP;
|
||||
}
|
||||
|
||||
spin_lock(&intf->lock);
|
||||
memcpy(&intf->conf, bss_conf, sizeof(*bss_conf));
|
||||
if (delayed) {
|
||||
intf->delayed_flags |= delayed;
|
||||
queue_work(rt2x00dev->hw->workqueue, &rt2x00dev->intf_work);
|
||||
}
|
||||
spin_unlock(&intf->lock);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rt2x00mac_bss_info_changed);
|
||||
|
|
|
@ -128,28 +128,36 @@ static inline struct skb_frame_desc* get_skb_frame_desc(struct sk_buff *skb)
|
|||
return (struct skb_frame_desc *)&skb->cb[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* enum rxdone_entry_desc_flags: Flags for &struct rxdone_entry_desc
|
||||
*
|
||||
* @RXDONE_SIGNAL_PLCP: Does the signal field contain the plcp value,
|
||||
* or does it contain the bitrate itself.
|
||||
* @RXDONE_MY_BSS: Does this frame originate from device's BSS.
|
||||
*/
|
||||
enum rxdone_entry_desc_flags {
|
||||
RXDONE_SIGNAL_PLCP = 1 << 0,
|
||||
RXDONE_MY_BSS = 1 << 1,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct rxdone_entry_desc: RX Entry descriptor
|
||||
*
|
||||
* Summary of information that has been read from the RX frame descriptor.
|
||||
*
|
||||
* @signal: Signal of the received frame.
|
||||
* @signal_plcp: Does the signal field contain the plcp value,
|
||||
* or does it contain the bitrate itself.
|
||||
* @rssi: RSSI of the received frame.
|
||||
* @ofdm: Was frame send with an OFDM rate.
|
||||
* @size: Data size of the received frame.
|
||||
* @flags: MAC80211 receive flags (See &enum mac80211_rx_flags).
|
||||
* @my_bss: Does this frame originate from device's BSS.
|
||||
* @dev_flags: Ralink receive flags (See &enum rxdone_entry_desc_flags).
|
||||
|
||||
*/
|
||||
struct rxdone_entry_desc {
|
||||
int signal;
|
||||
int signal_plcp;
|
||||
int rssi;
|
||||
int ofdm;
|
||||
int size;
|
||||
int flags;
|
||||
int my_bss;
|
||||
int dev_flags;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -321,6 +321,37 @@ static void rt61pci_led_brightness(struct led_classdev *led_cdev,
|
|||
/*
|
||||
* Configuration handlers.
|
||||
*/
|
||||
static void rt61pci_config_filter(struct rt2x00_dev *rt2x00dev,
|
||||
const unsigned int filter_flags)
|
||||
{
|
||||
u32 reg;
|
||||
|
||||
/*
|
||||
* Start configuration steps.
|
||||
* Note that the version error will always be dropped
|
||||
* and broadcast frames will always be accepted since
|
||||
* there is no filter for it at this time.
|
||||
*/
|
||||
rt2x00pci_register_read(rt2x00dev, TXRX_CSR0, ®);
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_CRC,
|
||||
!(filter_flags & FIF_FCSFAIL));
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_PHYSICAL,
|
||||
!(filter_flags & FIF_PLCPFAIL));
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_CONTROL,
|
||||
!(filter_flags & FIF_CONTROL));
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_NOT_TO_ME,
|
||||
!(filter_flags & FIF_PROMISC_IN_BSS));
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_TO_DS,
|
||||
!(filter_flags & FIF_PROMISC_IN_BSS));
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_VERSION_ERROR, 1);
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_MULTICAST,
|
||||
!(filter_flags & FIF_ALLMULTI));
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_BROADCAST, 0);
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_ACK_CTS,
|
||||
!(filter_flags & FIF_CONTROL));
|
||||
rt2x00pci_register_write(rt2x00dev, TXRX_CSR0, reg);
|
||||
}
|
||||
|
||||
static void rt61pci_config_intf(struct rt2x00_dev *rt2x00dev,
|
||||
struct rt2x00_intf *intf,
|
||||
struct rt2x00intf_conf *conf,
|
||||
|
@ -368,8 +399,8 @@ static void rt61pci_config_intf(struct rt2x00_dev *rt2x00dev,
|
|||
}
|
||||
}
|
||||
|
||||
static int rt61pci_config_erp(struct rt2x00_dev *rt2x00dev,
|
||||
struct rt2x00lib_erp *erp)
|
||||
static void rt61pci_config_erp(struct rt2x00_dev *rt2x00dev,
|
||||
struct rt2x00lib_erp *erp)
|
||||
{
|
||||
u32 reg;
|
||||
|
||||
|
@ -381,8 +412,6 @@ static int rt61pci_config_erp(struct rt2x00_dev *rt2x00dev,
|
|||
rt2x00_set_field32(®, TXRX_CSR4_AUTORESPOND_PREAMBLE,
|
||||
!!erp->short_preamble);
|
||||
rt2x00pci_register_write(rt2x00dev, TXRX_CSR4, reg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void rt61pci_config_phymode(struct rt2x00_dev *rt2x00dev,
|
||||
|
@ -1649,12 +1678,15 @@ static void rt61pci_fill_rxdone(struct queue_entry *entry,
|
|||
* the signal is the PLCP value. If it was received with
|
||||
* a CCK bitrate the signal is the rate in 100kbit/s.
|
||||
*/
|
||||
rxdesc->ofdm = rt2x00_get_field32(word0, RXD_W0_OFDM);
|
||||
rxdesc->signal = rt2x00_get_field32(word1, RXD_W1_SIGNAL);
|
||||
rxdesc->signal_plcp = rxdesc->ofdm;
|
||||
rxdesc->rssi = rt61pci_agc_to_rssi(entry->queue->rt2x00dev, word1);
|
||||
rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT);
|
||||
rxdesc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS);
|
||||
|
||||
rxdesc->dev_flags = 0;
|
||||
if (rt2x00_get_field32(word0, RXD_W0_OFDM))
|
||||
rxdesc->dev_flags |= RXDONE_SIGNAL_PLCP;
|
||||
if (rt2x00_get_field32(word0, RXD_W0_MY_BSS))
|
||||
rxdesc->dev_flags |= RXDONE_MY_BSS;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2281,71 +2313,6 @@ static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev)
|
|||
/*
|
||||
* IEEE80211 stack callback functions.
|
||||
*/
|
||||
static void rt61pci_configure_filter(struct ieee80211_hw *hw,
|
||||
unsigned int changed_flags,
|
||||
unsigned int *total_flags,
|
||||
int mc_count,
|
||||
struct dev_addr_list *mc_list)
|
||||
{
|
||||
struct rt2x00_dev *rt2x00dev = hw->priv;
|
||||
u32 reg;
|
||||
|
||||
/*
|
||||
* Mask off any flags we are going to ignore from
|
||||
* the total_flags field.
|
||||
*/
|
||||
*total_flags &=
|
||||
FIF_ALLMULTI |
|
||||
FIF_FCSFAIL |
|
||||
FIF_PLCPFAIL |
|
||||
FIF_CONTROL |
|
||||
FIF_OTHER_BSS |
|
||||
FIF_PROMISC_IN_BSS;
|
||||
|
||||
/*
|
||||
* Apply some rules to the filters:
|
||||
* - Some filters imply different filters to be set.
|
||||
* - Some things we can't filter out at all.
|
||||
* - Multicast filter seems to kill broadcast traffic so never use it.
|
||||
*/
|
||||
*total_flags |= FIF_ALLMULTI;
|
||||
if (*total_flags & FIF_OTHER_BSS ||
|
||||
*total_flags & FIF_PROMISC_IN_BSS)
|
||||
*total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS;
|
||||
|
||||
/*
|
||||
* Check if there is any work left for us.
|
||||
*/
|
||||
if (rt2x00dev->packet_filter == *total_flags)
|
||||
return;
|
||||
rt2x00dev->packet_filter = *total_flags;
|
||||
|
||||
/*
|
||||
* Start configuration steps.
|
||||
* Note that the version error will always be dropped
|
||||
* and broadcast frames will always be accepted since
|
||||
* there is no filter for it at this time.
|
||||
*/
|
||||
rt2x00pci_register_read(rt2x00dev, TXRX_CSR0, ®);
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_CRC,
|
||||
!(*total_flags & FIF_FCSFAIL));
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_PHYSICAL,
|
||||
!(*total_flags & FIF_PLCPFAIL));
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_CONTROL,
|
||||
!(*total_flags & FIF_CONTROL));
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_NOT_TO_ME,
|
||||
!(*total_flags & FIF_PROMISC_IN_BSS));
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_TO_DS,
|
||||
!(*total_flags & FIF_PROMISC_IN_BSS));
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_VERSION_ERROR, 1);
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_MULTICAST,
|
||||
!(*total_flags & FIF_ALLMULTI));
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_BROADCAST, 0);
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_ACK_CTS,
|
||||
!(*total_flags & FIF_CONTROL));
|
||||
rt2x00pci_register_write(rt2x00dev, TXRX_CSR0, reg);
|
||||
}
|
||||
|
||||
static int rt61pci_set_retry_limit(struct ieee80211_hw *hw,
|
||||
u32 short_retry, u32 long_retry)
|
||||
{
|
||||
|
@ -2454,7 +2421,7 @@ static const struct ieee80211_ops rt61pci_mac80211_ops = {
|
|||
.remove_interface = rt2x00mac_remove_interface,
|
||||
.config = rt2x00mac_config,
|
||||
.config_interface = rt2x00mac_config_interface,
|
||||
.configure_filter = rt61pci_configure_filter,
|
||||
.configure_filter = rt2x00mac_configure_filter,
|
||||
.get_stats = rt2x00mac_get_stats,
|
||||
.set_retry_limit = rt61pci_set_retry_limit,
|
||||
.bss_info_changed = rt2x00mac_bss_info_changed,
|
||||
|
@ -2484,6 +2451,7 @@ static const struct rt2x00lib_ops rt61pci_rt2x00_ops = {
|
|||
.write_tx_data = rt2x00pci_write_tx_data,
|
||||
.kick_tx_queue = rt61pci_kick_tx_queue,
|
||||
.fill_rxdone = rt61pci_fill_rxdone,
|
||||
.config_filter = rt61pci_config_filter,
|
||||
.config_intf = rt61pci_config_intf,
|
||||
.config_erp = rt61pci_config_erp,
|
||||
.config = rt61pci_config,
|
||||
|
|
|
@ -333,6 +333,37 @@ static void rt73usb_led_brightness(struct led_classdev *led_cdev,
|
|||
/*
|
||||
* Configuration handlers.
|
||||
*/
|
||||
static void rt73usb_config_filter(struct rt2x00_dev *rt2x00dev,
|
||||
const unsigned int filter_flags)
|
||||
{
|
||||
u32 reg;
|
||||
|
||||
/*
|
||||
* Start configuration steps.
|
||||
* Note that the version error will always be dropped
|
||||
* and broadcast frames will always be accepted since
|
||||
* there is no filter for it at this time.
|
||||
*/
|
||||
rt73usb_register_read(rt2x00dev, TXRX_CSR0, ®);
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_CRC,
|
||||
!(filter_flags & FIF_FCSFAIL));
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_PHYSICAL,
|
||||
!(filter_flags & FIF_PLCPFAIL));
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_CONTROL,
|
||||
!(filter_flags & FIF_CONTROL));
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_NOT_TO_ME,
|
||||
!(filter_flags & FIF_PROMISC_IN_BSS));
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_TO_DS,
|
||||
!(filter_flags & FIF_PROMISC_IN_BSS));
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_VERSION_ERROR, 1);
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_MULTICAST,
|
||||
!(filter_flags & FIF_ALLMULTI));
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_BROADCAST, 0);
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_ACK_CTS,
|
||||
!(filter_flags & FIF_CONTROL));
|
||||
rt73usb_register_write(rt2x00dev, TXRX_CSR0, reg);
|
||||
}
|
||||
|
||||
static void rt73usb_config_intf(struct rt2x00_dev *rt2x00dev,
|
||||
struct rt2x00_intf *intf,
|
||||
struct rt2x00intf_conf *conf,
|
||||
|
@ -380,18 +411,11 @@ static void rt73usb_config_intf(struct rt2x00_dev *rt2x00dev,
|
|||
}
|
||||
}
|
||||
|
||||
static int rt73usb_config_erp(struct rt2x00_dev *rt2x00dev,
|
||||
struct rt2x00lib_erp *erp)
|
||||
static void rt73usb_config_erp(struct rt2x00_dev *rt2x00dev,
|
||||
struct rt2x00lib_erp *erp)
|
||||
{
|
||||
u32 reg;
|
||||
|
||||
/*
|
||||
* When in atomic context, we should let rt2x00lib
|
||||
* try this configuration again later.
|
||||
*/
|
||||
if (in_atomic())
|
||||
return -EAGAIN;
|
||||
|
||||
rt73usb_register_read(rt2x00dev, TXRX_CSR0, ®);
|
||||
rt2x00_set_field32(®, TXRX_CSR0_RX_ACK_TIMEOUT, erp->ack_timeout);
|
||||
rt73usb_register_write(rt2x00dev, TXRX_CSR0, reg);
|
||||
|
@ -400,8 +424,6 @@ static int rt73usb_config_erp(struct rt2x00_dev *rt2x00dev,
|
|||
rt2x00_set_field32(®, TXRX_CSR4_AUTORESPOND_PREAMBLE,
|
||||
!!erp->short_preamble);
|
||||
rt73usb_register_write(rt2x00dev, TXRX_CSR4, reg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void rt73usb_config_phymode(struct rt2x00_dev *rt2x00dev,
|
||||
|
@ -1409,12 +1431,15 @@ static void rt73usb_fill_rxdone(struct queue_entry *entry,
|
|||
* the signal is the PLCP value. If it was received with
|
||||
* a CCK bitrate the signal is the rate in 100kbit/s.
|
||||
*/
|
||||
rxdesc->ofdm = rt2x00_get_field32(word0, RXD_W0_OFDM);
|
||||
rxdesc->signal = rt2x00_get_field32(word1, RXD_W1_SIGNAL);
|
||||
rxdesc->signal_plcp = rxdesc->ofdm;
|
||||
rxdesc->rssi = rt73usb_agc_to_rssi(entry->queue->rt2x00dev, word1);
|
||||
rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT);
|
||||
rxdesc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS);
|
||||
|
||||
rxdesc->dev_flags = 0;
|
||||
if (rt2x00_get_field32(word0, RXD_W0_OFDM))
|
||||
rxdesc->dev_flags |= RXDONE_SIGNAL_PLCP;
|
||||
if (rt2x00_get_field32(word0, RXD_W0_MY_BSS))
|
||||
rxdesc->dev_flags |= RXDONE_MY_BSS;
|
||||
|
||||
/*
|
||||
* Adjust the skb memory window to the frame boundaries.
|
||||
|
@ -1869,6 +1894,7 @@ static int rt73usb_probe_hw(struct rt2x00_dev *rt2x00dev)
|
|||
* This device requires firmware.
|
||||
*/
|
||||
__set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags);
|
||||
__set_bit(DRIVER_REQUIRE_SCHEDULED, &rt2x00dev->flags);
|
||||
|
||||
/*
|
||||
* Set the rssi offset.
|
||||
|
@ -1881,80 +1907,6 @@ static int rt73usb_probe_hw(struct rt2x00_dev *rt2x00dev)
|
|||
/*
|
||||
* IEEE80211 stack callback functions.
|
||||
*/
|
||||
static void rt73usb_configure_filter(struct ieee80211_hw *hw,
|
||||
unsigned int changed_flags,
|
||||
unsigned int *total_flags,
|
||||
int mc_count,
|
||||
struct dev_addr_list *mc_list)
|
||||
{
|
||||
struct rt2x00_dev *rt2x00dev = hw->priv;
|
||||
u32 reg;
|
||||
|
||||
/*
|
||||
* Mask off any flags we are going to ignore from
|
||||
* the total_flags field.
|
||||
*/
|
||||
*total_flags &=
|
||||
FIF_ALLMULTI |
|
||||
FIF_FCSFAIL |
|
||||
FIF_PLCPFAIL |
|
||||
FIF_CONTROL |
|
||||
FIF_OTHER_BSS |
|
||||
FIF_PROMISC_IN_BSS;
|
||||
|
||||
/*
|
||||
* Apply some rules to the filters:
|
||||
* - Some filters imply different filters to be set.
|
||||
* - Some things we can't filter out at all.
|
||||
* - Multicast filter seems to kill broadcast traffic so never use it.
|
||||
*/
|
||||
*total_flags |= FIF_ALLMULTI;
|
||||
if (*total_flags & FIF_OTHER_BSS ||
|
||||
*total_flags & FIF_PROMISC_IN_BSS)
|
||||
*total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS;
|
||||
|
||||
/*
|
||||
* Check if there is any work left for us.
|
||||
*/
|
||||
if (rt2x00dev->packet_filter == *total_flags)
|
||||
return;
|
||||
rt2x00dev->packet_filter = *total_flags;
|
||||
|
||||
/*
|
||||
* When in atomic context, reschedule and let rt2x00lib
|
||||
* call this function again.
|
||||
*/
|
||||
if (in_atomic()) {
|
||||
queue_work(rt2x00dev->hw->workqueue, &rt2x00dev->filter_work);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Start configuration steps.
|
||||
* Note that the version error will always be dropped
|
||||
* and broadcast frames will always be accepted since
|
||||
* there is no filter for it at this time.
|
||||
*/
|
||||
rt73usb_register_read(rt2x00dev, TXRX_CSR0, ®);
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_CRC,
|
||||
!(*total_flags & FIF_FCSFAIL));
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_PHYSICAL,
|
||||
!(*total_flags & FIF_PLCPFAIL));
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_CONTROL,
|
||||
!(*total_flags & FIF_CONTROL));
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_NOT_TO_ME,
|
||||
!(*total_flags & FIF_PROMISC_IN_BSS));
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_TO_DS,
|
||||
!(*total_flags & FIF_PROMISC_IN_BSS));
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_VERSION_ERROR, 1);
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_MULTICAST,
|
||||
!(*total_flags & FIF_ALLMULTI));
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_BROADCAST, 0);
|
||||
rt2x00_set_field32(®, TXRX_CSR0_DROP_ACK_CTS,
|
||||
!(*total_flags & FIF_CONTROL));
|
||||
rt73usb_register_write(rt2x00dev, TXRX_CSR0, reg);
|
||||
}
|
||||
|
||||
static int rt73usb_set_retry_limit(struct ieee80211_hw *hw,
|
||||
u32 short_retry, u32 long_retry)
|
||||
{
|
||||
|
@ -2064,7 +2016,7 @@ static const struct ieee80211_ops rt73usb_mac80211_ops = {
|
|||
.remove_interface = rt2x00mac_remove_interface,
|
||||
.config = rt2x00mac_config,
|
||||
.config_interface = rt2x00mac_config_interface,
|
||||
.configure_filter = rt73usb_configure_filter,
|
||||
.configure_filter = rt2x00mac_configure_filter,
|
||||
.get_stats = rt2x00mac_get_stats,
|
||||
.set_retry_limit = rt73usb_set_retry_limit,
|
||||
.bss_info_changed = rt2x00mac_bss_info_changed,
|
||||
|
@ -2093,6 +2045,7 @@ static const struct rt2x00lib_ops rt73usb_rt2x00_ops = {
|
|||
.get_tx_data_len = rt73usb_get_tx_data_len,
|
||||
.kick_tx_queue = rt73usb_kick_tx_queue,
|
||||
.fill_rxdone = rt73usb_fill_rxdone,
|
||||
.config_filter = rt73usb_config_filter,
|
||||
.config_intf = rt73usb_config_intf,
|
||||
.config_erp = rt73usb_config_erp,
|
||||
.config = rt73usb_config,
|
||||
|
|
|
@ -643,6 +643,21 @@ enum sta_notify_cmd {
|
|||
STA_NOTIFY_ADD, STA_NOTIFY_REMOVE
|
||||
};
|
||||
|
||||
/**
|
||||
* enum ieee80211_tkip_key_type - get tkip key
|
||||
*
|
||||
* Used by drivers which need to get a tkip key for skb. Some drivers need a
|
||||
* phase 1 key, others need a phase 2 key. A single function allows the driver
|
||||
* to get the key, this enum indicates what type of key is required.
|
||||
*
|
||||
* @IEEE80211_TKIP_P1_KEY: the driver needs a phase 1 key
|
||||
* @IEEE80211_TKIP_P2_KEY: the driver needs a phase 2 key
|
||||
*/
|
||||
enum ieee80211_tkip_key_type {
|
||||
IEEE80211_TKIP_P1_KEY,
|
||||
IEEE80211_TKIP_P2_KEY,
|
||||
};
|
||||
|
||||
/**
|
||||
* enum ieee80211_hw_flags - hardware flags
|
||||
*
|
||||
|
@ -812,6 +827,16 @@ static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, u8 *addr)
|
|||
* parameter is guaranteed to be valid until another call to set_key()
|
||||
* removes it, but it can only be used as a cookie to differentiate
|
||||
* keys.
|
||||
*
|
||||
* In TKIP some HW need to be provided a phase 1 key, for RX decryption
|
||||
* acceleration (i.e. iwlwifi). Those drivers should provide update_tkip_key
|
||||
* handler.
|
||||
* The update_tkip_key() call updates the driver with the new phase 1 key.
|
||||
* This happens everytime the iv16 wraps around (every 65536 packets). The
|
||||
* set_key() call will happen only once for each key (unless the AP did
|
||||
* rekeying), it will not include a valid phase 1 key. The valid phase 1 key is
|
||||
* provided by udpate_tkip_key only. The trigger that makes mac80211 call this
|
||||
* handler is software decryption with wrap around of iv16.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -988,6 +1013,10 @@ enum ieee80211_ampdu_mlme_action {
|
|||
* and remove_interface calls, i.e. while the interface with the
|
||||
* given local_address is enabled.
|
||||
*
|
||||
* @update_tkip_key: See the section "Hardware crypto acceleration"
|
||||
* This callback will be called in the context of Rx. Called for drivers
|
||||
* which set IEEE80211_KEY_FLAG_TKIP_REQ_RX_P1_KEY.
|
||||
*
|
||||
* @hw_scan: Ask the hardware to service the scan request, no need to start
|
||||
* the scan state machine in stack. The scan must honour the channel
|
||||
* configuration done by the regulatory agent in the wiphy's registered
|
||||
|
@ -1079,6 +1108,9 @@ struct ieee80211_ops {
|
|||
int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd,
|
||||
const u8 *local_address, const u8 *address,
|
||||
struct ieee80211_key_conf *key);
|
||||
void (*update_tkip_key)(struct ieee80211_hw *hw,
|
||||
struct ieee80211_key_conf *conf, const u8 *address,
|
||||
u32 iv32, u16 *phase1key);
|
||||
int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len);
|
||||
int (*get_stats)(struct ieee80211_hw *hw,
|
||||
struct ieee80211_low_level_stats *stats);
|
||||
|
@ -1471,6 +1503,21 @@ int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
|
|||
*/
|
||||
int ieee80211_get_hdrlen(u16 fc);
|
||||
|
||||
/**
|
||||
* ieee80211_get_tkip_key - get a TKIP rc4 for skb
|
||||
*
|
||||
* This function computes a TKIP rc4 key for an skb. It computes
|
||||
* a phase 1 key if needed (iv16 wraps around). This function is to
|
||||
* be used by drivers which can do HW encryption but need to compute
|
||||
* to phase 1/2 key in SW.
|
||||
*
|
||||
* @keyconf: the parameter passed with the set key
|
||||
* @skb: the skb for which the key is needed
|
||||
* @rc4key: a buffer to which the key will be written
|
||||
*/
|
||||
void ieee80211_get_tkip_key(struct ieee80211_key_conf *keyconf,
|
||||
struct sk_buff *skb,
|
||||
enum ieee80211_tkip_key_type type, u8 *key);
|
||||
/**
|
||||
* ieee80211_wake_queue - wake specific queue
|
||||
* @hw: pointer as obtained from ieee80211_alloc_hw().
|
||||
|
|
|
@ -304,4 +304,10 @@ extern int ieee80211_channel_to_frequency(int chan);
|
|||
*/
|
||||
extern int ieee80211_frequency_to_channel(int freq);
|
||||
|
||||
/**
|
||||
* ieee80211_get_channel - get channel struct from wiphy for specified frequency
|
||||
*/
|
||||
extern struct ieee80211_channel *ieee80211_get_channel(struct wiphy *wiphy,
|
||||
int freq);
|
||||
|
||||
#endif /* __NET_WIRELESS_H */
|
||||
|
|
|
@ -386,7 +386,6 @@ static int ieee80211_stop(struct net_device *dev)
|
|||
struct ieee80211_local *local = sdata->local;
|
||||
struct ieee80211_if_init_conf conf;
|
||||
struct sta_info *sta;
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Stop TX on this interface first.
|
||||
|
@ -400,11 +399,7 @@ static int ieee80211_stop(struct net_device *dev)
|
|||
|
||||
list_for_each_entry_rcu(sta, &local->sta_list, list) {
|
||||
if (sta->sdata == sdata)
|
||||
for (i = 0; i < STA_TID_NUM; i++)
|
||||
ieee80211_sta_stop_rx_ba_session(sdata->dev,
|
||||
sta->addr, i,
|
||||
WLAN_BACK_RECIPIENT,
|
||||
WLAN_REASON_QSTA_LEAVE_QBSS);
|
||||
ieee80211_sta_tear_down_BA_sessions(dev, sta->addr);
|
||||
}
|
||||
|
||||
rcu_read_unlock();
|
||||
|
|
|
@ -928,10 +928,12 @@ void ieee80211_send_addba_request(struct net_device *dev, const u8 *da,
|
|||
u16 agg_size, u16 timeout);
|
||||
void ieee80211_send_delba(struct net_device *dev, const u8 *da, u16 tid,
|
||||
u16 initiator, u16 reason_code);
|
||||
|
||||
void ieee80211_sta_stop_rx_ba_session(struct net_device *dev, u8 *da,
|
||||
u16 tid, u16 initiator, u16 reason);
|
||||
void sta_rx_agg_session_timer_expired(unsigned long data);
|
||||
void sta_addba_resp_timer_expired(unsigned long data);
|
||||
void ieee80211_sta_tear_down_BA_sessions(struct net_device *dev, u8 *addr);
|
||||
u64 ieee80211_sta_get_rates(struct ieee80211_local *local,
|
||||
struct ieee802_11_elems *elems,
|
||||
enum ieee80211_band band);
|
||||
|
|
|
@ -279,36 +279,15 @@ static int ieee80211_ioctl_giwmode(struct net_device *dev,
|
|||
|
||||
int ieee80211_set_freq(struct ieee80211_local *local, int freqMHz)
|
||||
{
|
||||
int set = 0;
|
||||
int ret = -EINVAL;
|
||||
enum ieee80211_band band;
|
||||
struct ieee80211_supported_band *sband;
|
||||
int i;
|
||||
struct ieee80211_channel *chan;
|
||||
|
||||
for (band = 0; band < IEEE80211_NUM_BANDS; band ++) {
|
||||
sband = local->hw.wiphy->bands[band];
|
||||
chan = ieee80211_get_channel(local->hw.wiphy, freqMHz);
|
||||
|
||||
if (!sband)
|
||||
continue;
|
||||
if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) {
|
||||
local->oper_channel = chan;
|
||||
|
||||
for (i = 0; i < sband->n_channels; i++) {
|
||||
struct ieee80211_channel *chan = &sband->channels[i];
|
||||
|
||||
if (chan->flags & IEEE80211_CHAN_DISABLED)
|
||||
continue;
|
||||
|
||||
if (chan->center_freq == freqMHz) {
|
||||
set = 1;
|
||||
local->oper_channel = chan;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (set)
|
||||
break;
|
||||
}
|
||||
|
||||
if (set) {
|
||||
if (local->sta_sw_scanning)
|
||||
if (local->sta_sw_scanning || local->sta_hw_scanning)
|
||||
ret = 0;
|
||||
else
|
||||
ret = ieee80211_hw_config(local);
|
||||
|
|
|
@ -220,6 +220,61 @@ static int ecw2cw(int ecw)
|
|||
return (1 << ecw) - 1;
|
||||
}
|
||||
|
||||
|
||||
static void ieee80211_sta_def_wmm_params(struct net_device *dev,
|
||||
struct ieee80211_sta_bss *bss,
|
||||
int ibss)
|
||||
{
|
||||
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
|
||||
struct ieee80211_local *local = sdata->local;
|
||||
int i, have_higher_than_11mbit = 0;
|
||||
|
||||
|
||||
/* cf. IEEE 802.11 9.2.12 */
|
||||
for (i = 0; i < bss->supp_rates_len; i++)
|
||||
if ((bss->supp_rates[i] & 0x7f) * 5 > 110)
|
||||
have_higher_than_11mbit = 1;
|
||||
|
||||
if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ &&
|
||||
have_higher_than_11mbit)
|
||||
sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE;
|
||||
else
|
||||
sdata->flags &= ~IEEE80211_SDATA_OPERATING_GMODE;
|
||||
|
||||
|
||||
if (local->ops->conf_tx) {
|
||||
struct ieee80211_tx_queue_params qparam;
|
||||
int i;
|
||||
|
||||
memset(&qparam, 0, sizeof(qparam));
|
||||
|
||||
qparam.aifs = 2;
|
||||
|
||||
if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ &&
|
||||
!(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE))
|
||||
qparam.cw_min = 31;
|
||||
else
|
||||
qparam.cw_min = 15;
|
||||
|
||||
qparam.cw_max = 1023;
|
||||
qparam.txop = 0;
|
||||
|
||||
for (i = IEEE80211_TX_QUEUE_DATA0; i < NUM_TX_DATA_QUEUES; i++)
|
||||
local->ops->conf_tx(local_to_hw(local),
|
||||
i + IEEE80211_TX_QUEUE_DATA0,
|
||||
&qparam);
|
||||
|
||||
if (ibss) {
|
||||
/* IBSS uses different parameters for Beacon sending */
|
||||
qparam.cw_min++;
|
||||
qparam.cw_min *= 2;
|
||||
qparam.cw_min--;
|
||||
local->ops->conf_tx(local_to_hw(local),
|
||||
IEEE80211_TX_QUEUE_BEACON, &qparam);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ieee80211_sta_wmm_params(struct net_device *dev,
|
||||
struct ieee80211_if_sta *ifsta,
|
||||
u8 *wmm_param, size_t wmm_param_len)
|
||||
|
@ -467,8 +522,8 @@ static void ieee80211_set_associated(struct net_device *dev,
|
|||
memcpy(wrqu.ap_addr.sa_data, sdata->u.sta.bssid, ETH_ALEN);
|
||||
ieee80211_sta_send_associnfo(dev, ifsta);
|
||||
} else {
|
||||
ieee80211_sta_tear_down_BA_sessions(dev, ifsta->bssid);
|
||||
ifsta->flags &= ~IEEE80211_STA_ASSOCIATED;
|
||||
|
||||
netif_carrier_off(dev);
|
||||
ieee80211_reset_erp_info(dev);
|
||||
memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN);
|
||||
|
@ -1145,7 +1200,7 @@ static void ieee80211_sta_process_addba_request(struct net_device *dev,
|
|||
status = WLAN_STATUS_INVALID_QOS_PARAM;
|
||||
#ifdef CONFIG_MAC80211_HT_DEBUG
|
||||
if (net_ratelimit())
|
||||
printk(KERN_DEBUG "Block Ack Req with bad params from "
|
||||
printk(KERN_DEBUG "AddBA Req with bad params from "
|
||||
"%s on tid %u. policy %d, buffer size %d\n",
|
||||
print_mac(mac, mgmt->sa), tid, ba_policy,
|
||||
buf_size);
|
||||
|
@ -1169,7 +1224,7 @@ static void ieee80211_sta_process_addba_request(struct net_device *dev,
|
|||
if (tid_agg_rx->state != HT_AGG_STATE_IDLE) {
|
||||
#ifdef CONFIG_MAC80211_HT_DEBUG
|
||||
if (net_ratelimit())
|
||||
printk(KERN_DEBUG "unexpected Block Ack Req from "
|
||||
printk(KERN_DEBUG "unexpected AddBA Req from "
|
||||
"%s on tid %u\n",
|
||||
print_mac(mac, mgmt->sa), tid);
|
||||
#endif /* CONFIG_MAC80211_HT_DEBUG */
|
||||
|
@ -1427,7 +1482,7 @@ static void ieee80211_sta_process_delba(struct net_device *dev,
|
|||
if (net_ratelimit())
|
||||
printk(KERN_DEBUG "delba from %s (%s) tid %d reason code %d\n",
|
||||
print_mac(mac, mgmt->sa),
|
||||
initiator ? "recipient" : "initiator", tid,
|
||||
initiator ? "initiator" : "recipient", tid,
|
||||
mgmt->u.action.u.delba.reason_code);
|
||||
#endif /* CONFIG_MAC80211_HT_DEBUG */
|
||||
|
||||
|
@ -1497,8 +1552,8 @@ timer_expired_exit:
|
|||
}
|
||||
|
||||
/*
|
||||
* After receiving Block Ack Request (BAR) we activated a
|
||||
* timer after each frame arrives from the originator.
|
||||
* After accepting the AddBA Request we activated a timer,
|
||||
* resetting it after each frame that arrives from the originator.
|
||||
* if this timer expires ieee80211_sta_stop_rx_ba_session will be executed.
|
||||
*/
|
||||
void sta_rx_agg_session_timer_expired(unsigned long data)
|
||||
|
@ -1518,6 +1573,19 @@ void sta_rx_agg_session_timer_expired(unsigned long data)
|
|||
WLAN_REASON_QSTA_TIMEOUT);
|
||||
}
|
||||
|
||||
void ieee80211_sta_tear_down_BA_sessions(struct net_device *dev, u8 *addr)
|
||||
{
|
||||
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < STA_TID_NUM; i++) {
|
||||
ieee80211_stop_tx_ba_session(&local->hw, addr, i,
|
||||
WLAN_BACK_INITIATOR);
|
||||
ieee80211_sta_stop_rx_ba_session(dev, addr, i,
|
||||
WLAN_BACK_RECIPIENT,
|
||||
WLAN_REASON_QSTA_LEAVE_QBSS);
|
||||
}
|
||||
}
|
||||
|
||||
static void ieee80211_rx_mgmt_auth(struct net_device *dev,
|
||||
struct ieee80211_if_sta *ifsta,
|
||||
|
@ -2289,6 +2357,8 @@ static int ieee80211_sta_join_ibss(struct net_device *dev,
|
|||
rates |= BIT(j);
|
||||
}
|
||||
ifsta->supp_rates_bits[local->hw.conf.channel->band] = rates;
|
||||
|
||||
ieee80211_sta_def_wmm_params(dev, bss, 1);
|
||||
} while (0);
|
||||
|
||||
if (skb) {
|
||||
|
@ -2356,6 +2426,7 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
|
|||
struct sta_info *sta;
|
||||
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
|
||||
u64 beacon_timestamp, rx_timestamp;
|
||||
struct ieee80211_channel *channel;
|
||||
DECLARE_MAC_BUF(mac);
|
||||
DECLARE_MAC_BUF(mac2);
|
||||
|
||||
|
@ -2420,6 +2491,11 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
|
|||
else
|
||||
freq = rx_status->freq;
|
||||
|
||||
channel = ieee80211_get_channel(local->hw.wiphy, freq);
|
||||
|
||||
if (!channel || channel->flags & IEEE80211_CHAN_DISABLED)
|
||||
return;
|
||||
|
||||
#ifdef CONFIG_MAC80211_MESH
|
||||
if (elems.mesh_config)
|
||||
bss = ieee80211_rx_mesh_bss_get(dev, elems.mesh_id,
|
||||
|
@ -3274,6 +3350,7 @@ static int ieee80211_sta_config_auth(struct net_device *dev,
|
|||
ieee80211_sta_set_ssid(dev, selected->ssid,
|
||||
selected->ssid_len);
|
||||
ieee80211_sta_set_bssid(dev, selected->bssid);
|
||||
ieee80211_sta_def_wmm_params(dev, selected, 0);
|
||||
ieee80211_rx_bss_put(dev, selected);
|
||||
ifsta->state = IEEE80211_AUTHENTICATE;
|
||||
ieee80211_sta_reset_auth(dev, ifsta);
|
||||
|
@ -3448,43 +3525,10 @@ int ieee80211_sta_set_ssid(struct net_device *dev, char *ssid, size_t len)
|
|||
{
|
||||
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
|
||||
struct ieee80211_if_sta *ifsta;
|
||||
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
|
||||
|
||||
if (len > IEEE80211_MAX_SSID_LEN)
|
||||
return -EINVAL;
|
||||
|
||||
/* TODO: This should always be done for IBSS, even if IEEE80211_QOS is
|
||||
* not defined. */
|
||||
if (local->ops->conf_tx) {
|
||||
struct ieee80211_tx_queue_params qparam;
|
||||
int i;
|
||||
|
||||
memset(&qparam, 0, sizeof(qparam));
|
||||
|
||||
qparam.aifs = 2;
|
||||
|
||||
if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ &&
|
||||
!(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE))
|
||||
qparam.cw_min = 31;
|
||||
else
|
||||
qparam.cw_min = 15;
|
||||
|
||||
qparam.cw_max = 1023;
|
||||
qparam.txop = 0;
|
||||
|
||||
for (i = IEEE80211_TX_QUEUE_DATA0; i < NUM_TX_DATA_QUEUES; i++)
|
||||
local->ops->conf_tx(local_to_hw(local),
|
||||
i + IEEE80211_TX_QUEUE_DATA0,
|
||||
&qparam);
|
||||
|
||||
/* IBSS uses different parameters for Beacon sending */
|
||||
qparam.cw_min++;
|
||||
qparam.cw_min *= 2;
|
||||
qparam.cw_min--;
|
||||
local->ops->conf_tx(local_to_hw(local),
|
||||
IEEE80211_TX_QUEUE_BEACON, &qparam);
|
||||
}
|
||||
|
||||
ifsta = &sdata->u.sta;
|
||||
|
||||
if (ifsta->ssid_len != len || memcmp(ifsta->ssid, ssid, len) != 0)
|
||||
|
@ -3596,6 +3640,9 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw)
|
|||
|
||||
if (local->sta_hw_scanning) {
|
||||
local->sta_hw_scanning = 0;
|
||||
if (ieee80211_hw_config(local))
|
||||
printk(KERN_DEBUG "%s: failed to restore operational "
|
||||
"channel after scan\n", dev->name);
|
||||
/* Restart STA timer for HW scan case */
|
||||
rcu_read_lock();
|
||||
list_for_each_entry_rcu(sdata, &local->interfaces, list)
|
||||
|
|
|
@ -214,6 +214,59 @@ void ieee80211_tkip_gen_rc4key(struct ieee80211_key *key, u8 *ta,
|
|||
key->u.tkip.iv16, rc4key);
|
||||
}
|
||||
|
||||
void ieee80211_get_tkip_key(struct ieee80211_key_conf *keyconf,
|
||||
struct sk_buff *skb, enum ieee80211_tkip_key_type type,
|
||||
u8 *outkey)
|
||||
{
|
||||
struct ieee80211_key *key = (struct ieee80211_key *)
|
||||
container_of(keyconf, struct ieee80211_key, conf);
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
|
||||
u8 *data = (u8 *) hdr;
|
||||
u16 fc = le16_to_cpu(hdr->frame_control);
|
||||
int hdr_len = ieee80211_get_hdrlen(fc);
|
||||
u8 *ta = hdr->addr2;
|
||||
u16 iv16;
|
||||
u32 iv32;
|
||||
|
||||
iv16 = data[hdr_len] << 8;
|
||||
iv16 += data[hdr_len + 2];
|
||||
iv32 = data[hdr_len + 4] +
|
||||
(data[hdr_len + 5] >> 8) +
|
||||
(data[hdr_len + 6] >> 16) +
|
||||
(data[hdr_len + 7] >> 24);
|
||||
|
||||
#ifdef CONFIG_TKIP_DEBUG
|
||||
printk(KERN_DEBUG "TKIP encrypt: iv16 = 0x%04x, iv32 = 0x%08x\n",
|
||||
iv16, iv32);
|
||||
|
||||
if (iv32 != key->u.tkip.iv32) {
|
||||
printk(KERN_DEBUG "skb: iv32 = 0x%08x key: iv32 = 0x%08x\n",
|
||||
iv32, key->u.tkip.iv32);
|
||||
printk(KERN_DEBUG "Wrap around of iv16 in the middle of a "
|
||||
"fragmented packet\n");
|
||||
}
|
||||
#endif /* CONFIG_TKIP_DEBUG */
|
||||
|
||||
/* Update the p1k only when the iv16 in the packet wraps around, this
|
||||
* might occur after the wrap around of iv16 in the key in case of
|
||||
* fragmented packets. */
|
||||
if (iv16 == 0 || !key->u.tkip.tx_initialized) {
|
||||
/* IV16 wrapped around - perform TKIP phase 1 */
|
||||
tkip_mixing_phase1(ta, &key->conf.key[ALG_TKIP_TEMP_ENCR_KEY],
|
||||
iv32, key->u.tkip.p1k);
|
||||
key->u.tkip.tx_initialized = 1;
|
||||
}
|
||||
|
||||
if (type == IEEE80211_TKIP_P1_KEY) {
|
||||
memcpy(outkey, key->u.tkip.p1k, sizeof(u16) * 5);
|
||||
return;
|
||||
}
|
||||
|
||||
tkip_mixing_phase2(key->u.tkip.p1k,
|
||||
&key->conf.key[ALG_TKIP_TEMP_ENCR_KEY], iv16, outkey);
|
||||
}
|
||||
EXPORT_SYMBOL(ieee80211_get_tkip_key);
|
||||
|
||||
/* Encrypt packet payload with TKIP using @key. @pos is a pointer to the
|
||||
* beginning of the buffer containing payload. This payload must include
|
||||
* headroom of eight octets for IV and Ext. IV and taildroom of four octets
|
||||
|
@ -238,7 +291,7 @@ void ieee80211_tkip_encrypt_data(struct crypto_blkcipher *tfm,
|
|||
int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm,
|
||||
struct ieee80211_key *key,
|
||||
u8 *payload, size_t payload_len, u8 *ta,
|
||||
int only_iv, int queue,
|
||||
u8 *ra, int only_iv, int queue,
|
||||
u32 *out_iv32, u16 *out_iv16)
|
||||
{
|
||||
u32 iv32;
|
||||
|
@ -315,6 +368,19 @@ int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm,
|
|||
printk("\n");
|
||||
}
|
||||
#endif /* CONFIG_TKIP_DEBUG */
|
||||
if (key->local->ops->update_tkip_key &&
|
||||
key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) {
|
||||
u8 bcast[ETH_ALEN] =
|
||||
{0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
||||
u8 *sta_addr = key->sta->addr;
|
||||
|
||||
if (is_multicast_ether_addr(ra))
|
||||
sta_addr = bcast;
|
||||
|
||||
key->local->ops->update_tkip_key(
|
||||
local_to_hw(key->local), &key->conf,
|
||||
sta_addr, iv32, key->u.tkip.p1k_rx[queue]);
|
||||
}
|
||||
}
|
||||
|
||||
tkip_mixing_phase2(key->u.tkip.p1k_rx[queue],
|
||||
|
|
|
@ -31,7 +31,7 @@ enum {
|
|||
int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm,
|
||||
struct ieee80211_key *key,
|
||||
u8 *payload, size_t payload_len, u8 *ta,
|
||||
int only_iv, int queue,
|
||||
u8 *ra, int only_iv, int queue,
|
||||
u32 *out_iv32, u16 *out_iv16);
|
||||
|
||||
#endif /* TKIP_H */
|
||||
|
|
|
@ -312,7 +312,7 @@ ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx)
|
|||
res = ieee80211_tkip_decrypt_data(rx->local->wep_rx_tfm,
|
||||
key, skb->data + hdrlen,
|
||||
skb->len - hdrlen, rx->sta->addr,
|
||||
hwaccel, rx->queue,
|
||||
hdr->addr1, hwaccel, rx->queue,
|
||||
&rx->tkip_iv32,
|
||||
&rx->tkip_iv16);
|
||||
if (res != TKIP_DECRYPT_OK || wpa_test) {
|
||||
|
|
|
@ -33,6 +33,29 @@ int ieee80211_frequency_to_channel(int freq)
|
|||
}
|
||||
EXPORT_SYMBOL(ieee80211_frequency_to_channel);
|
||||
|
||||
struct ieee80211_channel *ieee80211_get_channel(struct wiphy *wiphy,
|
||||
int freq)
|
||||
{
|
||||
enum ieee80211_band band;
|
||||
struct ieee80211_supported_band *sband;
|
||||
int i;
|
||||
|
||||
for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
|
||||
sband = wiphy->bands[band];
|
||||
|
||||
if (!sband)
|
||||
continue;
|
||||
|
||||
for (i = 0; i < sband->n_channels; i++) {
|
||||
if (sband->channels[i].center_freq == freq)
|
||||
return &sband->channels[i];
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL(ieee80211_get_channel);
|
||||
|
||||
static void set_mandatory_flags_band(struct ieee80211_supported_band *sband,
|
||||
enum ieee80211_band band)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue