]> asedeno.scripts.mit.edu Git - linux.git/log
linux.git
5 years agoMerge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
Kalle Valo [Thu, 20 Dec 2018 17:25:43 +0000 (19:25 +0200)]
Merge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git

ath.git patches for 4.21. Major changes:

ath10k

* add amsdu support for QCA6174 monitor mode

* report tx rate using the new ieee80211_tx_rate_update() API

* wcn3990 support is not experimental anymore

5 years agoath10k: add support to configure BB timing over wmi
Bhagavathi Perumal S [Thu, 20 Dec 2018 12:26:00 +0000 (14:26 +0200)]
ath10k: add support to configure BB timing over wmi

Add wmi configuration cmd to configure base band(BB) power amplifier(PA)
off timing values in hardware. The default PA off timings were fine tuned
to make proper DFS radar detection in QCA reference design. If ODM uses
different PA in their design, then the same default PA off timing values
cannot be used, it requires different settling time to detect radar pulses
very sooner and avoid radar detection problems. In that case it provides
provision to select proper PA off timing values based on the PA hardware used.
The PA component is part of FEM hardware and new device tree entry
"ext-fem-name" is used to indentify the FEM hardware. And this wmi configuration
cmd is enabled via wmi service flag "WMI_SERVICE_BB_TIMING_CONFIG_SUPPORT".

Other way is to apply these values through calibration data, but recalibration
of all boards out there might not be feasible.

This change tested on firmware ver 10.2.4-1.0-00042 in QCA988X chipset.

Signed-off-by: Bhagavathi Perumal S <bperumal@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agodt-bindings: net: ath10k: add new dt entry to identify external FEM
Bhagavathi Perumal S [Thu, 20 Dec 2018 12:25:43 +0000 (14:25 +0200)]
dt-bindings: net: ath10k: add new dt entry to identify external FEM

This adds new dt entry ext-fem-name, it is used by ath10k driver
to select correct timing parameters and configure it in target wifi hardware.
The Front End Module(FEM) normally includes tx power amplifier(PA) and
rx low noise amplifier(LNA). The default timing parameters like tx end to
PA off timing values were fine tuned for internal FEM used in reference
design. And these timing values can not be same if ODM modifies hardware
design with different external FEM. This DT entry helps to choose correct
timing values in driver if different external FEM hardware used.

Signed-off-by: Bhagavathi Perumal S <bperumal@codeaurora.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agodt-bindings: net: ath10k: fix node name and device type in qcom ath10k example
Bhagavathi Perumal S [Thu, 20 Dec 2018 12:25:32 +0000 (14:25 +0200)]
dt-bindings: net: ath10k: fix node name and device type in qcom ath10k example

In qcom,ath10k documentation, ath10k is used as node name in the example of
pci based device. Normally, node name should be class of device and not the
model name, so fix it to node name "wifi". And remove the property device_type
pci since only pci bridges should have this property.

Signed-off-by: Bhagavathi Perumal S <bperumal@codeaurora.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath10k: fix tx_stats memory leak
Zhi Chen [Thu, 20 Dec 2018 12:25:18 +0000 (14:25 +0200)]
ath10k: fix tx_stats memory leak

Memory of tx_stats was allocated when a STA was added. But it's not freed
if the STA failed to be added to driver. This issue could be seen in MDK3
attack case when STA number reached the limit.

Tested: QCA9984 with firmware ver 10.4-3.9.0.1-00005
Signed-off-by: Zhi Chen <zhichen@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath10k: fix peer stats null pointer dereference
Zhi Chen [Thu, 20 Dec 2018 12:24:43 +0000 (14:24 +0200)]
ath10k: fix peer stats null pointer dereference

There was a race condition in SMP that an ath10k_peer was created but its
member sta was null. Following are procedures of ath10k_peer creation and
member sta access in peer statistics path.

    1. Peer creation:
        ath10k_peer_create()
            =>ath10k_wmi_peer_create()
                =>ath10k_wait_for_peer_created()
                ...

        # another kernel path, RX from firmware
        ath10k_htt_t2h_msg_handler()
        =>ath10k_peer_map_event()
                =>wake_up()
                # ar->peer_map[id] = peer //add peer to map

        #wake up original path from waiting
                ...
                # peer->sta = sta //sta assignment

    2.  RX path of statistics
        ath10k_htt_t2h_msg_handler()
            =>ath10k_update_per_peer_tx_stats()
                =>ath10k_htt_fetch_peer_stats()
                # peer->sta //sta accessing

Any access of peer->sta after peer was added to peer_map but before sta was
assigned could cause a null pointer issue. And because these two steps are
asynchronous, no proper lock can protect them. So both peer and sta need to
be checked before access.

Tested: QCA9984 with firmware ver 10.4-3.9.0.1-00005
Signed-off-by: Zhi Chen <zhichen@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agodt: bindings: ath10k: add bindings for wifi iommu node
Govind Singh [Thu, 20 Dec 2018 12:24:23 +0000 (14:24 +0200)]
dt: bindings: ath10k: add bindings for wifi iommu node

WCN3990 wifi module can optionally make use of the IOMMU.
Add binding documentation for phandle to the IOMMU and
the stream id of wifi iommu block.

Signed-off-by: Govind Singh <govinds@codeaurora.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agodt: bindings: ath10k: add missing dt properties for WCN3990 wifi node
Govind Singh [Thu, 20 Dec 2018 12:24:10 +0000 (14:24 +0200)]
dt: bindings: ath10k: add missing dt properties for WCN3990 wifi node

Add missing optional properties in WCN3990 wifi node.

Signed-off-by: Govind Singh <govinds@codeaurora.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath10k: remove an unnecessary NULL check
Dan Carpenter [Thu, 20 Dec 2018 07:53:45 +0000 (09:53 +0200)]
ath10k: remove an unnecessary NULL check

The "survey" pointer is the address of an array element.  We know that
it can't be NULL so this check can be removed.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath10k: move non-fatal warn logs to dbg level
Govind Singh [Thu, 20 Dec 2018 07:53:43 +0000 (09:53 +0200)]
ath10k: move non-fatal warn logs to dbg level

During driver load below warn logs are printed in the console.
Since driver may not implement all wmi events sent by fw and
all of them are non-fatal, move this log to debug level to
remove un-necessary warn message on console.

[  361.887230] ath10k_snoc a000000.wifi: Unknown eventid: 16393
[  361.907037] ath10k_snoc a000000.wifi: Unknown eventid: 237569

Signed-off-by: Govind Singh <govinds@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath10k: fix a NULL vs IS_ERR() check
Dan Carpenter [Thu, 20 Dec 2018 07:53:41 +0000 (09:53 +0200)]
ath10k: fix a NULL vs IS_ERR() check

The devm_memremap() function doesn't return NULLs, it returns error
pointers.

Fixes: ba94c753ccb4 ("ath10k: add QMI message handshake for wcn3990 client")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath10k: remove work in progress logs from snoc driver
Govind Singh [Thu, 20 Dec 2018 07:53:36 +0000 (09:53 +0200)]
ath10k: remove work in progress logs from snoc driver

All the necessary patches to make wifi running (over SNOC)
are merged and tested on SDM845/QCS404 platform with WCN3990
wifi module, hence remove work in progress debug from snoc
driver and Kconfig.

Signed-off-by: Govind Singh <govinds@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath10k: fix warning due to msdu limit error
Bhagavathi Perumal S [Thu, 20 Dec 2018 07:53:34 +0000 (09:53 +0200)]
ath10k: fix warning due to msdu limit error

