Re: Help with ath10k related circular locking
On Wed, 2018-09-19 at 08:53 -0700, Ben Greear wrote: > Hello, > > I see this lockdep splat on a modified 4.16.18+ kernel when the ath10k > firmware crashes early. > > I am having a hard time figuring out how to go about fixing this, and would > welcome > some suggestions. Not really sure how to fix it - it basically means that "ath10k_wq" contains code that acquires the RTNL: > -> #2 (rtnl_mutex){+.+.}: > Sep 19 08:38:51 lf0313-6477 kernel:wiphy_register+0x1120/0x1f90 > [cfg80211] > Sep 19 08:38:51 lf0313-6477 kernel: > ieee80211_register_hw+0x114e/0x2d20 [mac80211] > Sep 19 08:38:51 lf0313-6477 kernel:ath10k_mac_register+0x1b2f/0x2ff0 > [ath10k_core] > Sep 19 08:38:51 lf0313-6477 kernel: > ath10k_core_register_work+0x2365/0x30e0 [ath10k_core] > Sep 19 08:38:51 lf0313-6477 kernel:process_one_work+0x5f7/0x14d0 > Sep 19 08:38:51 lf0313-6477 kernel:worker_thread+0xdc/0x12d0 > Sep 19 08:38:51 lf0313-6477 kernel:kthread+0x2cf/0x3c0 > Sep 19 08:38:51 lf0313-6477 kernel:ret_from_fork+0x24/0x30 but something on the workqueue is also flushed while holding rtnl. The solution might be as simple as making it not be an ordered/single- threaded workqueue (which can spawn extra threads if needed), but I don't know how it's used. Then again, ath10k_stop() only calls cancel_work_sync() and cancel_delayed_work_sync() ... which I think means you're running into the lockdep annotation bug I fixed recently! See upstream commits 87915adc3f0ac ("workqueue: re-add lockdep dependencies for flushing") d6e89786bed97 ("workqueue: skip lockdep wq dependency in cancel_work_sync()") johannes
Netgear R7800 - ath10k QCA 9984 firmware crash
Hi all, I get a firmware crash using latest openwrt 18.06.1 on the Netgear R7800 with stock firmware Dmesg is : [ 13.804366] ath10k_pci :01:00.0: assign IRQ: got 67 [ 13.804805] ath10k_pci :01:00.0: enabling device (0140 -> 0142) [ 13.804887] ath10k_pci :01:00.0: enabling bus mastering [ 13.805346] ath10k_pci :01:00.0: pci irq msi oper_irq_mode 2 irq_mode 0 reset_mode 0 [ 13.974787] ath10k_pci :01:00.0: Direct firmware load for ath10k/pre-cal-pci-:01:00.0.bin failed with error -2 [ 13.974827] ath10k_pci :01:00.0: Falling back to user helper [ 14.304794] ath10k_pci :01:00.0: Direct firmware load for ath10k/QCA9984/hw1.0/firmware-6.bin failed with error -2 [ 14.304857] ath10k_pci :01:00.0: Falling back to user helper [ 14.337111] firmware ath10k!QCA9984!hw1.0!firmware-6.bin: firmware_loading_store: map pages failed [ 14.702947] ath10k_pci :01:00.0: qca9984/qca9994 hw1.0 target 0x0100 chip_id 0x sub 168c:cafe [ 14.702997] ath10k_pci :01:00.0: kconfig debug 0 debugfs 1 tracing 0 dfs 1 testmode 1 [ 14.716459] ath10k_pci :01:00.0: firmware ver 10.4-3.5.3-00053 api 5 features no-p2p,mfp,peer-flow-ctrl,btcoex-param,allows-mesh-bcast,no-ps crc32 4c56a386 [ 15.973104] ath10k_pci :01:00.0: board_file api 2 bmi_id 0:31 crc32 dd6d039c [ 19.753460] ath10k_pci :01:00.0: firmware crashed! (guid ca7089d2-df9a-4f9d-8fa6-d1b908cf3220) [ 19.753494] ath10k_pci :01:00.0: qca9984/qca9994 hw1.0 target 0x0100 chip_id 0x sub 168c:cafe [ 19.761307] ath10k_pci :01:00.0: kconfig debug 0 debugfs 1 tracing 0 dfs 1 testmode 1 [ 19.773202] ath10k_pci :01:00.0: firmware ver 10.4-3.5.3-00053 api 5 features no-p2p,mfp,peer-flow-ctrl,btcoex-param,allows-mesh-bcast,no-ps crc32 4c56a386 [ 19.779887] ath10k_pci :01:00.0: board_file api 2 bmi_id 0:31 crc32 dd6d039c [ 19.793511] ath10k_pci :01:00.0: htt-ver 0.0 wmi-op 6 htt-op 4 cal pre-cal-file max-sta 32 raw 0 hwcrypto 1 [ 19.803176] ath10k_pci :01:00.0: firmware register dump: [ 19.810956] ath10k_pci :01:00.0: [00]: 0x0100 0x15B3 0x009CBB38 0x00975B31 [ 19.816861] ath10k_pci :01:00.0: [04]: 0x009CBB38 0x00060530 0x0011 0x00415760 [ 19.824587] ath10k_pci :01:00.0: [08]: 0x00417E6C 0x0040 0x0001 0x00422990 [ 19.832485] ath10k_pci :01:00.0: [12]: 0x0009 0x 0x00973B25 0x00973B47 [ 19.840384] ath10k_pci :01:00.0: [16]: 0x009CBB38 0x000CEEA7 0x 0x [ 19.848284] ath10k_pci :01:00.0: [20]: 0x409CBB38 0x004068DC 0x0001 0x00403628 [ 19.856183] ath10k_pci :01:00.0: [24]: 0x809814EF 0x0040693C 0x0049 0xC09CBB38 [ 19.864083] ath10k_pci :01:00.0: [28]: 0x800DF216 0x004069AC 0x0004 0x00415300 [ 19.871983] ath10k_pci :01:00.0: [32]: 0x800C383A 0x004069DC 0x00415160 0x0040 [ 19.879881] ath10k_pci :01:00.0: [36]: 0x809800A3 0x00406A0C 0x00415170 0x009C41F8 [ 19.887781] ath10k_pci :01:00.0: [40]: 0x8098003A 0x00406A5C 0x0040 0x00400600 [ 19.895680] ath10k_pci :01:00.0: [44]: 0x809607C1 0x00406A8C 0xD8400100 0x00406A9C [ 19.903579] ath10k_pci :01:00.0: [48]: 0x80960892 0x00406AAC 0x 0x0008 [ 19.911479] ath10k_pci :01:00.0: [52]: 0x80960E39 0x00406ACC 0x0040 0x00400600 [ 19.919378] ath10k_pci :01:00.0: [56]: 0x80960E9D 0x00406AEC 0x 0x00400600 [ 19.927277] ath10k_pci :01:00.0: Copy Engine register dump: [ 19.935181] ath10k_pci :01:00.0: [00]: 0x0004a000 11 11 12 11 [ 19.940994] ath10k_pci :01:00.0: [01]: 0x0004a400 11 11 10 11 [ 19.947590] ath10k_pci :01:00.0: [02]: 0x0004a800 0 0 63 0 [ 19.954014] ath10k_pci :01:00.0: [03]: 0x0004ac00 0 0 0 0 [ 19.960439] ath10k_pci :01:00.0: [04]: 0x0004b000 0 0 0 0 [ 19.966862] ath10k_pci :01:00.0: [05]: 0x0004b400 0 0 0 0 [ 19.973285] ath10k_pci :01:00.0: [06]: 0x0004b800 0 0 0 0 [ 19.979709] ath10k_pci :01:00.0: [07]: 0x0004bc00 1 1 1 1 [ 19.986132] ath10k_pci :01:00.0: [08]: 0x0004c000 0 0 127 0 [ 19.992556] ath10k_pci :01:00.0: [09]: 0x0004c400 1 1 1 1 [ 19.998980] ath10k_pci :01:00.0: [10]: 0x0004c800 0 0 0 0 [ 20.005403] ath10k_pci :01:00.0: [11]: 0x0004cc00 0 0 0 0 [ 20.795948] ath10k_pci :01:00.0: failed to receive control response completion, polling.. [ 21.835766] ath10k_pci :01:00.0: ctl_resp never came in (-110) [ 21.835810] ath10k_pci :01:00.0: failed to connect to HTC: -110 [ 21.915174] ath10k_pci :01:00.0: could not init core (-110) [ 21.915620] ath10k_pci :01:00.0: could not probe fw (-110) [ 21.920266] ath10k_pci 0001:01:00.0: assign IRQ: got 100 [ 21.921197] ath10k_pci 0001:01:00.0: enabling device (0140 -> 0142) [ 21.926032] ath10k_pci 0001:01:00.0: enabling bus mastering [ 21.926715] ath10k_pci 0001:01:00.0: pci irq msi oper_irq_mode 2
Re: Problem with sending pkt on a monitor port
On 09/19/2018 01:35 PM, Johannes Berg wrote: On Wed, 2018-09-19 at 13:33 -0700, Ben Greear wrote: This is with a modified 4.16.18+ kernel, though the code in question is from 2011, so this is not new... I am attempting to use radiotap packet injection on a monitor port. In the ieee80211_monitor_start_xmit method, before this code below runs, sdata is 'moni6a', my monitor port. But, since I have a station wlan1 with the same MAC address, then when this code is completed, stdata becomes wlan1. Ath10k has all sorts of issues transmitting raw frames, and sending on the wrong vdev only makes it even more broken! If user-space binds a socket to a monitor vdev and transmits a frame, why would we want to change the vdev here? For one, the driver has no concept of the original vif, since monitor vifs aren't added to it. ath10k does create a monitor vif, but maybe it is not mapped directly to mac80211. Secondly, the old hostapd code before nl80211 injects frames that way, and they need to go there. Ok, I agree we should not break backwards compat then. I'll poke some more to see if I can get it working. Thanks, Ben -- Ben Greear Candela Technologies Inc http://www.candelatech.com
Re: SAE authentication frames in client mode
> > If that is the case, this would conflict with the SAE handshake as > > defined in the 802.11-2016 standard. That's because when the AP > > receives a Commit frame, the AP is allowed to send both a Commit and > > Confirm frame (see 12.4.8.6.3). So according to the standard, the > > client must accept a SAE Confirm authentication frame, even if it > > hasn't yet transmitted its own Confirm frame. So this appears to be a > > bug. Thoughts? > > While the SAE authentication exchange itself has such flexibility in the > sequence of Commit/Confirm messages, there is a constraint in IEEE > 802.11 on how the Authentication frames are exchanged in an > infrastructure BSS between a non-AP STA and an AP. For SAE, this is > explicitly requiring the exchange proceed in the sequence shown in > Figure 4-29 (Example using SAE authentication), i.e., with the Commit > messages exchanged first and the first Confirm message coming from STA > to AP and the exchange concluded with the Confirm message from AP to > STA. This matches the Linux kernel implementation. That figure only appears to be an example. It doesn't say an exchange must ("shall") follow that order. So I don't see where the standard puts a constraint on how the authentication frames are exchanged. A related observation is that retransmissions of the Confirm message are done by the kernel? Unfortunately this means the Send-Confirm field is not being incremented (as per 12.4.8.6.5). In practice we indeed see that this field is not being incremented for retransmitted Confirm frames (when using wpa_supplicant). This means that if the first Confirm frame sent by the AP is lost, the handshake will fail, since the AP will not accept retransmissions with the same Send-Confirm counter (and hence won't retransmit its own Confirm frame).
Re: Netgear R7800 - ath10k QCA 9984 firmware crash
Hi, Done, thanks Le mer. 19 sept. 2018 à 22:45, Ben Greear a écrit : > > On 09/19/2018 01:37 PM, Bruno Rosset wrote: > > Hi all, > > > > > Various tests with others firmware from candelatech , stock LEDE 17.01 > > or dd-wrt give me firmware crash also > > Please open a bug for the candela firmware crash, I might be able to figure > out why it crashes: > > https://github.com/greearb/ath10k-ct/issues > > https://www.candelatech.com/ath10k-bugs.php > > Thanks, > Ben > > > -- > Ben Greear > Candela Technologies Inc http://www.candelatech.com >
Re: Problem with sending pkt on a monitor port
On Wed, 2018-09-19 at 13:33 -0700, Ben Greear wrote: > This is with a modified 4.16.18+ kernel, though the code in question > is from 2011, so this is not new... > > I am attempting to use radiotap packet injection on a monitor port. > > In the ieee80211_monitor_start_xmit method, before this code below > runs, sdata is 'moni6a', my monitor port. But, since I have a > station wlan1 with the same MAC address, then when this code is > completed, stdata becomes wlan1. > > Ath10k has all sorts of issues transmitting raw frames, and sending on > the wrong vdev only makes it even more broken! > > If user-space binds a socket to a monitor vdev and transmits a frame, > why would we want to change the vdev here? For one, the driver has no concept of the original vif, since monitor vifs aren't added to it. Secondly, the old hostapd code before nl80211 injects frames that way, and they need to go there. johannes
Problem with sending pkt on a monitor port
This is with a modified 4.16.18+ kernel, though the code in question is from 2011, so this is not new... I am attempting to use radiotap packet injection on a monitor port. In the ieee80211_monitor_start_xmit method, before this code below runs, sdata is 'moni6a', my monitor port. But, since I have a station wlan1 with the same MAC address, then when this code is completed, stdata becomes wlan1. Ath10k has all sorts of issues transmitting raw frames, and sending on the wrong vdev only makes it even more broken! If user-space binds a socket to a monitor vdev and transmits a frame, why would we want to change the vdev here? list_for_each_entry_rcu(tmp_sdata, >interfaces, list) { if (!ieee80211_sdata_running(tmp_sdata)) continue; if (tmp_sdata->vif.type == NL80211_IFTYPE_MONITOR || tmp_sdata->vif.type == NL80211_IFTYPE_AP_VLAN || tmp_sdata->vif.type == NL80211_IFTYPE_WDS) continue; if (ether_addr_equal(tmp_sdata->vif.addr, hdr->addr2)) { sdata = tmp_sdata; break; } } Thanks, Ben -- Ben Greear Candela Technologies Inc http://www.candelatech.com
Re: Netgear R7800 - ath10k QCA 9984 firmware crash
On 09/19/2018 01:37 PM, Bruno Rosset wrote: Hi all, Various tests with others firmware from candelatech , stock LEDE 17.01 or dd-wrt give me firmware crash also Please open a bug for the candela firmware crash, I might be able to figure out why it crashes: https://github.com/greearb/ath10k-ct/issues https://www.candelatech.com/ath10k-bugs.php Thanks, Ben -- Ben Greear Candela Technologies Inc http://www.candelatech.com
Re: [PATCH RFC v4 1/4] mac80211: Add TXQ scheduling API
Kalle Valo writes: > Toke Høiland-Jørgensen writes: > >>> Unfortunately ath10k is not reporting last_tx_rate in tx_status(). So >>> I also applied this "ath10k: report tx rate using ieee80211_tx_status" >>> change. >> >> Yeah, that and the patch that computes the last used rate will probably >> be necessary; but they can be pretty much applied as-is, right? > > Unfortunately not. I think the plan is now to follow Johannes' proposal: > >"I'd recommend against doing this and disentangling the necessary > code in mac80211, e.g. with ieee80211_tx_status_ext() or adding > similar APIs." > >https://patchwork.kernel.org/patch/10353959/ Ahh, right... *that* patch :) Was thinking on this one with the "as-is" comment: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/588189 -Toke
Re: [PATCH RFC v4 1/4] mac80211: Add TXQ scheduling API
Toke Høiland-Jørgensen writes: >> Unfortunately ath10k is not reporting last_tx_rate in tx_status(). So >> I also applied this "ath10k: report tx rate using ieee80211_tx_status" >> change. > > Yeah, that and the patch that computes the last used rate will probably > be necessary; but they can be pretty much applied as-is, right? Unfortunately not. I think the plan is now to follow Johannes' proposal: "I'd recommend against doing this and disentangling the necessary code in mac80211, e.g. with ieee80211_tx_status_ext() or adding similar APIs." https://patchwork.kernel.org/patch/10353959/ -- Kalle Valo
Re: [PATCH] net: wireless: mediatek: fix mt76 LEDS build error
Kalle Valo writes: > Lorenzo Bianconi writes: > >>> From: Randy Dunlap >>> >>> All of the mt76 driver options use its mac80211.o component, >>> which uses led interfaces, so each of them should depend on >>> LEDS_CLASS. >>> >>> Fixes this build error: >>> >>> drivers/net/wireless/mediatek/mt76/mac80211.o: In function `mt76_led_init': >>> drivers/net/wireless/mediatek/mt76/mac80211.c:119: undefined >>> reference to `devm_of_led_classdev_register' >>> >>> Fixes: 17f1de56df05 ("mt76: add common code shared between multiple >>> chipsets") >>> >> >> Hi Randy, >> >> a fix for it has been already proposed by Arnd here: >> https://marc.info/?l=linux-wireless=151628136830540=2 >> but it has not been applied yet > > Yet? Arnd's patch is not on my queue as it's from last January and Felix > had a comment for it: > > https://patchwork.kernel.org/patch/10173197/ So what should we do? Arnd hasn't submitted a new patch so should we take this one instead? -- Kalle Valo
Re: [PATCH] net: wireless: mediatek: fix mt76 LEDS build error
On 9/19/18 9:07 AM, Kalle Valo wrote: > Kalle Valo writes: > >> Lorenzo Bianconi writes: >> From: Randy Dunlap All of the mt76 driver options use its mac80211.o component, which uses led interfaces, so each of them should depend on LEDS_CLASS. Fixes this build error: drivers/net/wireless/mediatek/mt76/mac80211.o: In function `mt76_led_init': drivers/net/wireless/mediatek/mt76/mac80211.c:119: undefined reference to `devm_of_led_classdev_register' Fixes: 17f1de56df05 ("mt76: add common code shared between multiple chipsets") >>> >>> Hi Randy, >>> >>> a fix for it has been already proposed by Arnd here: >>> https://marc.info/?l=linux-wireless=151628136830540=2 >>> but it has not been applied yet >> >> Yet? Arnd's patch is not on my queue as it's from last January and Felix >> had a comment for it: >> >> https://patchwork.kernel.org/patch/10173197/ > > So what should we do? Arnd hasn't submitted a new patch so should we > take this one instead? No. Arnd, can you resend your patch? thanks, -- ~Randy
[PATCH] mt76x0: pci: add mt7650 PCI ID
Add mt7650 PCI id found on ASUS rt-51ac to pci_device_id table Signed-off-by: Lorenzo Bianconi --- This patch is based on top of Felix's pull request: https://github.com/nbd168/wireless tags/mt76-for-kvalo-2018-09-19 --- drivers/net/wireless/mediatek/mt76/mt76x0/pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c b/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c index eb383f96ec9a..c5e47bc70202 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c @@ -65,6 +65,7 @@ mt76x0e_remove(struct pci_dev *pdev) static const struct pci_device_id mt76x0e_device_table[] = { { PCI_DEVICE(0x14c3, 0x7630) }, + { PCI_DEVICE(0x14c3, 0x7650) }, { }, }; -- 2.17.1
Re: [PATCH] mt76x0: run vco calibration for each channel configuration
Sid Hayn writes: > mt76x0 isn't in 4.18 at all, it's being added in 4.19 isn't it? I'm > not sure you can call it a regression, but adding a new driver with a > known bug that breaks an entire use case (monitor mode) seems silly > when a small and tested fix is available. Pretty please. Unfortunately it's not that simple as you think. And do take into account that the maintainers need to deal with a lot of patches and email so keeping things simple is important. And please do not top post: https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches#do_not_top_post_and_edit_your_quotes -- Kalle Valo
Re: [PATCH 1/5] rt2x00: set registers based on current band
On Wed, 19 Sep 2018 13:05:41 +0200, Stanislaw Gruszka wrote: >Driver should provide on what channels are supported to mac80211, but >user space decide what channel to use and that imply band 2.4GHz or >5GHz. ->curr_band is just shortcut for band of current channel. Is set >in rt2x00lib_config() after we call rt2x00dev->ops->lib->config() >[rt2800_config() for rt2800] . So patch is wrong. Either ->curr_band >should be set before ->config call or we need to consistently use >rf->channel <= 14 for band check in any rt2800_config() function and >all it's subroutines. I prefer the second solution (i.e. rf->channel) >and now I can see few places when we use ->curr_band, what is a bug. Works fine, no any kind of regression, especially not performance ones. So I don't see a reason to claim it is wrong or bug just because you prefer current solution. >It's because ->curr_band initialize to 0 and NL80211_BAND_2GHZ >happen to be 0. Also problem will not trigger on single band >2.4GHz devices. Can you show us how will the problem trigger on dual band devices?
SAE authentication frames in client mode
Hello, It seems that in client mode, the Linux kernel only accepts an authentication frame after sending one itself. Is this interpretation correct? If that is the case, this would conflict with the SAE handshake as defined in the 802.11-2016 standard. That's because when the AP receives a Commit frame, the AP is allowed to send both a Commit and Confirm frame (see 12.4.8.6.3). So according to the standard, the client must accept a SAE Confirm authentication frame, even if it hasn't yet transmitted its own Confirm frame. So this appears to be a bug. Thoughts? Cheers, Mathy
[PATCH] mt76x0: pci: add fw uploading routine
Add pci load firmware routine. Move some shared mcu definitions in mt76x02_mcu.h Signed-off-by: Lorenzo Bianconi Signed-off-by: Stanislaw Gruszka --- This patch is based on top of Felix's pull request: https://github.com/nbd168/wireless tags/mt76-for-kvalo-2018-09-19 --- .../net/wireless/mediatek/mt76/mt76x0/mcu.h | 5 + .../net/wireless/mediatek/mt76/mt76x0/pci.c | 120 +- .../net/wireless/mediatek/mt76/mt76x0/usb.c | 5 - .../net/wireless/mediatek/mt76/mt76x02_mcu.h | 9 ++ .../net/wireless/mediatek/mt76/mt76x2_mcu.h | 7 - 5 files changed, 133 insertions(+), 13 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/mcu.h b/drivers/net/wireless/mediatek/mt76/mt76x0/mcu.h index f2a87d283e09..09c78a101593 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/mcu.h @@ -41,4 +41,9 @@ enum mcu_calibrate { MCU_CAL_TX_GROUP_DELAY, }; +static inline int mt76x0_firmware_running(struct mt76x0_dev *dev) +{ + return mt76_rr(dev, MT_MCU_COM_REG0) == 1; +} + #endif diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c b/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c index c5e47bc70202..76e6d52b3a64 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c @@ -15,10 +15,122 @@ */ #include +#include #include #include #include "mt76x0.h" +#include "mcu.h" + +#define MT7610E_FIRMWARE "mediatek/mt7610e.bin" +#define MT7650E_FIRMWARE "mediatek/mt7650e.bin" + +#define MT_MCU_IVB_ADDR(MT_MCU_ILM_ADDR + 0x54000 - MT_MCU_IVB_SIZE) + +static int mt76x0e_load_firmware(struct mt76x0_dev *dev) +{ + bool is_combo_chip = mt76_chip(>mt76) != 0x7610; + u32 val, ilm_len, dlm_len, offset = 0; + const struct mt76x02_fw_header *hdr; + const struct firmware *fw; + const char *firmware; + const u8 *fw_payload; + int len, err; + + if (mt76x0_firmware_running(dev)) + return 0; + + if (is_combo_chip) + firmware = MT7650E_FIRMWARE; + else + firmware = MT7610E_FIRMWARE; + + err = request_firmware(, firmware, dev->mt76.dev); + if (err) + return err; + + if (!fw || !fw->data || fw->size < sizeof(*hdr)) { + err = -EIO; + goto out; + } + + hdr = (const struct mt76x02_fw_header *)fw->data; + + len = sizeof(*hdr); + len += le32_to_cpu(hdr->ilm_len); + len += le32_to_cpu(hdr->dlm_len); + + if (fw->size != len) { + err = -EIO; + goto out; + } + + fw_payload = fw->data + sizeof(*hdr); + + val = le16_to_cpu(hdr->fw_ver); + dev_info(dev->mt76.dev, "Firmware Version: %d.%d.%02d\n", +(val >> 12) & 0xf, (val >> 8) & 0xf, val & 0xf); + + val = le16_to_cpu(hdr->fw_ver); + dev_dbg(dev->mt76.dev, + "Firmware Version: %d.%d.%02d Build: %x Build time: %.16s\n", + (val >> 12) & 0xf, (val >> 8) & 0xf, val & 0xf, + le16_to_cpu(hdr->build_ver), hdr->build_time); + + if (is_combo_chip && !mt76_poll(dev, MT_MCU_SEMAPHORE_00, 1, 1, 600)) { + dev_err(dev->mt76.dev, + "Could not get hardware semaphore for loading fw\n"); + err = -ETIMEDOUT; + goto out; + } + + /* upload ILM. */ + mt76_wr(dev, MT_MCU_PCIE_REMAP_BASE4, 0); + ilm_len = le32_to_cpu(hdr->ilm_len); + if (is_combo_chip) { + ilm_len -= MT_MCU_IVB_SIZE; + offset = MT_MCU_IVB_SIZE; + } + dev_dbg(dev->mt76.dev, "loading FW - ILM %u\n", ilm_len); + mt76_wr_copy(dev, MT_MCU_ILM_ADDR + offset, fw_payload + offset, +ilm_len); + + /* upload IVB. */ + if (is_combo_chip) { + dev_dbg(dev->mt76.dev, "loading FW - IVB %u\n", + MT_MCU_IVB_SIZE); + mt76_wr_copy(dev, MT_MCU_IVB_ADDR, fw_payload, MT_MCU_IVB_SIZE); + } + + /* upload DLM. */ + mt76_wr(dev, MT_MCU_PCIE_REMAP_BASE4, MT_MCU_DLM_OFFSET); + dlm_len = le32_to_cpu(hdr->dlm_len); + dev_dbg(dev->mt76.dev, "loading FW - DLM %u\n", dlm_len); + mt76_wr_copy(dev, MT_MCU_ILM_ADDR, +fw_payload + le32_to_cpu(hdr->ilm_len), dlm_len); + + /* trigger firmware */ + mt76_wr(dev, MT_MCU_PCIE_REMAP_BASE4, 0); + if (is_combo_chip) + mt76_wr(dev, MT_MCU_INT_LEVEL, 0x3); + else + mt76_wr(dev, MT_MCU_RESET_CTL, 0x300); + + if (!mt76_poll_msec(dev, MT_MCU_COM_REG0, 1, 1, 1000)) { + dev_err(dev->mt76.dev, "Firmware failed to start\n"); + err = -ETIMEDOUT; + goto out; + } + + dev_dbg(dev->mt76.dev, "Firmware running!\n"); + +out: + if (is_combo_chip) +
Re: [PATCH 1/5] rt2x00: set registers based on current band
On Wed, Sep 19, 2018 at 02:17:30PM +0200, Tomislav Požega wrote: > On Wed, 19 Sep 2018 13:05:41 +0200, Stanislaw Gruszka wrote: > > >Driver should provide on what channels are supported to mac80211, but > >user space decide what channel to use and that imply band 2.4GHz or > >5GHz. ->curr_band is just shortcut for band of current channel. Is set > >in rt2x00lib_config() after we call rt2x00dev->ops->lib->config() > >[rt2800_config() for rt2800] . So patch is wrong. Either ->curr_band > >should be set before ->config call or we need to consistently use > >rf->channel <= 14 for band check in any rt2800_config() function and > >all it's subroutines. I prefer the second solution (i.e. rf->channel) > >and now I can see few places when we use ->curr_band, what is a bug. > > Works fine, no any kind of regression, especially not performance ones. Did you test on dual band devices ? > So I don't see a reason to claim it is wrong or bug just because you > prefer current solution. It's not wrong bacause I prefer current solution. It's because ->curr_band is not updated when you call rt2800_config(). > >It's because ->curr_band initialize to 0 and NL80211_BAND_2GHZ > >happen to be 0. Also problem will not trigger on single band > >2.4GHz devices. > > Can you show us how will the problem trigger on dual band devices? When you switch from some 2.4GHz channel to 5GHz channel (or vice versa) ->curr_band will point to old band not the new one. To fix that you have to move curr_band assignemt before ->config() in rt2x00lib_config() i.e: rt2x00dev->curr_band = conf->chandef.chan->band; rt2x00dev->ops->lib->config(rt2x00dev, , ieee80211_flags); However I do not see the point of replacyng rf->channel check to ->curr_band check. What you can do is oposite thing, replace wrong usage of ->curr_band in very few places in rt2800_config() subroutines to rf->channel check. Also replacing spec->num_channels is wrong because this will stop reporting device support 5GHz band. Regards Stanislaw
Re: [PATCH 1/5] rt2x00: set registers based on current band
On Wed, Sep 19, 2018 at 02:47:18PM +0200, Stanislaw Gruszka wrote: > > Can you show us how will the problem trigger on dual band devices? > > When you switch from some 2.4GHz channel to 5GHz channel (or vice versa) > ->curr_band will point to old band not the new one. To fix that you > have to move curr_band assignemt before ->config() in > rt2x00lib_config() i.e: > > rt2x00dev->curr_band = conf->chandef.chan->band; > rt2x00dev->ops->lib->config(rt2x00dev, , ieee80211_flags); > > However I do not see the point of replacyng rf->channel check > to ->curr_band check. What you can do is oposite thing, replace > wrong usage of ->curr_band in very few places in rt2800_config() > subroutines to rf->channel check. Actually ->curr_band is used in rt2800_config_ant() subroutines not in rt2800_config() subroutines so things looks ok. Stanislaw
Re: [PATCH RFC v4 1/4] mac80211: Add TXQ scheduling API
On 2018-09-19 07:50, Toke Høiland-Jørgensen wrote: Kalle Valo writes: Toke Høiland-Jørgensen writes: Unfortunately ath10k is not reporting last_tx_rate in tx_status(). So I also applied this "ath10k: report tx rate using ieee80211_tx_status" change. Yeah, that and the patch that computes the last used rate will probably be necessary; but they can be pretty much applied as-is, right? Unfortunately not. I think the plan is now to follow Johannes' proposal: "I'd recommend against doing this and disentangling the necessary code in mac80211, e.g. with ieee80211_tx_status_ext() or adding similar APIs." https://patchwork.kernel.org/patch/10353959/ Ahh, right... *that* patch :) Was thinking on this one with the "as-is" comment: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/588189 It is useful only when the driver calls tx_status_noskb(). It was recommended not to call tx_status() and tx_status_noskb() APIs from same driver. Hence Anil was trying to piggyback tx rate report by tx_status itself. https://chromium.googlesource.com/chromiumos/third_party/kernel/+/1e034d84bd444fd29b7f902c5e033a8c737a58b2%5E%21/ https://chromium.googlesource.com/chromiumos/third_party/kernel/+/2a8da427fc9dfb527516e7ac395b1e6af73bff84%5E%21/ -Rajkumar
Re: mt76x0 bug report
On Wed, Sep 19, 2018 at 7:15 AM Stanislaw Gruszka wrote: > > On Tue, Sep 18, 2018 at 01:36:51PM -0400, Sid Hayn wrote: > > On Tue, Sep 18, 2018 at 7:56 AM Stanislaw Gruszka > > wrote: > > > > > > On Mon, Sep 17, 2018 at 11:18:57PM -0400, Sid Hayn wrote: > > > > Sorry to bump the one thing that we both agreed was low priority but > > > > > > > > So was testing all of my dongles that use the driver you are working > > > > on, and running them through my connect scripts. I moved the AP to > > > > maybe <5ft from the clients and something wierd happened. The t1u > > > > tried to connect to one of the 2.4GHz only networks. It failed, but > > > > it actually got enough scan data back to attempt authentication with a > > > > valid 2.4GHz only bssid. Which means in short, that the eeprom isn't > > > > lying and your parsing of it is correct. Something obviously makes > > > > this a 5GHz only device, as the connection failed and most of the time > > > > nothing at all is seen on 2.4GHz, but clearly it's some filter or > > > > antenna or some other mechanism which makes it 5GHz only. So probably > > > > hardware lying to you is now even lower on your list since this safely > > > > rules out the driver parsing the eeprom incorrectly. > > > > > > First of all would be good to check if problem is not already solved, > > > latest version of the driver can be found here: > > > https://github.com/nbd168/wireless > > > > Booting that kernel gets me instant to near instant kernel panics, so > > I am unable to test much. > > This has to be fixed as well, can you provide kernel messages ? Working on it, please stand by. > > > > Second, is there vendor driver available for this particular device? > > > Perhaps there are some tweeks needed that are not provided by generic > > > driver. > > > > No clue, haven't even tried to look. This hardware was all sitting on > > a shelf till it looked like a real driver was being merged into the > > kernel so um, thanks :-) > > Why do you think device is 5GHz only? This is very unusual. I know > only single-band 2.4GHz or dual-band 2.4GHz & 5GHz devices. https://www.tp-link.com/us/faq-2253.html "Note: Before you do these troubleshooting, please kindly check whether the adapter you use is Archer T1U. For this model, it only supports 5GHz network. So if the router you use only provides 2.4GHz network, ‘you can’t find the 5GHz network any more." Yup, I agree, it's wierd. -Zero > > Regards > Stanislaw
Re: SAE authentication frames in client mode
On Wed, Sep 19, 2018 at 02:36:20PM +0200, Mathy Vanhoef wrote: > It seems that in client mode, the Linux kernel only accepts an > authentication frame after sending one itself. Is this interpretation > correct? For infrastructure station case, yes. > If that is the case, this would conflict with the SAE handshake as > defined in the 802.11-2016 standard. That's because when the AP > receives a Commit frame, the AP is allowed to send both a Commit and > Confirm frame (see 12.4.8.6.3). So according to the standard, the > client must accept a SAE Confirm authentication frame, even if it > hasn't yet transmitted its own Confirm frame. So this appears to be a > bug. Thoughts? While the SAE authentication exchange itself has such flexibility in the sequence of Commit/Confirm messages, there is a constraint in IEEE 802.11 on how the Authentication frames are exchanged in an infrastructure BSS between a non-AP STA and an AP. For SAE, this is explicitly requiring the exchange proceed in the sequence shown in Figure 4-29 (Example using SAE authentication), i.e., with the Commit messages exchanged first and the first Confirm message coming from STA to AP and the exchange concluded with the Confirm message from AP to STA. This matches the Linux kernel implementation. For mesh BSS cases, the SAE Confirm message can be sent out immediately after having processed the Commit message, so the sequence there may end up being different. That's also supported in the Linux implementation, but this flexibility is not extended to the infrastructure case on purpose. -- Jouni MalinenPGP id EFC895FA
Re: [PATCH RFC v4 1/4] mac80211: Add TXQ scheduling API
Rajkumar Manoharan writes: > On 2018-09-18 13:41, Toke Høiland-Jørgensen wrote: >> Rajkumar Manoharan writes: >> > Also an option to add the node at head or tail would be preferred. > If > return_txq adds node at head of list, then it is forcing the driver > to > serve same txq until it becomes empty. Also this will not allow the > driver to send N frames from each txqs. The whole point of this patch set is to move those kinds of decisions out of the driver and into mac80211. The airtime scheduler won't achieve fairness if it allows queues to be queued to the end of the rotation before its deficit turns negative. And obviously there's some lag in this since we're using after-the-fact airtime information. >>> Hmm.. As you know ath10k kind of doing fairness by serving fixed >>> frames >>> from each txq. This approach will be removed from ath10k. >>> For ath9k this has not really been a problem in my tests; if the lag turns out to be too great for ath10k (which I suppose is a possibility since we don't get airtime information on every TX-compl), I figure we can use the same estimated airtime value that is used for throttling the queues to adjust the deficit immediately... >>> Thats true. I am porting Kan's changes of airtime estimation for each >>> msdu for firmware that does not report airtime. >> >> Right. My thinking with this was that we could put the per-frame >> airtime >> estimation into ieee80211_tx_dequeue(), which could track the >> outstanding airtime and just return NULL if it goes over the threshold. >> I think this is fairly straight-forward to do on its own; the biggest >> problem is probably finding the space in the mac80211 cb? >> >> Is this what you are working on porting? Because then I'll wait for >> your >> patch rather than starting to write this code myself :) >> > Kind of.. something like below. > > tx_dequeue(){ > compute airtime_est from last_tx_rate > if (sta->airtime[ac].deficit < airtime_est) > return NULL; > dequeue skb and store airtime_est in cb > } I think I would decouple it further and not use the deficit. But rather: tx_dequeue(){ if (sta->airtime[ac].outstanding > AIRTIME_OUTSTANDING_MAX) return NULL compute airtime_est from last_tx_rate dequeue skb and store airtime_est in cb sta->airtime[ac].outstanding += airtime_est; } > Unfortunately ath10k is not reporting last_tx_rate in tx_status(). So > I also applied this "ath10k: report tx rate using ieee80211_tx_status" > change. Yeah, that and the patch that computes the last used rate will probably be necessary; but they can be pretty much applied as-is, right? >> This mechanism on its own will get us the queue limiting and latency >> reduction goodness for firmwares with deep queues. And for that it can >> be completely independent of the airtime fairness scheduler, which can >> use the after-tx-compl airtime information to presumably get more >> accurate fairness which includes retransmissions etc. >> >> Now, we could *also* use the ahead-of-time airtime estimation for >> fairness; either just as a fallback for drivers that can't get actual >> airtime usage information for the hardware, or as an alternative in >> cases where it works better for other reasons. But I think that >> separating the two in the initial implementation makes more sense; that >> will make it easier to experiment with different combinations of the >> two. >> >> Does that make sense? :) >> > Completely agree. I was thinking of using this as fallback for devices > that does not report airtime but tx rate. Great! Seems we are converging on a workable solution, then :) -Toke
Re: [PATCH 29/29] staging: wilc1000: return exact error of register_netdev() from wilc_netdev_init()
I was waiting for you to send this like a spider waits for flies. You fell directly into my trap. Mwuahahahahaha. drivers/staging/wilc1000/linux_wlan.c 1056 int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, 1057 const struct wilc_hif_func *ops) 1058 { 1059 int i, ret = -ENOMEM; 1060 struct wilc_vif *vif; 1061 struct net_device *ndev; 1062 struct wilc *wl; 1063 1064 wl = kzalloc(sizeof(*wl), GFP_KERNEL); 1065 if (!wl) 1066 return ret; ^^^ It's cleaner to return -ENOMEM so that we don't have to glance up to the declaration block. This is especially true when "ret" is zero, btw, because that can indicate a reversed test. if (!ret) return ret; In this theoretically example it was supposed to be: if (ret) return ret; Normally, reversed conditions are caught in testing, but for the kernel, no one has the hardware to test everything so we do get reversed conditions from time to time. 1067 1068 if (wilc_wlan_cfg_init(wl)) 1069 goto free_wl; 1070 1071 *wilc = wl; 1072 wl->io_type = io_type; 1073 wl->hif_func = ops; 1074 wl->enable_ps = true; 1075 wl->chip_ps_state = CHIP_WAKEDUP; 1076 INIT_LIST_HEAD(>txq_head.list); 1077 INIT_LIST_HEAD(>rxq_head.list); 1078 1079 wl->hif_workqueue = create_singlethread_workqueue("WILC_wq"); 1080 if (!wl->hif_workqueue) 1081 goto free_cfg; 1082 1083 register_inetaddr_notifier(_dev_notifier); 1084 1085 for (i = 0; i < NUM_CONCURRENT_IFC; i++) { 1086 struct wireless_dev *wdev; 1087 1088 ndev = alloc_etherdev(sizeof(struct wilc_vif)); 1089 if (!ndev) 1090 goto free_ndev; ^^^ ret is zero on the second iteration through the loop. 1091 1092 vif = netdev_priv(ndev); 1093 memset(vif, 0, sizeof(struct wilc_vif)); 1094 1095 if (i == 0) { 1096 strcpy(ndev->name, "wlan%d"); 1097 vif->ifc_id = 1; 1098 } else { 1099 strcpy(ndev->name, "p2p%d"); 1100 vif->ifc_id = 0; 1101 } 1102 vif->wilc = *wilc; 1103 vif->ndev = ndev; 1104 wl->vif[i] = vif; 1105 wl->vif_num = i; 1106 vif->idx = wl->vif_num; 1107 1108 ndev->netdev_ops = _netdev_ops; 1109 1110 wdev = wilc_create_wiphy(ndev, dev); if (!wdev) { 1112 netdev_err(ndev, "Can't register WILC Wiphy\n"); 1113 goto free_ndev; ^^^ Here too. 1114 } 1115 1116 SET_NETDEV_DEV(ndev, dev); 1117 1118 vif->ndev->ieee80211_ptr = wdev; 1119 vif->ndev->ml_priv = vif; 1120 wdev->netdev = vif->ndev; 1121 vif->netstats.rx_packets = 0; 1122 vif->netstats.tx_packets = 0; 1123 vif->netstats.rx_bytes = 0; 1124 vif->netstats.tx_bytes = 0; 1125 1126 ret = register_netdev(ndev); 1127 if (ret) 1128 goto free_ndev; ret is cleared on the first iteration through the loop. 1129 1130 vif->iftype = STATION_MODE; 1131 vif->mac_opened = 0; 1132 } 1133 1134 return 0; regards, dan carpenter
[PATCH 27/29] staging: wilc1000: use usleep_range() in place of udelay()
Changes to avoid the below checkpatch warning: 'usleep_range is preferred over udelay; see Documentation/timers/timers-howto.txt;' Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/wilc_wlan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 0ec0d9b..a48c906 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -412,7 +412,7 @@ void chip_wakeup(struct wilc *wilc) } while (wilc_get_chipid(wilc, true) == 0); } else if ((wilc->io_type & 0x1) == HIF_SDIO) { wilc->hif_func->hif_write_reg(wilc, 0xfa, 1); - udelay(200); + usleep_range(200, 400); wilc->hif_func->hif_read_reg(wilc, 0xf0, ); do { wilc->hif_func->hif_write_reg(wilc, 0xf0, -- 2.7.4
[PATCH 20/29] staging: wilc1000: remove use of unnecessary 'wilc_connected_ssid' variable
'wilc_connected_ssid' actually used to store the BSSID information for connected BSSID. 'wilc_vif' already has 'bssid' variable to store the same information. So refactor code to remove 'wilc_connected_ssid' and instead used 'wilc_vif' struct 'bssid' element. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 24 --- drivers/staging/wilc1000/host_interface.h | 2 -- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 24 ++- 3 files changed, 15 insertions(+), 35 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 529390d..01db899 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -813,7 +813,6 @@ static void handle_scan(struct work_struct *work) kfree(msg); } -u8 wilc_connected_ssid[6] = {0}; static void handle_connect(struct work_struct *work) { struct host_if_msg *msg = container_of(work, struct host_if_msg, work); @@ -835,11 +834,6 @@ static void handle_connect(struct work_struct *work) return; } - if (memcmp(conn_attr->bssid, wilc_connected_ssid, ETH_ALEN) == 0) { - netdev_err(vif->ndev, "Discard connect request\n"); - goto error; - } - bss_param = conn_attr->params; if (!bss_param) { netdev_err(vif->ndev, "Required BSSID not found\n"); @@ -1019,10 +1013,6 @@ static void handle_connect(struct work_struct *work) cur_byte = wid_list[wid_cnt].val; wid_cnt++; - if (conn_attr->bssid) - memcpy(wilc_connected_ssid, - conn_attr->bssid, ETH_ALEN); - result = wilc_send_config_pkt(vif, SET_CFG, wid_list, wid_cnt, wilc_get_vif_idx(vif)); @@ -1145,8 +1135,6 @@ static void handle_connect_timeout(struct work_struct *work) kfree(hif_drv->usr_conn_req.ies); hif_drv->usr_conn_req.ies = NULL; - eth_zero_addr(wilc_connected_ssid); - out: kfree(msg); } @@ -1452,16 +1440,6 @@ static inline void host_int_parse_assoc_resp_info(struct wilc_vif *vif, } } - if (mac_status == MAC_STATUS_CONNECTED && - conn_info.status != WLAN_STATUS_SUCCESS) { - netdev_err(vif->ndev, - "Received MAC status is MAC_STATUS_CONNECTED, Assoc Resp is not SUCCESS\n"); - eth_zero_addr(wilc_connected_ssid); - } else if (mac_status == MAC_STATUS_DISCONNECTED){ - netdev_err(vif->ndev, "Received MAC status is MAC_STATUS_DISCONNECTED\n"); - eth_zero_addr(wilc_connected_ssid); - } - if (hif_drv->usr_conn_req.bssid) { memcpy(conn_info.bssid, hif_drv->usr_conn_req.bssid, 6); @@ -1874,8 +1852,6 @@ static void handle_disconnect(struct work_struct *work) vif->obtaining_ip = false; wilc_set_power_mgmt(vif, 0, 0); - eth_zero_addr(wilc_connected_ssid); - result = wilc_send_config_pkt(vif, SET_CFG, , 1, wilc_get_vif_idx(vif)); diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 4416f8f..33fb731 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -359,6 +359,4 @@ int wilc_get_vif_idx(struct wilc_vif *vif); int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power); int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power); -extern u8 wilc_connected_ssid[6]; - #endif diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 76d017d..1a4d262 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -478,7 +478,6 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt, connect_status = WLAN_STATUS_UNSPECIFIED_FAILURE; wilc_wlan_set_bssid(priv->dev, null_bssid, STATION_MODE); - eth_zero_addr(wilc_connected_ssid); if (!wfi_drv->p2p_connect) wlan_channel = INVALID_CHANNEL; @@ -521,7 +520,6 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt, wilc_ie = false; eth_zero_addr(priv->associated_bss); wilc_wlan_set_bssid(priv->dev, null_bssid, STATION_MODE); - eth_zero_addr(wilc_connected_ssid); if (!wfi_drv->p2p_connect) wlan_channel = INVALID_CHANNEL; @@ -696,8 +694,12 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, nw_info = >scanned_shadow[sel_bssi_idx]; } else {
[PATCH 17/29] staging: wilc1000: refactor code to avoid static variables for config parameters
Refactor the code in wilc_wlan_cfg.c file to avoid the use of static variables. Move the static variables as part of wilc struct and also dynamically allocating memory for keeping those variables. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/linux_wlan.c | 12 +- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 + drivers/staging/wilc1000/wilc_wlan.c | 12 +- drivers/staging/wilc1000/wilc_wlan.h | 3 +- drivers/staging/wilc1000/wilc_wlan_cfg.c | 159 +- drivers/staging/wilc1000/wilc_wlan_cfg.h | 20 +++- 6 files changed, 138 insertions(+), 70 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index d9f927e..8ecd664 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -161,7 +161,7 @@ void wilc_mac_indicate(struct wilc *wilc) { s8 status; - wilc_wlan_cfg_get_val(WID_STATUS, , 1); + wilc_wlan_cfg_get_val(wilc, WID_STATUS, , 1); if (wilc->mac_status == MAC_STATUS_INIT) { wilc->mac_status = status; complete(>sync_event); @@ -677,7 +677,7 @@ static int wilc_wlan_initialize(struct net_device *dev, struct wilc_vif *vif) int size; char firmware_ver[20]; - size = wilc_wlan_cfg_get_val(WID_FIRMWARE_VERSION, + size = wilc_wlan_cfg_get_val(wl, WID_FIRMWARE_VERSION, firmware_ver, sizeof(firmware_ver)); firmware_ver[size] = '\0'; @@ -1035,6 +1035,7 @@ void wilc_netdev_cleanup(struct wilc *wilc) flush_workqueue(wilc->hif_workqueue); destroy_workqueue(wilc->hif_workqueue); + wilc_wlan_cfg_deinit(wilc); kfree(wilc); } EXPORT_SYMBOL_GPL(wilc_netdev_cleanup); @@ -1060,6 +1061,9 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, if (!wl) return -ENOMEM; + if (wilc_wlan_cfg_init(wl)) + goto free_wl; + *wilc = wl; wl->io_type = io_type; wl->hif_func = ops; @@ -1070,7 +1074,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, wl->hif_workqueue = create_singlethread_workqueue("WILC_wq"); if (!wl->hif_workqueue) - goto free_wl; + goto free_cfg; register_inetaddr_notifier(_dev_notifier); @@ -1139,6 +1143,8 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, } unregister_inetaddr_notifier(_dev_notifier); destroy_workqueue(wl->hif_workqueue); +free_cfg: + wilc_wlan_cfg_deinit(wl); free_wl: kfree(wl); return -ENOMEM; diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 70bae3a..484c265 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -16,6 +16,7 @@ #include "host_interface.h" #include "wilc_wlan.h" +#include "wilc_wlan_cfg.h" #define FLOW_CONTROL_LOWER_THRESHOLD 128 #define FLOW_CONTROL_UPPER_THRESHOLD 256 @@ -203,6 +204,7 @@ struct wilc { int clients_count; struct workqueue_struct *hif_workqueue; enum chip_ps_states chip_ps_state; + struct wilc_cfg cfg; }; struct wilc_wfi_mon_priv { diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 88808d9..0ec0d9b 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1194,9 +1194,9 @@ int wilc_wlan_cfg_get(struct wilc_vif *vif, int start, u16 wid, int commit, return ret_size; } -int wilc_wlan_cfg_get_val(u16 wid, u8 *buffer, u32 buffer_size) +int wilc_wlan_cfg_get_val(struct wilc *wl, u16 wid, u8 *buffer, u32 buffer_size) { - return wilc_wlan_cfg_get_wid_value(wid, buffer, buffer_size); + return wilc_wlan_cfg_get_wid_value(wl, wid, buffer, buffer_size); } int wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, struct wid *wids, @@ -1216,7 +1216,8 @@ int wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, struct wid *wids, } } for (i = 0; i < count; i++) { - wids[i].size = wilc_wlan_cfg_get_val(wids[i].id, + wids[i].size = wilc_wlan_cfg_get_val(vif->wilc, +wids[i].id, wids[i].val, wids[i].size); } @@ -1315,11 +1316,6 @@ int wilc_wlan_init(struct net_device *dev) goto fail; } - if (!wilc_wlan_cfg_init()) { - ret =
[PATCH 28/29] staging: wilc1000: avoid spaces preferred around checkpatch issue
Cleanup patch to add extra spaces around the '/' to avoid the below checkpatch warning. 'spaces preferred around that '/' (ctx:VxV)' Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/linux_wlan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 695d5b2..29c1317 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -823,7 +823,7 @@ static void wilc_set_multicast_list(struct net_device *dev) netdev_for_each_mc_addr(ha, dev) { memcpy(mc_list + i, ha->addr, ETH_ALEN); - netdev_dbg(dev, "Entry[%d]: %x:%x:%x:%x:%x:%x\n", i/ETH_ALEN, + netdev_dbg(dev, "Entry[%d]: %x:%x:%x:%x:%x:%x\n", i / ETH_ALEN, mc_list[i], mc_list[i + 1], mc_list[i + 2], mc_list[i + 3], mc_list[i + 4], mc_list[i + 5]); i += ETH_ALEN; -- 2.7.4
[PATCH 26/29] staging: wilc1000: remove unnecessary option used with ccflags-y in Makefile
Cleanup patch to remove -I(src) and -DWILC_ASIC_A0 option used in ccflag-y in Makefile. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile index 5718bc4..37e8560 100644 --- a/drivers/staging/wilc1000/Makefile +++ b/drivers/staging/wilc1000/Makefile @@ -4,8 +4,6 @@ obj-$(CONFIG_WILC1000) += wilc1000.o ccflags-y += -DFIRMWARE_1002=\"atmel/wilc1002_firmware.bin\" \ -DFIRMWARE_1003=\"atmel/wilc1003_firmware.bin\" -ccflags-y += -I$(src)/ -DWILC_ASIC_A0 - wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \ coreconfigurator.o host_interface.o \ wilc_wlan_cfg.o wilc_wlan.o -- 2.7.4
[PATCH 24/29] staging: wilc1000: remove p2p related static variables to wilc_vif struct
Avoid use of static variable and move them as part of private data(wilc_priv) struct. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/linux_wlan.c | 2 + drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 60 +++ drivers/staging/wilc1000/wilc_wfi_netdevice.h | 7 +++ 3 files changed, 38 insertions(+), 31 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 560c168..695d5b2 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -729,6 +729,7 @@ static int wilc_mac_open(struct net_device *ndev) { struct wilc_vif *vif = netdev_priv(ndev); struct wilc *wl = vif->wilc; + struct wilc_priv *priv = wdev_priv(vif->ndev->ieee80211_ptr); unsigned char mac_add[ETH_ALEN] = {0}; int ret = 0; int i = 0; @@ -782,6 +783,7 @@ static int wilc_mac_open(struct net_device *ndev) vif->frame_reg[1].reg); netif_wake_queue(ndev); wl->open_ifcs++; + priv->p2p.local_random = 0x01; vif->mac_opened = 1; return 0; } diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 1a4d262..4fd 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -137,10 +137,7 @@ struct p2p_mgmt_data { static u8 wlan_channel = INVALID_CHANNEL; static u8 curr_channel; static u8 p2p_oui[] = {0x50, 0x6f, 0x9A, 0x09}; -static u8 p2p_local_random = 0x01; -static u8 p2p_recv_random; static u8 p2p_vendor_spec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03}; -static bool wilc_ie; static struct ieee80211_supported_band wilc_band_2ghz = { .channels = ieee80211_2ghz_channels, @@ -515,9 +512,9 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt, GFP_KERNEL); } else if (conn_disconn_evt == CONN_DISCONN_EVENT_DISCONN_NOTIF) { vif->obtaining_ip = false; - p2p_local_random = 0x01; - p2p_recv_random = 0x00; - wilc_ie = false; + priv->p2p.local_random = 0x01; + priv->p2p.recv_random = 0x00; + priv->p2p.is_wilc_ie = false; eth_zero_addr(priv->associated_bss); wilc_wlan_set_bssid(priv->dev, null_bssid, STATION_MODE); @@ -829,9 +826,9 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, wlan_channel = INVALID_CHANNEL; wilc_wlan_set_bssid(priv->dev, null_bssid, STATION_MODE); - p2p_local_random = 0x01; - p2p_recv_random = 0x00; - wilc_ie = false; + priv->p2p.local_random = 0x01; + priv->p2p.recv_random = 0x00; + priv->p2p.is_wilc_ie = false; wfi_drv->p2p_timeout = 0; ret = wilc_disconnect(vif, reason_code); @@ -1330,20 +1327,21 @@ static void wilc_wfi_cfg_parse_rx_vendor_spec(struct wilc_priv *priv, u8 *buff, struct wilc_vif *vif = netdev_priv(priv->dev); subtype = buff[P2P_PUB_ACTION_SUBTYPE]; - if ((subtype == GO_NEG_REQ || subtype == GO_NEG_RSP) && !wilc_ie) { + if ((subtype == GO_NEG_REQ || subtype == GO_NEG_RSP) && + !priv->p2p.is_wilc_ie) { for (i = P2P_PUB_ACTION_SUBTYPE; i < size; i++) { if (!memcmp(p2p_vendor_spec, [i], 6)) { - p2p_recv_random = buff[i + 6]; - wilc_ie = true; + priv->p2p.recv_random = buff[i + 6]; + priv->p2p.is_wilc_ie = true; break; } } } - if (p2p_local_random <= p2p_recv_random) { + if (priv->p2p.local_random <= priv->p2p.recv_random) { netdev_dbg(vif->ndev, "PEER WILL BE GO LocaRand=%02x RecvRand %02x\n", - p2p_local_random, p2p_recv_random); + priv->p2p.local_random, priv->p2p.recv_random); return; } @@ -1411,7 +1409,7 @@ void wilc_wfi_p2p_rx(struct net_device *dev, u8 *buff, u32 size) size); if ((subtype == GO_NEG_REQ || subtype == GO_NEG_RSP) && - wilc_ie) + priv->p2p.is_wilc_ie) size -= 7; break; @@ -1503,7 +1501,8 @@ static int cancel_remain_on_channel(struct wiphy *wiphy, priv->remain_on_ch_params.listen_session_id); } -static void wilc_wfi_cfg_tx_vendor_spec(struct p2p_mgmt_data *mgmt_tx, +static void wilc_wfi_cfg_tx_vendor_spec(struct wilc_priv *priv, + struct p2p_mgmt_data
[PATCH 23/29] staging: wilc1000: remove unnecessary memset in sdio_init() & wilc_spi_init()
Cleanup changes to avoid unnecessary setting 'wilc->bus_data' value to zero as the buffer was allocated using kzalloc(). Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/wilc_sdio.c | 4 +--- drivers/staging/wilc1000/wilc_spi.c | 3 --- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index 7ef047c..ca351c9 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -689,10 +689,8 @@ static int sdio_init(struct wilc *wilc, bool resume) int loop, ret; u32 chipid; - if (!resume) { - memset(sdio_priv, 0, sizeof(struct wilc_sdio)); + if (!resume) sdio_priv->irq_gpio = wilc->dev_irq_num; - } /** * function 0 csa enable diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index 2559cf0..cef127b 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -838,12 +838,9 @@ static int wilc_spi_init(struct wilc *wilc, bool resume) return 1; } - memset(spi_priv, 0, sizeof(struct wilc_spi)); - /* * configure protocol */ - spi_priv->crc_off = 0; /* * TODO: We can remove the CRC trials if there is a definite -- 2.7.4
[PATCH 16/29] staging: wilc1000: refactor code to remove 'mac_status' from 'wilc_mac_cfg' struct
Refactor the code by removing use of 'mac_status' from 'wilc_mac_cfg' and only have the string type configuration values in 'wilc_mac_cfg' struct. Now fetch the value 'WID_STATUS' configuration from 'g_cfg_byte' array. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/linux_wlan.c | 4 ++-- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +- drivers/staging/wilc1000/wilc_wlan_cfg.c | 23 ++- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index e2669b9..d9f927e 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -159,9 +159,9 @@ static void deinit_irq(struct net_device *dev) void wilc_mac_indicate(struct wilc *wilc) { - int status; + s8 status; - wilc_wlan_cfg_get_val(WID_STATUS, (unsigned char *), 4); + wilc_wlan_cfg_get_val(WID_STATUS, , 1); if (wilc->mac_status == MAC_STATUS_INIT) { wilc->mac_status = status; complete(>sync_event); diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 30151b2..70bae3a 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -155,7 +155,7 @@ struct wilc_vif { struct wilc { const struct wilc_hif_func *hif_func; int io_type; - int mac_status; + s8 mac_status; struct gpio_desc *gpio_irq; bool initialized; int dev_irq_num; diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c index 541251b..4434976 100644 --- a/drivers/staging/wilc1000/wilc_wlan_cfg.c +++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c @@ -18,7 +18,6 @@ enum cfg_cmd_type { }; struct wilc_mac_cfg { - int mac_status; u8 mac_address[7]; u8 firmware_version[129]; u8 assoc_rsp[256]; @@ -251,15 +250,26 @@ static void wilc_wlan_parse_response_frame(u8 *info, int size) static void wilc_wlan_parse_info_frame(u8 *info) { - struct wilc_mac_cfg *pd = _mac; u32 wid, len; wid = info[0] | (info[1] << 8); len = info[2]; - if (len == 1 && wid == WID_STATUS) - pd->mac_status = info[3]; + if (len == 1 && wid == WID_STATUS) { + int i = 0; + + do { + if (g_cfg_byte[i].id == WID_NIL) + break; + + if (g_cfg_byte[i].id == wid) { + g_cfg_byte[i].val = info[3]; + break; + } + i++; + } while (1); + } } / @@ -323,11 +333,6 @@ int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 buffer_size) u32 type = (wid >> 12) & 0xf; int i, ret = 0; - if (wid == WID_STATUS) { - *((u32 *)buffer) = g_mac.mac_status; - return 4; - } - i = 0; if (type == CFG_BYTE_CMD) { do { -- 2.7.4
[PATCH 19/29] staging: wilc1000: avoid the use of 'hif_driver_comp' completion variable
Instead of using extra completion variable to handle the sync call now using msg->is_sync flag to handle the sync call. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 23 +++ drivers/staging/wilc1000/host_interface.h | 2 +- drivers/staging/wilc1000/linux_wlan.c | 3 ++- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 237a098d..529390d 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -187,7 +187,6 @@ struct join_bss_param { }; static struct host_if_drv *terminated_handle; -static struct completion hif_driver_comp; static struct mutex hif_deinit_lock; /* 'msg' should be free by the caller for syc */ @@ -310,10 +309,12 @@ static void handle_set_wfi_drv_handler(struct work_struct *work) if (ret) netdev_err(vif->ndev, "Failed to set driver handler\n"); - complete(_driver_comp); kfree(buffer); free_msg: + if (msg->is_sync) + complete(>work_comp); + kfree(msg); } @@ -333,9 +334,6 @@ static void handle_set_operation_mode(struct work_struct *work) ret = wilc_send_config_pkt(vif, SET_CFG, , 1, wilc_get_vif_idx(vif)); - if (hif_op_mode->mode == IDLE_MODE) - complete(_driver_comp); - if (ret) netdev_err(vif->ndev, "Failed to set operation mode\n"); @@ -3118,12 +3116,12 @@ int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel) } int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode, -u8 ifc_id) +u8 ifc_id, bool is_sync) { int result; struct host_if_msg *msg; - msg = wilc_alloc_work(vif, handle_set_wfi_drv_handler, false); + msg = wilc_alloc_work(vif, handle_set_wfi_drv_handler, is_sync); if (IS_ERR(msg)) return PTR_ERR(msg); @@ -3135,8 +3133,12 @@ int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode, if (result) { netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__); kfree(msg); + return result; } + if (is_sync) + wait_for_completion(>work_comp); + return result; } @@ -3380,10 +3382,8 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) vif->obtaining_ip = false; - if (wilc->clients_count == 0) { - init_completion(_driver_comp); + if (wilc->clients_count == 0) mutex_init(_deinit_lock); - } timer_setup(>periodic_rssi, get_periodic_rssi, 0); mod_timer(>periodic_rssi, jiffies + msecs_to_jiffies(5000)); @@ -3430,8 +3430,7 @@ int wilc_deinit(struct wilc_vif *vif) del_timer_sync(>periodic_rssi); del_timer_sync(_drv->remain_on_ch_timer); - wilc_set_wfi_drv_handler(vif, 0, 0, 0); - wait_for_completion(_driver_comp); + wilc_set_wfi_drv_handler(vif, 0, 0, 0, true); if (hif_drv->usr_scan_req.scan_result) { hif_drv->usr_scan_req.scan_result(SCAN_EVENT_ABORTED, NULL, diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 15ffaeb..4416f8f 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -350,7 +350,7 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id, int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id); void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg); int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode, -u8 ifc_id); +u8 ifc_id, bool is_sync); int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode); int wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats, bool is_sync); diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 8ecd664..b666e1e 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -753,7 +753,8 @@ static int wilc_mac_open(struct net_device *ndev) for (i = 0; i < wl->vif_num; i++) { if (ndev == wl->vif[i]->ndev) { wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif), -vif->iftype, vif->ifc_id); +vif->iftype, vif->ifc_id, +false); wilc_set_operation_mode(vif, vif->iftype); break; } diff --git
[PATCH 22/29] staging: wilc1000: avoid use of 'g_spi' static variable
Instead of using static variable 'g_spi' move it as part of 'wilc' struct. Also allocating the memory in the probe function and free is taken care in wilc_netdev_cleanup(). Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/wilc_spi.c | 58 +++-- 1 file changed, 36 insertions(+), 22 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index 5517477..2559cf0 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -14,7 +14,6 @@ struct wilc_spi { int has_thrpt_enh; }; -static struct wilc_spi g_spi; static const struct wilc_hif_func wilc_hif_spi; / @@ -107,6 +106,11 @@ static int wilc_bus_probe(struct spi_device *spi) int ret; struct wilc *wilc; struct gpio_desc *gpio; + struct wilc_spi *spi_priv; + + spi_priv = kzalloc(sizeof(*spi_priv), GFP_KERNEL); + if (!spi_priv) + return -ENOMEM; gpio = gpiod_get(>dev, "irq", GPIOD_IN); if (IS_ERR(gpio)) { @@ -117,11 +121,14 @@ static int wilc_bus_probe(struct spi_device *spi) } ret = wilc_netdev_init(, NULL, HIF_SPI, _hif_spi); - if (ret) + if (ret) { + kfree(spi_priv); return ret; + } spi_set_drvdata(spi, wilc); wilc->dev = >dev; + wilc->bus_data = spi_priv; wilc->gpio_irq = gpio; return 0; @@ -275,6 +282,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, u8 clockless) { struct spi_device *spi = to_spi_device(wilc->dev); + struct wilc_spi *spi_priv = wilc->bus_data; u8 wb[32], rb[32]; u8 wix, rix; u32 len2; @@ -375,7 +383,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, if (result != N_OK) return result; - if (!g_spi.crc_off) + if (!spi_priv->crc_off) wb[len - 1] = (crc7(0x7f, (const u8 *)[0], len - 1)) << 1; else len -= 1; @@ -393,7 +401,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, } else if (cmd == CMD_INTERNAL_READ || cmd == CMD_SINGLE_READ) { int tmp = NUM_RSP_BYTES + NUM_DATA_HDR_BYTES + NUM_DATA_BYTES + NUM_DUMMY_BYTES; - if (!g_spi.crc_off) + if (!spi_priv->crc_off) len2 = len + tmp + NUM_CRC_BYTES; else len2 = len + tmp; @@ -485,7 +493,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, return N_FAIL; } - if (!g_spi.crc_off) { + if (!spi_priv->crc_off) { /* * Read Crc */ @@ -527,7 +535,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, /* * Read Crc */ - if (!g_spi.crc_off && wilc_spi_rx(wilc, crc, 2)) { + if (!spi_priv->crc_off && wilc_spi_rx(wilc, crc, 2)) { dev_err(>dev, "Failed block crc read, bus err\n"); return N_FAIL; @@ -585,7 +593,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, /* * Read Crc */ - if (!g_spi.crc_off && wilc_spi_rx(wilc, crc, 2)) { + if (!spi_priv->crc_off && wilc_spi_rx(wilc, crc, 2)) { dev_err(>dev, "Failed block crc read, bus err\n"); result = N_FAIL; @@ -602,6 +610,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz) { struct spi_device *spi = to_spi_device(wilc->dev); + struct wilc_spi *spi_priv = wilc->bus_data; int ix, nbytes; int result = 1; u8 cmd, order, crc[2] = {0}; @@ -648,7 +657,7 @@ static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz) /* * Write Crc */ - if (!g_spi.crc_off) { + if (!spi_priv->crc_off) { if (wilc_spi_tx(wilc, crc, 2)) { dev_err(>dev, "Failed data block crc write, bus error...\n"); result = N_FAIL; @@ -816,6 +825,7 @@ static int _wilc_spi_deinit(struct wilc *wilc) static int wilc_spi_init(struct wilc *wilc, bool resume) { struct spi_device *spi =
[PATCH 21/29] staging: wilc1000: avoid use of 'g_sdio' static variable
Instead of using static variable 'g_sdio' move it as part of 'wilc' struct. Also allocating the memory in the probe function and free during deinitialization. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/linux_wlan.c | 1 + drivers/staging/wilc1000/wilc_sdio.c | 54 +-- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 + 3 files changed, 36 insertions(+), 20 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index b666e1e..560c168 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1037,6 +1037,7 @@ void wilc_netdev_cleanup(struct wilc *wilc) flush_workqueue(wilc->hif_workqueue); destroy_workqueue(wilc->hif_workqueue); wilc_wlan_cfg_deinit(wilc); + kfree(wilc->bus_data); kfree(wilc); } EXPORT_SYMBOL_GPL(wilc_netdev_cleanup); diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index b2080d8..7ef047c 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -30,7 +30,6 @@ struct wilc_sdio { int has_thrpt_enh3; }; -static struct wilc_sdio g_sdio; static const struct wilc_hif_func wilc_hif_sdio; static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data); @@ -109,6 +108,11 @@ static int linux_sdio_probe(struct sdio_func *func, struct wilc *wilc; int ret; struct gpio_desc *gpio = NULL; + struct wilc_sdio *sdio_priv; + + sdio_priv = kzalloc(sizeof(*sdio_priv), GFP_KERNEL); + if (!sdio_priv) + return -ENOMEM; if (IS_ENABLED(CONFIG_WILC1000_HW_OOB_INTR)) { gpio = gpiod_get(>dev, "irq", GPIOD_IN); @@ -124,9 +128,11 @@ static int linux_sdio_probe(struct sdio_func *func, ret = wilc_netdev_init(, >dev, HIF_SDIO, _hif_sdio); if (ret) { dev_err(>dev, "Couldn't initialize netdev\n"); + kfree(sdio_priv); return ret; } sdio_set_drvdata(func, wilc); + wilc->bus_data = sdio_priv; wilc->dev = >dev; wilc->gpio_irq = gpio; @@ -381,6 +387,7 @@ static int sdio_set_func1_block_size(struct wilc *wilc, u32 block_size) static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data) { struct sdio_func *func = dev_to_sdio_func(wilc->dev); + struct wilc_sdio *sdio_priv = wilc->bus_data; int ret; cpu_to_le32s(); @@ -415,7 +422,7 @@ static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data) cmd.increment = 1; cmd.count = 4; cmd.buffer = (u8 *) - cmd.block_size = g_sdio.block_size; + cmd.block_size = sdio_priv->block_size; ret = wilc_sdio_cmd53(wilc, ); if (ret) { dev_err(>dev, @@ -434,7 +441,8 @@ static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data) static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size) { struct sdio_func *func = dev_to_sdio_func(wilc->dev); - u32 block_size = g_sdio.block_size; + struct wilc_sdio *sdio_priv = wilc->bus_data; + u32 block_size = sdio_priv->block_size; struct sdio_cmd53 cmd; int nblk, nleft, ret; @@ -523,6 +531,7 @@ static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size) static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data) { struct sdio_func *func = dev_to_sdio_func(wilc->dev); + struct wilc_sdio *sdio_priv = wilc->bus_data; int ret; if (addr >= 0xf0 && addr <= 0xff) { @@ -553,7 +562,7 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data) cmd.count = 4; cmd.buffer = (u8 *)data; - cmd.block_size = g_sdio.block_size; + cmd.block_size = sdio_priv->block_size; ret = wilc_sdio_cmd53(wilc, ); if (ret) { dev_err(>dev, @@ -574,7 +583,8 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data) static int sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size) { struct sdio_func *func = dev_to_sdio_func(wilc->dev); - u32 block_size = g_sdio.block_size; + struct wilc_sdio *sdio_priv = wilc->bus_data; + u32 block_size = sdio_priv->block_size; struct sdio_cmd53 cmd; int nblk, nleft, ret; @@ -674,13 +684,14 @@ static int sdio_deinit(struct wilc *wilc) static int sdio_init(struct wilc *wilc, bool resume) { struct sdio_func *func = dev_to_sdio_func(wilc->dev); + struct wilc_sdio *sdio_priv = wilc->bus_data; struct sdio_cmd52 cmd; int loop, ret; u32 chipid; if (!resume) { - memset(_sdio, 0, sizeof(struct wilc_sdio)); - g_sdio.irq_gpio = wilc->dev_irq_num; +
[PATCH 25/29] staging: wilc1000: remove wilc_debugfs.c file as its not used
Deleted wilc_debugfs.c file as it's not used. Earlier discussion link: [1]. https://www.spinics.net/lists/linux-wireless/msg176076.html Suggested-by: Greg KH Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/Makefile | 5 +- drivers/staging/wilc1000/wilc_debugfs.c | 115 2 files changed, 2 insertions(+), 118 deletions(-) delete mode 100644 drivers/staging/wilc1000/wilc_debugfs.c diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile index ee7e26b..5718bc4 100644 --- a/drivers/staging/wilc1000/Makefile +++ b/drivers/staging/wilc1000/Makefile @@ -4,12 +4,11 @@ obj-$(CONFIG_WILC1000) += wilc1000.o ccflags-y += -DFIRMWARE_1002=\"atmel/wilc1002_firmware.bin\" \ -DFIRMWARE_1003=\"atmel/wilc1003_firmware.bin\" -ccflags-y += -I$(src)/ -DWILC_ASIC_A0 -DWILC_DEBUGFS +ccflags-y += -I$(src)/ -DWILC_ASIC_A0 wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \ coreconfigurator.o host_interface.o \ - wilc_wlan_cfg.o wilc_debugfs.o \ - wilc_wlan.o + wilc_wlan_cfg.o wilc_wlan.o obj-$(CONFIG_WILC1000_SDIO) += wilc1000-sdio.o wilc1000-sdio-objs += wilc_sdio.o diff --git a/drivers/staging/wilc1000/wilc_debugfs.c b/drivers/staging/wilc1000/wilc_debugfs.c deleted file mode 100644 index 8001df6..000 --- a/drivers/staging/wilc1000/wilc_debugfs.c +++ /dev/null @@ -1,115 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries. - * All rights reserved. - */ - -#if defined(WILC_DEBUGFS) -#include -#include - -#include "wilc_wlan_if.h" - -static struct dentry *wilc_dir; - -#define DEBUG BIT(0) -#define INFOBIT(1) -#define WRN BIT(2) -#define ERR BIT(3) - -#define DBG_LEVEL_ALL (DEBUG | INFO | WRN | ERR) -static atomic_t WILC_DEBUG_LEVEL = ATOMIC_INIT(ERR); -EXPORT_SYMBOL_GPL(WILC_DEBUG_LEVEL); - -static ssize_t wilc_debug_level_read(struct file *file, char __user *userbuf, -size_t count, loff_t *ppos) -{ - char buf[128]; - int res = 0; - - /* only allow read from start */ - if (*ppos > 0) - return 0; - - res = scnprintf(buf, sizeof(buf), "Debug Level: %x\n", - atomic_read(_DEBUG_LEVEL)); - - return simple_read_from_buffer(userbuf, count, ppos, buf, res); -} - -static ssize_t wilc_debug_level_write(struct file *filp, - const char __user *buf, size_t count, - loff_t *ppos) -{ - int flag = 0; - int ret; - - ret = kstrtouint_from_user(buf, count, 16, ); - if (ret) - return ret; - - if (flag > DBG_LEVEL_ALL) { - pr_info("%s, value (0x%08x) is out of range, stay previous flag (0x%08x)\n", - __func__, flag, atomic_read(_DEBUG_LEVEL)); - return -EINVAL; - } - - atomic_set(_DEBUG_LEVEL, (int)flag); - - if (flag == 0) - pr_info("Debug-level disabled\n"); - else - pr_info("Debug-level enabled\n"); - - return count; -} - -#define FOPS(_open, _read, _write, _poll) { \ - .owner = THIS_MODULE, \ - .open = (_open), \ - .read = (_read), \ - .write = (_write), \ - .poll = (_poll), \ -} - -struct wilc_debugfs_info_t { - const char *name; - int perm; - unsigned int data; - const struct file_operations fops; -}; - -static struct wilc_debugfs_info_t debugfs_info[] = { - { - "wilc_debug_level", - 0666, - (DEBUG | ERR), - FOPS(NULL, wilc_debug_level_read, wilc_debug_level_write, NULL), - }, -}; - -static int __init wilc_debugfs_init(void) -{ - int i; - struct wilc_debugfs_info_t *info; - - wilc_dir = debugfs_create_dir("wilc_wifi", NULL); - for (i = 0; i < ARRAY_SIZE(debugfs_info); i++) { - info = _info[i]; - debugfs_create_file(info->name, - info->perm, - wilc_dir, - >data, - >fops); - } - return 0; -} -module_init(wilc_debugfs_init); - -static void __exit wilc_debugfs_remove(void) -{ - debugfs_remove_recursive(wilc_dir); -} -module_exit(wilc_debugfs_remove); - -#endif -- 2.7.4
[PATCH 18/29] staging: wilc1000: rename 'wilc_mac_cfg' struct to 'wilc_cfg_str_vals'
Rename 'wilc_mac_cfg' struct to 'wilc_cfg_str_vals' as its more appropriate for structure to store the values of string configuration. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/wilc_wlan_cfg.c | 14 +++--- drivers/staging/wilc1000/wilc_wlan_cfg.h | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c index 8f1e962..930a389 100644 --- a/drivers/staging/wilc1000/wilc_wlan_cfg.c +++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c @@ -438,7 +438,7 @@ void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size, int wilc_wlan_cfg_init(struct wilc *wl) { - struct wilc_mac_cfg *mac_cfg; + struct wilc_cfg_str_vals *str_vals; int i = 0; wl->cfg.b = kmemdup(g_cfg_byte, sizeof(g_cfg_byte), GFP_KERNEL); @@ -457,20 +457,20 @@ int wilc_wlan_cfg_init(struct wilc *wl) if (!wl->cfg.s) goto out_w; - mac_cfg = kzalloc(sizeof(mac_cfg), GFP_KERNEL); - if (!mac_cfg) + str_vals = kzalloc(sizeof(str_vals), GFP_KERNEL); + if (!str_vals) goto out_s; - wl->cfg.str_vals = mac_cfg; + wl->cfg.str_vals = str_vals; /* store the string cfg parameters */ wl->cfg.s[i].id = WID_FIRMWARE_VERSION; - wl->cfg.s[i].str = mac_cfg->firmware_version; + wl->cfg.s[i].str = str_vals->firmware_version; i++; wl->cfg.s[i].id = WID_MAC_ADDR; - wl->cfg.s[i].str = mac_cfg->mac_address; + wl->cfg.s[i].str = str_vals->mac_address; i++; wl->cfg.s[i].id = WID_ASSOC_RES_INFO; - wl->cfg.s[i].str = mac_cfg->assoc_rsp; + wl->cfg.s[i].str = str_vals->assoc_rsp; i++; wl->cfg.s[i].id = WID_NIL; wl->cfg.s[i].str = NULL; diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.h b/drivers/staging/wilc1000/wilc_wlan_cfg.h index 176eef1..e5ca6ce 100644 --- a/drivers/staging/wilc1000/wilc_wlan_cfg.h +++ b/drivers/staging/wilc1000/wilc_wlan_cfg.h @@ -27,7 +27,7 @@ struct wilc_cfg_str { u8 *str; }; -struct wilc_mac_cfg { +struct wilc_cfg_str_vals { u8 mac_address[7]; u8 firmware_version[129]; u8 assoc_rsp[256]; @@ -38,7 +38,7 @@ struct wilc_cfg { struct wilc_cfg_hword *hw; struct wilc_cfg_word *w; struct wilc_cfg_str *s; - struct wilc_mac_cfg *str_vals; + struct wilc_cfg_str_vals *str_vals; }; struct wilc; -- 2.7.4
[PATCH 29/29] staging: wilc1000: return exact error of register_netdev() from wilc_netdev_init()
Modified wilc_netdev_init() to return the error code received from register_netdev() during the failure condition. Earlier discussion link [1]. https://www.spinics.net/lists/linux-wireless/msg177304.html Suggested-by: Claudiu Beznea Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/linux_wlan.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 29c1317..75abaf9 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1056,14 +1056,14 @@ static const struct net_device_ops wilc_netdev_ops = { int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, const struct wilc_hif_func *ops) { - int i, ret; + int i, ret = -ENOMEM; struct wilc_vif *vif; struct net_device *ndev; struct wilc *wl; wl = kzalloc(sizeof(*wl), GFP_KERNEL); if (!wl) - return -ENOMEM; + return ret; if (wilc_wlan_cfg_init(wl)) goto free_wl; @@ -1151,7 +1151,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, wilc_wlan_cfg_deinit(wl); free_wl: kfree(wl); - return -ENOMEM; + return ret; } EXPORT_SYMBOL_GPL(wilc_netdev_init); -- 2.7.4
Hello Friend
Dear, I am working in financial firm in Asia. I have a business to transfer the sum of $19.000.000.00 of abandon fund in my office. If you are,interested in the transaction reply on my email for more details. Best Regards, Danny Chan.
[PATCH 06/29] staging: wilc1000: use 'void' return type for host_int_get_assoc_res_info()
Change return type to 'void' for host_int_get_assoc_res_info() as its return value is not used. 'rcvd_assoc_resp_info_len' parameter value is used to know the status. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 7729f83..237a098d 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -1388,10 +1388,10 @@ static void handle_rcvd_ntwrk_info(struct work_struct *work) kfree(msg); } -static s32 host_int_get_assoc_res_info(struct wilc_vif *vif, - u8 *assoc_resp_info, - u32 max_assoc_resp_info_len, - u32 *rcvd_assoc_resp_info_len) +static void host_int_get_assoc_res_info(struct wilc_vif *vif, + u8 *assoc_resp_info, + u32 max_assoc_resp_info_len, + u32 *rcvd_assoc_resp_info_len) { int result; struct wid wid; @@ -1406,11 +1406,10 @@ static s32 host_int_get_assoc_res_info(struct wilc_vif *vif, if (result) { *rcvd_assoc_resp_info_len = 0; netdev_err(vif->ndev, "Failed to send association response\n"); - return -EINVAL; + return; } *rcvd_assoc_resp_info_len = wid.size; - return result; } static inline void host_int_free_user_conn_req(struct host_if_drv *hif_drv) -- 2.7.4
[PATCH 01/29] staging: wilc1000: change return type to 'void' for wilc_frame_register()
Cleanup patch to use 'void' return type for wilc_frame_register(), as its return value is not used. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 6 ++ drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 5388be9..7729f83 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3641,14 +3641,14 @@ int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id) return result; } -int wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg) +void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg) { int result; struct host_if_msg *msg; msg = wilc_alloc_work(vif, handle_register_frame, false); if (IS_ERR(msg)) - return PTR_ERR(msg); + return; switch (frame_type) { case ACTION: @@ -3670,8 +3670,6 @@ int wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg) netdev_err(vif->ndev, "%s: enqueue work failed\n", __func__); kfree(msg); } - - return result; } int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period, diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index a48818f..15ffaeb 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -348,7 +348,7 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id, wilc_remain_on_chan_ready ready, void *user_arg); int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id); -int wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg); +void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg); int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode, u8 ifc_id); int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode); -- 2.7.4
[PATCH 03/29] staging: wilc1000: change return type to 'void' for lock init & deinit functions
Cleanup patch to use 'void' return type for wlan_deinit_locks() & wlan_init_locks(), as same value is return. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/linux_wlan.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index d1d2c64..e2669b9 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -525,7 +525,7 @@ static int linux_wlan_init_test_config(struct net_device *dev, return -1; } -static int wlan_deinit_locks(struct net_device *dev) +static void wlan_deinit_locks(struct net_device *dev) { struct wilc_vif *vif = netdev_priv(dev); struct wilc *wilc = vif->wilc; @@ -533,8 +533,6 @@ static int wlan_deinit_locks(struct net_device *dev) mutex_destroy(>hif_cs); mutex_destroy(>rxq_cs); mutex_destroy(>txq_add_to_head_cs); - - return 0; } static void wlan_deinitialize_threads(struct net_device *dev) @@ -588,7 +586,7 @@ static void wilc_wlan_deinitialize(struct net_device *dev) } } -static int wlan_init_locks(struct net_device *dev) +static void wlan_init_locks(struct net_device *dev) { struct wilc_vif *vif = netdev_priv(dev); struct wilc *wl = vif->wilc; @@ -604,8 +602,6 @@ static int wlan_init_locks(struct net_device *dev) init_completion(>cfg_event); init_completion(>sync_event); init_completion(>txq_thread_started); - - return 0; } static int wlan_initialize_threads(struct net_device *dev) -- 2.7.4
[PATCH 04/29] staging: wilc1000: change return type to 'void' for wilc_deinit_host_int()
Cleanup patch to use 'void' return type for wilc_deinit_host_int(), as its return value is not used in caller. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 +--- drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 37c26d4..02a8846 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -2175,7 +2175,7 @@ int wilc_init_host_int(struct net_device *net) return ret; } -int wilc_deinit_host_int(struct net_device *net) +void wilc_deinit_host_int(struct net_device *net) { int ret; struct wilc_priv *priv = wdev_priv(net->ieee80211_ptr); @@ -2192,8 +2192,6 @@ int wilc_deinit_host_int(struct net_device *net) if (ret) netdev_err(net, "Error while deinitializing host interface\n"); - - return ret; } void wilc_free_wiphy(struct net_device *net) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h index be412b6..1858f56 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h @@ -11,7 +11,7 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *dev); void wilc_free_wiphy(struct net_device *net); -int wilc_deinit_host_int(struct net_device *net); +void wilc_deinit_host_int(struct net_device *net); int wilc_init_host_int(struct net_device *net); void wilc_wfi_monitor_rx(u8 *buff, u32 size); int wilc_wfi_deinit_mon_interface(void); -- 2.7.4
[PATCH 05/29] staging: wilc1000: change return type to 'void' for wilc_wfi_deinit_mon_interface()
Use 'void' return type for wilc_wfi_deinit_mon_interface(), as same value always return. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/linux_mon.c | 3 +-- drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c index 1afdb9e..a634468 100644 --- a/drivers/staging/wilc1000/linux_mon.c +++ b/drivers/staging/wilc1000/linux_mon.c @@ -253,7 +253,7 @@ struct net_device *wilc_wfi_init_mon_interface(const char *name, return wilc_wfi_mon; } -int wilc_wfi_deinit_mon_interface(void) +void wilc_wfi_deinit_mon_interface(void) { bool rollback_lock = false; @@ -270,5 +270,4 @@ int wilc_wfi_deinit_mon_interface(void) } wilc_wfi_mon = NULL; } - return 0; } diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h index 1858f56..4812c8e 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h @@ -14,7 +14,7 @@ void wilc_free_wiphy(struct net_device *net); void wilc_deinit_host_int(struct net_device *net); int wilc_init_host_int(struct net_device *net); void wilc_wfi_monitor_rx(u8 *buff, u32 size); -int wilc_wfi_deinit_mon_interface(void); +void wilc_wfi_deinit_mon_interface(void); struct net_device *wilc_wfi_init_mon_interface(const char *name, struct net_device *real_dev); void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev, -- 2.7.4
[PATCH 11/29] staging: wilc1000: refactor wilc_wlan_parse_info_frame() function
Return 'void' from wilc_wlan_parse_info_frame() as same constant value is returned always. Also removed the 'size' from input parameter as its not used in the function. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/wilc_wlan_cfg.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c index 42c64ed..2b5471b 100644 --- a/drivers/staging/wilc1000/wilc_wlan_cfg.c +++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c @@ -350,22 +350,17 @@ static void wilc_wlan_parse_response_frame(u8 *info, int size) } } -static int wilc_wlan_parse_info_frame(u8 *info, int size) +static void wilc_wlan_parse_info_frame(u8 *info) { struct wilc_mac_cfg *pd = _mac; u32 wid, len; - int type = WILC_CFG_RSP_STATUS; wid = info[0] | (info[1] << 8); len = info[2]; - if (len == 1 && wid == WID_STATUS) { + if (len == 1 && wid == WID_STATUS) pd->mac_status = info[3]; - type = WILC_CFG_RSP_STATUS; - } - - return type; } / @@ -528,7 +523,8 @@ void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size, break; case 'I': - rsp->type = wilc_wlan_parse_info_frame(frame, size); + wilc_wlan_parse_info_frame(frame); + rsp->type = WILC_CFG_RSP_STATUS; rsp->seq_no = msg_id; /*call host interface info parse as well*/ wilc_gnrl_async_info_received(wilc, frame - 4, size + 4); -- 2.7.4
[PATCH 10/29] staging: wilc1000: change return type to 'void' for wilc_wlan_cfg_indicate_rx()
Cleanup patch to use 'void' return type for wilc_wlan_cfg_indicate_rx(), as its return value is not used in caller. The value set in 'rsp' argument is used to get the success status. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/wilc_wlan_cfg.c | 8 ++-- drivers/staging/wilc1000/wilc_wlan_cfg.h | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c index 4215763..42c64ed 100644 --- a/drivers/staging/wilc1000/wilc_wlan_cfg.c +++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c @@ -502,10 +502,9 @@ int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 buffer_size) return ret; } -int wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size, - struct wilc_cfg_rsp *rsp) +void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size, + struct wilc_cfg_rsp *rsp) { - int ret = 1; u8 msg_type; u8 msg_id; @@ -547,11 +546,8 @@ int wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size, default: rsp->type = 0; rsp->seq_no = msg_id; - ret = 0; break; } - - return ret; } int wilc_wlan_cfg_init(void) diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.h b/drivers/staging/wilc1000/wilc_wlan_cfg.h index 0c649d1..189e617 100644 --- a/drivers/staging/wilc1000/wilc_wlan_cfg.h +++ b/drivers/staging/wilc1000/wilc_wlan_cfg.h @@ -31,8 +31,8 @@ struct wilc; int wilc_wlan_cfg_set_wid(u8 *frame, u32 offset, u16 id, u8 *buf, int size); int wilc_wlan_cfg_get_wid(u8 *frame, u32 offset, u16 id); int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 buffer_size); -int wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size, - struct wilc_cfg_rsp *rsp); +void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size, + struct wilc_cfg_rsp *rsp); int wilc_wlan_cfg_init(void); #endif -- 2.7.4
[PATCH 07/29] staging: wilc1000: use 'void' return for wilc_wlan_txq_add_to_head()
Use 'void' return for wilc_wlan_txq_add_to_head() as its always return '0' value. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/wilc_wlan.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 590a51c..8057db9 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -71,8 +71,8 @@ static void wilc_wlan_txq_add_to_tail(struct net_device *dev, complete(>txq_event); } -static int wilc_wlan_txq_add_to_head(struct wilc_vif *vif, -struct txq_entry_t *tqe) +static void wilc_wlan_txq_add_to_head(struct wilc_vif *vif, + struct txq_entry_t *tqe) { unsigned long flags; struct wilc *wilc = vif->wilc; @@ -87,8 +87,6 @@ static int wilc_wlan_txq_add_to_head(struct wilc_vif *vif, spin_unlock_irqrestore(>txq_spinlock, flags); mutex_unlock(>txq_add_to_head_cs); complete(>txq_event); - - return 0; } #define NOT_TCP_ACK(-1) @@ -275,10 +273,7 @@ static int wilc_wlan_txq_add_cfg_pkt(struct wilc_vif *vif, u8 *buffer, tqe->priv = NULL; tqe->ack_idx = NOT_TCP_ACK; - if (wilc_wlan_txq_add_to_head(vif, tqe)) { - kfree(tqe); - return 0; - } + wilc_wlan_txq_add_to_head(vif, tqe); return 1; } -- 2.7.4
[PATCH 08/29] staging: wilc1000: change return type to 'void' tcp ack filter functions
Use 'void' return type for below functions as they always return '0' and their return value is not used by caller. add_tcp_pending_ack() update_tcp_session() add_tcp_pending_ack() Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/wilc_wlan.c | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 8057db9..66ce29d 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -91,8 +91,8 @@ static void wilc_wlan_txq_add_to_head(struct wilc_vif *vif, #define NOT_TCP_ACK(-1) -static inline int add_tcp_session(struct wilc_vif *vif, u32 src_prt, - u32 dst_prt, u32 seq) +static inline void add_tcp_session(struct wilc_vif *vif, u32 src_prt, + u32 dst_prt, u32 seq) { struct tcp_ack_filter *f = >ack_filter; @@ -103,22 +103,20 @@ static inline int add_tcp_session(struct wilc_vif *vif, u32 src_prt, f->ack_session_info[f->tcp_session].dst_port = dst_prt; f->tcp_session++; } - return 0; } -static inline int update_tcp_session(struct wilc_vif *vif, u32 index, u32 ack) +static inline void update_tcp_session(struct wilc_vif *vif, u32 index, u32 ack) { struct tcp_ack_filter *f = >ack_filter; if (index < 2 * MAX_TCP_SESSION && ack > f->ack_session_info[index].bigger_ack_num) f->ack_session_info[index].bigger_ack_num = ack; - return 0; } -static inline int add_tcp_pending_ack(struct wilc_vif *vif, u32 ack, - u32 session_index, - struct txq_entry_t *txqe) +static inline void add_tcp_pending_ack(struct wilc_vif *vif, u32 ack, + u32 session_index, + struct txq_entry_t *txqe) { struct tcp_ack_filter *f = >ack_filter; u32 i = f->pending_base + f->pending_acks_idx; @@ -130,7 +128,6 @@ static inline int add_tcp_pending_ack(struct wilc_vif *vif, u32 ack, txqe->ack_idx = i; f->pending_acks_idx++; } - return 0; } static inline void tcp_process(struct net_device *dev, struct txq_entry_t *tqe) -- 2.7.4
[PATCH 09/29] staging: wilc1000: use 'void' return for wilc_wlan_txq_filter_dup_tcp_ack()
Use 'void' return for wilc_wlan_txq_filter_dup_tcp_ack() as it always return value '1' and its not used by the caller. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/wilc_wlan.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 66ce29d..88808d9 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -182,7 +182,7 @@ static inline void tcp_process(struct net_device *dev, struct txq_entry_t *tqe) spin_unlock_irqrestore(>txq_spinlock, flags); } -static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) +static void wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) { struct wilc_vif *vif = netdev_priv(dev); struct wilc *wilc = vif->wilc; @@ -237,8 +237,6 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) msecs_to_jiffies(1)); dropped--; } - - return 1; } void wilc_enable_tcp_ack_filter(struct wilc_vif *vif, bool value) -- 2.7.4
[PATCH 12/29] staging: wilc1000: set default value of cfg response type in wilc_wlan_cfg_indicate_rx()
Handle the setting of default value for 'wilc_cfg_rsp' type for all cases in wilc_wlan_cfg_indicate_rx() as the caller make use of this value to know the type of the received message. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/wilc_wlan_cfg.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c index 2b5471b..2c463a3 100644 --- a/drivers/staging/wilc1000/wilc_wlan_cfg.c +++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c @@ -507,6 +507,7 @@ void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size, msg_id = frame[1]; /* seq no */ frame += 4; size -= 4; + rsp->type = 0; /* * The valid types of response messages are @@ -532,7 +533,6 @@ void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size, case 'N': wilc_network_info_received(wilc, frame - 4, size + 4); - rsp->type = 0; break; case 'S': @@ -540,7 +540,6 @@ void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size, break; default: - rsp->type = 0; rsp->seq_no = msg_id; break; } -- 2.7.4
[PATCH 15/29] staging: wilc1000: remove unused wid from cfg struct
Cleanup patch to remove the unused element stored in cfg struct. Removed those wid from the cfg variables whose value is not fetched(GET_CFG) from the code. In case the wid is only set to the firmware then there is need to store them as part of cfg variables, so removed the unused code. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/wilc_wlan_cfg.c | 107 --- 1 file changed, 107 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c index 2c463a3..541251b 100644 --- a/drivers/staging/wilc1000/wilc_wlan_cfg.c +++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c @@ -20,131 +20,36 @@ enum cfg_cmd_type { struct wilc_mac_cfg { int mac_status; u8 mac_address[7]; - u8 ip_address[5]; - u8 bssid[7]; - u8 ssid[34]; u8 firmware_version[129]; - u8 supp_rate[24]; - u8 wep_key[28]; - u8 i_psk[66]; - u8 hw_product_version[33]; - u8 phyversion[17]; - u8 supp_username[21]; - u8 supp_password[64]; - u8 assoc_req[256]; u8 assoc_rsp[256]; - u8 firmware_info[8]; - u8 scan_result[256]; - u8 scan_result1[256]; }; static struct wilc_mac_cfg g_mac; static struct wilc_cfg_byte g_cfg_byte[] = { - {WID_BSS_TYPE, 0}, - {WID_CURRENT_TX_RATE, 0}, - {WID_CURRENT_CHANNEL, 0}, - {WID_PREAMBLE, 0}, - {WID_11G_OPERATING_MODE, 0}, {WID_STATUS, 0}, - {WID_SCAN_TYPE, 0}, - {WID_KEY_ID, 0}, - {WID_QOS_ENABLE, 0}, - {WID_POWER_MANAGEMENT, 0}, - {WID_11I_MODE, 0}, - {WID_AUTH_TYPE, 0}, - {WID_SITE_SURVEY, 0}, - {WID_LISTEN_INTERVAL, 0}, - {WID_DTIM_PERIOD, 0}, - {WID_ACK_POLICY, 0}, - {WID_BCAST_SSID, 0}, - {WID_REKEY_POLICY, 0}, - {WID_SHORT_SLOT_ALLOWED, 0}, - {WID_START_SCAN_REQ, 0}, {WID_RSSI, 0}, {WID_LINKSPEED, 0}, - {WID_AUTO_RX_SENSITIVITY, 0}, - {WID_DATAFLOW_CONTROL, 0}, - {WID_SCAN_FILTER, 0}, - {WID_11N_PROT_MECH, 0}, - {WID_11N_ERP_PROT_TYPE, 0}, - {WID_11N_ENABLE, 0}, - {WID_11N_OPERATING_MODE, 0}, - {WID_11N_OBSS_NONHT_DETECTION, 0}, - {WID_11N_HT_PROT_TYPE, 0}, - {WID_11N_RIFS_PROT_ENABLE, 0}, - {WID_11N_SMPS_MODE, 0}, - {WID_11N_CURRENT_TX_MCS, 0}, - {WID_11N_SHORT_GI_ENABLE, 0}, - {WID_RIFS_MODE, 0}, - {WID_TX_ABORT_CONFIG, 0}, - {WID_11N_IMMEDIATE_BA_ENABLED, 0}, - {WID_11N_TXOP_PROT_DISABLE, 0}, {WID_NIL, 0} }; static struct wilc_cfg_hword g_cfg_hword[] = { - {WID_LINK_LOSS_THRESHOLD, 0}, - {WID_RTS_THRESHOLD, 0}, - {WID_FRAG_THRESHOLD, 0}, - {WID_SHORT_RETRY_LIMIT, 0}, - {WID_LONG_RETRY_LIMIT, 0}, - {WID_BEACON_INTERVAL, 0}, - {WID_RX_SENSE, 0}, - {WID_ACTIVE_SCAN_TIME, 0}, - {WID_PASSIVE_SCAN_TIME, 0}, - {WID_SITE_SURVEY_SCAN_TIME, 0}, - {WID_JOIN_START_TIMEOUT, 0}, - {WID_AUTH_TIMEOUT, 0}, - {WID_ASOC_TIMEOUT, 0}, - {WID_11I_PROTOCOL_TIMEOUT, 0}, - {WID_EAPOL_RESPONSE_TIMEOUT, 0}, - {WID_11N_SIG_QUAL_VAL, 0}, - {WID_CCA_THRESHOLD, 0}, {WID_NIL, 0} }; static struct wilc_cfg_word g_cfg_word[] = { {WID_FAILED_COUNT, 0}, - {WID_RETRY_COUNT, 0}, - {WID_MULTIPLE_RETRY_COUNT, 0}, - {WID_FRAME_DUPLICATE_COUNT, 0}, - {WID_ACK_FAILURE_COUNT, 0}, {WID_RECEIVED_FRAGMENT_COUNT, 0}, - {WID_MCAST_RECEIVED_FRAME_COUNT, 0}, - {WID_FCS_ERROR_COUNT, 0}, {WID_SUCCESS_FRAME_COUNT, 0}, - {WID_TX_FRAGMENT_COUNT, 0}, - {WID_TX_MULTICAST_FRAME_COUNT, 0}, - {WID_RTS_SUCCESS_COUNT, 0}, - {WID_RTS_FAILURE_COUNT, 0}, - {WID_WEP_UNDECRYPTABLE_COUNT, 0}, - {WID_REKEY_PERIOD, 0}, - {WID_REKEY_PACKET_COUNT, 0}, - {WID_HW_RX_COUNT, 0}, {WID_GET_INACTIVE_TIME, 0}, {WID_NIL, 0} }; static struct wilc_cfg_str g_cfg_str[] = { - {WID_SSID, g_mac.ssid}, /* 33 + 1 bytes */ {WID_FIRMWARE_VERSION, g_mac.firmware_version}, - {WID_OPERATIONAL_RATE_SET, g_mac.supp_rate}, - {WID_BSSID, g_mac.bssid}, /* 6 bytes */ - {WID_WEP_KEY_VALUE, g_mac.wep_key}, /* 27 bytes */ - {WID_11I_PSK, g_mac.i_psk}, /* 65 bytes */ - {WID_HARDWARE_VERSION, g_mac.hw_product_version}, {WID_MAC_ADDR, g_mac.mac_address}, - {WID_PHY_VERSION, g_mac.phyversion}, - {WID_SUPP_USERNAME, g_mac.supp_username}, - {WID_SUPP_PASSWORD, g_mac.supp_password}, - {WID_SITE_SURVEY_RESULTS, g_mac.scan_result}, - {WID_SITE_SURVEY_RESULTS, g_mac.scan_result1}, - {WID_ASSOC_REQ_INFO, g_mac.assoc_req}, {WID_ASSOC_RES_INFO, g_mac.assoc_rsp}, - {WID_FIRMWARE_INFO, g_mac.firmware_version}, - {WID_IP_ADDRESS, g_mac.ip_address}, {WID_NIL, NULL} }; @@ -327,12 +232,6 @@ static void
[PATCH 14/29] staging: wilc1000: remove unused wid type values
Cleanup patch to remove the wid type not used in the code. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/wilc_wlan_if.h | 4 1 file changed, 4 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h index b81a73b..ce2066b 100644 --- a/drivers/staging/wilc1000/wilc_wlan_if.h +++ b/drivers/staging/wilc1000/wilc_wlan_if.h @@ -204,10 +204,6 @@ enum wid_type { WID_STR = 3, WID_BIN_DATA= 4, WID_BIN = 5, - WID_IP = 6, - WID_ADR = 7, - WID_UNDEF = 8, - WID_TYPE_FORCE_32BIT= 0x }; struct wid { -- 2.7.4
[PATCH 13/29] staging: wilc1000: changes 'val' type to u8 in wilc_cfg_byte struct
Use the correct datatype for storing the byte value in 'wilc_cfg_byte' struct. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/wilc_wlan_cfg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.h b/drivers/staging/wilc1000/wilc_wlan_cfg.h index 189e617..082093f 100644 --- a/drivers/staging/wilc1000/wilc_wlan_cfg.h +++ b/drivers/staging/wilc1000/wilc_wlan_cfg.h @@ -9,7 +9,7 @@ struct wilc_cfg_byte { u16 id; - u16 val; + u8 val; }; struct wilc_cfg_hword { -- 2.7.4
[PATCH 4/5] ath9k: FFT magnitude check: don't consider lower 3 data bits
There were a lot of Magnitude Mismatch while getting FFT samples on my hardware (Atheros AR9462. I've compared the reported magnitude with the data in the FFT bin, and the FFT bin was less accurate: [ 5395.193030] ath: phy0: FFT HT20 frame: max mag 0x89,max_mag_idx 28, ,magnitude 0x89 max_exp 0, data[28] = 0x88 [ 5395.194525] ath: phy0: FFT HT20 frame: max mag 0x89,max_mag_idx 28, ,magnitude 0x89 max_exp 0, data[28] = 0x88 [ 5395.196012] ath: phy0: FFT HT20 frame: max mag 0x88,max_mag_idx 28, ,magnitude 0x88 max_exp 0, data[28] = 0x88 [ 5395.197509] ath: phy0: FFT HT20 frame: max mag 0x6C,max_mag_idx 28, ,magnitude 0x6C max_exp 0, data[28] = 0x68 [ 5395.199015] ath: phy0: FFT HT20 frame: max mag 0x78,max_mag_idx 28, ,magnitude 0x78 max_exp 0, data[28] = 0x78 [ 5395.200497] ath: phy0: FFT HT20 frame: max mag 0xA1,max_mag_idx 28, ,magnitude 0xA1 max_exp 0, data[28] = 0xA0 [ 5395.202011] ath: phy0: FFT HT20 frame: max mag 0x91,max_mag_idx 28, ,magnitude 0x91 max_exp 0, data[28] = 0x90 [ 5395.203482] ath: phy0: FFT HT20 frame: max mag 0x89,max_mag_idx 28, ,magnitude 0x89 max_exp 0, data[28] = 0x88 [ 5395.204999] ath: phy0: FFT HT20 frame: max mag 0x27,max_mag_idx 4, ,magnitude 0x27 max_exp 0, data[4] = 0x20 [ 5395.206461] ath: phy0: FFT HT20 frame: max mag 0x41,max_mag_idx 28, ,magnitude 0x41 max_exp 0, data[28] = 0x40 [ 5395.207977] ath: phy0: FFT HT20 frame: max mag 0x51,max_mag_idx 28, ,magnitude 0x51 max_exp 0, data[28] = 0x50 [ 5395.209454] ath: phy0: FFT HT20 frame: max mag 0x53,max_mag_idx 28, ,magnitude 0x53 max_exp 0, data[28] = 0x50 [ 5395.210940] ath: phy0: FFT HT20 frame: max mag 0x40,max_mag_idx 28, ,magnitude 0x40 max_exp 0, data[28] = 0x40 [ 5395.212441] ath: phy0: FFT HT20 frame: max mag 0x59,max_mag_idx 28, ,magnitude 0x59 max_exp 0, data[28] = 0x58 [ 5395.213932] ath: phy0: FFT HT20 frame: max mag 0x53,max_mag_idx 28, ,magnitude 0x53 max_exp 0, data[28] = 0x50 [ 5395.215428] ath: phy0: FFT HT20 frame: max mag 0x7D,max_mag_idx 28, ,magnitude 0x7D max_exp 0, data[28] = 0x78 [ 5395.216910] ath: phy0: FFT HT20 frame: max mag 0x8C,max_mag_idx 28, ,magnitude 0x8C max_exp 0, data[28] = 0x88 [ 5395.218413] ath: phy0: FFT HT20 frame: max mag 0x7B,max_mag_idx 28, ,magnitude 0x7B max_exp 0, data[28] = 0x78 [ 5395.219900] ath: phy0: FFT HT20 frame: max mag 0x43,max_mag_idx 28, ,magnitude 0x43 max_exp 0, data[28] = 0x40 It seems like the lower 3 bits on my hardware are always zeroed, but the magnitude matches otherwise. Therefore, let's not make the magnitude check so strict so we can get those samples released to userspace. Cc: Nick Kossifidis Signed-off-by: Simon Wunderlich --- drivers/net/wireless/ath/ath9k/common-spectral.c | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/common-spectral.c b/drivers/net/wireless/ath/ath9k/common-spectral.c index d10e3f29c356..70ddaf6199a0 100644 --- a/drivers/net/wireless/ath/ath9k/common-spectral.c +++ b/drivers/net/wireless/ath/ath9k/common-spectral.c @@ -71,7 +71,7 @@ ath_cmn_max_idx_verify_ht20_fft(u8 *sample_end, int bytes_read) if (bytes_read < SPECTRAL_HT20_SAMPLE_LEN && max_index < 1) return -1; - if (sample[max_index] != (max_magnitude >> max_exp)) + if ((sample[max_index] & 0xf8) != ((max_magnitude >> max_exp) & 0xf8)) return -1; else return 0; @@ -114,8 +114,10 @@ ath_cmn_max_idx_verify_ht20_40_fft(u8 *sample_end, int bytes_read) ((upper_max_index < 1) || (lower_max_index < 1))) return -1; - if ((sample[upper_max_index + dc_pos] != (upper_mag >> max_exp)) || - (sample[lower_max_index] != (lower_mag >> max_exp))) + if (((sample[upper_max_index + dc_pos] & 0xf8) != +((upper_mag >> max_exp) & 0xf8)) || + ((sample[lower_max_index] & 0xf8) != +((lower_mag >> max_exp) & 0xf8))) return -1; else return 0; @@ -173,7 +175,8 @@ ath_cmn_process_ht20_fft(struct ath_rx_status *rs, magnitude >> max_exp, max_index); - if (fft_sample_20.data[max_index] != (magnitude >> max_exp)) { + if ((fft_sample_20.data[max_index] & 0xf8) != + ((magnitude >> max_exp) & 0xf8)) { ath_dbg(common, SPECTRAL_SCAN, "Magnitude mismatch !\n"); ret = -1; } @@ -317,10 +320,10 @@ ath_cmn_process_ht20_40_fft(struct ath_rx_status *rs, /* Check if we got the expected magnitude values at * the expected bins */ - if ((fft_sample_40.data[upper_max_index + dc_pos] - != (upper_mag >> max_exp)) || - (fft_sample_40.data[lower_max_index] - != (lower_mag >> max_exp))) { + if (((fft_sample_40.data[upper_max_index + dc_pos] & 0xf8) + != ((upper_mag >> max_exp) & 0xf8)) || +
[PATCH 5/5] ath9k: fix reporting calculated new FFT upper max
Cc: Nick Kossifidis Signed-off-by: Simon Wunderlich --- drivers/net/wireless/ath/ath9k/common-spectral.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath9k/common-spectral.c b/drivers/net/wireless/ath/ath9k/common-spectral.c index 70ddaf6199a0..6a43d26276e5 100644 --- a/drivers/net/wireless/ath/ath9k/common-spectral.c +++ b/drivers/net/wireless/ath/ath9k/common-spectral.c @@ -381,7 +381,7 @@ ath_cmn_process_ht20_40_fft(struct ath_rx_status *rs, ath_dbg(common, SPECTRAL_SCAN, "Calculated new upper max 0x%X at %i\n", - tmp_mag, i); + tmp_mag, fft_sample_40.upper_max_index); } else for (i = dc_pos; i < SPECTRAL_HT20_40_NUM_BINS; i++) { if (fft_sample_40.data[i] == (upper_mag >> max_exp)) -- 2.11.0
[PATCH 1/5] ath9k: add counters for good and errorneous FFT/spectral frames
This is helpful to see whether spectral samples get discarded. Signed-off-by: Simon Wunderlich --- drivers/net/wireless/ath/ath9k/common-debug.c| 2 ++ drivers/net/wireless/ath/ath9k/common-debug.h| 4 drivers/net/wireless/ath/ath9k/common-spectral.c | 15 +-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/common-debug.c b/drivers/net/wireless/ath/ath9k/common-debug.c index 239429f10378..53ca4b063eb9 100644 --- a/drivers/net/wireless/ath/ath9k/common-debug.c +++ b/drivers/net/wireless/ath/ath9k/common-debug.c @@ -144,6 +144,8 @@ static ssize_t read_file_recv(struct file *file, char __user *user_buf, RXS_ERR("BEACONS", rx_beacons); RXS_ERR("FRAGS", rx_frags); RXS_ERR("SPECTRAL", rx_spectral); + RXS_ERR("SPECTRAL SMPL GOOD", rx_spectral_sample_good); + RXS_ERR("SPECTRAL SMPL ERR", rx_spectral_sample_err); RXS_ERR("CRC ERR", crc_err); RXS_ERR("DECRYPT CRC ERR", decrypt_crc_err); diff --git a/drivers/net/wireless/ath/ath9k/common-debug.h b/drivers/net/wireless/ath/ath9k/common-debug.h index 3376990d3a24..2938b5b96b07 100644 --- a/drivers/net/wireless/ath/ath9k/common-debug.h +++ b/drivers/net/wireless/ath/ath9k/common-debug.h @@ -39,6 +39,8 @@ * @rx_beacons: No. of beacons received. * @rx_frags: No. of rx-fragements received. * @rx_spectral: No of spectral packets received. + * @rx_spectral_sample_good: No. of good spectral samples + * @rx_spectral_sample_err: No. of good spectral samples */ struct ath_rx_stats { u32 rx_pkts_all; @@ -58,6 +60,8 @@ struct ath_rx_stats { u32 rx_beacons; u32 rx_frags; u32 rx_spectral; + u32 rx_spectral_sample_good; + u32 rx_spectral_sample_err; }; #ifdef CONFIG_ATH9K_COMMON_DEBUG diff --git a/drivers/net/wireless/ath/ath9k/common-spectral.c b/drivers/net/wireless/ath/ath9k/common-spectral.c index 440e16e641e4..0c5559009a28 100644 --- a/drivers/net/wireless/ath/ath9k/common-spectral.c +++ b/drivers/net/wireless/ath/ath9k/common-spectral.c @@ -501,6 +501,7 @@ int ath_cmn_process_fft(struct ath_spec_scan_priv *spec_priv, struct ieee80211_h u8 sample_buf[SPECTRAL_SAMPLE_MAX_LEN] = {0}; struct ath_hw *ah = spec_priv->ah; struct ath_common *common = ath9k_hw_common(spec_priv->ah); + struct ath_softc *sc = (struct ath_softc *)common->priv; u8 num_bins, *vdata = (u8 *)hdr; struct ath_radar_info *radar_info; int len = rs->rs_datalen; @@ -649,8 +650,13 @@ int ath_cmn_process_fft(struct ath_spec_scan_priv *spec_priv, struct ieee80211_h sample_buf, sample_len, sample_bytes); - fft_handler(rs, spec_priv, sample_buf, - tsf, freq, chan_type); + ret = fft_handler(rs, spec_priv, sample_buf, + tsf, freq, chan_type); + + if (ret == 0) + RX_STAT_INC(rx_spectral_sample_good); + else + RX_STAT_INC(rx_spectral_sample_err); memset(sample_buf, 0, SPECTRAL_SAMPLE_MAX_LEN); @@ -665,6 +671,11 @@ int ath_cmn_process_fft(struct ath_spec_scan_priv *spec_priv, struct ieee80211_h ret = fft_handler(rs, spec_priv, sample_start, tsf, freq, chan_type); + if (ret == 0) + RX_STAT_INC(rx_spectral_sample_good); + else + RX_STAT_INC(rx_spectral_sample_err); + /* Mix the received bins to the /dev/random * pool */ -- 2.11.0
[PATCH 3/5] ath9k: fix and simplify FFT max index retrieval
FFT max index retrieval was not retrieved correctly for HT20/HT40 FFT frames. Fixing the retrieval allows us to remove the fixup function as well. While at it, split the spectral_max_index function into versions for ht20 and ht40 to simplify the code. Cc: Nick Kossifidis Signed-off-by: Simon Wunderlich --- drivers/net/wireless/ath/ath9k/common-spectral.c | 45 drivers/net/wireless/ath/ath9k/common-spectral.h | 17 + 2 files changed, 23 insertions(+), 39 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/common-spectral.c b/drivers/net/wireless/ath/ath9k/common-spectral.c index f6dd0ecfbbf3..d10e3f29c356 100644 --- a/drivers/net/wireless/ath/ath9k/common-spectral.c +++ b/drivers/net/wireless/ath/ath9k/common-spectral.c @@ -59,8 +59,7 @@ ath_cmn_max_idx_verify_ht20_fft(u8 *sample_end, int bytes_read) sample = sample_end - SPECTRAL_HT20_SAMPLE_LEN + 1; - max_index = spectral_max_index(mag_info->all_bins, - SPECTRAL_HT20_NUM_BINS); + max_index = spectral_max_index_ht20(mag_info->all_bins); max_magnitude = spectral_max_magnitude(mag_info->all_bins); max_exp = mag_info->max_exp & 0xf; @@ -100,12 +99,10 @@ ath_cmn_max_idx_verify_ht20_40_fft(u8 *sample_end, int bytes_read) sample = sample_end - SPECTRAL_HT20_40_SAMPLE_LEN + 1; lower_mag = spectral_max_magnitude(mag_info->lower_bins); - lower_max_index = spectral_max_index(mag_info->lower_bins, -SPECTRAL_HT20_40_NUM_BINS); + lower_max_index = spectral_max_index_ht40(mag_info->lower_bins); upper_mag = spectral_max_magnitude(mag_info->upper_bins); - upper_max_index = spectral_max_index(mag_info->upper_bins, -SPECTRAL_HT20_40_NUM_BINS); + upper_max_index = spectral_max_index_ht40(mag_info->upper_bins); max_exp = mag_info->max_exp & 0xf; @@ -117,17 +114,6 @@ ath_cmn_max_idx_verify_ht20_40_fft(u8 *sample_end, int bytes_read) ((upper_max_index < 1) || (lower_max_index < 1))) return -1; - /* Some time hardware messes up the index and adds -* the index of the middle point (dc_pos). Try to fix it. -*/ - if ((upper_max_index - dc_pos > 0) && - (sample[upper_max_index] == (upper_mag >> max_exp))) - upper_max_index -= dc_pos; - - if ((lower_max_index - dc_pos > 0) && - (sample[lower_max_index - dc_pos] == (lower_mag >> max_exp))) - lower_max_index -= dc_pos; - if ((sample[upper_max_index + dc_pos] != (upper_mag >> max_exp)) || (sample[lower_max_index] != (lower_mag >> max_exp))) return -1; @@ -169,8 +155,7 @@ ath_cmn_process_ht20_fft(struct ath_rx_status *rs, magnitude = spectral_max_magnitude(mag_info->all_bins); fft_sample_20.max_magnitude = __cpu_to_be16(magnitude); - max_index = spectral_max_index(mag_info->all_bins, - SPECTRAL_HT20_NUM_BINS); + max_index = spectral_max_index_ht20(mag_info->all_bins); fft_sample_20.max_index = max_index; bitmap_w = spectral_bitmap_weight(mag_info->all_bins); @@ -302,12 +287,10 @@ ath_cmn_process_ht20_40_fft(struct ath_rx_status *rs, upper_mag = spectral_max_magnitude(mag_info->upper_bins); fft_sample_40.upper_max_magnitude = __cpu_to_be16(upper_mag); - lower_max_index = spectral_max_index(mag_info->lower_bins, - SPECTRAL_HT20_40_NUM_BINS); + lower_max_index = spectral_max_index_ht40(mag_info->lower_bins); fft_sample_40.lower_max_index = lower_max_index; - upper_max_index = spectral_max_index(mag_info->upper_bins, - SPECTRAL_HT20_40_NUM_BINS); + upper_max_index = spectral_max_index_ht40(mag_info->upper_bins); fft_sample_40.upper_max_index = upper_max_index; lower_bitmap_w = spectral_bitmap_weight(mag_info->lower_bins); @@ -331,22 +314,6 @@ ath_cmn_process_ht20_40_fft(struct ath_rx_status *rs, upper_mag >> max_exp, upper_max_index); - /* Some time hardware messes up the index and adds -* the index of the middle point (dc_pos). Try to fix it. -*/ - if ((upper_max_index - dc_pos > 0) && - (fft_sample_40.data[upper_max_index] == (upper_mag >> max_exp))) { - upper_max_index -= dc_pos; - fft_sample_40.upper_max_index = upper_max_index; - } - - if ((lower_max_index - dc_pos > 0) && - (fft_sample_40.data[lower_max_index - dc_pos] == - (lower_mag >> max_exp))) { - lower_max_index -= dc_pos; - fft_sample_40.lower_max_index = lower_max_index; - } - /* Check if we got the expected magnitude
[PATCH 0/5] ath9k: FFT fixes and improvements
During FFT evaluation on an AR9462 adapter, we noticed that there were way less FFT samples received than we would expect. This patchset adds some counters to be able to check for received (and discarded) FFT samples, and fixes a variety of issues I found while debugging. Cheers, Simon Simon Wunderlich (5): ath9k: add counters for good and errorneous FFT/spectral frames ath9k: return when short FFT frame was handled ath9k: fix and simplify FFT max index retrieval ath9k: FFT magnitude check: don't consider lower 3 data bits ath9k: fix reporting calculated new FFT upper max drivers/net/wireless/ath/ath9k/common-debug.c| 2 + drivers/net/wireless/ath/ath9k/common-debug.h| 4 ++ drivers/net/wireless/ath/ath9k/common-spectral.c | 83 +--- drivers/net/wireless/ath/ath9k/common-spectral.h | 17 + 4 files changed, 55 insertions(+), 51 deletions(-) -- 2.11.0
[PATCH 2/5] ath9k: return when short FFT frame was handled
With the loop break like this, there are false "FFT report truncated" messages because the iterator is not advanced as the check expects. Instead, just return, for a single frame there is nothing left to be done anyways. Cc: Nick Kossifidis Signed-off-by: Simon Wunderlich --- drivers/net/wireless/ath/ath9k/common-spectral.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath9k/common-spectral.c b/drivers/net/wireless/ath/ath9k/common-spectral.c index 0c5559009a28..f6dd0ecfbbf3 100644 --- a/drivers/net/wireless/ath/ath9k/common-spectral.c +++ b/drivers/net/wireless/ath/ath9k/common-spectral.c @@ -686,7 +686,7 @@ int ath_cmn_process_fft(struct ath_spec_scan_priv *spec_priv, struct ieee80211_h * loop. */ if (len <= fft_len + 2) - break; + return 1; sample_start = [i + 1]; -- 2.11.0
pull request: mt76 2018-09-19
Hi Kalle, Here's a large batch of mt76 code cleanup / deduplication / fixes, rebased to your latest wireless-drivers-next. This replaces the previous pull request. - Felix The following changes since commit 43e2f2904160b9a95aad77df9cbc1622910b8598: Merge wireless-drivers into wireless-drivers-next (2018-09-17 17:41:02 +0300) are available in the Git repository at: https://github.com/nbd168/wireless tags/mt76-for-kvalo-2018-09-19 for you to fetch changes up to bf3741ada33bb4fabec99538b8014c054854912b: mt76x0: usb: remove mt76_fw definition (2018-09-19 12:31:49 +0200) mt76 patches for 4.20 * lots of mt76x0 cleanups / fixes * mt76x2u fixes * unify code between mt76x0, mt76x2e and mt76x2u * rename mt76x0 to mt76x0u * improve rx buffer allocation for all variants * prepare for adding mt76x0e (pci-e variant) support add CONFIG_MT76x0E kconfig symbol Felix Fietkau (1): mt76: use a per rx queue page fragment cache Lorenzo Bianconi (58): mt76x2: change mt76x2_tx_complete routine signature mt76: move mt76x2_tx_complete routine in mt76x02-lib module mt76: move mt76x2u_remove_dma_hdr in mt76x02-lib module mt76: move mt76x2u_tx_complete_skb in mt76x02-lib moudule mt76: move mt76_qsel definition in dma.h mt76: move mt76x2u_set_txinfo in mt76x02-lib module mt76x0: introduce mt76x0_tx_prepare_skb routine mt76: move mt76x2u_tx_status_data in mt76x02-lib module mt76x0: disable usb rx bulk aggregation mt76x0: mark device as running in mt76x0_start mt76x0: simplify mt76_mac_process_rx signature mt76x0: add mt76x0_queue_rx_skb routine mt76x0: init mt76_driver_ops callbacks mt76x0: use mt76_alloc_device for device allocation mt76x0: unify tx/rx datapath with mt76x2u driver mt76x0: stop stat workqueue at hw stop mt76x0: set max fragments size mt76x0: remove unused dma.c source file mt76x0: remove unused stat work_queue mt76x0: remove unused {tx/rx}_queue definitions mt76x0: remove unused mt76x0_tx_status routine mt76x0: remove unused endpoint definitions mt76x0: remove unused stat_work mt76x0: enable per-sta tx queueing mt76x0: init hw capabilities mt76: remove unused MT76_MORE_STATS state mt76x0: remove mt76x0_stop_hardware routine mt76: move mt76 rate definitions in mt76x02-lib module mt76x0: alloc mcu buffers first in mt76x0_mcu_cmd_init mt76x0: fix memory leak during hw probe mt76x0: move stop related routines in mt76x0_mac_stop mt76x0: move mt76x0_init_hardware in mt76x0_register_device mt76x0: do not free/alloc buffers during suspend/resume mt76x0: remove has_{2,5}ghz fields of mt76x0_eeprom_params mt76x0: use mt76_register_device for device registration mt76x0: run vco calibration for each channel configuration mt76: move mt76x0 and mt76x2 mcu shared defs in mt76x02_mcu.h mt76: add mt76_mcu_ops data structure for mcu related pointers mt76: usb: use common helpers for mcu_alloc_msg()/mcu_send_msg() mt76: usb: move mt76x02 mcu code in mt76x02-usb module mt76: usb: move mt76u_skb_dma_info in mt76x02_usb_core.c mt76x02: move TXD/RXD/MCU definitions in mt76x02_dma.h mt76x02: add static qualifier to mt76x02_remove_dma_hdr mt76: usb: remove skb check in mt76x{0,2}u mcu routines mt76x2: use mt76_dev instead of mt76x2_dev in mt76x2_tx_queue_mcu mt76x2: remove leftover mt76u_buf data structure in mt76x2_mcu mt76: introduce mmio data structure in mt76_dev mt76: move __iomem regs in mt76_mmio mt76x2: use mt76_dev instead of mt76x2_dev in mt76x2_mcu_msg_send mt76x2: use common helpers for mcu_alloc_msg()/mcu_send_msg() mt76: unify firmware header between mt76x0 and mt76x2 mt76: move mt76{0,2} mcu shared code in mt76x02_mcu.c mt76x2: move mt76x2 mcu shared code in mt76x2_mcu_common.c mt76: move shared mcu_calibrate routine in mt76x02-lib module mt76x2: move mt76x2_phy_tssi_compensate in mt76x2-common module mt76x0: remove mcu source file mt76x0: remove unused usb header file mt76x0: usb: remove mt76_fw definition Stanislaw Gruszka (30): mt76: move wcid fields to common mt76_dev struct mt76: unify sta_add / sta_remove mt76: pratially unify add_interface mt76: unify ampdu_action mt76: unify set_key mt76x0: remove empty sta_notify mt76: unify AC to hw queue mapping mt76: unify conf_tx mt76x0: remove vif_mask mt76: unify remove_interface mt76: unify add_interface mt76: unify sta_rate_tbl_update and related helpers mt76: unify txwi and rxwi structures mt76: unify load_tx_status mt76: unify send_tx_status and related helpers mt76: use mt76_rx_status
Re: [PATCH 29/29] staging: wilc1000: return exact error of register_netdev() from wilc_netdev_init()
Hi Dan, Thanks your reviewing the patch. On Wed, 19 Sep 2018 12:41:32 +0300 Dan Carpenter wrote: > I was waiting for you to send this like a spider waits for flies. You > fell directly into my trap. Mwuahahahahaha. Oops!!! I missed seeing it coming :) > > drivers/staging/wilc1000/linux_wlan.c > 1056 int wilc_netdev_init(struct wilc **wilc, struct device *dev, > int io_type, 1057 const struct wilc_hif_func > *ops) 1058 { > 1059 int i, ret = -ENOMEM; > 1060 struct wilc_vif *vif; > 1061 struct net_device *ndev; > 1062 struct wilc *wl; > 1063 > 1064 wl = kzalloc(sizeof(*wl), GFP_KERNEL); > 1065 if (!wl) > 1066 return ret; >^^^ > It's cleaner to return -ENOMEM so that we don't have to glance up to > the declaration block. This is especially true when "ret" is zero, > btw, because that can indicate a reversed test. I will change it to directly return -ENOMEM value. > > if (!ret) > return ret; > > In this theoretically example it was supposed to be: > > if (ret) > return ret; > > Normally, reversed conditions are caught in testing, but for the > kernel, no one has the hardware to test everything so we do get > reversed conditions from time to time. > > 1067 > 1068 if (wilc_wlan_cfg_init(wl)) I will set 'ret' value to -ENOMEM here also. > 1069 goto free_wl; > 1070 > 1071 *wilc = wl; > 1072 wl->io_type = io_type; > 1073 wl->hif_func = ops; > 1074 wl->enable_ps = true; > 1075 wl->chip_ps_state = CHIP_WAKEDUP; > 1076 INIT_LIST_HEAD(>txq_head.list); > 1077 INIT_LIST_HEAD(>rxq_head.list); > 1078 > 1079 wl->hif_workqueue = > create_singlethread_workqueue("WILC_wq"); 1080 if > (!wl->hif_workqueue) 1081 goto free_cfg; > 1082 > 1083 register_inetaddr_notifier(_dev_notifier); > 1084 > 1085 for (i = 0; i < NUM_CONCURRENT_IFC; i++) { > 1086 struct wireless_dev *wdev; > 1087 > 1088 ndev = alloc_etherdev(sizeof(struct > wilc_vif)); 1089 if (!ndev) > 1090 goto free_ndev; > ^^^ > ret is zero on the second iteration through the loop. I will set 'ret' to -ENOMEM before 'goto', which should handle this scenario. > > 1091 > 1092 vif = netdev_priv(ndev); > 1093 memset(vif, 0, sizeof(struct wilc_vif)); > 1094 > 1095 if (i == 0) { > 1096 strcpy(ndev->name, "wlan%d"); > 1097 vif->ifc_id = 1; > 1098 } else { > 1099 strcpy(ndev->name, "p2p%d"); > 1100 vif->ifc_id = 0; > 1101 } > 1102 vif->wilc = *wilc; > 1103 vif->ndev = ndev; > 1104 wl->vif[i] = vif; > 1105 wl->vif_num = i; > 1106 vif->idx = wl->vif_num; > 1107 > 1108 ndev->netdev_ops = _netdev_ops; > 1109 > 1110 wdev = wilc_create_wiphy(ndev, dev); > if (!wdev) { > 1112 netdev_err(ndev, "Can't register WILC > Wiphy\n"); 1113 goto free_ndev; > ^^^ > Here too. Same here, i.e setting ret = -ENOMEM should handle the condition. Also I will remove the default setting of 'ret' value to -ENOMEM because after modification the error scenarios will set 'ret' explicitly. Regards, Ajay
Re: [PATCH 1/5] rt2x00: set registers based on current band
On Tue, Sep 18, 2018 at 04:14:33PM +0200, Tomislav Požega wrote: > On Tue, 18 Sep 2018 14:20:16 +0200, Stanislaw Gruszka wrote: > > >On Mon, Sep 17, 2018 at 06:32:51PM +0200, Tomislav Požega wrote: > >> Use curr_band instead of rf->channel among various subroutines - > >> mostly for 2.4GHz band but in some circumstances for 5GHz band too. > > > >What is the reason for that change ? > > Operating band should be fetched from device capabilities, not from userspace > variables. More changes will needed to be made to accomplish that. Driver should provide on what channels are supported to mac80211, but user space decide what channel to use and that imply band 2.4GHz or 5GHz. ->curr_band is just shortcut for band of current channel. Is set in rt2x00lib_config() after we call rt2x00dev->ops->lib->config() [rt2800_config() for rt2800] . So patch is wrong. Either ->curr_band should be set before ->config call or we need to consistently use rf->channel <= 14 for band check in any rt2800_config() function and all it's subroutines. I prefer the second solution (i.e. rf->channel) and now I can see few places when we use ->curr_band, what is a bug. > >> - if (spec->num_channels > 14) { > >> + if (rt2x00dev->curr_band == NL80211_BAND_5GHZ) { > >>default_power1 = rt2800_eeprom_addr(rt2x00dev, > >>EEPROM_TXPOWER_A1); > >>default_power2 = rt2800_eeprom_addr(rt2x00dev, > > > >Above looks wrong. > > > >Thanks > >Stanislaw > > Worked fine when I tried run two USB cards (RT3070-RF0005, RT5390-RF5370). > Why do you think it's wrong? Is there a dual-band card that operates on > both bands at the same time? It's because ->curr_band initialize to 0 and NL80211_BAND_2GHZ happen to be 0. Also problem will not trigger on single band 2.4GHz devices. Regards Stanislaw
Re: mt76x0 bug report
On Tue, Sep 18, 2018 at 01:36:51PM -0400, Sid Hayn wrote: > On Tue, Sep 18, 2018 at 7:56 AM Stanislaw Gruszka wrote: > > > > On Mon, Sep 17, 2018 at 11:18:57PM -0400, Sid Hayn wrote: > > > Sorry to bump the one thing that we both agreed was low priority but > > > > > > So was testing all of my dongles that use the driver you are working > > > on, and running them through my connect scripts. I moved the AP to > > > maybe <5ft from the clients and something wierd happened. The t1u > > > tried to connect to one of the 2.4GHz only networks. It failed, but > > > it actually got enough scan data back to attempt authentication with a > > > valid 2.4GHz only bssid. Which means in short, that the eeprom isn't > > > lying and your parsing of it is correct. Something obviously makes > > > this a 5GHz only device, as the connection failed and most of the time > > > nothing at all is seen on 2.4GHz, but clearly it's some filter or > > > antenna or some other mechanism which makes it 5GHz only. So probably > > > hardware lying to you is now even lower on your list since this safely > > > rules out the driver parsing the eeprom incorrectly. > > > > First of all would be good to check if problem is not already solved, > > latest version of the driver can be found here: > > https://github.com/nbd168/wireless > > Booting that kernel gets me instant to near instant kernel panics, so > I am unable to test much. This has to be fixed as well, can you provide kernel messages ? > > Second, is there vendor driver available for this particular device? > > Perhaps there are some tweeks needed that are not provided by generic > > driver. > > No clue, haven't even tried to look. This hardware was all sitting on > a shelf till it looked like a real driver was being merged into the > kernel so um, thanks :-) Why do you think device is 5GHz only? This is very unusual. I know only single-band 2.4GHz or dual-band 2.4GHz & 5GHz devices. Regards Stanislaw
Re: [PATCH] mt76x0: run vco calibration for each channel configuration
On Tue, Sep 18, 2018 at 10:26:09AM -0400, Sid Hayn wrote: > mt76x0 isn't in 4.18 at all, it's being added in 4.19 isn't it? I'm > not sure you can call it a regression, but adding a new driver with a > known bug that breaks an entire use case (monitor mode) seems silly > when a small and tested fix is available. Pretty please. Patch conflict with pending mt76 -next patches. Apply it and rebase all other patches on top of it, is a lot of work. I agree with Kalle that it will be better to apply this patch on top of -next and CC stable. Problem should be fixed in 4.19.1 or 4.19.2 . Regards Stanislaw