platform/kernel/linux-rpi.git
3 years agomt76: mt7915: optimize mt7915_mac_sta_poll
Felix Fietkau [Thu, 20 Aug 2020 09:41:16 +0000 (11:41 +0200)]
mt76: mt7915: optimize mt7915_mac_sta_poll

Since DMA completion does not imply tx completion, it makes more sense to
poll for airtime from mt7915_mac_tx_free.
Reduce the runtime of the function by moving all items from dev->sta_poll_list
to a local list once and process any stations that were added afterwards
on the next run

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7615: fix reading airtime statistics
Felix Fietkau [Tue, 18 Aug 2020 10:44:05 +0000 (12:44 +0200)]
mt76: mt7615: fix reading airtime statistics

- change the WTBL LMAC access function to set the mapping window only once
- use ac * 2 as offset, since each AC has separate words for rx and tx

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7663u: fix dma header initialization
Lorenzo Bianconi [Mon, 24 Aug 2020 18:55:12 +0000 (20:55 +0200)]
mt76: mt7663u: fix dma header initialization

Fix length field corruption in usb dma header introduced adding sdio
support

Fixes: 75b10f0cbd0b ("mt76: mt76u: add mt76_skb_adjust_pad utility routine")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: fix a possible NULL pointer dereference in mt76_testmode_dump
Lorenzo Bianconi [Fri, 21 Aug 2020 10:52:15 +0000 (12:52 +0200)]
mt76: fix a possible NULL pointer dereference in mt76_testmode_dump

Fix a possible NULL pointer dereference in mt76_testmode_dump() since
nla_nest_start returns NULL in case of error

Fixes: f0efa8621550e ("mt76: add API for testmode support")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7615: fix a possible NULL pointer dereference in mt7615_pm_wake_work
Lorenzo Bianconi [Fri, 21 Aug 2020 10:09:54 +0000 (12:09 +0200)]
mt76: mt7615: fix a possible NULL pointer dereference in mt7615_pm_wake_work

Initialize wcid to global_wcid if msta is NULL in mt7615_pm_wake_work
routine since wcid will be dereferenced running mt76_tx()

Fixes: 2b8cdfb28d340 ("mt76: mt7615: wake device before pushing frames in mt7615_tx")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7615: fix possible memory leak in mt7615_tm_set_tx_power
Lorenzo Bianconi [Fri, 21 Aug 2020 09:19:51 +0000 (11:19 +0200)]
mt76: mt7615: fix possible memory leak in mt7615_tm_set_tx_power

Fix a memory leak in mt7615_tm_set_tx_power routine if
mt7615_eeprom_get_target_power_index fails.
Moreover do not account req_header twice in mcu skb allocation.

Fixes: 4f0bce1c88882 ("mt76: mt7615: implement testmode support")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7663s: fix unable to handle kernel paging request
Sean Wang [Tue, 18 Aug 2020 04:12:28 +0000 (12:12 +0800)]
mt76: mt7663s: fix unable to handle kernel paging request

Use buffer allocated with kmalloc instead of with stack to fix kernel
crash due to Unable to handle kernel paging request at virtual address
ffffffc0095cbce8.

[  156.977349] Unable to handle kernel paging request at virtual address ffffffc0095cbce8
[  156.985270] Mem abort info:
[  156.988059]   ESR = 0x96000045
[  156.991104]   Exception class = DABT (current EL), IL = 32 bits
[  156.997013]   SET = 0, FnV = 0
[  157.000057]   EA = 0, S1PTW = 0
[  157.003190] Data abort info:
[  157.006061]   ISV = 0, ISS = 0x00000045
[  157.009887]   CM = 0, WnR = 1
[  157.012850] swapper pgtable: 4k pages, 39-bit VAs, pgdp = 0000000042adcba2
[  157.019715] [ffffffc0095cbce8] pgd=0000000000000000, pud=0000000000000000
[  157.026499] Internal error: Oops: 96000045 [#1] PREEMPT SMP
[  157.032065] Modules linked in: mt7663s mt7663_usb_sdio_common mt7615_common

...

[  157.073007] Process CompositorTileW (pid: 1625, stack limit = 0x000000003f2389fc)
[  157.080484] CPU: 0 PID: 1625 Comm: CompositorTileW Not tainted 4.19.137 #36
[  157.092219] pstate: 80000085 (Nzcv daIf -PAN -UAO)
[  157.097012] pc : __memcpy+0xc0/0x180
[  157.100585] lr : swiotlb_tbl_unmap_single+0x84/0x14c
[  157.105540] sp : ffffff8008003cb0
[  157.108845] x29: ffffff8008003cb0 x28: ffffff9c1a211f60
[  157.114149] x27: ffffff9c19ecc018 x26: 0000000000001000
[  157.119452] x25: ffffff9c1a378000 x24: 0000000000000001
[  157.124755] x23: ffffff9c1a378000 x22: 00000000000001ff
[  157.130058] x21: 0000000000000000 x20: 00000000fbefe800
[  157.135360] x19: 0000000000000070 x18: 0000000000000000
[  157.140663] x17: 0000000000000000 x16: 0000000000000000
[  157.145965] x15: 0000000000000000 x14: 0000000000000000
[  157.151267] x13: 0000000000000000 x12: 000000000000000d
[  157.156569] x11: 000000000000000c x10: 0000000a7befe800
[  157.161873] x9 : fffffff680000000 x8 : 0000000000000000
[  157.167175] x7 : 0000000100000003 x6 : ffffffc0095cbce8
[  157.172479] x5 : 0000000000000000 x4 : 0000000000000000
[  157.177781] x3 : 0000000000000002 x2 : fffffffffffffff0
[  157.183085] x1 : ffffffca7befe810 x0 : ffffffc0095cbce8
[  157.188389] Call trace:
[  157.190832]  __memcpy+0xc0/0x180
[  157.194053]  swiotlb_unmap_sg_attrs+0xa8/0xb0
[  157.198406]  __swiotlb_unmap_sg_attrs+0x8c/0xa4
[  157.202931]  msdc_unprepare_data+0x6c/0x84
[  157.207019]  msdc_request_done+0x58/0x98
[  157.210934]  msdc_data_xfer_done+0x1a8/0x1d0
[  157.215195]  msdc_irq+0x12c/0x17c
[  157.218505]  __handle_irq_event_percpu+0xd8/0x298
[  157.223202]  handle_irq_event+0x60/0xdc
[  157.227031]  handle_fasteoi_irq+0xa4/0x1d4
[  157.231120]  __handle_domain_irq+0x84/0xc4
[  157.235210]  gic_handle_irq+0x124/0x1a4
[  157.239038]  el0_irq_naked+0x4c/0x54
[  157.242608] Code: 14000028 f1020042 5400024a a8c12027 (a88120c7)
[  157.248693] ---[ end trace 28b8090135b0a2e1 ]---
[  157.265589] Kernel panic - not syncing: Fatal exception in interrupt
[  157.271944] SMP: stopping secondary CPUs
[  157.275865] Kernel Offset: 0x1c10e00000 from 0xffffff8008000000
[  157.281779] CPU features: 0x0,2188200c
[  157.285519] Memory Limit: none

Fixes: a66cbdd6573d ("mt76: mt7615: introduce mt7663s support")
Co-developed-by: YN Chen <YN.Chen@mediatek.com>
Signed-off-by: YN Chen <YN.Chen@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7663s: fix resume failure
Sean Wang [Thu, 13 Aug 2020 21:49:47 +0000 (05:49 +0800)]
mt76: mt7663s: fix resume failure

MT7663s have to rely on MMC_PM_KEEP_POWER in pm_flags for to avoid SDIO
power is being shut off.

To fix sdio access failure like "mt7663s mmc1:0001:1: sdio write failed:
-22" for the first sdio command to access the bus in the resume handler.

Fixes: a66cbdd6573d ("mt76: mt7615: introduce mt7663s support")
Co-developed-by: YN Chen <YN.Chen@mediatek.com>
Signed-off-by: YN Chen <YN.Chen@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7663s: use NULL instead of 0 in sdio code
Lorenzo Bianconi [Thu, 13 Aug 2020 09:55:52 +0000 (11:55 +0200)]
mt76: mt7663s: use NULL instead of 0 in sdio code

Fix the following sparse warnings in mt7663s driver:

drivers/net/wireless/mediatek/mt76/mt7615/sdio_mcu.c:78:62: warning:
Using plain integer as NULL pointer
drivers/net/wireless/mediatek/mt76/mt7615/sdio_mcu.c:110:62: warning:
Using plain integer as NULL pointer
drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c:229:64: warning:
Using plain integer as NULL pointer
drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c:263:64: warning:
Using plain integer as NULL pointer

Fixes: a66cbdd6573d ("mt76: mt7615: introduce mt7663s support")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7615: release mutex in mt7615_reset_test_set
Lorenzo Bianconi [Sat, 8 Aug 2020 18:25:41 +0000 (20:25 +0200)]
mt76: mt7615: release mutex in mt7615_reset_test_set

Reduce scope of mutex_acquire/mutex_release in mt7615_reset_test_set
routine in order to fix the following static checker warning:

drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c:179
mt7615_reset_test_set()
warn: inconsistent returns 'dev->mt76.mutex'.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: ea4906c4be49 ("mt76: mt7615: wake device before accessing regmap in debugfs")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: add Tx A-MSDU offloading support
Ryder Lee [Tue, 11 Aug 2020 07:59:57 +0000 (09:59 +0200)]
mt76: mt7915: add Tx A-MSDU offloading support

This disables the software A-MSDU aggregation in mac80211 and enables hardware
offloading

Suggested-by: Yiwei Chung <yiwei.chung@mediatek.com>
Suggested-by: YF Luo <yf.luo@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Co-developed-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: add missing flags in WMM parameter settings
Felix Fietkau [Sat, 8 Aug 2020 19:22:53 +0000 (21:22 +0200)]
mt76: mt7915: add missing flags in WMM parameter settings

Indicate the filled parameter to the firmware

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: simplify aggregation session check
Felix Fietkau [Tue, 28 Jul 2020 21:30:08 +0000 (23:30 +0200)]
mt76: mt7915: simplify aggregation session check

Use the txwi data as primary source information to avoid touching skb data
Use bitfield instead of state variable + spinlock

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7615: remove mtxq->agg_ssn assignment
Felix Fietkau [Tue, 28 Jul 2020 18:48:42 +0000 (20:48 +0200)]
mt76: mt7615: remove mtxq->agg_ssn assignment

It is not used anywhere for this driver

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: move mt76_check_agg_ssn to driver tx_prepare calls
Felix Fietkau [Tue, 28 Jul 2020 18:41:09 +0000 (20:41 +0200)]
mt76: move mt76_check_agg_ssn to driver tx_prepare calls

mt7615 and newer drivers do not need this, since they use sequence number offload
Moving this code also reduces the number of callsites to make it easier to review

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: enable offloading of sequence number assignment
Felix Fietkau [Mon, 27 Jul 2020 13:33:12 +0000 (15:33 +0200)]
mt76: mt7915: enable offloading of sequence number assignment

Preparation for supporting more offload features

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: increase tx retry count
Felix Fietkau [Sat, 8 Aug 2020 19:36:53 +0000 (21:36 +0200)]
mt76: mt7915: increase tx retry count

Set it to 15 to match reference driver

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: clean up station stats polling and rate control update
Felix Fietkau [Sun, 26 Jul 2020 18:45:58 +0000 (20:45 +0200)]
mt76: mt7915: clean up station stats polling and rate control update

Queueing a per-sta work item from the tx free path can become very expensive
under load. This work is only supposed to pull rate control stats every
second and deal with rate control changes.

Additionally, the rate control update code was wrong, because it was
confusing bit masks and bit numbers in test_bit.

Fix this by introducing a dedicated device work item for rate control
updates, and by polling station stats from the phy mac work.
Stations requiring polling or rate control updates are added to lists
protected by dev->sta_poll_lock.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: do not do any work in napi poll after calling napi_complete_done()
Felix Fietkau [Fri, 7 Aug 2020 18:57:46 +0000 (20:57 +0200)]
mt76: mt7915: do not do any work in napi poll after calling napi_complete_done()

Fixes a race condition where multiple tx cleanup or sta poll tasks could run
in parallel.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7615: do not do any work in napi poll after calling napi_complete_done()
Felix Fietkau [Fri, 7 Aug 2020 18:52:20 +0000 (20:52 +0200)]
mt76: mt7615: do not do any work in napi poll after calling napi_complete_done()

Fixes a race condition where multiple tx cleanup tasks could run in parallel

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt76x02: clean up and fix interrupt masking in the irq handler
Felix Fietkau [Fri, 7 Aug 2020 20:05:17 +0000 (22:05 +0200)]
mt76: mt76x02: clean up and fix interrupt masking in the irq handler

Only clear unmasked interrupts. If an interrupt is temporarily masked,
its pending events need to be processed later, even if another interrupt
happened in the mean time.
Disable interrupts in one call before scheduling

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7615: only clear unmasked interrupts in irq tasklet
Felix Fietkau [Fri, 7 Aug 2020 17:31:40 +0000 (19:31 +0200)]
mt76: mt7615: only clear unmasked interrupts in irq tasklet

If an interrupt is temporarily masked, its pending events need to be processed
later, even if another interrupt happened in the mean time.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: clean up and fix interrupt masking in the irq handler
Felix Fietkau [Fri, 7 Aug 2020 18:56:32 +0000 (20:56 +0200)]
mt76: mt7915: clean up and fix interrupt masking in the irq handler

Only clear unmasked interrupts. If an interrupt is temporarily masked,
its pending events need to be processed later, even if another interrupt
happened in the mean time.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: set interrupt mask register to 0 before requesting irq
Felix Fietkau [Fri, 7 Aug 2020 19:55:52 +0000 (21:55 +0200)]
mt76: set interrupt mask register to 0 before requesting irq

Avoids spurious interrupts in case the hardware was running already

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: fix double DMA unmap of the first buffer on 7615/7915
Felix Fietkau [Sat, 25 Jul 2020 12:44:07 +0000 (14:44 +0200)]
mt76: fix double DMA unmap of the first buffer on 7615/7915

A small part of the first skb buffer is passed to the firmware for parsing
via DMA, while the full buffer is passed as part of the TXP.

Avoid calling DMA unmap on the first part (with a different length than map)

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: fix crash on tx rate report for invalid stations
Felix Fietkau [Fri, 24 Jul 2020 14:13:10 +0000 (16:13 +0200)]
mt76: mt7915: fix crash on tx rate report for invalid stations

Check wcid RCU pointer before using it

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: enable U-APSD on AP side
Ryder Lee [Fri, 31 Jul 2020 22:24:15 +0000 (06:24 +0800)]
mt76: mt7915: enable U-APSD on AP side

Enable U-APSD support for AP interface.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt76s: get rid of unused variable
Lorenzo Bianconi [Fri, 31 Jul 2020 11:50:14 +0000 (13:50 +0200)]
mt76: mt76s: get rid of unused variable

Remove unused state variable in mt76_sdio structure

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt76s: move tx/rx processing in 2 separate works
Lorenzo Bianconi [Thu, 30 Jul 2020 14:09:51 +0000 (16:09 +0200)]
mt76: mt76s: move tx/rx processing in 2 separate works

In order to maximize parallelism, split status work in tx status work
and rx net work

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt76s: move status processing in txrx wq
Lorenzo Bianconi [Thu, 30 Jul 2020 14:09:50 +0000 (16:09 +0200)]
mt76: mt76s: move status processing in txrx wq

As it has been done for tx and rx processing, move tx/rx status
processing into mt76s_txrx_wq workqueue

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7663s: move rx processing in txrx wq
Lorenzo Bianconi [Thu, 30 Jul 2020 14:09:49 +0000 (16:09 +0200)]
mt76: mt7663s: move rx processing in txrx wq

Move rx processing to mt76s_txrx_wq in order to minimize the interval when
the sdio bus is locked during rx

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt76s: move tx processing in a dedicated wq
Lorenzo Bianconi [Thu, 30 Jul 2020 14:09:48 +0000 (16:09 +0200)]
mt76: mt76s: move tx processing in a dedicated wq

Introduce mt76s_txrx_wq workqueue and move tx processing from kthread to
a dedicated work. This is preliminary patch to improve mt7663s throughput

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt76s: fix oom in mt76s_tx_queue_skb_raw
Lorenzo Bianconi [Thu, 30 Jul 2020 09:38:46 +0000 (11:38 +0200)]
mt76: mt76s: fix oom in mt76s_tx_queue_skb_raw

Free the mcu skb in case of error in mt76s_tx_queue_skb_raw routine

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7615: reschedule runtime-pm receiving a tx interrupt
Lorenzo Bianconi [Thu, 30 Jul 2020 09:34:43 +0000 (11:34 +0200)]
mt76: mt7615: reschedule runtime-pm receiving a tx interrupt

Reschedule runtime-pm after receiving a tx interrupt.
Update runtime-pm last activity before injecting packets

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: do not inject packets if MT76_STATE_PM is set
Lorenzo Bianconi [Thu, 30 Jul 2020 09:27:51 +0000 (11:27 +0200)]
mt76: do not inject packets if MT76_STATE_PM is set

Do not tx packets in mt76_txq_send_burst() or mt76_txq_schedule_list()
if the device is in runtime-pm

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7615: hold mt76 lock queueing wd in mt7615_queue_key_update
Lorenzo Bianconi [Thu, 30 Jul 2020 09:21:31 +0000 (11:21 +0200)]
mt76: mt7615: hold mt76 lock queueing wd in mt7615_queue_key_update

wq queue is always updated holding mt76 spinlock. Grab mt76 lock in
mt7615_queue_key_update() before putting a new element at the end of the
queue.

Fixes: eb99cc95c3b65 ("mt76: mt7615: introduce mt7663u support")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7663s: move drv_own/fw_own in mt7615_mcu_ops
Lorenzo Bianconi [Mon, 20 Jul 2020 15:41:20 +0000 (17:41 +0200)]
mt76: mt7663s: move drv_own/fw_own in mt7615_mcu_ops

Initialize set_drv_ctrl and set_fw_ctrl function pointers in
mt7663s_mcu_init. This is a preliminary patch to enable runtime-pm for
mt7663s chipset.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7615: move drv_own/fw_own in mt7615_mcu_ops
Lorenzo Bianconi [Mon, 20 Jul 2020 15:41:19 +0000 (17:41 +0200)]
mt76: mt7615: move drv_own/fw_own in mt7615_mcu_ops

Introduce set_drv_ctrl and set_fw_ctrl function pointers in
mt7615_mcu_ops data structure. This is a preliminary patch to enable
runtime-pm for non-pci chipsets

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7615: register ext_phy if DBDC is detected
Shayne Chen [Wed, 24 Jun 2020 09:39:37 +0000 (17:39 +0800)]
mt76: mt7615: register ext_phy if DBDC is detected

MT_EE_WIFI_CONF field can be used to detect if the chipset is MT7615D.
Thus, add support to automatically register ext_phy if DBDC is detected.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agozd1201: simplify the return expression of zd1201_set_maxassoc()
Qinglang Miao [Mon, 21 Sep 2020 13:11:15 +0000 (21:11 +0800)]
zd1201: simplify the return expression of zd1201_set_maxassoc()

Simplify the return expression.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200921131115.93504-1-miaoqinglang@huawei.com
3 years agortw88: Fix potential probe error handling race with wow firmware loading
Andreas Färber [Sun, 20 Sep 2020 13:26:21 +0000 (15:26 +0200)]
rtw88: Fix potential probe error handling race with wow firmware loading

If rtw_core_init() fails to load the wow firmware, rtw_core_deinit()
will not get called to clean up the regular firmware.

Ensure that an error loading the wow firmware does not produce an oops
for the regular firmware by waiting on its completion to be signalled
before returning. Also release the loaded firmware.

Fixes: c8e5695eae99 ("rtw88: load wowlan firmware if wowlan is supported")
Cc: Chin-Yen Lee <timlee@realtek.com>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200920132621.26468-3-afaerber@suse.de
3 years agortw88: Fix probe error handling race with firmware loading
Andreas Färber [Sun, 20 Sep 2020 13:26:20 +0000 (15:26 +0200)]
rtw88: Fix probe error handling race with firmware loading

In case of rtw8822be, a probe failure after successful rtw_core_init()
has been observed to occasionally lead to an oops from rtw_load_firmware_cb():

[    3.924268] pci 0001:01:00.0: [10ec:b822] type 00 class 0xff0000
[    3.930531] pci 0001:01:00.0: reg 0x10: [io  0x0000-0x00ff]
[    3.936360] pci 0001:01:00.0: reg 0x18: [mem 0x00000000-0x0000ffff 64bit]
[    3.944042] pci 0001:01:00.0: supports D1 D2
[    3.948438] pci 0001:01:00.0: PME# supported from D0 D1 D2 D3hot D3cold
[    3.957312] pci 0001:01:00.0: BAR 2: no space for [mem size 0x00010000 64bit]
[    3.964645] pci 0001:01:00.0: BAR 2: failed to assign [mem size 0x00010000 64bit]
[    3.972332] pci 0001:01:00.0: BAR 0: assigned [io  0x10000-0x100ff]
[    3.986240] rtw_8822be 0001:01:00.0: enabling device (0000 -> 0001)
[    3.992735] rtw_8822be 0001:01:00.0: failed to map pci memory
[    3.998638] rtw_8822be 0001:01:00.0: failed to request pci io region
[    4.005166] rtw_8822be 0001:01:00.0: failed to setup pci resources
[    4.011580] rtw_8822be: probe of 0001:01:00.0 failed with error -12
[    4.018827] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    4.029121] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    4.050828] Unable to handle kernel paging request at virtual address edafeaac9607952c
[    4.058975] Mem abort info:
[    4.058980]   ESR = 0x96000004
[    4.058990]   EC = 0x25: DABT (current EL), IL = 32 bits
[    4.070353]   SET = 0, FnV = 0
[    4.073487]   EA = 0, S1PTW = 0
[    4.073501] dw-apb-uart 98007800.serial: forbid DMA for kernel console
[    4.076723] Data abort info:
[    4.086415]   ISV = 0, ISS = 0x00000004
[    4.087731] Freeing unused kernel memory: 1792K
[    4.090391]   CM = 0, WnR = 0
[    4.098091] [edafeaac9607952c] address between user and kernel address ranges
[    4.105418] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[    4.111129] Modules linked in:
[    4.114275] CPU: 1 PID: 31 Comm: kworker/1:1 Not tainted 5.9.0-rc5-next-20200915+ #700
[    4.122386] Hardware name: Realtek Saola EVB (DT)
[    4.127223] Workqueue: events request_firmware_work_func
[    4.132676] pstate: 60000005 (nZCv daif -PAN -UAO BTYPE=--)
[    4.138393] pc : rtw_load_firmware_cb+0x54/0xbc
[    4.143040] lr : request_firmware_work_func+0x44/0xb4
[    4.148217] sp : ffff800010133d70
[    4.151616] x29: ffff800010133d70 x28: 0000000000000000
[    4.157069] x27: 0000000000000000 x26: 0000000000000000
[    4.162520] x25: 0000000000000000 x24: 0000000000000000
[    4.167971] x23: ffff00007ac21908 x22: ffff00007ebb2100
[    4.173424] x21: ffff00007ad35880 x20: edafeaac96079504
[    4.178877] x19: ffff00007ad35870 x18: 0000000000000000
[    4.184328] x17: 00000000000044d8 x16: 0000000000004310
[    4.189780] x15: 0000000000000800 x14: 00000000ef006305
[    4.195231] x13: ffffffff00000000 x12: ffffffffffffffff
[    4.200682] x11: 0000000000000020 x10: 0000000000000003
[    4.206135] x9 : 0000000000000000 x8 : ffff00007e73f680
[    4.211585] x7 : 0000000000000000 x6 : ffff80001119b588
[    4.217036] x5 : ffff00007e649c80 x4 : ffff00007e649c80
[    4.222487] x3 : ffff80001119b588 x2 : ffff8000108d1718
[    4.227940] x1 : ffff800011bd5000 x0 : ffff00007ac21600
[    4.233391] Call trace:
[    4.235906]  rtw_load_firmware_cb+0x54/0xbc
[    4.240198]  request_firmware_work_func+0x44/0xb4
[    4.245027]  process_one_work+0x178/0x1e4
[    4.249142]  worker_thread+0x1d0/0x268
[    4.252989]  kthread+0xe8/0xf8
[    4.256127]  ret_from_fork+0x10/0x18
[    4.259800] Code: f94013f5 a8c37bfd d65f03c0 f9000260 (f9401681)
[    4.266049] ---[ end trace f822ebae1a8545c2 ]---