Some hardwares variants (QCA99x0) are limiting msdu deaggregation with
some threshold value(default limit in QCA99x0 is 64 msdus), it was introduced to
avoid excessive MSDU-deaggregation in error cases. When number of sub frames
exceeds the limit, target hardware will send all msdus starting from present
msdu in RAW format as a single msdu packet and it will be indicated with
error status bit "RX_MSDU_END_INFO0_MSDU_LIMIT_ERR" set in rx descriptor.
This msdu frame is a partial raw MSDU and does't have first msdu and ieee80211
header. It caused below warning message.

[  320.151332] ------------[ cut here ]------------
[  320.155006] WARNING: CPU: 0 PID: 3 at drivers/net/wireless/ath/ath10k/htt_rx.c:1188

In our issue case, MSDU limit error happened due to FCS error and generated
this warning message.

This fixes the warning by handling the MSDU limit error. If msdu limit error
happens, driver adds first MSDU's ieee80211 header and sets A-MSDU present bit
in QOS header so that upper layer processes this frame if it is valid or drop it
if FCS error set. And removed the warning message, hence partial msdus without
first msdu is expected in msdu limit error cases.

Tested on QCA9984, Firmware 10.4-3.6-00104

Signed-off-by: Bhagavathi Perumal S <bperumal@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath10k: disable 4addr source port learning in 10.4 FW by default
Sathishkumar Muruganandam [Thu, 20 Dec 2018 07:53:30 +0000 (09:53 +0200)]
ath10k: disable 4addr source port learning in 10.4 FW by default

Currently in 10.4 FW, all the received 4addr frames are processed for
source port learning which is enabled by default. This learning can't be
disabled by default in FW since it breaks backward compatibility.

Since ath10k uses mac80211 based 4addr mode, source port learning done in
10.4 FW is redundant and also causes issues when 3addr frames are
transmitted/received for a 4addr station.

One such visible functional impact is when GTK rekey frame from
hostapd based AP to 4addr STA is dropped in AP's 10.4 FW. This is since
GTK rekey EAPOL frame is 3addr frame on AP interface and STA enabled
with 4addr is already allowed for receiving 3addr EAPOL frames.

Source port learning implementation in 10.4 FW drops this 3addr GTK rekey
frame in AP destinated for 4addr STA causing disassociation and
re-association for every GTK rekey session. GTK rekey issue is not seen
when learning is disabled in FW.

To prevent such issues without breaking backward compatibility, FW
advertises new service bit making the source port learning configurable and
this learning is being currently disabled during ath10k vdev creation.

* Tested HW: QCA9984
* Tested FW: 10.4-3.6.0.1-00004

Signed-off-by: Sathishkumar Muruganandam <murugana@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath10k: report tx rate using ieee80211_tx_rate_update()
Anilkumar Kolli [Thu, 20 Dec 2018 07:53:28 +0000 (09:53 +0200)]
ath10k: report tx rate using ieee80211_tx_rate_update()

Mesh path metric needs tx rate information from ieee80211_tx_status()
call but in ath10k there is no mechanism to report tx rate information
via ieee80211_tx_status(), the tx rate is only accessible via
sta_statiscs() op.

Per peer tx stats has tx rate info available, Tx rate is available
to ath10k driver after every 4 PPDU sent in the air. For each PPDU,
ath10k driver updates rate informattion to mac80211 using
ieee80211_tx_rate_update().

Per peer txrate information is updated through per peer statistics
and is available for QCA9888/QCA9984/QCA4019/QCA998X only

Tested on QCA9984 with firmware-5.bin_10.4-3.5.3-00053
Tested on QCA998X with firmware-5.bin_10.2.4-1.0-00036

Signed-off-by: Anilkumar Kolli <akolli@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath10k: add amsdu support for monitor mode
Yu Wang [Thu, 20 Dec 2018 07:53:26 +0000 (09:53 +0200)]
ath10k: add amsdu support for monitor mode

When processing HTT_T2H_MSG_TYPE_RX_IN_ORD_PADDR_IND, if the length of a msdu
is larger than the tailroom of the rx skb, skb_over_panic issue will happen
when calling skb_put.  In monitor mode, amsdu will be handled in this path, and
msdu_len of the first msdu_desc is the length of the entire amsdu, which might
be larger than the maximum length of a skb, in such case, it will hit the issue
upon.

To fix this issue, process msdu list separately for monitor mode.

Successfully tested with:
QCA6174 (FW version: RM.4.4.1.c2-00057-QCARMSWP-1).

Signed-off-by: Yu Wang <yyuwang@codeaurora.org>
[kvalo@codeaurora.org: cosmetic cleanup]
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath10k: fix kernel panic due to use after free
Karthikeyan Periyasamy [Thu, 20 Dec 2018 07:53:17 +0000 (09:53 +0200)]
ath10k: fix kernel panic due to use after free

This issue arise in a race condition between ath10k_sta_state() and
ath10k_htt_fetch_peer_stats(), explained in below scenario

Steps:
1. In ath10k_sta_state(), arsta->tx_stats get deallocated before peer deletion
   when the station moves from IEEE80211_STA_NONE to IEEE80211_STA_NOTEXIST
   state.
2. Meanwhile ath10k receive HTT_T2H_MSG_TYPE_PEER_STATS message.
   In ath10k_htt_fetch_peer_stats(), arsta->tx_stats get accessed after
   the peer validation check.

Since arsta->tx_stats get freed before the peer deletion [1].
ath10k_htt_fetch_peer_stats() ended up in "use after free" situation.

Fixed this issue by moving the arsta->tx_stats free handling after the
peer deletion. so that ath10k_htt_fetch_peer_stats() will not end up in
"use after free" situation.

Kernel Panic:

