summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/wcn36xx
Commit message (Collapse)AuthorAgeFilesLines
* ath: fix SPDX tagsKalle Valo2019-06-262-2/+2
| | | | | | | | | | | | | | | | | | | Commit ec8f24b7faaf ("treewide: Add SPDX license identifier - Makefile/Kconfig") marked various Makefiles and Kconfig files within ath directories as GPL-2.0. But these modules and drivers are actually ISC: * ath * ar5523 * ath10k * ath5k * ath6kl * ath9k * wcn36xx * wil6210 Fix SPDX tags accordingly. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* treewide: Add SPDX license identifier - Makefile/KconfigThomas Gleixner2019-05-211-0/+1
| | | | | | | | | | | | | | Add SPDX license identifiers to all Make/Kconfig files which: - Have no license information of any form These files fall under the project license, GPL v2 only. The resulting SPDX license identifier is: GPL-2.0-only Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* netlink: make validation more configurable for future strictnessJohannes Berg2019-04-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently have two levels of strict validation: 1) liberal (default) - undefined (type >= max) & NLA_UNSPEC attributes accepted - attribute length >= expected accepted - garbage at end of message accepted 2) strict (opt-in) - NLA_UNSPEC attributes accepted - attribute length >= expected accepted Split out parsing strictness into four different options: * TRAILING - check that there's no trailing data after parsing attributes (in message or nested) * MAXTYPE - reject attrs > max known type * UNSPEC - reject attributes with NLA_UNSPEC policy entries * STRICT_ATTRS - strictly validate attribute size The default for future things should be *everything*. The current *_strict() is a combination of TRAILING and MAXTYPE, and is renamed to _deprecated_strict(). The current regular parsing has none of this, and is renamed to *_parse_deprecated(). Additionally it allows us to selectively set one of the new flags even on old policies. Notably, the UNSPEC flag could be useful in this case, since it can be arranged (by filling in the policy) to not be an incompatible userspace ABI change, but would then going forward prevent forgetting attribute entries. Similar can apply to the POLICY flag. We end up with the following renames: * nla_parse -> nla_parse_deprecated * nla_parse_strict -> nla_parse_deprecated_strict * nlmsg_parse -> nlmsg_parse_deprecated * nlmsg_parse_strict -> nlmsg_parse_deprecated_strict * nla_parse_nested -> nla_parse_nested_deprecated * nla_validate_nested -> nla_validate_nested_deprecated Using spatch, of course: @@ expression TB, MAX, HEAD, LEN, POL, EXT; @@ -nla_parse(TB, MAX, HEAD, LEN, POL, EXT) +nla_parse_deprecated(TB, MAX, HEAD, LEN, POL, EXT) @@ expression NLH, HDRLEN, TB, MAX, POL, EXT; @@ -nlmsg_parse(NLH, HDRLEN, TB, MAX, POL, EXT) +nlmsg_parse_deprecated(NLH, HDRLEN, TB, MAX, POL, EXT) @@ expression NLH, HDRLEN, TB, MAX, POL, EXT; @@ -nlmsg_parse_strict(NLH, HDRLEN, TB, MAX, POL, EXT) +nlmsg_parse_deprecated_strict(NLH, HDRLEN, TB, MAX, POL, EXT) @@ expression TB, MAX, NLA, POL, EXT; @@ -nla_parse_nested(TB, MAX, NLA, POL, EXT) +nla_parse_nested_deprecated(TB, MAX, NLA, POL, EXT) @@ expression START, MAX, POL, EXT; @@ -nla_validate_nested(START, MAX, POL, EXT) +nla_validate_nested_deprecated(START, MAX, POL, EXT) @@ expression NLH, HDRLEN, MAX, POL, EXT; @@ -nlmsg_validate(NLH, HDRLEN, MAX, POL, EXT) +nlmsg_validate_deprecated(NLH, HDRLEN, MAX, POL, EXT) For this patch, don't actually add the strict, non-renamed versions yet so that it breaks compile if I get it wrong. Also, while at it, make nla_validate and nla_parse go down to a common __nla_validate_parse() function to avoid code duplication. Ultimately, this allows us to have very strict validation for every new caller of nla_parse()/nlmsg_parse() etc as re-introduced in the next patch, while existing things will continue to work as is. In effect then, this adds fully strict validation for any new command. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* cross-tree: phase out dma_zalloc_coherent()Luis Chamberlain2019-01-081-9/+8Star
| | | | | | | | | | | | | | | | | | | We already need to zero out memory for dma_alloc_coherent(), as such using dma_zalloc_coherent() is superflous. Phase it out. This change was generated with the following Coccinelle SmPL patch: @ replace_dma_zalloc_coherent @ expression dev, size, data, handle, flags; @@ -dma_zalloc_coherent(dev, size, handle, flags) +dma_alloc_coherent(dev, size, handle, flags) Suggested-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org> [hch: re-ran the script on the latest tree] Signed-off-by: Christoph Hellwig <hch@lst.de>
* wcn36xx: use dma_zalloc_coherent instead of allocator/memsetYueHaibing2018-08-241-10/+9Star
| | | | | | | | Use dma_zalloc_coherent instead of dma_alloc_coherent followed by memset 0. Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: Use kmemdup instead of duplicating it in ↵YueHaibing2018-08-241-2/+2
| | | | | | | | | | wcn36xx_smd_process_ptt_msg_rsp Replace calls to kmalloc followed by a memcpy with a direct call to kmemdup. Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* Merge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.gitKalle Valo2018-07-253-56/+72
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | ath.git patches for 4.19. Major changes: wcn36xx * fix WEP in client mode wil6210 * add support for Talyn-MB (Talyn ver 2.0) device * add support for enhanced DMA firmware feature
| * wcn36xx: drop unnecessary initialization of variablesDaniel Mack2018-07-022-41/+38Star
| | | | | | | | | | | | | | | | | | | | | | Initialization is unneccessary when the variable is written before it is read. There were some occasions in which the driver would initialize `ret' during declaration without need. Purely a cosmetic change with no functional impact. Signed-off-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
| * wcn36xx: Fix WEP encryptionLoic Poulain2018-06-292-14/+25
| | | | | | | | | | | | | | | | | | | | | | In case of WEP encryption, driver has to configure shared key for associated station(s). Note that sta pointer is NULL in case of non pairwise key, causing NULL pointer dereference with existing code (sta_priv->is_data_encrypted). Fix this by using associated sta list instead. This enables WEP support as client, WEP AP is non-functional. Signed-off-by: Loic Poulain <loic.poulain@linaro.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
| * wcn36xx: Track associated stationsLoic Poulain2018-06-292-0/+8
| | | | | | | | | | | | | | Add list of associated stations(STA, AP, peer...) per vif. Signed-off-by: Loic Poulain <loic.poulain@linaro.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
| * wcn36xx: Fix WEP104 encryption typeLoic Poulain2018-06-291-1/+1
| | | | | | | | | | | | | | This is an obvious copy & paste bug. Signed-off-by: Loic Poulain <loic.poulain@linaro.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* | wcn36xx: Remove Unicode Byte Order Mark from testcodeGeert Uytterhoeven2018-06-281-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | Older gcc (< 4.4) doesn't like files starting with a Unicode BOM: drivers/net/wireless/ath/wcn36xx/testmode.c:1: error: stray ‘\357’ in program drivers/net/wireless/ath/wcn36xx/testmode.c:1: error: stray ‘\273’ in program drivers/net/wireless/ath/wcn36xx/testmode.c:1: error: stray ‘\277’ in program Remove the BOM, the rest of the file is plain ASCII anyway. Output of "file drivers/net/wireless/ath/wcn36xx/testmode.c" before: drivers/net/wireless/ath/wcn36xx/testmode.c: C source, UTF-8 Unicode (with BOM) text and after: drivers/net/wireless/ath/wcn36xx/testmode.c: C source, ASCII text Fixes: 87f825e6e246cee0 ("wcn36xx: Add support for Factory Test Mode (FTM)") Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Acked-by: Ramon Fried <ramon.fried@gmail.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: Add support for Factory Test Mode (FTM)Eyal Ilsar2018-05-259-0/+332
| | | | | | | | | | | | | | | | | | Introduce infrastructure for supporting Factory Test Mode (FTM) of the wireless LAN subsystem. In order for the user space to access the firmware in test mode the relevant netlink channel needs to be exposed from the kernel driver. The above is achieved as follows: 1) Register wcn36xx driver to testmode callback from netlink 2) Add testmode callback implementation to handle incoming FTM commands 3) Add FTM command packet structure 4) Add handling for GET_BUILD_RELEASE_NUMBER (msgid=0x32A2) 5) Add generic handling for all PTT_MSG packets Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org> Signed-off-by: Ramon Fried <ramon.fried@linaro.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: improve debug and error messages for SMDDaniel Mack2018-05-251-4/+10
| | | | | | | | Add a missing newline in wcn36xx_smd_send_and_wait() and also log the command request and response type that was processed. Signed-off-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: simplify wcn36xx_smd_open()Daniel Mack2018-05-251-9/+3Star
| | | | | | | | Drop the extra warning about failed allocations, both the core and the only caller of this function will warn loud enough in such cases. Signed-off-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: drain pending indicator messages on shutdownDaniel Mack2018-05-251-0/+6
| | | | | | | | | | | | When the interface is shut down, wcn36xx_smd_close() potentially races against the queue worker. Make sure to cancel the work, and then free all the remnants in hal_ind_queue manually. This is again just a theoretical issue, not something that was triggered in the wild. Signed-off-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: set PREASSOC and IDLE stated when BSS info changesDaniel Mack2018-05-251-0/+4
| | | | | | | | | | | When a BSSID is joined, set the link status to 'preassoc', and set it to 'idle' when the BSS is deleted. This is what the downstream driver is doing, and it seems to improve the reliability during connect/disconnect stress tests. Signed-off-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: consider CTRL_EOP bit when looking for valid descriptorsDaniel Mack2018-05-251-1/+3
| | | | | | | | | | In reap_tx_dxes(), when we iterate over the linked descriptors, only consider such valid that have WCN36xx_DXE_CTRL_EOP set. This is what the prima downstream driver is doing as well. Signed-off-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: only handle packets when ED or DONE bit is setDaniel Mack2018-05-251-4/+16
| | | | | | | | | | | | | | | On RX and TX interrupts, check for the WCN36XX_CH_STAT_INT_ED_MASK or WCN36XX_CH_STAT_INT_DONE_MASK in the interrupt reason register, and only handle packets when it is set. This way, reap_tx_dxes() is only invoked when needed. This brings the dequeing logic in line with what the prima downstream driver is doing. While at it, also log the interrupt reason. Signed-off-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: clear all masks in RX interruptDaniel Mack2018-05-251-22/+40
| | | | | | | | | | | | | | | | | | Like on the TX side, check for the interrupt reason when the RX interrupt is latched and clear the ERR, DONE and ED masks. This seems to help with connection timeouts and network stream starvatations. And FWIW, the downstream driver does the same thing. Note that in analogy to the TX side, WCN36XX_DXE_0_INT_CLR should be set to WCN36XX_INT_MASK_CHAN_RX_{L,H} rather than WCN36XX_DXE_INT_CH{1,3}_MASK. It did the right thing however, as the defines happen to have identical values. Also, instead of determining register addresses and values inside wcn36xx_rx_handle_packets(), pass them as arguments. Signed-off-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: don't disable RX IRQ from handlerDaniel Mack2018-05-251-4/+11
| | | | | | | | There's no need to disable the IRQ from inside its handler. Instead just grab the spinlock of the channel that is being processed. Signed-off-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: set DMA mask explicitlyDaniel Mack2018-05-251-0/+6
| | | | | | | | | The device takes 32-bit addresses only, so inform the DMA API about it. This is the default on msm8016, so that doesn't change anything, but it's best practice to be explicit. Signed-off-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: fix buffer commit logic on TX pathDaniel Mack2018-05-251-37/+38
| | | | | | | | | | | | | | | | | | | | | | When wcn36xx_dxe_tx_frame() is entered while the device is still processing the queue asyncronously, we are racing against the firmware code with updates to the buffer descriptors. Presumably, the firmware scans the ring buffer that holds the descriptors and scans for a valid control descriptor, and then assumes that the next descriptor contains the payload. If, however, the control descriptor is marked valid, but the payload descriptor isn't, the packet is not sent out. Another issue with the current code is that is lacks memory barriers before descriptors are marked valid. This is important because the CPU may reorder writes to memory, even if it is allocated as coherent DMA area, and hence the device may see incompletely written data. To fix this, the code in wcn36xx_dxe_tx_frame() was restructured a bit so that the payload descriptor is made valid before the control descriptor. Memory barriers are added to ensure coherency of shared memory areas. Signed-off-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: pass information elements in scan requestsDaniel Mack2018-04-243-7/+18
| | | | | | | | | | | | | | | | | When the wifi driver core passes IE elements in the scan request, append them to the firmware message. The driver currently tells the core that it is capable of attaching up to WCN36XX_MAX_SCAN_IE_LEN octets, but doesn't actually pass them to the the hardware. Note that this patch doesn't fix a bug that was observed. The change is merely done for the sake of completeness as the hardware supports appending IEs in scans. Tests show that network scans work fine with this patch applied. Some defines were moved around to avoid cyclic include dependencies. Signed-off-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: send bss_type in scan requestsDaniel Mack2018-04-242-1/+5
| | | | | | | | | | | | Pass the bss_type of the currently configured BSS in the message for the scan request. Therefore, that setting needs to be kept in struct wcn36xx_vif. This seems to be only interesting when scanning for a specific SSID and doesn't matter for regular wildcard scans. Signed-off-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: handle scan cancellation when firmware support is missingDaniel Mack2018-04-241-3/+11
| | | | | | | | | For firmwares that don't have the SCAN_OFFLOAD feature bit set, do not call into wcn36xx_smd_stop_hw_scan(). Instead, stop the asynchronous work and call into ieee80211_scan_completed() immediately. Signed-off-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: cancel pending scan request when interface goes downDaniel Mack2018-04-241-0/+13
| | | | | | | | | | | | | | When the network interface goes down while a scan request is still pending that can't be stopped due to firmware hickups, wcn->scan_req remains set, even though the hardware is deinitialized. This results in -EBUSY for all scan requests after the interface was brought up again. Fix this by explicitly completing pending scan requests in wcn36xx_stop(). Signed-off-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: abort scan request when 'dequeued' indicator is sentDaniel Mack2018-04-241-2/+2
| | | | | | | | | | | | | | | | When the firmware sends a WCN36XX_HAL_SCAN_IND_DEQUEUED indication, the request is apparently no longer valid. Attempts to stop the hardware scan request subsequently will lead to the following error message, and the hardware is no longer able to communicate with any AP: [ 57.917186] wcn36xx: ERROR hal_stop_scan_offload response failed err=5 Interpreting this indicator message as scan abortion fixes this. While at it, add a newline to a debug print. Signed-off-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: pass correct BSS index when deleting BSS keysDaniel Mack2018-04-243-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | The firmware message to delete BSS keys expects a BSS index to be passed. This field is currently hard-coded to 0. Fix this by passing in the index we received from the firmware when the BSS was configured. The encryption type in that message also needs to be set to what was used when the key was set, so the assignment of vif_priv->encrypt_type is now done after the firmware command was sent. This reportedly fixes the following error in AP mode: wcn36xx: ERROR hal_remove_bsskey response failed err=6 Also, AFAIU, when a BSS is deleted, the firmware apparently drops all the keys associated with it. Trying to remove the key explicitly afterwards will hence lead to the following message: wcn36xx: ERROR hal_remove_bsskey response failed err=16 This is now suppressed with an extra check for the BSS index validity. Signed-off-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: use READ_ONCE() to access desc->ctrlDaniel Mack2018-04-191-4/+3Star
| | | | | | | | | | | | | | | | | When accessing shared memory to check for the stat of submitted descriptors, make sure to use READ_ONCE(). This will guarantee the compiler treats these memory locations as volatile and doesn't apply any caching. While this doesn't fix any particular problem I ran into, it's best practice to do it this way. Note that this patch also removes the superflous extra condition check in the do-while loop in reap_tx_dxes(), as the loop will break instantly anyway in that case. Signed-off-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: allocate skbs with GFP_KERNEL during initDaniel Mack2018-04-101-4/+6
| | | | | | | | | | | | GFP_ATOMIC should only be used when the allocation is done from atomic context. Introduce a new flag to wcn36xx_dxe_fill_skb() and use GFP_KERNEL when pre-allocating buffers during init. This doesn't fix an issue that was observed in the wild, but it reduces the chance of failed allocations under memory pressure. Signed-off-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: Remove useless skb spinlockLoic Poulain2018-04-102-8/+1Star
| | | | | | | | | | Each DXE control block is associated to a specific channel. The channel lock is always taken before accessing a control block. There is no need to have an extra (useless) spinlock for the control block skb. Signed-off-by: Loic Poulain <loic.poulain@linaro.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: Add missing fall through comment in smd.cLoic Poulain2018-04-101-0/+1
| | | | | | | | | This prevents GCC warning. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Loic Poulain <loic.poulain@linaro.org> Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: don't delete invalid bss indicesDaniel Mack2018-04-102-0/+7
| | | | | | | | | | | | | | | | | | The firmware code cannot cope with requests to remove BSS indices that have not previously been added. This primarily happens when the device is suspended and then resumed. ieee80211_reconfig() then calls into wcn36xx_bss_info_changed() with an empty bssid and BSS_CHANGED_BSSID set, which subsequently leads to a firmware crash: [ 43.647928] qcom-wcnss-pil a204000.wcnss: fatal error received: halMsg.c:4964:halMsg_DelBss: Invalid BSSIndex 0 [ 43.647959] remoteproc remoteproc0: crash detected in a204000.wcnss: type fatal error To fix this, set bss_index to WCN36XX_HAL_BSS_INVALID_IDX for all bss that have not been configured in the firmware, and don't call into the firmware with invalid indices. Signed-off-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: don't keep reference to skb if transmission failedDaniel Mack2018-04-102-4/+17
| | | | | | | | | | | | | | | | | When wcn36xx_dxe_tx_frame() fails to transmit the TX frame, the driver will call into ieee80211_free_txskb() for the skb in flight, so it'll no longer be valid. Hence, we shouldn't keep a reference to it in ctl->skb. Also, if the skb has IEEE80211_TX_CTL_REQ_TX_STATUS set, a pointer to it will currently remain in wcn->tx_ack_skb, which will potentially lead to a crash if accessed later. Fix this by checking the return value of wcn36xx_dxe_tx_frame(), and nullify wcn->tx_ack_skb again in case of errors. Move the assignment of ctl->skb in wcn36xx_dxe_tx_frame() so it only happens when the transmission is successful. Signed-off-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: check for DMA mapping errors in wcn36xx_dxe_tx_frame()Daniel Mack2018-04-101-0/+5
| | | | | | | | | Bail out if the mapping fails. Even though this hasn't occured during tests, this unlikely case should still be handled. Signed-off-by: Daniel Mack <daniel@zonque.org> Acked-by: Ramon Fried <rfried@codeaurora.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: dequeue all pending indicator messagesDaniel Mack2018-03-291-43/+52
| | | | | | | | | | | | | | | | | In case wcn36xx_smd_rsp_process() is called more than once before hal_ind_work was dispatched, the messages will end up in hal_ind_queue, but wcn36xx_ind_smd_work() will only look at the first message in that list. Fix this by dequeing the messages from the list in a loop, and only stop when it's empty. This issue was found during a review of the driver. In my tests, that race never actually occured. Signed-off-by: Daniel Mack <daniel@zonque.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: Fix firmware crash due to corrupted buffer addressLoic Poulain2018-03-293-32/+16Star
| | | | | | | | | | | | | | | | | | | | wcn36xx_start_tx function retrieves the buffer descriptor from the channel control queue to start filling tx buffer information. However, nothing prevents this same buffer to be concurrently accessed in a concurent tx call, leading to potential buffer coruption and firmware crash (observed during iperf test). The channel control queue should only be accessed and updated with the channel lock. Fix this issue by using a local buffer descriptor which will be copied in the thread-safe wcn36xx_dxe_tx_frame. Note that buffer descriptor size is few bytes so the introduced copy overhead is insignificant. Moreover, this allows to keep the locked section minimal. Signed-off-by: Loic Poulain <loic.poulain@linaro.org> Signed-off-by: Ramon Fried <rfried@codeaurora.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: turn off probe response offloadingRamon Fried2018-03-291-2/+0Star
| | | | | | | | | | It appears that the WCN36xx firmware doesn't actually respond to probe requests. Until it's resolved, switch the probe response responsibility to the 802.11 layer to allow creation of hidden SSID AP's. Signed-off-by: Ramon Fried <rfried@codeaurora.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wireless: Use octal not symbolic permissionsJoe Perches2018-03-271-3/+2Star
| | | | | | | | | | | | | | Prefer the direct use of octal for permissions. Done with checkpatch -f --types=SYMBOLIC_PERMS --fix-inplace and some typing. Miscellanea: o Whitespace neatening around these conversions. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: Check DXE IRQ reasonRamon Fried2018-03-262-7/+47
| | | | | | | | | | IRQ reason was not cheked for errors. Although error handing is not currently supported, it will be nice to output an error value to the log if the DMA operation failed. Signed-off-by: Ramon Fried <rfried@codeaurora.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: calculate DXE default channel valuesRamon Fried2018-03-261-5/+99
| | | | | | | | | DXE channel defaults used hardcoded magic values. Added bit definitions of the control register and calculate this values in compilation for clarity. Signed-off-by: Ramon Fried <rfried@codeaurora.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: calculate DXE control registers valuesRamon Fried2018-03-262-15/+103
| | | | | | | | | DXE descriptor control registers used hardcoded magic values. Added bit definitions of the control register and calculate this values in compilation for clarity. No functional changes. Signed-off-by: Ramon Fried <rfried@codeaurora.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: reduce verbosity of drivers messagesRamon Fried2018-03-263-9/+14
| | | | | | | | | | | | Whenever the WLAN interface is started the FW version and caps are printed. The caps now will be displayed only in debug mode. Firmware version will be displayed only once on first startup of the interface. Change-Id: I4db6ea7f384fe15eebe4c3ddb1d1ccab00094332 Signed-off-by: Ramon Fried <rfried@codeaurora.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: Fix warning due to duplicate scan_completed notificationLoic Poulain2018-02-272-6/+5Star
| | | | | | | | | | | The wcn36xx_cancel_hw_scan method stops the hw scan and notify the scan completion via ieee80211_scan_completed. However, on scan offload cancellation, firmware sends a scan complete indication, triggering a new call to ieee80211_scan_completed. This leads to kernel warn since the scan has already been completed. Signed-off-by: Loic Poulain <loic.poulain@linaro.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* wcn36xx: release DMA memory in case of errorRamon Fried2018-01-251-6/+40
| | | | | | | | wcn36xx_dxe_init() doesn't check for the return value of wcn36xx_dxe_init_descs(), release the resources in case an error ocurred. Signed-off-by: Ramon Fried <rfried@codeaurora.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* Merge tag 'wireless-drivers-next-for-davem-2018-01-13' of ↵David S. Miller2018-01-151-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next Kalle Valo says: ==================== wireless-drivers-next patches for 4.16 Here are patches which have been accumulating over the holidays and after the New Year. Business as usual and nothing special really standing out. But what's noteworthy here is that Larry Finger is stepping down as the rtlwifi maintainer. He has been maintaining rtlwifi since it was applied back in 2010 in commit 0c8173385e54 ("rtl8192ce: Add new driver") and it has been no easy role trying to juggle between the vendor, demanding upstream community and users. So big thank you to Larry for all his efforts! ath10k * more preparation work for wcn3990 support * add memory dump to firmware coredump files wil6210 * support scheduled scan * support 40-bit DMA addresses qtnfmac * support MAC address based access control * support for radar detection and Channel Availibility Check (CAC) mwifiex * firmware coredump for usb devices rtlwifi * Larry Finger steps down as the maintainer and Ping-Ke Shih becomes the new maintainer * add debugfs interfaces to dump register and btcoex status, and also write registers and h2c ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
| * wcn36xx: fix incorrect assignment to msg_body.min_ch_timeColin Ian King2018-01-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The second assignment to msg_body.min_ch_time is incorrect, it should actually be to msg_body.max_ch_time. Thanks to Bjorn Andersson for identifying the correct way to fix this as my original fix was incorrect. Detected by CoverityScan, CID#1463042 ("Unused Value") Fixes: 2f3bef4b247e ("wcn36xx: Add hardware scan offload support") Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* | Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller2018-01-122-13/+16
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | BPF alignment tests got a conflict because the registers are output as Rn_w instead of just Rn in net-next, and in net a fixup for a testcase prohibits logical operations on pointers before using them. Also, we should attempt to patch BPF call args if JIT always on is enabled. Instead, if we fail to JIT the subprogs we should pass an error back up and fail immediately. Signed-off-by: David S. Miller <davem@davemloft.net>
| * wcn36xx: Fix dynamic power savingLoic Poulain2018-01-042-13/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since driver does not report hardware dynamic power saving cap, this is up to the mac80211 to manage power saving timeout and state machine, using the ieee80211 config callback to report PS changes. This patch enables/disables PS mode according to the new configuration. Remove old behaviour enabling PS mode in a static way, this make the device unusable when power save is enabled since device is forced to PS regardless RX/TX traffic. Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Loic Poulain <loic.poulain@linaro.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>