Felix Fietkau [Tue, 21 Mar 2023 09:12:48 +0000 (10:12 +0100)]
wifi: mac80211: add support for letting drivers register tc offload support
On newer MediaTek SoCs (e.g. MT7986), WLAN->WLAN or WLAN->Ethernet flows can
be offloaded by the SoC. In order to support that, the .ndo_setup_tc op is
needed.
Avraham Stern [Mon, 20 Mar 2023 10:33:18 +0000 (12:33 +0200)]
wifi: iwlwifi: mvm: support enabling and disabling HW timestamping
Instead of enabling HW timestamping by default every time a station
is connected, disable it by default and enable it only upon request
for a specific station. HW timestamping can be enabled for only one
peer at a time.
As we have a new MLD STA cmd, there will be a different function to
add/remove a station in MLD mode. But both functions will share a
common part. Put this part in a separate function which will be used
later in adding/removing a sta in MLD mode.
Miri Korenblit [Mon, 20 Mar 2023 10:33:15 +0000 (12:33 +0200)]
wifi: iwlwifi: mvm: remove not needed initializations
In iwl_mvm_add_sta() we're initializing the new allocated mvm_sta.
We are setting some fields to zero even though it was allocated with
kzalloc, for the case of HW restart. But in such a case we will never
get to this initializations due to the goto statement that we have in
this case. Remove these initializations.
We have a new STA cmd as part of the new MLD API. There are some
parts of sending the STA cmd which are common to both the old and
the new one. Put this parts in functions which will later be used
to send the new STA cmd.
Miri Korenblit [Mon, 20 Mar 2023 10:33:13 +0000 (12:33 +0200)]
wifi: iwlwifi: mvm: refactor iwl_mvm_sta
As the new MLD API is introduced, we have a new enumeration
for the different station types. Since struct iwl_mvm_sta's
sta_type field will be in use for both new and old API,
change its type to a unified one, so it can hold both.
Miri Korenblit [Mon, 20 Mar 2023 10:33:12 +0000 (12:33 +0200)]
wifi: iwlwifi: mvm: refactor iwl_mvm_cfg_he_sta()
This function sends the STA_HE_CTXT_CMD, which won't be used in the
new MLD API. Instead, a part of the fields of this command
will be in the new STA cmd. Put the parts that are common to both
commands in functions, which will later be used in sending the new
STA cmd.
Miri Korenblit [Mon, 20 Mar 2023 10:33:11 +0000 (12:33 +0200)]
wifi: iwlwifi: mvm: Don't send MAC CTXT cmd after deauthorization
We used to send a MAC CTXT cmd to ask the FW to not pass MCAST frames
if we're associated but not authorized, because we don't have the
keys in that stage, and after authorization - we sent the cmd again
to ask the FW to pass MCAST, as we have the keys now.
The patch linked below was changing this strategy to always allow
MCAST frames, and if we're not authorized - the driver will drop them.
But we're still sending the MAC CTXT cmd after deaouthorization even
though we don't tell the FW to not pass MCAST frames anymore.
Basically we don't tell the FW anything new with this cmd.
Fix this by not sending MAC CTXT command after deauthorization.
For authorization we're sending the cmd to configure other changes too,
so keep it.
Avraham Stern [Mon, 20 Mar 2023 10:33:08 +0000 (12:33 +0200)]
wifi: iwlwifi: mvm: select ptp cross timestamp from multiple reads
iwl_mvm_get_sync_time() reads the gp2 from the device and then
reads the system clock. Since the two reads are not done atomically,
unexpected delays may happen between the two reads (e.g. context
switch) which make it inaccurate.
In order to improve the accuracy of the cross timestamp, call
iwl_mvm_get_sync_time() multiple times in a loop and take the
result in which the difference between the two clock is the smallest.
Implement the following PHC operations:
1. adjtime - for adding an offset to the PHC clock time.
2. adjfine - for adjusting the PHC clock frequency.
3. gettime64 - for getting the PHC clock time. This function returns
the time as adjusted by adjtime and adjfine.
The adjusted time will also be used for time sync frames timestamping.
Avraham Stern [Mon, 20 Mar 2023 10:33:04 +0000 (12:33 +0200)]
wifi: iwlwifi: mvm: report hardware timestamps in RX/TX status
For TM/FTM frames, report the hardware timestamps reported by the
fw as part of the RX/TX status. Since the fw reports the timestamps
in a dedicated notification (and not as part of the RX/TX status),
hold the frame until the fw timestamps notification is received.
Timestamping is enabled when a station is connected and disabled
when disconnected. For AP interface, only the first station will
have timestamping enabled since the fw only supports timestamping
for one peer.
Avraham Stern [Mon, 20 Mar 2023 10:33:03 +0000 (12:33 +0200)]
wifi: iwlwifi: mvm: read synced time from firmware if supported
If the firmware supports reading synced GP2/ATRB timestamps,
read the synced timestamps from firmware instead of reading the
GP2 register and the system time separately. Reading the synced
time from firmware should be more accurate.
wifi: iwlwifi: mvm: add support for PTP HW clock (PHC)
Add support to enable/disable PHC clock. The PHC clock includes support
for fetching the cross timestamp i.e. a non-atomic snapshot of the current
time from the hardware (WiFi device) clock and system clock (wall-clock)
simultaneously.
Bitterblue Smith [Mon, 13 Mar 2023 13:58:14 +0000 (15:58 +0200)]
wifi: rtl8xxxu: Support new chip RTL8710BU aka RTL8188GU
This chip is found in cheap "free driver" USB adapters from Aliexpress.
Initially they pretend to be a CD-ROM containing the driver for Windows.
"Ejecting" switches the device to wifi mode.
Features: 2.4 GHz, b/g/n mode, 1T1R, 150 Mbps.
This chip is more unique than other Realtek chips:
* The registers at addresses 0x0-0xff, which all the other chips use,
can't be used here. New registers at 0x8000-0x80ff must be used
instead. And it's not a simple matter of adding 0x8000: 0x2
(REG_SYS_FUNC) became 0x8004, 0x80 (REG_MCU_FW_DL) became 0x8090,
etc.
* Also there are a few new registers which must be accessed indirectly
because their addresses don't fit in 16 bits. No other chips seem to
have these.
* The vendor driver compiles to 8188gu.ko, but the code calls the chip
RTL8710B(U) pretty much everywhere, including messages visible to the
user.
Another difference compared to the other chips supported by rtl8xxxu is
that it has a new PHY status struct, or three of them actually, from
which we extract the RSSI, among other things. This is not unique,
though, just new. The chips supported by rtw88 also use it.
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com> Reviewed-by: Ping-Ke Shih <pkshih@realtek.com> Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150 Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/4edbe29f-00b9-8eef-9789-20bed0b141e2@gmail.com
The warning being disabled by this pragma is GCC specific. Guard its use
with CONFIG_CC_IS_GCC so that it is not used with clang to clear up the
error.
Johannes Berg [Wed, 15 Mar 2023 12:29:20 +0000 (13:29 +0100)]
wifi: iwlwifi: suppress printf warnings in tracing
This can't really be fixed due to the macro layout of
tracepoints (you'd need a special tracepoint macro for
when this is needed), so just suppress the warnings.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Johannes Berg [Tue, 14 Mar 2023 17:49:34 +0000 (19:49 +0200)]
wifi: iwlwifi: fw: pnvm: fix uefi reduced TX power loading
There are a number of issues here:
* if trans->reduce_power_loaded is already true, we call
iwl_trans_set_reduce_power() with an uninitialized len
value
* in this case we also clobber a previous load/setting
* if iwl_uefi_get_reduced_power() returns an ERR_PTR() we
try to kfree() it
Move the iwl_trans_set_reduce_power() call into the success
case only to fix these issues.
Johannes Berg [Tue, 14 Mar 2023 17:49:32 +0000 (19:49 +0200)]
wifi: iwlwifi: mvm: rs: print BAD_RATE for invalid HT/VHT index
If there's a rate->index that maps inside the range but
to an uninitialized value, then that's also a bad rate,
avoid printing "(nil)" in that case and rather print the
"BAD_RATE" string instead as in the else branch.
Tom Rix [Tue, 14 Mar 2023 17:49:27 +0000 (19:49 +0200)]
wifi: iwlwifi: mvm: remove setting of 'sta' parameter
cppcheck reports
[drivers/net/wireless/intel/iwlwifi/mvm/rs.c:2686]: (warning) Assignment of function parameter has no effect outside the function. Did you forget dereferencing it?
The setting of the 'sta' parameter is not needed. In the if-check that sets it
to NULL, mvm_sta is also set to NULL. Then the next statement checks if
mvm_sta is NULL and does an early return. So remove setting sta.
Since parts of the functionality of this function is going to be used
also by the MLD version of it, put in a separate function the parts
that are common for both MLD and non-MLD modes.
The common function will later be used in the MLD ops.
Since parts of the functionality of this function is going to be used
also by the MLD version of it, put in a separate function the parts
that are common for both MLD and non-MLD modes.
The common function will later be used in the MLD ops.
Miri Korenblit [Tue, 14 Mar 2023 17:49:22 +0000 (19:49 +0200)]
wifi: iwlwifi: mvm: Add a remove_interface() callback for mld mode
As the MLD mode and its new APIs are introduced,
we've decided to add a new ieee80211_ops dedicated for
MLD callbacks. Add the MLD remove_interface() callback
which uses the new MLD APIs.
Miri Korenblit [Tue, 14 Mar 2023 17:49:21 +0000 (19:49 +0200)]
wifi: iwlwifi: mvm: Add an add_interface() callback for mld mode
As the MLD mode and its new APIs are introduced,
we've decided to add a new ieee80211_ops dedicated for
MLD callbacks. Add the MLD add_interface() callback
which uses the new MLD APIs added the previous patches.
Miri Korenblit [Tue, 14 Mar 2023 17:49:20 +0000 (19:49 +0200)]
wifi: iwlwifi: mvm: add support for the new STA related commands
As a part of the new MLD FW API changes, we have new commands for STA
related operations (add/remove/aux/disable tx).
Add structures and enum definitions, along with part of the functions
that sends this commands.
This functions will be in used and more will be added in the next patches.
Miri Korenblit [Tue, 14 Mar 2023 17:49:19 +0000 (19:49 +0200)]
wifi: iwlwifi: mvm: add support for the new LINK command
As a part of the new MLD FW API changes, we have a new LINK command
to add/remove/configure a link.
Add structures and enum definitions, along with the functions that
sends this command (i.e. add, remove and change mac ctxt).
These functions will be in used in the next patches.
Miri Korenblit [Tue, 14 Mar 2023 17:49:18 +0000 (19:49 +0200)]
wifi: iwlwifi: mvm: add support for the new MAC CTXT command
As a part of the new MLD FW API changes, we have a new MAC CTXT command.
Add structures and enum definitions, along with the functions that
sends this command (i.e. add, remove and change mac ctxt).
This functions will be in used in the next patches.
1. As the new MLD API is introduced, there are some common fields in
both the old and new APIs. The MAC_CONTEXT_CMD of the non-MLD API
has common fields with the link and mac commands of the new MLD API.
Put this common parts in functions so it can be used later by the
new MLD API.
2. Use iwl_mvm_mac_ctxt_send_cmd when removing a mac instead of
implementing the same functionality once again.
3. Change the debug print when sending the command to be more specific,
so it will be easy to distinguish later if the old or new mac command
was sent.
1. As the new MLD API is introduced, there are some common fields in
both the old and new APIs. The STA_HE_CTXT_CMD of the non-MLD API
has common fields with the link and mac commands of the new MLD API.
Put this common parts in functions so it can be used later by the
new MLD API.
2. The HE capability which indicates whether the NIC is ack-enabled or
not is the same for all bands. No need to take it from the specific
band which is currently in use. Take it from the low band - this
simplifies the code and doesn't require a phy_ctxt.
Johannes Berg [Tue, 14 Mar 2023 17:49:13 +0000 (19:49 +0200)]
wifi: iwlwifi: mvm: avoid sta lookup in queue alloc
In FW restart scenarios, we allocate the queues from the
iwl_mvm_realloc_queues_after_restart() function, but that
is called before we insert the station ID into our map
(mvm->fw_id_to_mac_id).
However, in all cases where we're actually allocating a
queue for a "real" (not bcast, aux, ...) station we have
the sta pointer already, so just pass it along to use it
instead of looking it up.
This fixes an issue where after restart we only allocated
a queue of size 16 (due to the ordering issue described
above), and thus never got good throughput again since no
aggregates could be formed on transmit.
Lukas Bulwahn [Tue, 14 Mar 2023 04:18:48 +0000 (05:18 +0100)]
MAINTAINERS: adjust file entries after wifi driver movement
Commit f79cbc77abde ("wifi: move mac80211_hwsim and virt_wifi to virtual
directory") and commit 298e50ad8eb8 ("wifi: move raycs, wl3501 and
rndis_wlan to legacy directory") move remaining wireless drivers into
subdirectories, but does not adjust the entries in MAINTAINERS.
Hence, ./scripts/get_maintainer.pl --self-test=patterns complains about
broken references.
Repair these file references in those wireless driver sections.
Jisoo Jang [Thu, 9 Mar 2023 10:44:57 +0000 (19:44 +0900)]
wifi: brcmfmac: slab-out-of-bounds read in brcmf_get_assoc_ies()
Fix a slab-out-of-bounds read that occurs in kmemdup() called from
brcmf_get_assoc_ies().
The bug could occur when assoc_info->req_len, data from a URB provided
by a USB device, is bigger than the size of buffer which is defined as
WL_EXTRA_BUF_MAX.
Add the size check for req_len/resp_len of assoc_info.
Found by a modified version of syzkaller.
[ 46.592467][ T7] ==================================================================
[ 46.594687][ T7] BUG: KASAN: slab-out-of-bounds in kmemdup+0x3e/0x50
[ 46.596572][ T7] Read of size 3014656 at addr ffff888019442000 by task kworker/0:1/7
[ 46.598575][ T7]
[ 46.599157][ T7] CPU: 0 PID: 7 Comm: kworker/0:1 Tainted: G O 5.14.0+ #145
[ 46.601333][ T7] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org 04/01/2014
[ 46.604360][ T7] Workqueue: events brcmf_fweh_event_worker
[ 46.605943][ T7] Call Trace:
[ 46.606584][ T7] dump_stack_lvl+0x8e/0xd1
[ 46.607446][ T7] print_address_description.constprop.0.cold+0x93/0x334
[ 46.608610][ T7] ? kmemdup+0x3e/0x50
[ 46.609341][ T7] kasan_report.cold+0x79/0xd5
[ 46.610151][ T7] ? kmemdup+0x3e/0x50
[ 46.610796][ T7] kasan_check_range+0x14e/0x1b0
[ 46.611691][ T7] memcpy+0x20/0x60
[ 46.612323][ T7] kmemdup+0x3e/0x50
[ 46.612987][ T7] brcmf_get_assoc_ies+0x967/0xf60
[ 46.613904][ T7] ? brcmf_notify_vif_event+0x3d0/0x3d0
[ 46.614831][ T7] ? lock_chain_count+0x20/0x20
[ 46.615683][ T7] ? mark_lock.part.0+0xfc/0x2770
[ 46.616552][ T7] ? lock_chain_count+0x20/0x20
[ 46.617409][ T7] ? mark_lock.part.0+0xfc/0x2770
[ 46.618244][ T7] ? lock_chain_count+0x20/0x20
[ 46.619024][ T7] brcmf_bss_connect_done.constprop.0+0x241/0x2e0
[ 46.620019][ T7] ? brcmf_parse_configure_security.isra.0+0x2a0/0x2a0
[ 46.620818][ T7] ? __lock_acquire+0x181f/0x5790
[ 46.621462][ T7] brcmf_notify_connect_status+0x448/0x1950
[ 46.622134][ T7] ? rcu_read_lock_bh_held+0xb0/0xb0
[ 46.622736][ T7] ? brcmf_cfg80211_join_ibss+0x7b0/0x7b0
[ 46.623390][ T7] ? find_held_lock+0x2d/0x110
[ 46.623962][ T7] ? brcmf_fweh_event_worker+0x19f/0xc60
[ 46.624603][ T7] ? mark_held_locks+0x9f/0xe0
[ 46.625145][ T7] ? lockdep_hardirqs_on_prepare+0x3e0/0x3e0
[ 46.625871][ T7] ? brcmf_cfg80211_join_ibss+0x7b0/0x7b0
[ 46.626545][ T7] brcmf_fweh_call_event_handler.isra.0+0x90/0x100
[ 46.627338][ T7] brcmf_fweh_event_worker+0x557/0xc60
[ 46.627962][ T7] ? brcmf_fweh_call_event_handler.isra.0+0x100/0x100
[ 46.628736][ T7] ? rcu_read_lock_sched_held+0xa1/0xd0
[ 46.629396][ T7] ? rcu_read_lock_bh_held+0xb0/0xb0
[ 46.629970][ T7] ? lockdep_hardirqs_on_prepare+0x273/0x3e0
[ 46.630649][ T7] process_one_work+0x92b/0x1460
[ 46.631205][ T7] ? pwq_dec_nr_in_flight+0x330/0x330
[ 46.631821][ T7] ? rwlock_bug.part.0+0x90/0x90
[ 46.632347][ T7] worker_thread+0x95/0xe00
[ 46.632832][ T7] ? __kthread_parkme+0x115/0x1e0
[ 46.633393][ T7] ? process_one_work+0x1460/0x1460
[ 46.633957][ T7] kthread+0x3a1/0x480
[ 46.634369][ T7] ? set_kthread_struct+0x120/0x120
[ 46.634933][ T7] ret_from_fork+0x1f/0x30
[ 46.635431][ T7]
[ 46.635687][ T7] Allocated by task 7:
[ 46.636151][ T7] kasan_save_stack+0x1b/0x40
[ 46.636628][ T7] __kasan_kmalloc+0x7c/0x90
[ 46.637108][ T7] kmem_cache_alloc_trace+0x19e/0x330
[ 46.637696][ T7] brcmf_cfg80211_attach+0x4a0/0x4040
[ 46.638275][ T7] brcmf_attach+0x389/0xd40
[ 46.638739][ T7] brcmf_usb_probe+0x12de/0x1690
[ 46.639279][ T7] usb_probe_interface+0x2aa/0x760
[ 46.639820][ T7] really_probe+0x205/0xb70
[ 46.640342][ T7] __driver_probe_device+0x311/0x4b0
[ 46.640876][ T7] driver_probe_device+0x4e/0x150
[ 46.641445][ T7] __device_attach_driver+0x1cc/0x2a0
[ 46.642000][ T7] bus_for_each_drv+0x156/0x1d0
[ 46.642543][ T7] __device_attach+0x23f/0x3a0
[ 46.643065][ T7] bus_probe_device+0x1da/0x290
[ 46.643644][ T7] device_add+0xb7b/0x1eb0
[ 46.644130][ T7] usb_set_configuration+0xf59/0x16f0
[ 46.644720][ T7] usb_generic_driver_probe+0x82/0xa0
[ 46.645295][ T7] usb_probe_device+0xbb/0x250
[ 46.645786][ T7] really_probe+0x205/0xb70
[ 46.646258][ T7] __driver_probe_device+0x311/0x4b0
[ 46.646804][ T7] driver_probe_device+0x4e/0x150
[ 46.647387][ T7] __device_attach_driver+0x1cc/0x2a0
[ 46.647926][ T7] bus_for_each_drv+0x156/0x1d0
[ 46.648454][ T7] __device_attach+0x23f/0x3a0
[ 46.648939][ T7] bus_probe_device+0x1da/0x290
[ 46.649478][ T7] device_add+0xb7b/0x1eb0
[ 46.649936][ T7] usb_new_device.cold+0x49c/0x1029
[ 46.650526][ T7] hub_event+0x1c98/0x3950
[ 46.650975][ T7] process_one_work+0x92b/0x1460
[ 46.651535][ T7] worker_thread+0x95/0xe00
[ 46.651991][ T7] kthread+0x3a1/0x480
[ 46.652413][ T7] ret_from_fork+0x1f/0x30
[ 46.652885][ T7]
[ 46.653131][ T7] The buggy address belongs to the object at ffff888019442000
[ 46.653131][ T7] which belongs to the cache kmalloc-2k of size 2048
[ 46.654669][ T7] The buggy address is located 0 bytes inside of
[ 46.654669][ T7] 2048-byte region [ffff888019442000, ffff888019442800)
[ 46.656137][ T7] The buggy address belongs to the page:
[ 46.656720][ T7] page:ffffea0000651000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x19440
[ 46.657792][ T7] head:ffffea0000651000 order:3 compound_mapcount:0 compound_pincount:0
[ 46.658673][ T7] flags: 0x100000000010200(slab|head|node=0|zone=1)
[ 46.659422][ T7] raw: 01000000000102000000000000000000dead000000000122ffff888100042000
[ 46.660363][ T7] raw: 0000000000000000000000000008000800000001ffffffff0000000000000000
[ 46.661236][ T7] page dumped because: kasan: bad access detected
[ 46.661956][ T7] page_owner tracks the page as allocated
[ 46.662588][ T7] page last allocated via order 3, migratetype Unmovable, gfp_mask 0x52a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 7, ts 31136961085, free_ts 0
[ 46.664271][ T7] prep_new_page+0x1aa/0x240
[ 46.664763][ T7] get_page_from_freelist+0x159a/0x27c0
[ 46.665340][ T7] __alloc_pages+0x2da/0x6a0
[ 46.665847][ T7] alloc_pages+0xec/0x1e0
[ 46.666308][ T7] allocate_slab+0x380/0x4e0
[ 46.666770][ T7] ___slab_alloc+0x5bc/0x940
[ 46.667264][ T7] __slab_alloc+0x6d/0x80
[ 46.667712][ T7] kmem_cache_alloc_trace+0x30a/0x330
[ 46.668299][ T7] brcmf_usbdev_qinit.constprop.0+0x50/0x470
[ 46.668885][ T7] brcmf_usb_probe+0xc97/0x1690
[ 46.669438][ T7] usb_probe_interface+0x2aa/0x760
[ 46.669988][ T7] really_probe+0x205/0xb70
[ 46.670487][ T7] __driver_probe_device+0x311/0x4b0
[ 46.671031][ T7] driver_probe_device+0x4e/0x150
[ 46.671604][ T7] __device_attach_driver+0x1cc/0x2a0
[ 46.672192][ T7] bus_for_each_drv+0x156/0x1d0
[ 46.672739][ T7] page_owner free stack trace missing
[ 46.673335][ T7]
[ 46.673620][ T7] Memory state around the buggy address:
[ 46.674213][ T7] ffff888019442700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 46.675083][ T7] ffff888019442780: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 46.675994][ T7] >ffff888019442800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[ 46.676875][ T7] ^
[ 46.677323][ T7] ffff888019442880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[ 46.678190][ T7] ffff888019442900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[ 46.679052][ T7] ==================================================================
[ 46.679945][ T7] Disabling lock debugging due to kernel taint
[ 46.680725][ T7] Kernel panic - not syncing:
Ching-Te Ku [Wed, 8 Mar 2023 05:32:25 +0000 (13:32 +0800)]
wifi: rtw89: coex: Add v5 firmware cycle status report
To support v5 version firmware cycle report, apply the related structure
and functions. v5 cycle report add a group of status to show how the
free-run/TDMA training goes to. It is a firmware mechanism that can auto
adjust coexistence mode between TDMA and free run mechanism at 3 antenna
solution. v5 version provide more reference data to let the mechanism
make decision.
Ching-Te Ku [Wed, 8 Mar 2023 05:32:24 +0000 (13:32 +0800)]
wifi: rtw89: coex: Add v2 Bluetooth scan info
Compare to v1 and v2 removed some not usable parameters. Save firmware
code size. The information can show how frequent and how long the
Bluetooth scan do. It will help to debug coexistence issue.
Ching-Te Ku [Wed, 8 Mar 2023 05:32:21 +0000 (13:32 +0800)]
wifi: rtw89: coex: Add traffic TX/RX info and its H2C
There is a new mechanism which can do some real time performance
tuning for WiFi and BT. This TX/RX info is a condition provide to
firmware to do traffic analysis.
Ching-Te Ku [Wed, 8 Mar 2023 05:32:19 +0000 (13:32 +0800)]
wifi: rtw89: coex: Add more error_map and counter to log
The error map and counter can help to analyze is coexistence mechanism
going well or not. For example, if there is E2G (External control Wi-Fi
slot for Wi-Fi 2.4 GHz) hang counter, it means Wi-Fi firmware didn't cut
a slot for Wi-Fi 2.4 GHz. Maybe something wrong with firmware timer.
Jacob Keller [Tue, 7 Mar 2023 23:02:12 +0000 (15:02 -0800)]
wifi: qtnfmac: use struct_size and size_sub for payload length
Replace the calculations for the payload length in
qtnf_cmd_band_fill_iftype with struct_size() and size_sub(). While
the payload length does not get directly passed to an allocation function,
the performed calculation is still calculating the size of a flexible array
structure (minus the size of a header structure).
Jacob Keller [Tue, 7 Mar 2023 23:01:48 +0000 (15:01 -0800)]
wifi: ipw2x00: convert ipw_fw_error->elem to flexible array[]
The ipw_fw_error structure contains a payload[] flexible array as well as
two pointers to this array area, ->elem, and ->log. The total size of the
allocated structure is computed without use of the <linux/overflow.h>
macros.
There's no reason to keep both a payload[] and an extra pointer to both the
elem and log members. Convert the elem pointer member into the flexible
array member, removing payload.
Fix the allocation of the ipw_fw_error structure to use size_add(),
struct_size(), and array_size() to compute the allocation. This ensures
that any overflow saturates at SIZE_MAX rather than overflowing and
potentially allowing an undersized allocation.
Before the structure change, the layout of ipw_fw_error was:
Martin Kaiser [Tue, 7 Mar 2023 19:57:17 +0000 (20:57 +0100)]
wifi: rtl8xxxu: use module_usb_driver
We can use the module_usb_driver macro instead of open-coding the driver's
init and exit functions. This is simpler and saves some lines of code.
Other realtek wireless drivers use module_usb_driver as well.
Signed-off-by: Martin Kaiser <martin@kaiser.cx> Reviewed-by: Ping-Ke Shih <pkshih@realtek.com> Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150 Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20230307195718.168021-1-martin@kaiser.cx
Ping-Ke Shih [Tue, 7 Mar 2023 14:18:48 +0000 (22:18 +0800)]
wifi: rtw89: release RX standby timer of beamformee CSI to save power
Originally, we keep RX standby timer to handle beamformee CSI, but this
spends power and causes system not entering power save mode. To improve
power consumption, release the timer if throughput becomes low.
Martin Kaiser [Sun, 5 Mar 2023 17:59:32 +0000 (18:59 +0100)]
wifi: rtl8xxxu: mark Edimax EW-7811Un V2 as tested
The Edimax V2 (vid 0x7392, pid 0xb811) works well with the rtl8xxxu driver
since rtl8188eu support has been added. Remove the untested flag for this
device.
Hans de Goede [Fri, 3 Mar 2023 22:23:31 +0000 (23:23 +0100)]
wifi: brcmfmac: Use ISO3166 country code and rev 0 as fallback on 4356
Many devices ship with a nvram ccode value of X2/XT/XU/XV/ALL which are
all special world-wide compatibility ccode-s. Most of these world-wide
ccode-s allow passive scan mode only for 2.4GHz channels 12-14,
only enabling them when an AP is seen on them.
Since linux-firmware has moved to the new cyfmac4356-pci.bin +
cyfmac4356-pci.clm_blob firmware files this no longer works and
4356 devices using e.g. an X2 ccode fail to connect to an AP on
channel 13.
Add the 4356 chip-id to the list of chips for which to use the ISO3166
country code + rev 0 as fallback in brcmf_translate_country_code() to
fix this.
Kalle Valo [Mon, 27 Feb 2023 12:17:32 +0000 (14:17 +0200)]
wifi: move raycs, wl3501 and rndis_wlan to legacy directory
To clean up drivers/net/wireless move the old drivers drivers left in the
directory to a new "legacy" directory. I did consider adding
CONFIG_WLAN_VENDOR_LEGACY like other vendors have but then dropped the idea as
these are really old drivers and hopefully we get to remove them soon.
There should be no changes in compilation or in Kconfig options, merely moving files.
Kalle Valo [Mon, 27 Feb 2023 12:17:31 +0000 (14:17 +0200)]
wifi: move mac80211_hwsim and virt_wifi to virtual directory
To clean up drivers/net/wireless move the virtual drivers to a new virtual
directory. I did consider adding CONFIG_WLAN_VENDOR_VIRTUAL like other vendors
have but then dropped the idea as we are not real drivers.
There should be no changes in compilation or in Kconfig options, merely moving
files. The order in menuconfig is slightly changed, the virtual drivers are now
last in the list.
wifi: ath11k: add support to parse new WMI event for 6 GHz
In order to support different power levels of 6 GHz AP and client,
new WMI event for regulatory - WMI_REG_CHAN_LIST_CC_EXT_EVENTID is
added in firmware. This event provides new parameters required for
6 GHz regulatory rules.
Add support for parsing 2.4 GHz, 5 GHz and 6 GHz reg rules and other
parameters from WMI_REG_CHAN_LIST_CC_EXT_EVENTID.
make versioncheck reports the following:
./drivers/net/ethernet/qlogic/qede/qede.h: 10 linux/version.h not needed.
./drivers/net/ethernet/qlogic/qede/qede_ethtool.c: 7 linux/version.h not needed.
So remove linux/version.h from both of these files. Also remove
linux/compiler.h while at it as it is also not being used.
====================
Update CPSW bindings for Serdes PHY
This series adds documentation for the Serdes PHY. Also, the name used to
refer to the Serdes PHY in the am65-cpsw driver is updated to match the
documented name.
Documenting the Serdes PHY bindings was missed out in the already merged
series at:
https://lore.kernel.org/r/20230104103432.1126403-1-s-vadapalli@ti.com/
This miss was pointed out at:
https://lore.kernel.org/r/CAMuHMdW5atq-FuLEL3htuE3t2uO86anLL3zeY7n1RqqMP_rH1g@mail.gmail.com/
net: ethernet: ti: am65-cpsw: Update name of Serdes PHY
The bindings for the am65-cpsw driver use the name "serdes" to refer to
the Serdes PHY. Thus, update the name used for the Serdes PHY within the
am65_cpsw_init_serdes_phy() function from "serdes-phy" to "serdes".
Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Update bindings to include Serdes PHY as an optional PHY, in addition to
the existing CPSW MAC's PHY. The CPSW MAC's PHY is required while the
Serdes PHY is optional. The Serdes PHY handle has to be provided only
when the Serdes is being configured in a Single-Link protocol. Using the
name "serdes-phy" to represent the Serdes PHY handle, the am65-cpsw-nuss
driver can obtain the Serdes PHY and request the Serdes to be
configured.
Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Vadim Fedorenko [Thu, 9 Mar 2023 10:54:21 +0000 (02:54 -0800)]
ptp_ocp: add force_irq to xilinx_spi configuration
Flashing firmware via devlink flash was failing on PTP OCP devices
because it is using Quad SPI mode, but the driver was not properly
behaving. With force_irq flag landed it now can be fixed.
Jakub Kicinski [Sat, 11 Mar 2023 02:22:28 +0000 (18:22 -0800)]
Merge tag 'wireless-next-2023-03-10' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next
Johannes Berg says:
====================
wireless-next patches for 6.4
Major changes:
cfg80211
* 6 GHz improvements
* HW timestamping support
* support for randomized auth/deauth TA for PASN privacy
(also for mac80211)
mac80211
* radiotap TLV and EHT support for the iwlwifi sniffer
* HW timestamping support
* per-link debugfs for multi-link
brcmfmac
* support for Apple (M1 Pro/Max) devices
iwlwifi
* support for a few new devices
* EHT sniffer support
rtw88
* better support for some SDIO devices
(e.g. MAC address from efuse)
rtw89
* HW scan support for 8852b
* better support for 6 GHz scanning
* tag 'wireless-next-2023-03-10' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next: (84 commits)
wifi: iwlwifi: mvm: fix EOF bit reporting
wifi: iwlwifi: Do not include radiotap EHT user info if not needed
wifi: iwlwifi: mvm: add EHT RU allocation to radiotap
wifi: iwlwifi: Update logs for yoyo reset sw changes
wifi: iwlwifi: mvm: clean up duplicated defines
wifi: iwlwifi: rs-fw: break out for unsupported bandwidth
wifi: iwlwifi: Add support for B step of BnJ-Fm4
wifi: iwlwifi: mvm: make flush code a bit clearer
wifi: iwlwifi: mvm: avoid UB shift of snif_queue
wifi: iwlwifi: mvm: add primary 80 known for EHT radiotap
wifi: iwlwifi: mvm: parse FW frame metadata for EHT sniffer mode
wifi: iwlwifi: mvm: decode USIG_B1_B7 RU to nl80211 RU width
wifi: iwlwifi: mvm: rename define to generic name
wifi: iwlwifi: mvm: allow Microsoft to use TAS
wifi: iwlwifi: mvm: add all EHT based on data0 info from HW
wifi: iwlwifi: mvm: add EHT radiotap info based on rate_n_flags
wifi: iwlwifi: mvm: add an helper function radiotap TLVs
wifi: radiotap: separate vendor TLV into header/content
wifi: iwlwifi: reduce verbosity of some logging events
wifi: iwlwifi: Adding the code to get RF name for MsP device
...
====================
This series reworks the SFP A2 (diagnostics and control) access so we
don't end up testing a variable number of conditions in several places.
This also resolves a minor issue where we may have a module indicating
that it is not SFF8472 compliant, doesn't implement A2, but fails to
set the enhanced option byte to zero, leading to accesses to the A2
page that fail.
The first patch adds a new flag "have_a2" which indicates whether we
should be accessing the A2 page, and uses this for hwmon. The
conditions are kept the same.
The second patch extends the check for soft-state polling and control
by using this "have_a2" flag (which effectively augments the check to
include some level of SFF8472 compliance.)
====================
net: sfp: only use soft polling if we have A2h access
The soft state bits are stored in the A2h memory space, and require
SFF-8472 compliance. This is what our have_a2 flag tells us, so use
this to indicate whether we should attempt to use the soft signals.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
The hwmon code wants to know when it is safe to access the A2h data
stored in a separate address. We indicate that this is present when
we have SFF-8472 compliance and the lack of an address-change
sequence.,
The same conditions are also true if we want to access other controls
and status in the A2h address. So let's make a flag to indicate whether
we can access it, instead of repeating the conditions throughout the
code.
For now, only convert the hwmon code.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
====================
Couple of minor improvements to build_skb variants
First patch replaces open-coded occurrences of
skb_propagate_pfmemalloc() in build_skb() and build_skb_around().
The secnod patch adds a likely() to the skb allocation in build_skb().
====================
Gal Pressman [Wed, 8 Mar 2023 13:17:20 +0000 (15:17 +0200)]
skbuff: Add likely to skb pointer in build_skb()
Similarly to napi_build_skb(), it is likely the skb allocation in
build_skb() succeeded. frag_size != 0 is also likely, as stated in
__build_skb_around().
Reviewed-by: Tariq Toukan <tariqt@nvidia.com> Signed-off-by: Gal Pressman <gal@nvidia.com> Reviewed-by: Larysa Zaremba <larysa.zaremba@intel.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Jens Axboe [Wed, 8 Mar 2023 04:18:21 +0000 (21:18 -0700)]
tap: add support for IOCB_NOWAIT
The tap driver already supports passing in nonblocking state based
on O_NONBLOCK, add support for checking IOCB_NOWAIT as well. With that
done, we can flag it with FMODE_NOWAIT as well.
Jens Axboe [Wed, 8 Mar 2023 03:45:56 +0000 (20:45 -0700)]
tun: flag the device as supporting FMODE_NOWAIT
tun already checks for both O_NONBLOCK and IOCB_NOWAIT in its read
and write iter handlers, so it's fully ready for FMODE_NOWAIT. But
for some reason it doesn't set it. Rectify that oversight.
====================
net: lan966x: Add support for IS1 VCAP
Provide the Ingress Stage 1 (IS1) VCAP (Versatile Content-Aware
Processor) support for the Lan966x platform.
The IS1 VCAP has 3 lookups and they are accessible with a TC chain id:
- chain 1000000: IS1 Lookup 0
- chain 1100000: IS1 Lookup 1
- chain 1200000: IS1 Lookup 2
The IS1 is capable of different actions like rewrite VLAN tags, change
priority of the frames, police the traffic, etc. These features will be
added at a later point.
The IS1 currently implements the action that allows setting the value
of a PAG (Policy Association Group) key field in the frame metadata and
this can be used for matching in an IS2 VCAP rule. In this way a rule in
IS0 VCAP can be linked to rules in the IS2 VCAP. The linking is exposed
by using the TC "goto chain" action with an offset from the IS2 chain ids.
For example "goto chain 8000001" will use a PAG value of 1 to chain to a
rule in IS2 lookup 0.
====================
Horatiu Vultur [Tue, 7 Mar 2023 22:09:29 +0000 (23:09 +0100)]
net: lan966x: Add support for IS1 VCAP ethernet protocol types
IS1 VCAP has it's own list of supported ethernet protocol types which is
different than the IS2 VCAP. Therefore separate the list of known
protocol types based on the VCAP type.
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Miquel Raynal [Tue, 7 Mar 2023 19:29:27 +0000 (20:29 +0100)]
net: mvpp2: Defer probe if MAC address source is not yet ready
NVMEM layouts are no longer registered early, and thus may not yet be
available when Ethernet drivers (or any other consumer) probe, leading
to possible probe deferrals errors. Forward the error code if this
happens. All other errors being discarded, the driver will eventually
use a random MAC address if no other source was considered valid (no
functional change on this regard).
Bjorn Helgaas [Tue, 7 Mar 2023 22:10:51 +0000 (16:10 -0600)]
net: restore alpha order to Ethernet devices in config
The filename "wangxun" sorts between "intel" and "xscale", but
xscale/Kconfig contains "Intel XScale" prompts, so Wangxun ends up in the
wrong place in the config front-ends.
Move wangxun/Kconfig so the Wangxun devices appear in order in the user
interface.
Jakub Kicinski [Fri, 10 Mar 2023 07:35:49 +0000 (23:35 -0800)]
Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue
Tony Nguyen says:
====================
Intel Wired LAN Driver Updates 2023-03-07 (igc)
This series contains updates to igc driver only.
Muhammad adds tracking and reporting of QBV config errors.
Tan Tee adds support for configuring max SDU for each Tx queue.
Sasha removes check for alternate media as only one media type is
supported.
* '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue:
igc: Clean up and optimize watchdog task
igc: offload queue max SDU from tc-taprio
igc: Add qbv_config_change_errors counter
====================
Jason Xing [Wed, 8 Mar 2023 02:11:53 +0000 (10:11 +0800)]
udp: introduce __sk_mem_schedule() usage
Keep the accounting schema consistent across different protocols
with __sk_mem_schedule(). Besides, it adjusts a little bit on how
to calculate forward allocated memory compared to before. After
applied this patch, we could avoid receive path scheduling extra
amount of memory.
Jakub Kicinski [Fri, 10 Mar 2023 07:28:53 +0000 (23:28 -0800)]
Merge branch 'main' of git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next
Florian Westphal says:
====================
Netfilter updates for net-next
1. nf_tables 'brouting' support, from Sriram Yagnaraman.
2. Update bridge netfilter and ovs conntrack helpers to handle
IPv6 Jumbo packets properly, i.e. fetch the packet length
from hop-by-hop extension header, from Xin Long.
This comes with a test BIG TCP test case, added to
tools/testing/selftests/net/.
3. Fix spelling and indentation in conntrack, from Jeremy Sowden.
* 'main' of git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next:
netfilter: nat: fix indentation of function arguments
netfilter: conntrack: fix typo
selftests: add a selftest for big tcp
netfilter: use nf_ip6_check_hbh_len in nf_ct_skb_network_trim
netfilter: move br_nf_check_hbh_len to utils
netfilter: bridge: move pskb_trim_rcsum out of br_nf_check_hbh_len
netfilter: bridge: check len before accessing more nh data
netfilter: bridge: call pskb_may_pull in br_nf_check_hbh_len
netfilter: bridge: introduce broute meta statement
====================
Nick Alcock [Wed, 8 Mar 2023 12:12:29 +0000 (12:12 +0000)]
lib: packing: remove MODULE_LICENSE in non-modules
Since commit 8b41fc4454e ("kbuild: create modules.builtin without
Makefile.modbuiltin or tristate.conf"), MODULE_LICENSE declarations
are used to identify modules. As a consequence, uses of the macro
in non-modules will cause modprobe to misidentify their containing
object file as a module when it is not (false positives), and modprobe
might succeed rather than failing with a suitable error message.
So remove it in the files in this commit, none of which can be built as
modules.
Signed-off-by: Nick Alcock <nick.alcock@oracle.com> Suggested-by: Luis Chamberlain <mcgrof@kernel.org> Cc: Hitomi Hasegawa <hasegawa-hitomi@fujitsu.com> Cc: Vladimir Oltean <olteanv@gmail.com> Link: https://lore.kernel.org/r/20230308121230.5354-1-nick.alcock@oracle.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>