platform/kernel/linux-starfive.git
6 years agohostap: Fix outdated comment about dev->destructor
Stefano Brivio [Thu, 27 Jul 2017 11:20:15 +0000 (13:20 +0200)]
hostap: Fix outdated comment about dev->destructor

After commit cf124db566e6 ("net: Fix inconsistent teardown and
release of private netdev state."), setting
'dev->needs_free_netdev' ensures device data is released, and
'dev->destructor' is not used anymore.

Fixes: cf124db566e6 ("net: Fix inconsistent teardown and release of private netdev state.")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: rtl8192ee: constify pci_device_id.
Arvind Yadav [Mon, 17 Jul 2017 18:09:55 +0000 (23:39 +0530)]
rtlwifi: rtl8192ee: constify pci_device_id.

pci_device_id are not supposed to change at runtime. All functions
working with pci_device_id provided by <linux/pci.h> work with
const pci_device_id. So mark the non-const structs as const.

File size before:
   text    data     bss     dec     hex filename
   1899     928       0    2827     b0b realtek/rtlwifi/rtl8192ee/sw.o

File size After adding 'const':
   text    data     bss     dec     hex filename
   1963     864       0    2827     b0b realtek/rtlwifi/rtl8192ee/sw.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: rtl8188ee: constify pci_device_id.
Arvind Yadav [Mon, 17 Jul 2017 18:09:54 +0000 (23:39 +0530)]
rtlwifi: rtl8188ee: constify pci_device_id.

pci_device_id are not supposed to change at runtime. All functions
working with pci_device_id provided by <linux/pci.h> work with
const pci_device_id. So mark the non-const structs as const.

File size before:
   text    data     bss     dec     hex filename
   3090     912       0    4002     fa2 realtek/rtlwifi/rtl8188ee/sw.o

File size After adding 'const':
   text    data     bss     dec     hex filename
   3154     848       0    4002     fa2 realtek/rtlwifi/rtl8188ee/sw.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: rtl8723be: constify pci_device_id.
Arvind Yadav [Mon, 17 Jul 2017 18:09:53 +0000 (23:39 +0530)]
rtlwifi: rtl8723be: constify pci_device_id.

pci_device_id are not supposed to change at runtime. All functions
working with pci_device_id provided by <linux/pci.h> work with
const pci_device_id. So mark the non-const structs as const.

File size before:
   text    data     bss     dec     hex filename
   3032     912       0    3944     f68 realtek/rtlwifi/rtl8723be/sw.o

File size After adding 'const':
   text    data     bss     dec     hex filename
   3096     848       0    3944     f68 realtek/rtlwifi/rtl8723be/sw.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: rtl8723ae: constify pci_device_id.
Arvind Yadav [Mon, 17 Jul 2017 18:09:52 +0000 (23:39 +0530)]
rtlwifi: rtl8723ae: constify pci_device_id.

pci_device_id are not supposed to change at runtime. All functions
working with pci_device_id provided by <linux/pci.h> work with
const pci_device_id. So mark the non-const structs as const.

File size before:
   text    data     bss     dec     hex filename
   2775     912       0    3687     e67 realtek/rtlwifi/rtl8723ae/sw.o

File size After adding 'const':
   text    data     bss     dec     hex filename
   2839     848       0    3687     e67 realtek/rtlwifi/rtl8723ae/sw.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: rtl8821ae: constify pci_device_id.
Arvind Yadav [Mon, 17 Jul 2017 18:09:51 +0000 (23:39 +0530)]
rtlwifi: rtl8821ae: constify pci_device_id.

pci_device_id are not supposed to change at runtime. All functions
working with pci_device_id provided by <linux/pci.h> work with
const pci_device_id. So mark the non-const structs as const.

File size before:
   text    data     bss     dec     hex filename
   2491     960       0    3451     d7b realtek/rtlwifi/rtl8821ae/sw.o

File size After adding 'const':
   text    data     bss     dec     hex filename
   2587     864       0    3451     d7b realtek/rtlwifi/rtl8821ae/sw.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: rtl8192se: constify pci_device_id.
Arvind Yadav [Mon, 17 Jul 2017 18:09:50 +0000 (23:39 +0530)]
rtlwifi: rtl8192se: constify pci_device_id.

pci_device_id are not supposed to change at runtime. All functions
working with pci_device_id provided by <linux/pci.h> work with
const pci_device_id. So mark the non-const structs as const.

File size before:
   text    data     bss     dec     hex filename
   2817    1040       0    3857     f11 realtek/rtlwifi/rtl8192se/sw.o

File size After adding 'const':
   text    data     bss     dec     hex filename
   3009     848       0    3857     f11 realtek/rtlwifi/rtl8192se/sw.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: rtl8192de: constify pci_device_id.
Arvind Yadav [Mon, 17 Jul 2017 18:09:49 +0000 (23:39 +0530)]
rtlwifi: rtl8192de: constify pci_device_id.

pci_device_id are not supposed to change at runtime. All functions
working with pci_device_id provided by <linux/pci.h> work with
const pci_device_id. So mark the non-const structs as const.

File size before:
   text    data     bss     dec     hex filename
   2833     945      12    3790     ece realtek/rtlwifi/rtl8192de/sw.o

File size After adding 'const':
   text    data     bss     dec     hex filename
   2929     849      12    3790     ece realtek/rtlwifi/rtl8192de/sw.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: Tidy up DMA mask setting
Robin Murphy [Mon, 24 Jul 2017 17:41:30 +0000 (18:41 +0100)]
qtnfmac: Tidy up DMA mask setting

As the only caller of dma_supported() outside of DMA API internals, the
qtfnmac driver stands out and invites scrutiny. Thankfully, it's not
being used for evil, but it is entirely redundant, since it open-codes a
check that the DMA mask setting functions are going to perform anyway.
In fact, the whole qtnf_pcie_init_dma_mask() function is nothing more
than a rather long-winded implementation of dma_set_mask_and_coherent(),
so let's just use that directly.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Acked-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: prepare for AP_VLAN interface type support
Sergey Matyukevich [Thu, 27 Jul 2017 23:06:54 +0000 (02:06 +0300)]
qtnfmac: prepare for AP_VLAN interface type support

Modify qlink command structures and interface types handling
to prepare adding AP_VLAN support to qtnfmac driver.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Avinash Patil <avinashp@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: remove function qtnf_cmd_skb_put_action
Sergey Matyukevich [Thu, 27 Jul 2017 23:06:53 +0000 (02:06 +0300)]
qtnfmac: remove function qtnf_cmd_skb_put_action

This function is not used anymore, so remove it.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Avinash Patil <avinashp@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: fix handling of iftype mask reported by firmware
Sergey Matyukevich [Thu, 27 Jul 2017 23:06:52 +0000 (02:06 +0300)]
qtnfmac: fix handling of iftype mask reported by firmware

Firmware sends supported interface type rather than mask. As a result,
types field of ieee80211_iface_limit structure may end up having
multiple iftype bits set. This leads to WARN_ON from
wiphy_verify_combinations.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Avinash Patil <avinashp@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: implement scan timeout
Sergey Matyukevich [Thu, 27 Jul 2017 23:06:51 +0000 (02:06 +0300)]
qtnfmac: implement scan timeout

Userspace tools may hang on scan in the case when scan completion event
is not returned by firmware. This patch implements the scan timeout
to avoid such situation.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Avinash Patil <avinashp@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: implement cfg80211 channel_switch handler
Sergey Matyukevich [Thu, 27 Jul 2017 23:06:50 +0000 (02:06 +0300)]
qtnfmac: implement cfg80211 channel_switch handler

This patch implements cfg80211 channel_switch handler enabling CSA
channel-switch procedure.

Driver performs only basic validation of the requested new channel
and then sends command to firmware. Beacon IEs are not sent since
beacon update is handled by firmware.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Avinash Patil <avinashp@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: move current channel info from vif to mac
Sergey Matyukevich [Thu, 27 Jul 2017 23:06:49 +0000 (02:06 +0300)]
qtnfmac: move current channel info from vif to mac

Wireless cfg80211 core supplies channel settings in cfg80211_ap_settings
structure for each BSS in multiple BSS configuration. On the other hand
all the virtual interfaces on one radio are using the same PHY settings
including channel.

Move chandef structure from vif to mac structure in order to mantain
the only instance of cfg80211_chan_def structure in qtnf_wmac
rather than its multiple copies in qtnf_vif.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Avinash Patil <avinashp@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: fix station leave reason endianness
Sergey Matyukevich [Thu, 27 Jul 2017 23:06:48 +0000 (02:06 +0300)]
qtnfmac: fix station leave reason endianness

Use proper endianness conversion for client station leave reason.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Avinash Patil <avinashp@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: implement reporting current channel
Sergey Matyukevich [Thu, 27 Jul 2017 23:06:47 +0000 (02:06 +0300)]
qtnfmac: implement reporting current channel

Implement current channel reporting functionality. Current operating
channel can be obtained either directly using cfg80211 get_channel
callback or from stats reported by cfg80211 survey_dump callback.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Avinash Patil <avinashp@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: implement cfg80211 dump_survey handler
Sergey Matyukevich [Thu, 27 Jul 2017 23:06:46 +0000 (02:06 +0300)]
qtnfmac: implement cfg80211 dump_survey handler

This patch implements cfg80211 dump_survey handler enabling
per-channel survey data reports.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Avinash Patil <avinashp@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: add missing bus lock
Sergey Matyukevich [Thu, 27 Jul 2017 23:06:45 +0000 (02:06 +0300)]
qtnfmac: add missing bus lock

Add missing bus lock into get_mac_chan_info command.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Avinash Patil <avinashp@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: regulatory configuration for self-managed setup
Sergey Matyukevich [Thu, 27 Jul 2017 23:06:44 +0000 (02:06 +0300)]
qtnfmac: regulatory configuration for self-managed setup

Regdomain information needs to be registered with cfg80211
for devices with REGULATORY_WIPHY_SELF_MANAGED flag set.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Avinash Patil <avinashp@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: updates for regulatory support
Sergey Matyukevich [Thu, 27 Jul 2017 23:06:43 +0000 (02:06 +0300)]
qtnfmac: updates for regulatory support

On startup driver obtains regulatory rules from firmware and
enables them during wiphy registration. Later on regulatory
domain change can be requested by host. In this case firmware
is notified about the upcoming changes. If the change is valid,
then firmware updates hardware channel configuration and host
driver receives updated channel info for each band.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Avinash Patil <avinashp@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: Fix fallback firmware loading
Sven Joachim [Mon, 31 Jul 2017 16:10:45 +0000 (18:10 +0200)]
rtlwifi: Fix fallback firmware loading

Commit f70e4df2b384 ("rtlwifi: Add code to read new versions of
firmware") added code to load an old firmware file if the new one is
not available.  Unfortunately that code is never reached because
request_firmware_nowait() does not wait for the firmware to show up
and returns 0 even if the file is not there.

Use the existing fallback mechanism introduced by commit 62009b7f1279
("rtlwifi: rtl8192cu: Add new firmware") instead.

Fixes: f70e4df2b384 ("rtlwifi: Add code to read new versions of firmware")
Cc: stable@vger.kernel.org
Signed-off-by: Sven Joachim <svenjoac@gmx.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: correct IE parse during association
Xinming Hu [Mon, 31 Jul 2017 09:49:24 +0000 (09:49 +0000)]
mwifiex: correct IE parse during association

It is observed that some IEs get missed during association.
This patch correct the old IE parse code. sme->ie will be
store as wpa ie, wps ie, wapi ie and gen ie accordingly.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: rtl_pci_probe: Fix fail path of _rtl_pci_find_adapter
Malcolm Priestley [Sun, 30 Jul 2017 08:02:19 +0000 (09:02 +0100)]
rtlwifi: rtl_pci_probe: Fix fail path of _rtl_pci_find_adapter

_rtl_pci_find_adapter fail path will jump to label fail3 for
unsupported adapter types.

However, on course for fail3 there will be call rtl_deinit_core
before rtl_init_core.

For the inclusion of checking pci_iounmap this fail can be moved to
fail2.

Fixes
[    4.492963] BUG: unable to handle kernel NULL pointer dereference at           (null)
[    4.493067] IP: rtl_deinit_core+0x31/0x90 [rtlwifi]

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoMerge tag 'iwlwifi-next-for-kalle-2017-08-01' of git://git.kernel.org/pub/scm/linux...
Kalle Valo [Thu, 3 Aug 2017 09:15:59 +0000 (12:15 +0300)]
Merge tag 'iwlwifi-next-for-kalle-2017-08-01' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

First batch of iwlwifi patches for 4.14

* Reorganization of the code into separate directories continues;
* A couple of new minor features;
* Fixes and cleanups here and there.

6 years agoiwlwifi: mvm: don't retake the pointer to skb's CB
Emmanuel Grumbach [Sun, 25 Jun 2017 07:38:12 +0000 (10:38 +0300)]
iwlwifi: mvm: don't retake the pointer to skb's CB

We already have a such a pointer.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: remove non-DQA mode
Johannes Berg [Mon, 19 Jun 2017 21:50:31 +0000 (23:50 +0200)]
iwlwifi: mvm: remove non-DQA mode

All the firmware versions the driver supports enable DQA, and thus
the only way to get non-DQA mode is to modify the source. Remove
this mode to simplify the code.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: rename p2p-specific sta functions to include p2p in the names
Luca Coelho [Thu, 22 Jun 2017 13:00:25 +0000 (16:00 +0300)]
iwlwifi: mvm: rename p2p-specific sta functions to include p2p in the names

The iwl_mvm_add_bcast_sta() and the iwl_mvm_rm_bcast_sta() functions
are only called in P2P flows.  Add _p2p_ to the function names to make
this explicit.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: simplify bufferable MMPDU check
Johannes Berg [Tue, 20 Jun 2017 09:22:07 +0000 (11:22 +0200)]
iwlwifi: mvm: simplify bufferable MMPDU check

There's no need to spell out the cases when we can just
use ieee80211_is_bufferable_mmpdu().

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: require AP_LINK_PS for TVQM
Johannes Berg [Tue, 20 Jun 2017 13:18:43 +0000 (15:18 +0200)]
iwlwifi: mvm: require AP_LINK_PS for TVQM

Since the TXQ timer freeze code will not properly handle the
large TVQM queue numbers, warn if we get into that code when
we have TVQM. Also, just to catch this earlier, warn if the
firmware image doesn't support AP_LINK_PS but we're running
on HW using TVQM.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: pcie: rename iwl_trans_check_hw_rf_kill() to pcie
Johannes Berg [Tue, 20 Jun 2017 13:10:31 +0000 (15:10 +0200)]
iwlwifi: pcie: rename iwl_trans_check_hw_rf_kill() to pcie

Rename this function to the more appropriate iwl_pcie_check_hw_rf_kill()
since it's only a function in the pcie code and cannot be called from
any other place.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: add compile-time option to disable EBS
Zamir, Roee [Wed, 14 Jun 2017 10:53:44 +0000 (13:53 +0300)]
iwlwifi: mvm: add compile-time option to disable EBS

For testing purposes, we may want to disable EBS scans at compile time.

Signed-off-by: Roee Zamir <roee.zamir@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: implement fseq version mismatch warning
Mordechai Goodstein [Tue, 13 Jun 2017 14:17:27 +0000 (17:17 +0300)]
iwlwifi: implement fseq version mismatch warning

During init, the FW checks whether the FSEQ value matches what it
expects.  If it doesn't match, we print a warning to let integrators
clearly know that something is wrong.  This can happen if another core
(i.e. not WiFi) has updated the FSEQ version.  This notification is
only sent by the FW in production, for development firmwares, an
assertion is triggered instead.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Mordechai Goodstein <mordechay.goodstein@intel.com>
6 years agoiwlwifi: mvm: support fw reading empty OTP
Liad Kaufman [Mon, 5 Jun 2017 13:39:39 +0000 (16:39 +0300)]
iwlwifi: mvm: support fw reading empty OTP

If the OTP is empty, the NVM_GET_INFO command returns
with flags' bit(0) on. This means the FW returns the
default values for working with. This is allowed, so
use this returned data.

Fixes: e9e1ba3dbf00 ("iwlwifi: mvm: support getting nvm data from firmware")
Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: pcie: fix A-MSDU on gen2 devices
Emmanuel Grumbach [Wed, 14 Jun 2017 12:25:39 +0000 (15:25 +0300)]
iwlwifi: pcie: fix A-MSDU on gen2 devices

The return status check of iwl_pcie_gen2_build_amsdu
was buggy. Fix it.

Fixes: 6ffe5de35b05 ("iwlwifi: pcie: add AMSDU to gen2")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: fix uninitialized var while waiting for queues to empty
Sharon Dvir [Mon, 12 Jun 2017 08:40:33 +0000 (11:40 +0300)]
iwlwifi: mvm: fix uninitialized var while waiting for queues to empty

While waiting for queues to empty,
If txq_id == IWL_MVM_INVALID_QUEUE for all txq_ids,
ret is used uninitialized.
Found by Klocwork.

Fixes: d6d517b7730c ("iwlwifi: add wait for tx queue empty")
Signed-off-by: Sharon Dvir <sharon.dvir@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: fix the FIFO numbers in A000 devices
Emmanuel Grumbach [Tue, 13 Jun 2017 10:18:48 +0000 (13:18 +0300)]
iwlwifi: mvm: fix the FIFO numbers in A000 devices

The FIFO numbering is different in A000 devices. This
means that we routed BE packets to BK FIFO. Fix this.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: refactor beacon template command code
Luca Coelho [Thu, 1 Jun 2017 12:19:45 +0000 (15:19 +0300)]
iwlwifi: mvm: refactor beacon template command code

We currently support 3 different versions of the beacon template
command and the code does some tricks in order to reuse what is
possible across these versions.  But it is a bit complicated to read
and soon there will be one more variation that the driver needs
implement, which would complicate it even further.

Refactor the way we send beacon template commands, which increases the
code size a bit, but makes it much easier to read.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: dvm: remove unused defines
Seraphime Kirkovski [Tue, 6 Jun 2017 23:20:27 +0000 (01:20 +0200)]
iwlwifi: dvm: remove unused defines

Those constants have been unused for quite some time now.

Signed-off-by: Seraphime Kirkovski <kirkseraph@gmail.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: byte-swap constant instead of variable
Johannes Berg [Wed, 7 Jun 2017 07:31:13 +0000 (09:31 +0200)]
iwlwifi: mvm: byte-swap constant instead of variable

Convention has it to byte-swap the constant instead of the variable
when doing bit checks. This also generates better code when the swap
is actually needed, since the constant can be swapped at compile-time.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: check family instead of new TX API for workarounds
Johannes Berg [Thu, 8 Jun 2017 07:42:28 +0000 (09:42 +0200)]
iwlwifi: mvm: check family instead of new TX API for workarounds

There are two workarounds because RSS is currently broken on A000
devices due to firmware issues, but checking for the new TX API
doesn't really make sense. Check the hardware family instead of
the new TX API - there's nothing better to check since it's just
a temporary workaround.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: add and use iwl_mvm_has_unified_ucode()
Johannes Berg [Thu, 8 Jun 2017 07:18:22 +0000 (09:18 +0200)]
iwlwifi: mvm: add and use iwl_mvm_has_unified_ucode()

This may need to be refined later, but for now using this,
even with the TODO, is better than checking "has new TX API".

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: fw api: fix various kernel-doc warnings
Johannes Berg [Tue, 6 Jun 2017 10:19:22 +0000 (12:19 +0200)]
iwlwifi: fw api: fix various kernel-doc warnings

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: reorganize firmware API
Johannes Berg [Fri, 2 Jun 2017 13:15:53 +0000 (15:15 +0200)]
iwlwifi: reorganize firmware API

Apart from DVM, all firmware uses the same base API, and there's
code outside iwlmvm that needs to interact with it. Reflect this
in the source better and reorganize the firmware API to a new
fw/api/ directory.

While at it, split the already pretty large fw-api.h file into a
number of smaller files, going from almost 3k lines in there to
a maximum number of lines less than 1k.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: refactor firmware debug code
Johannes Berg [Thu, 1 Jun 2017 14:03:19 +0000 (16:03 +0200)]
iwlwifi: refactor firmware debug code

Split out the firmware debug code to be more general, so that it
can be used by different subdrivers.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: track current firmware image in common code
Johannes Berg [Fri, 2 Jun 2017 09:56:58 +0000 (11:56 +0200)]
iwlwifi: track current firmware image in common code

Track the current firmware image in the common code instead
of in the opmode so that later patches can access it there
in a common way.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: refactor shared mem parsing
Johannes Berg [Thu, 1 Jun 2017 12:44:40 +0000 (14:44 +0200)]
iwlwifi: refactor shared mem parsing

Refactor the shared memory command parsing into common code.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: refactor out paging code
Johannes Berg [Thu, 1 Jun 2017 10:10:32 +0000 (12:10 +0200)]
iwlwifi: refactor out paging code

Refactor the paging code from mvm to be used by different opmodes.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agortlwifi: rtl8821ae: Fix HW_VAR_NAV_UPPER operation
Dan Carpenter [Thu, 13 Jul 2017 07:43:23 +0000 (10:43 +0300)]
rtlwifi: rtl8821ae: Fix HW_VAR_NAV_UPPER operation

The cast here is wrong.  We want to cast the pointer but we accidentally
do a no-op cast of the value.  We normally want to set us_nav_upper to
WIFI_NAV_UPPER_US (30000) but because of this bug we instead set it to
184 on little endian systems and 0 on big endian ones.

Fixes: 3c05bedb5fef ("Staging: rtl8812ae: Add Realtek 8821 PCI WIFI driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: Fix memory leak when firmware request fails
Souptick Joarder [Wed, 5 Jul 2017 14:25:06 +0000 (19:55 +0530)]
rtlwifi: Fix memory leak when firmware request fails

This patch will fix memory leak when firmware request fails

Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: Remove unused dummy function
Souptick Joarder [Wed, 28 Jun 2017 12:32:33 +0000 (18:02 +0530)]
rtlwifi: Remove unused dummy function

Removing unused dummy function

Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: remove dummy function call
Souptick Joarder [Wed, 28 Jun 2017 07:57:11 +0000 (13:27 +0530)]
rtlwifi: remove dummy function call

_rtl92cu_init_usb_aggregation() can be removed as it is dummy one

Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: move IS_HARDWARE_TYPE_xxx checker to wifi.h
Ping-Ke Shih [Sun, 2 Jul 2017 18:12:37 +0000 (13:12 -0500)]
rtlwifi: move IS_HARDWARE_TYPE_xxx checker to wifi.h

Use rtlpriv instead of rtlhal as argument, so driver and btcoex use
the same definitions.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: Uses addr1 instead DA to determine broadcast and multicast addr.
Ping-Ke Shih [Sun, 2 Jul 2017 18:12:36 +0000 (13:12 -0500)]
rtlwifi: Uses addr1 instead DA to determine broadcast and multicast addr.

We should check addr1 to indicate a packet as broadcast or multicast
in tx desc. An obvious example, a STA transmit an *unicast* ARP packet
where addr1 and DA are the addresses of AP and broadcast respectively.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: Rename rtl_desc92_rate to rtl_desc_rate
Ping-Ke Shih [Sun, 2 Jul 2017 18:12:35 +0000 (13:12 -0500)]
rtlwifi: Rename rtl_desc92_rate to rtl_desc_rate

This is a common enumeration, so we use a common name.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: Update 8723be new phy parameters and its parser.
Ping-Ke Shih [Sun, 2 Jul 2017 18:12:34 +0000 (13:12 -0500)]
rtlwifi: Update 8723be new phy parameters and its parser.

There are new PHY table values for the RTL8723BE. The changes require
new parsing code.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: add amplifier type for 8812ae
Ping-Ke Shih [Sun, 2 Jul 2017 18:12:33 +0000 (13:12 -0500)]
rtlwifi: add amplifier type for 8812ae

With correct amplifier_type, the phy praser can choose correct parameters.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: Add board type for 8723be and 8192ee
Ping-Ke Shih [Sun, 2 Jul 2017 18:12:32 +0000 (13:12 -0500)]
rtlwifi: Add board type for 8723be and 8192ee

With correct board_type, the phy praser can choose correct parameters.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: Add BT_MP_INFO to c2h handler.
Ping-Ke Shih [Sun, 2 Jul 2017 18:12:31 +0000 (13:12 -0500)]
rtlwifi: Add BT_MP_INFO to c2h handler.

We use H2C to ask BT's status, and C2H will return the status.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: Fill in_4way field by driver
Ping-Ke Shih [Sun, 2 Jul 2017 18:12:30 +0000 (13:12 -0500)]
rtlwifi: Fill in_4way field by driver

Because it isn't always correct to use EAPOL to check 4-way,
we add a timer to handle exception.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agowl3501_cs: fix spelling mistake: "Insupported" -> "Unsupported"
Colin Ian King [Thu, 27 Jul 2017 22:09:54 +0000 (23:09 +0100)]
wl3501_cs: fix spelling mistake: "Insupported" -> "Unsupported"

Trivial fix to spelling mistake in printk message

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: constify pci_device_id
Arvind Yadav [Mon, 17 Jul 2017 18:16:42 +0000 (23:46 +0530)]
brcmfmac: constify pci_device_id

pci_device_id are not supposed to change at runtime. All functions
working with pci_device_id provided by <linux/pci.h> work with
const pci_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agozd1211rw: fix spelling mistake 'hybernate' -> 'hibernate'
Colin Ian King [Thu, 13 Jul 2017 22:48:29 +0000 (23:48 +0100)]
zd1211rw: fix spelling mistake 'hybernate' -> 'hibernate'

Trivial fix to spelling mistake in PDEBUG debug message.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoipw2100: don't return positive values to PCI probe on error
Dan Williams [Wed, 12 Jul 2017 16:47:02 +0000 (11:47 -0500)]
ipw2100: don't return positive values to PCI probe on error

Causes the PCI stack to complain, and then eventually call the
PCI remove function, which ipw2100 is not expecting.  It then
tries to unregister an already-released netdev and other nasty
things, leading to a panic.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1185518

Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: fix spelling mistake: "Insuffient" -> "Insufficient"
Colin Ian King [Thu, 27 Jul 2017 22:06:22 +0000 (23:06 +0100)]
mwifiex: fix spelling mistake: "Insuffient" -> "Insufficient"

Trivial fix to spelling mistake in mwifiex_dbg debug message

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: usb: fix spelling mistake: "aggreataon"-> "aggregation"
Colin Ian King [Mon, 24 Jul 2017 22:26:23 +0000 (23:26 +0100)]
mwifiex: usb: fix spelling mistake: "aggreataon"-> "aggregation"

Trivial fix to spelling mistake in aggr_ctrl module parameter
message text.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: disable uapsd in tdls config
Xinming Hu [Fri, 21 Jul 2017 09:57:37 +0000 (09:57 +0000)]
mwifiex: disable uapsd in tdls config

Tdls uapsd support capability is default disabled during
tdls setup, correspondingly it should also been disabled
in tdls config.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Zhiyuan Yang <yangzy@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: usb: unlock on error in mwifiex_usb_tx_aggr_tmo()
Dan Carpenter [Mon, 10 Jul 2017 07:21:15 +0000 (10:21 +0300)]
mwifiex: usb: unlock on error in mwifiex_usb_tx_aggr_tmo()

We need to unlock if mwifiex_usb_prepare_tx_aggr_skb() fails.

Fixes: a2ca85ad721d ("mwifiex: usb: add timer to flush aggregation packets")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: uninit wakeup info in the error handling
Jeffy Chen [Thu, 6 Jul 2017 07:55:28 +0000 (15:55 +0800)]
mwifiex: uninit wakeup info in the error handling

We inited wakeup info at the beginning of mwifiex_add_card, so we need
to uninit it in the error handling.

It's much the same as what we did in:
36908c4 mwifiex: uninit wakeup info when removing device

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: fix compile warning of unused variable
Shawn Lin [Thu, 6 Jul 2017 07:50:33 +0000 (15:50 +0800)]
mwifiex: fix compile warning of unused variable

We got a compile warning shows below:

drivers/net/wireless/marvell/mwifiex/sdio.c: In function
'mwifiex_sdio_remove':
drivers/net/wireless/marvell/mwifiex/sdio.c:377:6: warning: variable
'ret' set but not used [-Wunused-but-set-variable]

Per the code, it didn't check if mwifiex_sdio_read_fw_status
finish successfully. We should at least check the return of
mwifiex_sdio_read_fw_status, otherwise the following check of
firmware_stat and adapter->mfg_mode is pointless as the device
is probably dead.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: drop num CPU notice
Brian Norris [Tue, 25 Jul 2017 01:13:36 +0000 (18:13 -0700)]
mwifiex: drop num CPU notice

This print isn't very useful. It's also different between
mwifiex_add_card() and mwifiex_reinit_sw(), and I'd like to consolidate
them eventually.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: keep mwifiex_cancel_pending_ioctl() static
Brian Norris [Tue, 25 Jul 2017 01:13:35 +0000 (18:13 -0700)]
mwifiex: keep mwifiex_cancel_pending_ioctl() static

It has some scary comments about "only being called" from the timeout
handler, so let's help keep it that way.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: pcie: remove unnecessary 'pdev' check
Brian Norris [Tue, 25 Jul 2017 01:13:34 +0000 (18:13 -0700)]
mwifiex: pcie: remove unnecessary 'pdev' check

'card->dev' is initialized once and is never cleared. Drop the
unnecessary "safety" check, as it simply obscures things, and we don't
do this check everywhere (and therefore it's not really "safe").

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: pcie: disable device DMA before unmapping/freeing buffers
Brian Norris [Tue, 25 Jul 2017 01:13:33 +0000 (18:13 -0700)]
mwifiex: pcie: disable device DMA before unmapping/freeing buffers

In testing the mwifiex reset code path, I've noticed KASAN complaining
about some "overwritten poison values" in our RX buffer descriptors.
Because KASAN didn't notice this at the time of a CPU write, this seems
to suggest that the device is writing to this memory.

This makes a little sense, because when resetting, we don't necessarily
expect the device to be responsive, so we don't have a chance to disable
everything cleanly.

We can at least take the precaution of disabling DMA for the device
though, and in my testing that seems to clear up this particular issue.

This patch reorders the removal path so that we disable the device
*before* releasing our last PCIe buffers, and it clears/sets the bus
master feature from the PCI device when resetting.

Along the way, remove the insufficient (and confusing) error path in
mwifiex_pcie_up_dev() (it doesn't unwind things well enough, and it
doesn't propagate its errors upward anyway).

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: debugfs: allow card_reset() to cancel things
Brian Norris [Tue, 25 Jul 2017 01:13:32 +0000 (18:13 -0700)]
mwifiex: debugfs: allow card_reset() to cancel things

The card_reset() implementation should be setting our state flags and
cancelling commands for us (i.e., in mwifiex_shutdown_drv()), so let's
not do it here.

Also, this debugfs file is useful for testing and debugging the reset
feature, so we shouldn't do extra preparatory steps here, as that might
cause different reset behavior, which could either cause new bugs or
paper over existing ones that this debug feature should otherwise help
us catch.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: pcie: unify MSI-X / non-MSI-X interrupt process
Brian Norris [Tue, 25 Jul 2017 01:13:31 +0000 (18:13 -0700)]
mwifiex: pcie: unify MSI-X / non-MSI-X interrupt process

After removing the interrupt loop in commit 5d5ddb5e0d9b ("mwifiex:
pcie: don't loop/retry interrupt status checks"), there is practically
zero difference between mwifiex_process_pcie_int() (which handled legacy
PCI interrupts and MSI interrupts) and mwifiex_process_msix_int() (which
handled MSI-X interrupts). Let's add the one relevant line to
mwifiex_process_pcie_int() and kill the copy-and-paste.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: pcie: remove unnecessary masks
Brian Norris [Tue, 25 Jul 2017 01:13:30 +0000 (18:13 -0700)]
mwifiex: pcie: remove unnecessary masks

After removing the interrupt loop in commit 5d5ddb5e0d9b ("mwifiex:
pcie: don't loop/retry interrupt status checks"), we don't need to keep
track of the cleared interrupts (actually, we didn't need to do that
before, but we *really* don't need to now).

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: drop 'add_tail' param from mwifiex_insert_cmd_to_pending_q()
Brian Norris [Tue, 25 Jul 2017 01:13:29 +0000 (18:13 -0700)]
mwifiex: drop 'add_tail' param from mwifiex_insert_cmd_to_pending_q()

It's always called with 'true' -- we only determine it 'false' locally
within this function. So drop the parameter.

Also, this should be 'bool' (since we use true/false), not 'u32'.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: don't open-code ARRAY_SIZE()
Brian Norris [Tue, 25 Jul 2017 01:13:28 +0000 (18:13 -0700)]
mwifiex: don't open-code ARRAY_SIZE()

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: utilize netif_tx_{wake,stop}_all_queues()
Brian Norris [Tue, 25 Jul 2017 01:13:27 +0000 (18:13 -0700)]
mwifiex: utilize netif_tx_{wake,stop}_all_queues()

We're open-coding these. Just use the helpers.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: make mwifiex_free_cmd_buffer() return void
Brian Norris [Tue, 25 Jul 2017 01:13:26 +0000 (18:13 -0700)]
mwifiex: make mwifiex_free_cmd_buffer() return void

It doesn't fail.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: fix misnomers in mwifiex_free_lock_list()
Brian Norris [Tue, 25 Jul 2017 01:13:25 +0000 (18:13 -0700)]
mwifiex: fix misnomers in mwifiex_free_lock_list()

Despite the name (and meticulous comments), this function frees no
memory and does not touch any locks. All it does is "delete" the list
heads -- which just means they'll be dangling, and we'll need to re-init
them if we use them again.

It seems like this code would work OK as a sort of canary for using the
list after we've torn everything down, so it's fine to keep the code;
let's just get the name and comments to match what's actually happening.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: ensure "disable auto DS" struct is initialized
Brian Norris [Tue, 25 Jul 2017 01:13:24 +0000 (18:13 -0700)]
mwifiex: ensure "disable auto DS" struct is initialized

The .idle_time field *should* be unused, but technically, we're allowing
unitialized stack garbage to pass all the way through to the firmware
host command. Let's zero it out instead.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: fixup init_channel_scan_gap error case
Brian Norris [Tue, 25 Jul 2017 01:13:23 +0000 (18:13 -0700)]
mwifiex: fixup init_channel_scan_gap error case

In reading through _mwifiex_fw_dpc(), I noticed that after we've
registered our wiphy, we still have error paths that don't free it back
up. Let's do that.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: don't short-circuit netdev notifiers on interface deletion
Brian Norris [Tue, 25 Jul 2017 01:13:22 +0000 (18:13 -0700)]
mwifiex: don't short-circuit netdev notifiers on interface deletion

When we leave the delete interface function, there are still netdev
hooks that might try to process the device. We're short-circuiting some
of that by changing the interface type and clearing ieee80211_ptr. This
means we skip NETDEV_UNREGISTER_FINAL in cfg80211. Fortunately, that is
currently a no-op.

We don't need most of the cleanup here anyway:

 * the connection state will get (un)set as part of the disconnect
   process (which cfg80211 already initiates for us)
 * the interface type doesn't actually need to be cleared at all (it'll
   trigger a WARN_ON() in cfg80211 if we do)
 * the iee80211_ptr isn't really "ours" to clear anyway

So stop resetting those 3 things.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: unregister wiphy before freeing resources
Brian Norris [Tue, 25 Jul 2017 01:13:21 +0000 (18:13 -0700)]
mwifiex: unregister wiphy before freeing resources

It's possible for some control interfaces (e.g., scans, set freq) to be
active after we've stopped our main work queue and the netif TX queues.
These don't get completely shut out until we've unregistered the wdevs
and wiphy.

So let's only free command buffers and poison our lists after
wiphy_unregister().

This resolves various use-after-free issues seen when resetting the
device.

Cc: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: re-register wiphy across reset
Brian Norris [Tue, 25 Jul 2017 01:13:20 +0000 (18:13 -0700)]
mwifiex: re-register wiphy across reset

In general, it's helpful to use the same code for device removal as for
device reset, as this tends to have fewer bugs. Let's move the wiphy
unregistration code into the common reset and removal code.

In particular, it's very hard to properly handle the reset sequence when
something fails. Currently, if mwifiex_reinit_sw() fails, we've failed
to unregister the associated wiphy, and so running something as simple
as "iw phy" can trigger an OOPS, as the wiphy still has hooks back into
freed mwifiex data structures. For example, KASAN complained:

[... see reset fail for other reasons ...]
[ 1184.821158] mwifiex_pcie 0000:01:00.0: info: dnld wifi firmware from 174948 bytes
[ 1186.870914] mwifiex_pcie 0000:01:00.0: info: FW download over, size 608396 bytes
[ 1187.685990] mwifiex_pcie 0000:01:00.0: WLAN FW is active
[ 1187.692673] mwifiex_pcie 0000:01:00.0: cmd_wait_q terminated: -512
[ 1187.699075] mwifiex_pcie 0000:01:00.0: info: _mwifiex_fw_dpc: unregister device
[ 1187.713476] mwifiex: Failed to bring up adapter: -5
[ 1187.718644] mwifiex_pcie 0000:01:00.0: reinit failed: -5

[... run `iw phy` ...]
[ 1212.902419] ==================================================================
[ 1212.909806] BUG: KASAN: use-after-free in mwifiex_cfg80211_get_antenna+0x54/0xfc [mwifiex] at addr ffffffc0ad1a8028
[ 1212.920246] Read of size 1 by task iw/3127
[...]
[ 1212.934946] page dumped because: kasan: bad access detected
[...]
[ 1212.950665] Call trace:
[ 1212.953148] [<ffffffc00020a69c>] dump_backtrace+0x0/0x190
[ 1212.958572] [<ffffffc00020a96c>] show_stack+0x20/0x28
[ 1212.963648] [<ffffffc0005ce18c>] dump_stack+0xa4/0xcc
[ 1212.968723] [<ffffffc0003c4430>] kasan_report+0x378/0x500
[ 1212.974140] [<ffffffc0003c3358>] __asan_load1+0x44/0x4c
[ 1212.979462] [<ffffffbffc2e8360>] mwifiex_cfg80211_get_antenna+0x54/0xfc [mwifiex]
[ 1212.987131] [<ffffffbffc084fc4>] nl80211_send_wiphy+0x75c/0x2de0 [cfg80211]
[ 1212.994246] [<ffffffbffc094f60>] nl80211_dump_wiphy+0x32c/0x438 [cfg80211]
[ 1213.001149] [<ffffffc000ab6404>] genl_lock_dumpit+0x48/0x64
[ 1213.006746] [<ffffffc000ab3474>] netlink_dump+0x178/0x398
[ 1213.012171] [<ffffffc000ab3d18>] __netlink_dump_start+0x1bc/0x260
[...]

This all goes away if we just tear down the wiphy on the way down, and
set it back up if/when we bring the device back up.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: pcie: don't allow cmd buffer reuse after reset
Brian Norris [Tue, 25 Jul 2017 01:13:19 +0000 (18:13 -0700)]
mwifiex: pcie: don't allow cmd buffer reuse after reset

In rogue cases (due to other bugs) it's possible we try to process an
old command response *after* resetting the device. This could trigger a
double-free (or the SKB can get reallocated elsewhere...causing other
memory corruptions) in mwifiex_pcie_process_cmd_complete().

For safety (and symmetry) let's always NULL out the command buffer as we
free it up. We're already doing this for the command response buffer.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: reset interrupt status across device reset
Brian Norris [Tue, 25 Jul 2017 01:13:18 +0000 (18:13 -0700)]
mwifiex: reset interrupt status across device reset

When resetting the device, we might have queued up interrupts that
didn't get a chance to finish processing. We really don't need to handle
them at this point; we just want to make sure they don't cause us to try
to process old commands from before the device was reset.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: reunite copy-and-pasted remove/reset code
Brian Norris [Tue, 25 Jul 2017 01:13:17 +0000 (18:13 -0700)]
mwifiex: reunite copy-and-pasted remove/reset code

When PCIe FLR code was added, it explicitly copy-and-pasted much of
mwifiex_remove_card() into mwifiex_shutdown_sw(). This is unnecessary,
as almost all of the code should be reused.

Let's reunite what we can for now.

The only functional changes for now:

 * call netif_device_detach() in the remove() code path -- this wasn't
   done before, but it really should be a no-op, when the device is
   getting totally unregistered soon anyway

 * call the ->down_dev() driver callback only after we've finished all
   SW teardown -- this should have no significant effect, since the only
   user (pcie.c) does very minimal work there, and it doesn't matter
   that we reorder this

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: fix static checker warning
Amitkumar Karwar [Tue, 11 Jul 2017 14:27:53 +0000 (19:57 +0530)]
rsi: fix static checker warning

u32 pointer is changed to u16 and filled the value. Problem is
solved by using local temporary variable. Below static checker
warning was reported.

drivers/net/wireless/rsi/rsi_91x_usb.c:400 rsi_usb_master_reg_read()
        warn: passing casted pointer 'value' to 'rsi_usb_reg_read()'
32 vs 16.

Fixes: b97e9b94ad75c ("rsi: Add new host interface operations")
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: check length before USB read/write register
Amitkumar Karwar [Tue, 11 Jul 2017 14:27:52 +0000 (19:57 +0530)]
rsi: check length before USB read/write register

These checks are required. Otherwise we may end up getting
memory corruption if invalid length is passed.

Fixes: b97e9b94ad75c ("rsi: Add new host interface operations")
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: use macro for allocating USB buffer
Amitkumar Karwar [Tue, 11 Jul 2017 14:27:51 +0000 (19:57 +0530)]
rsi: use macro for allocating USB buffer

4 bytes is fixed size for reading or writing USB register. We
will use a macro instead of hardcoding this.

Fixes: b97e9b94ad75c ("rsi: Add new host interface operations")
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: regulatory enhancements
Prameela Rani Garnepudi [Mon, 10 Jul 2017 12:40:48 +0000 (18:10 +0530)]
rsi: regulatory enhancements

Below regulatory changes are included this patch
* Country code is saved as it will be used in bgscan.
* Region codes are mapped according to RSI region codes.
* Radar flag settings are moved under the check if 5GHZ band
  is enabled.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: Send rx filter frame to device when interface is down
Prameela Rani Garnepudi [Mon, 10 Jul 2017 12:40:47 +0000 (18:10 +0530)]
rsi: Send rx filter frame to device when interface is down

When interface is down it is better to stop all RX packets to
host. 0xffff will block all packets to host.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: Remove internal header from Tx status skb
Prameela Rani Garnepudi [Mon, 10 Jul 2017 12:40:46 +0000 (18:10 +0530)]
rsi: Remove internal header from Tx status skb

Device specific descriptor for each TX packet is prepared on top of
skb data address. This descriptor should be pulled out before
indicating the TX status to mac80211.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: update tx command frame block/unblock data
Prameela Rani Garnepudi [Mon, 10 Jul 2017 12:40:45 +0000 (18:10 +0530)]
rsi: update tx command frame block/unblock data

TX command frame block/unblock data is modified to
use common descriptor structure.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: block/unblock data queues as per connection status
Prameela Rani Garnepudi [Mon, 10 Jul 2017 12:40:44 +0000 (18:10 +0530)]
rsi: block/unblock data queues as per connection status

Data queues should be unblocked after station add notify frame
is sent and should be blocked after station delete notify is sent.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: update autorate request command frame
Prameela Rani Garnepudi [Mon, 10 Jul 2017 12:40:43 +0000 (18:10 +0530)]
rsi: update autorate request command frame

When Short Gaurd Interval is enabled bit 9 is set in rate. Otherwise
it should not be set. Added missing 'else' case in this patch.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: set_key enhancements
Prameela Rani Garnepudi [Mon, 10 Jul 2017 12:40:42 +0000 (18:10 +0530)]
rsi: set_key enhancements

Broadcast bit to be set for broadcast and multicast packets.
For remove_key, tx and rx mic need not be filled.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>