Unable to handle kernel NULL pointer dereference at virtual address 00000286
pgd = d8754000
[00000286] *pgd=00000000
Internal error: Oops: 5 [#1] PREEMPT SMP ARM
...
CPU: 0 PID: 6245 Comm: hostapd Not tainted
task: dc44cac0 ti: d4a38000 task.ti: d4a38000
PC is at kmem_cache_alloc+0x7c/0x114
LR is at ath10k_sta_state+0x190/0xd58 [ath10k_core]
pc : [<c02bdc50>]    lr : [<bf916b78>]    psr: 20000013
sp : d4a39b88  ip : 00000000  fp : 00000001
r10: 00000000  r9 : 1d3bc000  r8 : 00000dc0
r7 : 000080d0  r6 : d4a38000  r5 : dd401b00  r4 : 00000286
r3 : 00000000  r2 : d4a39ba0  r1 : 000080d0  r0 : dd401b00
Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: 10c5787d  Table: 5a75406a  DAC: 00000015
Process hostapd (pid: 6245, stack limit = 0xd4a38238)
Stack: (0xd4a39b88 to 0xd4a3a000)
...
[<c02bdc50>] (kmem_cache_alloc) from [<bf916b78>] (ath10k_sta_state+0x190/0xd58 [ath10k_core])
[<bf916b78>] (ath10k_sta_state [ath10k_core]) from [<bf870d4c>] (sta_info_insert_rcu+0x418/0x61c [mac80211])
[<bf870d4c>] (sta_info_insert_rcu [mac80211]) from [<bf88634c>] (ieee80211_add_station+0xf0/0x134 [mac80211])
[<bf88634c>] (ieee80211_add_station [mac80211]) from [<bf83f3c4>] (nl80211_new_station+0x330/0x36c [cfg80211])
[<bf83f3c4>] (nl80211_new_station [cfg80211]) from [<bf6c4040>] (extack_doit+0x2c/0x74 [compat])
[<bf6c4040>] (extack_doit [compat]) from [<c05c285c>] (genl_rcv_msg+0x274/0x30c)
[<c05c285c>] (genl_rcv_msg) from [<c05c1d98>] (netlink_rcv_skb+0x58/0xac)
[<c05c1d98>] (netlink_rcv_skb) from [<c05c25d4>] (genl_rcv+0x20/0x34)
[<c05c25d4>] (genl_rcv) from [<c05c1750>] (netlink_unicast+0x11c/0x204)
[<c05c1750>] (netlink_unicast) from [<c05c1be0>] (netlink_sendmsg+0x30c/0x370)
[<c05c1be0>] (netlink_sendmsg) from [<c0587e90>] (sock_sendmsg+0x70/0x84)
[<c0587e90>] (sock_sendmsg) from [<c058970c>] (___sys_sendmsg.part.3+0x188/0x228)
[<c058970c>] (___sys_sendmsg.part.3) from [<c058a594>] (__sys_sendmsg+0x4c/0x70)
[<c058a594>] (__sys_sendmsg) from [<c0208c80>] (ret_fast_syscall+0x0/0x44)
Code: ebfffec1 e1a04000 ea00001b e5953014 (e7940003)
ath10k_pci 0000:01:00.0: SWBA overrun on vdev 0, skipped old beacon

Hardware tested: QCA9984
Firmware tested: 10.4-3.6.0.1-00004

Fixes: a904417fc ("ath10k: add extended per sta tx statistics support")
Signed-off-by: Karthikeyan Periyasamy <periyasa@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath10k: remove set but not used variable 'num_tdls_vifs'
YueHaibing [Thu, 20 Dec 2018 07:53:10 +0000 (09:53 +0200)]
ath10k: remove set but not used variable 'num_tdls_vifs'

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

drivers/net/wireless/ath/ath10k/mac.c: In function 'ath10k_sta_state':
drivers/net/wireless/ath/ath10k/mac.c:6238:7: warning:
 variable 'num_tdls_vifs' set but not used [-Wunused-but-set-variable]

'num_tdls_vifs' not used any more after
  9a993cc1ea95 ("ath10k: fix the logic of limiting tdls peer counts")

Also, remove the single called function ath10k_mac_tdls_vifs_count
and ath10k_mac_tdls_vifs_count_iter.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agowil6210: remove set but not used variable 'wdev'
YueHaibing [Wed, 5 Dec 2018 07:59:03 +0000 (07:59 +0000)]
wil6210: remove set but not used variable 'wdev'

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

drivers/net/wireless/ath/wil6210/main.c: In function '_wil6210_disconnect':
drivers/net/wireless/ath/wil6210/main.c:407:23: warning:
 variable 'wdev' set but not used [-Wunused-but-set-variable]

It never used since commit ("e1b43407c034 wil6210: refactor disconnect flow")

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agowil6210: convert to DEFINE_SHOW_ATTRIBUTE
Yangtao Li [Mon, 3 Dec 2018 13:25:57 +0000 (08:25 -0500)]
wil6210: convert to DEFINE_SHOW_ATTRIBUTE

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath6kl: Use debug instead of error message when disabled
Kyle Roeschley [Wed, 5 Dec 2018 07:43:16 +0000 (09:43 +0200)]
ath6kl: Use debug instead of error message when disabled

This is not an unexpected condition, so we don't need to be shouting to the
world about it.

Signed-off-by: Kyle Roeschley <kyle.roeschley@ni.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath6kl: Fix off by one error in scan completion
Kyle Roeschley [Wed, 5 Dec 2018 07:43:13 +0000 (09:43 +0200)]
ath6kl: Fix off by one error in scan completion

When ath6kl was reworked to share code between regular and scheduled scans
in commit 3b8ffc6a22ba ("ath6kl: Configure probed SSID list consistently"),
probed SSID entry changed from 1-index to 0-indexed. However,
ath6kl_cfg80211_scan_complete_event() was missed in that change. Fix its
indexing so that we correctly clear out the probed SSID list.

Signed-off-by: Kyle Roeschley <kyle.roeschley@ni.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath6kl: Only use match sets when firmware supports it
Kyle Roeschley [Wed, 5 Dec 2018 07:43:11 +0000 (09:43 +0200)]
ath6kl: Only use match sets when firmware supports it

Commit dd45b7598f1c ("ath6kl: Include match ssid list in scheduled scan")
merged the probed and matched SSID lists before sending them to the
firmware. In the process, it assumed match set support is always available
in ath6kl_set_probed_ssids, which breaks scans for hidden SSIDs. Now, check
that the firmware supports matching SSIDs in scheduled scans before setting
MATCH_SSID_FLAG.

Fixes: dd45b7598f1c ("ath6kl: Include match ssid list in scheduled scan")
Signed-off-by: Kyle Roeschley <kyle.roeschley@ni.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoiwlwifi: dbg_ini: fix bad ini tlv parsing
Shahar S Matityahu [Wed, 19 Dec 2018 09:36:19 +0000 (11:36 +0200)]
iwlwifi: dbg_ini: fix bad ini tlv parsing

Add a break at the end of the ini tlv case.
Fix both the internal and external tlv parsing.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoiwlwifi: bump the API version to 43 for 9000 and 22000
Luca Coelho [Wed, 13 Jun 2018 12:26:37 +0000 (15:26 +0300)]
iwlwifi: bump the API version to 43 for 9000 and 22000

Bump the API version to 43 for 9000 and 22000 devices.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoiwlwifi: dbg: add debug data to warning
Sara Sharon [Thu, 6 Sep 2018 07:03:22 +0000 (10:03 +0300)]
iwlwifi: dbg: add debug data to warning

Add debug data to the warning issued when getting wrong region
id from firmware.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoiwlwifi: mvm: d3: use struct_size() in kzalloc()
Gustavo A. R. Silva [Fri, 24 Aug 2018 01:15:40 +0000 (20:15 -0500)]
iwlwifi: mvm: d3: 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 issue was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoiwlwifi: mvm: fix spelling mistake "Recieved" -> "Received"
Colin Ian King [Sun, 26 Aug 2018 22:31:17 +0000 (23:31 +0100)]
iwlwifi: mvm: fix spelling mistake "Recieved" -> "Received"

Trivial fix to spelling mistake in debug message.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoiwlwifi: mvm: set TWT responder capability bit in 11AX SoftAP mode
Emmanuel Grumbach [Mon, 3 Sep 2018 11:32:48 +0000 (14:32 +0300)]
iwlwifi: mvm: set TWT responder capability bit in 11AX SoftAP mode

This is needed to test TWT requester on the client side.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoiwlwifi: remove unused and wrong PHY_CFG_* macros
Luca Coelho [Thu, 30 Aug 2018 12:07:03 +0000 (15:07 +0300)]
iwlwifi: remove unused and wrong PHY_CFG_* macros

These macros are never used and are actually wrong, so it's very
confusing.  Remove them.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoiwlwifi: wrt: add rt status and num of rx/tx fifos to dump
Shahar S Matityahu [Tue, 28 Aug 2018 13:15:55 +0000 (16:15 +0300)]
iwlwifi: wrt: add rt status and num of rx/tx fifos to dump

Add the rt status of the last assert or 0 if the dump collection was
not initiated by an assert.  Add the number of rx and tx fifos in use.
These fields are added to dump info lst file.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoiwlwifi: mvm: clean up SSN incrementation
Sara Sharon [Wed, 22 Aug 2018 07:50:49 +0000 (10:50 +0300)]
iwlwifi: mvm: clean up SSN incrementation

Sometimes, due to SCD bug, we need to start the queue with an
higher SSN. The queue allocation function currently increments
the SSN in the packet itself, but it is pointless, since this
value is overridden later by iwl_mvm_tx_mpdu with the value
from mvmsta->tid_data[tid].seq_number. Updating tid data is
sufficient.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoiwlwifi: pcie: lock txq a bit later in reclaim code
Sara Sharon [Mon, 27 Aug 2018 11:07:20 +0000 (14:07 +0300)]
iwlwifi: pcie: lock txq a bit later in reclaim code

In reclaim code, we don't need to take the queue lock for
waking the queue. The code section is executed only when
the tx path is stopped, and since the reclaim path is not
executed in parallel to itself, no one can update the queue
pointers, and accessing them is safe without a lock.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoiwlwifi: mvm: take station lock later in the code
Sara Sharon [Mon, 27 Aug 2018 10:56:41 +0000 (13:56 +0300)]
iwlwifi: mvm: take station lock later in the code

There is no need to lock mvm station for transport reclaim.
Move the locking down, after the reclaim.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoiwlwifi: mvm: handle RX no data notification
Shaul Triebitz [Mon, 23 Jul 2018 08:40:30 +0000 (11:40 +0300)]
iwlwifi: mvm: handle RX no data notification

Handle RX no data notification, which is used for advertising NDP to
radiotap.

Signed-off-by: Golan Ben Ami <golan.ben.ami@intel.com>
Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoiwlwifi: split HE capabilities between AP and STA
Shaul Triebitz [Mon, 20 Aug 2018 13:07:26 +0000 (16:07 +0300)]
iwlwifi: split HE capabilities between AP and STA

HE capabilities differ between AP and STA.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoiwlwifi: make MVM and DVM depend on MAC80211
Luca Coelho [Mon, 27 Aug 2018 10:02:19 +0000 (13:02 +0300)]
iwlwifi: make MVM and DVM depend on MAC80211

It's not the iwlwifi module that depends on mac80211, but iwlmvm and
iwldvm.  To reflect this better, make MVM and DVM Kconfig options
depend on MAC80211 instead.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoiwlwifi: mvm: fix setting HE ppe FW config
Naftali Goldstein [Wed, 22 Aug 2018 09:18:19 +0000 (12:18 +0300)]
iwlwifi: mvm: fix setting HE ppe FW config

The FW expects to get the ppe value for each NSS-BW pair in the same
format as in the he phy capabilities IE, which means that a value of 0
implies ppe should be used for BPSK (mcs 0). If there are no PPE
thresholds in the IE, or if for some NSS-RU pair there's no threshold
set for it (this could happen because it's a variable-sized field), it
means no PPE should not be used for that pair, so the value sent to FW
should be 7 which corresponds to "none".

Fixes: 514c30696fbc ("iwlwifi: add support for IEEE802.11ax")
Signed-off-by: Naftali Goldstein <naftali.goldstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoiwlwifi: mvm: cleanup iwl_mvm_tx_skb_non_sta
Sara Sharon [Thu, 23 Aug 2018 10:40:16 +0000 (13:40 +0300)]
iwlwifi: mvm: cleanup iwl_mvm_tx_skb_non_sta

Make the coupling of station id and queue id clear. Group code
together. Remove outdated comment. Never use an undefined hw
queue as given from mac80211.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoiwlwifi: mvm: remove pointless NULL assignment
Sara Sharon [Thu, 23 Aug 2018 08:03:17 +0000 (11:03 +0300)]
iwlwifi: mvm: remove pointless NULL assignment

Assigning mvmsta to be NULL when we are about to exit the
function is pointless. Remove it. Move the variable declaration
to the scope it is used.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoiwlwifi: mvm: remove dead code
Sara Sharon [Thu, 23 Aug 2018 09:10:01 +0000 (12:10 +0300)]
iwlwifi: mvm: remove dead code

In iwl_mvm_tx_skb_non_sta(), in case of managed interface,
the AP station was supposed to be used for multicast frames
instead of the auxiliary station to avoid frames possibly
sent to an absent P2P GO. However, when moving to DQA mode,
this was broken as no valid queue was assigned. This is fixed
by a recent patch that directs all non-offchannel traffic to
ap station earlier in the TX path. However, the broken, and
now dead code, remained. Remove it.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoiwlwifi: pcie: use iwl_tx_cmd_gen2 and not iwl_tx_cmd
Sara Sharon [Mon, 20 Aug 2018 07:34:04 +0000 (10:34 +0300)]
iwlwifi: pcie: use iwl_tx_cmd_gen2 and not iwl_tx_cmd

When building AMSDU for gen2, code uses iwl_tx_cmd. The only
updated field is len, which is in the same location, so it
is not a bug. However, it is a bit confusing and error prone,
so change it.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoipw2x00: cleanup dead code
YueHaibing [Wed, 19 Dec 2018 03:00:13 +0000 (11:00 +0800)]
ipw2x00: cleanup dead code

Fix smatch warning:

drivers/net/wireless/intel/ipw2x00/ipw2100.c:5606
 shim__set_security() warn: always true condition '(sec->active_key <= 3) => (0-3 <= 3)'
drivers/net/wireless/intel/ipw2x00/ipw2200.c:10725
 shim__set_security() warn: always true condition '(sec->active_key <= 3) => (0-3 <= 3)'

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agocw1200: Fix concurrency use-after-free bugs in cw1200_hw_scan()
Jia-Ju Bai [Fri, 14 Dec 2018 03:55:21 +0000 (11:55 +0800)]
cw1200: Fix concurrency use-after-free bugs in cw1200_hw_scan()

The function cw1200_bss_info_changed() and cw1200_hw_scan() can be
concurrently executed.
The two functions both access a possible shared variable "frame.skb".

This shared variable is freed by dev_kfree_skb() in cw1200_upload_beacon(),
which is called by cw1200_bss_info_changed(). The free operation is
protected by a mutex lock "priv->conf_mutex" in cw1200_bss_info_changed().

In cw1200_hw_scan(), this shared variable is accessed without the
protection of the mutex lock "priv->conf_mutex".
Thus, concurrency use-after-free bugs may occur.

To fix these bugs, the original calls to mutex_lock(&priv->conf_mutex) and
mutex_unlock(&priv->conf_mutex) are moved to the places, which can
protect the accesses to the shared variable.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agobrcmfmac: Fix access point mode
Stefan Wahren [Wed, 12 Dec 2018 19:20:06 +0000 (20:20 +0100)]
brcmfmac: Fix access point mode

Since commit 1204aa17f3b4 ("brcmfmac: set WIPHY_FLAG_HAVE_AP_SME flag")
the Raspberry Pi 3 A+ (BCM43455) isn't able to operate in AP mode with
hostapd (device_ap_sme=1 use_monitor=0):

brcmfmac: brcmf_cfg80211_stop_ap: setting AP mode failed -52

So add the missing mgmt_stypes for AP mode to fix this.

Fixes: 1204aa17f3b4 ("brcmfmac: set WIPHY_FLAG_HAVE_AP_SME flag")
Suggested-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agobrcmfmac: fix roamoff=1 modparam
Stijn Tintel [Tue, 4 Dec 2018 18:29:05 +0000 (20:29 +0200)]
brcmfmac: fix roamoff=1 modparam

When the update_connect_param callback is set, nl80211 expects the flag
WIPHY_FLAG_SUPPORTS_FW_ROAM to be set as well. However, this flag is
only set when modparam roamoff=0, while the callback is set
unconditionally. Since commit 7f9a3e150ec7 this causes a warning in
wiphy_register, which breaks brcmfmac.

Disable the update_connect_param callback when roamoff=0 to fix this.

Fixes: 7f9a3e150ec7 ("nl80211: Update ERP info using NL80211_CMD_UPDATE_CONNECT_PARAMS")
Cc: Stable <stable@vger.kernel.org> # 4.19+
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agocw1200: convert to DEFINE_SHOW_ATTRIBUTE
Yangtao Li [Mon, 3 Dec 2018 13:31:45 +0000 (08:31 -0500)]
cw1200: convert to DEFINE_SHOW_ATTRIBUTE

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoMerge tag 'iwlwifi-next-for-kalle-2018-12-14' of git://git.kernel.org/pub/scm/linux...
Kalle Valo [Fri, 14 Dec 2018 14:58:00 +0000 (16:58 +0200)]
Merge tag 'iwlwifi-next-for-kalle-2018-12-14' of git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next

Third batch of iwlwifi patches intended for v4.21

* Some cleanups in the HW configuration structures;
* More work on the debugging infrastructure;
* Fixes related to 802.11ax;
* Other cleanups and small fixes;

5 years agoiwlwifi: mvm: don't check if a pointer is set if it can't be unset
Emmanuel Grumbach [Tue, 14 Aug 2018 13:49:30 +0000 (16:49 +0300)]
iwlwifi: mvm: don't check if a pointer is set if it can't be unset

We used to have many versions of statistics notification
coming from the firmware. In one of the cleanup patches,
we forgot to clean the code that checks if data->general
is set. Since it is always set, remove the check.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: pcie: set cmd_len in the correct place
Sara Sharon [Mon, 20 Aug 2018 07:07:32 +0000 (10:07 +0300)]
iwlwifi: pcie: set cmd_len in the correct place

command len is set too early in the code, since when building
AMSDU, the size changes. This causes the byte count table to
have the wrong size.

Fixes: a0ec0169b7a9 ("iwlwifi: support new tx api")
Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: radiotap: remove UL_DL bit in HE TRIG_BASED
Shaul Triebitz [Wed, 25 Jul 2018 19:11:52 +0000 (22:11 +0300)]
iwlwifi: mvm: radiotap: remove UL_DL bit in HE TRIG_BASED

UL_DL is irrelevant to HE TRIG_BASED PPDU.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: add L-SIG length to radiotap
Shaul Triebitz [Mon, 2 Jul 2018 15:16:48 +0000 (17:16 +0200)]
iwlwifi: mvm: add L-SIG length to radiotap

We may have the L-SIG length depending on the phy_data info type;
add it to radiotap when we do.

Move getting the phy_data out one layer up and the info type into
it so we can use this data more generically. We need to call the
iwl_mvm_rx_he() function for other reasons as well, so can't just
combine all of that into something like iwl_mvm_parse_phy_data().

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: change PHY data RX for HE radiotap
Shaul Triebitz [Mon, 2 Jul 2018 12:35:26 +0000 (14:35 +0200)]
iwlwifi: mvm: change PHY data RX for HE radiotap

The firmware changed the PHY data API, so follow suit.
Some data is now available even for HT/VHT frames, so
the info type in the metadata was changed. This change
isn't backwards compatible, but
 1) the firmware with the old API was never released;
 2) the only overlap in the info type field is from the
    old type of TB to the new of HT, so this basically
    just means that with older FW and newer driver the
    data will be considered missing.

