Commit e0a8c583 authored by John W. Linville's avatar John W. Linville
parents a508a6ea 04b4d69c
This diff is collapsed.
This diff is collapsed.
...@@ -107,16 +107,6 @@ static unsigned int wl12xx_get_fw_ver_quirks(struct wl1271 *wl) ...@@ -107,16 +107,6 @@ static unsigned int wl12xx_get_fw_ver_quirks(struct wl1271 *wl)
unsigned int quirks = 0; unsigned int quirks = 0;
unsigned int *fw_ver = wl->chip.fw_ver; unsigned int *fw_ver = wl->chip.fw_ver;
/* Only for wl127x */
if ((fw_ver[FW_VER_CHIP] == FW_VER_CHIP_WL127X) &&
/* Check STA version */
(((fw_ver[FW_VER_IF_TYPE] == FW_VER_IF_TYPE_STA) &&
(fw_ver[FW_VER_MINOR] < FW_VER_MINOR_1_SPARE_STA_MIN)) ||
/* Check AP version */
((fw_ver[FW_VER_IF_TYPE] == FW_VER_IF_TYPE_AP) &&
(fw_ver[FW_VER_MINOR] < FW_VER_MINOR_1_SPARE_AP_MIN))))
quirks |= WL12XX_QUIRK_USE_2_SPARE_BLOCKS;
/* Only new station firmwares support routing fw logs to the host */ /* Only new station firmwares support routing fw logs to the host */
if ((fw_ver[FW_VER_IF_TYPE] == FW_VER_IF_TYPE_STA) && if ((fw_ver[FW_VER_IF_TYPE] == FW_VER_IF_TYPE_STA) &&
(fw_ver[FW_VER_MINOR] < FW_VER_MINOR_FWLOG_STA_MIN)) (fw_ver[FW_VER_MINOR] < FW_VER_MINOR_FWLOG_STA_MIN))
...@@ -504,21 +494,18 @@ static int wl1271_boot_run_firmware(struct wl1271 *wl) ...@@ -504,21 +494,18 @@ static int wl1271_boot_run_firmware(struct wl1271 *wl)
wl->event_mask = BSS_LOSE_EVENT_ID | wl->event_mask = BSS_LOSE_EVENT_ID |
SCAN_COMPLETE_EVENT_ID | SCAN_COMPLETE_EVENT_ID |
PS_REPORT_EVENT_ID | PS_REPORT_EVENT_ID |
JOIN_EVENT_COMPLETE_ID |
DISCONNECT_EVENT_COMPLETE_ID | DISCONNECT_EVENT_COMPLETE_ID |
RSSI_SNR_TRIGGER_0_EVENT_ID | RSSI_SNR_TRIGGER_0_EVENT_ID |
PSPOLL_DELIVERY_FAILURE_EVENT_ID | PSPOLL_DELIVERY_FAILURE_EVENT_ID |
SOFT_GEMINI_SENSE_EVENT_ID | SOFT_GEMINI_SENSE_EVENT_ID |
PERIODIC_SCAN_REPORT_EVENT_ID | PERIODIC_SCAN_REPORT_EVENT_ID |
PERIODIC_SCAN_COMPLETE_EVENT_ID; PERIODIC_SCAN_COMPLETE_EVENT_ID |
DUMMY_PACKET_EVENT_ID |
if (wl->bss_type == BSS_TYPE_AP_BSS) PEER_REMOVE_COMPLETE_EVENT_ID |
wl->event_mask |= STA_REMOVE_COMPLETE_EVENT_ID | BA_SESSION_RX_CONSTRAINT_EVENT_ID |
INACTIVE_STA_EVENT_ID | REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID |
MAX_TX_RETRY_EVENT_ID; INACTIVE_STA_EVENT_ID |
else MAX_TX_RETRY_EVENT_ID;
wl->event_mask |= DUMMY_PACKET_EVENT_ID |
BA_SESSION_RX_CONSTRAINT_EVENT_ID;
ret = wl1271_event_unmask(wl); ret = wl1271_event_unmask(wl);
if (ret < 0) { if (ret < 0) {
...@@ -549,13 +536,13 @@ static void wl1271_boot_hw_version(struct wl1271 *wl) ...@@ -549,13 +536,13 @@ static void wl1271_boot_hw_version(struct wl1271 *wl)
{ {
u32 fuse; u32 fuse;
fuse = wl1271_top_reg_read(wl, REG_FUSE_DATA_2_1); if (wl->chip.id == CHIP_ID_1283_PG20)
fuse = wl1271_top_reg_read(wl, WL128X_REG_FUSE_DATA_2_1);
else
fuse = wl1271_top_reg_read(wl, WL127X_REG_FUSE_DATA_2_1);
fuse = (fuse & PG_VER_MASK) >> PG_VER_OFFSET; fuse = (fuse & PG_VER_MASK) >> PG_VER_OFFSET;
wl->hw_pg_ver = (s8)fuse; wl->hw_pg_ver = (s8)fuse;
if (((wl->hw_pg_ver & PG_MAJOR_VER_MASK) >> PG_MAJOR_VER_OFFSET) < 3)
wl->quirks |= WL12XX_QUIRK_END_OF_TRANSACTION;
} }
static int wl128x_switch_tcxo_to_fref(struct wl1271 *wl) static int wl128x_switch_tcxo_to_fref(struct wl1271 *wl)
...@@ -696,7 +683,8 @@ static int wl127x_boot_clk(struct wl1271 *wl) ...@@ -696,7 +683,8 @@ static int wl127x_boot_clk(struct wl1271 *wl)
u32 pause; u32 pause;
u32 clk; u32 clk;
wl1271_boot_hw_version(wl); if (((wl->hw_pg_ver & PG_MAJOR_VER_MASK) >> PG_MAJOR_VER_OFFSET) < 3)
wl->quirks |= WL12XX_QUIRK_END_OF_TRANSACTION;
if (wl->ref_clock == CONF_REF_CLK_19_2_E || if (wl->ref_clock == CONF_REF_CLK_19_2_E ||
wl->ref_clock == CONF_REF_CLK_38_4_E || wl->ref_clock == CONF_REF_CLK_38_4_E ||
...@@ -750,6 +738,8 @@ int wl1271_load_firmware(struct wl1271 *wl) ...@@ -750,6 +738,8 @@ int wl1271_load_firmware(struct wl1271 *wl)
u32 tmp, clk; u32 tmp, clk;
int selected_clock = -1; int selected_clock = -1;
wl1271_boot_hw_version(wl);
if (wl->chip.id == CHIP_ID_1283_PG20) { if (wl->chip.id == CHIP_ID_1283_PG20) {
ret = wl128x_boot_clk(wl, &selected_clock); ret = wl128x_boot_clk(wl, &selected_clock);
if (ret < 0) if (ret < 0)
...@@ -852,9 +842,6 @@ int wl1271_boot(struct wl1271 *wl) ...@@ -852,9 +842,6 @@ int wl1271_boot(struct wl1271 *wl)
/* Enable firmware interrupts now */ /* Enable firmware interrupts now */
wl1271_boot_enable_interrupts(wl); wl1271_boot_enable_interrupts(wl);
/* set the wl1271 default filters */
wl1271_set_default_filters(wl);
wl1271_event_mbox_config(wl); wl1271_event_mbox_config(wl);
out: out:
......
...@@ -55,7 +55,8 @@ struct wl1271_static_data { ...@@ -55,7 +55,8 @@ struct wl1271_static_data {
#define OCP_REG_CLK_POLARITY 0x0cb2 #define OCP_REG_CLK_POLARITY 0x0cb2
#define OCP_REG_CLK_PULL 0x0cb4 #define OCP_REG_CLK_PULL 0x0cb4
#define REG_FUSE_DATA_2_1 0x050a #define WL127X_REG_FUSE_DATA_2_1 0x050a
#define WL128X_REG_FUSE_DATA_2_1 0x2152
#define PG_VER_MASK 0x3c #define PG_VER_MASK 0x3c
#define PG_VER_OFFSET 2 #define PG_VER_OFFSET 2
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -339,10 +339,11 @@ static ssize_t driver_state_read(struct file *file, char __user *user_buf, ...@@ -339,10 +339,11 @@ static ssize_t driver_state_read(struct file *file, char __user *user_buf,
#define DRIVER_STATE_PRINT_HEX(x) DRIVER_STATE_PRINT(x, "0x%x") #define DRIVER_STATE_PRINT_HEX(x) DRIVER_STATE_PRINT(x, "0x%x")
DRIVER_STATE_PRINT_INT(tx_blocks_available); DRIVER_STATE_PRINT_INT(tx_blocks_available);
DRIVER_STATE_PRINT_INT(tx_allocated_blocks[0]); DRIVER_STATE_PRINT_INT(tx_allocated_blocks);
DRIVER_STATE_PRINT_INT(tx_allocated_blocks[1]); DRIVER_STATE_PRINT_INT(tx_allocated_pkts[0]);
DRIVER_STATE_PRINT_INT(tx_allocated_blocks[2]); DRIVER_STATE_PRINT_INT(tx_allocated_pkts[1]);
DRIVER_STATE_PRINT_INT(tx_allocated_blocks[3]); DRIVER_STATE_PRINT_INT(tx_allocated_pkts[2]);
DRIVER_STATE_PRINT_INT(tx_allocated_pkts[3]);
DRIVER_STATE_PRINT_INT(tx_frames_cnt); DRIVER_STATE_PRINT_INT(tx_frames_cnt);
DRIVER_STATE_PRINT_LHEX(tx_frames_map[0]); DRIVER_STATE_PRINT_LHEX(tx_frames_map[0]);
DRIVER_STATE_PRINT_INT(tx_queue_count[0]); DRIVER_STATE_PRINT_INT(tx_queue_count[0]);
...@@ -352,10 +353,7 @@ static ssize_t driver_state_read(struct file *file, char __user *user_buf, ...@@ -352,10 +353,7 @@ static ssize_t driver_state_read(struct file *file, char __user *user_buf,
DRIVER_STATE_PRINT_INT(tx_packets_count); DRIVER_STATE_PRINT_INT(tx_packets_count);
DRIVER_STATE_PRINT_INT(tx_results_count); DRIVER_STATE_PRINT_INT(tx_results_count);
DRIVER_STATE_PRINT_LHEX(flags); DRIVER_STATE_PRINT_LHEX(flags);
DRIVER_STATE_PRINT_INT(tx_blocks_freed[0]); DRIVER_STATE_PRINT_INT(tx_blocks_freed);
DRIVER_STATE_PRINT_INT(tx_blocks_freed[1]);
DRIVER_STATE_PRINT_INT(tx_blocks_freed[2]);
DRIVER_STATE_PRINT_INT(tx_blocks_freed[3]);
DRIVER_STATE_PRINT_INT(tx_security_last_seq_lsb); DRIVER_STATE_PRINT_INT(tx_security_last_seq_lsb);
DRIVER_STATE_PRINT_INT(rx_counter); DRIVER_STATE_PRINT_INT(rx_counter);
DRIVER_STATE_PRINT_INT(session_counter); DRIVER_STATE_PRINT_INT(session_counter);
...@@ -369,9 +367,6 @@ static ssize_t driver_state_read(struct file *file, char __user *user_buf, ...@@ -369,9 +367,6 @@ static ssize_t driver_state_read(struct file *file, char __user *user_buf,
DRIVER_STATE_PRINT_INT(beacon_int); DRIVER_STATE_PRINT_INT(beacon_int);
DRIVER_STATE_PRINT_INT(psm_entry_retry); DRIVER_STATE_PRINT_INT(psm_entry_retry);
DRIVER_STATE_PRINT_INT(ps_poll_failures); DRIVER_STATE_PRINT_INT(ps_poll_failures);
DRIVER_STATE_PRINT_HEX(filters);
DRIVER_STATE_PRINT_HEX(rx_config);
DRIVER_STATE_PRINT_HEX(rx_filter);
DRIVER_STATE_PRINT_INT(power_level); DRIVER_STATE_PRINT_INT(power_level);
DRIVER_STATE_PRINT_INT(rssi_thold); DRIVER_STATE_PRINT_INT(rssi_thold);
DRIVER_STATE_PRINT_INT(last_rssi_event); DRIVER_STATE_PRINT_INT(last_rssi_event);
......
...@@ -285,13 +285,13 @@ static int wl1271_event_process(struct wl1271 *wl, struct event_mailbox *mbox) ...@@ -285,13 +285,13 @@ static int wl1271_event_process(struct wl1271 *wl, struct event_mailbox *mbox)
if ((vector & BA_SESSION_RX_CONSTRAINT_EVENT_ID) && !is_ap) { if ((vector & BA_SESSION_RX_CONSTRAINT_EVENT_ID) && !is_ap) {
wl1271_debug(DEBUG_EVENT, "BA_SESSION_RX_CONSTRAINT_EVENT_ID. " wl1271_debug(DEBUG_EVENT, "BA_SESSION_RX_CONSTRAINT_EVENT_ID. "
"ba_allowed = 0x%x", mbox->ba_allowed); "ba_allowed = 0x%x", mbox->rx_ba_allowed);
if (wl->vif) if (wl->vif)
wl1271_stop_ba_event(wl, mbox->ba_allowed); wl1271_stop_ba_event(wl, mbox->rx_ba_allowed);
} }
if ((vector & DUMMY_PACKET_EVENT_ID) && !is_ap) { if ((vector & DUMMY_PACKET_EVENT_ID)) {
wl1271_debug(DEBUG_EVENT, "DUMMY_PACKET_ID_EVENT_ID"); wl1271_debug(DEBUG_EVENT, "DUMMY_PACKET_ID_EVENT_ID");
if (wl->vif) if (wl->vif)
wl1271_tx_dummy_packet(wl); wl1271_tx_dummy_packet(wl);
......
...@@ -49,32 +49,27 @@ enum { ...@@ -49,32 +49,27 @@ enum {
MEASUREMENT_START_EVENT_ID = BIT(8), MEASUREMENT_START_EVENT_ID = BIT(8),
MEASUREMENT_COMPLETE_EVENT_ID = BIT(9), MEASUREMENT_COMPLETE_EVENT_ID = BIT(9),
SCAN_COMPLETE_EVENT_ID = BIT(10), SCAN_COMPLETE_EVENT_ID = BIT(10),
SCHEDULED_SCAN_COMPLETE_EVENT_ID = BIT(11), WFD_DISCOVERY_COMPLETE_EVENT_ID = BIT(11),
AP_DISCOVERY_COMPLETE_EVENT_ID = BIT(12), AP_DISCOVERY_COMPLETE_EVENT_ID = BIT(12),
PS_REPORT_EVENT_ID = BIT(13), PS_REPORT_EVENT_ID = BIT(13),
PSPOLL_DELIVERY_FAILURE_EVENT_ID = BIT(14), PSPOLL_DELIVERY_FAILURE_EVENT_ID = BIT(14),
DISCONNECT_EVENT_COMPLETE_ID = BIT(15), DISCONNECT_EVENT_COMPLETE_ID = BIT(15),
JOIN_EVENT_COMPLETE_ID = BIT(16), /* BIT(16) is reserved */
CHANNEL_SWITCH_COMPLETE_EVENT_ID = BIT(17), CHANNEL_SWITCH_COMPLETE_EVENT_ID = BIT(17),
BSS_LOSE_EVENT_ID = BIT(18), BSS_LOSE_EVENT_ID = BIT(18),
REGAINED_BSS_EVENT_ID = BIT(19), REGAINED_BSS_EVENT_ID = BIT(19),
MAX_TX_RETRY_EVENT_ID = BIT(20), MAX_TX_RETRY_EVENT_ID = BIT(20),
/* STA: dummy paket for dynamic mem blocks */ DUMMY_PACKET_EVENT_ID = BIT(21),
DUMMY_PACKET_EVENT_ID = BIT(21),
/* AP: STA remove complete */
STA_REMOVE_COMPLETE_EVENT_ID = BIT(21),
SOFT_GEMINI_SENSE_EVENT_ID = BIT(22), SOFT_GEMINI_SENSE_EVENT_ID = BIT(22),
/* STA: SG prediction */ CHANGE_AUTO_MODE_TIMEOUT_EVENT_ID = BIT(23),
SOFT_GEMINI_PREDICTION_EVENT_ID = BIT(23),
/* AP: Inactive STA */
INACTIVE_STA_EVENT_ID = BIT(23),
SOFT_GEMINI_AVALANCHE_EVENT_ID = BIT(24), SOFT_GEMINI_AVALANCHE_EVENT_ID = BIT(24),
PLT_RX_CALIBRATION_COMPLETE_EVENT_ID = BIT(25), PLT_RX_CALIBRATION_COMPLETE_EVENT_ID = BIT(25),
DBG_EVENT_ID = BIT(26), INACTIVE_STA_EVENT_ID = BIT(26),
HEALTH_CHECK_REPLY_EVENT_ID = BIT(27), PEER_REMOVE_COMPLETE_EVENT_ID = BIT(27),
PERIODIC_SCAN_COMPLETE_EVENT_ID = BIT(28), PERIODIC_SCAN_COMPLETE_EVENT_ID = BIT(28),
PERIODIC_SCAN_REPORT_EVENT_ID = BIT(29), PERIODIC_SCAN_REPORT_EVENT_ID = BIT(29),
BA_SESSION_RX_CONSTRAINT_EVENT_ID = BIT(30), BA_SESSION_RX_CONSTRAINT_EVENT_ID = BIT(30),
REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID = BIT(31),
EVENT_MBOX_ALL_EVENT_ID = 0x7fffffff, EVENT_MBOX_ALL_EVENT_ID = 0x7fffffff,
}; };
...@@ -83,15 +78,6 @@ enum { ...@@ -83,15 +78,6 @@ enum {
EVENT_ENTER_POWER_SAVE_SUCCESS, EVENT_ENTER_POWER_SAVE_SUCCESS,
}; };
struct event_debug_report {
u8 debug_event_id;
u8 num_params;
__le16 pad;
__le32 report_1;
__le32 report_2;
__le32 report_3;
} __packed;
#define NUM_OF_RSSI_SNR_TRIGGERS 8 #define NUM_OF_RSSI_SNR_TRIGGERS 8
struct event_mailbox { struct event_mailbox {
...@@ -100,49 +86,45 @@ struct event_mailbox { ...@@ -100,49 +86,45 @@ struct event_mailbox {
__le32 reserved_1; __le32 reserved_1;
__le32 reserved_2; __le32 reserved_2;
u8 dbg_event_id;
u8 num_relevant_params;
__le16 reserved_3;
__le32 event_report_p1;
__le32 event_report_p2;
__le32 event_report_p3;
u8 number_of_scan_results; u8 number_of_scan_results;
u8 scan_tag; u8 scan_tag;
u8 reserved_4[2]; u8 completed_scan_status;
__le32 compl_scheduled_scan_status; u8 reserved_3;
__le16 scheduled_scan_attended_channels;
u8 soft_gemini_sense_info; u8 soft_gemini_sense_info;
u8 soft_gemini_protective_info; u8 soft_gemini_protective_info;
s8 rssi_snr_trigger_metric[NUM_OF_RSSI_SNR_TRIGGERS]; s8 rssi_snr_trigger_metric[NUM_OF_RSSI_SNR_TRIGGERS];
u8 channel_switch_status; u8 channel_switch_status;
u8 scheduled_scan_status; u8 scheduled_scan_status;
u8 ps_status; u8 ps_status;
/* tuned channel (roc) */
u8 roc_channel;
/* AP FW only */ __le16 hlid_removed_bitmap;
u8 hlid_removed;
/* a bitmap of hlids for stations that have been inactive too long */ /* bitmap of aged stations (by HLID) */
__le16 sta_aging_status; __le16 sta_aging_status;
/* a bitmap of hlids for stations which didn't respond to TX */ /* bitmap of stations (by HLID) which exceeded max tx retries */
__le16 sta_tx_retry_exceeded; __le16 sta_tx_retry_exceeded;
/* /* discovery completed results */
* Bitmap, Each bit set represents the Role ID for which this constraint u8 discovery_tag;
* is set. Range: 0 - FF, FF means ANY role u8 number_of_preq_results;
*/ u8 number_of_prsp_results;
u8 ba_role_id; u8 reserved_5;
/*
* Bitmap, Each bit set represents the Link ID for which this constraint /* rx ba constraint */
* is set. Not applicable if ba_role_id is set to ANY role (FF). u8 role_id; /* 0xFF means any role. */
* Range: 0 - FFFF, FFFF means ANY link in that role u8 rx_ba_allowed;
*/ u8 reserved_6[2];
u8 ba_link_id;
u8 ba_allowed; u8 ps_poll_delivery_failure_role_ids;
u8 stopped_role_ids;
u8 reserved_5[21]; u8 started_role_ids;
u8 change_auto_mode_timeout;
u8 reserved_7[12];
} __packed; } __packed;
int wl1271_event_unmask(struct wl1271 *wl); int wl1271_event_unmask(struct wl1271 *wl);
......
...@@ -39,13 +39,13 @@ int wl1271_sta_init_templates_config(struct wl1271 *wl) ...@@ -39,13 +39,13 @@ int wl1271_sta_init_templates_config(struct wl1271 *wl)
/* send empty templates for fw memory reservation */ /* send empty templates for fw memory reservation */
ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_2_4, NULL, ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_2_4, NULL,
WL1271_CMD_TEMPL_MAX_SIZE, WL1271_CMD_TEMPL_DFLT_SIZE,
0, WL1271_RATE_AUTOMATIC); 0, WL1271_RATE_AUTOMATIC);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_5, ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_5,
NULL, WL1271_CMD_TEMPL_MAX_SIZE, 0, NULL, WL1271_CMD_TEMPL_DFLT_SIZE, 0,
WL1271_RATE_AUTOMATIC); WL1271_RATE_AUTOMATIC);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -70,15 +70,13 @@ int wl1271_sta_init_templates_config(struct wl1271 *wl) ...@@ -70,15 +70,13 @@ int wl1271_sta_init_templates_config(struct wl1271 *wl)
return ret; return ret;
ret = wl1271_cmd_template_set(wl, CMD_TEMPL_PROBE_RESPONSE, NULL, ret = wl1271_cmd_template_set(wl, CMD_TEMPL_PROBE_RESPONSE, NULL,
sizeof WL1271_CMD_TEMPL_DFLT_SIZE,
(struct wl12xx_probe_resp_template),
0, WL1271_RATE_AUTOMATIC); 0, WL1271_RATE_AUTOMATIC);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = wl1271_cmd_template_set(wl, CMD_TEMPL_BEACON, NULL, ret = wl1271_cmd_template_set(wl, CMD_TEMPL_BEACON, NULL,
sizeof WL1271_CMD_TEMPL_DFLT_SIZE,
(struct wl12xx_beacon_template),
0, WL1271_RATE_AUTOMATIC); 0, WL1271_RATE_AUTOMATIC);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -92,7 +90,7 @@ int wl1271_sta_init_templates_config(struct wl1271 *wl) ...@@ -92,7 +90,7 @@ int wl1271_sta_init_templates_config(struct wl1271 *wl)
for (i = 0; i < CMD_TEMPL_KLV_IDX_MAX; i++) { for (i = 0; i < CMD_TEMPL_KLV_IDX_MAX; i++) {
ret = wl1271_cmd_template_set(wl, CMD_TEMPL_KLV, NULL, ret = wl1271_cmd_template_set(wl, CMD_TEMPL_KLV, NULL,
WL1271_CMD_TEMPL_MAX_SIZE, i, WL1271_CMD_TEMPL_DFLT_SIZE, i,
WL1271_RATE_AUTOMATIC); WL1271_RATE_AUTOMATIC);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -191,15 +189,13 @@ static int wl1271_ap_init_templates_config(struct wl1271 *wl) ...@@ -191,15 +189,13 @@ static int wl1271_ap_init_templates_config(struct wl1271 *wl)
* reserve memory for later. * reserve memory for later.
*/ */
ret = wl1271_cmd_template_set(wl, CMD_TEMPL_AP_PROBE_RESPONSE, NULL, ret = wl1271_cmd_template_set(wl, CMD_TEMPL_AP_PROBE_RESPONSE, NULL,
sizeof WL1271_CMD_TEMPL_MAX_SIZE,
(struct wl12xx_probe_resp_template),
0, WL1271_RATE_AUTOMATIC); 0, WL1271_RATE_AUTOMATIC);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = wl1271_cmd_template_set(wl, CMD_TEMPL_AP_BEACON, NULL, ret = wl1271_cmd_template_set(wl, CMD_TEMPL_AP_BEACON, NULL,
sizeof WL1271_CMD_TEMPL_MAX_SIZE,
(struct wl12xx_beacon_template),
0, WL1271_RATE_AUTOMATIC); 0, WL1271_RATE_AUTOMATIC);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -227,7 +223,7 @@ static int wl1271_ap_init_templates_config(struct wl1271 *wl) ...@@ -227,7 +223,7 @@ static int wl1271_ap_init_templates_config(struct wl1271 *wl)
return 0; return 0;
} }
static int wl1271_init_rx_config(struct wl1271 *wl, u32 config, u32 filter) static int wl12xx_init_rx_config(struct wl1271 *wl)
{ {
int ret; int ret;
...@@ -235,10 +231,6 @@ static int wl1271_init_rx_config(struct wl1271 *wl, u32 config, u32 filter) ...@@ -235,10 +231,6 @@ static int wl1271_init_rx_config(struct wl1271 *wl, u32 config, u32 filter)
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = wl1271_acx_rx_config(wl, config, filter);
if (ret < 0)
return ret;
return 0; return 0;
} }
...@@ -285,10 +277,7 @@ int wl1271_init_pta(struct wl1271 *wl) ...@@ -285,10 +277,7 @@ int wl1271_init_pta(struct wl1271 *wl)
{ {
int ret; int ret;
if (wl->bss_type == BSS_TYPE_AP_BSS) ret = wl12xx_acx_sg_cfg(wl);
ret = wl1271_acx_ap_sg_cfg(wl);
else
ret = wl1271_acx_sta_sg_cfg(wl);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -392,7 +381,7 @@ static int wl1271_sta_hw_init(struct wl1271 *wl) ...@@ -392,7 +381,7 @@ static int wl1271_sta_hw_init(struct wl1271 *wl)
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = wl1271_acx_sta_mem_cfg(wl); ret = wl12xx_acx_mem_cfg(wl);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -408,12 +397,6 @@ static int wl1271_sta_hw_init_post_mem(struct wl1271 *wl) ...@@ -408,12 +397,6 @@ static int wl1271_sta_hw_init_post_mem(struct wl1271 *wl)
{ {
int ret, i; int ret, i;
ret = wl1271_cmd_set_sta_default_wep_key(wl, wl->default_key);
if (ret < 0) {
wl1271_warning("couldn't set default key");
return ret;
}
/* disable all keep-alive templates */ /* disable all keep-alive templates */
for (i = 0; i < CMD_TEMPL_KLV_IDX_MAX; i++) { for (i = 0; i < CMD_TEMPL_KLV_IDX_MAX; i++) {
ret = wl1271_acx_keep_alive_config(wl, i, ret = wl1271_acx_keep_alive_config(wl, i,
...@@ -451,7 +434,7 @@ static int wl1271_ap_hw_init(struct wl1271 *wl) ...@@ -451,7 +434,7 @@ static int wl1271_ap_hw_init(struct wl1271 *wl)
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = wl1271_acx_ap_mem_cfg(wl); ret = wl12xx_acx_mem_cfg(wl);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -483,7 +466,7 @@ int wl1271_ap_init_templates(struct wl1271 *wl) ...@@ -483,7 +466,7 @@ int wl1271_ap_init_templates(struct wl1271 *wl)
* when operating as AP we want to receive external beacons for * when operating as AP we want to receive external beacons for
* configuring ERP protection. * configuring ERP protection.
*/ */
ret = wl1271_acx_set_ap_beacon_filter(wl, false); ret = wl1271_acx_beacon_filter_opt(wl, false);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -532,6 +515,9 @@ int wl1271_init_ap_rates(struct wl1271 *wl) ...@@ -532,6 +515,9 @@ int wl1271_init_ap_rates(struct wl1271 *wl)
else else
supported_rates = CONF_TX_AP_ENABLED_RATES; supported_rates = CONF_TX_AP_ENABLED_RATES;
/* unconditionally enable HT rates */
supported_rates |= CONF_TX_MCS_RATES;
/* configure unicast TX rate classes */ /* configure unicast TX rate classes */
for (i = 0; i < wl->conf.tx.ac_conf_count; i++) { for (i = 0; i < wl->conf.tx.ac_conf_count; i++) {
rc.enabled_rates = supported_rates; rc.enabled_rates = supported_rates;
...@@ -546,41 +532,24 @@ int wl1271_init_ap_rates(struct wl1271 *wl) ...@@ -546,41 +532,24 @@ int wl1271_init_ap_rates(struct wl1271 *wl)
return 0; return 0;
} }
static void wl1271_check_ba_support(struct wl1271 *wl)
{
/* validate FW cose ver x.x.x.50-60.x */
if ((wl->chip.fw_ver[3] >= WL12XX_BA_SUPPORT_FW_COST_VER2_START) &&
(wl->chip.fw_ver[3] < WL12XX_BA_SUPPORT_FW_COST_VER2_END)) {
wl->ba_support = true;
return;
}
wl->ba_support = false;
}
static int wl1271_set_ba_policies(struct wl1271 *wl) static int wl1271_set_ba_policies(struct wl1271 *wl)
{ {
u8 tid_index;
int ret = 0;
/* Reset the BA RX indicators */ /* Reset the BA RX indicators */
wl->ba_rx_bitmap = 0; wl->ba_rx_bitmap = 0;
wl->ba_allowed = true; wl->ba_allowed = true;
wl->ba_rx_session_count = 0;
/* validate that FW support BA */ /* BA is supported in STA/AP modes */
wl1271_check_ba_support(wl); if (wl->bss_type != BSS_TYPE_AP_BSS &&
wl->bss_type != BSS_TYPE_STA_BSS) {
wl->ba_support = false;
return 0;
}
if (wl->ba_support) wl->ba_support = true;
/* 802.11n initiator BA session setting */
for (tid_index = 0; tid_index < CONF_TX_MAX_TID_COUNT;
++tid_index) {
ret = wl1271_acx_set_ba_session(wl, WLAN_BACK_INITIATOR,
tid_index, true);
if (ret < 0)
break;
}
return ret; /* 802.11n initiator BA session setting */
return wl12xx_acx_set_ba_initiator_policy(wl);
} }
int wl1271_chip_specific_init(struct wl1271 *wl) int wl1271_chip_specific_init(struct wl1271 *wl)
...@@ -650,11 +619,7 @@ int wl1271_hw_init(struct wl1271 *wl) ...@@ -650,11 +619,7 @@ int wl1271_hw_init(struct wl1271 *wl)
return ret; return ret;
/* RX config */ /* RX config */
ret = wl1271_init_rx_config(wl, ret = wl12xx_init_rx_config(wl);
RX_CFG_PROMISCUOUS | RX_CFG_TSF,
RX_FILTER_OPTION_DEF);
/* RX_CONFIG_OPTION_ANY_DST_ANY_BSS,
RX_FILTER_OPTION_FILTER_ALL); */
if (ret < 0) if (ret < 0)
goto out_free_memmap; goto out_free_memmap;
...@@ -733,6 +698,10 @@ int wl1271_hw_init(struct wl1271 *wl) ...@@ -733,6 +698,10 @@ int wl1271_hw_init(struct wl1271 *wl)
if (ret < 0) if (ret < 0)
goto out_free_memmap; goto out_free_memmap;
ret = wl12xx_acx_set_rate_mgmt_params(wl);
if (ret < 0)
goto out_free_memmap;
/* Configure initiator BA sessions policies */ /* Configure initiator BA sessions policies */
ret = wl1271_set_ba_policies(wl); ret = wl1271_set_ba_policies(wl);
if (ret < 0) if (ret < 0)
......
...@@ -186,6 +186,5 @@ int wl1271_free_hw(struct wl1271 *wl); ...@@ -186,6 +186,5 @@ int wl1271_free_hw(struct wl1271 *wl);
irqreturn_t wl1271_irq(int irq, void *data); irqreturn_t wl1271_irq(int irq, void *data);
bool wl1271_set_block_size(struct wl1271 *wl); bool wl1271_set_block_size(struct wl1271 *wl);
int wl1271_tx_dummy_packet(struct wl1271 *wl); int wl1271_tx_dummy_packet(struct wl1271 *wl);
void wl1271_configure_filters(struct wl1271 *wl, unsigned int filters);
#endif #endif
This diff is collapsed.
...@@ -226,8 +226,8 @@ void wl1271_ps_link_start(struct wl1271 *wl, u8 hlid, bool clean_queues) ...@@ -226,8 +226,8 @@ void wl1271_ps_link_start(struct wl1271 *wl, u8 hlid, bool clean_queues)
if (test_bit(hlid, &wl->ap_ps_map)) if (test_bit(hlid, &wl->ap_ps_map))
return; return;
wl1271_debug(DEBUG_PSM, "start mac80211 PSM on hlid %d blks %d " wl1271_debug(DEBUG_PSM, "start mac80211 PSM on hlid %d pkts %d "
"clean_queues %d", hlid, wl->links[hlid].allocated_blks, "clean_queues %d", hlid, wl->links[hlid].allocated_pkts,
clean_queues); clean_queues);
rcu_read_lock(); rcu_read_lock();
......
...@@ -296,81 +296,6 @@ ...@@ -296,81 +296,6 @@
===============================================*/ ===============================================*/
#define REG_EVENT_MAILBOX_PTR (SCR_PAD1) #define REG_EVENT_MAILBOX_PTR (SCR_PAD1)
/* Misc */
#define REG_ENABLE_TX_RX (ENABLE)
/*
* Rx configuration (filter) information element
* ---------------------------------------------
*/
#define REG_RX_CONFIG (RX_CFG)
#define REG_RX_FILTER (RX_FILTER_CFG)
#define RX_CFG_ENABLE_PHY_HEADER_PLCP 0x0002
/* promiscuous - receives all valid frames */
#define RX_CFG_PROMISCUOUS 0x0008
/* receives frames from any BSSID */
#define RX_CFG_BSSID 0x0020
/* receives frames destined to any MAC address */
#define RX_CFG_MAC 0x0010
#define RX_CFG_ENABLE_ONLY_MY_DEST_MAC 0x0010
#define RX_CFG_ENABLE_ANY_DEST_MAC 0x0000
#define RX_CFG_ENABLE_ONLY_MY_BSSID 0x0020
#define RX_CFG_ENABLE_ANY_BSSID 0x0000
/* discards all broadcast frames */
#define RX_CFG_DISABLE_BCAST 0x0200
#define RX_CFG_ENABLE_ONLY_MY_SSID 0x0400
#define RX_CFG_ENABLE_RX_CMPLT_FCS_ERROR 0x0800
#define RX_CFG_COPY_RX_STATUS 0x2000
#define RX_CFG_TSF 0x10000
#define RX_CONFIG_OPTION_ANY_DST_MY_BSS (RX_CFG_ENABLE_ANY_DEST_MAC | \
RX_CFG_ENABLE_ONLY_MY_BSSID)
#define RX_CONFIG_OPTION_MY_DST_ANY_BSS (RX_CFG_ENABLE_ONLY_MY_DEST_MAC\
| RX_CFG_ENABLE_ANY_BSSID)
#define RX_CONFIG_OPTION_ANY_DST_ANY_BSS (RX_CFG_ENABLE_ANY_DEST_MAC | \
RX_CFG_ENABLE_ANY_BSSID)
#define RX_CONFIG_OPTION_MY_DST_MY_BSS (RX_CFG_ENABLE_ONLY_MY_DEST_MAC\
| RX_CFG_ENABLE_ONLY_MY_BSSID)
#define RX_CONFIG_OPTION_FOR_SCAN (RX_CFG_ENABLE_PHY_HEADER_PLCP \
| RX_CFG_ENABLE_RX_CMPLT_FCS_ERROR \
| RX_CFG_COPY_RX_STATUS | RX_CFG_TSF)
#define RX_CONFIG_OPTION_FOR_MEASUREMENT (RX_CFG_ENABLE_ANY_DEST_MAC)
#define RX_CONFIG_OPTION_FOR_JOIN (RX_CFG_ENABLE_ONLY_MY_BSSID | \
RX_CFG_ENABLE_ONLY_MY_DEST_MAC)
#define RX_CONFIG_OPTION_FOR_IBSS_JOIN (RX_CFG_ENABLE_ONLY_MY_SSID | \
RX_CFG_ENABLE_ONLY_MY_DEST_MAC)
#define RX_FILTER_OPTION_DEF (CFG_RX_MGMT_EN | CFG_RX_DATA_EN\
| CFG_RX_CTL_EN | CFG_RX_BCN_EN\
| CFG_RX_AUTH_EN | CFG_RX_ASSOC_EN)
#define RX_FILTER_OPTION_FILTER_ALL 0
#define RX_FILTER_OPTION_DEF_PRSP_BCN (CFG_RX_PRSP_EN | CFG_RX_MGMT_EN\
| CFG_RX_RCTS_ACK | CFG_RX_BCN_EN)
#define RX_FILTER_OPTION_JOIN (CFG_RX_MGMT_EN | CFG_RX_DATA_EN\
| CFG_RX_BCN_EN | CFG_RX_AUTH_EN\
| CFG_RX_ASSOC_EN | CFG_RX_RCTS_ACK\
| CFG_RX_PRSP_EN)
/*=============================================== /*===============================================
EEPROM Read/Write Request 32bit RW EEPROM Read/Write Request 32bit RW
------------------------------------------ ------------------------------------------
......
...@@ -30,20 +30,28 @@ ...@@ -30,20 +30,28 @@
#include "rx.h" #include "rx.h"
#include "io.h" #include "io.h"
static u8 wl1271_rx_get_mem_block(struct wl1271_fw_common_status *status, static u8 wl12xx_rx_get_mem_block(struct wl12xx_fw_status *status,
u32 drv_rx_counter) u32 drv_rx_counter)
{ {
return le32_to_cpu(status->rx_pkt_descs[drv_rx_counter]) & return le32_to_cpu(status->rx_pkt_descs[drv_rx_counter]) &
RX_MEM_BLOCK_MASK; RX_MEM_BLOCK_MASK;
} }
static u32 wl1271_rx_get_buf_size(struct wl1271_fw_common_status *status, static u32 wl12xx_rx_get_buf_size(struct wl12xx_fw_status *status,
u32 drv_rx_counter) u32 drv_rx_counter)
{ {
return (le32_to_cpu(status->rx_pkt_descs[drv_rx_counter]) & return (le32_to_cpu(status->rx_pkt_descs[drv_rx_counter]) &
RX_BUF_SIZE_MASK) >> RX_BUF_SIZE_SHIFT_DIV; RX_BUF_SIZE_MASK) >> RX_BUF_SIZE_SHIFT_DIV;
} }
static bool wl12xx_rx_get_unaligned(struct wl12xx_fw_status *status,
u32 drv_rx_counter)
{
/* Convert the value to bool */
return !!(le32_to_cpu(status->rx_pkt_descs[drv_rx_counter]) &
RX_BUF_UNALIGNED_PAYLOAD);
}
static void wl1271_rx_status(struct wl1271 *wl, static void wl1271_rx_status(struct wl1271 *wl,
struct wl1271_rx_descriptor *desc, struct wl1271_rx_descriptor *desc,
struct ieee80211_rx_status *status, struct ieee80211_rx_status *status,
...@@ -89,7 +97,8 @@ static void wl1271_rx_status(struct wl1271 *wl, ...@@ -89,7 +97,8 @@ static void wl1271_rx_status(struct wl1271 *wl,
} }
} }
static int wl1271_rx_handle_data(struct wl1271 *wl, u8 *data, u32 length) static int wl1271_rx_handle_data(struct wl1271 *wl, u8 *data, u32 length,
bool unaligned)
{ {
struct wl1271_rx_descriptor *desc; struct wl1271_rx_descriptor *desc;
struct sk_buff *skb; struct sk_buff *skb;
...@@ -97,6 +106,7 @@ static int wl1271_rx_handle_data(struct wl1271 *wl, u8 *data, u32 length) ...@@ -97,6 +106,7 @@ static int wl1271_rx_handle_data(struct wl1271 *wl, u8 *data, u32 length)
u8 *buf; u8 *buf;
u8 beacon = 0; u8 beacon = 0;
u8 is_data = 0; u8 is_data = 0;
u8 reserved = unaligned ? NET_IP_ALIGN : 0;
/* /*
* In PLT mode we seem to get frames and mac80211 warns about them, * In PLT mode we seem to get frames and mac80211 warns about them,
...@@ -131,17 +141,25 @@ static int wl1271_rx_handle_data(struct wl1271 *wl, u8 *data, u32 length) ...@@ -131,17 +141,25 @@ static int wl1271_rx_handle_data(struct wl1271 *wl, u8 *data, u32 length)
return -EINVAL; return -EINVAL;
} }
skb = __dev_alloc_skb(length, GFP_KERNEL); /* skb length not included rx descriptor */
skb = __dev_alloc_skb(length + reserved - sizeof(*desc), GFP_KERNEL);
if (!skb) { if (!skb) {
wl1271_error("Couldn't allocate RX frame"); wl1271_error("Couldn't allocate RX frame");
return -ENOMEM; return -ENOMEM;
} }
buf = skb_put(skb, length); /* reserve the unaligned payload(if any) */
memcpy(buf, data, length); skb_reserve(skb, reserved);
/* now we pull the descriptor out of the buffer */ buf = skb_put(skb, length - sizeof(*desc));
skb_pull(skb, sizeof(*desc));
/*
* Copy packets from aggregation buffer to the skbs without rx
* descriptor and with packet payload aligned care. In case of unaligned
* packets copy the packets in offset of 2 bytes guarantee IP header
* payload aligned to 4 bytes.
*/
memcpy(buf, data + sizeof(*desc), length - sizeof(*desc));
hdr = (struct ieee80211_hdr *)skb->data; hdr = (struct ieee80211_hdr *)skb->data;
if (ieee80211_is_beacon(hdr->frame_control)) if (ieee80211_is_beacon(hdr->frame_control))
...@@ -163,7 +181,7 @@ static int wl1271_rx_handle_data(struct wl1271 *wl, u8 *data, u32 length) ...@@ -163,7 +181,7 @@ static int wl1271_rx_handle_data(struct wl1271 *wl, u8 *data, u32 length)
return is_data; return is_data;
} }
void wl1271_rx(struct wl1271 *wl, struct wl1271_fw_common_status *status) void wl12xx_rx(struct wl1271 *wl, struct wl12xx_fw_status *status)
{ {
struct wl1271_acx_mem_map *wl_mem_map = wl->target_mem_map; struct wl1271_acx_mem_map *wl_mem_map = wl->target_mem_map;
u32 buf_size; u32 buf_size;
...@@ -175,12 +193,13 @@ void wl1271_rx(struct wl1271 *wl, struct wl1271_fw_common_status *status) ...@@ -175,12 +193,13 @@ void wl1271_rx(struct wl1271 *wl, struct wl1271_fw_common_status *status)
u32 pkt_offset; u32 pkt_offset;
bool is_ap = (wl->bss_type == BSS_TYPE_AP_BSS); bool is_ap = (wl->bss_type == BSS_TYPE_AP_BSS);
bool had_data = false; bool had_data = false;
bool unaligned = false;
while (drv_rx_counter != fw_rx_counter) { while (drv_rx_counter != fw_rx_counter) {
buf_size = 0; buf_size = 0;
rx_counter = drv_rx_counter; rx_counter = drv_rx_counter;
while (rx_counter != fw_rx_counter) { while (rx_counter != fw_rx_counter) {
pkt_length = wl1271_rx_get_buf_size(status, rx_counter); pkt_length = wl12xx_rx_get_buf_size(status, rx_counter);
if (buf_size + pkt_length > WL1271_AGGR_BUFFER_SIZE) if (buf_size + pkt_length > WL1271_AGGR_BUFFER_SIZE)
break; break;
buf_size += pkt_length; buf_size += pkt_length;
...@@ -199,7 +218,7 @@ void wl1271_rx(struct wl1271 *wl, struct wl1271_fw_common_status *status) ...@@ -199,7 +218,7 @@ void wl1271_rx(struct wl1271 *wl, struct wl1271_fw_common_status *status)
* For aggregated packets, only the first memory block * For aggregated packets, only the first memory block
* should be retrieved. The FW takes care of the rest. * should be retrieved. The FW takes care of the rest.
*/ */
mem_block = wl1271_rx_get_mem_block(status, mem_block = wl12xx_rx_get_mem_block(status,
drv_rx_counter); drv_rx_counter);
wl->rx_mem_pool_addr.addr = (mem_block << 8) + wl->rx_mem_pool_addr.addr = (mem_block << 8) +
...@@ -220,8 +239,12 @@ void wl1271_rx(struct wl1271 *wl, struct wl1271_fw_common_status *status) ...@@ -220,8 +239,12 @@ void wl1271_rx(struct wl1271 *wl, struct wl1271_fw_common_status *status)
/* Split data into separate packets */ /* Split data into separate packets */
pkt_offset = 0; pkt_offset = 0;
while (pkt_offset < buf_size) { while (pkt_offset < buf_size) {
pkt_length = wl1271_rx_get_buf_size(status, pkt_length = wl12xx_rx_get_buf_size(status,
drv_rx_counter); drv_rx_counter);
unaligned = wl12xx_rx_get_unaligned(status,
drv_rx_counter);
/* /*
* the handle data call can only fail in memory-outage * the handle data call can only fail in memory-outage
* conditions, in that case the received frame will just * conditions, in that case the received frame will just
...@@ -229,7 +252,7 @@ void wl1271_rx(struct wl1271 *wl, struct wl1271_fw_common_status *status) ...@@ -229,7 +252,7 @@ void wl1271_rx(struct wl1271 *wl, struct wl1271_fw_common_status *status)
*/ */
if (wl1271_rx_handle_data(wl, if (wl1271_rx_handle_data(wl,
wl->aggr_buf + pkt_offset, wl->aggr_buf + pkt_offset,
pkt_length) == 1) pkt_length, unaligned) == 1)
had_data = true; had_data = true;
wl->rx_counter++; wl->rx_counter++;
...@@ -260,14 +283,3 @@ void wl1271_rx(struct wl1271 *wl, struct wl1271_fw_common_status *status) ...@@ -260,14 +283,3 @@ void wl1271_rx(struct wl1271 *wl, struct wl1271_fw_common_status *status)
jiffies + msecs_to_jiffies(timeout)); jiffies + msecs_to_jiffies(timeout));
} }
} }
void wl1271_set_default_filters(struct wl1271 *wl)
{
if (wl->bss_type == BSS_TYPE_AP_BSS) {
wl->rx_config = WL1271_DEFAULT_AP_RX_CONFIG;
wl->rx_filter = WL1271_DEFAULT_AP_RX_FILTER;
} else {
wl->rx_config = WL1271_DEFAULT_STA_RX_CONFIG;
wl->rx_filter = WL1271_DEFAULT_STA_RX_FILTER;
}
}
...@@ -86,16 +86,18 @@ ...@@ -86,16 +86,18 @@
* Bits 3-5 - process_id tag (AP mode FW) * Bits 3-5 - process_id tag (AP mode FW)
* Bits 6-7 - reserved * Bits 6-7 - reserved
*/ */
#define WL1271_RX_DESC_STATUS_MASK 0x07 #define WL1271_RX_DESC_STATUS_MASK 0x03
#define WL1271_RX_DESC_SUCCESS 0x00 #define WL1271_RX_DESC_SUCCESS 0x00
#define WL1271_RX_DESC_DECRYPT_FAIL 0x01 #define WL1271_RX_DESC_DECRYPT_FAIL 0x01
#define WL1271_RX_DESC_MIC_FAIL 0x02 #define WL1271_RX_DESC_MIC_FAIL 0x02
#define WL1271_RX_DESC_DRIVER_RX_Q_FAIL 0x03 #define WL1271_RX_DESC_DRIVER_RX_Q_FAIL 0x03
#define RX_MEM_BLOCK_MASK 0xFF #define RX_MEM_BLOCK_MASK 0xFF
#define RX_BUF_SIZE_MASK 0xFFF00 #define RX_BUF_SIZE_MASK 0xFFF00
#define RX_BUF_SIZE_SHIFT_DIV 6 #define RX_BUF_SIZE_SHIFT_DIV 6
/* If set, the start of IP payload is not 4 bytes aligned */
#define RX_BUF_UNALIGNED_PAYLOAD BIT(20)
enum { enum {
WL12XX_RX_CLASS_UNKNOWN, WL12XX_RX_CLASS_UNKNOWN,
...@@ -119,16 +121,12 @@ struct wl1271_rx_descriptor { ...@@ -119,16 +121,12 @@ struct wl1271_rx_descriptor {
u8 snr; u8 snr;
__le32 timestamp; __le32 timestamp;
u8 packet_class; u8 packet_class;
union { u8 hlid;
u8 process_id; /* STA FW */
u8 hlid; /* AP FW */
} __packed;
u8 pad_len; u8 pad_len;
u8 reserved; u8 reserved;
} __packed; } __packed;
void wl1271_rx(struct wl1271 *wl, struct wl1271_fw_common_status *status); void wl12xx_rx(struct wl1271 *wl, struct wl12xx_fw_status *status);
u8 wl1271_rate_to_idx(int rate, enum ieee80211_band band); u8 wl1271_rate_to_idx(int rate, enum ieee80211_band band);
void wl1271_set_default_filters(struct wl1271 *wl);
#endif #endif
...@@ -33,6 +33,8 @@ void wl1271_scan_complete_work(struct work_struct *work) ...@@ -33,6 +33,8 @@ void wl1271_scan_complete_work(struct work_struct *work)
{ {
struct delayed_work *dwork; struct delayed_work *dwork;
struct wl1271 *wl; struct wl1271 *wl;
int ret;
bool is_sta, is_ibss;
dwork = container_of(work, struct delayed_work, work); dwork = container_of(work, struct delayed_work, work);
wl = container_of(dwork, struct wl1271, scan_complete_work); wl = container_of(dwork, struct wl1271, scan_complete_work);
...@@ -50,21 +52,34 @@ void wl1271_scan_complete_work(struct work_struct *work) ...@@ -50,21 +52,34 @@ void wl1271_scan_complete_work(struct work_struct *work)
wl->scan.state = WL1271_SCAN_STATE_IDLE; wl->scan.state = WL1271_SCAN_STATE_IDLE;
memset(wl->scan.scanned_ch, 0, sizeof(wl->scan.scanned_ch)); memset(wl->scan.scanned_ch, 0, sizeof(wl->scan.scanned_ch));
wl->scan.req = NULL; wl->scan.req = NULL;
ieee80211_scan_completed(wl->hw, false);
/* restore hardware connection monitoring template */ ret = wl1271_ps_elp_wakeup(wl);
if (ret < 0)
goto out;
if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) { if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) {
if (wl1271_ps_elp_wakeup(wl) == 0) { /* restore hardware connection monitoring template */
wl1271_cmd_build_ap_probe_req(wl, wl->probereq); wl1271_cmd_build_ap_probe_req(wl, wl->probereq);
wl1271_ps_elp_sleep(wl); }
}
/* return to ROC if needed */
is_sta = (wl->bss_type == BSS_TYPE_STA_BSS);
is_ibss = (wl->bss_type == BSS_TYPE_IBSS);
if ((is_sta && !test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) ||
(is_ibss && !test_bit(WL1271_FLAG_IBSS_JOINED, &wl->flags))) {
/* restore remain on channel */
wl12xx_cmd_role_start_dev(wl);
wl12xx_roc(wl, wl->dev_role_id);
} }
wl1271_ps_elp_sleep(wl);
if (wl->scan.failed) { if (wl->scan.failed) {
wl1271_info("Scan completed due to error."); wl1271_info("Scan completed due to error.");
wl12xx_queue_recovery_work(wl); wl12xx_queue_recovery_work(wl);
} }
ieee80211_scan_completed(wl->hw, false);
out: out:
mutex_unlock(&wl->mutex); mutex_unlock(&wl->mutex);
...@@ -156,6 +171,11 @@ static int wl1271_scan_send(struct wl1271 *wl, enum ieee80211_band band, ...@@ -156,6 +171,11 @@ static int wl1271_scan_send(struct wl1271 *wl, enum ieee80211_band band,
if (passive || wl->scan.req->n_ssids == 0) if (passive || wl->scan.req->n_ssids == 0)
scan_options |= WL1271_SCAN_OPT_PASSIVE; scan_options |= WL1271_SCAN_OPT_PASSIVE;
if (WARN_ON(wl->role_id == WL12XX_INVALID_ROLE_ID)) {
ret = -EINVAL;
goto out;
}
cmd->params.role_id = wl->role_id;
cmd->params.scan_options = cpu_to_le16(scan_options); cmd->params.scan_options = cpu_to_le16(scan_options);
cmd->params.n_ch = wl1271_get_scan_channels(wl, wl->scan.req, cmd->params.n_ch = wl1271_get_scan_channels(wl, wl->scan.req,
...@@ -167,10 +187,6 @@ static int wl1271_scan_send(struct wl1271 *wl, enum ieee80211_band band, ...@@ -167,10 +187,6 @@ static int wl1271_scan_send(struct wl1271 *wl, enum ieee80211_band band,
} }
cmd->params.tx_rate = cpu_to_le32(basic_rate); cmd->params.tx_rate = cpu_to_le32(basic_rate);
cmd->params.rx_config_options = cpu_to_le32(CFG_RX_ALL_GOOD);
cmd->params.rx_filter_options =
cpu_to_le32(CFG_RX_PRSP_EN | CFG_RX_MGMT_EN | CFG_RX_BCN_EN);
cmd->params.n_probe_reqs = wl->conf.scan.num_probe_reqs; cmd->params.n_probe_reqs = wl->conf.scan.num_probe_reqs;
cmd->params.tx_rate = cpu_to_le32(basic_rate); cmd->params.tx_rate = cpu_to_le32(basic_rate);
cmd->params.tid_trigger = 0; cmd->params.tid_trigger = 0;
...@@ -186,6 +202,8 @@ static int wl1271_scan_send(struct wl1271 *wl, enum ieee80211_band band, ...@@ -186,6 +202,8 @@ static int wl1271_scan_send(struct wl1271 *wl, enum ieee80211_band band,
memcpy(cmd->params.ssid, wl->scan.ssid, wl->scan.ssid_len); memcpy(cmd->params.ssid, wl->scan.ssid, wl->scan.ssid_len);
} }
memcpy(cmd->addr, wl->mac_addr, ETH_ALEN);
ret = wl1271_cmd_build_probe_req(wl, wl->scan.ssid, wl->scan.ssid_len, ret = wl1271_cmd_build_probe_req(wl, wl->scan.ssid, wl->scan.ssid_len,
wl->scan.req->ie, wl->scan.req->ie_len, wl->scan.req->ie, wl->scan.req->ie_len,
band); band);
......
...@@ -46,7 +46,10 @@ void wl1271_scan_sched_scan_results(struct wl1271 *wl); ...@@ -46,7 +46,10 @@ void wl1271_scan_sched_scan_results(struct wl1271 *wl);
#define WL1271_SCAN_CURRENT_TX_PWR 0 #define WL1271_SCAN_CURRENT_TX_PWR 0
#define WL1271_SCAN_OPT_ACTIVE 0 #define WL1271_SCAN_OPT_ACTIVE 0
#define WL1271_SCAN_OPT_PASSIVE 1 #define WL1271_SCAN_OPT_PASSIVE 1
#define WL1271_SCAN_OPT_TRIGGERED_SCAN 2
#define WL1271_SCAN_OPT_PRIORITY_HIGH 4 #define WL1271_SCAN_OPT_PRIORITY_HIGH 4
/* scan even if we fail to enter psm */
#define WL1271_SCAN_OPT_FORCE 8
#define WL1271_SCAN_BAND_2_4_GHZ 0 #define WL1271_SCAN_BAND_2_4_GHZ 0
#define WL1271_SCAN_BAND_5_GHZ 1 #define WL1271_SCAN_BAND_5_GHZ 1
...@@ -62,27 +65,27 @@ enum { ...@@ -62,27 +65,27 @@ enum {
}; };
struct basic_scan_params { struct basic_scan_params {
__le32 rx_config_options;
__le32 rx_filter_options;
/* Scan option flags (WL1271_SCAN_OPT_*) */ /* Scan option flags (WL1271_SCAN_OPT_*) */
__le16 scan_options; __le16 scan_options;
u8 role_id;
/* Number of scan channels in the list (maximum 30) */ /* Number of scan channels in the list (maximum 30) */
u8 n_ch; u8 n_ch;
/* This field indicates the number of probe requests to send /* This field indicates the number of probe requests to send
per channel for an active scan */ per channel for an active scan */
u8 n_probe_reqs; u8 n_probe_reqs;
/* Rate bit field for sending the probes */
__le32 tx_rate;
u8 tid_trigger; u8 tid_trigger;
u8 ssid_len; u8 ssid_len;
/* in order to align */ u8 use_ssid_list;
u8 padding1[2];
/* Rate bit field for sending the probes */
__le32 tx_rate;
u8 ssid[IEEE80211_MAX_SSID_LEN]; u8 ssid[IEEE80211_MAX_SSID_LEN];
/* Band to scan */ /* Band to scan */
u8 band; u8 band;
u8 use_ssid_list;
u8 scan_tag; u8 scan_tag;
u8 padding2; u8 padding2[2];
} __packed; } __packed;
struct basic_scan_channel_params { struct basic_scan_channel_params {
...@@ -105,6 +108,10 @@ struct wl1271_cmd_scan { ...@@ -105,6 +108,10 @@ struct wl1271_cmd_scan {
struct basic_scan_params params; struct basic_scan_params params;
struct basic_scan_channel_params channels[WL1271_SCAN_MAX_CHANNELS]; struct basic_scan_channel_params channels[WL1271_SCAN_MAX_CHANNELS];
/* src mac address */
u8 addr[ETH_ALEN];
u8 padding[2];
} __packed; } __packed;
struct wl1271_cmd_trigger_scan_to { struct wl1271_cmd_trigger_scan_to {
...@@ -184,7 +191,7 @@ struct wl1271_cmd_sched_scan_config { ...@@ -184,7 +191,7 @@ struct wl1271_cmd_sched_scan_config {
} __packed; } __packed;
#define SCHED_SCAN_MAX_SSIDS 8 #define SCHED_SCAN_MAX_SSIDS 16
enum { enum {
SCAN_SSID_TYPE_PUBLIC = 0, SCAN_SSID_TYPE_PUBLIC = 0,
......
...@@ -412,7 +412,5 @@ module_exit(wl1271_exit); ...@@ -412,7 +412,5 @@ module_exit(wl1271_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_AUTHOR("Luciano Coelho <coelho@ti.com>"); MODULE_AUTHOR("Luciano Coelho <coelho@ti.com>");
MODULE_AUTHOR("Juuso Oikarinen <juuso.oikarinen@nokia.com>"); MODULE_AUTHOR("Juuso Oikarinen <juuso.oikarinen@nokia.com>");
MODULE_FIRMWARE(WL1271_FW_NAME); MODULE_FIRMWARE(WL127X_FW_NAME);
MODULE_FIRMWARE(WL128X_FW_NAME); MODULE_FIRMWARE(WL128X_FW_NAME);
MODULE_FIRMWARE(WL127X_AP_FW_NAME);
MODULE_FIRMWARE(WL128X_AP_FW_NAME);
...@@ -486,8 +486,6 @@ module_exit(wl1271_exit); ...@@ -486,8 +486,6 @@ module_exit(wl1271_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_AUTHOR("Luciano Coelho <coelho@ti.com>"); MODULE_AUTHOR("Luciano Coelho <coelho@ti.com>");
MODULE_AUTHOR("Juuso Oikarinen <juuso.oikarinen@nokia.com>"); MODULE_AUTHOR("Juuso Oikarinen <juuso.oikarinen@nokia.com>");
MODULE_FIRMWARE(WL1271_FW_NAME); MODULE_FIRMWARE(WL127X_FW_NAME);
MODULE_FIRMWARE(WL128X_FW_NAME); MODULE_FIRMWARE(WL128X_FW_NAME);
MODULE_FIRMWARE(WL127X_AP_FW_NAME);
MODULE_FIRMWARE(WL128X_AP_FW_NAME);
MODULE_ALIAS("spi:wl1271"); MODULE_ALIAS("spi:wl1271");
...@@ -37,9 +37,10 @@ static int wl1271_set_default_wep_key(struct wl1271 *wl, u8 id) ...@@ -37,9 +37,10 @@ static int wl1271_set_default_wep_key(struct wl1271 *wl, u8 id)
bool is_ap = (wl->bss_type == BSS_TYPE_AP_BSS); bool is_ap = (wl->bss_type == BSS_TYPE_AP_BSS);
if (is_ap) if (is_ap)
ret = wl1271_cmd_set_ap_default_wep_key(wl, id); ret = wl12xx_cmd_set_default_wep_key(wl, id,
wl->ap_bcast_hlid);
else else
ret = wl1271_cmd_set_sta_default_wep_key(wl, id); ret = wl12xx_cmd_set_default_wep_key(wl, id, wl->sta_hlid);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -77,6 +78,7 @@ static int wl1271_tx_update_filters(struct wl1271 *wl, ...@@ -77,6 +78,7 @@ static int wl1271_tx_update_filters(struct wl1271 *wl,
struct sk_buff *skb) struct sk_buff *skb)
{ {
struct ieee80211_hdr *hdr; struct ieee80211_hdr *hdr;
int ret;
hdr = (struct ieee80211_hdr *)(skb->data + hdr = (struct ieee80211_hdr *)(skb->data +
sizeof(struct wl1271_tx_hw_descr)); sizeof(struct wl1271_tx_hw_descr));
...@@ -90,9 +92,19 @@ static int wl1271_tx_update_filters(struct wl1271 *wl, ...@@ -90,9 +92,19 @@ static int wl1271_tx_update_filters(struct wl1271 *wl,
if (!ieee80211_is_auth(hdr->frame_control)) if (!ieee80211_is_auth(hdr->frame_control))
return 0; return 0;
wl1271_configure_filters(wl, FIF_OTHER_BSS); if (wl->dev_hlid != WL12XX_INVALID_LINK_ID)
goto out;
return wl1271_acx_rx_config(wl, wl->rx_config, wl->rx_filter); wl1271_debug(DEBUG_CMD, "starting device role for roaming");
ret = wl12xx_cmd_role_start_dev(wl);
if (ret < 0)
goto out;
ret = wl12xx_roc(wl, wl->dev_role_id);
if (ret < 0)
goto out;
out:
return 0;
} }
static void wl1271_tx_ap_update_inconnection_sta(struct wl1271 *wl, static void wl1271_tx_ap_update_inconnection_sta(struct wl1271 *wl,
...@@ -114,24 +126,29 @@ static void wl1271_tx_ap_update_inconnection_sta(struct wl1271 *wl, ...@@ -114,24 +126,29 @@ static void wl1271_tx_ap_update_inconnection_sta(struct wl1271 *wl,
static void wl1271_tx_regulate_link(struct wl1271 *wl, u8 hlid) static void wl1271_tx_regulate_link(struct wl1271 *wl, u8 hlid)
{ {
bool fw_ps; bool fw_ps;
u8 tx_blks; u8 tx_pkts;
/* only regulate station links */ /* only regulate station links */
if (hlid < WL1271_AP_STA_HLID_START) if (hlid < WL1271_AP_STA_HLID_START)
return; return;
fw_ps = test_bit(hlid, (unsigned long *)&wl->ap_fw_ps_map); fw_ps = test_bit(hlid, (unsigned long *)&wl->ap_fw_ps_map);
tx_blks = wl->links[hlid].allocated_blks; tx_pkts = wl->links[hlid].allocated_pkts;
/* /*
* if in FW PS and there is enough data in FW we can put the link * if in FW PS and there is enough data in FW we can put the link
* into high-level PS and clean out its TX queues. * into high-level PS and clean out its TX queues.
*/ */
if (fw_ps && tx_blks >= WL1271_PS_STA_MAX_BLOCKS) if (fw_ps && tx_pkts >= WL1271_PS_STA_MAX_PACKETS)
wl1271_ps_link_start(wl, hlid, true); wl1271_ps_link_start(wl, hlid, true);
} }
u8 wl1271_tx_get_hlid(struct sk_buff *skb) static bool wl12xx_is_dummy_packet(struct wl1271 *wl, struct sk_buff *skb)
{
return wl->dummy_packet == skb;
}
u8 wl12xx_tx_get_hlid_ap(struct wl1271 *wl, struct sk_buff *skb)
{ {
struct ieee80211_tx_info *control = IEEE80211_SKB_CB(skb); struct ieee80211_tx_info *control = IEEE80211_SKB_CB(skb);
...@@ -144,14 +161,32 @@ u8 wl1271_tx_get_hlid(struct sk_buff *skb) ...@@ -144,14 +161,32 @@ u8 wl1271_tx_get_hlid(struct sk_buff *skb)
} else { } else {
struct ieee80211_hdr *hdr; struct ieee80211_hdr *hdr;
if (!test_bit(WL1271_FLAG_AP_STARTED, &wl->flags))
return wl->system_hlid;
hdr = (struct ieee80211_hdr *)skb->data; hdr = (struct ieee80211_hdr *)skb->data;
if (ieee80211_is_mgmt(hdr->frame_control)) if (ieee80211_is_mgmt(hdr->frame_control))
return WL1271_AP_GLOBAL_HLID; return wl->ap_global_hlid;
else else
return WL1271_AP_BROADCAST_HLID; return wl->ap_bcast_hlid;
} }
} }
static u8 wl1271_tx_get_hlid(struct wl1271 *wl, struct sk_buff *skb)
{
if (wl12xx_is_dummy_packet(wl, skb))
return wl->system_hlid;
if (wl->bss_type == BSS_TYPE_AP_BSS)
return wl12xx_tx_get_hlid_ap(wl, skb);
if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags) ||
test_bit(WL1271_FLAG_IBSS_JOINED, &wl->flags))
return wl->sta_hlid;
else
return wl->dev_hlid;
}
static unsigned int wl12xx_calc_packet_alignment(struct wl1271 *wl, static unsigned int wl12xx_calc_packet_alignment(struct wl1271 *wl,
unsigned int packet_length) unsigned int packet_length)
{ {
...@@ -169,12 +204,9 @@ static int wl1271_tx_allocate(struct wl1271 *wl, struct sk_buff *skb, u32 extra, ...@@ -169,12 +204,9 @@ static int wl1271_tx_allocate(struct wl1271 *wl, struct sk_buff *skb, u32 extra,
u32 len; u32 len;
u32 total_blocks; u32 total_blocks;
int id, ret = -EBUSY, ac; int id, ret = -EBUSY, ac;
u32 spare_blocks;
if (unlikely(wl->quirks & WL12XX_QUIRK_USE_2_SPARE_BLOCKS)) /* we use 1 spare block */
spare_blocks = 2; u32 spare_blocks = 1;
else
spare_blocks = 1;
if (buf_offset + total_len > WL1271_AGGR_BUFFER_SIZE) if (buf_offset + total_len > WL1271_AGGR_BUFFER_SIZE)
return -EAGAIN; return -EAGAIN;
...@@ -206,12 +238,14 @@ static int wl1271_tx_allocate(struct wl1271 *wl, struct sk_buff *skb, u32 extra, ...@@ -206,12 +238,14 @@ static int wl1271_tx_allocate(struct wl1271 *wl, struct sk_buff *skb, u32 extra,
desc->id = id; desc->id = id;
wl->tx_blocks_available -= total_blocks; wl->tx_blocks_available -= total_blocks;
wl->tx_allocated_blocks += total_blocks;
ac = wl1271_tx_get_queue(skb_get_queue_mapping(skb)); ac = wl1271_tx_get_queue(skb_get_queue_mapping(skb));
wl->tx_allocated_blocks[ac] += total_blocks; wl->tx_allocated_pkts[ac]++;
if (wl->bss_type == BSS_TYPE_AP_BSS) if (wl->bss_type == BSS_TYPE_AP_BSS &&
wl->links[hlid].allocated_blks += total_blocks; hlid >= WL1271_AP_STA_HLID_START)
wl->links[hlid].allocated_pkts++;
ret = 0; ret = 0;
...@@ -225,11 +259,6 @@ static int wl1271_tx_allocate(struct wl1271 *wl, struct sk_buff *skb, u32 extra, ...@@ -225,11 +259,6 @@ static int wl1271_tx_allocate(struct wl1271 *wl, struct sk_buff *skb, u32 extra,
return ret; return ret;
} }
static bool wl12xx_is_dummy_packet(struct wl1271 *wl, struct sk_buff *skb)
{
return wl->dummy_packet == skb;
}
static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb, static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb,
u32 extra, struct ieee80211_tx_info *control, u32 extra, struct ieee80211_tx_info *control,
u8 hlid) u8 hlid)
...@@ -280,9 +309,9 @@ static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb, ...@@ -280,9 +309,9 @@ static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb,
wl->session_counter << TX_HW_ATTR_OFST_SESSION_COUNTER; wl->session_counter << TX_HW_ATTR_OFST_SESSION_COUNTER;
} }
if (wl->bss_type != BSS_TYPE_AP_BSS) { desc->hlid = hlid;
desc->aid = hlid;
if (wl->bss_type != BSS_TYPE_AP_BSS) {
/* if the packets are destined for AP (have a STA entry) /* if the packets are destined for AP (have a STA entry)
send them with AP rate policies, otherwise use default send them with AP rate policies, otherwise use default
basic rates */ basic rates */
...@@ -291,18 +320,12 @@ static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb, ...@@ -291,18 +320,12 @@ static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb,
else else
rate_idx = ACX_TX_BASIC_RATE; rate_idx = ACX_TX_BASIC_RATE;
} else { } else {
desc->hlid = hlid; if (hlid == wl->ap_global_hlid)
switch (hlid) {
case WL1271_AP_GLOBAL_HLID:
rate_idx = ACX_TX_AP_MODE_MGMT_RATE; rate_idx = ACX_TX_AP_MODE_MGMT_RATE;
break; else if (hlid == wl->ap_bcast_hlid)
case WL1271_AP_BROADCAST_HLID:
rate_idx = ACX_TX_AP_MODE_BCST_RATE; rate_idx = ACX_TX_AP_MODE_BCST_RATE;
break; else
default:
rate_idx = ac; rate_idx = ac;
break;
}
} }
tx_attr |= rate_idx << TX_HW_ATTR_OFST_RATE_POLICY; tx_attr |= rate_idx << TX_HW_ATTR_OFST_RATE_POLICY;
...@@ -376,10 +399,11 @@ static int wl1271_prepare_tx_frame(struct wl1271 *wl, struct sk_buff *skb, ...@@ -376,10 +399,11 @@ static int wl1271_prepare_tx_frame(struct wl1271 *wl, struct sk_buff *skb,
} }
} }
if (wl->bss_type == BSS_TYPE_AP_BSS) hlid = wl1271_tx_get_hlid(wl, skb);
hlid = wl1271_tx_get_hlid(skb); if (hlid == WL12XX_INVALID_LINK_ID) {
else wl1271_error("invalid hlid. dropping skb 0x%p", skb);
hlid = TX_HW_DEFAULT_AID; return -EINVAL;
}
ret = wl1271_tx_allocate(wl, skb, extra, buf_offset, hlid); ret = wl1271_tx_allocate(wl, skb, extra, buf_offset, hlid);
if (ret < 0) if (ret < 0)
...@@ -462,20 +486,24 @@ void wl1271_handle_tx_low_watermark(struct wl1271 *wl) ...@@ -462,20 +486,24 @@ void wl1271_handle_tx_low_watermark(struct wl1271 *wl)
static struct sk_buff_head *wl1271_select_queue(struct wl1271 *wl, static struct sk_buff_head *wl1271_select_queue(struct wl1271 *wl,
struct sk_buff_head *queues) struct sk_buff_head *queues)
{ {
int i, q = -1; int i, q = -1, ac;
u32 min_blks = 0xffffffff; u32 min_pkts = 0xffffffff;
/* /*
* Find a non-empty ac where: * Find a non-empty ac where:
* 1. There are packets to transmit * 1. There are packets to transmit
* 2. The FW has the least allocated blocks * 2. The FW has the least allocated blocks
*
* We prioritize the ACs according to VO>VI>BE>BK
*/ */
for (i = 0; i < NUM_TX_QUEUES; i++) for (i = 0; i < NUM_TX_QUEUES; i++) {
if (!skb_queue_empty(&queues[i]) && ac = wl1271_tx_get_queue(i);
(wl->tx_allocated_blocks[i] < min_blks)) { if (!skb_queue_empty(&queues[ac]) &&
q = i; (wl->tx_allocated_pkts[ac] < min_pkts)) {
min_blks = wl->tx_allocated_blocks[q]; q = ac;
min_pkts = wl->tx_allocated_pkts[q];
} }
}
if (q == -1) if (q == -1)
return NULL; return NULL;
...@@ -579,7 +607,7 @@ static void wl1271_skb_queue_head(struct wl1271 *wl, struct sk_buff *skb) ...@@ -579,7 +607,7 @@ static void wl1271_skb_queue_head(struct wl1271 *wl, struct sk_buff *skb)
if (wl12xx_is_dummy_packet(wl, skb)) { if (wl12xx_is_dummy_packet(wl, skb)) {
set_bit(WL1271_FLAG_DUMMY_PACKET_PENDING, &wl->flags); set_bit(WL1271_FLAG_DUMMY_PACKET_PENDING, &wl->flags);
} else if (wl->bss_type == BSS_TYPE_AP_BSS) { } else if (wl->bss_type == BSS_TYPE_AP_BSS) {
u8 hlid = wl1271_tx_get_hlid(skb); u8 hlid = wl1271_tx_get_hlid(wl, skb);
skb_queue_head(&wl->links[hlid].tx_queue[q], skb); skb_queue_head(&wl->links[hlid].tx_queue[q], skb);
/* make sure we dequeue the same packet next time */ /* make sure we dequeue the same packet next time */
...@@ -826,10 +854,14 @@ void wl1271_tx_reset_link_queues(struct wl1271 *wl, u8 hlid) ...@@ -826,10 +854,14 @@ void wl1271_tx_reset_link_queues(struct wl1271 *wl, u8 hlid)
total[i] = 0; total[i] = 0;
while ((skb = skb_dequeue(&wl->links[hlid].tx_queue[i]))) { while ((skb = skb_dequeue(&wl->links[hlid].tx_queue[i]))) {
wl1271_debug(DEBUG_TX, "link freeing skb 0x%p", skb); wl1271_debug(DEBUG_TX, "link freeing skb 0x%p", skb);
info = IEEE80211_SKB_CB(skb);
info->status.rates[0].idx = -1; if (!wl12xx_is_dummy_packet(wl, skb)) {
info->status.rates[0].count = 0; info = IEEE80211_SKB_CB(skb);
ieee80211_tx_status_ni(wl->hw, skb); info->status.rates[0].idx = -1;
info->status.rates[0].count = 0;
ieee80211_tx_status_ni(wl->hw, skb);
}
total[i]++; total[i]++;
} }
} }
...@@ -853,8 +885,8 @@ void wl1271_tx_reset(struct wl1271 *wl, bool reset_tx_queues) ...@@ -853,8 +885,8 @@ void wl1271_tx_reset(struct wl1271 *wl, bool reset_tx_queues)
if (wl->bss_type == BSS_TYPE_AP_BSS) { if (wl->bss_type == BSS_TYPE_AP_BSS) {
for (i = 0; i < AP_MAX_LINKS; i++) { for (i = 0; i < AP_MAX_LINKS; i++) {
wl1271_tx_reset_link_queues(wl, i); wl1271_tx_reset_link_queues(wl, i);
wl->links[i].allocated_blks = 0; wl->links[i].allocated_pkts = 0;
wl->links[i].prev_freed_blks = 0; wl->links[i].prev_freed_pkts = 0;
} }
wl->last_tx_hlid = 0; wl->last_tx_hlid = 0;
......
...@@ -29,9 +29,6 @@ ...@@ -29,9 +29,6 @@
#define TX_HW_MGMT_PKT_LIFETIME_TU 2000 #define TX_HW_MGMT_PKT_LIFETIME_TU 2000
#define TX_HW_AP_MODE_PKT_LIFETIME_TU 8000 #define TX_HW_AP_MODE_PKT_LIFETIME_TU 8000
/* The chipset reference driver states, that the "aid" value 1
* is for infra-BSS, but is still always used */
#define TX_HW_DEFAULT_AID 1
#define TX_HW_ATTR_SAVE_RETRIES BIT(0) #define TX_HW_ATTR_SAVE_RETRIES BIT(0)
#define TX_HW_ATTR_HEADER_PAD BIT(1) #define TX_HW_ATTR_HEADER_PAD BIT(1)
...@@ -116,12 +113,8 @@ struct wl1271_tx_hw_descr { ...@@ -116,12 +113,8 @@ struct wl1271_tx_hw_descr {
u8 id; u8 id;
/* The packet TID value (as User-Priority) */ /* The packet TID value (as User-Priority) */
u8 tid; u8 tid;
union { /* host link ID (HLID) */
/* STA - Identifier of the remote STA in IBSS, 1 in infra-BSS */ u8 hlid;
u8 aid;
/* AP - host link ID (HLID) */
u8 hlid;
} __packed;
u8 reserved; u8 reserved;
} __packed; } __packed;
...@@ -133,7 +126,8 @@ enum wl1271_tx_hw_res_status { ...@@ -133,7 +126,8 @@ enum wl1271_tx_hw_res_status {
TX_TIMEOUT = 4, TX_TIMEOUT = 4,
TX_KEY_NOT_FOUND = 5, TX_KEY_NOT_FOUND = 5,
TX_PEER_NOT_FOUND = 6, TX_PEER_NOT_FOUND = 6,
TX_SESSION_MISMATCH = 7 TX_SESSION_MISMATCH = 7,
TX_LINK_NOT_VALID = 8,
}; };
struct wl1271_tx_hw_res_descr { struct wl1271_tx_hw_res_descr {
...@@ -216,7 +210,7 @@ void wl1271_tx_flush(struct wl1271 *wl); ...@@ -216,7 +210,7 @@ void wl1271_tx_flush(struct wl1271 *wl);
u8 wl1271_rate_to_idx(int rate, enum ieee80211_band band); u8 wl1271_rate_to_idx(int rate, enum ieee80211_band band);
u32 wl1271_tx_enabled_rates_get(struct wl1271 *wl, u32 rate_set); u32 wl1271_tx_enabled_rates_get(struct wl1271 *wl, u32 rate_set);
u32 wl1271_tx_min_rate_get(struct wl1271 *wl); u32 wl1271_tx_min_rate_get(struct wl1271 *wl);
u8 wl1271_tx_get_hlid(struct sk_buff *skb); u8 wl12xx_tx_get_hlid_ap(struct wl1271 *wl, struct sk_buff *skb);
void wl1271_tx_reset_link_queues(struct wl1271 *wl, u8 hlid); void wl1271_tx_reset_link_queues(struct wl1271 *wl, u8 hlid);
void wl1271_handle_tx_low_watermark(struct wl1271 *wl); void wl1271_handle_tx_low_watermark(struct wl1271 *wl);
......
...@@ -112,28 +112,8 @@ extern u32 wl12xx_debug_level; ...@@ -112,28 +112,8 @@ extern u32 wl12xx_debug_level;
true); \ true); \
} while (0) } while (0)
#define WL1271_DEFAULT_STA_RX_CONFIG (CFG_UNI_FILTER_EN | \ #define WL127X_FW_NAME "ti-connectivity/wl127x-fw-3.bin"
CFG_BSSID_FILTER_EN | \ #define WL128X_FW_NAME "ti-connectivity/wl128x-fw-3.bin"
CFG_MC_FILTER_EN)
#define WL1271_DEFAULT_STA_RX_FILTER (CFG_RX_RCTS_ACK | CFG_RX_PRSP_EN | \
CFG_RX_MGMT_EN | CFG_RX_DATA_EN | \
CFG_RX_CTL_EN | CFG_RX_BCN_EN | \
CFG_RX_AUTH_EN | CFG_RX_ASSOC_EN)
#define WL1271_DEFAULT_AP_RX_CONFIG 0
#define WL1271_DEFAULT_AP_RX_FILTER (CFG_RX_RCTS_ACK | CFG_RX_PREQ_EN | \
CFG_RX_MGMT_EN | CFG_RX_DATA_EN | \
CFG_RX_CTL_EN | CFG_RX_AUTH_EN | \
CFG_RX_ASSOC_EN)
#define WL1271_FW_NAME "ti-connectivity/wl1271-fw-2.bin"
#define WL128X_FW_NAME "ti-connectivity/wl128x-fw.bin"
#define WL127X_AP_FW_NAME "ti-connectivity/wl1271-fw-ap.bin"
#define WL128X_AP_FW_NAME "ti-connectivity/wl128x-fw-ap.bin"
/* /*
* wl127x and wl128x are using the same NVS file name. However, the * wl127x and wl128x are using the same NVS file name. However, the
...@@ -157,25 +137,34 @@ extern u32 wl12xx_debug_level; ...@@ -157,25 +137,34 @@ extern u32 wl12xx_debug_level;
#define WL1271_DEFAULT_BEACON_INT 100 #define WL1271_DEFAULT_BEACON_INT 100
#define WL1271_DEFAULT_DTIM_PERIOD 1 #define WL1271_DEFAULT_DTIM_PERIOD 1
#define WL1271_AP_GLOBAL_HLID 0 #define WL12XX_MAX_ROLES 4
#define WL1271_AP_BROADCAST_HLID 1 #define WL12XX_MAX_LINKS 8
#define WL1271_AP_STA_HLID_START 2 #define WL12XX_INVALID_ROLE_ID 0xff
#define WL12XX_INVALID_LINK_ID 0xff
/* Defined by FW as 0. Will not be freed or allocated. */
#define WL12XX_SYSTEM_HLID 0
/*
* TODO: we currently don't support multirole. remove
* this constant from the code when we do.
*/
#define WL1271_AP_STA_HLID_START 3
/* /*
* When in AP-mode, we allow (at least) this number of mem-blocks * When in AP-mode, we allow (at least) this number of packets
* to be transmitted to FW for a STA in PS-mode. Only when packets are * to be transmitted to FW for a STA in PS-mode. Only when packets are
* present in the FW buffers it will wake the sleeping STA. We want to put * present in the FW buffers it will wake the sleeping STA. We want to put
* enough packets for the driver to transmit all of its buffered data before * enough packets for the driver to transmit all of its buffered data before
* the STA goes to sleep again. But we don't want to take too much mem-blocks * the STA goes to sleep again. But we don't want to take too much memory
* as it might hurt the throughput of active STAs. * as it might hurt the throughput of active STAs.
* The number of blocks (18) is enough for 2 large packets.
*/ */
#define WL1271_PS_STA_MAX_BLOCKS (2 * 9) #define WL1271_PS_STA_MAX_PACKETS 2
#define WL1271_AP_BSS_INDEX 0 #define WL1271_AP_BSS_INDEX 0
#define WL1271_AP_DEF_BEACON_EXP 20 #define WL1271_AP_DEF_BEACON_EXP 20
#define ACX_TX_DESCRIPTORS 32 #define ACX_TX_DESCRIPTORS 16
#define WL1271_AGGR_BUFFER_SIZE (4 * PAGE_SIZE) #define WL1271_AGGR_BUFFER_SIZE (4 * PAGE_SIZE)
...@@ -247,26 +236,22 @@ struct wl1271_stats { ...@@ -247,26 +236,22 @@ struct wl1271_stats {
#define AP_MAX_STATIONS 5 #define AP_MAX_STATIONS 5
/* Broadcast and Global links + links to stations */ /* Broadcast and Global links + system link + links to stations */
#define AP_MAX_LINKS (AP_MAX_STATIONS + 2) /*
* TODO: when WL1271_AP_STA_HLID_START is no longer constant, change all
* the places that use this.
*/
#define AP_MAX_LINKS (AP_MAX_STATIONS + 3)
/* FW status registers common for AP/STA */ /* FW status registers */
struct wl1271_fw_common_status { struct wl12xx_fw_status {
__le32 intr; __le32 intr;
u8 fw_rx_counter; u8 fw_rx_counter;
u8 drv_rx_counter; u8 drv_rx_counter;
u8 reserved; u8 reserved;
u8 tx_results_counter; u8 tx_results_counter;
__le32 rx_pkt_descs[NUM_RX_PKT_DESC]; __le32 rx_pkt_descs[NUM_RX_PKT_DESC];
__le32 tx_released_blks[NUM_TX_QUEUES];
__le32 fw_localtime; __le32 fw_localtime;
} __packed;
/* FW status registers for AP */
struct wl1271_fw_ap_status {
struct wl1271_fw_common_status common;
/* Next fields valid only in AP FW */
/* /*
* A bitmap (where each bit represents a single HLID) * A bitmap (where each bit represents a single HLID)
...@@ -274,29 +259,29 @@ struct wl1271_fw_ap_status { ...@@ -274,29 +259,29 @@ struct wl1271_fw_ap_status {
*/ */
__le32 link_ps_bitmap; __le32 link_ps_bitmap;
/* Number of freed MBs per HLID */ /*
u8 tx_lnk_free_blks[AP_MAX_LINKS]; * A bitmap (where each bit represents a single HLID) to indicate
u8 padding_1[1]; * if the station is in Fast mode
} __packed; */
__le32 link_fast_bitmap;
/* FW status registers for STA */ /* Cumulative counter of total released mem blocks since FW-reset */
struct wl1271_fw_sta_status { __le32 total_released_blks;
struct wl1271_fw_common_status common;
u8 tx_total; /* Size (in Memory Blocks) of TX pool */
u8 reserved1; __le32 tx_total;
__le16 reserved2;
__le32 log_start_addr;
} __packed;
struct wl1271_fw_full_status { /* Cumulative counter of released packets per AC */
union { u8 tx_released_pkts[NUM_TX_QUEUES];
struct wl1271_fw_common_status common;
struct wl1271_fw_sta_status sta; /* Cumulative counter of freed packets per HLID */
struct wl1271_fw_ap_status ap; u8 tx_lnk_free_pkts[WL12XX_MAX_LINKS];
};
} __packed;
/* Cumulative counter of released Voice memory blocks */
u8 tx_voice_released_blks;
u8 padding_1[7];
__le32 log_start_addr;
} __packed;
struct wl1271_rx_mem_pool_addr { struct wl1271_rx_mem_pool_addr {
u32 addr; u32 addr;
...@@ -342,7 +327,7 @@ struct wl1271_ap_key { ...@@ -342,7 +327,7 @@ struct wl1271_ap_key {
enum wl12xx_flags { enum wl12xx_flags {
WL1271_FLAG_STA_ASSOCIATED, WL1271_FLAG_STA_ASSOCIATED,
WL1271_FLAG_JOINED, WL1271_FLAG_IBSS_JOINED,
WL1271_FLAG_GPIO_POWER, WL1271_FLAG_GPIO_POWER,
WL1271_FLAG_TX_QUEUE_STOPPED, WL1271_FLAG_TX_QUEUE_STOPPED,
WL1271_FLAG_TX_PENDING, WL1271_FLAG_TX_PENDING,
...@@ -369,11 +354,14 @@ struct wl1271_link { ...@@ -369,11 +354,14 @@ struct wl1271_link {
/* AP-mode - TX queue per AC in link */ /* AP-mode - TX queue per AC in link */
struct sk_buff_head tx_queue[NUM_TX_QUEUES]; struct sk_buff_head tx_queue[NUM_TX_QUEUES];
/* accounting for allocated / available TX blocks in FW */ /* accounting for allocated / freed packets in FW */
u8 allocated_blks; u8 allocated_pkts;
u8 prev_freed_blks; u8 prev_freed_pkts;
u8 addr[ETH_ALEN]; u8 addr[ETH_ALEN];
/* bitmap of TIDs where RX BA sessions are active for this link */
u8 ba_bitmap;
}; };
struct wl1271 { struct wl1271 {
...@@ -405,7 +393,6 @@ struct wl1271 { ...@@ -405,7 +393,6 @@ struct wl1271 {
u8 *fw; u8 *fw;
size_t fw_len; size_t fw_len;
u8 fw_bss_type;
void *nvs; void *nvs;
size_t nvs_len; size_t nvs_len;
...@@ -418,15 +405,30 @@ struct wl1271 { ...@@ -418,15 +405,30 @@ struct wl1271 {
u8 ssid[IEEE80211_MAX_SSID_LEN + 1]; u8 ssid[IEEE80211_MAX_SSID_LEN + 1];
u8 ssid_len; u8 ssid_len;
int channel; int channel;
u8 role_id;
u8 dev_role_id;
u8 system_hlid;
u8 sta_hlid;
u8 dev_hlid;
u8 ap_global_hlid;
u8 ap_bcast_hlid;
unsigned long links_map[BITS_TO_LONGS(WL12XX_MAX_LINKS)];
unsigned long roles_map[BITS_TO_LONGS(WL12XX_MAX_ROLES)];
unsigned long roc_map[BITS_TO_LONGS(WL12XX_MAX_ROLES)];
struct wl1271_acx_mem_map *target_mem_map; struct wl1271_acx_mem_map *target_mem_map;
/* Accounting for allocated / available TX blocks on HW */ /* Accounting for allocated / available TX blocks on HW */
u32 tx_blocks_freed[NUM_TX_QUEUES]; u32 tx_blocks_freed;
u32 tx_blocks_available; u32 tx_blocks_available;
u32 tx_allocated_blocks[NUM_TX_QUEUES]; u32 tx_allocated_blocks;
u32 tx_results_count; u32 tx_results_count;
/* Accounting for allocated / available Tx packets in HW */
u32 tx_pkts_freed[NUM_TX_QUEUES];
u32 tx_allocated_pkts[NUM_TX_QUEUES];
/* Transmitted TX packets counter for chipset interface */ /* Transmitted TX packets counter for chipset interface */
u32 tx_packets_count; u32 tx_packets_count;
...@@ -535,10 +537,6 @@ struct wl1271 { ...@@ -535,10 +537,6 @@ struct wl1271 {
struct work_struct rx_streaming_disable_work; struct work_struct rx_streaming_disable_work;
struct timer_list rx_streaming_timer; struct timer_list rx_streaming_timer;
unsigned int filters;
unsigned int rx_config;
unsigned int rx_filter;
struct completion *elp_compl; struct completion *elp_compl;
struct completion *ps_compl; struct completion *ps_compl;
struct delayed_work elp_work; struct delayed_work elp_work;
...@@ -562,7 +560,7 @@ struct wl1271 { ...@@ -562,7 +560,7 @@ struct wl1271 {
u32 buffer_cmd; u32 buffer_cmd;
u32 buffer_busyword[WL1271_BUSY_WORD_CNT]; u32 buffer_busyword[WL1271_BUSY_WORD_CNT];
struct wl1271_fw_full_status *fw_status; struct wl12xx_fw_status *fw_status;
struct wl1271_tx_hw_res_if *tx_res_if; struct wl1271_tx_hw_res_if *tx_res_if;
struct ieee80211_vif *vif; struct ieee80211_vif *vif;
...@@ -622,6 +620,9 @@ struct wl1271 { ...@@ -622,6 +620,9 @@ struct wl1271 {
/* Platform limitations */ /* Platform limitations */
unsigned int platform_quirks; unsigned int platform_quirks;
/* number of currently active RX BA sessions */
int ba_rx_session_count;
}; };
struct wl1271_station { struct wl1271_station {
...@@ -659,12 +660,6 @@ size_t wl12xx_copy_fwlog(struct wl1271 *wl, u8 *memblock, size_t maxlen); ...@@ -659,12 +660,6 @@ size_t wl12xx_copy_fwlog(struct wl1271 *wl, u8 *memblock, size_t maxlen);
/* Each RX/TX transaction requires an end-of-transaction transfer */ /* Each RX/TX transaction requires an end-of-transaction transfer */
#define WL12XX_QUIRK_END_OF_TRANSACTION BIT(0) #define WL12XX_QUIRK_END_OF_TRANSACTION BIT(0)
/*
* Older firmwares use 2 spare TX blocks
* (for STA < 6.1.3.50.58 or for AP < 6.2.0.0.47)
*/
#define WL12XX_QUIRK_USE_2_SPARE_BLOCKS BIT(1)
/* WL128X requires aggregated packets to be aligned to the SDIO block size */ /* WL128X requires aggregated packets to be aligned to the SDIO block size */
#define WL12XX_QUIRK_BLOCKSIZE_ALIGNMENT BIT(2) #define WL12XX_QUIRK_BLOCKSIZE_ALIGNMENT BIT(2)
......
...@@ -105,18 +105,6 @@ struct wl12xx_ie_country { ...@@ -105,18 +105,6 @@ struct wl12xx_ie_country {
/* Templates */ /* Templates */
struct wl12xx_beacon_template {
struct ieee80211_header header;
__le32 time_stamp[2];
__le16 beacon_interval;
__le16 capability;
struct wl12xx_ie_ssid ssid;
struct wl12xx_ie_rates rates;
struct wl12xx_ie_rates ext_rates;
struct wl12xx_ie_ds_params ds_params;
struct wl12xx_ie_country country;
} __packed;
struct wl12xx_null_data_template { struct wl12xx_null_data_template {
struct ieee80211_header header; struct ieee80211_header header;
} __packed; } __packed;
...@@ -146,19 +134,6 @@ struct wl12xx_arp_rsp_template { ...@@ -146,19 +134,6 @@ struct wl12xx_arp_rsp_template {
__be32 target_ip; __be32 target_ip;
} __packed; } __packed;
struct wl12xx_probe_resp_template {
struct ieee80211_header header;
__le32 time_stamp[2];
__le16 beacon_interval;
__le16 capability;
struct wl12xx_ie_ssid ssid;
struct wl12xx_ie_rates rates;
struct wl12xx_ie_rates ext_rates;
struct wl12xx_ie_ds_params ds_params;
struct wl12xx_ie_country country;
} __packed;
struct wl12xx_disconn_template { struct wl12xx_disconn_template {
struct ieee80211_header header; struct ieee80211_header header;
__le16 disconn_reason; __le16 disconn_reason;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment