platform/kernel/linux-rpi.git
5 years agoMerge tag 'mt76-for-kvalo-2019-05-01' of https://github.com/nbd168/wireless
Kalle Valo [Wed, 1 May 2019 16:51:28 +0000 (19:51 +0300)]
Merge tag 'mt76-for-kvalo-2019-05-01' of https://github.com/nbd168/wireless

mt76 patches for 5.2

* share more code across drivers
* new driver for MT7615 chipsets
* rework DMA API
* tx/rx performance optimizations
* use NAPI for tx cleanup on mt76x02
* AP mode support for USB devices
* USB stability fixes
* tx power handling fixes for 76x2
* endian fixes

5 years agobrcmfmac: print firmware messages after a firmware crash
Rafał Miłecki [Sun, 28 Apr 2019 21:38:26 +0000 (23:38 +0200)]
brcmfmac: print firmware messages after a firmware crash

Normally firmware messages are printed with debugging enabled only. It's
a good idea as firmware may print a lot of messages that normal users
don't need to care about.

However, on firmware crash, it may be very helpful to log all recent
messages. There is almost always a backtrace available as well as rought
info on the latest actions/state.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agobrcmfmac: set txflow request id from 1 to pktids array size
Wright Feng [Fri, 26 Apr 2019 03:41:46 +0000 (03:41 +0000)]
brcmfmac: set txflow request id from 1 to pktids array size

Some PCIE firmwares drop txstatus if pktid is 0 and make packet held in
host side and never be released. If that packet type is 802.1x, the
pend_8021x_cnt value will be always greater than 0 and show "Timed out
waiting for no pending 802.1x packets" error message when sending key to
dongle every time.

To be compatible with all firmwares, host should set txflow request id
from 1 instead of from 0.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agobrcm80211: potential NULL dereference in brcmf_cfg80211_vndr_cmds_dcmd_handler()
Dan Carpenter [Wed, 24 Apr 2019 09:52:18 +0000 (12:52 +0300)]
brcm80211: potential NULL dereference in brcmf_cfg80211_vndr_cmds_dcmd_handler()

If "ret_len" is negative then it could lead to a NULL dereference.

The "ret_len" value comes from nl80211_vendor_cmd(), if it's negative
then we don't allocate the "dcmd_buf" buffer.  Then we pass "ret_len" to
brcmf_fil_cmd_data_set() where it is cast to a very high u32 value.
Most of the functions in that call tree check whether the buffer we pass
is NULL but there are at least a couple places which don't such as
brcmf_dbg_hex_dump() and brcmf_msgbuf_query_dcmd().  We memcpy() to and
from the buffer so it would result in a NULL dereference.

The fix is to change the types so that "ret_len" can't be negative.  (If
we memcpy() zero bytes to NULL, that's a no-op and doesn't cause an
issue).

Fixes: 1bacb0487d0e ("brcmfmac: replace cfg80211 testmode with vendor command")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agomt76: mt7603: dynamically alloc mcu req in mt7603_mcu_set_eeprom
Lorenzo Bianconi [Tue, 30 Apr 2019 15:17:23 +0000 (17:17 +0200)]
mt76: mt7603: dynamically alloc mcu req in mt7603_mcu_set_eeprom

Do not allocate mcu requests on the stack in mt7603_mcu_set_eeprom
in order to avoid the following warning:

Warning: the frame size of 1032 bytes is larger than 1024 bytes
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: do not enable/disable pre_tbtt_tasklet in scan_start/scan_complete
Lorenzo Bianconi [Tue, 30 Apr 2019 13:12:03 +0000 (15:12 +0200)]
mt76: do not enable/disable pre_tbtt_tasklet in scan_start/scan_complete

Do not enable/disable pre_tbtt_tasklet tasklet in
mt76x02_sw_scan/mt76x02_sw_scan_complete since it is already done
setting the operating channel. Do run tbtt_tasklet while the device is
offchannel

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: mt7603: enable/disable pre_tbtt_tasklet in mt7603_set_channel
Lorenzo Bianconi [Tue, 30 Apr 2019 13:12:02 +0000 (15:12 +0200)]
mt76: mt7603: enable/disable pre_tbtt_tasklet in mt7603_set_channel

Disable pre_tbtt_tasklet tasklet before setting the operating channel.
Enable/disable beacon_timer in mt7603_set_channel

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: move pre_tbtt_tasklet in mt76_dev
Lorenzo Bianconi [Tue, 30 Apr 2019 13:12:01 +0000 (15:12 +0200)]
mt76: move pre_tbtt_tasklet in mt76_dev

Move pre_tbtt_tasklet tasklet in mt76_dev data structure since
it is used by all drivers

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: add TX/RX antenna pattern capabilities
Ryder Lee [Tue, 30 Apr 2019 13:55:38 +0000 (21:55 +0800)]
mt76: add TX/RX antenna pattern capabilities

Announce antenna pattern cap to adapt PHY and baseband settings.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: move beacon_mask in mt76_dev
Lorenzo Bianconi [Mon, 29 Apr 2019 08:13:00 +0000 (10:13 +0200)]
mt76: move beacon_mask in mt76_dev

Move beacon_mask in mt76_dev data structure since it is used by
all drivers

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: move beacon_int in mt76_dev
Lorenzo Bianconi [Mon, 29 Apr 2019 08:12:59 +0000 (10:12 +0200)]
mt76: move beacon_int in mt76_dev

Move beacon_int in mt76_dev data structure since it is used by
all drivers

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: usb: use EP max packet aligned buffer sizes for rx
Stanislaw Gruszka [Tue, 30 Apr 2019 08:10:49 +0000 (10:10 +0200)]
mt76: usb: use EP max packet aligned buffer sizes for rx

