linux-2.6-microblaze.git
5 years agortl8723ae: Re-introduce the adaptive rate control
Bernd Edlinger [Tue, 8 Jan 2019 22:49:52 +0000 (22:49 +0000)]
rtl8723ae: Re-introduce the adaptive rate control

This re-introduces the function rtl8723e_dm_refresh_rate_adaptive_mask.

This function was present in a previous version of the code base,
it works just fine for me -- as long as it is not using stale data.

Unlike the original version of this function it avoids using
dm.undec_sm_pwdb when no beacon was received.

Fixed a style nit in rtl8723e_dm_init_rate_adaptive_mask.

Signed-off-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agortl8723ae: Dont use old data for input gain control
Bernd Edlinger [Tue, 8 Jan 2019 22:49:40 +0000 (22:49 +0000)]
rtl8723ae: Dont use old data for input gain control

When no beacon was received, the value in dm.undec_sm_pwdb is most
likely out of date and should not be used to adjust the input path.
Assume instead that the signal level is low.

Fix the state machine in rtl8723e_dm_cck_packet_detection_thresh
which did not clear pre_cck_fa_state when changing cur_cck_pd_state
from CCK_PD_STAGE_LOWRSSI/CCK_FA_STAGE_LOW to CCK_PD_STAGE_HIGHRSSI
and back again to CCK_PD_STAGE_LOWRSSI/CCK_FA_STAGE_LOW, the register
RCCK0_CCA not written to 0x83 on the second change.

Explicitly initialize pre_cck_fa_state/cur_cck_fa_state in
rtl_dm_diginit.

Signed-off-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agortl8723ae: Take the FW LPS mode handling out
Bernd Edlinger [Tue, 8 Jan 2019 22:49:23 +0000 (22:49 +0000)]
rtl8723ae: Take the FW LPS mode handling out

This appears to trigger a firmware bug and causes severe
problems with rtl8723ae PCI devices.

When the power save mode is activated for longer periods
of time the firmware stops to receive any packets.

