linux-2.6-block.git
4 years agortw88: remove redundant null pointer check on arrays
Colin Ian King [Fri, 25 Oct 2019 11:30:56 +0000 (12:30 +0100)]
rtw88: remove redundant null pointer check on arrays

The checks to see if swing_table->n or swing_table->p are null are
redundant since n and p are arrays and can never be null if
swing_table is non-null.  I believe these are redundant checks
and can be safely removed, especially the checks implies that these
are not arrays which can lead to confusion.

Addresses-Coverity: ("Array compared against 0")
Fixes: c97ee3e0bea2 ("rtw88: add power tracking support")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: avoid FW info flood
Yan-Hsuan Chuang [Fri, 25 Oct 2019 09:33:45 +0000 (17:33 +0800)]
rtw88: avoid FW info flood

The FW info was printed everytime driver is powered on, such as
leaving IDLE state. It will flood the kernel log.

Move the FW info printing to callback when FW is loaded, so
that will only be printed once when device is probed.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: fix potential read outside array boundary
Tzu-En Huang [Fri, 25 Oct 2019 09:33:44 +0000 (17:33 +0800)]
rtw88: fix potential read outside array boundary

The level of cckpd is from 0 to 4, and it is the index of
array pd_lvl[] and cs_lvl[]. However, the length of both arrays
are 4, which is smaller than the possible maximum input index.
Enumerate cck level to make sure the max level will not be wrong
if new level is added in future.

Fixes: 479c4ee931a6 ("rtw88: add dynamic cck pd mechanism")
Signed-off-by: Tzu-En Huang <tehuang@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: rearrange if..else statements for rx rate indexes
Yan-Hsuan Chuang [Fri, 25 Oct 2019 09:33:43 +0000 (17:33 +0800)]
rtw88: rearrange if..else statements for rx rate indexes

Driver just memset() rx_status to 0 before assigning rate indexes.
And driver could never hit the 'else' because the driver checks
if 'pkt_stat->rate >= DESC_RATEMCS0', so the 'else' statement can
be removed.

Also rearrange the if..else statements because DESC_RATEMCS0 is
actually larger than DESC_RATE1M ~ DESC_RATE54M, move the check
of 'pkt_stat->rate >= DESC_RATEMCS0' to the last to keep an
increasing order.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: use rtw_phy_pg_cfg_pair struct, not arrays
Yan-Hsuan Chuang [Fri, 25 Oct 2019 09:33:41 +0000 (17:33 +0800)]
rtw88: use rtw_phy_pg_cfg_pair struct, not arrays

Use proper struct for BB PG tables.

TODO: we need to find a way to store the tables that have
      condition values.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: 8822b: add RFE type 3 support
Yan-Hsuan Chuang [Fri, 25 Oct 2019 09:33:40 +0000 (17:33 +0800)]
rtw88: 8822b: add RFE type 3 support

Some of the modules use RFE type 3, add corresponding tables
for them.

Tested-by: G.schlmm <g.schlmm@googlemail.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: fix sparse warnings for power tracking
Yan-Hsuan Chuang [Fri, 25 Oct 2019 08:32:00 +0000 (16:32 +0800)]
rtw88: fix sparse warnings for power tracking

sparse warnings:
    drivers/net/wireless/realtek/rtw88/rtw8822b.c:1440:6: sparse: sparse:
    symbol 'rtw8822b_pwr_track' was not declared. Should it be static?
    drivers/net/wireless/realtek/rtw88/rtw8822c.c:1008:6: sparse: sparse:
    symbol 'rtw8822c_pwrtrack_init' was not declared. Should it be static?

Fixes: c97ee3e0bea2 ("rtw88: add power tracking support")
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: fix sparse warnings for DPK
Yan-Hsuan Chuang [Fri, 25 Oct 2019 08:31:59 +0000 (16:31 +0800)]
rtw88: fix sparse warnings for DPK

sparse warnings:
    drivers/net/wireless/realtek/rtw88/rtw8822c.c:2871:6: sparse:
sparse: symbol 'rtw8822c_dpk_cal_coef1' was not declared. Should it be
static?
    drivers/net/wireless/realtek/rtw88/rtw8822c.c:3112:6: sparse:
sparse: symbol 'rtw8822c_dpk_track' was not declared. Should it be
static?

Fixes: 5227c2ee453d ("rtw88: 8822c: add SW DPK support")
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agoMerge tag 'iwlwifi-next-for-kalle-2019-10-18-2' of git://git.kernel.org/pub/scm/linux...
Kalle Valo [Fri, 25 Oct 2019 07:42:15 +0000 (10:42 +0300)]
Merge tag 'iwlwifi-next-for-kalle-2019-10-18-2' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

Patches intended for v5.5

* Revamp the debugging infrastructure;
* Some udpdates to FW API commands;
* Fix max amsdu value calculation;
* Small updates in the debugging infra;
* Some new helper functions;
* A few clean-ups;
* Other small fixes and improvements;

4 years agortw88: fix GENMASK_ULL for u64
Yan-Hsuan Chuang [Thu, 24 Oct 2019 09:19:48 +0000 (17:19 +0800)]
rtw88: fix GENMASK_ULL for u64

This fixes compile warning:

    In file included from include/linux/bitops.h:5:0,
                     from include/linux/kernel.h:12,
                     from include/asm-generic/bug.h:19,
                     from arch/mips/include/asm/bug.h:42,
                     from include/linux/bug.h:5,
                     from include/net/mac80211.h:16,
                     from drivers/net/wireless/realtek/rtw88/main.h:8,
                     from drivers/net/wireless/realtek/rtw88/main.c:5:
    drivers/net/wireless/realtek/rtw88/main.c: In function 'rtw_update_rate_mask':
      include/linux/bits.h:23:11: warning: right shift count is negative
      [-Wshift-count-negative]
       (~UL(0) >> (BITS_PER_LONG - 1 - (h))))
               ^
    drivers/net/wireless/realtek/rtw88/main.c:622:17: note: in expansion of macro 'GENMASK'
      u64 cfg_mask = GENMASK(63, 0);
                     ^~~~~~~

Reported-by: kbuild test robot <lkp@intel.com>
Fixes: f39e9bd49a3d ("rtw88: add set_bitrate_mask support")
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agoiwlwifi: rx: use new api to get band from rx mpdu
Tova Mussai [Thu, 1 Aug 2019 11:00:24 +0000 (14:00 +0300)]
iwlwifi: rx: use new api to get band from rx mpdu

The FW introduce new API to get the band from the rx mpdu,
use this new API.

Signed-off-by: Tova Mussai <tova.mussai@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: nvm: create function to convert channel index to nl80211_band
Tova Mussai [Wed, 31 Jul 2019 08:19:26 +0000 (11:19 +0300)]
iwlwifi: nvm: create function to convert channel index to nl80211_band

Create function to convert channel index to nl80211_band
and use it.

Signed-off-by: Tova Mussai <tova.mussai@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: mvm: Invert the condition for OFDM rate
Tova Mussai [Sun, 28 Jul 2019 10:51:07 +0000 (13:51 +0300)]
iwlwifi: mvm: Invert the condition for OFDM rate