If buffer size is not usb_endpoint_maxp (512 or 1024 bytes) multiple,
usb host driver has to use bounce buffer and copy data. For RX we can
avoid that since we alreay allocate q->buf_size (2kB) buffers and
mt76usb hardware will not fill more data as rx packet size is limited
by network protocol. However add error message if this assumption
somehow will be not true.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: mt7603: report firmware version using ethtool
Lorenzo Bianconi [Sat, 27 Apr 2019 13:02:10 +0000 (15:02 +0200)]
mt76: mt7603: report firmware version using ethtool

Print fw_ver and build_date members of struct mt7603_fw_trailer
similarly to what appears in the output of 'dmesg' when the MCU firmware
is loaded.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: fix endianness sparse warnings
Ryder Lee [Fri, 26 Apr 2019 08:09:22 +0000 (16:09 +0800)]
mt76: fix endianness sparse warnings

Fix many warnings with incorrect endian assumptions.

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Reviewed-by: Stanislaw Gruszka <sgruszka@redhat.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: mt76x02: mt76x02_poll_tx() can be static
kbuild test robot [Mon, 29 Apr 2019 19:25:55 +0000 (03:25 +0800)]
mt76: mt76x02: mt76x02_poll_tx() can be static

Fixes: ec7d2d74760a ("mt76: mt76x02: use napi polling for tx cleanup")
Signed-off-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: mt7603: run __mt76_mcu_send_msg in mt7603_mcu_send_firmware
Lorenzo Bianconi [Thu, 18 Apr 2019 14:32:00 +0000 (16:32 +0200)]
mt76: mt7603: run __mt76_mcu_send_msg in mt7603_mcu_send_firmware

Run __mt76_mcu_send_msg instead of __mt7603_mcu_msg_send and remove
duplicated code.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: mt7603: init mcu_restart function pointer
Lorenzo Bianconi [Sat, 13 Apr 2019 14:01:28 +0000 (16:01 +0200)]
mt76: mt7603: init mcu_restart function pointer

Use common function wrapper in mt7603_mcu_exit since the code is shared
with mt7615 driver

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: introduce mt76_mcu_restart macro
Lorenzo Bianconi [Sat, 13 Apr 2019 14:01:27 +0000 (16:01 +0200)]
mt76: introduce mt76_mcu_restart macro

Use common function wrapper in mt76x02_watchdog_reset

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: mt7603: initialize mt76_mcu_ops data structure
Lorenzo Bianconi [Sat, 13 Apr 2019 14:01:26 +0000 (16:01 +0200)]
mt76: mt7603: initialize mt76_mcu_ops data structure

Use __mt76_mcu_send_msg wrapper instead of mt7603_mcu_msg_send.
This is a preliminary patch for mt7615-mt7603 mcu code unification

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: mt7603: use standard signature for mt7603_mcu_msg_send
Lorenzo Bianconi [Sat, 13 Apr 2019 14:01:25 +0000 (16:01 +0200)]
mt76: mt7603: use standard signature for mt7603_mcu_msg_send

Use mt76 common signature for mt7603_mcu_msg_send. Move skb allocation
in mt7603_mcu_msg_send and remove duplicated code. This is a preliminary
patch for mt7615-mt7603 mcu code unification

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: mt7603: remove query from mt7603_mcu_msg_send signature
Lorenzo Bianconi [Sat, 13 Apr 2019 14:01:24 +0000 (16:01 +0200)]
mt76: mt7603: remove query from mt7603_mcu_msg_send signature

Remove query parameter from mt7603_mcu_msg_send/__mt7603_mcu_msg_send
routine signature since it can be obtained from cmd value. This is a
preliminary patch for mcu code unification between mt7615 and mt7603
drivers

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: mt7615: use sizeof instead of sizeof_field
Felix Fietkau [Sat, 13 Apr 2019 12:07:42 +0000 (14:07 +0200)]
mt76: mt7615: use sizeof instead of sizeof_field

It is simpler in this case

Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: mt7603: fix initialization of max rx length
Felix Fietkau [Fri, 8 Mar 2019 18:50:21 +0000 (19:50 +0100)]
mt76: mt7603: fix initialization of max rx length

The previous version only accidentally disabled A-MSDU deaggregation by
using the wrong mask for rx length configuration, which left previous
length value in place.
Fix the length and initialize the register completely to keep A-MSDU
de-aggregation remaining disabled

Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: mt76x02: remove irqsave/restore in locking for tx status fifo
Felix Fietkau [Thu, 31 Jan 2019 21:38:28 +0000 (22:38 +0100)]
mt76: mt76x02: remove irqsave/restore in locking for tx status fifo

Use a separate lock and spin_trylock to avoid disabling interrupts.
Should improve performance and latency

Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: mt76x02: use napi polling for tx cleanup
Felix Fietkau [Fri, 22 Mar 2019 06:36:07 +0000 (07:36 +0100)]
mt76: mt76x02: use napi polling for tx cleanup

This allows tx scheduling and tx cleanup to run concurrently

Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: mt76x02: remove bogus mutex usage
Stanislaw Gruszka [Fri, 26 Apr 2019 07:58:42 +0000 (09:58 +0200)]
mt76: mt76x02: remove bogus mutex usage

mac80211 .start(), .stop() callbacks are never called concurrently with
other callbacks. The only concurencly is with mt76 works which we cancel
on stop() and schedule on start().