While at it, remove the extra code to set the LTF syms
corresponding to the streams and use the data from the
device instead - we don't really need this in any case
other than when we have it from the device.

As the new API gives use the spatial reuse 1-4 fields
for trigger-based PPDUs, also expose that to radiotap.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: pcie: fix erroneous print
Sara Sharon [Thu, 16 Aug 2018 10:01:09 +0000 (13:01 +0300)]
iwlwifi: pcie: fix erroneous print

When removing the driver, the following flow can happen:
1. host command is in progress, for example at index 68.
2. RX interrupt is received with the response.
3. Before it is processed, the remove flow kicks in, and
   calls iwl_pcie_txq_unmap. The function cleans all DMA,
   and promotes the read pointer to 69.
4. RX thread proceeds with the processing, and is calling
   iwl_pcie_cmdq_reclaim, which will print this error:
   iwl_pcie_cmdq_reclaim: Read index for DMA queue txq id (0),
   index 4 is out of range [0-256] 69 69.

Detect this situation, and avoid the print. Change it to
warning while at it, to make such issues more noticeable
in the future.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: force TCM re-evaluation on TCM resume
Avraham Stern [Wed, 15 Aug 2018 09:23:39 +0000 (12:23 +0300)]
iwlwifi: mvm: force TCM re-evaluation on TCM resume

