mwifiex: fix misleading firmware download messages
PATCH 1/3 mwifiex: fix misleading firmware download messages
From: chunfan chen <[email protected]>
mwifiex_check_fw_status() checks firmware status and also check if WLAN is the winner for firmware downloading.
Once we detect that other interface is downloading the firmware, we call this routine again with max poll count to wait until firmware is ready.
This patch splits the routine to avoid checking winner status multiple times and ensures that correct warning messages are displayed.
Firmware status poll count is also increased to 150.
--- drivers/net/wireless/marvell/mwifiex/fw.h | 2 +- drivers/net/wireless/marvell/mwifiex/init.c | 16 +++++++++--- drivers/net/wireless/marvell/mwifiex/main.h | 1 + drivers/net/wireless/marvell/mwifiex/pcie.c | 40 +++++++++++++++++------------ drivers/net/wireless/marvell/mwifiex/sdio.c | 33 ++++++++++++++---------- 5 files changed, 57 insertions(+), 35 deletions(-)
drivers/net/wireless/marvell/mwifiex/fw.h +1 -1
@@ -96,7 +96,7 @@ enum KEY_TYPE_ID {#define WAPI_KEY_LEN (WLAN_KEY_LEN_SMS4 + PN_LEN + 2)#define MAX_POLL_TRIES 100 -#define MAX_FIRMWARE_POLL_TRIES 100 +#define MAX_FIRMWARE_POLL_TRIES 150#define FIRMWARE_READY_SDIO 0xfedc#define FIRMWARE_READY_PCIE 0xfedcba00
drivers/net/wireless/marvell/mwifiex/init.c +12 -4
@@ -741,8 +741,6 @@ int mwifiex_dnld_fw(struct mwifiex_adapter *adapter,u32 poll_num =1 ;if (adapter->if_ops.check_fw_status) { - adapter->winner =0 ; -/* check if firmware is already running */ ret = adapter->if_ops.check_fw_status (adapter, poll_num);if (!ret) {
@@ -750,13 +748,23 @@ int mwifiex_dnld_fw(struct mwifiex_adapter *adapter, "WLAN FW already running! Skip FW dnld\n");return 0 ; } + } + +/* check if we are the winner for downloading FW */ +if (adapter->if_ops.check_winner_status) { + adapter->winner =0 ; + ret = adapter->if_ops.check_winner_status (adapter); poll_num =MAX_FIRMWARE_POLL_TRIES ; +if (ret) { +mwifiex_dbg (adapter,MSG , +"WLAN read winner status failed!\n" ); +return ret; + } -/* check if we are the winner for downloading FW */ if (!adapter->winner) {mwifiex_dbg (adapter,MSG , -"FW already running! Skip FW dnld\n" ); +"WLAN is not the winner! Skip FW dnld\n" ); goto poll_fw; } }
drivers/net/wireless/marvell/mwifiex/main.h +1 -0
@@ -791,6 +791,7 @@ struct mwifiex_if_ops {int (*init_if) (struct mwifiex_adapter *);void (*cleanup_if) (struct mwifiex_adapter *);int (*check_fw_status) (struct mwifiex_adapter *,u32 ); +int (*check_winner_status)(struct mwifiex_adapter *);int (*prog_fw) (struct mwifiex_adapter *,struct mwifiex_fw_image *);int (*register_dev) (struct mwifiex_adapter *);void (*unregister_dev) (struct mwifiex_adapter *);
drivers/net/wireless/marvell/mwifiex/pcie.c +24 -16
@@ -2007,14 +2007,12 @@ done:/* * This function checks the firmware status in card. -* -* The winner interface is also determined by this function. */ static int mwifiex_check_fw_status (struct mwifiex_adapter *adapter,u32 poll_num) {int ret =0 ; -u32 firmware_stat, winner_status; +u32 firmware_stat;struct pcie_service_card *card = adapter->card;const struct mwifiex_pcie_card_reg *reg = card->pcie.reg;u32 tries;
@@ -2054,19 +2052,28 @@ mwifiex_check_fw_status(struct mwifiex_adapter *adapter, u32 poll_num) } } -if (ret) { -if (mwifiex_read_reg (adapter, reg->fw_status, - &winner_status)) - ret =-1 ; -else if (!winner_status) { -mwifiex_dbg (adapter,INFO , -"PCI-E is the winner\n" ); - adapter->winner =1 ; - }else { -mwifiex_dbg (adapter,ERROR , -"PCI-E is not the winner <%#x,%d>, exit dnld\n" , - ret, adapter->winner); - } +return ret; +} + +/* This function checks if WLAN is the winner. +*/ +static int +mwifiex_check_winner_status (struct mwifiex_adapter *adapter) +{ +u32 winner =0 ; +int ret =0 ; +struct pcie_service_card *card = adapter->card; +const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; + +if (mwifiex_read_reg (adapter, reg->fw_status, &winner)) { + ret =-1 ; + }else if (!winner) { +mwifiex_dbg (adapter,INFO ,"PCI-E is the winner\n" ); + adapter->winner =1 ; + }else { +mwifiex_dbg (adapter,ERROR , +"PCI-E is not the winner <%#x,%d>, exit dnld\n" , + ret, adapter->winner); }return ret;
@@ -2681,6 +2688,7 @@ static struct mwifiex_if_ops pcie_ops = { .init_if = mwifiex_pcie_init, .cleanup_if = mwifiex_pcie_cleanup, .check_fw_status = mwifiex_check_fw_status, + .check_winner_status = mwifiex_check_winner_status, .prog_fw = mwifiex_prog_fw_w_helper, .register_dev = mwifiex_register_dev, .unregister_dev = mwifiex_unregister_dev,
drivers/net/wireless/marvell/mwifiex/sdio.c +19 -14
@@ -1039,19 +1039,14 @@ done:/* * This function checks the firmware status in card. -* -* The winner interface is also determined by this function. */ static int mwifiex_check_fw_status (struct mwifiex_adapter *adapter,u32 poll_num) { -struct sdio_mmc_card *card = adapter->card;int ret =0 ;u16 firmware_stat;u32 tries; -u8 winner_status; -/* Wait for firmware initialization event */ for (tries =0 ; tries < poll_num; tries++) { ret =mwifiex_sdio_read_fw_status (adapter, &firmware_stat);if (ret)
@@ -1065,16 +1060,25 @@ static int mwifiex_check_fw_status(struct mwifiex_adapter *adapter, } } -if (ret) { -if (mwifiex_read_reg - (adapter, card->reg->status_reg_0, &winner_status)) - winner_status =0 ; +return ret; +} + +/* This function checks if WLAN is the winner. +*/ +static int mwifiex_check_winner_status (struct mwifiex_adapter *adapter) +{ +int ret =0 ; +u8 winner =0 ; +struct sdio_mmc_card *card = adapter->card; + +if (mwifiex_read_reg (adapter, card->reg->status_reg_0, &winner)) +return -1 ; + +if (winner) + adapter->winner =0 ; +else + adapter->winner =1 ; -if (winner_status) - adapter->winner =0 ; -else - adapter->winner =1 ; - }return ret; }
@@ -2609,6 +2613,7 @@ static struct mwifiex_if_ops sdio_ops = { .init_if = mwifiex_init_sdio, .cleanup_if = mwifiex_cleanup_sdio, .check_fw_status = mwifiex_check_fw_status, + .check_winner_status = mwifiex_check_winner_status, .prog_fw = mwifiex_prog_fw_w_helper, .register_dev = mwifiex_register_dev, .unregister_dev = mwifiex_unregister_dev,
Signature · 1 line
1.8.1.4
PATCH 2/3 mwifiex: fix IBSS data path issue.
From: chunfan chen <[email protected]>
The port_open flag is not applicable for IBSS mode. IBSS data path was broken when port_open flag was introduced. This patch fixes the problem by correcting the checks.
--- drivers/net/wireless/marvell/mwifiex/sta_event.c | 10 ++++++---- drivers/net/wireless/marvell/mwifiex/wmm.c | 6 ++++-- 2 files changed, 10 insertions(+), 6 deletions(-)
drivers/net/wireless/marvell/mwifiex/sta_event.c +6 -4
@@ -607,11 +607,13 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)case EVENT_PS_AWAKE :mwifiex_dbg (adapter,EVENT ,"info: EVENT: AWAKE\n" ); -if (!adapter->pps_uapsd_mode && priv->port_open && +if (!adapter->pps_uapsd_mode && + (priv->port_open || + (priv->bss_mode ==NL80211_IFTYPE_ADHOC )) && priv->media_connected && adapter->sleep_period.period) { - adapter->pps_uapsd_mode = true; -mwifiex_dbg (adapter,EVENT , -"event: PPS/UAPSD mode activated\n" ); + adapter->pps_uapsd_mode = true; +mwifiex_dbg (adapter,EVENT , +"event: PPS/UAPSD mode activated\n" ); } adapter->tx_lock_flag = false;if (adapter->pps_uapsd_mode && adapter->gen_null_pkt) {
drivers/net/wireless/marvell/mwifiex/wmm.c +4 -2
@@ -475,7 +475,8 @@ mwifiex_wmm_lists_empty(struct mwifiex_adapter *adapter) priv = adapter->priv[i];if (!priv)continue ; -if (!priv->port_open) +if (!priv->port_open && + (priv->bss_mode !=NL80211_IFTYPE_ADHOC ))continue ;if (adapter->if_ops.is_port_ready && !adapter->if_ops.is_port_ready (priv))
@@ -1099,7 +1100,8 @@ mwifiex_wmm_get_highest_priolist_ptr(struct mwifiex_adapter *adapter, priv_tmp = adapter->bss_prio_tbl[j].bss_prio_cur->priv; -if (!priv_tmp->port_open || +if (((priv_tmp->bss_mode !=NL80211_IFTYPE_ADHOC ) && + !priv_tmp->port_open) || (atomic_read (&priv_tmp->wmm.tx_pkts_queued) ==0 ))continue ;
Signature · 1 line
1.8.1.4
PATCH 3/3 mwifiex: add debugfs file to read chip information
In reply to Amitkumar KarwarFrom: Xinming Hu <[email protected]>
This patch add 'verext' debugfs item, which can be used to get detailed chip specific information from our firmware.
Examples:
echo "1" > /sys/kernel/debug/mwifiex/mlan0/verext
cat /sys/kernel/debug/mwifiex/mlan0/verext
--- drivers/net/wireless/marvell/mwifiex/README | 10 +++++ drivers/net/wireless/marvell/mwifiex/debugfs.c | 51 +++++++++++++++++++++++- drivers/net/wireless/marvell/mwifiex/main.h | 3 +- drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 3 +- 4 files changed, 63 insertions(+), 4 deletions(-)
drivers/net/wireless/marvell/mwifiex/README +10 -0
@@ -237,4 +237,14 @@ device_dump cat fw_dump +verext + This command is used to get extended firmware version string using + different configuration parameters. + + Usage: + echo "[version_str_sel]" > verext + cat verext + + [version_str_sel]: firmware support several extend version + string cases, include 0/1/10/20/21/99 ===============================================================================
drivers/net/wireless/marvell/mwifiex/debugfs.c +49 -2
75 lines not on this page · raw message
drivers/net/wireless/marvell/mwifiex/main.h +2 -1
@@ -616,6 +616,7 @@ struct mwifiex_private {spinlock_t curr_bcn_buf_lock;struct wireless_dev wdev;struct mwifiex_chan_freq_power cfp; +u32 versionstrsel;char version_str[128 ];#ifdef CONFIG_DEBUG_FS struct dentry *dfs_dev_dir;
@@ -1418,7 +1419,7 @@ int mwifiex_set_encode(struct mwifiex_private *priv, struct key_params *kp,int mwifiex_set_gen_ie (struct mwifiex_private *priv,const u8 *ie,int ie_len); -int mwifiex_get_ver_ext (struct mwifiex_private *priv); +int mwifiex_get_ver_ext (struct mwifiex_private *priv,u32 version_str_sel); int mwifiex_remain_on_chan_cfg(struct mwifiex_private *priv, u16 action, struct ieee80211_channel *chan,
drivers/net/wireless/marvell/mwifiex/sta_ioctl.c +2 -1
@@ -1114,11 +1114,12 @@ int mwifiex_set_encode(struct mwifiex_private *priv, struct key_params *kp,* with requisite parameters and calls the IOCTL handler. */ int -mwifiex_get_ver_ext (struct mwifiex_private *priv) +mwifiex_get_ver_ext (struct mwifiex_private *priv,u32 version_str_sel) {struct mwifiex_ver_ext ver_ext;memset (&ver_ext,0 ,sizeof (struct host_cmd_ds_version_ext )); + ver_ext.version_str_sel = version_str_sel;if (mwifiex_send_cmd (priv, HostCmd_CMD_VERSION_EXT, HostCmd_ACT_GEN_GET,0 , &ver_ext, true))return -1 ;
Signature · 1 line
1.8.1.4
Quoted 9 lines · Amitkumar Karwar
From: chunfan chen <[email protected]>
mwifiex_check_fw_status()checks firmware status and also check if WLAN is the winner for firmware downloading.Once we detect that other interface is downloading the firmware, we call this routine again with max poll count to wait until firmware is ready.
Quoted 5 lines
This patch splits the routine to avoid checking winner status multiple times and ensures that correct warning messages are displayed.
Firmware status poll count is also increased to 150.
The title is somewhat misleading, you are doing a lot more than just fixing messages. Also please clarify the concept here, especially about "winner", "loser" and the other interface.
Quoted 1 line
Signed-off-by chunfan chen <[email protected]>
It's good practise to capitalise the name.
Signature · 1 line
Kalle Valo
Hi Kalle,
Quoted 19 lines
From: Kalle Valo [mailto:[email protected]]
Sent: Tuesday, January 05, 2016 3:41 PM
To: Amitkumar Karwar
Cc: [email protected]; Cathy Luo; Nishant Sarmukadam; Jeff CF Chen
Subject: Re: [PATCH 1/3] mwifiex: fix misleading firmware download messagesQuoted 9 lines · Amitkumar Karwar
From: chunfan chen <[email protected]>
mwifiex_check_fw_status()checks firmware status and also check if WLAN is the winner for firmware downloading.Once we detect that other interface is downloading the firmware, we call this routine again with max poll count to wait until firmware is ready.
Quoted 9 lines
Quoted 4 lines
This patch splits the routine to avoid checking winner status multiple times and ensures that correct warning messages are displayed.
Firmware status poll count is also increased to 150.
The title is somewhat misleading, you are doing a lot more than just fixing messages. Also please clarify the concept here, especially about "winner", "loser" and the other interface.
Thanks for review. I will submit updated version with below changes.
1) Change title to "mwifiex: firmware download enhancements"
2) Modified description to explain "winner", "loser" and the other interface concepts.
Quoted 4 lines
Quoted 1 line
Signed-off-by chunfan chen <[email protected]>It's good practise to capitalise the name.
Ack.
Regards,
Amitkumar Karwar