To avoid this, wait on the completion callbacks in rtw_core_deinit()
before releasing firmware and continuing teardown.

Note that rtw_wait_firmware_completion() was introduced with
c8e5695eae9959fc5774c0f490f2450be8bad3de ("rtw88: load wowlan firmware
if wowlan is supported"), so backports to earlier branches may need to
inline wait_for_completion(&rtwdev->fw.completion) instead.

Fixes: e3037485c68e ("rtw88: new Realtek 802.11ac driver")
Fixes: c8e5695eae99 ("rtw88: load wowlan firmware if wowlan is supported")
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200920132621.26468-2-afaerber@suse.de
3 years agobrcmfmac: check return value of driver_for_each_device()
Zhang Changzhong [Sat, 19 Sep 2020 02:06:31 +0000 (10:06 +0800)]
brcmfmac: check return value of driver_for_each_device()

Fixes the following W=1 kernel build warning(s):

drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c:1576:6: warning:
 variable 'ret' set but not used [-Wunused-but-set-variable]
  1576 |  int ret;
       |      ^~~

driver_for_each_device() has been declared with __must_check, so the
return value should be checked.

Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1600481191-14250-1-git-send-email-zhangchangzhong@huawei.com
3 years agortlwifi: rtl8723be: use true,false for bool variable large_cfo_hit
Jason Yan [Sat, 19 Sep 2020 07:44:37 +0000 (15:44 +0800)]
rtlwifi: rtl8723be: use true,false for bool variable large_cfo_hit

This addresses the following coccinelle warning:

drivers/net/wireless/realtek/rtlwifi/rtl8723be/dm.c:1155:27-47: WARNING:
Comparison of 0/1 to bool variable
drivers/net/wireless/realtek/rtlwifi/rtl8723be/dm.c:1156:3-23: WARNING:
Assignment of 0/1 to bool variable
drivers/net/wireless/realtek/rtlwifi/rtl8723be/dm.c:1159:3-23: WARNING:
Assignment of 0/1 to bool variable

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200919074437.3459305-1-yanaijie@huawei.com
3 years agortlwifi: rtl8821ae: use true,false for bool variable large_cfo_hit
Jason Yan [Sat, 19 Sep 2020 07:44:28 +0000 (15:44 +0800)]
rtlwifi: rtl8821ae: use true,false for bool variable large_cfo_hit

This addresses the following coccinelle warning:

drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c:2680:27-47: WARNING:
Comparison of 0/1 to bool variable
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c:2683:3-23: WARNING:
Assignment of 0/1 to bool variable
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c:2686:3-23: WARNING:
Assignment of 0/1 to bool variable

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200919074428.3459234-1-yanaijie@huawei.com
3 years agortlwifi: rtl8192ee: use true,false for bool variable large_cfo_hit
Jason Yan [Sat, 19 Sep 2020 07:44:12 +0000 (15:44 +0800)]
rtlwifi: rtl8192ee: use true,false for bool variable large_cfo_hit

This addresses the following coccinelle warning:

drivers/net/wireless/realtek/rtlwifi/rtl8192ee/dm.c:721:27-47:
WARNING: Comparison of 0/1 to bool variable
drivers/net/wireless/realtek/rtlwifi/rtl8192ee/dm.c:722:3-23: WARNING:
Assignment of 0/1 to bool variable
drivers/net/wireless/realtek/rtlwifi/rtl8192ee/dm.c:725:2-22: WARNING:
Assignment of 0/1 to bool variable

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200919074412.3459163-1-yanaijie@huawei.com
3 years agortlwifi: Use ffs in <foo>_phy_calculate_bit_shift
Joe Perches [Sat, 19 Sep 2020 06:37:47 +0000 (23:37 -0700)]
rtlwifi: Use ffs in <foo>_phy_calculate_bit_shift

Remove the loop and use the generic ffs instead.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/e2ab424d24b74901bc0c39f0c60f75e871adf2ba.camel@perches.com
3 years agomt7601u: Convert to DEFINE_SHOW_ATTRIBUTE
Qinglang Miao [Sat, 19 Sep 2020 02:48:38 +0000 (10:48 +0800)]
mt7601u: Convert to DEFINE_SHOW_ATTRIBUTE

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Acked-by: Jakub Kicinski <kubakici@wp.pl>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200919024838.14172-1-miaoqinglang@huawei.com
3 years agowlcore: Remove unused function no_write_handler()
YueHaibing [Fri, 18 Sep 2020 13:13:05 +0000 (21:13 +0800)]
wlcore: Remove unused function no_write_handler()

There is no caller in tree, so can remove it.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200918131305.20976-1-yuehaibing@huawei.com
3 years agortlwifi: rtl8723be: fix comparison to bool warning in hw.c
Zheng Bin [Fri, 18 Sep 2020 10:25:05 +0000 (18:25 +0800)]
rtlwifi: rtl8723be: fix comparison to bool warning in hw.c

Fixes coccicheck warning:

drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c:861:6-35: WARNING: Comparison to bool

Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200918102505.16036-10-zhengbin13@huawei.com
3 years agortlwifi: rtl8192de: fix comparison to bool warning in hw.c
Zheng Bin [Fri, 18 Sep 2020 10:25:04 +0000 (18:25 +0800)]
rtlwifi: rtl8192de: fix comparison to bool warning in hw.c

Fixes coccicheck warning:

drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c:566:14-20: WARNING: Comparison to bool
drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c:572:13-19: WARNING: Comparison to bool
drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c:581:14-20: WARNING: Comparison to bool
drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c:587:13-19: WARNING: Comparison to bool

Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200918102505.16036-9-zhengbin13@huawei.com
3 years agortlwifi: rtl8192ce: fix comparison to bool warning in hw.c
Zheng Bin [Fri, 18 Sep 2020 10:25:03 +0000 (18:25 +0800)]
rtlwifi: rtl8192ce: fix comparison to bool warning in hw.c

Fixes coccicheck warning:

drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c:616:14-20: WARNING: Comparison to bool
drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c:621:13-19: WARNING: Comparison to bool
drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c:626:14-20: WARNING: Comparison to bool
drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c:631:13-19: WARNING: Comparison to bool

Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200918102505.16036-8-zhengbin13@huawei.com
3 years agortlwifi: rtl8192cu: fix comparison to bool warning in hw.c
Zheng Bin [Fri, 18 Sep 2020 10:25:02 +0000 (18:25 +0800)]
rtlwifi: rtl8192cu: fix comparison to bool warning in hw.c

Fixes coccicheck warning:

drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c:831:14-49: WARNING: Comparison to bool

Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200918102505.16036-7-zhengbin13@huawei.com
3 years agortlwifi: rtl8821ae: fix comparison to bool warning in phy.c
Zheng Bin [Fri, 18 Sep 2020 10:25:01 +0000 (18:25 +0800)]
rtlwifi: rtl8821ae: fix comparison to bool warning in phy.c

Fixes coccicheck warning:

drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c:1816:5-13: WARNING: Comparison to bool
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c:1825:5-13: WARNING: Comparison to bool
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c:1839:5-13: WARNING: Comparison to bool

Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200918102505.16036-6-zhengbin13@huawei.com
3 years agortlwifi: rtl8821ae: fix comparison to bool warning in hw.c
Zheng Bin [Fri, 18 Sep 2020 10:25:00 +0000 (18:25 +0800)]
rtlwifi: rtl8821ae: fix comparison to bool warning in hw.c

Fixes coccicheck warning:

drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c:1897:5-13: WARNING: Comparison to bool

Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200918102505.16036-5-zhengbin13@huawei.com
3 years agortlwifi: rtl8192cu: fix comparison to bool warning in mac.c
Zheng Bin [Fri, 18 Sep 2020 10:24:59 +0000 (18:24 +0800)]
rtlwifi: rtl8192cu: fix comparison to bool warning in mac.c

Fixes coccicheck warning:

drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c:161:14-17: WARNING: Comparison to bool
drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c:168:13-16: WARNING: Comparison to bool
drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c:179:14-17: WARNING: Comparison to bool
drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c:186:13-16: WARNING: Comparison to bool

Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200918102505.16036-4-zhengbin13@huawei.com
3 years agortlwifi: rtl8192c: fix comparison to bool warning in phy_common.c
Zheng Bin [Fri, 18 Sep 2020 10:24:58 +0000 (18:24 +0800)]
rtlwifi: rtl8192c: fix comparison to bool warning in phy_common.c

Fixes coccicheck warning:

drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.c:1106:14-18: WARNING: Comparison to bool

Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200918102505.16036-3-zhengbin13@huawei.com
3 years agortlwifi: rtl8192ee: fix comparison to bool warning in hw.c
Zheng Bin [Fri, 18 Sep 2020 10:24:57 +0000 (18:24 +0800)]
rtlwifi: rtl8192ee: fix comparison to bool warning in hw.c

Fixes coccicheck warning:

drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c:797:6-33: WARNING: Comparison to bool

Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200918102505.16036-2-zhengbin13@huawei.com
3 years agonet: wilc1000: clean up resource in error path of init mon interface
Huang Guobin [Thu, 17 Sep 2020 12:30:19 +0000 (08:30 -0400)]
net: wilc1000: clean up resource in error path of init mon interface

The wilc_wfi_init_mon_int() forgets to clean up resource when
register_netdevice() failed. Add the missed call to fix it.
And the return value of netdev_priv can't be NULL, so remove
the unnecessary error handling.

Fixes: 588713006ea4 ("staging: wilc1000: avoid the use of 'wilc_wfi_mon' static variable")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Huang Guobin <huangguobin4@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200917123019.206382-1-huangguobin4@huawei.com
3 years agossb: Remove meaningless jump label to simplify the code
Jing Xiangfeng [Tue, 15 Sep 2020 02:03:30 +0000 (10:03 +0800)]
ssb: Remove meaningless jump label to simplify the code

The out jump label has nothing to do. So remove it to simplify the code.

Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200915020330.96067-1-jingxiangfeng@huawei.com
3 years agortlwifi: rtl8723ae: fix comparison pointer to bool warning in phy.c
Zheng Bin [Thu, 10 Sep 2020 14:16:42 +0000 (22:16 +0800)]
rtlwifi: rtl8723ae: fix comparison pointer to bool warning in phy.c

Fixes coccicheck warning:

drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.c:191:5-13: WARNING: Comparison to bool
drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.c:205:5-13: WARNING: Comparison to bool
drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.c:211:5-13: WARNING: Comparison to bool
drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.c:625:5-30: WARNING: Comparison to bool

Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200910141642.127006-4-zhengbin13@huawei.com
3 years agortlwifi: rtl8723ae: fix comparison pointer to bool warning in trx.c
Zheng Bin [Thu, 10 Sep 2020 14:16:41 +0000 (22:16 +0800)]
rtlwifi: rtl8723ae: fix comparison pointer to bool warning in trx.c

Fixes coccicheck warning:

drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.c:592:5-9: WARNING: Comparison to bool
drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.c:633:5-9: WARNING: Comparison to bool

Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200910141642.127006-3-zhengbin13@huawei.com
3 years agortlwifi: rtl8723ae: fix comparison pointer to bool warning in rf.c
Zheng Bin [Thu, 10 Sep 2020 14:16:40 +0000 (22:16 +0800)]
rtlwifi: rtl8723ae: fix comparison pointer to bool warning in rf.c

Fixes coccicheck warning:

drivers/net/wireless/realtek/rtlwifi/rtl8723ae/rf.c:52:5-22: WARNING: Comparison to bool
drivers/net/wireless/realtek/rtlwifi/rtl8723ae/rf.c:482:6-14: WARNING: Comparison to bool

Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200910141642.127006-2-zhengbin13@huawei.com
3 years agortlwifi: rtl8188ee: fix comparison pointer to bool warning in hw.c
Zheng Bin [Thu, 10 Sep 2020 13:59:17 +0000 (21:59 +0800)]
rtlwifi: rtl8188ee: fix comparison pointer to bool warning in hw.c

Fixes coccicheck warning:

drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c:777:14-20: WARNING: Comparison to bool
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c:782:13-19: WARNING: Comparison to bool
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c:787:14-20: WARNING: Comparison to bool
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c:792:13-19: WARNING: Comparison to bool
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c:871:6-33: WARNING: Comparison to bool
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c:1070:5-13: WARNING: Comparison to bool

Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200910135917.143723-4-zhengbin13@huawei.com
3 years agortlwifi: rtl8188ee: fix comparison pointer to bool warning in trx.c
Zheng Bin [Thu, 10 Sep 2020 13:59:16 +0000 (21:59 +0800)]
rtlwifi: rtl8188ee: fix comparison pointer to bool warning in trx.c

Fixes coccicheck warning:

drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.c:735:5-9: WARNING: Comparison to bool
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.c:776:5-9: WARNING: Comparison to bool

Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200910135917.143723-3-zhengbin13@huawei.com
3 years agortlwifi: rtl8188ee: fix comparison pointer to bool warning in phy.c
Zheng Bin [Thu, 10 Sep 2020 13:59:15 +0000 (21:59 +0800)]
rtlwifi: rtl8188ee: fix comparison pointer to bool warning in phy.c

Fixes coccicheck warning:

drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c:1584:14-18: WARNING: Comparison to bool

Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200910135917.143723-2-zhengbin13@huawei.com
3 years agoqtnfmac: Remove unused macro QTNF_DMP_MAX_LEN
YueHaibing [Wed, 9 Sep 2020 13:59:51 +0000 (21:59 +0800)]
qtnfmac: Remove unused macro QTNF_DMP_MAX_LEN

There is no caller in tree, so remove it.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200909135951.4028-1-yuehaibing@huawei.com
3 years agortw88: rtw8822c: eliminate code duplication, use native swap() function
Ivan Safonov [Sun, 13 Sep 2020 16:59:59 +0000 (19:59 +0300)]
rtw88: rtw8822c: eliminate code duplication, use native swap() function

swap_u32() duplicate native swap(), so replace swap_u32() with swap().

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200913165958.419744-1-insafonov@gmail.com
3 years agowlcore: Remove unused macro WL1271_SUSPEND_SLEEP
YueHaibing [Wed, 9 Sep 2020 13:59:05 +0000 (21:59 +0800)]
wlcore: Remove unused macro WL1271_SUSPEND_SLEEP

commit 45aa7f071b06 ("wlcore: Use generic runtime pm calls for wowlan elp configuration")
left behind this, remove it.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200909135905.35728-1-yuehaibing@huawei.com
3 years agobrcmsmac: main: Eliminate empty brcms_c_down_del_timer()
Jason Yan [Thu, 10 Sep 2020 14:04:46 +0000 (22:04 +0800)]
brcmsmac: main: Eliminate empty brcms_c_down_del_timer()

This function does nothing so remove it. This addresses the following
coccicheck warning:

drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c:5103:6-15:
Unneeded variable: "callbacks". Return "0" on line 5105

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200910140446.1168049-1-yanaijie@huawei.com
Link: https://lore.kernel.org/r/20200910140455.1168174-1-yanaijie@huawei.com
3 years agobrcmsmac: phy_lcn: Remove unused variable 'lcnphy_rx_iqcomp_table_rev0'
Lee Jones [Thu, 10 Sep 2020 06:54:31 +0000 (07:54 +0100)]
brcmsmac: phy_lcn: Remove unused variable 'lcnphy_rx_iqcomp_table_rev0'

Fixes the following W=1 kernel build warning(s):

 drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c:361:25: warning: unused variable 'lcnphy_rx_iqcomp_table_rev0' [-Wunused-const-variable]
 struct lcnphy_rx_iqcomp lcnphy_rx_iqcomp_table_rev0[] = {
                         ^
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200910065431.657636-30-lee.jones@linaro.org
Link: https://lore.kernel.org/r/20200910140505.1168317-1-yanaijie@huawei.com
Link: https://lore.kernel.org/r/20200910035600.21736-1-yuehaibing@huawei.com
3 years agobrcmsmac: phytbl_lcn: Remove unused array 'dot11lcn_gain_tbl_rev1'
Lee Jones [Thu, 10 Sep 2020 06:54:30 +0000 (07:54 +0100)]
brcmsmac: phytbl_lcn: Remove unused array 'dot11lcn_gain_tbl_rev1'

Fixes the following W=1 kernel build warning(s):

 drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phytbl_lcn.c:108:18: warning: unused variable 'dot11lcn_gain_tbl_rev1' [-Wunused-const-variable]
 static const u32 dot11lcn_gain_tbl_rev1[] = {

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200910065431.657636-29-lee.jones@linaro.org
3 years agoairo: switch from 'pci_' to 'dma_' API
Christophe JAILLET [Mon, 7 Sep 2020 20:19:42 +0000 (22:19 +0200)]
airo: switch from 'pci_' to 'dma_' API

The wrappers in include/linux/pci-dma-compat.h should go away.

The patch has been generated with the coccinelle script below and has been
hand modified to replace GFP_ with a correct flag.
It has been compile tested.

When memory is allocated in 'mpi_map_card()' GFP_KERNEL can be used because
this function is called from a probe or a module_init() function and no
spinlock is taken in the between.

The call chains are:
  airo_init_module module_init function in 'airo.c'
or
  airo_probe .probe function in 'airo_cs.c'
    --> airo_config

followed in both cases by:
      --> init_airo_card
        --> _init_airo_card
          --> mpi_map_card

@@
@@
-    PCI_DMA_BIDIRECTIONAL
+    DMA_BIDIRECTIONAL

@@
@@
-    PCI_DMA_TODEVICE
+    DMA_TO_DEVICE

@@
@@
-    PCI_DMA_FROMDEVICE
+    DMA_FROM_DEVICE

@@
@@
-    PCI_DMA_NONE
+    DMA_NONE

@@
expression e1, e2, e3;
@@
-    pci_alloc_consistent(e1, e2, e3)
+    dma_alloc_coherent(&e1->dev, e2, e3, GFP_)

@@
expression e1, e2, e3;
@@
-    pci_zalloc_consistent(e1, e2, e3)
+    dma_alloc_coherent(&e1->dev, e2, e3, GFP_)

@@
expression e1, e2, e3, e4;
@@
-    pci_free_consistent(e1, e2, e3, e4)
+    dma_free_coherent(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_map_single(e1, e2, e3, e4)
+    dma_map_single(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_unmap_single(e1, e2, e3, e4)
+    dma_unmap_single(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4, e5;
@@
-    pci_map_page(e1, e2, e3, e4, e5)
+    dma_map_page(&e1->dev, e2, e3, e4, e5)

@@
expression e1, e2, e3, e4;
@@
-    pci_unmap_page(e1, e2, e3, e4)
+    dma_unmap_page(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_map_sg(e1, e2, e3, e4)
+    dma_map_sg(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_unmap_sg(e1, e2, e3, e4)
+    dma_unmap_sg(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_dma_sync_single_for_cpu(e1, e2, e3, e4)
+    dma_sync_single_for_cpu(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_dma_sync_single_for_device(e1, e2, e3, e4)
+    dma_sync_single_for_device(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_dma_sync_sg_for_cpu(e1, e2, e3, e4)
+    dma_sync_sg_for_cpu(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_dma_sync_sg_for_device(e1, e2, e3, e4)
+    dma_sync_sg_for_device(&e1->dev, e2, e3, e4)

@@
expression e1, e2;
@@
-    pci_dma_mapping_error(e1, e2)
+    dma_mapping_error(&e1->dev, e2)

@@
expression e1, e2;
@@
-    pci_set_dma_mask(e1, e2)
+    dma_set_mask(&e1->dev, e2)

@@
expression e1, e2;
@@
-    pci_set_consistent_dma_mask(e1, e2)
+    dma_set_coherent_mask(&e1->dev, e2)

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200907201942.321568-1-christophe.jaillet@wanadoo.fr
3 years agobrcmfmac: support SAE authentication offload in AP mode
Chung-Hsien Hsu [Mon, 17 Aug 2020 07:33:16 +0000 (02:33 -0500)]
brcmfmac: support SAE authentication offload in AP mode

Firmware may have SAE authenticator code built-in. This is detected by
the driver and indicated in the wiphy features flags. User space can use
this flag to determine whether or not to provide the password material
in the nl80211 start AP command to offload the SAE authentication in AP
mode.

Signed-off-by: Chung-Hsien Hsu <stanley.hsu@cypress.com>
Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200817073316.33402-5-stanley.hsu@cypress.com
3 years agobrcmfmac: support 4-way handshake offloading for WPA/WPA2-PSK in AP mode
Chung-Hsien Hsu [Mon, 17 Aug 2020 07:33:14 +0000 (02:33 -0500)]
brcmfmac: support 4-way handshake offloading for WPA/WPA2-PSK in AP mode

Firmware may have authenticator code built-in. This is detected by the
driver and indicated in the wiphy features flags. User space can use
this flag to determine whether or not to provide the pre-shared key
material in the nl80211 start AP command to offload the 4-way handshake
in AP mode.

Signed-off-by: Chung-Hsien Hsu <stanley.hsu@cypress.com>
Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200817073316.33402-3-stanley.hsu@cypress.com
3 years agonet: hns: use IRQ_NOAUTOEN to avoid irq is enabled due to request_irq
Barry Song [Fri, 11 Sep 2020 01:55:10 +0000 (13:55 +1200)]
net: hns: use IRQ_NOAUTOEN to avoid irq is enabled due to request_irq

Rather than doing request_irq and then disabling the irq immediately, it
should be safer to use IRQ_NOAUTOEN flag for the irq. It removes any gap
between request_irq() and disable_irq().

Cc: Salil Mehta <salil.mehta@huawei.com>
Reviewed-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: Barry Song <song.bao.hua@hisilicon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoMerge branch 'net-ethernet-ti-ale-add-static-configuration'
David S. Miller [Sat, 12 Sep 2020 00:34:40 +0000 (17:34 -0700)]
Merge branch 'net-ethernet-ti-ale-add-static-configuration'

Grygorii Strashko says:

====================
net: ethernet: ti: ale: add static configuration

As existing, as newly introduced CPSW ALE versions have differences in
supported features and ALE table formats. Especially it's actual for the
recent AM65x/J721E/J7200 and future AM64x SoCs, which supports more
features like: auto-aging, classifiers, Link aggregation, additional HW
filtering, etc.

The existing ALE configuration interface is not practical in terms of
adding new features and requires consumers to program a lot static
parameters. And any attempt to add new features will case endless adding
and maintaining different combination of flags and options. Because CPSW
ALE configuration is static and fixed for SoC (or set of SoC), It is
reasonable to add support for static ALE configurations inside ALE module.

This series introduces static ALE configuration table for different ALE
variants and provides option for consumers to select required ALE
configuration by providing ALE const char *dev_id identifier (Patch 2).
And all existing driver have been switched to use new approach (Patches 3-6).

After this ALE HW auto-ageing feature can be enabled for AM65x CPSW ALE
variant (Patch 7).

Finally, Patches 8-9 introduces tables to describe the ALE VLAN entries
fields as the ALE VLAN entries are too much differ between different TI
CPSW ALE versions. So, handling them using flags, defines and get/set
functions are became over-complicated.

Patch 1 - is preparation patch

Changes in v3:
- fixed comment for Patch 2

Changes in v2:
- fixed sparse warnings

v2: https://lore.kernel.org/patchwork/cover/1301684/
v1: https://lore.kernel.org/patchwork/cover/1301048/
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: ethernet: ti: ale: add support for multi port k3 cpsw versions
Grygorii Strashko [Thu, 10 Sep 2020 20:28:07 +0000 (23:28 +0300)]
net: ethernet: ti: ale: add support for multi port k3 cpsw versions

The TI J721E (CPSW9g) ALE version is similar, in general, to Sitara AM3/4/5
CPSW ALE, but has more extended functions and different ALE VLAN entry
format.

This patch adds support for for multi port TI J721E (CPSW9g) ALE variant.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: ethernet: ti: ale: switch to use tables for vlan entry description
Grygorii Strashko [Thu, 10 Sep 2020 20:28:06 +0000 (23:28 +0300)]
net: ethernet: ti: ale: switch to use tables for vlan entry description

The ALE VLAN entries are too much differ between different TI CPSW ALE
versions. So, handling them using flags, defines and get/set functions
became over-complicated.

This patch introduces tables to describe the ALE VLAN entries fields, which
are different between TI CPSW ALE versions, and new get/set access
functions. It also allows to detect incorrect access to not available ALL
entry fields.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: ethernet: ti: am65-cpsw: enable hw auto ageing
Grygorii Strashko [Thu, 10 Sep 2020 20:28:05 +0000 (23:28 +0300)]
net: ethernet: ti: am65-cpsw: enable hw auto ageing

The AM65x ALE supports HW auto-ageing which can be enabled by programming
ageing interval in ALE_AGING_TIMER register. For this CPSW fck_clk
frequency has to be know by ALE.

This patch extends cpsw_ale_params with bus_freq field and enables ALE HW
auto ageing for AM65x CPSW2G ALE version.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: ethernet: ti: ale: make usage of ale dev_id mandatory
Grygorii Strashko [Thu, 10 Sep 2020 20:28:04 +0000 (23:28 +0300)]
net: ethernet: ti: ale: make usage of ale dev_id mandatory

Hence all existing driver updated to use ALE dev_id the usage of ale dev_id
can be made mandatory and cpsw_ale_create() can be updated to use
"features" property from ALE static configuration.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: ethernet: ti: am65-cpsw: use dev_id for ale configuration
Grygorii Strashko [Thu, 10 Sep 2020 20:28:03 +0000 (23:28 +0300)]
net: ethernet: ti: am65-cpsw: use dev_id for ale configuration

The previous patch has introduced possibility to select CPSW ALE by using
ALE dev_id identifier. Switch TI TI AM65x/J721E CPSW NUSS driver to use
dev_id.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: netcp: ethss: use dev_id for ale configuration
Grygorii Strashko [Thu, 10 Sep 2020 20:28:02 +0000 (23:28 +0300)]
net: netcp: ethss: use dev_id for ale configuration

The previous patch has introduced possibility to select CPSW ALE by using
ALE dev_id identifier. Switch TI Keystone 2 NETCP driver to use dev_id and
perform clean up by removing "ale_entries" configuration code.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: ethernet: ti: cpsw: use dev_id for ale configuration
Grygorii Strashko [Thu, 10 Sep 2020 20:28:01 +0000 (23:28 +0300)]
net: ethernet: ti: cpsw: use dev_id for ale configuration

The previous patch has introduced possibility to select CPSW ALE by using
ALE dev_id identifier. Switch TI cpsw driver to use dev_id="cpsw" and
perform clean up by removing "ale_entries" configuration code.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: ethernet: ti: ale: add static configuration
Grygorii Strashko [Thu, 10 Sep 2020 20:28:00 +0000 (23:28 +0300)]
net: ethernet: ti: ale: add static configuration

As existing, as newly introduced CPSW ALE versions have differences in
supported features and ALE table formats. Especially it's actual for the
recent AM65x/J721E/J7200 SoC and feature AM64x, which supports features
like: auto-aging, classifiers, Link aggregation, additional hw filtering,
etc.

Existing ALE configuration interface is not practical in terms of adding
new features and requires consumers to program a lot static parameters. Any
attempt to add new options will case endless adding and maintaining
different combination of flags and options.

Hence CPSW ALE configuration is static and fixed for SoC (or set of SoC) It
is reasonable to add support for static ALE configurations inside ALE
module. This patch adds static ALE configuration table for different ALE
versions and provides option for consumers to select required ALE
configuration by providing ALE const char *dev_id identifier.

This feature is not enabled by default until existing CPSW drivers will be
modified by follow up patches.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: ethernet: ti: ale: add cpsw_ale_get_num_entries api
Grygorii Strashko [Thu, 10 Sep 2020 20:27:59 +0000 (23:27 +0300)]
net: ethernet: ti: ale: add cpsw_ale_get_num_entries api

Add cpsw_ale_get_num_entries() API to return number of ALE table entries
and update existing drivers to use it.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoMerge branch 'DSA-tag_8021q-cleanup'
David S. Miller [Sat, 12 Sep 2020 00:30:43 +0000 (17:30 -0700)]
Merge branch 'DSA-tag_8021q-cleanup'

Vladimir Oltean says:

====================
DSA tag_8021q cleanup

This small series tries to consolidate the VLAN handling in DSA a little
bit. It reworks tag_8021q to be minimally invasive to the dsa_switch_ops
structure. This makes the rest of the code a bit easier to follow.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoRevert "net: dsa: Add more convenient functions for installing port VLANs"
Vladimir Oltean [Thu, 10 Sep 2020 16:48:57 +0000 (19:48 +0300)]
Revert "net: dsa: Add more convenient functions for installing port VLANs"

This reverts commit 314f76d7a68bab0516aa52877944e6aacfa0fc3f.

Citing that commit message, the call graph was:

    dsa_slave_vlan_rx_add_vid   dsa_port_setup_8021q_tagging
                |                        |
                |                        |
                |          +-------------+
                |          |
                v          v
               dsa_port_vid_add      dsa_slave_port_obj_add
                      |                         |
                      +-------+         +-------+
                              |         |
                              v         v
                           dsa_port_vlan_add

Now that tag_8021q has its own ops structure, it no longer relies on
dsa_port_vid_add, and therefore on the dsa_switch_ops to install its
VLANs.

So dsa_port_vid_add now only has one single caller. So we can simplify
the call graph to what it was before, aka:

        dsa_slave_vlan_rx_add_vid     dsa_slave_port_obj_add
                      |                         |
                      +-------+         +-------+
                              |         |
                              v         v
                           dsa_port_vlan_add

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: dsa: tag_8021q: add a context structure
Vladimir Oltean [Thu, 10 Sep 2020 16:48:56 +0000 (19:48 +0300)]
net: dsa: tag_8021q: add a context structure

While working on another tag_8021q driver implementation, some things
became apparent:

- It is not mandatory for a DSA driver to offload the tag_8021q VLANs by
  using the VLAN table per se. For example, it can add custom TCAM rules
  that simply encapsulate RX traffic, and redirect & decapsulate rules
  for TX traffic. For such a driver, it makes no sense to receive the
  tag_8021q configuration through the same callback as it receives the
  VLAN configuration from the bridge and the 8021q modules.

- Currently, sja1105 (the only tag_8021q user) sets a
  priv->expect_dsa_8021q variable to distinguish between the bridge
  calling, and tag_8021q calling. That can be improved, to say the
  least.

- The crosschip bridging operations are, in fact, stateful already. The
  list of crosschip_links must be kept by the caller and passed to the
  relevant tag_8021q functions.

So it would be nice if the tag_8021q configuration was more
self-contained. This patch attempts to do that.

Create a struct dsa_8021q_context which encapsulates a struct
dsa_switch, and has 2 function pointers for adding and deleting a VLAN.
These will replace the previous channel to the driver, which was through
the .port_vlan_add and .port_vlan_del callbacks of dsa_switch_ops.

Also put the list of crosschip_links into this dsa_8021q_context.
Drivers that don't support cross-chip bridging can simply omit to
initialize this list, as long as they dont call any cross-chip function.

The sja1105_vlan_add and sja1105_vlan_del functions are refactored into
a smaller sja1105_vlan_add_one, which now has 2 entry points:
- sja1105_vlan_add, from struct dsa_switch_ops
- sja1105_dsa_8021q_vlan_add, from the tag_8021q ops
But even this change is fairly trivial. It just reflects the fact that
for sja1105, the VLANs from these 2 channels end up in the same hardware
table. However that is not necessarily true in the general sense (and
that's the reason for making this change).

The rest of the patch is mostly plain refactoring of "ds" -> "ctx". The
dsa_8021q_context structure needs to be propagated because adding a VLAN
is now done through the ops function pointers inside of it.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: dsa: tag_8021q: setup tagging via a single function call
Vladimir Oltean [Thu, 10 Sep 2020 16:48:55 +0000 (19:48 +0300)]
net: dsa: tag_8021q: setup tagging via a single function call

There is no point in calling dsa_port_setup_8021q_tagging for each
individual port. Additionally, it will become more difficult to do that
when we'll have a context structure to tag_8021q (next patch). So
refactor this now.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: dsa: tag_8021q: include missing refcount.h
Vladimir Oltean [Thu, 10 Sep 2020 16:48:54 +0000 (19:48 +0300)]
net: dsa: tag_8021q: include missing refcount.h

The previous assumption was that the caller would already have this
header file included.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agocrypto/chcr: move nic TLS functionality to drivers/net
Rohit Maheshwari [Thu, 10 Sep 2020 14:21:47 +0000 (19:51 +0530)]
crypto/chcr: move nic TLS functionality to drivers/net

This patch moves complete nic tls offload (kTLS) code from crypto
directory to drivers/net/ethernet/chelsio/inline_crypto/ch_ktls
directory. nic TLS is made a separate ULD of cxgb4.

Signed-off-by: Rohit Maheshwari <rohitm@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoMerge branch 'sfc-encap-offloads-on-EF10'
David S. Miller [Sat, 12 Sep 2020 00:15:22 +0000 (17:15 -0700)]
Merge branch 'sfc-encap-offloads-on-EF10'

Edward Cree says:

====================
sfc: encap offloads on EF10

EF10 NICs from the 8000 series onwards support TX offloads (checksumming,
 TSO) on VXLAN- and NVGRE-encapsulated packets.  This series adds driver
 support for these offloads.

Changes from v1:
 * Fix 'no TXQ of type' error handling in patch #1 (and clear up the
   misleading comment that inspired the wrong version)
 * Add comment in patch #5 explaining what the deal with TSOv3 is
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agosfc: advertise encapsulated offloads on EF10
Edward Cree [Fri, 11 Sep 2020 22:40:41 +0000 (23:40 +0100)]
sfc: advertise encapsulated offloads on EF10

Necessitates an .ndo_features_check, as the EF10 datapath has several
 limitations on what it can handle.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agosfc: implement encapsulated TSO on EF10
Edward Cree [Fri, 11 Sep 2020 22:40:14 +0000 (23:40 +0100)]
sfc: implement encapsulated TSO on EF10

>From the 8000 series onwards, EF10 NICs with suitable firmware are able
 to perform TSO within VXLAN or NVGRE encapsulation.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agosfc: de-indirect TSO handling
Edward Cree [Fri, 11 Sep 2020 22:40:03 +0000 (23:40 +0100)]
sfc: de-indirect TSO handling

Remove the tx_queue->handle_tso function pointer, and just use
 tx_queue->tso_version to decide which function to call, thus removing
 an indirect call from the fast path.
Instead of passing a tso_v2 flag to efx_mcdi_tx_init(), set the desired
 tx_queue->tso_version before calling it.
In efx_mcdi_tx_init(), report back failure to obtain a TSOv2 context by
 setting tx_queue->tso_version to 0, which will cause the TX path to
 use the GSO-based fallback.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agosfc: select inner-csum-offload TX queues for skbs that need it
Edward Cree [Fri, 11 Sep 2020 22:39:39 +0000 (23:39 +0100)]
sfc: select inner-csum-offload TX queues for skbs that need it

Won't actually be exercised until we start advertising the corresponding
 offload features.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agosfc: create inner-csum queues on EF10 if supported
Edward Cree [Fri, 11 Sep 2020 22:39:28 +0000 (23:39 +0100)]
sfc: create inner-csum queues on EF10 if supported

If the MC reports the VXLAN_NVGRE datapath capability, then these queues
 can be used for checksum offload of encapsulated packets.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agosfc: define inner/outer csum offload TXQ types
Edward Cree [Fri, 11 Sep 2020 22:39:14 +0000 (23:39 +0100)]
sfc: define inner/outer csum offload TXQ types

Nothing yet creates inner csum TXQs; just change all references to
 EFX_TXQ_TYPE_OFFLOAD to the new EFX_TXQ_TYPE_OUTER_CSUM.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agosfc: decouple TXQ type from label
Edward Cree [Fri, 11 Sep 2020 22:39:02 +0000 (23:39 +0100)]
sfc: decouple TXQ type from label

Make it possible to have an arbitrary mapping from types to labels,
 because when we add inner-csum-offload TXQs there will no longer be a
 convenient nesting hierarchy of NIC types (EF10 will have inner-csum
 TXQs, while Siena will have HIGHPRI).
Correct a misleading comment on efx_hard_start_xmit().

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>