ath10k: fix kernel panic, move arvifs list head init before htt init
It is observed that while loading and unloading ath10k modules
in an infinite loop, before ath10k_core_start() completion HTT
rx frames are received, while processing these frames,
dereferencing the arvifs list code is getting hit before
initilizing the arvifs list, causing a kernel panic.
This patch initilizes the arvifs list before initilizing htt.
Johannes Berg [Thu, 21 Apr 2016 13:17:49 +0000 (16:17 +0300)]
ath10k: remove VHT capabilities from 2.4GHz
According to the spec, VHT doesn't exist in 2.4GHz.
There are vendor extensions to allow a subset of VHT to work
(notably 256-QAM), but since mac80211 doesn't support those
advertising VHT capability on 2.4GHz leads to the behaviour
of reporting VHT capabilities but not being able to use any
of them due to mac80211's code requiring 80 MHz support.
Remove the VHT capabilities from 2.4GHz for now. If mac80211
gets extended to use the (likely Broadcom) vendor IEs for it
and handles the lack of 80 MHz support, it can be added back.
Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
After booting the wireless subsystem and uploading the NV blob to the
WCNSS_CTRL service the remote continues to do things and will not start
servicing wlan-requests for another 2-5 seconds (measured).
The downstream code does not have any special handling for this case,
but has a timeout of 10 seconds for the communication layer. By
extending the wcn36xx timeout to match this we follows the same flow for
the boot procedure and can successfully configure WiFi as wlan0 is
registered.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
wil6210: prevent deep sleep of 60G device in critical paths
In idle times 60G device can enter deep sleep and turn off
its XTAL clock.
Host access triggers the device power-up flow which will hold
the AHB during XTAL stabilization until device switches from
slow-clock to XTAL clock.
This behavior can stall the PCIe bus for some arbitrary period
of time.
In order to prevent this stall, host can vote for High Latency
Access Policy (HALP) before reading from PCIe bus.
This vote will wakeup the device from deep sleep and prevent
deep sleep until unvote is done.
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
wil6210: unmask RX_HTRSH interrupt only when connected
RX_HTRSH interrupt sometimes triggered during device reset
procedure.
To prevent handling this interrupt when not required, unmask
this interrupt only if we are connected and mask it when
disconnected.
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
wil6210: print debug message when transmitting while disconnected
Network stack can try to transmit data while AP / STA is
disconnected.
Change this print-out to debug level as this should not be
handled as error.
This patch also adds wil_dbg_ratelimited, used to limit the
above print-out.
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
wil6210: change RX_HTRSH interrupt print level to debug
When using interrupt moderation RX_HTRSH interrupt can occur
frequently during high throughput and should not be considered
as error.
Such print-outs can degrade the performance hence should be printed
in debug print level.
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Lior David [Tue, 26 Apr 2016 11:41:38 +0000 (14:41 +0300)]
wil6210: support regular scan on P2P_DEVICE interface
P2P search can only run on the social channel (channel 2).
When issuing a scan request on the P2P_DEVICE interface,
driver ignored the channels argument and always performed a P2P
search.
Fix this by checking the channels argument, if it is
not specified (meaning full scan) or if a non-social channel
was specified, perform a regular scan and not a P2P search.
Signed-off-by: Lior David <qca_liord@qca.qualcomm.com> Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Alan Liu [Tue, 26 Apr 2016 11:41:33 +0000 (14:41 +0300)]
ath10k: add max_tx_power for QCA6174 WLAN.RM.2.0 firmware
QCA6174 WLAN.RM.2.0 firmware uses max_tx_power instead of using max_reg_power
to set transmission power. The tx power was about -50dbm, after applying this
change, it become -32dbm.
Signed-off-by: Alan Liu <alanliu@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
In commit 97f95c93c8ed ("iwlwifi: remove support for fw older than
-16.ucode") we accidentally changed the fw version reading code for
DVM devices. The code intended to remove the old fw version API,
because all MVM firmwares version 16 and above that we support don't
use it anymore. But DVM devices still use the old FW API.
Fix that by bringing the code back in.
Reported-by: Pat Erley <pat-lkml@erley.org> Tested-by: Kalle Valo <kvalo@codeaurora.org> Fixes: 97f95c93c8ed ("iwlwifi: remove support for fw older than-16.ucode") Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Dan Carpenter [Tue, 19 Apr 2016 14:25:43 +0000 (07:25 -0700)]
brcmfmac: testing the wrong variable in brcmf_rx_hdrpull()
Smatch complains about this code:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c:335 brcmf_rx_hdrpull()
error: we previously assumed '*ifp' could be null (see line 333)
The problem is that we recently changed these from "ifp" to "*ifp" but
there was one that we didn't update.
- if (ret || !ifp || !ifp->ndev) {
+ if (ret || !(*ifp) || !(*ifp)->ndev) {
if (ret != -ENODATA && ifp)
^^^
- ifp->stats.rx_errors++;
+ (*ifp)->stats.rx_errors++;
I have updated it to *ifp as well. We always call this function is a
non-NULL "ifp" pointer, btw.
Fixes: c462ebcdfe42 ('brcmfmac: create common function for handling brcmf_proto_hdrpull()') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Dan Carpenter [Tue, 19 Apr 2016 14:23:44 +0000 (07:23 -0700)]
mwifiex: fix loop timeout in mwifiex_prog_fw_w_helper()
USB8XXX_FW_MAX_RETRY is 3. We were using a post-op loop
"while (retries--) {" but then the lines after that assume the loop
exits with retries set to zero.
I've fixed this by changing to a pre-op loop. I started with retries
set to 4 instead of 3 so that we still go through the loop the same
number of times.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Xinming Hu [Mon, 18 Apr 2016 12:22:23 +0000 (05:22 -0700)]
mwifiex: add platform specific wakeup interrupt support
On some arm-based platforms, we need to configure platform specific
parameters by device tree node and also define our node as a child
node of parent SDIO host controller.
This patch parses these parameters from device tree. It includes
calibration data dowoload to firmware, wakeup pin configured to firmware,
and soc specific wake up gpio, which will be set as wakeup interrupt pin.
Signed-off-by: Xinming Hu <huxm@marvell.com> Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Add device tree binding documentation for MARVELL's sd8xxx
(sd8897 and sd8997) wlan chip.
Signed-off-by: Xinming Hu <huxm@marvell.com> Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
David Müller [Fri, 15 Apr 2016 06:50:25 +0000 (08:50 +0200)]
rtlwifi: rtl8821ae: Make sure loop counter is signed on all architectures
The for-loop condition does not work correctly on architectures where
"char" is unsigned. Fix it by using an "int", which may also result in
more efficient code.
Signed-off-by: David Müller <d.mueller@elsoft.ch> Acked-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Tina Ruchandani [Wed, 13 Apr 2016 06:09:16 +0000 (23:09 -0700)]
prism54: isl_38xx: Replace 'struct timeval'
'struct timeval' uses a 32-bit seconds field which will overflow in
year 2038 and beyond. This patch is part of a larger effort to remove
all instances of 'struct timeval' from the kernel and replace them
with 64-bit timekeeping variables.
The patch also fixes the debug printf specifier to avoid the
seconds value being truncated.
The patch was build-tested / debugged by removing the
"if VERBOSE > SHOW_ERROR_MESSAGES" guards.
Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com> Suggested-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Jia-Ju Bai [Fri, 18 Mar 2016 02:27:09 +0000 (13:27 +1100)]
rtl818x_pci: Fix a memory leak in rtl8180_init_rx_ring
When dev_alloc_skb or pci_dma_mapping_error in rtl8180_init_rx_ring fails,
the memory allocated by pci_zalloc_consistent is not freed.
This patch fixes the bug by adding pci_free_consistent
in error handling code.
Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com> Signed-off-by: Julian Calaby <julian.calaby@gmail.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
wcn36xx: Copy all members in config_sta v1 conversion
When converting to version 1 of the config_sta struct not all
members where copied. This fixes the problem of multicast frames
not being delivered on an encrypted network.
Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
While poking at this I also change two related things. I rename one
variable to make the names consistent. I also move one assignment of
priv_sta to the declaration to save a few lines.
Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
The wcn36xx FW expects a fixed size TIM PVM in the beacon template. If
supplied with a shorter than expected PVM it will overwrite the IE
following the TIM.
Squashed with fix from Jason Mobarak <jam@cozybit.com>:
Patch "wcn36xx: Pad TIM PVM if needed" has caused a regression in mesh
beaconing. The field tim_off is always 0 for mesh mode, and thus
pvm_len (referring to the TIM length field) and pad are both incorrectly
calculated. Thus, msg_body.beacon_length is incorrectly calculated for
mesh mode. Fix this.
Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com> Signed-off-by: Jason Mobarak <jam@cozybit.com>
[bjorn: squashed in Jason's fixup] Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
The references to some arrays in the rtl8xxxu driver were moved inside
of an #ifdef, but the symbols remain outside, resulting in build warnings:
rtl8xxxu/rtl8xxxu.c:1506:33: error: 'rtl8188ru_radioa_1t_highpa_table' defined but not used
rtl8xxxu/rtl8xxxu.c:1431:33: error: 'rtl8192cu_radioa_1t_init_table' defined but not used
rtl8xxxu/rtl8xxxu.c:1407:33: error: 'rtl8192cu_radiob_2t_init_table' defined but not used
rtl8xxxu/rtl8xxxu.c:1332:33: error: 'rtl8192cu_radioa_2t_init_table' defined but not used
rtl8xxxu/rtl8xxxu.c:239:35: error: 'rtl8192c_power_base' defined but not used
rtl8xxxu/rtl8xxxu.c:217:35: error: 'rtl8188r_power_base' defined but not used
This adds an extra #ifdef around them to shut up the warnings.
Signed-off-by: Arnd Bergmann <arnd@arndb.de> Fixes: 2fc0b8e5a17d ("rtl8xxxu: Add TX power base values for gen1 parts") Fixes: 4062b8ffec36 ("rtl8xxxu: Move PHY RF init into device specific functions") Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Kalle Valo [Wed, 20 Apr 2016 16:46:01 +0000 (19:46 +0300)]
ath10k: switch testmode to use ath10k_core_fetch_firmware_api_n()
Now that all firmware-N.bin related are within struct ath10k_fw_file we can
switch to use ath10k_core_fetch_firmware_api_n() and delete almost identical
ath10k_tm_fetch_utf_firmware_api_2().
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Kalle Valo [Wed, 20 Apr 2016 16:44:51 +0000 (19:44 +0300)]
ath10k: refactor firmware images to struct ath10k_fw_components
To make it easier to share ath10k_core_fetch_board_data_api_n() with testmode.c
refactor all firmware components to struct ath10k_fw_components. This structure
will hold firmware related files, for example firmware-N.bin and board-N.bin.
For firmware-N.bin create a new struct ath10k_fw_file which contains the actual
firmware image as well as the parsed data from the image.
Modify ath10k_core_start() to take struct ath10k_fw_components() as an argument
which makes it possible in following patches to drop some ugly hacks from
testmode.c.
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Tx power limitations at upper layers are interpreted in
the EIRP domain. When the user requests a given maximum
txpower, e.g. with: 'iw phy0 set txpower fixed 1500',
he expects the EIRP to be at or below 15dBm.
In ath9k_hw_apply_txpower(), the interpretation is
different: the antenna-gain is capped against the
current txpower limit in the regulatory, but not
against the user set value. It ensures that the
resulting EIRP is below the limit defined by the
active countrycode, but not below the value the
user requested.
In a scenario like e.g.
a) antenna_gain=6
b) countrycode limits to eirp=18
c) user set txpower=15
this will cause a setting for AR_PHY_POWER_TX_RATE
regs resulting in an EIRP > 15.
This patch ensures that antenna-gain is considered
whenever the txpower limit is adjusted and with that
the user set limits are kept.
Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Raja Mani [Tue, 12 Apr 2016 14:45:53 +0000 (20:15 +0530)]
ath10k: add dynamic tx mode switch config support for qca4019
push-pull mode needs certain amount the host driver involvement for
managing queues in the host memory and packet delivery to firmware.
qca4019 wifi firmware has an option to stay in push mode for less
number of active traffic flow and then switch to push-pull mode when
the active traffic flow goes beyond the certain limit.
The advantage of staying in push mode for less active traffic is, the
host cpu consumption is reduced. qca4019 firmware supports this
flexibility of the mode switch. It takes the host driver interest
(LOW_PERF/HIGH_PERF) via WMI_EXT_RESOURCE_CFG_CMDID,
LOW_PERF - fw would stay in push mode and switch to push-pull
based on demand.
HIGH_PERF - fw would stay in push-pull mode from the boot.
To make this configuration generic, new WMI services
WMI_SERVICE_TX_MODE_PUSH_ONLY, WMI_SERVICE_TX_MODE_PUSH_PULL,
WMI_SERVICE_TX_MODE_DYNAMIC are introduced to take dynamic tx mode
switch support availability in firmware.
Based on WMI_SERVICE_TX_MODE_DYNAMIC, LOW_PERF or HIGHT_PERF is
configured to the firmware.
Signed-off-by: Raja Mani <rmani@qti.qualcomm.com> Signed-off-by: Tamizh chelvam <c_traja@qti.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Dan Carpenter [Mon, 11 Apr 2016 08:15:20 +0000 (11:15 +0300)]
ath10k: add some sanity checks to peer_map_event() functions
Smatch complains that since "ev->peer_id" comes from skb->data that
means we can't trust it and have to do a bounds check on it to prevent
an array overflow.
Fixes: 6942726f7f7b ('ath10k: add fast peer_map lookup') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Upon firmware assert, restart work will be triggered so that mac80211
will reconfigure the driver. An issue is reported that after restart
work, survey dump data do not contain in-use (SURVEY_INFO_IN_USE) info
for operating channel. During reconfigure, since mac80211 already has
valid channel context for given radio, channel context iteration return
num_chanctx > 0. Hence rx_channel is always NULL. Fix this by assigning
channel context to rx_channel when driver restart is in progress.
Cc: stable@vger.kernel.org Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
ath10k: fix return value for btcoex and peer stats debugfs
Return value is incorrect for btcoex and peer stats debugfs
'write' entries if the user provides a value that matches with
the already available debugfs entry, this results in the debugfs
entry getting stuck and the operation has to be terminated manually.
Fix this by returning the appropriate return 'count' as we do it for
other debugfs entries like pktlog etc.
Fixes: cc61a1bbbc0e ("ath10k: enable debugfs provision to enable Peer Stats feature") Fixes: c28e6f06ff40 ("ath10k: fix sanity check on enabling btcoex via debugfs") Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
This implements an 8192eu specific enable_rf() function. The 8192eu is
not a combo device, so no need for doing the BT specific bits needed
by the 8723bu.
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
rtl8xxxu: Fix OOPS if user tries to add device via /sys
This driver relies on driver_info in struct usb_device_id, so allowing
adding a device via /sys/bus/usb/drivers/rtl8xxxu/new_id will cause a
NULL pointer dereference.
Set .no_dynamic_id = 1 to disable hot add of USB IDs.
Reported-by: Xose Vazquez Perez <xose.vazquez@gmail.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Colin Ian King [Thu, 14 Apr 2016 20:37:07 +0000 (16:37 -0400)]
rtl8xxxu: fix uninitialized return value in ret
several functions are not initializing a return status in ret
resulting in garbage to be returned instead of 0 for success.
Currently, the calls to these functions are not checking the
return, however, it seems prudent to return the correct status
in case they are to be checked at a later date.
Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This dongle was tested successfully by Andrea Merello
Reported-by: Andrea Merello <andrea.merello@gmail.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>