Skip to content

Commit 4da6ee2

Browse files
authored
Merge pull request kaloz#330 from mrvltest/master
Merged latest code.
2 parents fac1da8 + 917a4ed commit 4da6ee2

File tree

10 files changed

+111
-27
lines changed

10 files changed

+111
-27
lines changed

bin/firmware/88W8997.bin

192 Bytes
Binary file not shown.

core.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -946,8 +946,6 @@ struct ieee80211_hw *mwl_alloc_hw(int bus_type,
946946
priv->regulatory_set = false;
947947
priv->use_short_slot = false;
948948
priv->use_short_preamble = false;
949-
priv->basic_rate_idx = 0;
950-
priv->broadcast_ssid = 0xFF;
951949
priv->disable_2g = false;
952950
priv->disable_5g = false;
953951
priv->tx_amsdu = true;

core.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,6 @@ struct mwl_priv {
222222

223223
bool use_short_slot;
224224
bool use_short_preamble;
225-
int basic_rate_idx;
226-
u8 broadcast_ssid;
227225

228226
struct {
229227
enum mwl_bus bus;
@@ -238,6 +236,7 @@ struct mwl_priv {
238236
int antenna_tx;
239237
int antenna_rx;
240238
bool tx_amsdu;
239+
bool dump_hostcmd;
241240

242241
struct mwl_tx_pwr_tbl tx_pwr_tbl[SYSADPT_MAX_NUM_CHANNELS];
243242
bool cdd;
@@ -251,6 +250,8 @@ struct mwl_priv {
251250
unsigned short *pcmd_buf; /* pointer to CmdBuf (virtual) */
252251
dma_addr_t pphys_cmd_buf; /* pointer to CmdBuf (physical) */
253252
bool in_send_cmd;
253+
bool cmd_timeout;
254+
bool rmmod;
254255

255256
int irq;
256257
struct mwl_hw_data hw_data; /* Adapter HW specific info */
@@ -393,6 +394,9 @@ struct mwl_vif {
393394
bool is_hw_crypto_enabled;
394395
/* Indicate if this is station mode */
395396
struct beacon_info beacon_info;
397+
bool set_beacon;
398+
int basic_rate_idx;
399+
u8 broadcast_ssid;
396400
u16 iv16;
397401
u32 iv32;
398402
s8 keyidx;

debugfs.c

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,63 @@ static ssize_t mwl_debugfs_tx_amsdu_write(struct file *file,
814814
return ret;
815815
}
816816

817+
static ssize_t mwl_debugfs_dump_hostcmd_read(struct file *file,
818+
char __user *ubuf,
819+
size_t count, loff_t *ppos)
820+
{
821+
struct mwl_priv *priv = (struct mwl_priv *)file->private_data;
822+
unsigned long page = get_zeroed_page(GFP_KERNEL);
823+
char *p = (char *)page;
824+
int len = 0, size = PAGE_SIZE;
825+
ssize_t ret;
826+
827+
if (!p)
828+
return -ENOMEM;
829+
830+
len += scnprintf(p + len, size - len, "\n");
831+
len += scnprintf(p + len, size - len, "tx amsdu: %s\n",
832+
priv->dump_hostcmd ? "enable" : "disable");
833+
len += scnprintf(p + len, size - len, "\n");
834+
835+
ret = simple_read_from_buffer(ubuf, count, ppos, p, len);
836+
free_page(page);
837+
838+
return ret;
839+
}
840+
841+
static ssize_t mwl_debugfs_dump_hostcmd_write(struct file *file,
842+
const char __user *ubuf,
843+
size_t count, loff_t *ppos)
844+
{
845+
struct mwl_priv *priv = (struct mwl_priv *)file->private_data;
846+
unsigned long addr = get_zeroed_page(GFP_KERNEL);
847+
char *buf = (char *)addr;
848+
size_t buf_size = min_t(size_t, count, PAGE_SIZE - 1);
849+
int value;
850+
ssize_t ret;
851+
852+
if (!buf)
853+
return -ENOMEM;
854+
855+
if (copy_from_user(buf, ubuf, buf_size)) {
856+
ret = -EFAULT;
857+
goto err;
858+
}
859+
860+
if (kstrtoint(buf, 0, &value)) {
861+
ret = -EINVAL;
862+
goto err;
863+
}
864+
865+
priv->dump_hostcmd = value ? true : false;
866+
867+
ret = count;
868+
869+
err:
870+
free_page(addr);
871+
return ret;
872+
}
873+
817874
static ssize_t mwl_debugfs_dfs_test_read(struct file *file,
818875
char __user *ubuf,
819876
size_t count, loff_t *ppos)
@@ -1967,6 +2024,7 @@ MWLWIFI_DEBUGFS_FILE_READ_OPS(stnid);
19672024
MWLWIFI_DEBUGFS_FILE_READ_OPS(device_pwrtbl);
19682025
MWLWIFI_DEBUGFS_FILE_READ_OPS(txpwrlmt);
19692026
MWLWIFI_DEBUGFS_FILE_OPS(tx_amsdu);
2027+
MWLWIFI_DEBUGFS_FILE_OPS(dump_hostcmd);
19702028
MWLWIFI_DEBUGFS_FILE_OPS(dfs_test);
19712029
MWLWIFI_DEBUGFS_FILE_OPS(dfs_channel);
19722030
MWLWIFI_DEBUGFS_FILE_OPS(dfs_radar);
@@ -2002,6 +2060,7 @@ void mwl_debugfs_init(struct ieee80211_hw *hw)
20022060
MWLWIFI_DEBUGFS_ADD_FILE(device_pwrtbl);
20032061
MWLWIFI_DEBUGFS_ADD_FILE(txpwrlmt);
20042062
MWLWIFI_DEBUGFS_ADD_FILE(tx_amsdu);
2063+
MWLWIFI_DEBUGFS_ADD_FILE(dump_hostcmd);
20052064
MWLWIFI_DEBUGFS_ADD_FILE(dfs_test);
20062065
MWLWIFI_DEBUGFS_ADD_FILE(dfs_channel);
20072066
MWLWIFI_DEBUGFS_ADD_FILE(dfs_radar);

hif/fwcmd.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ char *mwl_fwcmd_get_cmd_string(unsigned short cmd)
9898
{ HOSTCMD_CMD_GET_DEVICE_PWR_TBL_SC4, "GetDevicePwrTblSC4" },
9999
{ HOSTCMD_CMD_QUIET_MODE, "QuietMode" },
100100
{ HOSTCMD_CMD_CORE_DUMP_DIAG_MODE, "CoreDumpDiagMode" },
101-
{ HOSTCMD_CMD_GET_FW_CORE_DUMP, "GetFwCoreDump" },
102101
{ HOSTCMD_CMD_802_11_SLOT_TIME, "80211SlotTime" },
102+
{ HOSTCMD_CMD_GET_FW_CORE_DUMP, "GetFwCoreDump" },
103103
{ HOSTCMD_CMD_EDMAC_CTRL, "EDMACCtrl" },
104104
{ HOSTCMD_CMD_TXPWRLMT_CFG, "TxpwrlmtCfg" },
105105
{ HOSTCMD_CMD_MCAST_CTS, "McastCts" },
@@ -2945,8 +2945,6 @@ int mwl_fwcmd_start_stream(struct ieee80211_hw *hw,
29452945
if (stream->state != AMPDU_STREAM_NEW)
29462946
return 0;
29472947

2948-
wiphy_debug(hw->wiphy, "Start BA %pM\n", stream->sta->addr);
2949-
29502948
return ieee80211_start_tx_ba_session(stream->sta, stream->tid, 0);
29512949
}
29522950

@@ -3572,6 +3570,9 @@ int mwl_fwcmd_get_fw_core_dump(struct ieee80211_hw *hw,
35723570
struct mwl_priv *priv = hw->priv;
35733571
struct hostcmd_cmd_get_fw_core_dump *pcmd;
35743572

3573+
if (priv->chip_type != MWL8964)
3574+
return -EPERM;
3575+
35753576
pcmd = (struct hostcmd_cmd_get_fw_core_dump *)&priv->pcmd_buf[0];
35763577

35773578
mutex_lock(&priv->fwcmd_mutex);

hif/hostcmd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@
7777
#define HOSTCMD_CMD_GET_DEVICE_PWR_TBL_SC4 0x118B
7878
#define HOSTCMD_CMD_QUIET_MODE 0x1201
7979
#define HOSTCMD_CMD_CORE_DUMP_DIAG_MODE 0x1202
80-
#define HOSTCMD_CMD_GET_FW_CORE_DUMP 0x1203
8180
#define HOSTCMD_CMD_802_11_SLOT_TIME 0x1203
81+
#define HOSTCMD_CMD_GET_FW_CORE_DUMP 0x1203
8282
#define HOSTCMD_CMD_EDMAC_CTRL 0x1204
8383
#define HOSTCMD_CMD_TXPWRLMT_CFG 0x1211
8484
#define HOSTCMD_CMD_MCAST_CTS 0x4001

hif/pcie/dev.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include <net/mac80211.h>
2828

2929
#define PCIE_DRV_NAME KBUILD_MODNAME
30-
#define PCIE_DRV_VERSION "10.3.8.0-20181022"
30+
#define PCIE_DRV_VERSION "10.3.8.0-20181027"
3131

3232
#define PCIE_MIN_BYTES_HEADROOM 64
3333
#define PCIE_MIN_TX_HEADROOM_KF2 96

hif/pcie/pcie.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ static bool pcie_chk_adapter(struct pcie_priv *pcie_priv)
151151
return false;
152152
}
153153

154+
if (priv->cmd_timeout)
155+
wiphy_debug(priv->hw->wiphy, "MACREG_REG_INT_CODE: 0x%04x\n",
156+
regval);
157+
154158
return true;
155159
}
156160

@@ -170,7 +174,7 @@ static int pcie_wait_complete(struct mwl_priv *priv, unsigned short cmd)
170174
do {
171175
int_code = le16_to_cpu(*((__le16 *)&priv->pcmd_buf[0]));
172176
usleep_range(1000, 2000);
173-
} while ((int_code != cmd) && (--curr_iteration));
177+
} while ((int_code != cmd) && (--curr_iteration) && !priv->rmmod);
174178

175179
if (curr_iteration == 0) {
176180
wiphy_err(priv->hw->wiphy, "cmd 0x%04x=%s timed out\n",
@@ -380,19 +384,23 @@ static int pcie_exec_cmd(struct ieee80211_hw *hw, unsigned short cmd)
380384
return -EIO;
381385
}
382386

383-
if (!priv->in_send_cmd) {
387+
if (!priv->in_send_cmd && !priv->rmmod) {
384388
priv->in_send_cmd = true;
389+
if (priv->dump_hostcmd)
390+
wiphy_debug(priv->hw->wiphy, "send cmd 0x%04x=%s\n",
391+
cmd, mwl_fwcmd_get_cmd_string(cmd));
385392
pcie_send_cmd(pcie_priv);
386393
if (pcie_wait_complete(priv, 0x8000 | cmd)) {
387394
wiphy_err(priv->hw->wiphy, "timeout: 0x%04x\n", cmd);
388395
priv->in_send_cmd = false;
396+
priv->cmd_timeout = true;
389397
vendor_cmd_basic_event(hw->wiphy,
390398
MWL_VENDOR_EVENT_CMD_TIMEOUT);
391399
return -EIO;
392400
}
393401
} else {
394402
wiphy_warn(priv->hw->wiphy,
395-
"previous command is still running\n");
403+
"previous command is running or module removed\n");
396404
busy = true;
397405
}
398406

@@ -1606,7 +1614,11 @@ static int pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id)
16061614
static void pcie_remove(struct pci_dev *pdev)
16071615
{
16081616
struct ieee80211_hw *hw = pci_get_drvdata(pdev);
1617+
struct mwl_priv *priv = hw->priv;
16091618

1619+
priv->rmmod = true;
1620+
while (priv->in_send_cmd)
1621+
usleep_range(1000, 2000);
16101622
vendor_cmd_basic_event(hw->wiphy, MWL_VENDOR_EVENT_DRIVER_START_REMOVE);
16111623
mwl_deinit_hw(hw);
16121624
pci_set_drvdata(pdev, NULL);

hif/pcie/tx.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -954,11 +954,8 @@ void pcie_tx_skbs(unsigned long data)
954954
break;
955955

956956
tx_skb = skb_dequeue(&pcie_priv->txq[num]);
957-
if (!tx_skb) {
958-
wiphy_warn(hw->wiphy,
959-
"Socket buffer is NULL\n");
957+
if (!tx_skb)
960958
continue;
961-
}
962959
tx_info = IEEE80211_SKB_CB(tx_skb);
963960
tx_ctrl = (struct pcie_tx_ctrl *)&tx_info->status;
964961

@@ -1058,6 +1055,7 @@ void pcie_tx_xmit(struct ieee80211_hw *hw,
10581055
bool eapol_frame = false;
10591056
struct pcie_tx_ctrl *tx_ctrl;
10601057
struct ieee80211_key_conf *k_conf = NULL;
1058+
int rc;
10611059

10621060
index = skb_get_queue_mapping(skb);
10631061
sta = control->sta;
@@ -1220,8 +1218,11 @@ void pcie_tx_xmit(struct ieee80211_hw *hw,
12201218
/* Initiate the ampdu session here */
12211219
if (start_ba_session) {
12221220
spin_lock_bh(&priv->stream_lock);
1223-
if (mwl_fwcmd_start_stream(hw, stream))
1221+
rc = mwl_fwcmd_start_stream(hw, stream);
1222+
if (rc)
12241223
mwl_fwcmd_remove_stream(hw, stream);
1224+
else
1225+
wiphy_debug(hw->wiphy, "Mac80211 start BA %pM\n", stream->sta->addr);
12251226
spin_unlock_bh(&priv->stream_lock);
12261227
}
12271228
}

mac80211.c

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@ static int mwl_mac80211_add_interface(struct ieee80211_hw *hw,
214214
mwl_vif->seqno = 0;
215215
mwl_vif->is_hw_crypto_enabled = false;
216216
mwl_vif->beacon_info.valid = false;
217+
mwl_vif->set_beacon = false;
218+
mwl_vif->basic_rate_idx = 0;
219+
mwl_vif->broadcast_ssid = 0xFF;
217220
mwl_vif->iv16 = 1;
218221
mwl_vif->iv32 = 0;
219222
mwl_vif->keyidx = 0;
@@ -379,6 +382,9 @@ static void mwl_mac80211_bss_info_changed_ap(struct ieee80211_hw *hw,
379382
u32 changed)
380383
{
381384
struct mwl_priv *priv = hw->priv;
385+
struct mwl_vif *mwl_vif;
386+
387+
mwl_vif = mwl_dev_get_vif(vif);
382388

383389
if ((changed & BSS_CHANGED_ERP_SLOT) && (priv->chip_type == MWL8997)) {
384390
if (priv->use_short_slot != vif->bss_conf.use_short_slot) {
@@ -409,14 +415,14 @@ static void mwl_mac80211_bss_info_changed_ap(struct ieee80211_hw *hw,
409415
idx = ffs(vif->bss_conf.basic_rates);
410416
if (idx)
411417
idx--;
412-
if (priv->basic_rate_idx != idx) {
418+
if (mwl_vif->basic_rate_idx != idx) {
413419
if (hw->conf.chandef.chan->band == NL80211_BAND_2GHZ)
414420
rate = mwl_rates_24[idx].hw_value;
415421
else
416422
rate = mwl_rates_50[idx].hw_value;
417423

418424
mwl_fwcmd_use_fixed_rate(hw, rate, rate);
419-
priv->basic_rate_idx = idx;
425+
mwl_vif->basic_rate_idx = idx;
420426
}
421427
}
422428

@@ -426,22 +432,25 @@ static void mwl_mac80211_bss_info_changed_ap(struct ieee80211_hw *hw,
426432
if ((info->ssid[0] != '\0') &&
427433
(info->ssid_len != 0) &&
428434
(!info->hidden_ssid)) {
429-
if (priv->broadcast_ssid != true) {
435+
if (mwl_vif->broadcast_ssid != true) {
430436
mwl_fwcmd_broadcast_ssid_enable(hw, vif, true);
431-
priv->broadcast_ssid = true;
437+
mwl_vif->broadcast_ssid = true;
432438
}
433439
} else {
434-
if (priv->broadcast_ssid != false) {
440+
if (mwl_vif->broadcast_ssid != false) {
435441
mwl_fwcmd_broadcast_ssid_enable(hw, vif, false);
436-
priv->broadcast_ssid = false;
442+
mwl_vif->broadcast_ssid = false;
437443
}
438444
}
439445

440-
skb = ieee80211_beacon_get(hw, vif);
446+
if (!mwl_vif->set_beacon) {
447+
skb = ieee80211_beacon_get(hw, vif);
441448

442-
if (skb) {
443-
mwl_fwcmd_set_beacon(hw, vif, skb->data, skb->len);
444-
dev_kfree_skb_any(skb);
449+
if (skb) {
450+
mwl_fwcmd_set_beacon(hw, vif, skb->data, skb->len);
451+
dev_kfree_skb_any(skb);
452+
}
453+
mwl_vif->set_beacon = true;
445454
}
446455
}
447456

0 commit comments

Comments
 (0)