wl12xx: Use a single fw for both STA and AP roles
PATCH v3 2/40 wl12xx: Use a single fw for both STA and AP roles
From: Arik Nemtsov <[email protected]>
Firmware >= 6/7.3.0.0.75 (wl127x/wl128x) supports both STA and AP roles.
---
v3: s/WL1271/WL127X in spi.c
drivers/net/wireless/wl12xx/main.c | 31 +++++-------------------------- drivers/net/wireless/wl12xx/sdio.c | 4 +--- drivers/net/wireless/wl12xx/spi.c | 4 +--- drivers/net/wireless/wl12xx/wl12xx.h | 7 ++----- 4 files changed, 9 insertions(+), 37 deletions(-)
drivers/net/wireless/wl12xx/main.c +5 -26
@@ -1040,31 +1040,16 @@ EXPORT_SYMBOL_GPL(wl1271_irq);static int wl1271_fetch_firmware (struct wl1271 *wl) {const struct firmware *fw;const char *fw_name;int ret; -switch (wl->bss_type) { -case BSS_TYPE_AP_BSS : -if (wl->chip.id ==CHIP_ID_1283_PG20 ) - fw_name =WL128X_AP_FW_NAME ; -else - fw_name =WL127X_AP_FW_NAME ; -break ; -case BSS_TYPE_IBSS : -case BSS_TYPE_STA_BSS : -if (wl->chip.id ==CHIP_ID_1283_PG20 ) - fw_name =WL128X_FW_NAME ; -else - fw_name =WL1271_FW_NAME ; -break ; -default : -wl1271_error ("no compatible firmware for bss_type %d" , - wl->bss_type); -return -EINVAL ; - } +if (wl->chip.id ==CHIP_ID_1283_PG20 ) + fw_name =WL128X_FW_NAME ; +else + fw_name =WL127X_FW_NAME ;wl1271_debug (DEBUG_BOOT ,"booting firmware %s" , fw_name); ret =request_firmware (&fw, fw_name,wl1271_wl_to_dev (wl));if (ret <0 ) {
@@ -1087,13 +1072,12 @@ static int wl1271_fetch_firmware(struct wl1271 *wl)wl1271_error ("could not allocate memory for the firmware" ); ret = -ENOMEM ; goto out; }memcpy (wl->fw, fw->data, wl->fw_len); - wl->fw_bss_type = wl->bss_type; ret =0 ; out:release_firmware (fw);return ret;
@@ -1358,14 +1342,13 @@ static int wl1271_chip_wakeup(struct wl1271 *wl)default :wl1271_warning ("unsupported chip id: 0x%x" , wl->chip.id); ret = -ENODEV ; goto out; } -/* Make sure the firmware type matches the BSS type */ -if (wl->fw ==NULL || wl->fw_bss_type != wl->bss_type) { +if (wl->fw ==NULL ) { ret =wl1271_fetch_firmware (wl);if (ret <0 ) goto out; }/* No NVS from netlink, try to get it from the filesystem */
@@ -1793,15 +1776,12 @@ static int wl1271_op_start(struct ieee80211_hw *hw)* initializing the firmware. The MAC address cannot be changed * after boot, and without the proper MAC address, the firmware * will not function properly. * * The MAC address is first known when the corresponding interface * is added. That is where we will initialize the hardware. -* -* In addition, we currently have different firmwares for AP and managed -* operation. We will know which to boot according to interface type. */ return 0 ; }static void wl1271_op_stop (struct ieee80211_hw *hw)
@@ -4390,13 +4370,12 @@ struct ieee80211_hw *wl1271_alloc_hw(void) wl->vif =NULL ; wl->flags =0 ; wl->sg_enabled = true; wl->hw_pg_ver =-1 ; wl->bss_type =MAX_BSS_TYPE ; wl->set_bss_type =MAX_BSS_TYPE ; - wl->fw_bss_type =MAX_BSS_TYPE ; wl->last_tx_hlid =0 ; wl->ap_ps_map =0 ; wl->ap_fw_ps_map =0 ; wl->quirks =0 ; wl->platform_quirks =0 ; wl->sched_scanning = false;
drivers/net/wireless/wl12xx/sdio.c +1 -3
@@ -409,10 +409,8 @@ static void __exit wl1271_exit(void)module_init (wl1271_init);module_exit (wl1271_exit);MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Luciano Coelho <[email protected]>" );MODULE_AUTHOR ("Juuso Oikarinen <[email protected]>" ); -MODULE_FIRMWARE (WL1271_FW_NAME ); +MODULE_FIRMWARE (WL127X_FW_NAME );MODULE_FIRMWARE (WL128X_FW_NAME ); -MODULE_FIRMWARE (WL127X_AP_FW_NAME ); -MODULE_FIRMWARE (WL128X_AP_FW_NAME );
drivers/net/wireless/wl12xx/spi.c +1 -3
@@ -483,11 +483,9 @@ static void __exit wl1271_exit(void)module_init (wl1271_init);module_exit (wl1271_exit);MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Luciano Coelho <[email protected]>" );MODULE_AUTHOR ("Juuso Oikarinen <[email protected]>" ); -MODULE_FIRMWARE (WL1271_FW_NAME ); +MODULE_FIRMWARE (WL127X_FW_NAME );MODULE_FIRMWARE (WL128X_FW_NAME ); -MODULE_FIRMWARE (WL127X_AP_FW_NAME ); -MODULE_FIRMWARE (WL128X_AP_FW_NAME );MODULE_ALIAS ("spi:wl1271" );
drivers/net/wireless/wl12xx/wl12xx.h +2 -5
@@ -127,16 +127,14 @@ extern u32 wl12xx_debug_level; 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" +#define WL127X_FW_NAME "ti-connectivity/wl127x-fw-3.bin" +#define WL128X_FW_NAME "ti-connectivity/wl128x-fw-3.bin"/* * wl127x and wl128x are using the same NVS file name. However, the * ini parameters between them are different. The driver validates * the correct NVS size in wl1271_boot_upload_nvs(). */
@@ -402,13 +400,12 @@ struct wl1271 {int cmd_box_addr;int event_box_addr;u8 *fw;size_t fw_len; -u8 fw_bss_type;void *nvs;size_t nvs_len;s8 hw_pg_ver;u8 bssid[ETH_ALEN ];
Signature · 1 line
1.7.6.401.g6a319
PATCH v3 23/40 wl12xx: re-enable block ack session support
From: Arik Nemtsov <[email protected]>
Incorporate interface changes for HT support.
Add ba_bitmap field to the wl1271_link struct, to indicate activate RX BA sessions (for AP mode).
---
v3: don't change tx_ba_win_size conf value (64)
drivers/net/wireless/wl12xx/acx.c | 66 +++++---------- drivers/net/wireless/wl12xx/acx.h | 82 ++++++------------- drivers/net/wireless/wl12xx/cmd.h | 1 + drivers/net/wireless/wl12xx/conf.h | 9 ++- drivers/net/wireless/wl12xx/init.c | 37 +++------ drivers/net/wireless/wl12xx/main.c | 146 ++++++++++++++++++++++++---------- drivers/net/wireless/wl12xx/wl12xx.h | 6 ++ 7 files changed, 177 insertions(+), 170 deletions(-)
drivers/net/wireless/wl12xx/acx.c +22 -44
@@ -1320,25 +1320,21 @@ int wl1271_acx_set_ht_capabilities(struct wl1271 *wl, acx =kzalloc (sizeof (*acx),GFP_KERNEL );if (!acx) { ret = -ENOMEM ; goto out; } -/* Allow HT Operation ? */ if (allow_ht_operation) { - ht_capabilites = -WL1271_ACX_FW_CAP_HT_OPERATION ; -if (ht_cap->cap &IEEE80211_HT_CAP_GRN_FLD ) - ht_capabilites |= -WL1271_ACX_FW_CAP_GREENFIELD_FRAME_FORMAT ; -if (ht_cap->cap &IEEE80211_HT_CAP_SGI_20 ) - ht_capabilites |= -WL1271_ACX_FW_CAP_SHORT_GI_FOR_20MHZ_PACKETS ; -if (ht_cap->cap &IEEE80211_HT_CAP_LSIG_TXOP_PROT ) - ht_capabilites |= -WL1271_ACX_FW_CAP_LSIG_TXOP_PROTECTION ; +/* no need to translate capabilities - use the spec values */ + ht_capabilites = ht_cap->cap; + +/* +* this bit is not employed by the spec but only by FW to +* indicate peer HT support +*/ + ht_capabilites |=WL12XX_HT_CAP_HT_OPERATION ;/* get data from A-MPDU parameters field */ acx->ampdu_max_length = ht_cap->ampdu_factor; acx->ampdu_min_spacing = ht_cap->ampdu_density; }
@@ -1389,82 +1385,64 @@ int wl1271_acx_set_ht_information(struct wl1271 *wl, out:kfree (acx);return ret; }/* Configure BA session initiator/receiver parameters setting in the FW. */ -int wl1271_acx_set_ba_session (struct wl1271 *wl, -enum ieee80211_back_parties direction, -u8 tid_index,u8 policy) +int wl12xx_acx_set_ba_initiator_policy (struct wl1271 *wl) { -struct wl1271_acx_ba_session_policy *acx; +struct wl1271_acx_ba_initiator_policy *acx;int ret; -wl1271_debug (DEBUG_ACX ,"acx ba session setting" ); +wl1271_debug (DEBUG_ACX ,"acx ba initiator policy" ); acx =kzalloc (sizeof (*acx),GFP_KERNEL );if (!acx) { ret = -ENOMEM ; goto out; } -/* ANY role */ - acx->role_id =0xff ; - acx->tid = tid_index; - acx->enable = policy; - acx->ba_direction = direction; - -switch (direction) { -case WLAN_BACK_INITIATOR : - acx->win_size = wl->conf.ht.tx_ba_win_size; - acx->inactivity_timeout = wl->conf.ht.inactivity_timeout; -break ; -case WLAN_BACK_RECIPIENT : - acx->win_size =RX_BA_WIN_SIZE ; - acx->inactivity_timeout =0 ; -break ; -default : -wl1271_error ("Incorrect acx command id=%x\n" , direction); - ret = -EINVAL ; - goto out; - } +/* set for the current role */ + acx->role_id = wl->role_id; + acx->tid_bitmap = wl->conf.ht.tx_ba_tid_bitmap; + acx->win_size = wl->conf.ht.tx_ba_win_size; + acx->inactivity_timeout = wl->conf.ht.inactivity_timeout; ret =wl1271_cmd_configure (wl, -ACX_BA_SESSION_POLICY_CFG , +ACX_BA_SESSION_INIT_POLICY , acx,sizeof (*acx));if (ret <0 ) { -wl1271_warning ("acx ba session setting failed: %d" , ret); +wl1271_warning ("acx ba initiator policy failed: %d" , ret); goto out; } out:kfree (acx);return ret; }/* setup BA session receiver setting in the FW. */ -int wl1271_acx_set_ba_receiver_session (struct wl1271 *wl,u8 tid_index,u16 ssn, -bool enable) +int wl12xx_acx_set_ba_receiver_session (struct wl1271 *wl,u8 tid_index, +u16 ssn,bool enable,u8 peer_hlid) {struct wl1271_acx_ba_receiver_setup *acx;int ret;wl1271_debug (DEBUG_ACX ,"acx ba receiver session setting" ); acx =kzalloc (sizeof (*acx),GFP_KERNEL );if (!acx) { ret = -ENOMEM ; goto out; } -/* Single link for now */ - acx->link_id =1 ; + acx->hlid = peer_hlid; acx->tid = tid_index; acx->enable = enable; - acx->win_size =0 ; + acx->win_size = wl->conf.ht.rx_ba_win_size; acx->ssn = ssn; ret =wl1271_cmd_configure (wl,ACX_BA_SESSION_RX_SETUP , acx,sizeof (*acx));if (ret <0 ) {wl1271_warning ("acx ba receiver session failed: %d" , ret);
drivers/net/wireless/wl12xx/acx.h +27 -55
174 lines not on this page · raw message
drivers/net/wireless/wl12xx/cmd.h +1 -0
@@ -205,12 +205,13 @@ enum {CMD_STATUS_STA_TABLE_FULL =17 ,CMD_STATUS_RADIO_ERROR =18 ,CMD_STATUS_WRONG_NESTING =19 ,CMD_STATUS_TIMEOUT =21 ,/* Driver internal use.*/ CMD_STATUS_FW_RESET =22 ,/* Driver internal use.*/ CMD_STATUS_TEMPLATE_OOM =23 , +CMD_STATUS_NO_RX_BA_SESSION =24 , MAX_COMMAND_STATUS = 0xff };#define CMDMBOX_HEADER_LEN 4#define CMDMBOX_INFO_ELEM_HEADER_LEN 4
drivers/net/wireless/wl12xx/conf.h +8 -1
@@ -554,12 +554,15 @@ struct conf_tx_ac_category {*/ u16 tx_op_limit; };#define CONF_TX_MAX_TID_COUNT 8 +/* Allow TX BA on all TIDs but 6,7. These are currently reserved in the FW */ +#define CONF_TX_BA_ENABLED_TID_BITMAP 0x3F +enum {CONF_CHANNEL_TYPE_DCF =0 ,/* DC/LEGACY*/ CONF_CHANNEL_TYPE_EDCF =1 ,/* EDCA*/ CONF_CHANNEL_TYPE_HCCA =2 ,/* HCCA*/ };
@@ -1092,14 +1095,18 @@ struct conf_rf_settings {* Range: s8 */ u8 tx_per_channel_power_compensation_5[CONF_TX_PWR_COMPENSATION_LEN_5 ]; };struct conf_ht_setting { -u16 tx_ba_win_size; +u8 rx_ba_win_size; +u8 tx_ba_win_size;u16 inactivity_timeout; + +/* bitmap of enabled TIDs for TX BA sessions */ +u8 tx_ba_tid_bitmap; };struct conf_memory_settings {/* Number of stations supported in IBSS mode */ u8 num_stations;
drivers/net/wireless/wl12xx/init.c +10 -27
@@ -526,47 +526,30 @@ int wl1271_init_ap_rates(struct wl1271 *wl)return ret; }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) { -u8 tid_index; -int ret =0 ; -/* Reset the BA RX indicators */ wl->ba_rx_bitmap =0 ; wl->ba_allowed = true; + wl->ba_rx_session_count =0 ; -/* validate that FW support BA */ -wl1271_check_ba_support (wl); +/* BA is supported in STA/AP modes */ +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) -/* 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 ; - } + wl->ba_support = true; -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 ret =0 ;
drivers/net/wireless/wl12xx/main.c +103 -43
238 lines not on this page · raw message
drivers/net/wireless/wl12xx/wl12xx.h +6 -0
@@ -352,12 +352,15 @@ struct wl1271_link {/* accounting for allocated / available TX blocks in FW */ u8 allocated_blks;u8 prev_freed_blks;u8 addr[ETH_ALEN ]; + +/* bitmap of TIDs where RX BA sessions are active for this link */ +u8 ba_bitmap; };struct wl1271 {struct platform_device *plat_dev;struct ieee80211_hw *hw;bool mac80211_registered;
@@ -606,12 +609,15 @@ struct wl1271 {/* Quirks of specific hardware revisions */ unsigned int quirks;/* Platform limitations */ unsigned int platform_quirks; + +/* number of currently active RX BA sessions */ +int ba_rx_session_count; };struct wl1271_station {u8 hlid; };
Signature · 1 line
1.7.6.401.g6a319
Quoted 9 lines · Eliad Peller
From: Arik Nemtsov <[email protected]>
Firmware >= 6/7.3.0.0.75 (wl127x/wl128x) supports both STA and AP roles.
Signed-off-by Arik Nemtsov <[email protected]>Signed-off-by Eliad Peller <[email protected]>---
v3: s/WL1271/WL127X inspi.c
Ah, nice that you fixed this. I had actually seen this problem (I always compile the SPI module) and I had already fixed it in my tree.
Signature · 2 lines
Cheers, Luca.