OFDM rate used for all bands except to band 2.4 which use CCK rate.
Inverting the condition help that in future we won't need to expand the
condition for more bands.

Signed-off-by: Tova Mussai <tova.mussai@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: mvm: create function to convert nl80211 band to phy band
Tova Mussai [Wed, 31 Jul 2019 06:06:31 +0000 (09:06 +0300)]
iwlwifi: mvm: create function to convert nl80211 band to phy band

Create the function and use it.

Signed-off-by: Tova Mussai <tova.mussai@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: dbg_ini: use vzalloc to allocate dumping memory regions
Shahar S Matityahu [Sun, 4 Aug 2019 11:06:45 +0000 (14:06 +0300)]
iwlwifi: dbg_ini: use vzalloc to allocate dumping memory regions

During dump flow, the driver allocates spaces to store the memory
regions that will be included in the dump. These regions can be very
large so in order to avoid allocation failure, use vzalloc instead.
The kmalloc uses GFP_KERNEL and the driver does not make any use of the
fact that the memory is contiguous so the same functionality is
maintained.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: dbg_ini: add user trigger support
Shahar S Matityahu [Sun, 4 Aug 2019 07:57:16 +0000 (10:57 +0300)]
iwlwifi: dbg_ini: add user trigger support

Allow to fire user trigger in ini mode

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: mvm: add notification for missed VAP
Lior Cohen [Thu, 18 Jul 2019 08:37:48 +0000 (11:37 +0300)]
iwlwifi: mvm: add notification for missed VAP

A missed VAP notification will be sent from umac when
the station is out of sync with its associated non-transmitted
BSSID. The notification will be sent only if the transmitted
BSSID is an EMA-AP one.

The driver will consider this notification as connection loss.

Signed-off-by: Lior Cohen <lior2.cohen@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: mvm: fix old-style declaration
YueHaibing [Fri, 26 Jul 2019 14:18:38 +0000 (22:18 +0800)]
iwlwifi: mvm: fix old-style declaration

There expect the 'static' keyword to come first in a
declaration, and we get warnings like this with "make W=1":

drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c:427:1: warning:
 'static' is not at beginning of declaration [-Wold-style-declaration]
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c:434:1: warning:
 'static' is not at beginning of declaration [-Wold-style-declaration]

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: mvm: use the new session protection command
Emmanuel Grumbach [Thu, 11 Jul 2019 18:44:42 +0000 (21:44 +0300)]
iwlwifi: mvm: use the new session protection command

The firmware has now a new session protection command.
This new API allows the firmware to manage the protection
needed for association. It'll also remove the event when
the association is complete.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: mvm: remove leftover rs_remove_sta_debugfs() prototype
Johannes Berg [Fri, 26 Jul 2019 11:21:46 +0000 (13:21 +0200)]
iwlwifi: mvm: remove leftover rs_remove_sta_debugfs() prototype

This prototype is no longer used, remove it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: mvm: add support for new version for D0I3_END_CMD
Haim Dreyfuss [Tue, 23 Jul 2019 15:27:45 +0000 (18:27 +0300)]
iwlwifi: mvm: add support for new version for D0I3_END_CMD

During D3 state there are some flows which requires FW reset.
Add new API to support it.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: mvm: consider ieee80211 station max amsdu value
Mordechay Goodstein [Sun, 28 Jul 2019 17:09:22 +0000 (20:09 +0300)]
iwlwifi: mvm: consider ieee80211 station max amsdu value

debugfs amsdu_len sets only the max_amsdu_len for ieee80211 station
so take it into consideration while getting max amsdu

Fixes: af2984e9e625 ("iwlwifi: mvm: add a debugfs entry to set a fixed size AMSDU for all TX packets")
Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: dbg_ini: support FW notification dumping in case of missed beacon
Shahar S Matityahu [Thu, 25 Jul 2019 10:25:07 +0000 (13:25 +0300)]
iwlwifi: dbg_ini: support FW notification dumping in case of missed beacon

Pass the FW notification packet to the dump collection flow to allow
the driver to include it in the dump file if requested.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: dbg_ini: remove old API and some related code
Shahar S Matityahu [Tue, 23 Jul 2019 12:27:14 +0000 (15:27 +0300)]
iwlwifi: dbg_ini: remove old API and some related code

Remove unused code of the old debug ini API.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: dbg_ini: rename external debug configuration file
Shahar S Matityahu [Tue, 23 Jul 2019 12:24:54 +0000 (15:24 +0300)]
iwlwifi: dbg_ini: rename external debug configuration file

Rename the external configuration file to align to the debug SAS.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: dbg_ini: support FW response/notification region type
Shahar S Matityahu [Tue, 23 Jul 2019 12:22:25 +0000 (15:22 +0300)]
iwlwifi: dbg_ini: support FW response/notification region type

Allow the driver to collect FW response/notification region type
during dump and allow triggering dump collection for a given FW
response/notification.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: dbg_ini: support domain changing via debugfs
Shahar S Matityahu [Wed, 24 Jul 2019 15:52:23 +0000 (18:52 +0300)]
iwlwifi: dbg_ini: support domain changing via debugfs

Allow to change or read the debug domain bitmap at runtime via
fw_dbg_domain debugfs.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: dbg_ini: add periodic trigger new API support
Shahar S Matityahu [Tue, 23 Jul 2019 12:10:59 +0000 (15:10 +0300)]
iwlwifi: dbg_ini: add periodic trigger new API support

Enable periodic trigger.
Allows the driver to trigger dump collection in constant intervals.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: dbg_ini: implement monitor allocation flow
Shahar S Matityahu [Tue, 23 Jul 2019 11:37:45 +0000 (14:37 +0300)]
iwlwifi: dbg_ini: implement monitor allocation flow

Allow allocating fragmented buffers for several allocation IDs.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: dbg_ini: implement time point handling
Shahar S Matityahu [Tue, 23 Jul 2019 11:26:49 +0000 (14:26 +0300)]
iwlwifi: dbg_ini: implement time point handling

Calculate active triggers list and implement time points handling.
Also allow to override the debug domain via iwl-dbg-cfg.ini by setting
FW_DBG_DOMAIN field.

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: dbg_ini: add TLV allocation new API support
Shahar S Matityahu [Tue, 23 Jul 2019 10:41:44 +0000 (13:41 +0300)]
iwlwifi: dbg_ini: add TLV allocation new API support

Add new debug TLVs API preprocessing.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: dbg_ini: use new API in dump info
Shahar S Matityahu [Tue, 23 Jul 2019 09:50:25 +0000 (12:50 +0300)]
iwlwifi: dbg_ini: use new API in dump info

Make dump info region use new API.
debug_info_tlv_list list will be initialize in a future patch once the
driver will start using it.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: dbg_ini: add error tables dumping support
Shahar S Matityahu [Tue, 23 Jul 2019 09:47:13 +0000 (12:47 +0300)]
iwlwifi: dbg_ini: add error tables dumping support