This fixes possible deadlock on cancel_delayed_work_sync(&dev->mac_work)
as mac_work also take mutex.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76usb: fix tx/rx stop
Stanislaw Gruszka [Fri, 26 Apr 2019 07:58:41 +0000 (09:58 +0200)]
mt76usb: fix tx/rx stop

Disabling tasklets on stopping rx/tx is wrong. If blocked tasklet
is scheduled and we remove device we will get 100% cpu usage:

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
    9 root      20   0       0      0      0 R  93.8   0.0   1:47.19 ksoftirqd/0

by infinite loop in tasklet_action_common() and eventuall crash on next
mt76usb module load:

[ 2068.591964] RIP: 0010:tasklet_action_common.isra.17+0x66/0x100
[ 2068.591966] Code: 41 89 f5 eb 25 f0 48 0f ba 33 00 0f 83 b1 00 00 00 48 8b 7a 20 48 8b 42 18 e8 56 a3 b5 00 f0 80 23 fd 48 89 ea 48 85 ed 74 53 <48> 8b 2a 48 8d 5a 08 f0 48 0f ba 6a 08 01 72 0b 8b 42 10 85 c0 74
[ 2068.591968] RSP: 0018:ffff98758c34be58 EFLAGS: 00010206
[ 2068.591969] RAX: ffff98758e6966d0 RBX: ffff98756e69aef8 RCX: 0000000000000006
[ 2068.591970] RDX: 01060a053d060305 RSI: 0000000000000006 RDI: ffff98758e6966d0
[ 2068.591971] RBP: 01060a053d060305 R08: 0000000000000000 R09: 00000000000203c0
[ 2068.591971] R10: 000003ff65b34f08 R11: 0000000000000001 R12: ffff98758e6966d0
[ 2068.591972] R13: 0000000000000006 R14: 0000000000000040 R15: 0000000000000006
[ 2068.591974] FS:  0000000000000000(0000) GS:ffff98758e680000(0000) knlGS:0000000000000000
[ 2068.591975] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 2068.591975] CR2: 00002c5f73a6cc20 CR3: 00000002f920a001 CR4: 00000000003606e0
[ 2068.591977] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 2068.591978] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 2068.591978] Call Trace:
[ 2068.591985]  __do_softirq+0xe3/0x30a
[ 2068.591989]  ? sort_range+0x20/0x20
[ 2068.591990]  run_ksoftirqd+0x26/0x40
[ 2068.591992]  smpboot_thread_fn+0xc5/0x160
[ 2068.591995]  kthread+0x112/0x130
[ 2068.591997]  ? kthread_create_on_node+0x40/0x40
[ 2068.591998]  ret_from_fork+0x35/0x40
[ 2068.591999] Modules linked in: ccm arc4 fuse rfcomm cmac bnep sunrpc snd_hda_codec_hdmi snd_soc_skl snd_soc_core snd_soc_acpi_intel_match snd_hda_codec_realtek snd_soc_acpi snd_hda_codec_generic snd_soc_skl_ipc snd_soc_sst_ipc snd_soc_sst_dsp snd_hda_ext_core iTCO_wdt snd_hda_intel intel_rapl iTCO_vendor_support x86_pkg_temp_thermal intel_powerclamp btusb mei_wdt coretemp btrtl snd_hda_codec btbcm btintel intel_cstate snd_hwdep intel_uncore uvcvideo snd_hda_core videobuf2_vmalloc videobuf2_memops intel_rapl_perf wmi_bmof videobuf2_v4l2 intel_wmi_thunderbolt snd_seq bluetooth joydev videobuf2_common snd_seq_device snd_pcm videodev media i2c_i801 snd_timer idma64 ecdh_generic intel_lpss_pci intel_lpss mei_me mei ucsi_acpi typec_ucsi processor_thermal_device intel_soc_dts_iosf intel_pch_thermal typec thinkpad_acpi wmi snd soundcore rfkill int3403_thermal int340x_thermal_zone int3400_thermal acpi_thermal_rel acpi_pad pcc_cpufreq uas usb_storage crc32c_intel i915 i2c_algo_bit nvme serio_raw
[ 2068.592033]  drm_kms_helper e1000e nvme_core drm video ipv6 [last unloaded: cfg80211]

Fortunate thing is that this not happen frequently, as scheduling
tasklet on blocked state is very exceptional, though might happen.

Due to different RX/TX tasklet processing fix is different for those.

For RX we have to assure rx_tasklet do fail to resubmit buffers
by poisoning urb's and kill the tasklet.

For TX we need to handle all stop cases properly (suspend, module
unload, device removal).

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: mt76x02u: remove bogus stop on suspend
Stanislaw Gruszka [Fri, 26 Apr 2019 07:58:40 +0000 (09:58 +0200)]
mt76: mt76x02u: remove bogus stop on suspend

On suspend mac80211 .stop callback is called before .suspend(), so
hw mac is already stopped and we do not have to do this again.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agoMAINTAINERS: update entry for mt76 wireless driver
Ryder Lee [Mon, 1 Apr 2019 07:16:44 +0000 (15:16 +0800)]
MAINTAINERS: update entry for mt76 wireless driver

Roy and I actively join the development and review.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: use macro for sn and seq_ctrl conversion
Ryder Lee [Mon, 1 Apr 2019 07:16:43 +0000 (15:16 +0800)]
mt76: use macro for sn and seq_ctrl conversion

Use macro to convert sn and seq_ctrl for better readability.

Signed-off-by: Roy Luo <royluo@google.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: add unlikely() for dma_mapping_error() check
Ryder Lee [Mon, 1 Apr 2019 07:16:42 +0000 (15:16 +0800)]
mt76: add unlikely() for dma_mapping_error() check

In the tx/rx fastpath, the funciton dma_map_single() rarely fails.
This adds unlikely() optimization to this error check conditional.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: add mac80211 driver for MT7615 PCIe-based chipsets
Ryder Lee [Mon, 1 Apr 2019 07:16:41 +0000 (15:16 +0800)]
mt76: add mac80211 driver for MT7615 PCIe-based chipsets

This driver is for a newer generation of MediaTek MT7615 4x4 802.11ac
PCIe-based chipsets, which support wave2 MU-MIMO up to 4 users/group
and also support up to 160MHz bandwidth.

The driver fully supports AP, station and monitor mode.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Roy Luo <royluo@google.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: dma: add skb check for dummy pointer
Lorenzo Bianconi [Tue, 2 Apr 2019 09:47:59 +0000 (11:47 +0200)]
mt76: dma: add skb check for dummy pointer

Introduce skb check for dummy address in mt76_dma_tx_cleanup_idx.
This is a preliminary patch to add support for new chipsets (e.g. 7615)

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: dma: introduce skb field in mt76_txwi_cache
Lorenzo Bianconi [Tue, 2 Apr 2019 09:47:58 +0000 (11:47 +0200)]
mt76: dma: introduce skb field in mt76_txwi_cache

Introduce skb field in mt76_txwi_cache. Moreover add txwi_flags
to mt76_driver_ops since new chipsets will release mt76_txwi_cache/skbs
at tx completion instead of dma one.
This is a preliminary patch to add mt7615 support

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: add skb pointer to mt76_tx_info
Lorenzo Bianconi [Tue, 2 Apr 2019 09:47:57 +0000 (11:47 +0200)]
mt76: add skb pointer to mt76_tx_info

Pass skb pointer to tx_prepare_skb through mt76_tx_info data structure.
This is a preliminary patch to properly support dma error path for
new chipsets (e.g. 7615)

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: set txwi_size according to the driver value
Lorenzo Bianconi [Tue, 2 Apr 2019 09:47:56 +0000 (11:47 +0200)]
mt76: set txwi_size according to the driver value

Dynamically allocate txwi since new chipsets will use longer txwi
descriptors

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: usb: reduce locking in mt76u_tx_tasklet
Lorenzo Bianconi [Mon, 25 Mar 2019 19:18:38 +0000 (20:18 +0100)]
mt76: usb: reduce locking in mt76u_tx_tasklet

Similar to pci counterpart, reduce locking in mt76u_tx_tasklet since
q->head is managed just in mt76u_tx_tasklet and q->queued is updated
holding q->lock

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: move mac_work in mt76_dev
Lorenzo Bianconi [Mon, 18 Mar 2019 10:21:44 +0000 (11:21 +0100)]
mt76: move mac_work in mt76_dev

Move mac_work delayed work in mt76_dev data structure since
it is used by all drivers and it will be reused adding mac work to
mt7615

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: only schedule txqs from the tx tasklet
Felix Fietkau [Wed, 13 Mar 2019 19:18:56 +0000 (20:18 +0100)]
mt76: only schedule txqs from the tx tasklet

Reduces lock contention from the tx path and improves performance

Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: move tx tasklet to struct mt76_dev
Felix Fietkau [Wed, 13 Mar 2019 19:17:45 +0000 (20:17 +0100)]
mt76: move tx tasklet to struct mt76_dev

Allows it to be scheduled from core code

Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: store wcid tx rate info in one u32 reduce locking
Felix Fietkau [Wed, 13 Mar 2019 13:20:06 +0000 (14:20 +0100)]
mt76: store wcid tx rate info in one u32 reduce locking

Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: reduce locking in mt76_dma_tx_cleanup
Felix Fietkau [Thu, 31 Jan 2019 21:39:32 +0000 (22:39 +0100)]
mt76: reduce locking in mt76_dma_tx_cleanup

q->tail can be safely updated without locking, because there is no
concurrent access. If called from outside of the tasklet (for flushing),
the tasklet is always disabled.
q->queued can be safely read without locking, as long as the decrement
happens within the locked section.
This patch allows cleaning up tx packets outside of the section that holds
the queue lock for improved performance

Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: use mac80211 txq scheduling
Felix Fietkau [Tue, 12 Mar 2019 23:51:36 +0000 (00:51 +0100)]
mt76: use mac80211 txq scheduling

Performance improvement and preparation for adding airtime fairness support

Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: use readl/writel instead of ioread32/iowrite32
Felix Fietkau [Sat, 23 Mar 2019 14:24:56 +0000 (15:24 +0100)]
mt76: use readl/writel instead of ioread32/iowrite32

Switching to readl/writel is faster because it gets rid of an unnecessary
wrapper with extra checks.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: fix tx power issues
Felix Fietkau [Wed, 27 Mar 2019 09:10:48 +0000 (10:10 +0100)]
mt76: fix tx power issues

- tx power is stored in the channels after ieee80211_register_hw, so
  chan->orig_mpwr needs to be updated as well
- for non-TSSI devices, mt76x2e needs to use a different target power value
  from the EEPROM
- fix a rounding error in a few places (need to round up, not down)

Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: introduce mt76_free_device routine
Lorenzo Bianconi [Wed, 27 Mar 2019 11:41:03 +0000 (12:41 +0100)]
mt76: introduce mt76_free_device routine

Move mt76_tx_free in mt76_free_device routine in order to
unmap all txwi descriptors at module unload

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76usb: remove queue variable from rx_tasklet
Stanislaw Gruszka [Thu, 21 Mar 2019 15:25:37 +0000 (16:25 +0100)]
mt76usb: remove queue variable from rx_tasklet