This problem was exposed by commit 873ffe154ae0 ("rtlwifi:
Fix logic error in enter/exit power-save mode").

Previously the power save mode was only active rarely and
only for a short time so that the problem was not noticeable.

Signed-off-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agolibertas: add checks for the return value of sysfs_create_group
Kangjie Lu [Tue, 8 Jan 2019 17:42:21 +0000 (11:42 -0600)]
libertas: add checks for the return value of sysfs_create_group

sysfs_create_group() could fail. The fix checkes its return values
and issue error messages if it fails.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoqtnfmac: use struct_size() in kzalloc()
Gustavo A. R. Silva [Tue, 8 Jan 2019 17:26:32 +0000 (11:26 -0600)]
qtnfmac: use struct_size() in kzalloc()

One of the more common cases of allocation size calculations is finding the
size of a structure that has a zero-sized array at the end, along with memory
for some number of elements for that array. For example:

struct foo {
    int stuff;
    void *entry[];
};

instance = kzalloc(sizeof(struct foo) + sizeof(void *) * count, GFP_KERNEL);

Instead of leaving these open-coded and prone to type mistakes, we can now
use the new struct_size() helper:

instance = kzalloc(struct_size(instance, entry, count), GFP_KERNEL);

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agort2x00: reduce tx power to nominal level on RT6352
Tomislav Požega [Thu, 27 Dec 2018 14:05:25 +0000 (15:05 +0100)]
rt2x00: reduce tx power to nominal level on RT6352

Current implementation of RT6352 support provides too high tx power
at least on iPA/eLNA devices. Reduce amplification of variable gain
amplifier by 6dB to match board target power of 17dBm.
Transmited signal strength with this patch is similar to that of
stock firmware or pandorabox firmware. Throughput measured with iperf
improves. Device tested: Xiaomi Miwifi Mini.

Signed-off-by: Tomislav Požega <pozega.tomislav@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoiwlwifi: mvm: fix merge damage in iwl_mvm_rx_mpdu_mq()
Luca Coelho [Wed, 30 Jan 2019 12:38:11 +0000 (14:38 +0200)]
iwlwifi: mvm: fix merge damage in iwl_mvm_rx_mpdu_mq()

A call to iwl_mvm_add_rtap_sniffer_config() was missing due to a merge
damage when I submitted the patch mentioned below.  And this causes
the following compilation warning:

drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c:195:13: warning: 'iwl_mvm_add_rtap_sniffer_config' defined but not used [-Wunused-function]
 static void iwl_mvm_add_rtap_sniffer_config(struct iwl_mvm *mvm,
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fix it by adding the if block that calls this function.

Fixes: 9bf13bee2d74 ("iwlwifi: mvm: include configured sniffer AID in radiotap")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoMerge tag 'iwlwifi-next-for-kalle-2019-01-29' of git://git.kernel.org/pub/scm/linux...
Kalle Valo [Wed, 30 Jan 2019 11:07:49 +0000 (13:07 +0200)]
Merge tag 'iwlwifi-next-for-kalle-2019-01-29' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

Second batch of iwlwifi patches intended for v5.1

* A bunch of fixes for issues found with static analyzers;
* Relicense the pcie submodule to dual GPL/BSD;
* Reworked the TOF/CSI implementation;
* Work on new debugging infra continues;
* Some product name updates in the human-readable strings
* Some more cleanups for the device configuration refactoring;
* General bugfixes;
* Other cleanups and small fixes;

5 years agoMerge tag 'mt76-for-kvalo-2019-01-22' of https://github.com/nbd168/wireless
Kalle Valo [Wed, 30 Jan 2019 11:03:38 +0000 (13:03 +0200)]
Merge tag 'mt76-for-kvalo-2019-01-22' of https://github.com/nbd168/wireless

first batch of mt76 patches for 5.1

* fixes for mt76x0/mt76x2
* energy detect regulatory compliance fixes
* tx status handling fixes
* preparation for MT7603 support
* channel switch announcement support

5 years agoiwiwifi: fix bad monitor buffer register addresses
Shahar S Matityahu [Mon, 26 Nov 2018 09:33:09 +0000 (11:33 +0200)]
iwiwifi: fix bad monitor buffer register addresses

The monitor buffer register address is wrong.
Set the right address

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Fixes: c2d202017da1 ("iwlwifi: pcie: add firmware monitor capabilities")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: dbg_ini: set dump mask BIT(n) instead of n
Shahar S Matityahu [Mon, 26 Nov 2018 08:29:15 +0000 (10:29 +0200)]
iwlwifi: dbg_ini: set dump mask BIT(n) instead of n

The driver sets dump_mask value instead of BIT(value).
fix it by updating dump_mask correctly.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Fixes: 7a14c23dcdee ("iwlwifi: dbg: dump data according to the new ini TLVs")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: dbg_ini: retrieve dump_delay value properly
Shahar S Matityahu [Mon, 26 Nov 2018 08:34:37 +0000 (10:34 +0200)]
iwlwifi: dbg_ini: retrieve dump_delay value properly

The driver uses ignore_consec instead of dump_delay.
Fix it by using dump_delay as expected.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Fixes: fe1b7d6c2888 ("iwlwifi: add support for triggering ini triggers")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: dbg_ini: properly handle ini user trigger
Shahar S Matityahu [Mon, 26 Nov 2018 09:02:54 +0000 (11:02 +0200)]
iwlwifi: dbg_ini: properly handle ini user trigger

in case of a user trigger while ini is enable we change
FW_DBG_TRIGGER_USER to IWL_FW_TRIGGER_ID_USER_TRIGGER in
iwl_fw_dbg_collect and then again we attempt to do so in
_iwl_fw_error_ini_dump which causes to abort the dump.

Fix it by removing the second check in _iwl_fw_error_ini_dump.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Fixes: 7a14c23dcdee ("iwlwifi: dbg: dump data according to the new ini TLVs")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: dbg_ini: allocate dram buffer with proper flags
Shahar S Matityahu [Mon, 26 Nov 2018 09:19:00 +0000 (11:19 +0200)]
iwlwifi: dbg_ini: allocate dram buffer with proper flags

Use the same flags we use in the legacy buffer allocation.
Missing __GFP_NOWARN will cause an unwanted warning incase
we fail to allocate.
Missing __GFP_ZERO will give a buffer initially filled with
garbage which can make debug difficult in case our wrap count is zero.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Fixes: d47902f9f71d ("iwlwifi: dbg: add apply point logic")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: update firmware when MU EDCA params change
Shaul Triebitz [Wed, 7 Nov 2018 16:51:06 +0000 (18:51 +0200)]
iwlwifi: mvm: update firmware when MU EDCA params change

When MU EDCA params change, resend the STA_HE_CTXT command
updating the MU EDCA params.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: trigger dump on assert prior to setting the device up
Shahar S Matityahu [Thu, 22 Nov 2018 06:01:30 +0000 (08:01 +0200)]
iwlwifi: trigger dump on assert prior to setting the device up

In the regular flow, when we receive an assert, ieee80211_reconfig is
called which reconfig the driver using iwl_mvm_mac_start.
iwl_mvm_mac_start is clearing the restart bit and does dump collection.

Prior to setting the device up, ieee80211_reconfig does not call
iwl_mvm_mac_start since there is nothing to reconfig and we miss the
dump collection of the assert.

solve it by checking the restart bit before we stop the device
and trigger a dump collection in case it is set.

note that we don't need to do it in the fmac case since in fmac
assert flow in iwl_fmac_nic_error we call iwl_fw_dbg_collect_desc
so we can be sure that there will a dump collection in
iwl_fmac_stop_device.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: include configured sniffer AID in radiotap
Johannes Berg [Tue, 20 Nov 2018 16:58:46 +0000 (17:58 +0100)]
iwlwifi: mvm: include configured sniffer AID in radiotap

In order to make more sense out of the captured radiotap data e.g.
when the configured AID changes, add the currently configured AID
to the radiotap data as a vendor extension field.

This is made race-free by updating the included value from inside
the RX path (using a notification wait) for the command response
from the firmware, which thus means it's serialized with frame RX.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: document monitor mode reorder buffer bypass
Johannes Berg [Tue, 20 Nov 2018 16:14:06 +0000 (17:14 +0100)]
iwlwifi: mvm: document monitor mode reorder buffer bypass

The reorder buffer is bypassed because the firmware won't have
any BA sessions, document this.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: update product name for 9260 and 9560
Ihab Zhaika [Tue, 20 Nov 2018 07:33:57 +0000 (09:33 +0200)]
iwlwifi: update product name for 9260 and 9560

update the product name for the some of the cards from
the series of 9260 and 9560

Signed-off-by: Ihab Zhaika <ihab.zhaika@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: disable completely low latency mode with debugfs
Mordechay Goodstein [Tue, 13 Nov 2018 16:36:42 +0000 (18:36 +0200)]
iwlwifi: mvm: disable completely low latency mode with debugfs

We introduce a new state for latency, force mode, in force mode
you can enable always to be in low latency or always to be in non
low latency.

This is required for test mode in max TpT test.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: freeze management TXQ timer when station goes to sleep
Emmanuel Grumbach [Mon, 19 Nov 2018 07:32:39 +0000 (09:32 +0200)]
iwlwifi: mvm: freeze management TXQ timer when station goes to sleep

We maintain a timer for each Tx queue to detect stalls and
be able to recover / debug.
When we work in AP mode, we can freeze the Tx queue timer if
a station goes to sleep, because we don't want to warn about
stalls that are caused by faulty clients that don't wake up
on time.
This mechanism was applied to the queues of the clients, but
the management queue was omitted. Fix that.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: Change FW channel info API
David Spinadel [Sun, 18 Nov 2018 16:01:43 +0000 (18:01 +0200)]
iwlwifi: mvm: Change FW channel info API

Change iwl_fw_channel_info structure so it can have channel number
greater than 255. This is needed for 6 GHz channel numbers.
Change all relevant structs and member accesses accordingly.
The new API is indicated by a TLV capability bit.

Signed-off-by: David Spinadel <david.spinadel@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: implement CSI reporting
Johannes Berg [Thu, 25 Oct 2018 07:15:21 +0000 (09:15 +0200)]
iwlwifi: mvm: implement CSI reporting

Implement CSI (channel estimation matrix) reporting in the mvm
driver, if the firmware has the capability.

Currently only a debugfs API is provided as the API is still
under discussion.

For now, RX aggregation must be disabled to use this feature
on data frames as we haven't found a good way to attach the
data to A-MPDUs, given complexities with multi-queue.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: add location APIs
Johannes Berg [Wed, 31 Oct 2018 09:29:31 +0000 (10:29 +0100)]
iwlwifi: mvm: add location APIs

Add the location/time-of-flight/FTM APIs that we'll use in
follow-up patches to implement FTM responder and initiator.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: Disconnect on large beacon loss
Andrei Otcheretianski [Sun, 4 Nov 2018 19:56:31 +0000 (21:56 +0200)]
iwlwifi: mvm: Disconnect on large beacon loss

Some buggy APs stop sending beacons, but continue to ack our null data
packets or even run some traffic. It's better not to stick connected to
such an AP forever, so disconnect after some larger beacon loss
threshold is crossed.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: pcie: use u32* argument to iwl_trans_get_fw_monitor_len()
Johannes Berg [Fri, 9 Nov 2018 09:58:53 +0000 (10:58 +0100)]
iwlwifi: pcie: use u32* argument to iwl_trans_get_fw_monitor_len()

That's what we pass, and we don't want/need any negative values.
Found by sparse/smatch.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: dvm: remove useless condition
Johannes Berg [Fri, 9 Nov 2018 10:03:29 +0000 (11:03 +0100)]
iwlwifi: dvm: remove useless condition

If we're in the else branch of checking "tt->state == IWL_TI_CT_KILL"
so there's no point in checking "tt->state != IWL_TI_CT_KILL" again.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: remove TOF implementation
Johannes Berg [Tue, 30 Oct 2018 13:47:52 +0000 (14:47 +0100)]
iwlwifi: remove TOF implementation

This is an ancient (~2015) implementation that no longer matches
the firmware in any way, and most likely never worked. Remove all
of it so it can be reintroduced properly.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: get rid of tx_path_lock
Sara Sharon [Thu, 25 Oct 2018 17:11:51 +0000 (20:11 +0300)]
iwlwifi: mvm: get rid of tx_path_lock

TX path lock was introduced in order to prevent out of order
invocations of TX.

This can happen in the following flow:

TX path invoked from net dev
Packet dequeued
TX path invoked from RX path
Packet dequeued
Packet TXed
Packet TXed

However, we don't really need a lock. If TX path is already
invoked from some location, other paths can simply abort their
execution, instead of waiting to the first path to finish, and
then discover queue is (likely) empty or stopped.

Replace the lock with an atomic variable to track TX ownership.
This simplifies the locking dependencies between RX and TX paths,
and should improve performance.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: fix A-MPDU reference assignment
Johannes Berg [Thu, 8 Nov 2018 08:51:56 +0000 (09:51 +0100)]
iwlwifi: mvm: fix A-MPDU reference assignment

The current code assigns the reference, and then goes to increment
it if the toggle bit has changed. That way, we get

Toggle  0  0  0  0  1  1  1  1
ID      1  1  1  1  1  2  2  2

Fix that by assigning the post-toggle ID to get

Toggle  0  0  0  0  1  1  1  1
ID      1  1  1  1  2  2  2  2

Reported-by: Danny Alexander <danny.alexander@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Fixes: fbe4112791b8 ("iwlwifi: mvm: update mpdu metadata API")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: add an option to dereference vif by id
Sara Sharon [Mon, 29 Oct 2018 09:23:45 +0000 (11:23 +0200)]
iwlwifi: mvm: add an option to dereference vif by id

Currently whenever we get firmware notification with mac id,
we iterate over all the interfaces to find the ID. This is a
bit cumbersome. Instead, adding an array of RCU pointers, like
we have for station IDs. This is not expensive space wise
since we have only up to 4 active MACs, and not complicated
code wise, since we have a clear point to init and de-init it.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: monitor dumping flow cleanup
Shahar S Matityahu [Wed, 31 Oct 2018 11:29:21 +0000 (13:29 +0200)]
iwlwifi: monitor dumping flow cleanup

Since we use a dumping mask, checking if only monitor was requested
is redundant. Remove the unneeded code.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: remove sta key on wep ap
Liad Kaufman [Thu, 1 Nov 2018 14:30:15 +0000 (16:30 +0200)]
iwlwifi: mvm: remove sta key on wep ap

If WEP is used, no one removes the STA key upon STA
removal, leading to a situation where after 16
connect/disconnects - the AP could no longer decrypt
incoming data frames since iwl_mvm_set_fw_key_idx()
called from iwl_mvm_set_sta_key() during association
returns STA_KEY_IDX_INVALID, thus not setting the key
for that connecting STA.

Fix this by removing the key in the driver when the
STA is removed.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: make sure cur_fw_img is valid before accessing img
Luca Coelho [Tue, 6 Nov 2018 06:24:12 +0000 (08:24 +0200)]
iwlwifi: make sure cur_fw_img is valid before accessing img

Harden the fwrt->fw->img array access by making sure the cur_fw_img
value doesn't go out of bounds.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: calculate pointers from out_cmd instead of out_cmd->hdr
Luca Coelho [Mon, 5 Nov 2018 13:45:54 +0000 (15:45 +0200)]
iwlwifi: calculate pointers from out_cmd instead of out_cmd->hdr

The out_cmd structure starts with a header, so there's no need to use
&out_cmd->hdr, out_cmd alone is enough.  We use this when calculating
other addresses and klocwork gets confused with that because it thinks
we are trying to access hdr (as an array) beyond its size.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: pre-initialize alive_data in wait_alive()
Luca Coelho [Mon, 5 Nov 2018 09:07:58 +0000 (11:07 +0200)]
iwlwifi: mvm: pre-initialize alive_data in wait_alive()

The function we pass to the wait alive notification procedure may may
not even get called if the timeout occurs before the function is
called.  To prevent accessing unitialized data in alive_data, pre-set
it to zero in the declaration.  Found by static analyzers.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: move iwl_enable_{rx,tx}_ampdu to iwl-modparams.h
Johannes Berg [Wed, 31 Oct 2018 07:48:49 +0000 (08:48 +0100)]
iwlwifi: move iwl_enable_{rx,tx}_ampdu to iwl-modparams.h

These inlines just check the module parameters, so they don't
need a configuration parameter and can move to a better place.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: make iwl_fw_dbg_start_stop_hcmd() inline
Luca Coelho [Wed, 31 Oct 2018 08:21:10 +0000 (10:21 +0200)]
iwlwifi: make iwl_fw_dbg_start_stop_hcmd() inline

This function is supposed to be used as an inline function and is in a
header file, so make it inline.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: save and export regdb blob from the NVM
Luca Coelho [Mon, 13 Aug 2018 12:30:35 +0000 (15:30 +0300)]
iwlwifi: mvm: save and export regdb blob from the NVM

Sometimes we want to debug issues related to the regulatory blob in
the NVM.  To make that easier, add a debugfs entry to export it
together with the other nvm blobs we export.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: clean up LDBG config command usage
Johannes Berg [Mon, 29 Oct 2018 12:50:05 +0000 (13:50 +0100)]
iwlwifi: mvm: clean up LDBG config command usage

Clean up the LDBG config command to not be called "continuous
recording", and while at it actually remove the continuous
recording implementation completely since it was only used for
store & forward architectures.

This also fixes a bug at least in iwl_fw_dbg_buffer_allocation()
because what's now "__le32 type" (matching the firmware) used to
be "__le16 enable_recording", so the buffer allocation config
sub-struct would erroneously have started at the wrong offset.
In the other cases this didn't actually lead to a bug as other
bytes in pad[] were all zeroes, so accessing the 16-bit value as
a 32-bit value wouldn't make a difference (in little endian.)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: pcie: align licensing to dual GPL/BSD
Johannes Berg [Wed, 24 Oct 2018 07:04:36 +0000 (09:04 +0200)]
iwlwifi: pcie: align licensing to dual GPL/BSD

These files have a long history of code changes, but analysing
the remaining code leads to having only a few changes that are
not already owned by Intel, notably from
 - Andy Lutomirski <luto@amacapital.net>
 - Joonwoo Park <joonwpark81@gmail.com>
 - Kirtika Ruchandani <kirtika@chromium.org>
 - Rajat Jain <rajatja@google.com>
 - Stanislaw Gruszka <sgruszka@redhat.com>
remaining in the code today.

Note that
 - I myself was working for Intel and for any possibly code
   that might be before my employment there give permission
 - Wizery employees were working for Intel

More specifically, we identified the following commits that
(partially may) remain today:

25c03d8e8c13 Joonwoo Park <joonwpark81@gmail.com>      ("iwlwifi: do not schedule tasklet when rcv unused irq")
f36d04abe684 Stanislaw Gruszka <sgruszka@redhat.com>   ("iwlwifi: use dma_alloc_coherent")
387f3381f732 Stanislaw Gruszka <sgruszka@redhat.com>   ("iwlwifi: fix dma mappings and skbs leak")
2624e96ce16b Stanislaw Gruszka <sgruszka@redhat.com>   ("iwlwifi: fix possible data overwrite in hcmd callback")
bfe4b80e9f73 Stanislaw Gruszka <sgruszka@redhat.com>   ("iwlwifi: always check if got h/w access before write")
d536c32b45d2 Andy Lutomirski <luto@amacapital.net>     ("iwlwifi: pcie: log when waking the NIC for hcmd submission fails")
a6d24fad00d9 Rajat Jain <rajatja@google.com>           ("iwlwifi: pcie: dump registers when HW becomes inaccessible")
fb12777ab59b Kirtika Ruchandani <kirtika@chromium.org> ("iwlwifi: Add more call-sites for pcie reg dumper")
3a73a30049f2 Stanislaw Gruszka <sgruszka@redhat.com>   ("iwlwifi: cleanup/fix memory barriers")
aa5affbacb24 Stanislaw Gruszka <sgruszka@redhat.com>   ("iwlwifi: dump stack when fail to gain access to the device")

Align the licenses with their permission to clean up and to
make it all identical.

CC: Joonwoo Park <joonwpark81@gmail.com>
CC: Stanislaw Gruszka <sgruszka@redhat.com>
CC: Andy Lutomirski <luto@amacapital.net>
CC: Rajat Jain <rajatja@google.com>
CC: Kirtika Ruchandani <kirtika@chromium.org>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Kirtika Ruchandani <kirtika@chromium.org>
Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
Acked-by: Joonwoo Park <joonwpark81@gmail.com>
Acked-by: Rajat Jain <rajatja@google.com>
Acked-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: read IWL_RX_MPDU_PHY_SHORT_PREAMBLE only for CCK
Johannes Berg [Mon, 29 Oct 2018 08:44:03 +0000 (09:44 +0100)]
iwlwifi: mvm: read IWL_RX_MPDU_PHY_SHORT_PREAMBLE only for CCK

Due to a general shortage of RX API bits, the firmware is going
to reuse this bit on non-CCK frames to mean something else. Use
it only on CCK frames to prepare for that change.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: fix %16 to %016 print format
Johannes Berg [Fri, 26 Oct 2018 09:04:30 +0000 (11:04 +0200)]
iwlwifi: mvm: fix %16 to %016 print format

With just %16, it means 16 characters padding, but we really
don't want to print "0x         1F4547B", but instead want to
have this filled with zeroes, so we need the 0.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: pcie: add prints to track virtual ID
Sara Sharon [Wed, 24 Oct 2018 10:43:26 +0000 (13:43 +0300)]
iwlwifi: pcie: add prints to track virtual ID

In case there are bugs in this area, this data can
help with debugging.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: iwlmvm: in monitor NDP notif take the NSS from rx_vec
Shaul Triebitz [Wed, 24 Oct 2018 15:37:46 +0000 (18:37 +0300)]
iwlwifi: iwlmvm: in monitor NDP notif take the NSS from rx_vec

Take the NSS value from 'rx_vec' rather than from 'rate_n_flags'.
The rate_n_flags has only 2 bits for the NSS giving a max of 4SS
(0 = 1SS etc.). Since there may be up to 8SS use the rx_vec which
has 3 bits for the NSS.
While at it, fix the rx_vec array to length of 2.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: iwlmvm: ignore HE PPDU type regarding EOF
Shaul Triebitz [Wed, 24 Oct 2018 09:36:18 +0000 (12:36 +0300)]
iwlwifi: iwlmvm: ignore HE PPDU type regarding EOF

When setting the EOF bit in Rx flags (propagated
to radiotap) do not depend it on the PPDU type (SU/MU/TB)
since it doesn't.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: pcie: fix the use of a wrong define
Sara Sharon [Fri, 26 Oct 2018 07:01:39 +0000 (10:01 +0300)]
iwlwifi: pcie: fix the use of a wrong define

The code checks that we haven't exceeded the maximum number of
TBs by comparing to a define of gen1 instead of gen2, fix it.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoMerge tag 'iwlwifi-next-for-kalle-2019-01-25' of git://git.kernel.org/pub/scm/linux...
Kalle Valo [Tue, 29 Jan 2019 12:56:05 +0000 (14:56 +0200)]
Merge tag 'iwlwifi-next-for-kalle-2019-01-25' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

First batch of iwlwifi patches intended for v5.1

* Support for Target Wakeup Time (TWT) -- a feature that allows the AP
  to specify when individual stations can access the medium;
* Support for mac80211 AMSDU handling;
* Debugging infrastructure work;
* Preparations for improvements in the device selection code;
* Some new PCI IDs;
* Some updates in the documentation;
* A bunch of fixes for issues found with static analyzers;
* A couple of janitorial fixes from the community;
* Some fixes in P2P;
* Other cleanups and small fixes;

5 years agoiwlwifi: fw api: document WoWLAN patterns command
Johannes Berg [Wed, 24 Oct 2018 07:50:08 +0000 (09:50 +0200)]
iwlwifi: fw api: document WoWLAN patterns command

Document the WoWLAN patterns command structure.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: fw api: remove unused/deprecated filter status
Johannes Berg [Tue, 23 Oct 2018 18:51:56 +0000 (20:51 +0200)]
iwlwifi: fw api: remove unused/deprecated filter status

These are unused by both firmware and driver, remove them.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: avoid access out of memory allocated
Mordechay Goodstein [Sun, 21 Oct 2018 15:48:13 +0000 (18:48 +0300)]
iwlwifi: avoid access out of memory allocated

The value in num_lmac can be bigger than mem_cfg->lmac array,
warn in case it's bigger.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Fixes: 68025d5f9bfe ("iwlwifi: dbg: refactor dump code to improve readability")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: avoid possible access out of array.
Mordechay Goodstein [Sun, 21 Oct 2018 15:27:26 +0000 (18:27 +0300)]
iwlwifi: mvm: avoid possible access out of array.

The value in txq_id can be out of array scope,
validate it before accessing the array.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Fixes: cf961e16620f ("iwlwifi: mvm: support dqa-mode agg on non-shared queue")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: memcpy from dev_cmd and not dev_cmd->hdr
Liad Kaufman [Mon, 22 Oct 2018 07:12:28 +0000 (10:12 +0300)]
iwlwifi: memcpy from dev_cmd and not dev_cmd->hdr

Klocwork complains about copying from dev_cmd->hdr if
copying more than 4 bytes since it means part of the
copy is from the next field. This isn't a real bug,
but for not failing Klocwork next time - fix this.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: tighten boundary checks
Liad Kaufman [Sun, 21 Oct 2018 11:39:05 +0000 (14:39 +0300)]
iwlwifi: tighten boundary checks

The driver assumes certain sizes and lengths aren't crossed in some
places.  Make sure this indeed happens.

Found by Klocwork.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: make num_active_macs unsigned
Liad Kaufman [Sun, 21 Oct 2018 13:04:58 +0000 (16:04 +0300)]
iwlwifi: mvm: make num_active_macs unsigned

There is no point in having num_active_macs signed
since it should never be negative. Set it to be an
unsigned variable to ensure this.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: update hcmds documentation
Liad Kaufman [Mon, 8 Oct 2018 10:37:43 +0000 (13:37 +0300)]
iwlwifi: update hcmds documentation

A few commands refer to a struct that no longer exists
in the mentioned name. Our trace-cmd parsing scripts
rely on these mentioned names and can't find them,
resulting in these commands not being parsed nicely.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: Do not set RTS/CTS protection for P2P Device MAC
Ilan Peer [Wed, 17 Oct 2018 13:51:59 +0000 (16:51 +0300)]
iwlwifi: mvm: Do not set RTS/CTS protection for P2P Device MAC

As this is not needed and might cause interoperability issues
during pairing with devices that would not reply to RTS frames.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: Set Tx rate and flags when there is not station
Ilan Peer [Wed, 17 Oct 2018 11:06:19 +0000 (14:06 +0300)]
iwlwifi: mvm: Set Tx rate and flags when there is not station

When a frame is transmitted without a station, need to set the rate
and flags in the Tx command, as the FW does not have any information as
to what rate and flags should be used for this frame.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: Flush transmit queues on P2P Device ROC done
Ilan Peer [Tue, 16 Oct 2018 12:29:45 +0000 (15:29 +0300)]
iwlwifi: mvm: Flush transmit queues on P2P Device ROC done

When a time event for a P2P Device interface is done, it is possible
that there is still a frame pending for transmission that should be
flushed.

Set the IWL_MVM_STATUS_NEED_FLUSH_P2P to indicate to the ROC worker
that P2P Device station queue need also to be flushed.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: bring back mvm GSO code
Sara Sharon [Thu, 18 Oct 2018 08:03:06 +0000 (11:03 +0300)]
iwlwifi: mvm: bring back mvm GSO code

We have a slightly better TCP performance with GSO.
Add it back, it can co-exist with the code that builds
AMSDUs in mac80211.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: fix spelling mistake "registrating" -> "registering"
Colin Ian King [Thu, 11 Oct 2018 09:57:57 +0000 (10:57 +0100)]
iwlwifi: fix spelling mistake "registrating" -> "registering"

Trivial fix to spelling mistake in IWL_ERR error message

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: use kmemdup in iwl_parse_nvm_mcc_info()
YueHaibing [Fri, 5 Oct 2018 09:02:49 +0000 (09:02 +0000)]
iwlwifi: use kmemdup in iwl_parse_nvm_mcc_info()

Use kmemdup rather than duplicating its implementation in
iwl_parse_nvm_mcc_info().

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: fix values in the table example
Luca Coelho [Wed, 17 Oct 2018 06:04:09 +0000 (09:04 +0300)]
iwlwifi: mvm: fix values in the table example

We erroneously had some values for NGI in the table we give as an
example in rs_fill_rates_for_column(), when they should be SGI.
Change them so that they match what we say.

Reported-by: Rémy Grünblatt <remy@grunblatt.org>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: support mac80211 AMSDU
Sara Sharon [Tue, 28 Aug 2018 07:08:35 +0000 (10:08 +0300)]
iwlwifi: mvm: support mac80211 AMSDU

Support getting mac80211 building AMSDUs for us. Remove GSO
support from mvm - we don't need it anymore.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: support mac80211 TXQs model
Sara Sharon [Tue, 21 Aug 2018 12:23:39 +0000 (15:23 +0300)]
iwlwifi: mvm: support mac80211 TXQs model

Move to use the new mac80211 TXQs implementation. This has
quite a few benefits for us. We can get rid of the awkward
mapping of DQA to mac80211 queues. We can stop buffering
traffic while waiting for the queue to be allocated. We can
also use mac80211 AMSDUs instead of building it ourselves.

The usage is pretty simple:
Each ieee80211_txq contains iwl_mvm_txq. There is such a
queue for each TID, and one for management frames. We keep
having static AP queues for probes and non-bufferable MMPDUs,
along with broadcast and multicast queues. Those are being
used from the "old" TX invocation path - iwl_mvm_mac_tx.

When there is a new frame in a TXQ, iwl_mvm_mac_wake_tx is
being called, and either invokes the TX path, or allocates
the queue if it does not exist.

Most of the TX path is left untouched, although we can consider
cleaning it up some more, for example get rid of the duplication
of txq_id in both iwl_mvm_txq and iwl_mvm_dqa_txq_info.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: make NVM access actually fail on failures
Johannes Berg [Fri, 12 Oct 2018 07:35:00 +0000 (09:35 +0200)]
iwlwifi: mvm: make NVM access actually fail on failures

On any failure, including if we crash the firmware or get garbage
data, we currently ignore this and pretend the OTP was empty.
Clearly, this isn't typically the case.

In cases other than the firmware saying it can't read the requested
section, or the section having ended, make the access actually fail
and trickle the error up through the layers to fail init.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: wrt: add 22000 device familiy prph dump support
Shahar S Matityahu [Tue, 2 Oct 2018 11:13:48 +0000 (14:13 +0300)]
iwlwifi: wrt: add 22000 device familiy prph dump support

Add prph dump addresses to support prph dump in 22000 HW.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: pcie: remove suspend/resume workaround for 9000A devices
Luca Coelho [Thu, 4 Oct 2018 12:23:37 +0000 (15:23 +0300)]
iwlwifi: pcie: remove suspend/resume workaround for 9000A devices

We don't support 9000 A-step devices anymore, so we can remove the
suspend/resume workaround.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: pcie: remove unnecessary iwl_pcie_enable_rx_wake() function
Luca Coelho [Thu, 4 Oct 2018 12:20:38 +0000 (15:20 +0300)]
iwlwifi: pcie: remove unnecessary iwl_pcie_enable_rx_wake() function

This function was only used by 9000 A-step devices, which we don't
support anymore, so it can be removed.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: remove support for 9000 A-step devices
Luca Coelho [Thu, 4 Oct 2018 11:28:02 +0000 (14:28 +0300)]
iwlwifi: remove support for 9000 A-step devices

We don't support 9000 A-step devices anymore, so we can remove support
for loading both the a0/a0 and a0/b0 FWs.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: fix firmware statistics usage
Emmanuel Grumbach [Thu, 4 Oct 2018 07:41:45 +0000 (10:41 +0300)]
iwlwifi: mvm: fix firmware statistics usage

The new (CDB) statistics API is used by non-CDB devices
as well. Look at the right TLV flag to know which version
of the statistics notification to use.
To avoid confusion, remove the _cdb suffix from the
structure name.
While at it, remove a structure that was never used.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Fixes: 678d9b6dddea ("iwlwifi: mvm: update rx statistics cmd api")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: add new cards for 22560, 9260 and killer series
Ihab Zhaika [Sun, 5 Aug 2018 13:05:25 +0000 (16:05 +0300)]
iwlwifi: add new cards for 22560, 9260 and killer series

add few PCI ID'S for 22560, 9260 and killer series.

Signed-off-by: Ihab Zhaika <ihab.zhaika@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: correct one of the PCI struct names
Ihab Zhaika [Sun, 5 Aug 2018 12:05:45 +0000 (15:05 +0300)]
iwlwifi: correct one of the PCI struct names

One of the cfg struct names is mistakenly "iwl22000", when it should
be "iwl22560".

Chage-Id: If9fbfa4bceef81d028c90c98d47115fbe39da547
Signed-off-by: Ihab Zhaika <ihab.zhaika@intel.com>
Fixes: 2f7a3863191a ("iwlwifi: rename the temporary name of A000 to the official 22000")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: fix wrong DCM TLC config
Shaul Triebitz [Sun, 16 Sep 2018 06:58:15 +0000 (09:58 +0300)]
iwlwifi: mvm: fix wrong DCM TLC config

When configuring TLC DCM flag:
1. check the peer's RX DCM capabilities (since we TX)
2. do not set DCM_NSS_2 since we do not support it

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Fixes: 423584dd8060 ("iwlwifi: rs-fw: support dcm")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: pcie: recognize NICs with hw_rev 0x364 correctly
Luca Coelho [Tue, 2 Oct 2018 08:42:28 +0000 (11:42 +0300)]
iwlwifi: pcie: recognize NICs with hw_rev 0x364 correctly

Some devices with PCI ID 0x2723, which is supposed to be 22260, are
actually not.  So we need to differentiate them by checking the hw_rev
and change the cfg accordingly.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: add PCI IDs for the 22260 device series
Luca Coelho [Tue, 25 Sep 2018 08:21:50 +0000 (11:21 +0300)]
iwlwifi: add PCI IDs for the 22260 device series

Add new structs and PCI IDs for 22260 devices.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: rely on mac80211 to configure TWT support
Emmanuel Grumbach [Wed, 12 Sep 2018 13:25:27 +0000 (16:25 +0300)]
iwlwifi: mvm: rely on mac80211 to configure TWT support

Mac80211 will check both the HE Capability IE and the
Extended Capability IE, so set the TWT support bit when
mac80211 tells us to.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: advertise support for TWT in the Extended Capability IE
Emmanuel Grumbach [Wed, 12 Sep 2018 11:10:56 +0000 (14:10 +0300)]
iwlwifi: mvm: advertise support for TWT in the Extended Capability IE

We want to advertise support for TWT in the Extended
Capability IE. Since we don't want to set the bits for all
the interface types, define an interface specific
configuration.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: wrt: add to dump number of lmacs, lmac1 and umac error id
Shahar S Matityahu [Thu, 13 Sep 2018 11:52:59 +0000 (14:52 +0300)]
iwlwifi: wrt: add to dump number of lmacs, lmac1 and umac error id

Add to the dump the number of lmacs, the error id of the umac
and the error id of lmac1, if supported.
In case the reason for the dump trigger is not an assert
the error id is zero.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: pcie: make array 'prop' static, shrinks object size
Colin Ian King [Tue, 21 Aug 2018 10:21:09 +0000 (11:21 +0100)]
iwlwifi: pcie: make array 'prop' static, shrinks object size

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

Before:
   text    data     bss     dec     hex filename
  80138   15382     576   96096   17760 drivers/net/wireless/intel/iwlwifi/pcie/trans.o

After:
   text    data     bss     dec     hex filename
  79948   15542     576   96066   17742 drivers/net/wireless/intel/iwlwifi/pcie/trans.o

(gcc version 8.2.0 x86_64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agomt76: avoid scheduling tx queues for powersave stations
Felix Fietkau [Mon, 21 Jan 2019 16:33:38 +0000 (17:33 +0100)]
mt76: avoid scheduling tx queues for powersave stations

In case a tx queue wake call arrives after a client has transitioned to
powersave, make sure that the queue is not kept active until the client
has left powersave mode

Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: fix per-chain signal strength reporting
Felix Fietkau [Tue, 22 Jan 2019 15:33:53 +0000 (16:33 +0100)]
mt76: fix per-chain signal strength reporting

Fix an off-by-one error that resulted in not reporting the signal strength
for the first chain

Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: do not report out-of-range rx nss
Lorenzo Bianconi [Sat, 19 Jan 2019 15:00:26 +0000 (16:00 +0100)]
mt76: do not report out-of-range rx nss

Take into account device rx stream in mt76x02_mac_process_rate
in order to not report wrong number of rx spatial stream to mac80211.
The issue has been reported on mt76x0 device which is 1x1:1 however
the hw sometimes reports rx nss equal to 2

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: add channel switch announcement support
Felix Fietkau [Tue, 15 Jan 2019 13:26:53 +0000 (14:26 +0100)]
mt76: add channel switch announcement support

Use the appropriate mac80211 callbacks after beacon transmission

Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: fix signedness of rx status signal field
Felix Fietkau [Sat, 29 Dec 2018 12:01:31 +0000 (13:01 +0100)]
mt76: fix signedness of rx status signal field

It is usually negative, so it needs to be signed.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: fix rssi ewma tracking
Felix Fietkau [Fri, 11 Jan 2019 13:17:30 +0000 (14:17 +0100)]
mt76: fix rssi ewma tracking

The generic EWMA code cannot deal with negative numbers, so convert signal
to a positive number before adding it
Fixes mt76x2 AGC tuning

Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: move mt76x02_phy_get_min_avg_rssi to mt76 core
Felix Fietkau [Wed, 5 Dec 2018 16:06:58 +0000 (17:06 +0100)]
mt76: move mt76x02_phy_get_min_avg_rssi to mt76 core

This will be used by mt7603 as well

Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: move mt76x02_get_txpower to mt76 core
Felix Fietkau [Thu, 6 Dec 2018 13:27:34 +0000 (14:27 +0100)]
mt76: move mt76x02_get_txpower to mt76 core

It will be reused by mt7603 later

Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: set IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR flag
Felix Fietkau [Wed, 16 Jan 2019 21:33:18 +0000 (22:33 +0100)]
mt76: set IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR flag

The hardware does not deal with multiple WCID entries for the same station
properly. Set IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR to avoid those cases

Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: fix tx status reporting for non-probing frames
Felix Fietkau [Fri, 11 Jan 2019 12:37:43 +0000 (13:37 +0100)]
mt76: fix tx status reporting for non-probing frames

On MT76x2, the hardware does not report tx status in the FIFO register,
if the packet id is 0.
Change the allocation of packet IDs to use 0 for no-ack packets, 1 for
non-probing packets and 2-255 for packets with tx status requested.
Fixes rate control issues

Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: add led support to mt76x0e driver
Lorenzo Bianconi [Thu, 10 Jan 2019 13:27:06 +0000 (14:27 +0100)]
mt76: add led support to mt76x0e driver

Move mt76x02 led support in mt76x02-lib module in order to
add tpt led trigger to mt76x0e driver

Tested-by: LGA1150 <dqfext@gmail.com>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: use proper name for __MT76x02_H macro
Lorenzo Bianconi [Thu, 10 Jan 2019 11:14:04 +0000 (12:14 +0100)]
mt76: use proper name for __MT76x02_H macro

Use proper name for __MT76x02_H macro in mt76x02.h

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: dma: avoid indirect call in mt76_dma_tx_queue_skb
Lorenzo Bianconi [Mon, 31 Dec 2018 14:42:54 +0000 (15:42 +0100)]
mt76: dma: avoid indirect call in mt76_dma_tx_queue_skb

Call mt76_dma_add_buf routine directly in mt76_dma_tx_queue_skb
and avoid indirect call if not necessary

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: make const array 'data' static, shrinks object size
Colin Ian King [Sun, 30 Dec 2018 13:26:40 +0000 (13:26 +0000)]
mt76: make const array 'data' static, shrinks object size

Don't populate the const array 'data' on the stack but instead
make it static. Makes the object code smaller by 78 bytes:

Before:
   text    data     bss     dec     hex filename
   5438    1080       0    6518    1976 mediatek/mt76/mt76x2/usb_mcu.o

After:
   text    data     bss     dec     hex filename
   5296    1144       0    6440    1928 mediatek/mt76/mt76x2/usb_mcu.o

(gcc version 8.2.0 x86_64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: mmio: introduce mt76x02_check_tx_hang watchdog
Lorenzo Bianconi [Fri, 28 Dec 2018 14:44:09 +0000 (15:44 +0100)]
mt76: mmio: introduce mt76x02_check_tx_hang watchdog

Port mt76x02_check_tx_hang watchdog from vendor driver in order to
perform a device reset when tx mac/dma logic hangs. Tx mac/dma stuck
has been observed when the device is heavy loaded or in a noisy
environment. Moreover introduce wdt delayed work in order to run
tx_hang watchdog. For the moment run mt76x02_check_tx_hang watchdog
just on mt76x2 devices since the issue has not been observed on mt76x0
driver yet

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: dma: do not build skb if reported len does not fit in buf_size
Lorenzo Bianconi [Mon, 3 Dec 2018 14:34:24 +0000 (15:34 +0100)]
mt76: dma: do not build skb if reported len does not fit in buf_size

Precompute data length in order to avoid to allocate the related
skb data structure if reported length does not fit in queue buf_size

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: mac: minor optimizations in mt76x02_mac_tx_rate_val
Lorenzo Bianconi [Fri, 28 Dec 2018 10:00:47 +0000 (11:00 +0100)]
mt76: mac: minor optimizations in mt76x02_mac_tx_rate_val

Do not set bw variable to zero for legacy rates since it is already
initialized to zero. Moreover set nss to 1 just for legacy rates
since nss will be properly set for VHT/HT rates

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: add energy detect CCA support to mt76x{0,2}e drivers
Lorenzo Bianconi [Wed, 12 Dec 2018 21:51:55 +0000 (22:51 +0100)]
mt76: add energy detect CCA support to mt76x{0,2}e drivers

Ported from the reference driver. Should fix compliance with ETSI
regulatories on preventing transmission while energy detect values
are above the threshold.
The code has been tested using an ath9k device running tx99 as
noise generator

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76x2: init: set default value for MT_TX_LINK_CFG
Lorenzo Bianconi [Wed, 12 Dec 2018 21:51:54 +0000 (22:51 +0100)]
mt76x2: init: set default value for MT_TX_LINK_CFG

Update default value for MT_TX_LINK_CFG according to vendor driver

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: dfs: run mt76x02_dfs_set_domain atomically
Lorenzo Bianconi [Wed, 12 Dec 2018 21:51:53 +0000 (22:51 +0100)]
mt76: dfs: run mt76x02_dfs_set_domain atomically

Grab mt76_dev mutex in mt76x02_dfs_set_domain since it runs
concurrently with mt76x{0,2}_set_channel routines

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>