Allow to collect error table data.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: dbg_ini: add monitor dumping support
Shahar S Matityahu [Tue, 23 Jul 2019 09:34:49 +0000 (12:34 +0300)]
iwlwifi: dbg_ini: add monitor dumping support

Allow collecting monitor data in ini debug mode.
Implement both SMEM and DRAM monitor regions dumping.
For DRAM monitor, support DBGC1, DBGC2 and DBGC3 and support several
DRAM fragments per DBGC.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: dbg: remove multi buffers infra
Shahar S Matityahu [Mon, 22 Jul 2019 12:31:13 +0000 (15:31 +0300)]
iwlwifi: dbg: remove multi buffers infra

Legacy DRAM monitor does not support multi buffers.
Remove this infra.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: dbg_ini: use new trigger TLV in dump flow
Shahar S Matityahu [Tue, 23 Jul 2019 08:38:36 +0000 (11:38 +0300)]
iwlwifi: dbg_ini: use new trigger TLV in dump flow

Make dump flow use the new trigger TLV.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: dbg_ini: use new region TLV in dump flow
Shahar S Matityahu [Tue, 23 Jul 2019 08:00:47 +0000 (11:00 +0300)]
iwlwifi: dbg_ini: use new region TLV in dump flow

Make dump flow use the new region TLV and update the region type enum.
Temporarily remove monitor dumping support. Support will be readded in a
future patch.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agoiwlwifi: dbg_ini: load external dbg cfg after internal cfg is loaded
Shahar S Matityahu [Mon, 8 Jul 2019 07:52:14 +0000 (10:52 +0300)]
iwlwifi: dbg_ini: load external dbg cfg after internal cfg is loaded

In the new API implementation the driver does not keep the internal and
external debug configurations in separate structs so the last
configuration that is loaded overrides the previous ones (this is true
only in some of the TLVs e.g. the buffer allocation TLV).
Load the external configuration after the internal is loaded so that
user configuration will override the default coming with the FW.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
4 years agortl8xxxu: fix warnings for symbol not declared
Chris Chiu [Wed, 23 Oct 2019 10:54:07 +0000 (18:54 +0800)]
rtl8xxxu: fix warnings for symbol not declared

Fix the following sparse warnings.
sparse: symbol 'rtl8723bu_set_coex_with_type' was not declared.
Should it be static?
sparse: symbol 'rtl8723bu_update_bt_link_info' was not declared.
Should it be static?
sparse: symbol 'rtl8723bu_handle_bt_inquiry' was not declared.
Should it be static?
sparse: symbol 'rtl8723bu_handle_bt_info' was not declared.
Should it be static?

Signed-off-by: Chris Chiu <chiu@endlessm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortl8xxxu: remove set but not used variable 'rate_mask'
YueHaibing [Wed, 23 Oct 2019 07:53:42 +0000 (15:53 +0800)]
rtl8xxxu: remove set but not used variable 'rate_mask'

drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c:4484:6:
 warning: variable rate_mask set but not used [-Wunused-but-set-variable]