Since now only mt76u_get_next_rx_entry use queue argument move
it to this function.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76usb: allocate urb and sg as linear data
Stanislaw Gruszka [Thu, 21 Mar 2019 15:25:36 +0000 (16:25 +0100)]
mt76usb: allocate urb and sg as linear data

Alloc sg table at the end of urb structure. This will increase
cache usage.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76usb: remove unneded sg_init_table
Stanislaw Gruszka [Thu, 21 Mar 2019 15:25:35 +0000 (16:25 +0100)]
mt76usb: remove unneded sg_init_table

We already allocate with GFP_ZERO and sg marker is set later for
both RX and TX.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76usb: resue mt76u_urb_alloc for tx
Stanislaw Gruszka [Thu, 21 Mar 2019 15:25:34 +0000 (16:25 +0100)]
mt76usb: resue mt76u_urb_alloc for tx

Add new rx_urb_alloc routine and reuse common urb_alloc for tx
allocations.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76usb: remove MT_RXQ_MAIN queue from mt76u_urb_alloc
Stanislaw Gruszka [Thu, 21 Mar 2019 15:25:33 +0000 (16:25 +0100)]
mt76usb: remove MT_RXQ_MAIN queue from mt76u_urb_alloc

Get the RX queue inside mt76u_refill_rx. This will allow to reuse
mt76u_urb_alloc for TX allocations.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76usb: remove mt76u_buf and use urb directly
Stanislaw Gruszka [Thu, 21 Mar 2019 15:25:32 +0000 (16:25 +0100)]
mt76usb: remove mt76u_buf and use urb directly

Put urb pointer in mt76_queue_entry directly instead of mt76u_buf
structure.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76usb: move mt76u_buf->done to queue entry
Stanislaw Gruszka [Thu, 21 Mar 2019 15:25:31 +0000 (16:25 +0100)]
mt76usb: move mt76u_buf->done to queue entry

mt76_queue_entry has alreay one bool variable, adding new one will
not increase it's size. Removing ->done filed from mt76u_buf will
allow to use urb directly in mt76usb code.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76usb: remove mt76u_buf redundant fileds
Stanislaw Gruszka [Thu, 21 Mar 2019 15:25:30 +0000 (16:25 +0100)]
mt76usb: remove mt76u_buf redundant fileds

Remove mt76u_buf->{len, buf} fields and operate on corresponding
urb fields directly.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76usb: use usb_dev private data
Stanislaw Gruszka [Thu, 21 Mar 2019 15:25:29 +0000 (16:25 +0100)]
mt76usb: use usb_dev private data

Setup usb device private data. This allows to remove mt76u_buf->dev
and simplify some routines as no longer we need to get usb device
through usb interface.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76usb: change mt76u_fill_rx_sg arguments
Stanislaw Gruszka [Thu, 21 Mar 2019 15:25:28 +0000 (16:25 +0100)]
mt76usb: change mt76u_fill_rx_sg arguments

We do not need to pass len and sglen to the function.
Additionally pass gfp to control allocation context.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: remove rx_page_lock
Stanislaw Gruszka [Thu, 21 Mar 2019 15:25:27 +0000 (16:25 +0100)]
mt76: remove rx_page_lock

We can not run mt76u_alloc_buf() concurently, rx_tasklet is stooped
when mt76u_submit_rx_buffers(). We can remove rx_page_lock.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76usb: change mt76u_submit_buf
Stanislaw Gruszka [Thu, 21 Mar 2019 15:25:26 +0000 (16:25 +0100)]
mt76usb: change mt76u_submit_buf

Remove unnecessery arguments and change the function name since is
now used only for RX.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76x02: enable AP mode for USB
Stanislaw Gruszka [Tue, 19 Mar 2019 10:37:47 +0000 (11:37 +0100)]
mt76x02: enable AP mode for USB

Enable AP mode. For now without multi-vif support, this will require
more testing and investigation.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: unify set_tim
Stanislaw Gruszka [Tue, 19 Mar 2019 10:37:46 +0000 (11:37 +0100)]
mt76: unify set_tim

All mt76 drivers (now also USB drivers) require empty .set_tim
callback. Add it to common mt76 module and use on all drivers.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76x02u: add mt76_release_buffered_frames
Stanislaw Gruszka [Tue, 19 Mar 2019 10:37:45 +0000 (11:37 +0100)]
mt76x02u: add mt76_release_buffered_frames

Create software MT_TXQ_PSD queue for USB and map it to MT_TXQ_VO
since we do not have USB endpoint for PSD. This should make
mt76_release_buffered_frames() work by sending released frames
via MT_TXQ_VO.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76x02: make beacon slots bigger for USB
Stanislaw Gruszka [Tue, 19 Mar 2019 10:37:44 +0000 (11:37 +0100)]
mt76x02: make beacon slots bigger for USB

Since we sent PS buffered frames via beacon memory we need to make
beacon slots bigger. That imply we will also need to decrease number
of slots as beacon SRAM memory is limited to 8kB.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76x02u: implement pre TBTT work for USB
Stanislaw Gruszka [Tue, 19 Mar 2019 10:37:43 +0000 (11:37 +0100)]
mt76x02u: implement pre TBTT work for USB

Program beacons data and PS buffered frames on TBTT work for USB.
We do not have MT_TXQ_PSD queue available via USB endpoints. The way
we can send PS broadcast frames in timely manner before PS stations go
sleep again is program them in beacon data area. Hardware do not modify
those frames since TXWI is properly configured. mt76x02_mac_set_beacon()
already handle this and free no longer used frames.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76x02: disable HW encryption for group frames
Stanislaw Gruszka [Tue, 19 Mar 2019 10:37:42 +0000 (11:37 +0100)]
mt76x02: disable HW encryption for group frames