When traffic load is not low or low latency is active, TCM schedules
re-evaluation work so in case traffic stops TCM will detect that
traffic load has become low or that low latency is no longer active.
However, if TCM is paused when the re-evaluation work runs, it does
not re-evaluate and the re-evaluation work is no longer scheduled.
As a result, TCM will not indicate that low latency is no longer
active or that traffic load is low when traffic stops.

Fix this by forcing TCM re-evaluation when TCM is resumed in case
low latency is active or traffic load is not low.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: remove all unnecessary occurrences of nvm_calib_ver
Luca Coelho [Thu, 16 Aug 2018 07:01:00 +0000 (10:01 +0300)]
iwlwifi: remove all unnecessary occurrences of nvm_calib_ver

Now that nvm_calib_ver is not checked in opmodes other than dvm, we
can remove it from all irrelevant configurations.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: move iwl_nvm_check_version() into dvm
Luca Coelho [Thu, 16 Aug 2018 06:23:08 +0000 (09:23 +0300)]
iwlwifi: move iwl_nvm_check_version() into dvm

This function is only half-used by mvm (i.e. only the nvm_version part
matters, since the calibration version is irrelevant), so it's
pointless to export it from iwlwifi.  If mvm uses this function, it
has the additional complexity of setting the calib version to a bogus
value on all cfg structs.

To avoid this, move the function to dvm and make a simple comparison
of the nvm_version in mvm instead.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: remove useless NVM_HW_SECTION_NUM_FAMILY_* macros
Luca Coelho [Thu, 16 Aug 2018 06:01:31 +0000 (09:01 +0300)]
iwlwifi: remove useless NVM_HW_SECTION_NUM_FAMILY_* macros

These macros are useless because each one of them is used only once
and the element they are assigned to is already pretty clear about
what they mean, "nvm_hw_section_num".

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: don't define OTP_LOW_IMAGE_SIZE per family, but per size
Luca Coelho [Thu, 16 Aug 2018 05:53:10 +0000 (08:53 +0300)]
iwlwifi: don't define OTP_LOW_IMAGE_SIZE per family, but per size

Using OTP_LOW_IMAGE_SIZE_FAMILY_8000/9000/22000 only obfuscates the
actual values, since these 3 are the same.  Redefine the values per
size so it's easier to understand and compare the different
configurations.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: activate apply points
Sara Sharon [Wed, 13 Jun 2018 12:22:48 +0000 (15:22 +0300)]
iwlwifi: mvm: activate apply points

Call the previously introduced apply points entry
point when reaching an apply point.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: add support for triggering ini triggers
Sara Sharon [Thu, 21 Jun 2018 06:42:12 +0000 (09:42 +0300)]
iwlwifi: add support for triggering ini triggers

