wlcore/wl12xx/wl18xx: more pathes for 3.6
Subsystems (2)
cover wlcore/wl12xx/wl18xx: more pathes for 3.6
Hi,
This is one more batch of patches intended for 3.6. It contains a some patches by Yair related to interfaces with userspace (PLT, calibrator and wlconf) and a few bugfixes by Eyal, Eliad and Arik. Also a couple of my own patches to fix some out-of-sync issues with the firmware.
Please review.
Cheers,
Luca.
Arik Nemtsov (4):
wl18xx: alloc conf.phy memory to ensure alignemnt
wl18xx: fix bogus compile warning on cc config option
wlcore: don't issue SLEEP_AUTH command during recovery
wl18xx: enable MIMO rates when connected as a MIMO STA
Eliad Peller (1):
wlcore: use basic rates for non-data packets
Eyal Shapira (1):
wlcore: don't re-configure wakeup conditions if not needed
Igal Chernobelsky (1):
wlcore: send EAPOLs using minimum basic rate for all roles
Luciano Coelho (2):
wlcore: wait for command completion event when sending CMD_ROLE_STOP
wlcore: increase command completion timeout
Yair Shapira (5):
wl18xx: add support for ht_mode in conf.h
wlcore: add plt_mode including new PLT_FEM_DETECT
wl18xx: disable calibrator based fem detect wlcore/wl12xx: calibrator fem detect implementation
wlcore: make usage of nla_put clearer
drivers/net/wireless/ti/wl12xx/cmd.c | 34 ++++++++- drivers/net/wireless/ti/wl12xx/main.c | 23 ++++++ drivers/net/wireless/ti/wl18xx/conf.h | 21 +++++- drivers/net/wireless/ti/wl18xx/io.c | 2 +- drivers/net/wireless/ti/wl18xx/main.c | 117 +++++++++++++++++++++-------- drivers/net/wireless/ti/wlcore/cmd.c | 12 +++ drivers/net/wireless/ti/wlcore/cmd.h | 2 +- drivers/net/wireless/ti/wlcore/main.c | 44 ++++++++++- drivers/net/wireless/ti/wlcore/testmode.c | 85 +++++++++++++++------ drivers/net/wireless/ti/wlcore/tx.c | 14 ++-- drivers/net/wireless/ti/wlcore/wlcore.h | 2 + drivers/net/wireless/ti/wlcore/wlcore_i.h | 8 +- 12 files changed, 290 insertions(+), 74 deletions(-)
Signature · 1 line
1.7.10.4
PATCH 1/14 wl18xx: alloc conf.phy memory to ensure alignemnt
From: Arik Nemtsov <[email protected]>
We get DMA alignment trouble if the beginning of the conf.phy struct is not aligned to 4 bytes. Use kmemdup to ensure alignment.
--- drivers/net/wireless/ti/wl18xx/main.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/net/wireless/ti/wl18xx/main.c +10 -2
@@ -772,16 +772,24 @@ out:static int wl18xx_set_mac_and_phy (struct wl1271 *wl) {struct wl18xx_priv *priv = wl->priv; +struct wl18xx_mac_and_phy_params *params;int ret; + params =kmemdup (&priv->conf.phy,sizeof (*params),GFP_KERNEL ); +if (!params) { + ret = -ENOMEM ; + goto out; + } + ret =wlcore_set_partition (wl, &wl->ptable[PART_PHY_INIT ]);if (ret <0 ) goto out; - ret =wlcore_write (wl,WL18XX_PHY_INIT_MEM_ADDR , (u8 *)&priv->conf.phy, -sizeof (struct wl18xx_mac_and_phy_params ), false); + ret =wlcore_write (wl,WL18XX_PHY_INIT_MEM_ADDR , params, +sizeof (*params), false); out: +kfree (params);return ret; }
Signature · 1 line
1.7.10.4
PATCH 2/14 wlcore: don't re-configure wakeup conditions if not needed
In reply to Luciano CoelhoFrom: Eyal Shapira <[email protected]>
suspend and resume callbacks configure wakeup conditions to the FW which may be different between suspend and resume.
This feature is currently not utilized as both in suspend and resume FW wakeup every 1 DTIM. Avoid waking up the chip and doing the FW command unless there's an actual difference in the wakeup conditions.
--- drivers/net/wireless/ti/wlcore/main.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/net/wireless/ti/wlcore/main.c +13 -0
@@ -1585,6 +1585,12 @@ static int wl1271_configure_suspend_sta(struct wl1271 *wl,if (!test_bit (WLVIF_FLAG_STA_ASSOCIATED , &wlvif->flags)) goto out; +if ((wl->conf.conn.suspend_wake_up_event == + wl->conf.conn.wake_up_event) && + (wl->conf.conn.suspend_listen_interval == + wl->conf.conn.listen_interval)) + goto out; + ret =wl1271_ps_elp_wakeup (wl);if (ret <0 ) goto out;
@@ -1648,6 +1654,13 @@ static void wl1271_configure_resume(struct wl1271 *wl,if ((!is_ap) && (!is_sta))return ; +if (is_sta && + ((wl->conf.conn.suspend_wake_up_event == + wl->conf.conn.wake_up_event) && + (wl->conf.conn.suspend_listen_interval == + wl->conf.conn.listen_interval))) +return ; + ret =wl1271_ps_elp_wakeup (wl);if (ret <0 )return ;
Signature · 1 line
1.7.10.4
PATCH 3/14 wl18xx: add support for ht_mode in conf.h
In reply to Luciano CoelhoFrom: Yair Shapira <[email protected]>
ht_mode added to wl18xx conf struct in order to support different modes from the configuration file, as well as module params, and by default (working without a conf file and/or no module params).
the hack regarding conf.phy.low_band_component_type for each board is now explicitly handled after parsing module params. missing default values to wl18xx config added.
fix string module params not to have defaults (so if empty, param can be taken from conf file).
update conf version to 3.
--- drivers/net/wireless/ti/wl18xx/conf.h | 21 ++++++++- drivers/net/wireless/ti/wl18xx/main.c | 83 ++++++++++++++++++++++----------- 2 files changed, 77 insertions(+), 27 deletions(-)
drivers/net/wireless/ti/wl18xx/conf.h +20 -1
@@ -23,7 +23,7 @@#define __WL18XX_CONF_H__#define WL18XX_CONF_MAGIC 0x10e100ca -#define WL18XX_CONF_VERSION (WLCORE_CONF_VERSION | 0x0002) +#define WL18XX_CONF_VERSION (WLCORE_CONF_VERSION | 0x0003)#define WL18XX_CONF_MASK 0x0000ffff#define WL18XX_CONF_SIZE (WLCORE_CONF_SIZE + \ sizeof(struct wl18xx_priv_conf))
@@ -84,7 +84,26 @@ struct wl18xx_mac_and_phy_params {u8 padding[1 ]; } __packed; +enum wl18xx_ht_mode { +/* Default - use MIMO, fallback to SISO20 */ +HT_MODE_DEFAULT =0 , + +/* Wide - use SISO40 */ +HT_MODE_WIDE =1 , + +/* Use SISO20 */ +HT_MODE_SISO20 =2 , +}; + +struct wl18xx_ht_settings { +/* DEFAULT / WIDE / SISO20 */ +u8 mode; +} __packed; +struct wl18xx_priv_conf { +/* Module params structures */ +struct wl18xx_ht_settings ht; +/* this structure is copied wholesale to FW */ struct wl18xx_mac_and_phy_params phy; } __packed;
drivers/net/wireless/ti/wl18xx/main.c +57 -26
135 lines not on this page · raw message
Signature · 1 line
1.7.10.4
PATCH 4/14 wlcore: send EAPOLs using minimum basic rate for all roles
In reply to Luciano CoelhoFrom: Igal Chernobelsky <[email protected]>
Send EAPOLs using minimum basic rate for AP, STA, p2p GO and Client. The patch fixes p2p connection issue with Realtek device in p2p certification test 5.1.13 (DEVUT reinvokes Persistent Group).
--- drivers/net/wireless/ti/wlcore/tx.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/net/wireless/ti/wlcore/tx.c +6 -4
@@ -310,10 +310,10 @@ static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct wl12xx_vif *wlvif,* send them with AP rate policies (EAPOLs are an exception), * otherwise use default basic rates */ -if (control->flags &IEEE80211_TX_CTL_NO_CCK_RATE ) - rate_idx = wlvif->sta.p2p_rate_idx; -else if (skb->protocol ==cpu_to_be16 (ETH_P_PAE )) +if (skb->protocol ==cpu_to_be16 (ETH_P_PAE )) rate_idx = wlvif->sta.basic_rate_idx; +else if (control->flags &IEEE80211_TX_CTL_NO_CCK_RATE ) + rate_idx = wlvif->sta.p2p_rate_idx;else if (control->control.sta) rate_idx = wlvif->sta.ap_rate_idx;else
@@ -321,7 +321,9 @@ static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct wl12xx_vif *wlvif, }else {if (hlid == wlvif->ap.global_hlid) rate_idx = wlvif->ap.mgmt_rate_idx; -else if (hlid == wlvif->ap.bcast_hlid) +else if (hlid == wlvif->ap.bcast_hlid || + skb->protocol ==cpu_to_be16 (ETH_P_PAE )) +/* send AP bcast and EAPOLs using the min basic rate */ rate_idx = wlvif->ap.bcast_rate_idx;else rate_idx = wlvif->ap.ucast_rate_idx[ac];
Signature · 1 line
1.7.10.4
PATCH 5/14 wl18xx: fix bogus compile warning on cc config option
In reply to Luciano CoelhoFrom: Arik Nemtsov <[email protected]>
Initialize val to 0, to remove the following warning with CONFIG_CC_OPTIMIZE_FOR_SIZE. The compiler used was gcc 4.4.1 (Sourcery G++ Lite 2010q1-202).
drivers/net/wireless/ti/wl18xx/io.c: In function 'wl18xx_top_reg_read':drivers/net/wireless/ti/wl18xx/io.c:57: warning: 'val' may be used uninitialized in this function
--- drivers/net/wireless/ti/wl18xx/io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ti/wl18xx/io.c +1 -1
@@ -54,7 +54,7 @@ out:int wl18xx_top_reg_read (struct wl1271 *wl,int addr,u16 *out) { -u32 val; +u32 val =0 ;int ret;if (WARN_ON (addr %2 ))
Signature · 1 line
1.7.10.4
PATCH 6/14 wlcore: don't issue SLEEP_AUTH command during recovery
In reply to Luciano CoelhoFrom: Arik Nemtsov <[email protected]>
During interface removal, don't adjust sleep_auth if we are during recovery. Since the FW is potentially dead we shouldn't talk to it.
--- drivers/net/wireless/ti/wlcore/main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/net/wireless/ti/wlcore/main.c +9 -1
@@ -2377,7 +2377,14 @@ deinit:else wl->sta_count--; -/* Last AP, have more stations. Configure according to STA. */ +/* +* Last AP, have more stations. Configure sleep auth according to STA. +* Don't do thin on unintended recovery. +*/ +if (test_bit (WL1271_FLAG_RECOVERY_IN_PROGRESS , &wl->flags) && + !test_bit (WL1271_FLAG_INTENDED_FW_RECOVERY , &wl->flags)) + goto unlock; +if (wl->ap_count ==0 && is_ap && wl->sta_count) {u8 sta_auth = wl->conf.conn.sta_sleep_auth;/* Configure for power according to debugfs */
@@ -2391,6 +2398,7 @@ deinit:wl1271_acx_sleep_auth (wl,WL1271_PSM_ELP ); } +unlock:mutex_unlock (&wl->mutex);del_timer_sync (&wlvif->rx_streaming_timer);
Signature · 1 line
1.7.10.4
PATCH 7/14 wlcore: use basic rates for non-data packets
In reply to Luciano CoelhoFrom: Eliad Peller <[email protected]>
After the latest mac80211 changes, the sta has the ap's sta pointer even before association.
This cause the auth and assoc frames to be sent with the standard ap's rates, rather than the basic rates.
Change the tx rate policy logic to use the regular ap rates only for data packets (so control and mgmt packets will be sent with basic rates)
--- drivers/net/wireless/ti/wlcore/tx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ti/wlcore/tx.c +2 -2
@@ -306,7 +306,7 @@ static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct wl12xx_vif *wlvif, rate_idx =0 ; else if (wlvif->bss_type != BSS_TYPE_AP_BSS) {/* -* if the packets are destined for AP (have a STA entry) +* if the packets are data packets * send them with AP rate policies (EAPOLs are an exception), * otherwise use default basic rates */
@@ -314,7 +314,7 @@ static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct wl12xx_vif *wlvif, rate_idx = wlvif->sta.basic_rate_idx; else if (control->flags & IEEE80211_TX_CTL_NO_CCK_RATE) rate_idx = wlvif->sta.p2p_rate_idx; - else if (control->control.sta) + else if (ieee80211_is_data(frame_control)) rate_idx = wlvif->sta.ap_rate_idx; else rate_idx = wlvif->sta.basic_rate_idx;
Signature · 1 line
1.7.10.4
PATCH 8/14 wlcore: add plt_mode including new PLT_FEM_DETECT
In reply to Luciano CoelhoFrom: Yair Shapira <[email protected]>
add wl->plt_mode that is used to indicate different plt working modes: this will be used to implement calibrator side auto fem detection where driver asks firmware to detect the wlan fem radio type and returns it to calibrator.
this is not implemented yet and plt_modes: PLT_ON and PLT_FEM_DETECT currently behave the same.
--- drivers/net/wireless/ti/wlcore/main.c | 21 ++++++++++++++++++--- drivers/net/wireless/ti/wlcore/testmode.c | 7 ++++--- drivers/net/wireless/ti/wlcore/wlcore.h | 1 + drivers/net/wireless/ti/wlcore/wlcore_i.h | 8 +++++++- 4 files changed, 30 insertions(+), 7 deletions(-)
drivers/net/wireless/ti/wlcore/main.c +18 -3
@@ -1064,10 +1064,17 @@ out:return ret; } -int wl1271_plt_start (struct wl1271 *wl) +int wl1271_plt_start (struct wl1271 *wl,const enum plt_mode plt_mode) {int retries =WL1271_BOOT_RETRIES ;struct wiphy *wiphy = wl->hw->wiphy; + +static const char *const PLT_MODE [] = { +"PLT_OFF" , +"PLT_ON" , +"PLT_FEM_DETECT" + }; +int ret;mutex_lock (&wl->mutex);
@@ -1081,6 +1088,10 @@ int wl1271_plt_start(struct wl1271 *wl) goto out; } +/* Indicate to lower levels that we are now in PLT mode */ + wl->plt = true; + wl->plt_mode = plt_mode; +while (retries) { retries--; ret =wl12xx_chip_wakeup (wl, true);
@@ -1091,9 +1102,9 @@ int wl1271_plt_start(struct wl1271 *wl)if (ret <0 ) goto power_off; - wl->plt = true; wl->state =WL1271_STATE_ON ; -wl1271_notice ("firmware booted in PLT mode (%s)" , +wl1271_notice ("firmware booted in PLT mode %s (%s)" , +PLT_MODE [plt_mode], wl->chip.fw_ver_str);/* update hw/fw version info in wiphy struct */
@@ -1107,6 +1118,9 @@ power_off:wl1271_power_off (wl); } + wl->plt = false; + wl->plt_mode =PLT_OFF ; +wl1271_error ("firmware boot in PLT mode failed despite %d retries" ,WL1271_BOOT_RETRIES ); out:
@@ -1159,6 +1173,7 @@ int wl1271_plt_stop(struct wl1271 *wl) wl->sleep_auth =WL1271_PSM_ILLEGAL ; wl->state =WL1271_STATE_OFF ; wl->plt = false; + wl->plt_mode =PLT_OFF ; wl->rx_counter =0 ;mutex_unlock (&wl->mutex);
drivers/net/wireless/ti/wlcore/testmode.c +4 -3
@@ -258,11 +258,12 @@ static int wl1271_tm_cmd_set_plt_mode(struct wl1271 *wl, struct nlattr *tb[]) val =nla_get_u32 (tb[WL1271_TM_ATTR_PLT_MODE ]);switch (val) { -case 0 : +case PLT_OFF : ret =wl1271_plt_stop (wl);break ; -case 1 : - ret =wl1271_plt_start (wl); +case PLT_ON : +case PLT_FEM_DETECT : + ret =wl1271_plt_start (wl, val);break ;default : ret = -EINVAL ;
drivers/net/wireless/ti/wlcore/wlcore.h +1 -0
@@ -156,6 +156,7 @@ struct wl1271 {enum wl1271_state state;enum wl12xx_fw_type fw_type;bool plt; +enum plt_mode plt_mode;u8 last_vif_count;struct mutex mutex;
drivers/net/wireless/ti/wlcore/wlcore_i.h +7 -1
@@ -293,6 +293,12 @@ enum rx_filter_action {FILTER_FW_HANDLE =2 }; +enum plt_mode { +PLT_OFF =0 , +PLT_ON =1 , +PLT_FEM_DETECT =2 , +}; +struct wl12xx_rx_filter_field {__le16 offset;u8 len;
@@ -459,7 +465,7 @@ struct ieee80211_vif *wl12xx_wlvif_to_vif(struct wl12xx_vif *wlvif)#define wl12xx_for_each_wlvif_ap (wl, wlvif) \ wl12xx_for_each_wlvif_bss_type(wl, wlvif, BSS_TYPE_AP_BSS) -int wl1271_plt_start (struct wl1271 *wl); +int wl1271_plt_start (struct wl1271 *wl,const enum plt_mode plt_mode);int wl1271_plt_stop (struct wl1271 *wl);int wl1271_recalc_rx_streaming (struct wl1271 *wl,struct wl12xx_vif *wlvif);void wl12xx_queue_recovery_work (struct wl1271 *wl);
Signature · 1 line
1.7.10.4
PATCH 9/14 wl18xx: disable calibrator based fem detect
In reply to Luciano CoelhoFrom: Yair Shapira <[email protected]>
bip calibration is not required in wl18xx. Therefore we disable also auto fem (using calibrator fem detect) mode.
--- drivers/net/wireless/ti/wl18xx/main.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/wireless/ti/wl18xx/main.c +6 -0
@@ -1148,6 +1148,12 @@ static int wl18xx_plt_init(struct wl1271 *wl) {int ret; +/* calibrator based auto/fem detect not supported for 18xx */ +if (wl->plt_mode ==PLT_FEM_DETECT ) { +wl1271_error ("wl18xx_plt_init: PLT FEM_DETECT not supported" ); +return -EINVAL ; + } + ret =wlcore_write32 (wl,WL18XX_SCR_PAD8 ,WL18XX_SCR_PAD8_PLT );if (ret <0 )return ret;
Signature · 1 line
1.7.10.4
PATCH 10/14 wlcore/wl12xx: calibrator fem detect implementation
In reply to Luciano CoelhoFrom: Yair Shapira <[email protected]>
this completes the calibrator based fem detect logic in driver:
driver starts (by calibrator) in plt_mode PLT_FEM_DETECT wlcore inits and starts plt on wl12xx
wl12xx fetches fem number from firmware and stores it in wl->fem_manuf wl12xx immediatly returns (doesn't start radio, etc...) wlcore returns the fem_manuf to calibrator using WL1271_TM_ATTR_DATA plt_mode is stopped
--- drivers/net/wireless/ti/wl12xx/cmd.c | 34 +++++++++++++++++++++--- drivers/net/wireless/ti/wl12xx/main.c | 23 ++++++++++++++++ drivers/net/wireless/ti/wlcore/testmode.c | 41 ++++++++++++++++++++++++++++- drivers/net/wireless/ti/wlcore/wlcore.h | 1 + 4 files changed, 94 insertions(+), 5 deletions(-)
drivers/net/wireless/ti/wl12xx/cmd.c +30 -4
@@ -85,7 +85,11 @@ int wl1271_cmd_general_parms(struct wl1271 *wl)memcpy (&gen_parms->general_params, gp,sizeof (*gp)); -if (gp->tx_bip_fem_auto_detect) +/* If we started in PLT FEM_DETECT mode, force auto detect */ +if (wl->plt_mode ==PLT_FEM_DETECT ) + gen_parms->general_params.tx_bip_fem_auto_detect = true; + +if (gen_parms->general_params.tx_bip_fem_auto_detect) answer = true;/* Override the REF CLK from the NVS with the one from platform data */
@@ -106,8 +110,17 @@ int wl1271_cmd_general_parms(struct wl1271 *wl) goto out; } +/* If we are in calibrator based fem auto detect - save fem nr */ +if (wl->plt_mode ==PLT_FEM_DETECT ) + wl->fem_manuf = gp->tx_bip_fem_manufacturer; +wl1271_debug (DEBUG_CMD ,"FEM autodetect: %s, manufacturer: %d\n" , - answer ?"auto" :"manual" , gp->tx_bip_fem_manufacturer); + answer == false ? +"manual" : + wl->plt_mode ==PLT_FEM_DETECT ? +"calibrator_fem_detect" : +"auto" , + gp->tx_bip_fem_manufacturer); out:kfree (gen_parms);
@@ -139,7 +152,11 @@ int wl128x_cmd_general_parms(struct wl1271 *wl)memcpy (&gen_parms->general_params, gp,sizeof (*gp)); -if (gp->tx_bip_fem_auto_detect) +/* If we started in PLT FEM_DETECT mode, force auto detect */ +if (wl->plt_mode ==PLT_FEM_DETECT ) + gen_parms->general_params.tx_bip_fem_auto_detect = true; + +if (gen_parms->general_params.tx_bip_fem_auto_detect) answer = true;/* Replace REF and TCXO CLKs with the ones from platform data */
@@ -161,8 +178,17 @@ int wl128x_cmd_general_parms(struct wl1271 *wl) goto out; } +/* If we are in calibrator based fem auto detect - save fem nr */ +if (wl->plt_mode ==PLT_FEM_DETECT ) + wl->fem_manuf = gp->tx_bip_fem_manufacturer; +wl1271_debug (DEBUG_CMD ,"FEM autodetect: %s, manufacturer: %d\n" , - answer ?"auto" :"manual" , gp->tx_bip_fem_manufacturer); + answer == false ? +"manual" : + wl->plt_mode ==PLT_FEM_DETECT ? +"calibrator_fem_detect" : +"auto" , + gp->tx_bip_fem_manufacturer); out:kfree (gen_parms);
drivers/net/wireless/ti/wl12xx/main.c +23 -0
@@ -1339,6 +1339,14 @@ static int wl12xx_hw_init(struct wl1271 *wl) ret =wl128x_cmd_general_parms (wl);if (ret <0 ) goto out; + +/* +* If we are in calibrator based auto detect then we got the FEM nr +* in wl->fem_manuf. No need to continue further +*/ +if (wl->plt_mode ==PLT_FEM_DETECT ) + goto out; + ret =wl128x_cmd_radio_parms (wl);if (ret <0 ) goto out;
@@ -1355,6 +1363,14 @@ static int wl12xx_hw_init(struct wl1271 *wl) ret =wl1271_cmd_general_parms (wl);if (ret <0 ) goto out; + +/* +* If we are in calibrator based auto detect then we got the FEM nr +* in wl->fem_manuf. No need to continue further +*/ +if (wl->plt_mode ==PLT_FEM_DETECT ) + goto out; + ret =wl1271_cmd_radio_parms (wl);if (ret <0 ) goto out;
@@ -1500,6 +1516,13 @@ static int wl12xx_plt_init(struct wl1271 *wl)if (ret <0 ) goto out_irq_disable; +/* +* If we are in calibrator based auto detect then we got the FEM nr +* in wl->fem_manuf. No need to continue further +*/ +if (wl->plt_mode ==PLT_FEM_DETECT ) + goto out; + ret =wl1271_acx_init_mem_config (wl);if (ret <0 ) goto out_irq_disable;
drivers/net/wireless/ti/wlcore/testmode.c +40 -1
54 lines not on this page · raw message
drivers/net/wireless/ti/wlcore/wlcore.h +1 -0
@@ -157,6 +157,7 @@ struct wl1271 {enum wl12xx_fw_type fw_type;bool plt;enum plt_mode plt_mode; +u8 fem_manuf;u8 last_vif_count;struct mutex mutex;
Signature · 1 line
1.7.10.4
PATCH 11/14 wlcore: make usage of nla_put clearer
In reply to Luciano CoelhoFrom: Yair Shapira <[email protected]>
handle errors of nla_put() inside the if(nla_put...) {}
This makes the code simpler and clearer because:
we take advantage from the fact that we have only one nla_put in our routines (so no real need for goto label). this avoids ugly goto forward followed by goto backward.
--- drivers/net/wireless/ti/wlcore/testmode.c | 39 +++++++++++++---------------- 1 file changed, 18 insertions(+), 21 deletions(-)
drivers/net/wireless/ti/wlcore/testmode.c +18 -21
@@ -129,8 +129,12 @@ static int wl1271_tm_cmd_test(struct wl1271 *wl, struct nlattr *tb[]) goto out_sleep; } -if (nla_put (skb,WL1271_TM_ATTR_DATA , buf_len, buf)) - goto nla_put_failure; +if (nla_put (skb,WL1271_TM_ATTR_DATA , buf_len, buf)) { +kfree_skb (skb); + ret = -EMSGSIZE ; + goto out_sleep; + } + ret =cfg80211_testmode_reply (skb);if (ret <0 ) goto out_sleep;
@@ -142,11 +146,6 @@ out:mutex_unlock (&wl->mutex);return ret; - -nla_put_failure: -kfree_skb (skb); - ret = -EMSGSIZE ; - goto out_sleep; }static int wl1271_tm_cmd_interrogate (struct wl1271 *wl,struct nlattr *tb[])
@@ -192,8 +191,12 @@ static int wl1271_tm_cmd_interrogate(struct wl1271 *wl, struct nlattr *tb[]) goto out_free; } -if (nla_put (skb,WL1271_TM_ATTR_DATA ,sizeof (*cmd), cmd)) - goto nla_put_failure; +if (nla_put (skb,WL1271_TM_ATTR_DATA ,sizeof (*cmd), cmd)) { +kfree_skb (skb); + ret = -EMSGSIZE ; + goto out_free; + } + ret =cfg80211_testmode_reply (skb);if (ret <0 ) goto out_free;
@@ -206,11 +209,6 @@ out:mutex_unlock (&wl->mutex);return ret; - -nla_put_failure: -kfree_skb (skb); - ret = -EMSGSIZE ; - goto out_free; }static int wl1271_tm_cmd_configure (struct wl1271 *wl,struct nlattr *tb[])
@@ -343,8 +341,12 @@ static int wl12xx_tm_cmd_get_mac(struct wl1271 *wl, struct nlattr *tb[]) goto out; } -if (nla_put (skb,WL1271_TM_ATTR_DATA ,ETH_ALEN , mac_addr)) - goto nla_put_failure; +if (nla_put (skb,WL1271_TM_ATTR_DATA ,ETH_ALEN , mac_addr)) { +kfree_skb (skb); + ret = -EMSGSIZE ; + goto out; + } + ret =cfg80211_testmode_reply (skb);if (ret <0 ) goto out;
@@ -352,11 +354,6 @@ static int wl12xx_tm_cmd_get_mac(struct wl1271 *wl, struct nlattr *tb[]) out:mutex_unlock (&wl->mutex);return ret; - -nla_put_failure: -kfree_skb (skb); - ret = -EMSGSIZE ; - goto out; }int wl1271_tm_cmd (struct ieee80211_hw *hw,void *data,int len)
Signature · 1 line
1.7.10.4
PATCH 12/14 wl18xx: enable MIMO rates when connected as a MIMO STA
In reply to Luciano CoelhoFrom: Arik Nemtsov <[email protected]>
Use this opportunity to consolidate the check for MIMO support into a separate function.
--- drivers/net/wireless/ti/wl18xx/main.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/net/wireless/ti/wl18xx/main.c +12 -4
@@ -1013,6 +1013,13 @@ static void wl18xx_set_rx_csum(struct wl1271 *wl, skb->ip_summed =CHECKSUM_UNNECESSARY ; } +static bool wl18xx_is_mimo_supported (struct wl1271 *wl) +{ +struct wl18xx_priv *priv = wl->priv; + +return priv->conf.phy.number_of_assembled_ant2_4 >=2 ; +} +/* * TODO: instead of having these two functions to get the rate mask, * we should modify the wlvif->rate_set instead
@@ -1029,6 +1036,9 @@ static u32 wl18xx_sta_get_ap_rate_mask(struct wl1271 *wl,/* we don't support MIMO in wide-channel mode */ hw_rate_set &= ~CONF_TX_MIMO_RATES ; + }else if (wl18xx_is_mimo_supported (wl)) { +wl1271_debug (DEBUG_ACX ,"using MIMO channel rate mask" ); + hw_rate_set |=CONF_TX_MIMO_RATES ; }return hw_rate_set;
@@ -1037,8 +1047,6 @@ static u32 wl18xx_sta_get_ap_rate_mask(struct wl1271 *wl,static u32 wl18xx_ap_get_mimo_wide_rate_mask (struct wl1271 *wl,struct wl12xx_vif *wlvif) { -struct wl18xx_priv *priv = wl->priv; -if (wlvif->channel_type ==NL80211_CHAN_HT40MINUS || wlvif->channel_type ==NL80211_CHAN_HT40PLUS ) {wl1271_debug (DEBUG_ACX ,"using wide channel rate mask" );
@@ -1048,7 +1056,7 @@ static u32 wl18xx_ap_get_mimo_wide_rate_mask(struct wl1271 *wl,return 0 ;return CONF_TX_RATE_USE_WIDE_CHAN ; - }else if (priv->conf.phy.number_of_assembled_ant2_4 >=2 && + }else if (wl18xx_is_mimo_supported (wl) && wlvif->band ==IEEE80211_BAND_2GHZ ) {wl1271_debug (DEBUG_ACX ,"using MIMO rate mask" );/*
@@ -1478,7 +1486,7 @@ static int __devinit wl18xx_probe(struct platform_device *pdev)* Only support mimo with multiple antennas. Fall back to * siso20. */ -if (priv->conf.phy.number_of_assembled_ant2_4 >=2 ) +if (wl18xx_is_mimo_supported (wl))wlcore_set_ht_cap (wl,IEEE80211_BAND_2GHZ , &wl18xx_mimo_ht_cap_2ghz);else
Signature · 1 line
1.7.10.4
PATCH 13/14 wlcore: wait for command completion event when sending CMD_ROLE_STOP
In reply to Luciano CoelhoWe need to wait for the command completion event when we send the CMD_ROLE_STOP event otherwise we may try to send CMD_ROLE_START too soon and get out-of-sync with the firmware.
In some cases, the firmware may not send the event, so we wait for the event or for the timeout, whichever comes first.
This patch is based on an earlier version by Eliad.
--- drivers/net/wireless/ti/wlcore/cmd.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/net/wireless/ti/wlcore/cmd.c +12 -0
@@ -497,6 +497,7 @@ int wl12xx_cmd_role_stop_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif) {struct wl12xx_cmd_role_stop *cmd;int ret; +bool timeout = false;if (WARN_ON (wlvif->sta.hlid ==WL12XX_INVALID_LINK_ID ))return -EINVAL ;
@@ -519,6 +520,17 @@ int wl12xx_cmd_role_stop_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif) goto out_free; } +/* +* Sometimes the firmware doesn't send this event, so we just +* time out without failing. Queue recovery for other +* failures. +*/ + ret =wl1271_cmd_wait_for_event_or_timeout (wl, +ROLE_STOP_COMPLETE_EVENT_ID , + &timeout); +if (ret) +wl12xx_queue_recovery_work (wl); +wl12xx_free_link (wl, wlvif, &wlvif->sta.hlid); out_free:
Signature · 1 line
1.7.10.4
PATCH 14/14 wlcore: increase command completion timeout
In reply to Luciano CoelhoIn some rare cases, the CMD_ROC completion may take over 1 second. The timeout had earlier been increased to 1000ms (from 750ms), but it is still not enoug. Increase it to 1500ms.
--- drivers/net/wireless/ti/wlcore/cmd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ti/wlcore/cmd.h +1 -1
@@ -192,7 +192,7 @@ enum cmd_templ {#define WL1271_COMMAND_TIMEOUT 2000#define WL1271_CMD_TEMPL_DFLT_SIZE 252#define WL1271_CMD_TEMPL_MAX_SIZE 512 -#define WL1271_EVENT_TIMEOUT 1000 +#define WL1271_EVENT_TIMEOUT 1500struct wl1271_cmd_header {__le16 id;
Signature · 1 line
1.7.10.4
Quoted 9 lines · Luciano Coelho
Hi,
This is one more batch of patches intended for 3.6. It contains a some patches by Yair related to interfaces with userspace (PLT, calibrator and wlconf) and a few bugfixes by Eyal, Eliad and Arik. Also a couple of my own patches to fix some out-of-sync issues with the firmware.
Please review.
Applied and pushed this series.
--
Luca.