This is required to sent multicast/broadcast frames in USB AP
mode just after beacon.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76x02u: add sta_ps
Stanislaw Gruszka [Tue, 19 Mar 2019 10:37:41 +0000 (11:37 +0100)]
mt76x02u: add sta_ps

Add sta_ps callback but dont set WCID drop sicne registers for USB
can not be accessed from tasklet context.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76x02: generalize some mmio beaconing functions
Stanislaw Gruszka [Tue, 19 Mar 2019 10:37:40 +0000 (11:37 +0100)]
mt76x02: generalize some mmio beaconing functions

Move some TBTT mmio functions to mt76x02_beacon.c and create new ones
in order to be reused by USB pre-TBTT.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76x02u: implement beacon_ops
Stanislaw Gruszka [Tue, 19 Mar 2019 10:37:39 +0000 (11:37 +0100)]
mt76x02u: implement beacon_ops

Add implementation of beacon_ops for USB and exit function to
stop the timer if running when device is removed. Still no
actual work on pre tbtt event.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76x02: introduce beacon_ops
Stanislaw Gruszka [Tue, 19 Mar 2019 10:37:38 +0000 (11:37 +0100)]
mt76x02: introduce beacon_ops

Enabling/disableing TBTT and beacon will be diffrent for USB. Introduce
beacon_ops to encapsulate that and implement it for MMIO. USB
implementation is noop for now.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76x02: add hrtimer for pre TBTT for USB
Stanislaw Gruszka [Tue, 19 Mar 2019 10:37:37 +0000 (11:37 +0100)]
mt76x02: add hrtimer for pre TBTT for USB

Add timer and work for pre TBTT for USB devices. For now code
doesn't do anyting useful, just add hrtimer which synchronize
with hardware MT_TBTT_TIMER.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76x02: introduce mt76x02_beacon.c
Stanislaw Gruszka [Tue, 19 Mar 2019 10:37:36 +0000 (11:37 +0100)]
mt76x02: introduce mt76x02_beacon.c

Move most of beaconing code into separate file and separate beacon
initialization for USB and MMIO as pre TBTT implementation for USB
will be different.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: usb: reduce code indentation in mt76u_alloc_tx
Lorenzo Bianconi [Mon, 4 Mar 2019 12:59:49 +0000 (13:59 +0100)]
mt76: usb: reduce code indentation in mt76u_alloc_tx

Improve code readability reducing code indentation in
mt76u_alloc_tx

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt7603: core: do not use magic numbers in mt7603_reg_map
Lorenzo Bianconi [Sat, 16 Mar 2019 15:45:36 +0000 (16:45 +0100)]
mt7603: core: do not use magic numbers in mt7603_reg_map

Use register definitions instead of magic numbers in mt7603_reg_map

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt7603: remove mt7603_mcu_init routine
Lorenzo Bianconi [Sat, 16 Mar 2019 14:32:53 +0000 (15:32 +0100)]
mt7603: remove mt7603_mcu_init routine

Remove mt7603_mcu_init since mcu.mutex has been already initialized
in mt76_mmio_init. Run mt7603_load_firmware directly in
mt7603_init_hardware

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: dma: add static qualifier to mt76_dma_tx_queue_skb
Lorenzo Bianconi [Thu, 7 Mar 2019 14:45:43 +0000 (15:45 +0100)]
mt76: dma: add static qualifier to mt76_dma_tx_queue_skb

As already done for mt76_dma_tx_queue_skb_raw, add static qualifier to
mt76_dma_tx_queue_skb and introduce mt76_tx_queue_skb in order to run
mt76_dma_tx_queue_skb in driver code

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: introduce mt76_tx_info data structure
Lorenzo Bianconi [Thu, 14 Mar 2019 13:54:12 +0000 (14:54 +0100)]
mt76: introduce mt76_tx_info data structure

Add mt76_tx_info as auxiliary data structure to pass values
to tx_prepare_skb pointer. This is a preliminary patch to add
support for new chipsets (e.g. mt7615)

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: move skb dma mapping before running tx_prepare_skb
Lorenzo Bianconi [Thu, 14 Mar 2019 13:54:11 +0000 (14:54 +0100)]
mt76: move skb dma mapping before running tx_prepare_skb

Move skb dma mapping before configuring txwi since new chipsets (mt7615)
will need skb dma addresses in order to properly configure txwi

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: mmio: move mt76_insert_hdr_pad in mt76_dma_tx_queue_skb
Lorenzo Bianconi [Thu, 14 Mar 2019 13:54:10 +0000 (14:54 +0100)]
mt76: mmio: move mt76_insert_hdr_pad in mt76_dma_tx_queue_skb

Introduce tx_aligned4_skbs in mt76_driver_ops and move
mt76_insert_hdr_pad in mt76_dma_tx_queue_skb. This is a preliminary
patch in order to unify tx dma mapping for mt76x02 and new chipsets

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: move mt76x02_insert_hdr_pad in mt76-core module
Lorenzo Bianconi [Thu, 14 Mar 2019 13:54:09 +0000 (14:54 +0100)]
mt76: move mt76x02_insert_hdr_pad in mt76-core module

Move mt76x02_insert_hdr_pad in m76-core and rename it in
mt76_insert_hdr_pad in order to be used in mt76_dma_tx_queue_skb.
This is a preliminary patch in order to properly support tx dma
mapping for new chipsets (e.g. mt7615)

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: introduce mt76_txq_id field in mt76_queue_entry
Lorenzo Bianconi [Sat, 2 Mar 2019 13:47:42 +0000 (14:47 +0100)]
mt76: introduce mt76_txq_id field in mt76_queue_entry

