Commit Graph

810415 Commits

Author SHA1 Message Date
Colin Ian King
b0535d502d cw1200: fix indentation issues
There are two lines that have indentation issues, fix these.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-02-01 14:19:07 +02:00
Colin Ian King
6dcbe4592e libertas: fix indentation issue
There is a statement that is incorrectly indented, fix it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-02-01 14:18:37 +02:00
Bernd Edlinger
a4296994eb rt2x00: Work around a firmware bug with shared keys
Apparently the rt2x61 firmware fails temporarily to decode
broadcast packets if the shared keys are not assigned
in the "correct" sequence. At the same time unicast
packets work fine, since they are encrypted with the
pairwise key.

At least with WPA2 CCMP mode the shared keys are
set in the following sequence: keyidx=1, 2, 1, 2.
After a while only keyidx 2 gets decrypted, and
keyidx 1 is ignored, probably because there is never
a keyidx 3.

Symptoms are arping -b works for 10 minutes, since
keyidx=2 is used for broadcast, and then it stops
working for 10 minutes, because keyidx=1 is used.
That failure mode repeats forever.

Note, the firmware does not even know which keyidx
corresponds to which hw_key_idx so the firmware is
trying to be smarter than the driver, which is bound
to fail.

As workaround the function rt61pci_config_shared_key
requests software decryption of the shared keys,
by returning EOPNOTSUPP. However, pairwise keys are
still handled by hardware which works just fine.

Signed-off-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-02-01 14:16:05 +02:00
Sergey Matyukevich
3844dec0f4 qtnfmac: qtnf_cmd_send_with_reply cleanup
Use existing variable with dereferenced cmd_id field.

Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-02-01 14:12:10 +02:00
Sergey Matyukevich
324b8cad8c qtnfmac: remove unused declarations
Remove declarations for inexistent functions from bus.h header.

Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-02-01 14:12:07 +02:00
Sergey Matyukevich
23781af741 qtnfmac: add missing bss record to host scan cache
Make sure that valid BSS entry exists in wireless core record
even in the case of successful connect reported by firmware.

Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-02-01 14:12:05 +02:00
Sergey Matyukevich
ff233cb515 qtnfmac: convert to SPDX license identifiers
Replace textual license with SPDX-License-Identifier.
Add an SPDX-License-Identifier for the Makefile.

Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-02-01 14:12:02 +02:00
Sergey Matyukevich
f3c8bd46c7 qtnfmac: do not reject retry changes in driver
Do not reject RETRY changes in driver. This decision
should belong to firmware.

Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-02-01 14:12:01 +02:00
Sergey Matyukevich
9fe504a131 qtnfmac: switch to 32bit values for RTS/FRAG thresholds
Host wireless stack uses u32 type for RTS/FRAG threshold values.
Switch to u32 in driver: pass u32 values to firmware and let
firmware properly adapt these values according to its
internal representation.

Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-02-01 14:11:57 +02:00
Sergey Matyukevich
de624a355d qtnfmac: add support for 4addr mode
Advertise WIPHY_FLAG_4ADDR_STATION capability to wireless core. Send
use4addr interface change flag to firmware in change_virtual_intf
cfg80211 callback.

In order to enable adding wireless station interface to bridge
one should turn on 4addr mode using the following command:
$ iw dev wlan0 set 4addr on
$ brctl addif br0 wlan0

If this commands succeeds, then interface can be added to bridge.
Note that when wireless interface is added to bridge, wpa_supplicant
should be started with appropriate -b <brname> parameter, e.g:
$ wpa_supplicant -Dnl80211 -iwlan0 -c/path/to/wpa.conf -b br0

Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-02-01 14:11:55 +02:00
Sergey Matyukevich
d1365e794e qtnfmac: fix INTx interrupt handling
In the current implementation INTx interrupt is deasserted after the
control path processing. However this may lead to missed interrupts
from the wireless card. For instance, this may happen as a result
of control path activity, when another interrupt arrives before
INTx is deasserted.

Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-02-01 14:11:52 +02:00
Andrey Shevchenko
126824f5ce qtnfmac: support EBUSY errcode for QLINK protocol
Add support of EBUSY error code for remote procedures over QLINK protocol.

Signed-off-by: Andrey Shevchenko <ashevchenko@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-02-01 14:11:52 +02:00
Hemantkumar Suthar
1a0f547831 mwifiex: add support for sd8977 chipset
This patch adds support for 8977 chipset to mwifiex with SDIO
interface. Register offsets and supported feature flags are
updated. Firmware image used will be mrvl/sd8977_uapsta.bin.

Signed-off-by: Hemantkumar Suthar <shemant@marvell.com>
Signed-off-by: Rakesh Parmar <rakeshp@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-02-01 14:08:11 +02:00
Bernd Edlinger
051337d412 rtlwifi: Don't clear num_rx_inperiod too early
This patch moves the clearing of rtlpriv->link_info.num_rx_inperiod in
rtl_watchdog_wq_callback a few lines down.

This is necessary since it is still used in the "AP off" detection
code block. Moved clearing of rtlpriv->link_info.num_rx_inperiod
as well for consistency.