Add support for ini triggers.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: dbg: dump data according to the new ini TLVs
Sara Sharon [Wed, 13 Jun 2018 12:24:13 +0000 (15:24 +0300)]
iwlwifi: dbg: dump data according to the new ini TLVs

When ini TLVs are loaded, dump data according to the
stored configuration.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: move common 9000 cfg parameters to common macro
Luca Coelho [Thu, 9 Aug 2018 10:51:08 +0000 (13:51 +0300)]
iwlwifi: move common 9000 cfg parameters to common macro

The ht_params, nvm_ver, nvm_calib_ver and max_ht_ampdu_exponent
elements in 9000 devices are always the same.  Move them to the common
macro.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agortlwifi: rtl8821ae: remove set but not used variable 'type' in translate_rx_signal_stuff
YueHaibing [Thu, 6 Dec 2018 12:06:08 +0000 (12:06 +0000)]
rtlwifi: rtl8821ae: remove set but not used variable 'type' in translate_rx_signal_stuff

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

drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.c: In function 'translate_rx_signal_stuff':
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.c:309:6: warning:
 variable 'type' set but not used [-Wunused-but-set-variable]

It never used since commit 21e4b0726dc6 ("rtlwifi: rtl8821ae: Move driver from
staging to regular tree")

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agortl818x: fix potential use after free
Pan Bian [Thu, 29 Nov 2018 10:48:10 +0000 (18:48 +0800)]
rtl818x: fix potential use after free

entry is released via usb_put_urb just after calling usb_submit_urb.
However, entry is used if the submission fails, resulting in a use after
free bug. The patch fixes this.

Signed-off-by: Pan Bian <bianpan2016@163.com>
ACKed-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agob43: remove set but not used variables 'tx_pwr_state,tmp2'
YueHaibing [Wed, 5 Dec 2018 07:26:06 +0000 (07:26 +0000)]
b43: remove set but not used variables 'tx_pwr_state,tmp2'

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

drivers/net/wireless/broadcom/b43/phy_n.c: In function 'b43_nphy_op_recalc_txpower':
drivers/net/wireless/broadcom/b43/phy_n.c:5898:7: warning:
 variable 'tx_pwr_state' set but not used [-Wunused-but-set-variable]

drivers/net/wireless/broadcom/b43/phy_n.c:6047:20: warning:
 variable 'tmp2' set but not used [-Wunused-but-set-variable]

'tx_pwr_state' never used since introduction in commit
8615eb2870f1 ("b43: N-PHY: support setting custom TX power")

'tmp2' not used any more since commit c002831a07dd ("b43: N-PHY: use helper
for checking IPA")

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agobrcmfmac: fix false-positive -Wmaybe-unintialized warning
Arnd Bergmann [Mon, 10 Dec 2018 20:55:37 +0000 (21:55 +0100)]
brcmfmac: fix false-positive -Wmaybe-unintialized warning

When CONFIG_NO_AUTO_INLINE is set, we get a false-postive warning
for the brcmf_fw_request_nvram_done() function, after gcc figures
out that brcmf_fw_nvram_from_efi() might not set the 'data_len'
variable, but fails to notice that it always returns NULL:

drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c: In function 'brcmf_fw_request_nvram_done':
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:560:11: error: 'data_len' may be used uninitialized in this function [-Werror=maybe-uninitialized]

Mark it 'inline' to force gcc to understand this.

Fixes: ce2e6db554fa ("brcmfmac: Add support for getting nvram contents from EFI variables")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agobrcmfmac: disable command decode in sdio_aos
Wright Feng [Wed, 21 Nov 2018 07:53:52 +0000 (07:53 +0000)]
brcmfmac: disable command decode in sdio_aos

AOS is a part of the SDIOD core that becomes active when the rest of
SDIOD is sleeping to keep SDIO bus alive responding to reduced set of
commands.

Transaction between AOS and SDIOD is not protected, and if cmd 52 is
received in AOS and in the middle of response state changed from AOS to
SDIOD, response is corrupted and it causes to SDIO Host controller to
hang.

Command decode for below chips are disabled in this commit:
 - 4339
 - 4345
 - 4354
 - 4373

Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Double Lo <double.lo@cypress.com>
Signed-off-by: Madhan Mohan R <madhanmohan.r@cypress.com>
Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agobrcmfmac: 4373 save-restore support
Chi-Hsien Lin [Wed, 21 Nov 2018 07:53:50 +0000 (07:53 +0000)]
brcmfmac: 4373 save-restore support

Use chipcommon sr_control0 register to check 4373 sr support.

Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agobrcmfmac: update 43012 F2 watermark setting to fix DMA Error during UDP RX Traffic
Naveen Gupta [Wed, 21 Nov 2018 07:53:49 +0000 (07:53 +0000)]
brcmfmac: update 43012 F2 watermark setting to fix DMA Error during UDP RX Traffic

The number of words that the read FIFO has to contain except
the end of frame before sends data back to the host.
Max watermark = (512B - 2* (BurstLength))/4 =
(512 - 128)/4 = 384/4 = 0x60
so if burst length (i.e. BurstLength = 64) is increased,
watermark has to be reduced. This is the optimal setting for this chip.

Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Naveen Gupta <naveen.gupta@cypress.com>
Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agobrcmfmac: allow GCI core enumuration
Chi-Hsien Lin [Wed, 21 Nov 2018 07:53:48 +0000 (07:53 +0000)]
brcmfmac: allow GCI core enumuration

GCI core is needed for ULP operation. Allow GCI core enumuration with
below changes:
 - Allow GCI to be added to core list even when it doesn't have a wrapper.
 - Allow 8K address space size.
 - Don't overwrite the address value when an additional size descriptor
   is in place.

Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agobrcmfmac: add support for CYW43012 SDIO chipset
Chi-Hsien Lin [Wed, 21 Nov 2018 07:53:47 +0000 (07:53 +0000)]
brcmfmac: add support for CYW43012 SDIO chipset

CYW43012 is a 1x1 802.11a/b/g/n Dual-Band HT20, 256-QAM/Turbo QAM. It
is an Ultra Low Power WLAN+BT combo chip.

Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Praveen Babu C <praveen.chandran@cypress.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agobrcmfmac: set SDIO F1 MesBusyCtrl for CYW4373
Madhan Mohan R [Wed, 21 Nov 2018 07:53:45 +0000 (07:53 +0000)]
brcmfmac: set SDIO F1 MesBusyCtrl for CYW4373

Along with F2 watermark (existing) configuration, F1 MesBusyCtrl
should be enabled & sdio device RX FIFO watermark should be
configured to avoid overflow errors.

Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Madhan Mohan R <madhanmohan.r@cypress.com>
Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agobrcmfmac: set F2 watermark to 256 for 4373
Wright Feng [Wed, 21 Nov 2018 07:53:44 +0000 (07:53 +0000)]
brcmfmac: set F2 watermark to 256 for 4373

We got SDIO_CRC_ERROR with 4373 on SDR104 when doing bi-directional
throughput test. Enable watermark to 256 to guarantee the operation
stability.

Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agobrcmfmac: add 4354 raw pcie device id
Winnie Chang [Wed, 21 Nov 2018 07:53:42 +0000 (07:53 +0000)]
brcmfmac: add 4354 raw pcie device id

Add the raw 4354 PCIe device ID for unprogrammed Cypress boards.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Signed-off-by: Winnie Chang <winnie.chang@cypress.com>
Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agobrcmfmac: handle compressed tx status signal
Chung-Hsien Hsu [Mon, 5 Nov 2018 05:52:05 +0000 (05:52 +0000)]
brcmfmac: handle compressed tx status signal

Firmware inform the driver about tx status by normal tx status signal
or compressed tx status signal. This patch adds support to handle the
compressed tx status signal.

Signed-off-by: Chung-Hsien Hsu <stanley.hsu@cypress.com>
Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Wright Feng <wright.feng@cypress.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agobrcmfmac: enable frameburst mode in default firmware setting
Wright Feng [Mon, 5 Nov 2018 05:51:59 +0000 (05:51 +0000)]
brcmfmac: enable frameburst mode in default firmware setting

The frameburst feature can enable per-packet framebursting in firmware
side and get higher TX throughput in High Throughput(HT) mode. To enhance
TX throughput, we enable frameburst mode in default firmware setting.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agobrcmfmac: add credit numbers updating support
Wright Feng [Mon, 5 Nov 2018 05:51:54 +0000 (05:51 +0000)]
brcmfmac: add credit numbers updating support

The credit numbers are static and tunable per chip in firmware side.
However the credit number may be changed that is based on packet pool
length and will send BRCMF_E_FIFO_CREDIT_MAP event to notify host driver
updates the credit numbers during interface up.
The purpose of this patch is making host driver has ability of updating
the credit numbers when receiving the BRCMF_E_FIFO_CREDIT_MAP event.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agomwifiex: add NL80211_STA_INFO_RX_BITRATE support
Brian Norris [Fri, 7 Dec 2018 00:12:49 +0000 (16:12 -0800)]
mwifiex: add NL80211_STA_INFO_RX_BITRATE support

Comparing the existing TX_BITRATE parsing code (in
mwifiex_parse_htinfo()) with the RX bitrate histograms in debugfs.c, it
appears that the rxpd_rate and rxpd_htinfo fields have the same format.
At least, they give reasonable results when I parse them this way.

So this patch adds support for RX_BITRATE to our station info dump.

Along the way, I add legacy bitrate parsing into the same function,
using the debugfs code (mwifiex_histogram_read() and
mwifiex_adjust_data_rate()) as reference.

Additionally, to satisfy the requirements of
NL80211_STA_INFO_RX_BITRATE, I skip logging the bitrate of multicast
packets. This shouldn't add a lot of overhead to the RX path, as there
are already several similar 802.3 header checks in this same codepath.
We can also bias the branch behavior to favor unicast, as that's the
common performance-sensitive case.

I'd consider this support somewhat experimental, as I have zero
documentation from Marvell. But the existing driver code gives me good
reason to think this is correct.

I've tested this on a few different 802.11{a,b,g,n,ac} networks, and the
reported bitrates look good to me.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agomwifiex: refactor mwifiex_parse_htinfo() for reuse
Brian Norris [Fri, 7 Dec 2018 00:12:48 +0000 (16:12 -0800)]
mwifiex: refactor mwifiex_parse_htinfo() for reuse

This function converts some firmware-specific parameters into cfg80211
'rate_info' structures. It currently assumes it's dealing only with TX
bitrate, but the RX bitrate looks to be the same, so refactor this
function to be reusable.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agomwifiex: debugfs: correct histogram spacing, formatting
Brian Norris [Mon, 3 Dec 2018 22:26:55 +0000 (14:26 -0800)]
mwifiex: debugfs: correct histogram spacing, formatting

Currently, snippets of this file look like:

rx rates (in Mbps): 0=1M   1=2M2=5.5M  3=11M   4=6M   5=9M  6=12M
7=18M  8=24M  9=36M  10=48M  11=54M12-27=MCS0-15(BW20) 28-43=MCS0-15(BW40)
44-53=MCS0-9(VHT:BW20)54-63=MCS0-9(VHT:BW40)64-73=MCS0-9(VHT:BW80)
...
noise_flr[--96dBm] = 22
noise_flr[--95dBm] = 149
noise_flr[--94dBm] = 9
noise_flr[--93dBm] = 2

We're missing some spaces, and we're adding a minus sign ('-') on values
that are already negative signed integers.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agomwifiex: fix potential NULL dereference and use after free
Pan Bian [Thu, 29 Nov 2018 10:25:19 +0000 (18:25 +0800)]
mwifiex: fix potential NULL dereference and use after free

There are two defects: (1) passing a NULL bss to
mwifiex_save_hidden_ssid_channels will result in NULL dereference,
(2) using bss after dropping the reference to it via cfg80211_put_bss.
To fix them, the patch moves the buggy code to the branch that bss is
not NULL and puts it before cfg80211_put_bss.

Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoMerge tag 'mt76-for-kvalo-2018-11-30' of https://github.com/nbd168/wireless
Kalle Valo [Thu, 13 Dec 2018 14:02:19 +0000 (16:02 +0200)]
Merge tag 'mt76-for-kvalo-2018-11-30' of https://github.com/nbd168/wireless

first batch of mt76 patches for 4.21

* use the same firmware for mt76x2e and mt76x2u
* mt76x2 fixes
* mt76x0 fixes
* mt76x0e survey support
* more unification between mt76x2 and mt76x0
* mt76x0e AP mode support
* mt76x0e DFS support
* rework and fix tx status handling for mt76x0 and mt76x2

kvalo: fixed a conflict in drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c
and a build problem in drivers/net/wireless/mediatek/mt76/mt76x02_util.c

5 years agonet: marvell: convert to DEFINE_SHOW_ATTRIBUTE
Yangtao Li [Mon, 3 Dec 2018 14:34:11 +0000 (09:34 -0500)]
net: marvell: convert to DEFINE_SHOW_ATTRIBUTE

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: qca_spi: convert to DEFINE_SHOW_ATTRIBUTE
Yangtao Li [Mon, 3 Dec 2018 14:26:38 +0000 (09:26 -0500)]
net: qca_spi: convert to DEFINE_SHOW_ATTRIBUTE

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: stmmac: convert to DEFINE_SHOW_ATTRIBUTE
Yangtao Li [Mon, 3 Dec 2018 14:22:09 +0000 (09:22 -0500)]
net: stmmac: convert to DEFINE_SHOW_ATTRIBUTE

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonfp: convert to DEFINE_SHOW_ATTRIBUTE
Yangtao Li [Mon, 3 Dec 2018 14:13:35 +0000 (09:13 -0500)]
nfp: convert to DEFINE_SHOW_ATTRIBUTE

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'mlx4_core-cleanups'
David S. Miller [Tue, 4 Dec 2018 00:34:32 +0000 (16:34 -0800)]
Merge branch 'mlx4_core-cleanups'

Tariq Toukan says:

====================
mlx4_core cleanups

This patchset by Erez contains cleanups to the mlx4_core driver.

Patch 1 replaces -EINVAL with -EOPNOTSUPP for unsupported operations.
Patch 2 fixes some coding style issues.

Series generated against net-next commit:
97e6c858a26e net: usb: aqc111: Initialize wol_cfg with memset in aqc111_suspend
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet/mlx4_core: Fix several coding style errors
Erez Alfasi [Sun, 2 Dec 2018 15:40:26 +0000 (17:40 +0200)]
net/mlx4_core: Fix several coding style errors

Fix 3 checkpatch errors within mlx4/main.c:
- Unnecessary mlx4_debug_level global variable initialization to 0.
- Prohibited space before comma.
- Whitespaces instead of tab.

Signed-off-by: Erez Alfasi <ereza@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet/mlx4_core: Fix return codes of unsupported operations
Erez Alfasi [Sun, 2 Dec 2018 15:40:25 +0000 (17:40 +0200)]
net/mlx4_core: Fix return codes of unsupported operations

Functions __set_port_type and mlx4_check_port_params returned
-EINVAL while the proper return code is -EOPNOTSUPP as a
result of an unsupported operation. All drivers should generate
this and all users should check for it when detecting an
unsupported functionality.

Signed-off-by: Erez Alfasi <ereza@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: Also request modules for C45 IDs
Jose Abreu [Sun, 2 Dec 2018 15:33:14 +0000 (16:33 +0100)]
net: phy: Also request modules for C45 IDs

Logic of phy_device_create() requests PHY modules according to PHY ID
but for C45 PHYs we use different field for the IDs.

Let's also request the modules for these IDs.

Changes from v1:
- Only request C22 modules if C45 are not present (Andrew)

Signed-off-by: Jose Abreu <joabreu@synopsys.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Joao Pinto <joao.pinto@synopsys.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'octeontx2-next'
David S. Miller [Tue, 4 Dec 2018 00:23:09 +0000 (16:23 -0800)]
Merge branch 'octeontx2-next'

Jerin Jacob says:

====================
octeontx2-af: NIX and NPC enhancements

This patchset is a continuation to earlier submitted four patch
series to add a new driver for Marvell's OcteonTX2 SOC's
Resource virtualization unit (RVU) admin function driver.

1. octeontx2-af: Add RVU Admin Function driver
   https://www.spinics.net/lists/netdev/msg528272.html
2. octeontx2-af: NPA and NIX blocks initialization
   https://www.spinics.net/lists/netdev/msg529163.html
3. octeontx2-af: NPC parser and NIX blocks initialization
   https://www.spinics.net/lists/netdev/msg530252.html
4. octeontx2-af: NPC MCAM support and FLR handling
   https://www.spinics.net/lists/netdev/msg534392.html

This patch series adds support for below

NPC block:
- Add NPC(mkex) profile support for various Key extraction configurations

NIX block:
- Enable dynamic RSS flow key algorithm configuration
- Enhancements on Rx checksum and error checks
- Add support for Tx packet marking support
- TL1 schedule queue allocation enhancements
- Add LSO format configuration mbox
- VLAN TPID configuration
- Skip multicast entry init for broadcast tables

v2:

- Rename FLOW_* to NIX_FLOW_* to avoid serious global namespace collisions,
as we have various FLOW_* definitions coming from
include/uapi/linux/pkt_cls.h for example.(David Miller)
- Pack the arguments of rvu_get_tl1_schqs() function
as 80 columns allows.(David Miller)
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoocteontx2-af: Enable mkex profile
Vamsi Attunuru [Sun, 2 Dec 2018 12:47:49 +0000 (18:17 +0530)]
octeontx2-af: Enable mkex profile

The following set of NPC registers allow the driver to configure NPC
to generate different key value schemes to compare against packet
payload in MCAM search.

NPC_AF_INTF(0..1)_KEX_CFG
NPC_AF_KEX_LDATA(0..1)_FLAGS_CFG
NPC_AF_INTF(0..1)_LID(0..7)_LT(0..15)_LD(0..1)_CFG
NPC_AF_INTF(0..1)_LDATA(0..1)_FLAGS(0..15)_CFG

Currently, the AF driver populates these registers to
configure the default values to address the most common
use cases such as key generation for channel number + DMAC.

The secure firmware stores different configuration
value of these registers to enable different NPC use case
along with the name for the lookup.

Patch loads profile binary from secure firmware over
the exiting CGX mailbox interface and apply the profile.

AF driver shall fall back to the default configuration
in case of any errors.

The AF consumer driver can know the selected profile
on response to NPC_GET_KEX_CFG mailbox by introducing
mkex_pfl_name in the struct npc_get_kex_cfg_rsp.

Signed-off-by: Vamsi Attunuru <vamsi.attunuru@marvell.com>
Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoocteontx2-af: Add LSO format configuration mailbox
Nithin Dabilpuram [Sun, 2 Dec 2018 12:47:48 +0000 (18:17 +0530)]
octeontx2-af: Add LSO format configuration mailbox

NIX_AF_LSO_FORMAT(0..31)_FIELD(0..7) register enables an SW defined
means to define LSO packet modification formats.

0..31 works as an index to choose the algorithm, On success, the mailbox
returns the index to the client of chosen LSO algorithm selection.
This index will be used in configuring the transmit descriptors.

Add mailbox interface to dynamically reserve and configure LSO format.

This commit also fixes 'sizem1' for NIX_LSOALG_TCP_FLAGS
to '1' i.e 2 Bytes.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoocteontx2-af: Add L3 and L4 packet verification mailbox
Vidhya Raman [Sun, 2 Dec 2018 12:47:47 +0000 (18:17 +0530)]
octeontx2-af: Add L3 and L4 packet verification mailbox

Adds mailbox support for L4 checksum verification
and L3 and L4 length verification configuration.

Signed-off-by: Vidhya Raman <vraman@marvell.com>
Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoocteontx2-af: Configure VLAN TPIDs
Nithin Dabilpuram [Sun, 2 Dec 2018 12:47:46 +0000 (18:17 +0530)]
octeontx2-af: Configure VLAN TPIDs

Setup TPID's for vlan0 and vlan1 for Tx VLAN insertion offloads.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoocteontx2-af: Add support for Tx packet marking
Krzysztof Kanas [Sun, 2 Dec 2018 12:47:45 +0000 (18:17 +0530)]
octeontx2-af: Add support for Tx packet marking

NIX_AF_MARK_FORMAT(0..127)_CTL register enables an SW defined
means to mark/insert various data in the packet based on
final packet color from traffic shaping HW.

0..127 works as an index to choose the algorithm. On success,
the mailbox returns the index to the client.

Add NIX_MARK_FORMAT_CFG mailbox which reserves mark format based on
tuple (offset, y_mask, y_val, r_mask, r_val)

If the tuple is requested again for mark format that was already
reserved, then it will be reused. If not it will reserve a new entry
if space is available.

Also on AF init commonly used marker format such as VLAN DEI, IPv4
ECN, IPv4 DSCP are reserved for AF consumers.

Signed-off-by: Krzysztof Kanas <kkanas@marvell.com>
Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoocteontx2-af: Enable RSS with promiscuous mode
Vamsi Attunuru [Sun, 2 Dec 2018 12:47:44 +0000 (18:17 +0530)]
octeontx2-af: Enable RSS with promiscuous mode

This patch adds support for enabling RSS in promiscuous mode
if RSS is already requested by the AF client.

Signed-off-by: Vamsi Attunuru <vamsi.attunuru@marvell.com>
Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoocteontx2-af: Define all NIX_AF_RX_DEF_* registers
Jerin Jacob [Sun, 2 Dec 2018 12:47:43 +0000 (18:17 +0530)]
octeontx2-af: Define all NIX_AF_RX_DEF_* registers

In order to support all NIX specific valid length errors and
checksum errors on Rx, Update all NIX_AF_RX_DEF_* registers.

Also sorted all registers in HRM definition order.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoocteontx2-af: Enable inner IPv4 checksum and its error code
Jerin Jacob [Sun, 2 Dec 2018 12:47:42 +0000 (18:17 +0530)]
octeontx2-af: Enable inner IPv4 checksum and its error code

This patch enables the inner IPv4 checksum and
defines the error code for Rx inner and outer checksum errors.
Setting ERRCODE as 1 so that CQE descriptor can be embedded
valid checksum error code and the driver can interpret
checksum error as ERRLEV = LID + 1 and ERRCODE = 1.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>