Add mt76_txq_id field to mt76_queue_entry in order to properly
track outstanding frames for mt7615 that relies on a single hw queue

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: introduce mt76_sw_queue data structure
Lorenzo Bianconi [Sat, 2 Mar 2019 13:47:41 +0000 (14:47 +0100)]
mt76: introduce mt76_sw_queue data structure

Introduce mt76_sw_queue data structure in order to support new
chipsets (e.g. mt7615) that have a shared hardware queue for all traffic
identifiers. mt76_sw_queue will be used to track outstanding packets

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: remove mt76_queue dependency from tx_complete_skb function pointer
Lorenzo Bianconi [Sat, 2 Mar 2019 13:47:40 +0000 (14:47 +0100)]
mt76: remove mt76_queue dependency from tx_complete_skb function pointer

Remove mt76_queue dependency from tx_complete_skb function pointer and
rely on mt76_tx_qid instead. Remove flush from tx_complete_skb
signature. This is a preliminary patch to introduce mt76_sw_queue
support

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: remove mt76_queue dependency from tx_prepare_skb function pointer
Lorenzo Bianconi [Sat, 2 Mar 2019 13:47:39 +0000 (14:47 +0100)]
mt76: remove mt76_queue dependency from tx_prepare_skb function pointer

Remove mt76_queue dependency from tx_prepare_skb function pointer and
rely on mt76_tx_qid instead. This is a preliminary patch to introduce
mt76_sw_queue support

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: remove mt76_queue dependency from tx_queue_skb function pointer
Lorenzo Bianconi [Sat, 2 Mar 2019 13:47:38 +0000 (14:47 +0100)]
mt76: remove mt76_queue dependency from tx_queue_skb function pointer

Remove mt76_queue dependency from tx_queue_skb function pointer and
rely on mt76_tx_qid instead. This is a preliminary patch to introduce
mt76_sw_queue support

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: dma: move mt76x02_init_{tx,rx}_queue in mt76 module
Lorenzo Bianconi [Thu, 28 Feb 2019 16:54:32 +0000 (17:54 +0100)]
mt76: dma: move mt76x02_init_{tx,rx}_queue in mt76 module

Move mt76x02_init_tx_queue and mt76x02_init_rx_queue in mt76
module in order to be reused adding support for mt7603 driver
and remove duplicated code.
Squash mt76x02_init_tx_queue and mt76x02_init_rx_queue in
mt76_dma_alloc_queue

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: mmio: move mt76x02_set_irq_mask in mt76 module
Lorenzo Bianconi [Thu, 28 Feb 2019 16:54:31 +0000 (17:54 +0100)]
mt76: mmio: move mt76x02_set_irq_mask in mt76 module

Move mt76x02_set_irq_mask in mt76 module in order to be reused
adding support for mt7603 driver and remove duplicated code

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agortw88: new Realtek 802.11ac driver
Yan-Hsuan Chuang [Fri, 26 Apr 2019 12:17:37 +0000 (15:17 +0300)]
rtw88: new Realtek 802.11ac driver

This is a new mac80211 driver for Realtek 802.11ac wireless network chips.
rtw88 now supports RTL8822BE/RTL8822CE now, with basic station mode
functionalities. The firmware for both can be found at linux-firmware.

https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
For RTL8822BE: rtw88/rtw8822b_fw.bin
For RTL8822CE: rtw88/rtw8822c_fw.bin

And for now, only PCI buses (RTL8xxxE) are supported. We will add support
for USB and SDIO in the future. The bus interface abstraction can be seen
in this driver such as hci.h. Most of the hardware setting are the same
except for some TRX path or probing setup should be separated.

Supported:

 * Basic STA/AP/ADHOC mode, and TDLS (STA is well tested)

Missing feature:

 * WOW/PNO
 * USB & SDIO bus (such as RTL8xxxU/RTL8xxxS)
 * BT coexistence (8822B/8822C are combo ICs)
 * Multiple interfaces (for now single STA is better supported)
 * Dynamic hardware calibrations (to improve/stabilize performance)

Potential problems:

 * static calibration spends too much time, and it is painful for
   driver to leave IDLE state. And slows down associate process.
   But reload function are under development, will be added soon!
 * TRX statictics misleading, as we are not reporting status correctly,
   or say, not reporting for "every" packet.

The next patch set should have BT coexistence code since RTL8822B/C are
combo ICs, and the driver for BT can be found after Linux Kernel v4.20.
So it is better to add it first to make WiFi + BT work concurrently.

Although now rtw88 is simple but we are developing more features for it.
Even we want to add support for more chips such as RTL8821C/RTL8814B.

Finally, rtw88 has many authors, listed alphabetically:

Ping-Ke Shih <pkshih@realtek.com>
Tzu-En Huang <tehuang@realtek.com>
Yan-Hsuan Chuang <yhchuang@realtek.com>

Reviewed-by: Stanislaw Gruszka <sgruszka@redhat.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoMerge tag 'iwlwifi-next-for-kalle-2019-04-29' of git://git.kernel.org/pub/scm/linux...
Kalle Valo [Mon, 29 Apr 2019 17:50:44 +0000 (20:50 +0300)]
Merge tag 'iwlwifi-next-for-kalle-2019-04-29' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

Fourth batch of patches intended for v5.2