Signed-off-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-02-01 14:07:31 +02:00
Bernd Edlinger
28484b6b37 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>
2019-02-01 14:07:30 +02:00
Bernd Edlinger
5bb5385fbf 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>
2019-02-01 14:07:29 +02:00
Bernd Edlinger
46b87976d7 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 873ffe154a ("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>
2019-02-01 14:07:28 +02:00
Kangjie Lu
434256833d 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>
2019-02-01 14:06:28 +02:00
Gustavo A. R. Silva
db040dfa53 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>
2019-02-01 14:05:44 +02:00
Tomislav Požega
c2e28ef771 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>
2019-02-01 14:05:03 +02:00
Luca Coelho
3864be5514 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: 9bf13bee2d ("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>
2019-01-31 15:34:22 +02:00
Kalle Valo
d4065e90dc 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;
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEF3LNfgb2BPWm68smoUecoho8xfoFAlxQX0IACgkQoUecoho8
 xfrGQg//aKSTSQQDDEZdM0Gt+HUoCXr3DmJyc8UTq3HWark4u9mzrWfA66kCo9Zj
 Fbuw/6ijEYjM4eU/0J+dVuOEDDR3ZRlvnJfWginn0CzJyqY+16zpUFVXpFU7RQ0L
 Z0YEDKCn3W6KmS3ro6L3AHADpxRgvJS9AzVsjyARbQk9N3Z3zdIpBc97CCYd6aYc
 qh+IahBT56Bg19EBOY5FHjntFiSVtnT9AuC6s8Npz1lnZOM8fyknuo2x1psQuzWT
 kMCC9q3mQxRvQXo4hCIJa4+9RQ0wYWriL0RJPOrEWdA2WevuYSUiuGzD2W35jZFl
 cTX8b4EeMSznG2Lreg+UQyMCVDuRVLGcgJmdlRvKURjQyp978MigIMpHgN8gKx1f
 4A9UVGBzqwgA7YLmIsb2KHQytVJ4USpaFpz/kAEp4YQMxdM/xj6gpIVpvhUn/152
 oxpxx40P3hyzYBTdTVBHbh1qUrv+Bu5hxQMnXe+yW9BqXOwcfizSr0n2Ebi9Ij93
 kjlq4Uy0hm52R/lExKFfsbDMFkp/7YQ1j/8NCWq5j0KcXenllP4oixYkUAnm2Rmr
 0k56xV5EmFRy0t4cmbvwSubBwX6cCMh8FpN+/TffSHB5RjSQsqXFC+kUg/kDq7lU
 Ec1tqt5/9wY0heDl1KPlROTTAUi4MQ1U8tdSzeqDsE+KdNpAGEk=
 =7bNM
 -----END PGP SIGNATURE-----

Merge tag 'iwlwifi-next-for-kalle-2019-01-29' of git://git.kernel.org/pub/scm/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;
2019-01-30 13:07:49 +02:00
Kalle Valo
1899405c98 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
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG/MacGPG2 v2
 Comment: GPGTools - http://gpgtools.org
 
 iEYEABECAAYFAlxHOf4ACgkQ130UHQKnbvUnmwCg1qdMIcAUT28xG2my8VxqelEP
 BpMAn2uqBD+P+QBIgyXDN3GGF0P+UOWu
 =exYK
 -----END PGP SIGNATURE-----

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
2019-01-30 13:03:38 +02:00
Shahar S Matityahu
01f377dc92 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: c2d202017d ("iwlwifi: pcie: add firmware monitor capabilities")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2019-01-29 16:10:33 +02:00
Shahar S Matityahu
55fbf0d21c 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: 7a14c23dcd ("iwlwifi: dbg: dump data according to the new ini TLVs")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2019-01-29 16:10:33 +02:00
Shahar S Matityahu
b2aea95c18 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: fe1b7d6c28 ("iwlwifi: add support for triggering ini triggers")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2019-01-29 16:10:33 +02:00
Shahar S Matityahu
cd0fc658fb 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: 7a14c23dcd ("iwlwifi: dbg: dump data according to the new ini TLVs")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2019-01-29 16:10:33 +02:00
Shahar S Matityahu
07a44b3223 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: d47902f9f7 ("iwlwifi: dbg: add apply point logic")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2019-01-29 16:10:33 +02:00
Shaul Triebitz
40ecdd01d4 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>
2019-01-29 16:10:33 +02:00
Shahar S Matityahu
487ec49c35 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>
2019-01-29 16:10:32 +02:00
Johannes Berg
9bf13bee2d 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>
2019-01-29 16:10:32 +02:00
Johannes Berg
81444538ac 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>
2019-01-29 16:10:32 +02:00
Ihab Zhaika
98f0d01abc 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>
2019-01-29 16:10:32 +02:00
Mordechay Goodstein
fdd6c9419b 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>
2019-01-29 16:10:32 +02:00
Emmanuel Grumbach
311590a3a2 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>
2019-01-29 16:10:32 +02:00
David Spinadel
57e861d936 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>
2019-01-29 16:10:32 +02:00
Johannes Berg
5213e8a8a2 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>
2019-01-29 16:10:32 +02:00
Johannes Berg
6c161980ba 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>
2019-01-29 16:10:31 +02:00
Andrei Otcheretianski
babea2d4fe 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>
2019-01-29 16:10:31 +02:00
Johannes Berg
93079fd5c0 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>
2019-01-29 16:10:31 +02:00
Johannes Berg
4841914ef4 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>
2019-01-29 16:10:31 +02:00
Johannes Berg
3a894a9f31 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>
2019-01-29 16:10:31 +02:00
Sara Sharon
fba8248e7e 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>
2019-01-29 16:10:30 +02:00
Johannes Berg
1f7698abed 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: fbe4112791 ("iwlwifi: mvm: update mpdu metadata API")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2019-01-29 16:10:30 +02:00
Sara Sharon
698478c492 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>
2019-01-29 16:10:30 +02:00
Shahar S Matityahu
fefbf85305 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>
2019-01-29 16:10:30 +02:00
Liad Kaufman
34a880d8bd 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>
2019-01-29 16:10:30 +02:00
Luca Coelho
9adcc117bc 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>
2019-01-29 16:10:30 +02:00
Luca Coelho
29cf396f08 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>
2019-01-29 16:10:30 +02:00
Luca Coelho
94a8d87c47 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>
2019-01-29 16:10:30 +02:00