It is never used since commit a9bb0b515778 ("rtl8xxxu: Improve
TX performance of RTL8723BU on rtl8xxxu driver")

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agoatmel: remove set but not used variable 'dev'
YueHaibing [Wed, 23 Oct 2019 07:40:19 +0000 (15:40 +0800)]
atmel: remove set but not used variable 'dev'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/net/wireless/atmel/atmel_cs.c:120:21:
 warning: variable dev set but not used [-Wunused-but-set-variable]

It is never used, so can remove it.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agoadm80211: remove set but not used variables 'mem_addr' and 'io_addr'
YueHaibing [Wed, 23 Oct 2019 07:38:42 +0000 (15:38 +0800)]
adm80211: remove set but not used variables 'mem_addr' and 'io_addr'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/net/wireless/admtek/adm8211.c:1784:16:
 warning: variable mem_addr set but not used [-Wunused-but-set-variable]
drivers/net/wireless/admtek/adm8211.c:1785:15:
 warning: variable io_addr set but not used [-Wunused-but-set-variable]

They are never used, so can be removed.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortlwifi: Remove unnecessary NULL check in rtl_regd_init
Nathan Chancellor [Wed, 23 Oct 2019 00:47:03 +0000 (17:47 -0700)]
rtlwifi: Remove unnecessary NULL check in rtl_regd_init

When building with Clang + -Wtautological-pointer-compare:

drivers/net/wireless/realtek/rtlwifi/regd.c:389:33: warning: comparison
of address of 'rtlpriv->regd' equal to a null pointer is always false
[-Wtautological-pointer-compare]
        if (wiphy == NULL || &rtlpriv->regd == NULL)
                              ~~~~~~~~~^~~~    ~~~~
1 warning generated.

The address of an array member is never NULL unless it is the first
struct member so remove the unnecessary check. This was addressed in
the staging version of the driver in commit f986978b32b3 ("Staging:
rtlwifi: remove unnecessary NULL check").

While we are here, fix the following checkpatch warning:

CHECK: Comparison to NULL could be written "!wiphy"
35: FILE: drivers/net/wireless/realtek/rtlwifi/regd.c:389:
+       if (wiphy == NULL)

Fixes: 0c8173385e54 ("rtl8192ce: Add new driver")
Link:https://github.com/ClangBuiltLinux/linux/issues/750
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: add phy_info debugfs to show Tx/Rx physical status
Tsang-Shian Lin [Tue, 22 Oct 2019 10:04:20 +0000 (18:04 +0800)]
rtw88: add phy_info debugfs to show Tx/Rx physical status

This commit adds several Tx/Rx physical information to phy_info
debugfs for 8822B/8822C. By this debugfs, we can know physical
information, such as Tx/Rx rate, RSSI, EVM,SNR, etc. The
information is gotten from the packets of Tx/Rx path. It has
no impact for the performance of 8822B/8822C.

In the fields, we may meet different kinds of problems, but
we may have no professional instrument to check them. At
this moment, this debugfs is a good tool, and it may provide
useful information for debug.

Signed-off-by: Tsang-Shian Lin <thlin@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Reviewed-by: Chris Chiu <chiu@endlessm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: add set_bitrate_mask support
Tzu-En Huang [Tue, 22 Oct 2019 10:04:19 +0000 (18:04 +0800)]
rtw88: add set_bitrate_mask support

Support setting bit rate from upper layer.
After configuring the original rate control result in the driver, the
result is then masked by the bit rate mask received from the ops
set_bitrate_mask. Lastly, the masked result will be sent to firmware.

Signed-off-by: Tzu-En Huang <tehuang@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Reviewed-by: Chris Chiu <chiu@endlessm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: Enable 802.11ac beamformee support
Tzu-En Huang [Tue, 22 Oct 2019 10:04:18 +0000 (18:04 +0800)]
rtw88: Enable 802.11ac beamformee support

Enable MU-MIMO transmit beamformee support for chipset 8822b and 8822c.

If the driver is in station mode and associated with an AP, and the
capabilities of both meet the requirement of beamforming, driver will
run as a beamformee and the corresponding chip settings will be set.

In addition, module parameter support_bf is added to enable or disable
beamforming. Sometimes driver will need to disable for inter-operate
issues, and it would be easier for driver to debug.

Signed-off-by: Tzu-En Huang <tehuang@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: add power tracking support
Tzu-En Huang [Tue, 22 Oct 2019 10:04:17 +0000 (18:04 +0800)]
rtw88: add power tracking support

The temperature of the chip can affect the output power
of the RF components. Hence driver requires to compensate
the power by adjusting the power index recorded in the
power swing table.

And if the difference of current thermal value to the
default thermal value exceeds a threshold, the RF IQK
should be triggered to re-calibrate the characteristics
of the RF components, to keep the output IQ vectors of
the RF components orthogonal enough.

Signed-off-by: Tzu-En Huang <tehuang@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Reviewed-by: Chris Chiu <chiu@endlessm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: use macro to check the current band
Yan-Hsuan Chuang [Tue, 22 Oct 2019 10:04:16 +0000 (18:04 +0800)]
rtw88: use macro to check the current band

Add macros to see which band we are, based on the current channel.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agobcma: fix block comment style
Yadav Lamichhane [Mon, 21 Oct 2019 18:05:13 +0000 (23:35 +0530)]
bcma: fix block comment style

Fix a coding style issue.

Signed-off-by: Yadav Lamichhane <tuxomega1@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortl8xxxu: fix RTL8723BU connection failure issue after warm reboot
Chris Chiu [Wed, 16 Oct 2019 01:54:08 +0000 (09:54 +0800)]
rtl8xxxu: fix RTL8723BU connection failure issue after warm reboot

The RTL8723BU has problems connecting to AP after each warm reboot.
Sometimes it returns no scan result, and in most cases, it fails
the authentication for unknown reason. However, it works totally
fine after cold reboot.

Compare the value of register SYS_CR and SYS_CLK_MAC_CLK_ENABLE
for cold reboot and warm reboot, the registers imply that the MAC
is already powered and thus some procedures are skipped during
driver initialization. Double checked the vendor driver, it reads
the SYS_CR and SYS_CLK_MAC_CLK_ENABLE also but doesn't skip any
during initialization based on them. This commit only tells the
RTL8723BU to do full initialization without checking MAC status.

Signed-off-by: Chris Chiu <chiu@endlessm.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: mark rtw_fw_hdr __packed
Brian Norris [Mon, 14 Oct 2019 21:26:48 +0000 (14:26 -0700)]
rtw88: mark rtw_fw_hdr __packed

The use of u8 and __le16 in this struct assumes that it's going to be
packed to byte alignment. C doesn't guarantee that, so we should mark
this __packed.

Fixes: cc20a7139836 ("rtw88: use struct rtw_fw_hdr to access firmware header")
Cc: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agonet/wireless: Delete unnecessary checks before the macro call “dev_kfree_skb”
Markus Elfring [Thu, 22 Aug 2019 08:20:10 +0000 (10:20 +0200)]
net/wireless: Delete unnecessary checks before the macro call “dev_kfree_skb”

The dev_kfree_skb() function performs also input parameter validation.
Thus the test around the shown calls is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agowireless: Remove call to memset after dma_alloc_coherent
Fuqian Huang [Mon, 15 Jul 2019 03:19:41 +0000 (11:19 +0800)]
wireless: Remove call to memset after dma_alloc_coherent

In commit 518a2f1925c3
("dma-mapping: zero memory returned from dma_alloc_*"),
dma_alloc_coherent has already zeroed the memory.
So memset is not needed.

Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: include interrupt.h for tasklet_struct
Brian Norris [Sat, 12 Oct 2019 01:44:21 +0000 (18:44 -0700)]
rtw88: include interrupt.h for tasklet_struct

Depending on implicit header includes, we might see this compilation
error:

.../main.h:1391:24: error: field has incomplete type 'struct tasklet_struct'
        struct tasklet_struct tx_tasklet;
                              ^

Fixes: 3745d3e550d1 ("rtw88: add driver TX queue support")
Signed-off-by: Brian Norris <briannorris@chromium.org>
Acked-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: use a for loop in rtw_power_mode_change(), not goto
Brian Norris [Sat, 12 Oct 2019 01:27:20 +0000 (18:27 -0700)]
rtw88: use a for loop in rtw_power_mode_change(), not goto

No change in logic.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Acked-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: coex: Set 4 slot mode for A2DP
Ping-Ke Shih [Tue, 8 Oct 2019 08:21:00 +0000 (16:21 +0800)]
rtw88: coex: Set 4 slot mode for A2DP

With shallow buffer size, certain BT devices have active
A2DP flow control to fill buffer frequently. If the slot
is not at BT side, data can't be sent successfully to BT
devices, and will cause audio glitch.

To resolve this issue, this commit splits TUs into 4-slots
instead of 2-slot for all of the A2DP related coexistence
strategies. That makes BT have higher opportunity to fill
the A2DP buffer in time, and the audio quality could be
more stable and smooth.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: pci: config phy after chip info is setup
Yan-Hsuan Chuang [Tue, 8 Oct 2019 08:20:59 +0000 (16:20 +0800)]
rtw88: pci: config phy after chip info is setup

Chip info such as cut_version is required to configure
PCI phy. Move rtw_pci_phy_config after rtw_chip_info_setup.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: Use rtw_write8_set to set SYS_FUNC
Yan-Hsuan Chuang [Tue, 8 Oct 2019 08:20:58 +0000 (16:20 +0800)]
rtw88: Use rtw_write8_set to set SYS_FUNC

rtw_write8 could modify the values that we do not want
to change, use rtw_write8_set instead to only enable the
bits of sys_func_en

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: add NL80211_EXT_FEATURE_CAN_REPLACE_PTK0 support
Tzu-En Huang [Tue, 8 Oct 2019 08:20:57 +0000 (16:20 +0800)]
rtw88: add NL80211_EXT_FEATURE_CAN_REPLACE_PTK0 support

Add support for NL80211_EXT_FEATURE_CAN_REPLACE_PTK0 feature.
According to the "Hardware crypto acceleration" documentation section,
when set_key() is called with %DISABLE_KEY command, for outgoing frames,
we flush out frames in the queues with the old key; for incoming frames,
no frames will be passed to mac80211 decrypted with the old key due to
rtw_sec_clear_cam().

Signed-off-by: Tzu-En Huang <tehuang@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: config 8822c multicast address in MAC init flow
Tzu-En Huang [Tue, 8 Oct 2019 08:20:54 +0000 (16:20 +0800)]
rtw88: config 8822c multicast address in MAC init flow

Multicast address should be congiured in the initialization flow.
The value is created by a hashed calculation that is also implemented
by the hardware for multicast address filtering.

Signed-off-by: Tzu-En Huang <tehuang@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortlwifi: rtl8192se: Convert inline routines to little-endian words
Larry Finger [Wed, 9 Oct 2019 17:37:11 +0000 (12:37 -0500)]
rtlwifi: rtl8192se: Convert inline routines to little-endian words

In this step, the read/write routines for the descriptors are converted
to use __le32 quantities, thus a lot of casts can be removed. Callback
routines still use the 8-bit arrays, but these are changed within the
specified routine.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortlwifi: rtl8192se: Convert macros that set descriptor
Larry Finger [Wed, 9 Oct 2019 17:37:10 +0000 (12:37 -0500)]
rtlwifi: rtl8192se: Convert macros that set descriptor

As a first step in the conversion, the macros that set the RX and TX
descriptors are converted to static inline routines, and the names are
changed from upper to lower case. To minimize the changes in a given
step, the input descriptor information is left as as a byte array
(u8 *), even though it should be a little-endian word array (__le32 *).
That will be changed in the next patch.

Several places where checkpatch.pl complains about a space after a cast
and other warnings are fixed.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortlwifi: rtl8192se: Replace local bit manipulation macros
Larry Finger [Wed, 9 Oct 2019 17:37:09 +0000 (12:37 -0500)]
rtlwifi: rtl8192se: Replace local bit manipulation macros

This driver uses a set of local macros to manipulate the RX and TX
descriptors, which are all little-endian quantities. These macros
are replaced by the bitfield macros le32p_replace_bits() and
le32_get_bits(). In several places, the macros operated on an entire
32-bit word. In these cases, a direct read or replacement is used.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortlwifi: rtl8192se: Remove unused GET_XXX and SET_XXX
Larry Finger [Wed, 9 Oct 2019 17:37:08 +0000 (12:37 -0500)]
rtlwifi: rtl8192se: Remove unused GET_XXX and SET_XXX

As the first step in converting from macros that get/set information
in the RX and TX descriptors, unused macros are being removed.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agowlcore: clean-up clearing of WL1271_FLAG_IRQ_RUNNING
Tony Lindgren [Wed, 9 Oct 2019 16:50:06 +0000 (09:50 -0700)]
wlcore: clean-up clearing of WL1271_FLAG_IRQ_RUNNING

We set WL1271_FLAG_IRQ_RUNNING in the beginning of wlcore_irq(), but clear
it before interrupt handling is done in wlcore_irq_locked().

Let's move the clearing to the end of wlcore_irq() where it gets set,
and remove the old comments about hardirq. That's no longer the case as
we're using request_threaded_irq().

Note that the WL1271_FLAG_IRQ_RUNNING should never race between the
interrupt handler and wlcore_runtime_resume() as because of autosuspend
timeout we cannot enter idle between wlcore_irq_locked() and the end of
wlcore_irq().

Cc: Anders Roxell <anders.roxell@linaro.org>
Cc: Eyal Reizer <eyalr@ti.com>
Cc: Guy Mishol <guym@ti.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortlwifi: rtl8192ee: Remove set but not used variable 'err'
zhengbin [Wed, 9 Oct 2019 09:08:27 +0000 (17:08 +0800)]
rtlwifi: rtl8192ee: Remove set but not used variable 'err'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.c: In function rtl92ee_download_fw:
drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.c:111:6: warning: variable err set but not used [-Wunused-but-set-variable]

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortlwifi: rtl8192ee: Remove set but not used variable 'cur_tx_wp'
zhengbin [Tue, 8 Oct 2019 02:01:40 +0000 (10:01 +0800)]
rtlwifi: rtl8192ee: Remove set but not used variable 'cur_tx_wp'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c: In function rtl92ee_is_tx_desc_closed:
drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c:1005:18: warning: variable cur_tx_wp set but not used [-Wunused-but-set-variable]

It is not used since commit cf54622c8076 ("rtlwifi:
cleanup the code that check whether TX ring is available")

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortl8xxxu: make arrays static, makes object smaller
Colin Ian King [Mon, 7 Oct 2019 13:53:13 +0000 (14:53 +0100)]
rtl8xxxu: make arrays static, makes object smaller

Don't populate const arrays on the stack but instead make them
static. Makes the object code smaller by 60 bytes.

Before:
   text    data     bss     dec     hex filename
  15133    8768       0   23901    5d5d realtek/rtl8xxxu/rtl8xxxu_8192e.o
  15209    6392       0   21601    5461 realtek/rtl8xxxu/rtl8xxxu_8723b.o
 103254   31202     576  135032   20f78 realtek/rtl8xxxu/rtl8xxxu_core.o

After:
   text    data     bss     dec     hex filename
  14861    9024       0   23885    5d4d realtek/rtl8xxxu/rtl8xxxu_8192e.o
  14953    6616       0   21569    5441 realtek/rtl8xxxu/rtl8xxxu_8723b.o
 102986   31458     576  135020   20f6c realtek/rtl8xxxu/rtl8xxxu_core.o

(gcc version 9.2.1, amd64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Chris Chiu <chiu@endlessm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agoiwlegacy: make array interval static, makes object smaller
Colin Ian King [Mon, 7 Oct 2019 13:41:13 +0000 (14:41 +0100)]
iwlegacy: make array interval static, makes object smaller

Don't populate the array interval on the stack but instead make it
static. Makes the object code smaller by 121 bytes.

Before:
   text    data     bss     dec     hex filename
 167797   29676     448  197921   30521 wireless/intel/iwlegacy/common.o

After:
   text    data     bss     dec     hex filename
 167580   29772     448  197800   304a8 wireless/intel/iwlegacy/common.o

(gcc version 9.2.1, amd64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: Fix an error message
Dan Carpenter [Mon, 7 Oct 2019 08:48:05 +0000 (11:48 +0300)]
rtw88: Fix an error message

The WARN_ON() macro doesn't take an error message, the argument is a
condition so this won't display the warning message.

Fixes: 27e117e4b01b ("rtw88: add deep power save support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortl8xxxu: add bluetooth co-existence support for single antenna
Chris Chiu [Sat, 5 Oct 2019 09:48:26 +0000 (17:48 +0800)]
rtl8xxxu: add bluetooth co-existence support for single antenna

The RTL8723BU suffers the wifi disconnection problem while bluetooth
device connected. While wifi is doing tx/rx, the bluetooth will scan
without results. This is due to the wifi and bluetooth share the same
single antenna for RF communication and they need to have a mechanism
to collaborate.

BT information is provided via the packet sent from co-processor to
host (C2H). It contains the status of BT but the rtl8723bu_handle_c2h
dose not really handle it. And there's no bluetooth coexistence
mechanism to deal with it.

This commit adds a workqueue to set the tdma configurations and
coefficient table per the parsed bluetooth link status and given
wifi connection state. The tdma/coef table comes from the vendor
driver code of the RTL8192EU and RTL8723BU. However, this commit is
only for single antenna scenario which RTL8192EU is default dual
antenna. The rtl8xxxu_parse_rxdesc24 which invokes the handle_c2h
is only for 8723b and 8192e so the mechanism is expected to work
on both chips with single antenna. Note RTL8192EU dual antenna is
not supported.

Signed-off-by: Chris Chiu <chiu@endlessm.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agomwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring
Navid Emamdoost [Fri, 4 Oct 2019 20:16:48 +0000 (15:16 -0500)]
mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring

In mwifiex_pcie_init_evt_ring, a new skb is allocated which should be
released if mwifiex_map_pci_memory() fails. The release for skb and
card->evtbd_ring_vbase is added.

Fixes: 0732484b47b5 ("mwifiex: separate ring initialization and ring creation routines")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Acked-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agomwifiex: pcie: Fix memory leak in mwifiex_pcie_alloc_cmdrsp_buf
Navid Emamdoost [Fri, 4 Oct 2019 20:08:52 +0000 (15:08 -0500)]
mwifiex: pcie: Fix memory leak in mwifiex_pcie_alloc_cmdrsp_buf

In mwifiex_pcie_alloc_cmdrsp_buf, a new skb is allocated which should be
released if mwifiex_map_pci_memory() fails. The release is added.

Fixes: fc3314609047 ("mwifiex: use pci_alloc/free_consistent APIs for PCIe")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Acked-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agorsi: drop bogus device-id checks from probe
Johan Hovold [Fri, 4 Oct 2019 14:44:22 +0000 (16:44 +0200)]
rsi: drop bogus device-id checks from probe

USB core will never call a USB-driver probe function with a NULL
device-id pointer.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agoRevert "rsi: fix potential null dereference in rsi_probe()"
Johan Hovold [Fri, 4 Oct 2019 14:44:21 +0000 (16:44 +0200)]
Revert "rsi: fix potential null dereference in rsi_probe()"

This reverts commit f170d44bc4ec2feae5f6206980e7ae7fbf0432a0.

USB core will never call a USB-driver probe function with a NULL
device-id pointer.

Reverting before removing the existing checks in order to document this
and prevent the offending commit from being "autoselected" for stable.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortlwifi: rtl8723: Remove set but not used variable 'own'
zhengbin [Fri, 4 Oct 2019 08:43:55 +0000 (16:43 +0800)]
rtlwifi: rtl8723: Remove set but not used variable 'own'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/net/wireless/realtek/rtlwifi/rtl8723com/fw_common.c: In function rtl8723_cmd_send_packet:
drivers/net/wireless/realtek/rtlwifi/rtl8723com/fw_common.c:226:5: warning: variable own set but not used [-Wunused-but-set-variable]

It is not used since commit f1d2b4d338bf ("rtlwifi:
rtl818x: Move drivers into new realtek directory")

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortlwifi: btcoex: Remove set but not used variables 'wifi_busy','bt_info_ext'
zhengbin [Fri, 4 Oct 2019 08:43:54 +0000 (16:43 +0800)]
rtlwifi: btcoex: Remove set but not used variables 'wifi_busy','bt_info_ext'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b1ant.c: In function btc8723b1ant_tdma_dur_adj_for_acl:
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b1ant.c:1428:7: warning: variable wifi_busy set but not used [-Wunused-but-set-variable]
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b1ant.c: In function btc8723b1ant_tdma_dur_adj_for_acl:
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b1ant.c:1427:22: warning: variable bt_info_ext set but not used [-Wunused-but-set-variable]

'wifi_busy' is not used since commit 158707f9584c ("rtlwifi:
btcoex: Restore 23b 1ant routine for tdma adjustment")

'bt_info_ext' is not used since commit 2622d7d86a57 ("rtlwifi:
btcoex: 23b 1ant: TDMA duration for ACL busy")

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortlwifi: btcoex: Remove set but not used variable 'result'
zhengbin [Fri, 4 Oct 2019 08:43:53 +0000 (16:43 +0800)]
rtlwifi: btcoex: Remove set but not used variable 'result'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8192e2ant.c: In function btc8192e2ant_tdma_duration_adjust:
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8192e2ant.c:1584:6: warning: variable result set but not used [-Wunused-but-set-variable]

It is not used since commit 27a31a60a4de ("rtlwifi:
btcoex: remove unused functions")

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortlwifi: rtl8188ee: Remove set but not used variable 'h2c_parameter'
zhengbin [Fri, 4 Oct 2019 08:43:52 +0000 (16:43 +0800)]
rtlwifi: rtl8188ee: Remove set but not used variable 'h2c_parameter'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c: In function rtl88e_dm_pwdb_monitor:
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c:763:6: warning: variable h2c_parameter set but not used [-Wunused-but-set-variable]

It is not used since commit f1d2b4d338bf ("rtlwifi:
rtl818x: Move drivers into new realtek directory")

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortlwifi: rtl8188ee: Remove set but not used variables 'v3','rtstatus','reg_ecc',...
zhengbin [Fri, 4 Oct 2019 08:43:51 +0000 (16:43 +0800)]
rtlwifi: rtl8188ee: Remove set but not used variables 'v3','rtstatus','reg_ecc','reg_ec4','reg_eac','b_pathb_ok'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c: In function phy_config_bb_with_pghdr:
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c:652:22: warning: variable v3 set but not used [-Wunused-but-set-variable]
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c: In function rtl88e_phy_config_rf_with_headerfile:
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c:772:7: warning: variable rtstatus set but not used [-Wunused-but-set-variable]
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c: In function rtl88e_phy_iq_calibrate:
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c:1945:6: warning: variable reg_ecc set but not used [-Wunused-but-set-variable]
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c: In function rtl88e_phy_iq_calibrate:
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c:1944:61: warning: variable reg_ec4 set but not used [-Wunused-but-set-variable]
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c: In function rtl88e_phy_iq_calibrate:
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c:1944:34: warning: variable reg_eac set but not used [-Wunused-but-set-variable]
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c: In function rtl88e_phy_iq_calibrate:
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c:1943:19: warning: variable b_pathb_ok set but not used [-Wunused-but-set-variable]

They are not used since commit f1d2b4d338bf ("rtlwifi:
rtl818x: Move drivers into new realtek directory")

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortlwifi: rtl8192c: Remove set but not used variables 'reg_ecc','reg_eac'
zhengbin [Fri, 4 Oct 2019 08:43:50 +0000 (16:43 +0800)]
rtlwifi: rtl8192c: Remove set but not used variables 'reg_ecc','reg_eac'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.c: In function rtl92c_phy_iq_calibrate:
drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.c:1373:6: warning: variable reg_ecc set but not used [-Wunused-but-set-variable]
drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.c: In function rtl92c_phy_iq_calibrate:
drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.c:1372:34: warning: variable reg_eac set but not used [-Wunused-but-set-variable]

They are not used since commit f1d2b4d338bf ("rtlwifi:
rtl818x: Move drivers into new realtek directory")

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortlwifi: rtl8723ae: Remove set but not used variables 'reg_ecc','reg_ec4','reg_eac...
zhengbin [Fri, 4 Oct 2019 08:43:49 +0000 (16:43 +0800)]
rtlwifi: rtl8723ae: Remove set but not used variables 'reg_ecc','reg_ec4','reg_eac','b_pathb_ok'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.c: In function rtl8723e_phy_iq_calibrate:
drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.c:1346:6: warning: variable reg_ecc set but not used [-Wunused-but-set-variable]
drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.c: In function rtl8723e_phy_iq_calibrate:
drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.c:1345:61: warning: variable reg_ec4 set but not used [-Wunused-but-set-variable]
drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.c: In function rtl8723e_phy_iq_calibrate:
drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.c:1345:34: warning: variable reg_eac set but not used [-Wunused-but-set-variable]
drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.c: In function rtl8723e_phy_iq_calibrate:
drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.c:1344:19: warning: variable b_pathb_ok set but not used [-Wunused-but-set-variable]

They are not used since commit f1d2b4d338bf ("rtlwifi:
rtl818x: Move drivers into new realtek directory")

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortlwifi: rtl8821ae: Remove set but not used variables 'rtstatus','bd'
zhengbin [Fri, 4 Oct 2019 08:43:48 +0000 (16:43 +0800)]
rtlwifi: rtl8821ae: Remove set but not used variables 'rtstatus','bd'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c: In function rtl8812ae_phy_config_rf_with_headerfile:
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c:2079:7: warning: variable rtstatus set but not used [-Wunused-but-set-variable]
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c: In function rtl8821ae_phy_config_rf_with_headerfile:
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c:2114:7: warning: variable rtstatus set but not used [-Wunused-but-set-variable]
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c: In function _rtl8812ae_phy_get_txpower_limit:
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c:2354:6: warning: variable bd set but not used [-Wunused-but-set-variable]

They are not used since commit f1d2b4d338bf ("rtlwifi:
rtl818x: Move drivers into new realtek directory")

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortl8xxxu: Improve TX performance of RTL8723BU on rtl8xxxu driver
Chris Chiu [Wed, 2 Oct 2019 12:18:07 +0000 (20:18 +0800)]
rtl8xxxu: Improve TX performance of RTL8723BU on rtl8xxxu driver

We have 3 laptops which connect the wifi by the same RTL8723BU.
The PCI VID/PID of the wifi chip is 10EC:B720 which is supported.
They have the same problem with the in-kernel rtl8xxxu driver, the
iperf (as a client to an ethernet-connected server) gets ~1Mbps.
Nevertheless, the signal strength is reported as around -40dBm,
which is quite good. From the wireshark capture, the tx rate for each
data and qos data packet is only 1Mbps. Compare to the Realtek driver
at https://github.com/lwfinger/rtl8723bu, the same iperf test gets
~12Mbps or better. The signal strength is reported similarly around
-40dBm. That's why we want to improve.

After reading the source code of the rtl8xxxu driver and Realtek's, the
major difference is that Realtek's driver has a watchdog which will keep
monitoring the signal quality and updating the rate mask just like the
rtl8xxxu_gen2_update_rate_mask() does if signal quality changes.
And this kind of watchdog also exists in rtlwifi driver of some specific
chips, ex rtl8192ee, rtl8188ee, rtl8723ae, rtl8821ae...etc. They have
the same member function named dm_watchdog and will invoke the
corresponding dm_refresh_rate_adaptive_mask to adjust the tx rate
mask.

With this commit, the tx rate of each data and qos data packet will
be 39Mbps (MCS4) with the 0xF00000 as the tx rate mask. The 20th bit
to 23th bit means MCS4 to MCS7. It means that the firmware still picks
the lowest rate from the rate mask and explains why the tx rate of
data and qos data is always lowest 1Mbps because the default rate mask
passed is always 0xFFFFFFF ranges from the basic CCK rate, OFDM rate,
and MCS rate. However, with Realtek's driver, the tx rate observed from
wireshark under the same condition is almost 65Mbps or 72Mbps, which
indicating that rtl8xxxu could still be further improved.

Signed-off-by: Chris Chiu <chiu@endlessm.com>
Reviewed-by: Daniel Drake <drake@endlessm.com>
Acked-by: Jes Sorensen <Jes.Sorensen@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agorsi: fix potential null dereference in rsi_probe()
Denis Efremov [Wed, 2 Oct 2019 17:18:11 +0000 (20:18 +0300)]
rsi: fix potential null dereference in rsi_probe()

The id pointer can be NULL in rsi_probe(). It is checked everywhere except
for the else branch in the idProduct condition. The patch adds NULL check
before the id dereference in the rsi_dbg() call.

Fixes: 54fdb318c111 ("rsi: add new device model for 9116")
Cc: Amitkumar Karwar <amitkarwar@gmail.com>
Cc: Siva Rebbagondla <siva8118@gmail.com>
Cc: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Denis Efremov <efremov@linux.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agolibertas: remove redundant assignment to variable ret
Colin Ian King [Wed, 2 Oct 2019 10:15:17 +0000 (11:15 +0100)]
libertas: remove redundant assignment to variable ret

The variable ret is being assigned a value that is never read and is
being re-assigned a little later on. The assignment is redundant and hence
can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agobrcmfmac: add support for SAE authentication offload
Chung-Hsien Hsu [Wed, 2 Oct 2019 09:31:12 +0000 (09:31 +0000)]
brcmfmac: add support for SAE authentication offload

The firmware may have SAE authentication code built-in. This is
detected by the driver and indicated in the wiphy features flags.
User-space can use this flag to determine whether or not to provide
the password material for SAE authentication in the nl80211 CONNECT
command.

Signed-off-by: Chung-Hsien Hsu <stanley.hsu@cypress.com>
Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: fix error handling when setup efuse info
Ping-Ke Shih [Wed, 2 Oct 2019 06:35:31 +0000 (14:35 +0800)]
rtw88: fix error handling when setup efuse info

Disable efuse if the efuse is enabled when we failed to setup the efuse
information, otherwise the hardware will not turn off.

Fixes: e3037485c68e ("rtw88: new Realtek 802.11ac driver")
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: fix NSS of hw_cap
Ping-Ke Shih [Wed, 2 Oct 2019 06:35:30 +0000 (14:35 +0800)]
rtw88: fix NSS of hw_cap

8822C is a 2x2 11ac chip, and then NSS must be less or equal to 2. However,
current nss of hw cap is 3, likes
hw cap: hci=0x0f, bw=0x07, ptcl=0x03, ant_num=7, nss=3

This commit adds constraint to make sure NSS <= rf_path_num, and result
looks like
hw cap: hci=0x0f, bw=0x07, ptcl=0x03, ant_num=7, nss=2

Fixes: e3037485c68e ("rtw88: new Realtek 802.11ac driver")
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: use struct rtw_fw_hdr to access firmware header
Ping-Ke Shih [Wed, 2 Oct 2019 06:35:29 +0000 (14:35 +0800)]
rtw88: use struct rtw_fw_hdr to access firmware header

This commit doesn't change logic at all, just use struct rtw_fw_hdr to
access fixed part of 64 bytes header. Since remaining part is variable
length data of actual firmware, we don't define them within the struct.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: raise firmware version debug level
Yan-Hsuan Chuang [Wed, 2 Oct 2019 06:35:28 +0000 (14:35 +0800)]
rtw88: raise firmware version debug level

It's better to print firmware version at load time.
But since we need to set debug_mask properly to default print
rtw_dbg(), raise the debug level to rtw_info() instead.

Also change the multiple line style to one line only, it will
be easier for log analyzing.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: configure TX queue EDCA parameters
Yan-Hsuan Chuang [Wed, 2 Oct 2019 06:35:27 +0000 (14:35 +0800)]
rtw88: configure TX queue EDCA parameters

Set CWmax/CWmin, TXOP and AIFS according to ieee80211_tx_queue_params.

Do note that hardware has only one group of EDCA[ac] registers, if more
than one vif are added, the EDCA[ac] registers will contain value of
params of the most recent set by ieee80211_ops::conf_tx().

And AIFS = AIFSN[ac] * slot_time + SIFS, so if use_short_slot is changed,
need to also change AIFS.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: Don't set RX_FLAG_DECRYPTED if packet has no encryption
Ping-Ke Shih [Wed, 2 Oct 2019 06:35:26 +0000 (14:35 +0800)]
rtw88: Don't set RX_FLAG_DECRYPTED if packet has no encryption

The value of GET_RX_DESC_SWDEC() indicates that if this RX
packet requires software decryption or not. And software
decryption is required when the packet was encrypted and the
hardware failed to decrypt it.

So, GET_RX_DESC_SWDEC() is negative does not mean that this
packet is decrypted, it might just have no encryption at all.
To actually see if the packet is decrypted, driver needs to
further check if the hardware has successfully decrypted it,
with a specific type of encryption algorithm.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: fix beaconing mode rsvd_page memory violation issue
Yan-Hsuan Chuang [Wed, 2 Oct 2019 06:35:25 +0000 (14:35 +0800)]
rtw88: fix beaconing mode rsvd_page memory violation issue

When downloading the reserved page, the first page always contains
a beacon for the firmware to reference. For non-beaconing modes such
as station mode, also put a blank skb with length=1.

And for the beaconing modes, driver will get a real beacon with a
length approximate to the page size. But as the beacon is always put
at the first page, it does not need a tx_desc, because the TX path
will generate one when TXing the reserved page to the hardware. So we
could allocate a buffer with a size smaller than the reserved page,
when using memcpy() to copy the content of reserved page to the buffer,
the over-sized reserved page will violate the kernel memory.

To fix it, add the tx_desc before memcpy() the reserved packets to
the buffer, then we can get SKBs with correct length when counting
the pages in total. And for page 0, count the extra tx_desc_sz that
the TX path will generate. This way, the first beacon that allocated
without tx_desc can be counted with the extra tx_desc_sz to get
actual pages it requires.

Fixes: e3037485c68e ("rtw88: new Realtek 802.11ac driver")
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: flush hardware tx queues
Yan-Hsuan Chuang [Wed, 2 Oct 2019 06:35:24 +0000 (14:35 +0800)]
rtw88: flush hardware tx queues

Sometimes mac80211 will ask us to flush the hardware queues.
To flush them, first we need to get the corresponding priority queues
from the RQPN mapping table.

Then we can check the available pages are equal to the originally
reserved pages, which means the hardware has returned all of the pages
it used to transmit.

Note that now we only check for 100 ms for the priority queue, but
sometimes if we have a lot of traffic (ex. 100Mbps up), some of the
packets could be dropped.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: add TX-AMSDU support
Yan-Hsuan Chuang [Wed, 2 Oct 2019 06:35:23 +0000 (14:35 +0800)]
rtw88: add TX-AMSDU support

Based on the mac80211's TXQ implementation, TX-AMSDU can
be used to get higher MAC efficiency. To make mac80211
aggregate MSDUs, low level driver just need to leave skbs
in the TXQ, and mac80211 will try to aggregate them if
possible. As driver will schedule a tasklet when the TX
queue is woke, until the tasklet being served, there will
have some skbs in the queue if traffic is heavy.

Driver can control the max AMSDU size depending on the
current bit rate used by hardware/firmware. The higher
rates are used, the larger AMSDU size can be.

It is tested that can achieve higher T-Put at higher rates.
If the environment is relatively clean, and the bit_rate
is high enough, we can get about 80Mbps improvement.

For lower bit rates, not much gain can we get, so leave
the max_amsdu length low to prevent aggregation.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: report tx rate to mac80211 stack
Tzu-En Huang [Wed, 2 Oct 2019 06:35:22 +0000 (14:35 +0800)]
rtw88: report tx rate to mac80211 stack

Whenever the firmware increases/decreases the bit rate used
to transmit to a peer, it sends an RA report through C2H to
driver. Driver can then record the bit rate in the peer's
struct rtw_sta_info, and report to mac80211 when it asks us
for the statistics of the sta by ieee80211_ops::sta_statistics

Signed-off-by: Tzu-En Huang <tehuang@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: take over rate control from mac80211
Yan-Hsuan Chuang [Wed, 2 Oct 2019 06:35:21 +0000 (14:35 +0800)]
rtw88: take over rate control from mac80211

We can indicate IEEE80211_HW_HAS_RATE_CONTROL to mac80211 because
the hardware has its own rate control algorithm. And what driver needs
to do is to choose an RA mask according the peer's capabilities.

But the hardware is not able to setup BA session by itself. So driver
requires to initiate tx BA session for hardware, and tells it if it is
possible to transmit AMPDU. The hardware can then aggregate MPDUs.

And the size of AMPDU is controlled by the TX descriptor and the
register value. Since the TX descriptor will reference the max AMPDU
size from ieee80211_sta::ht_cap::ampdu_factor, just set the register
value to 0x3f, and let it be controlled by TX descriptor.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: add driver TX queue support
Yan-Hsuan Chuang [Wed, 2 Oct 2019 06:35:20 +0000 (14:35 +0800)]
rtw88: add driver TX queue support

The mac80211 provides software TX queue for driver, as long as
driver has hooked ieee80211_ops::wake_tx_queue. Each time a
packet is queued onto the TX queue, that queue will be woken
up the inform driver to serve the queue.

Now driver only supports PCI interface ICs, there's no specific
traffic control for each queue, just schedule a tasklet, and
dump all of the packets at once to the DMA ring. Instead of TX
the packets whenever TX queue is woke, tasklet handler can have
more packets dumped to the device, takes advantage of burst
write with DMA engine.

And if the driver is going to support USB/SDIO ICs, the tasklet
can be more flexible for aggregating the packets, enhance the
efficiency of bandwidth usage.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: allows to set RTS in TX descriptor
Yan-Hsuan Chuang [Wed, 2 Oct 2019 06:35:19 +0000 (14:35 +0800)]
rtw88: allows to set RTS in TX descriptor

Allows driver to send RTS by filling tx descriptor.

The user may want to set the rts threshold. But since we have not
been taking over rate control from mac80211 to driver by setting flag
IEEE80211_HW_HAS_RATE_CONTROL, there is nothing we can do about it.
So here just store the value, and mac80211 will tell us to use rts
protection by ieee80211_tx_info::control::use_rts.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>