* Fix a bug we introduced in the RX path in a previous patch;
* Add command version parsing from the FW TLVs;
* Some fixes and improvements in the new debugging framework;
* Bump the FW API supported for 22000 series;
* Small improvement in FTM;
* Some RF-Kill interrupt handling fixes;
* Support for a new WoWLAN patterns FW API;
* Other small fixes and improvements;

5 years agoiwlwifi: dbg_ini: check for valid region type during regions parsing
Shahar S Matityahu [Sun, 7 Apr 2019 07:46:08 +0000 (10:46 +0300)]
iwlwifi: dbg_ini: check for valid region type during regions parsing

Add region type checking during regions parsing to avoid attempts to
parse unsupported or illegal region types.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: avoid allocating memory for region with disabled domain
Shahar S Matityahu [Mon, 8 Apr 2019 13:59:53 +0000 (16:59 +0300)]
iwlwifi: avoid allocating memory for region with disabled domain

In iwl_fw_ini_get_trigger_len the driver allocates space for memory
regions regardless of their domain and in iwl_fw_ini_dump_trigger the
driver aborts trigger collection of disabled domain. This diff causes
unneeded memory allocation and traling zeros in the dump file.

Solve this behavior by enforcing domain checking in
iwl_fw_ini_get_trigger_len

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: dbg: replace dump info device family with HW type
Shahar S Matityahu [Thu, 4 Apr 2019 11:31:30 +0000 (14:31 +0300)]
iwlwifi: dbg: replace dump info device family with HW type

In the dump info, the driver sets device_family to
IWL_FW_ERROR_DUMP_FAMILY_7 in case IWL_FW_ERROR_DUMP_FAMILY_7 is used or
IWL_FW_ERROR_DUMP_FAMILY_8 otherwise. This information is misleading and
incorrect since the driver sets the device family to 8 to any device that
is from family 8 and later, e.g. device family 9 is represented as 8 in
the dump.
Also, the device family enum is known only to the driver and
does not give any information to the FW developer

Change the device family to HW type to give propper data about the nic
in use.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: dbg_ini: add periodic trigger support
Shahar S Matityahu [Tue, 19 Mar 2019 14:40:15 +0000 (16:40 +0200)]
iwlwifi: dbg_ini: add periodic trigger support

Allows to configure a periodic data collection

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: dbg_ini: add lmac and umac error tables dumping support
Shahar S Matityahu [Sun, 7 Apr 2019 07:41:20 +0000 (10:41 +0300)]
iwlwifi: dbg_ini: add lmac and umac error tables dumping support

Add LMAC_ERROR_TABLE and UMAC_ERROR_TABLE region types and handle them
in the same way as we handle DEVICE_MEMORY.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: parse command version TLV
Johannes Berg [Mon, 1 Apr 2019 08:57:32 +0000 (10:57 +0200)]
iwlwifi: parse command version TLV

In newer firmware images there's a command version TLV that
states, for each listed command or notification, which version
of the command and/or notification structure is used. Read and
keep this data to be able to use it in the future.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: pcie: remove stray character in iwl_pcie_rx_alloc_page()
Luca Coelho [Wed, 10 Apr 2019 07:15:02 +0000 (10:15 +0300)]
iwlwifi: pcie: remove stray character in iwl_pcie_rx_alloc_page()

We have a solitary and inconspicous ` in the middle of a comment in
this function, which should not be there.  Remove it.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: Don't sleep in RX path
Andrei Otcheretianski [Wed, 10 Apr 2019 12:31:28 +0000 (15:31 +0300)]
iwlwifi: mvm: Don't sleep in RX path

Don't use cancel_delayed_work_sync() inside the channel switch
notifications as they are handled synchronously as part of the RX path.
Fix that by replacing it with cancel_delayed_work(). This should be safe
as we don't really care whether the work is already started and in such
case we would disconnect anyway.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: bump FW API to 48 for 22000 series
Luca Coelho [Thu, 10 Jan 2019 15:13:12 +0000 (17:13 +0200)]
iwlwifi: bump FW API to 48 for 22000 series

Start supporting API version 48 for 22000 series.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: limit TLC according to our HE capabilities
Liad Kaufman [Tue, 26 Mar 2019 16:11:19 +0000 (18:11 +0200)]
iwlwifi: mvm: limit TLC according to our HE capabilities

Instead of setting the TLC config command according to the
rates the peer supports, make sure that we aren't also
limited by our own rates, so take the minimum between the
peer's supported RX rates and our supported TX rates.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: support fseq tlv and print fseq version
Shahar S Matityahu [Wed, 20 Mar 2019 07:20:58 +0000 (09:20 +0200)]
iwlwifi: support fseq tlv and print fseq version

Support fseq tlv and print fseq version to dmesg.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: report FTM start time TSF when applicable
Avraham Stern [Tue, 12 Mar 2019 09:48:56 +0000 (11:48 +0200)]
iwlwifi: mvm: report FTM start time TSF when applicable

When the interface that is requesting an FTM measurement is connected
to a BSS, it is possible that the FTM request was originated by an
RRM request from the AP. In this case the station needs to report
the measurement start time in terms of the TSF of the AP.

Since there is no indication in the FTM request itself if the TSF
is needed, always report the TSF if the station is associated.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: support v2 of the WoWLAN patterns command
Luca Coelho [Tue, 12 Mar 2019 14:01:24 +0000 (16:01 +0200)]
iwlwifi: mvm: support v2 of the WoWLAN patterns command

Add new definitions for the WoWLAN patterns API version 2 and support
for version 2 of the WoWLAN patterns command without implementing the
new features.  With this commit we only supporting the existing
bitmask pattern match.  Use the new version only if the TLV is set.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>