wifi: rtw89: 8852c: add beacon filter and CQM support
Adding this supports beacon filter and connection quality monitor.
To make host CPU wake up less, let firmware perform signal
monitoring and beacon processing, then notify driver upon signal
changes or beacon loss.
This feature needs firmware 0.27.56 or newer to support it.
Johannes Berg [Fri, 14 Apr 2023 10:12:06 +0000 (13:12 +0300)]
wifi: iwlwifi: mvm: tx: remove misleading if statement
The if statement here is misleading, we return zero anyway
since we just checked the 'ret' variable, simplify the code
to remove the condition entirely.
Ilan Peer [Fri, 14 Apr 2023 10:12:05 +0000 (13:12 +0300)]
wifi: iwlwifi: mvm: Fix setting the rate for non station cases
The setting of the rate used for non station cases did not take into
consideration the interface type etc., thus when probe responses
are transmitted on P2P Device interface etc. CCK rates were used
which is not allowed.
Modify the code so the non station case would consider the
interface type etc. For HWs/FWs that do not support rate control,
preserve the previous behavior, i.e., take the rate from the
skb metadata and adjust as needed.
Johannes Berg [Fri, 14 Apr 2023 10:12:00 +0000 (13:12 +0300)]
wifi: iwlwifi: mvm: track AP STA pointer and use it for MFP
Instead of relying on the AP STA ID and dereferencing our
firmware -> mac80211 STA array when we really only need
the STA, not the per-link information (and might not have
it, e.g. for a pairwise key installation where this is
relevant), keep track of the AP STA as a pointer to the
mac80211 STA, protected by the mutex. Then use it here in
the key code instead.
If the user passes a SIZE_MAX value to the "ssize_t count" parameter,
the ssize_t count parameter is assigned to "int buf_size_left".
Then compare "*size" with "buf_size_left" . Here, "buf_size_left" is a
negative number, so "*size" is assigned "buf_size_left" and goes into
the third argument of the copy_to_user function, causing a heap overflow.
This is not a security vulnerability because iwl_dbgfs_monitor_data_read()
is a debugfs operation with 0400 privileges.
Tom Rix [Fri, 14 Apr 2023 10:11:58 +0000 (13:11 +0300)]
wifi: iwlwifi: fw: move memset before early return
Clang static analysis reports this representative issue
dbg.c:1455:6: warning: Branch condition evaluates to
a garbage value
if (!rxf_data.size)
^~~~~~~~~~~~~~
This check depends on iwl_ini_get_rxf_data() to clear
rxf_data but the function can return early without
doing the clear. So move the memset before the early
return.
Tom Rix [Fri, 14 Apr 2023 10:11:57 +0000 (13:11 +0300)]
wifi: iwlwifi: mvm: initialize seq variable
Clang static analysis reports this issue
d3.c:567:22: warning: The left operand of '>' is
a garbage value
if (seq.tkip.iv32 > cur_rx_iv32)
~~~~~~~~~~~~~ ^
seq is never initialized. Call ieee80211_get_key_rx_seq() to
initialize seq.
Add RF step id handling and handle for BZ device.
Read CNV Aux register and uses for no OTP case.
Add missing rf support for Bz/Bnj device and correct/add
the mapping for rf-type if OTP not present.
wifi: iwlwifi: mvm: scan legacy bands and UHB channels with same antenna
In case of UHB scan that follows a scan on legacy bands,
consider both scan commands as part of the same scan cycle,
and thus configure them to use the same antenna configuration.
Daniel Gabay [Thu, 13 Apr 2023 18:40:34 +0000 (21:40 +0300)]
wifi: iwlwifi: yoyo: Fix possible division by zero
Don't allow buffer allocation TLV with zero req_size since it
leads later to division by zero in iwl_dbg_tlv_alloc_fragments().
Also, NPK/SRAM locations are allowed to have zero buffer req_size,
don't discard them.
Daniel Gabay [Thu, 13 Apr 2023 18:40:32 +0000 (21:40 +0300)]
wifi: iwlwifi: pcie: fix possible NULL pointer dereference
It is possible that iwl_pci_probe() will fail and free the trans,
then afterwards iwl_pci_remove() will be called and crash by trying
to access trans which is already freed, fix it.
iwlwifi 0000:01:00.0: Detected crf-id 0xa5a5a5a2, cnv-id 0xa5a5a5a2
wfpm id 0xa5a5a5a2
iwlwifi 0000:01:00.0: Can't find a correct rfid for crf id 0x5a2
...
BUG: kernel NULL pointer dereference, address: 0000000000000028
...
RIP: 0010:iwl_pci_remove+0x12/0x30 [iwlwifi]
pci_device_remove+0x3e/0xb0
device_release_driver_internal+0x103/0x1f0
driver_detach+0x4c/0x90
bus_remove_driver+0x5c/0xd0
driver_unregister+0x31/0x50
pci_unregister_driver+0x40/0x90
iwl_pci_unregister_driver+0x15/0x20 [iwlwifi]
__exit_compat+0x9/0x98 [iwlwifi]
__x64_sys_delete_module+0x147/0x260
Driver is using the dump name generated first time in all
generated dump in case of NMI.
The validity of dump name should be with each dump created
and need to reset after each use.
Johannes Berg [Thu, 13 Apr 2023 18:40:30 +0000 (21:40 +0300)]
wifi: iwlwifi: pcie: work around ROM bug on AX210 integrated
On 22000 and AX210 devices, there's a ROM bug that causes it to
set invalid LTR settings. On 22000 and AX210 non-integrated we
can fix up these settings from the driver (as done in the code
here), but on AX210 integrated these registers are not available
to the driver.
Attempt to work around the issue by spinning while the IML is
being loaded, the IML will then reprogram the LTR values itself
after it's loaded, so only the brief IML load (which the ROM is
doing) is affected.
wifi: iwlwifi: mvm: cleanup beacon_inject_active during hw restart
beacon_inject_active turns true and false via debugfs when we inject a
beacon. During the time of the beacon injection we can't configure the
FW with a beacon cmd. If we have a hw restart during the beacon injection
then in the recovery flow we will not be able to configure the beacon
cmd to the FW. Fix this by cleaning up this variable after an hw restart.
wifi: iwlwifi: mvm: support wowlan info notification version 2
As part of version 2 we don't need to have wake_packet_bufsize
and wake_packet_length. The first one is already calculated by the driver,
the latter is sent as part of the wake packet notification.
Johannes Berg [Thu, 13 Apr 2023 18:40:25 +0000 (21:40 +0300)]
wifi: iwlwifi: mvm: request limiting to 8 MSDUs per A-MSDU
Due to hardware limitations when splitting up A-MSDUs, it
cannot handle an arbitrary number of MSDUs per A-MSDU. Set
the bits to ask transmitters to send only 8 MSDUs in one
A-MSDU.
wifi: iwlwifi: acpi: support modules with high antenna gain
Starting from version 4 of ANT_GAIN_CMD verification of ppag table
values is done by the FW. Driver has to send the complete table as
it appears in the BIOS. Make this change.
Johannes Berg [Fri, 31 Mar 2023 14:59:17 +0000 (16:59 +0200)]
wifi: mac80211: add flush_sta method
Some drivers like iwlwifi might have per-STA queues, so we
may want to flush/drop just those queues rather than all
when removing a station. Add a separate method for that.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Johannes Berg [Fri, 31 Mar 2023 14:59:16 +0000 (16:59 +0200)]
wifi: mac80211: flush queues on STA removal
When we remove a station, we first make it unreachable,
then we (must) remove its keys, and then remove the
station itself. Depending on the hardware design, if
we have hardware crypto at all, frames still sitting
on hardware queues may then be transmitted without a
valid key, possibly unencrypted or with a fixed key.
Fix this by flushing the queues when removing stations
so this cannot happen.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Johannes Berg [Fri, 31 Mar 2023 14:59:08 +0000 (16:59 +0200)]
wifi: ieee80211: correctly mark FTM frames non-bufferable
The checks of whether or not a frame is bufferable were not
taking into account that some action frames aren't, such as
FTM. Check this, which requires some changes to the function
ieee80211_is_bufferable_mmpdu() since we need the whole skb
for the checks now.
Reviewed-by: Ilan Peer <ilan.peer@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
When the IPC registers are used for sleep control, setting
the IPC sleep bit already triggers an interrupt to the fw, so
there is no need to also set the doorbell. Setting also the
doorbell triggers the sleep interrupt twice which lead to
an assert.
Johannes Berg [Thu, 13 Apr 2023 07:44:05 +0000 (10:44 +0300)]
wifi: iwlwifi: mvm: convert TID to FW value on queue remove
On queue remove, we should convert the TID value to the
firmware value (8 -> 15) just like we do on queue add.
Otherwise, the firmware will not be able to find the
correct queue to remove.
wifi: iwlwifi: add a validity check of queue_id in iwl_txq_reclaim
This function receives the queue id to reclaim packets from. Currently
we're passing to it the queue id we received from the FW in the flush
response. We don't do any check of this value and it might be invalid.
In such case we will refer to a pointer to a queue which might be NULL.
Fix this by adding a validity check of the queue id before using it.
Johannes Berg [Thu, 13 Apr 2023 07:44:01 +0000 (10:44 +0300)]
wifi: iwlwifi: debug: fix crash in __iwl_err()
In __iwl_err(), if we rate-limit the message away, then
vaf.va is still NULL-initialized by the time we get to
the tracing code, which then crashes. When it doesn't
get rate-limited out, it's still wrong to reuse the old
args2 that was already printed, which is why we bother
making a copy in the first place.
mmc: sdio: add Realtek SDIO vendor ID and various wifi device IDs
Add the SDIO vendor ID for Realtek and some device IDs extracted from
their GPL vendor driver. This will be useful in the future when the
rtw88 driver gains support for these chips.
Acked-by: Ulf Hansson <ulf.hansson@linaro.org> Reviewed-by: Ping-Ke Shih <pkshih@realtek.com> Reviewed-by: Pali Rohár <pali@kernel.org> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20230405200729.632435-7-martin.blumenstingl@googlemail.com
wifi: rtw88: main: Reserve 8 bytes of extra TX headroom for SDIO cards
For SDIO host controllers with DMA support the TX buffer physical memory
address need to be aligned at an 8-byte boundary. Reserve 8 bytes of
extra TX headroom so we can align the data without re-allocating the
transmit buffer.
While here, also remove the TODO comment regarding extra headroom for
USB and SDIO. For SDIO the extra headroom is now handled and for USB it
was not needed so far.
wifi: rtw88: sdio: Add HCI implementation for SDIO based chipsets
Add a sub-driver for SDIO based chipsets which implements the following
functionality:
- register accessors for 8, 16 and 32 bits for all states of the card
(including usage of 4x 8 bit access for one 32 bit buffer if the card
is not fully powered on yet - or if it's fully powered on then 1x 32
bit access is used)
- checking whether there's space in the TX FIFO queue to transmit data
- transfers from the host to the device for actual network traffic,
reserved pages (for firmware download) and H2C (host-to-card)
transfers
- receiving data from the device
- deep power saving state
The transmit path is optimized so DMA-capable SDIO host controllers can
directly use the buffers provided because the buffer's physical
addresses are 8 byte aligned.
The receive path is prepared to support RX aggregation where the
chipset combines multiple MAC frames into one bigger buffer to reduce
SDIO transfer overhead.
Co-developed-by: Jernej Skrabec <jernej.skrabec@gmail.com> Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Reviewed-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20230405200729.632435-3-martin.blumenstingl@googlemail.com
wifi: rtw88: Clear RTW_FLAG_POWERON early in rtw_mac_power_switch()
The SDIO HCI implementation needs to know when the MAC is powered on.
This is needed because 32-bit register access has to be split into 4x
8-bit register access when the MAC is not fully powered on or while
powering off. When the MAC is powered on 32-bit register access can be
used to reduce the number of transfers but splitting into 4x 8-bit
register access still works in that case.
During the power on sequence is how RTW_FLAG_POWERON is only set when
the power on sequence has completed successfully. During power off
however RTW_FLAG_POWERON is set. This means that the upcoming SDIO HCI
implementation does not know that it has to use 4x 8-bit register
accessors. Clear the RTW_FLAG_POWERON flag early when powering off the
MAC so the whole power off sequence is processed with RTW_FLAG_POWERON
unset. This will make it possible to use the RTW_FLAG_POWERON flag in
the upcoming SDIO HCI implementation.
Note that a failure in rtw_pwr_seq_parser() while applying
chip->pwr_off_seq can theoretically result in the RTW_FLAG_POWERON
flag being cleared while the chip is still powered on. However,
depending on when the failure occurs in the power off sequence the
chip may be on or off. Even the original approach of clearing
RTW_FLAG_POWERON only when the power off sequence has been applied
successfully could end up in some corner case where the chip is
powered off but RTW_FLAG_POWERON was not cleared.
Fixes: 2af3b2a631b1 ("mac80211_hwsim: add PMSR report support via virtio") Reported-by: syzbot <syzkaller@googlegroups.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Jaewan Kim <jaewan@google.com> Cc: Johannes Berg <johannes.berg@intel.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Reviewed-by: Jaewan Kim <jaewan@google.com> Link: https://lore.kernel.org/r/20230404171658.917361-1-edumazet@google.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Shenwei Wang [Mon, 3 Apr 2023 22:23:02 +0000 (17:23 -0500)]
net: stmmac: dwmac-imx: use platform specific reset for imx93 SoCs
The patch addresses an issue with the reset logic on the i.MX93 SoC, which
requires configuration of the correct interface speed under RMII mode to
complete the reset. The patch implements a fix_soc_reset function and uses
it specifically for the i.MX93 SoCs.
Shenwei Wang [Mon, 3 Apr 2023 22:23:01 +0000 (17:23 -0500)]
net: stmmac: add support for platform specific reset
This patch adds support for platform-specific reset logic in the
stmmac driver. Some SoCs require a different reset mechanism than
the standard dwmac IP reset. To support these platforms, a new function
pointer 'fix_soc_reset' is added to the plat_stmmacenet_data structure.
The stmmac_reset in hwif.h is modified to call the 'fix_soc_reset'
function if it exists. This enables the driver to use the platform-specific
reset logic when necessary.
Rob Herring [Tue, 4 Apr 2023 20:41:52 +0000 (15:41 -0500)]
dt-bindings: net: dsa: brcm,sf2: Drop unneeded "#address-cells/#size-cells"
There's no need for "#address-cells/#size-cells" in the brcm,sf2 node as
no immediate child nodes have an address. What was probably intended was
to put them in the 'ports' node, but that's not necessary as that is
covered by ethernet-switch.yaml via dsa.yaml.
Signed-off-by: Rob Herring <robh@kernel.org> Reviewed-by: Vladimir Oltean <olteanv@gmail.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Link: https://lore.kernel.org/r/20230404204152.635400-1-robh@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Rob Herring [Tue, 4 Apr 2023 20:42:13 +0000 (15:42 -0500)]
dt-bindings: net: ethernet-switch: Make "#address-cells/#size-cells" required
The schema doesn't allow for a single (unaddressed) ethernet port node
nor does a single port switch make much sense. So if there's always
multiple child nodes, "#address-cells" and "#size-cells" should be
required.
Signed-off-by: Rob Herring <robh@kernel.org> Reviewed-by: Vladimir Oltean <olteanv@gmail.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Link: https://lore.kernel.org/r/20230404204213.635773-1-robh@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Jakub Kicinski [Thu, 6 Apr 2023 00:25:02 +0000 (17:25 -0700)]
Merge tag 'wireless-next-2023-04-05' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next
Kalle Valo says:
====================
wireless-next patches for v6.3
Smaller pull request this time, sending this early to fix the conflict
in mac80211. Nothing really special this time, only smaller changes.
* enable Wi-Fi 7 (EHT) mesh support
* tag 'wireless-next-2023-04-05' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next: (37 commits)
wifi: rt2x00: Fix memory leak when handling surveys
wifi: b43legacy: Remove the unused function prev_slot()
wifi: rtw89: Remove redundant pci_clear_master
wifi: rtw89: fix potential race condition between napi_init and napi_enable
wifi: rtw89: config EDCCA threshold during scan to prevent TX failed
wifi: rtw89: fix incorrect channel info during scan due to ppdu_sts filtering
wifi: rtw89: remove superfluous H2C of join_info
wifi: rtw89: set data lowest rate according to AP supported rate
wifi: rtw89: add counters of register-based H2C/C2H
wifi: rtw89: coex: Update Wi-Fi Bluetooth coexistence version to 7.0.1
wifi: rtw89: coex: Add report control v5 variation
wifi: rtw89: coex: Update RTL8852B LNA2 hardware parameter
wifi: rtw89: coex: Not to enable firmware report when WiFi is power saving
wifi: rtw89: coex: Add LPS protocol radio state for RTL8852B
bcma: remove unused mips_read32 function
bcma: Use of_address_to_resource()
wifi: mwifiex: remove unused evt_buf variable
wifi: brcmsmac: ampdu: remove unused suc_mpdu variable
wifi: rtlwifi: fix incorrect error codes in rtl_debugfs_set_write_reg()
wifi: rtlwifi: fix incorrect error codes in rtl_debugfs_set_write_rfreg()
...
====================
The first patch is by Oliver Hartkopp and makes the maximum pdu size
of the CAN ISOTP protocol configurable.
The following 5 patches are by Dario Binacchi and add support for the
bxCAN controller by ST.
Geert Uytterhoeven's patch for the rcar_canfd driver fixes a sparse
warning.
Peng Fan's patch adds an optional power-domains property to the
flexcan device tree binding.
Frank Jungclaus adds support for CAN_CTRLMODE_BERR_REPORTING to the
esd_usb driver.
The last patch is by Oliver Hartkopp and converts the USB IDs of the
kvaser_usb driver to hexadecimal values.
* tag 'linux-can-next-for-6.4-20230404-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next:
kvaser_usb: convert USB IDs to hexadecimal values
can: esd_usb: Add support for CAN_CTRLMODE_BERR_REPORTING
dt-bindings: can: fsl,flexcan: add optional power-domains property
can: rcar_canfd: rcar_canfd_probe(): fix plain integer in transceivers[] init
can: bxcan: add support for ST bxCAN controller
ARM: dts: stm32: add pin map for CAN controller on stm32f4
ARM: dts: stm32: add CAN support on stm32f429
dt-bindings: net: can: add STM32 bxcan DT bindings
dt-bindings: arm: stm32: add compatible for syscon gcan node
can: isotp: add module parameter for maximum pdu size
====================
Simon Horman [Mon, 3 Apr 2023 15:43:16 +0000 (17:43 +0200)]
net: qrtr: correct types of trace event parameters
The arguments passed to the trace events are of type unsigned int,
however the signature of the events used __le32 parameters.
I may be missing the point here, but sparse flagged this and it
does seem incorrect to me.
net/qrtr/ns.c: note: in included file (through include/trace/trace_events.h, include/trace/define_trace.h, include/trace/events/qrtr.h):
./include/trace/events/qrtr.h:11:1: warning: cast to restricted __le32
./include/trace/events/qrtr.h:11:1: warning: restricted __le32 degrades to integer
./include/trace/events/qrtr.h:11:1: warning: restricted __le32 degrades to integer
... (a lot more similar warnings)
net/qrtr/ns.c:115:47: expected restricted __le32 [usertype] service
net/qrtr/ns.c:115:47: got unsigned int service
net/qrtr/ns.c:115:61: warning: incorrect type in argument 2 (different base types)
... (a lot more similar warnings)
Oliver Hartkopp [Wed, 29 Mar 2023 09:09:15 +0000 (11:09 +0200)]
kvaser_usb: convert USB IDs to hexadecimal values
USB IDs are usually represented in 16 bit hexadecimal values. To match
the common representation in lsusb and for searching USB IDs in the
internet convert the decimal values to lowercase hexadecimal.
changes since v1: https://lore.kernel.org/all/20230327175344.4668-1-socketcan@hartkopp.net
- drop the aligned block indentation (suggested by Jimmy)
- use lowercase hex values (suggested by Alex)
Frank Jungclaus [Thu, 30 Mar 2023 18:44:46 +0000 (20:44 +0200)]
can: esd_usb: Add support for CAN_CTRLMODE_BERR_REPORTING
Announce that the driver supports CAN_CTRLMODE_BERR_REPORTING by means
of priv->can.ctrlmode_supported. Until now berr reporting always has
been active without taking care of the berr-reporting parameter given
to an "ip link set ..." command.
Additionally apply some changes to function esd_usb_rx_event():
- If berr reporting is off and it is also no state change, then
immediately return.
- Unconditionally (even in case of the above "immediate return") store
tx- and rx-error counters, so directly use priv->bec.txerr and
priv->bec.rxerr instead of intermediate variables.
- Not directly related, but to better point out the linkage between a
failed alloc_can_err_skb() and stats->rx_dropped++:
Move the increment of the rx_dropped statistic counter (back) to
directly behind the err_skb allocation.
====================
vsock: return errors other than -ENOMEM to socket
this patchset removes behaviour, where error code returned from any
transport was always switched to ENOMEM. This works in the same way as
patch from Bobby Eshleman:
commit c43170b7e157 ("vsock: return errors other than -ENOMEM to socket"),
but for receive calls. VMCI transport is also updated (both tx and rx
SOCK_STREAM callbacks), because it returns VMCI specific error code to
af_vsock.c (like VMCI_ERROR_*). Tx path is already merged to net, so it
was excluded from patchset in v4. At the same time, virtio and Hyper-V
transports are using general error codes, so there is no need to update
them.
vsock_test suite is also updated.
Link to v1:
https://lore.kernel.org/netdev/97f19214-ba04-c47e-7486-72e8aa16c690@sberdevices.ru/
Link to v2:
https://lore.kernel.org/netdev/60abc0da-0412-6e25-eeb0-8e32e3ec21e7@sberdevices.ru/
Link to v3:
https://lore.kernel.org/netdev/dead4842-333a-015e-028b-302151336ff9@sberdevices.ru/
====================
This removes behaviour, where error code returned from any transport
was always switched to ENOMEM. This works in the same way as:
commit c43170b7e157 ("vsock: return errors other than -ENOMEM to socket"),
but for receive calls.
vsock/vmci: convert VMCI error code to -ENOMEM on receive
This adds conversion of VMCI specific error code to general -ENOMEM. It
is preparation for the next patch, which changes af_vsock.c behaviour
on receive to pass value returned from transport to the user.
Jakub Kicinski [Tue, 4 Apr 2023 02:02:53 +0000 (19:02 -0700)]
Merge branch 'sfc-support-unicast-ptp'
Íñigo Huguet says:
====================
sfc: support unicast PTP
Unicast PTP was not working with sfc NICs.
The reason was that these NICs don't timestamp all incoming packets,
but instead they only timestamp packets of the queues that are selected
for that. Currently, only one RX queue is configured for timestamp: the
RX queue of the PTP channel. The packets that are put in the PTP RX
queue are selected according to firmware filters configured from the
driver.
Multicast PTP was already working because the needed filters are known
in advance, so they're inserted when PTP is enabled. This patches
add the ability to dynamically add filters for unicast addresses,
extracted from the TX PTP-event packets.
Since we don't know in advance how many filters we'll need, some info
about the filters need to be saved. This will allow to check if a filter
already exists or if a filter is too old and should be removed.
Note that the previous point is unnecessary for multicast filters, but
I've opted to change how they're handled to match the new unicast's
filters to avoid having duplicate insert/remove_filters functions,
once for each type of filter.
Tested: With ptp4l, all combinations of IPv4/IPv6, master/slave and
unicast/multicast
Reported-by: Yalin Li <yalli@redhat.com>
====================
Íñigo Huguet [Fri, 31 Mar 2023 11:14:04 +0000 (13:14 +0200)]
sfc: remove expired unicast PTP filters
Filters inserted to support unicast PTP mode might become unused after
some time, so we need to remove them to avoid accumulating many of them.
Refresh the expiration time of a filter each time it's used. Then check
periodically if any filter hasn't been used for a long time (30s) and
remove it.
Reported-by: Yalin Li <yalli@redhat.com> Signed-off-by: Íñigo Huguet <ihuguet@redhat.com> Reviewed-by: Edward Cree <ecree.xilinx@gmail.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Íñigo Huguet [Fri, 31 Mar 2023 11:14:03 +0000 (13:14 +0200)]
sfc: support unicast PTP
When sending a PTP event packet, add the correct filters that will make
that future incoming unicast PTP event packets will be timestamped.
The unicast address for the filter is gotten from the outgoing skb
before sending it.
Until now they were not timestamped because only filters that match with
the PTP multicast addressed were being configured into the NIC for the
PTP special channel. Packets received through different channels are not
timestamped, getting "received SYNC without timestamp" error in ptp4l.
Note that the inserted filters are never removed unless the NIC is stopped
or reconfigured, so efx_ptp_stop is called. Removal of old filters will
be handled by the next patch.
Additionally, cleanup a bit efx_ptp_xmit_skb_mc to use the reverse xmas
tree convention and remove an unnecessary assignment to rc variable in
void function.
Reported-by: Yalin Li <yalli@redhat.com> Signed-off-by: Íñigo Huguet <ihuguet@redhat.com> Reviewed-by: Edward Cree <ecree.xilinx@gmail.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Íñigo Huguet [Fri, 31 Mar 2023 11:14:02 +0000 (13:14 +0200)]
sfc: allow insertion of filters for unicast PTP
Add a second list for unicast filters and generalize the
efx_ptp_insert/remove_filters functions to allow acting in any of the 2
lists.
No filters for unicast are inserted yet. That will be done in the next
patch.
The reason to use 2 different lists instead of a single one is that, in
next patches, we will want to check if unicast filters are already added
and if they're expired. We don't need that for multicast filters.
Reported-by: Yalin Li <yalli@redhat.com> Signed-off-by: Íñigo Huguet <ihuguet@redhat.com> Reviewed-by: Edward Cree <ecree.xilinx@gmail.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Íñigo Huguet [Fri, 31 Mar 2023 11:14:01 +0000 (13:14 +0200)]
sfc: store PTP filters in a list
Instead of using a fixed sized array for the PTP filters, use a list.
This is not actually necessary at this point because the filters for
multicast PTP are a fixed number, but this is a preparation for the
following patches adding support for unicast PTP.
To avoid confusion with the new struct type efx_ptp_rxfilter, change the
name of some local variables from rxfilter to spec, given they're of the
type efx_filter_spec.
Reported-by: Yalin Li <yalli@redhat.com> Signed-off-by: Íñigo Huguet <ihuguet@redhat.com> Reviewed-by: Edward Cree <ecree.xilinx@gmail.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Fix this by freeing the channel surveys on device removal.
Tested with a RT3070 based USB wireless adapter.
Fixes: 5447626910f5 ("rt2x00: save survey for every channel visited") Signed-off-by: Armin Wolf <W_Armin@gmx.de> Reviewed-by: Simon Horman <simon.horman@corigine.com> Acked-by: Stanislaw Gruszka <stf_xl@wp.pl> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20230330215637.4332-1-W_Armin@gmx.de
Cai Huoqing [Thu, 23 Mar 2023 11:26:13 +0000 (19:26 +0800)]
wifi: rtw89: Remove redundant pci_clear_master
Remove pci_clear_master to simplify the code,
the bus-mastering is also cleared in do_pci_disable_device,
like this:
./drivers/pci/pci.c:2197
static void do_pci_disable_device(struct pci_dev *dev)
{
u16 pci_command;
Ping-Ke Shih [Thu, 23 Mar 2023 08:28:39 +0000 (16:28 +0800)]
wifi: rtw89: fix potential race condition between napi_init and napi_enable
A race condition can happen if netdev is registered, but NAPI isn't
initialized yet, and meanwhile user space starts the netdev that will
enable NAPI. Then, it hits BUG_ON():
To fix this, follow Jonas' suggestion to switch the order of these
functions and move register netdev to be the last step of PCI probe.
Also, correct the error handling of rtw89_core_register_hw().
Chih-Kang Chang [Mon, 20 Mar 2023 09:31:12 +0000 (17:31 +0800)]
wifi: rtw89: fix incorrect channel info during scan due to ppdu_sts filtering
We use ppdu_sts to obtain channel information from hardware, to ensure
that the scan results have correct channel information. However, some of
ppdu_sts that is filtered by the to_self check is also needed for the scan
results. Therefore, we modify the filter part in front of CFO count.
Chin-Yen Lee [Mon, 20 Mar 2023 09:31:11 +0000 (17:31 +0800)]
wifi: rtw89: remove superfluous H2C of join_info
We find that when starting WoWLAN, the second join_info H2C is
unnecessary and leads WoWLAN not enter power save mode if using new
firmware, so remove it.
Chih-Kang Chang [Mon, 20 Mar 2023 09:31:10 +0000 (17:31 +0800)]
wifi: rtw89: set data lowest rate according to AP supported rate
By default the driver uses the 1M and 6M rate (0x0) for data frames in
2 GHz and 5/6 GHz bands respectively. But the rate that might not AP
supported. Therefore, We modify the data lowest rate according to the
lowest of AP supported rate.
Ping-Ke Shih [Thu, 16 Mar 2023 06:39:56 +0000 (14:39 +0800)]
wifi: rtw89: add counters of register-based H2C/C2H
The register-based H2C/C2H are used to exchange information between driver
and firmware, but only apply to narrow area because its data size is
smaller than regular packet-based H2C/C2H.
This kind of H2C/C2H must be paired. To identify if any H2C/C2H is missing,
update counters to help diagnose this kind of problems.
Ching-Te Ku [Tue, 14 Mar 2023 02:06:17 +0000 (10:06 +0800)]
wifi: rtw89: coex: Update Wi-Fi Bluetooth coexistence version to 7.0.1
Update driver with the supported firmware version of the below item.
Bluetooth firmware BT_Coex_Ver: 0x07
Wi-Fi firmware version:
RTL8852C->v0.27.56.10
RTL8852A->v0.24.36
RTL8852B->v0.29.29
Ching-Te Ku [Tue, 14 Mar 2023 02:06:16 +0000 (10:06 +0800)]
wifi: rtw89: coex: Add report control v5 variation
In order to reduce firmware code size cost, remove some counter value from
the structure. But firmware didn't update version code. To parse the
correct report, add another variation version v105 to parse it.
Ching-Te Ku [Tue, 14 Mar 2023 02:06:14 +0000 (10:06 +0800)]
wifi: rtw89: coex: Not to enable firmware report when WiFi is power saving
If driver enable firmware report during WiFi power saving, the
firmware timer will lead to some power saving issue like,
fail to enter LPS, can not leave LPS or some unexpected issue.
Ching-Te Ku [Tue, 14 Mar 2023 02:06:13 +0000 (10:06 +0800)]
wifi: rtw89: coex: Add LPS protocol radio state for RTL8852B
This LPS state will not turn off RF, and it can still do some basic
traffic, only RTL8852B has the state. Coexistence need let Bluetooth
know WiFi is still alive to prevent some Bluetooth performance issue.
David S. Miller [Mon, 3 Apr 2023 09:13:01 +0000 (10:13 +0100)]
Merge branch 'mt7988-support'
Daniel Golle says:
====================
net: dsa: add support for MT7988
The MediaTek MT7988 SoC comes with a built-in switch very similar to
previous MT7530 and MT7531. However, the switch address space is mapped
into the SoCs memory space rather than being connected via MDIO.
Using MMIO simplifies register access and also removes the need for a bus
lock, and for that reason also makes interrupt handling more light-weight.
Note that this is different from previous SoCs like MT7621 and MT7623N
which also came with an integrated MT7530-like switch which yet had to be
accessed via MDIO.
Split-off the part of the driver registering an MDIO driver, then add
another module acting as MMIO/platform driver.
The whole series has been tested on various MediaTek boards:
* MT7623A + MT7530 (BPi-R2)
* MT7986A + MT7531 (BPi-R3)
* MT7988A reference board
Changes since v1:
* use 'internal' PHY mode where appropriate
* use regmap_update_bits in mt7530_rmw
* improve dt-bindings
Changes since RFC v3:
* WARN_ON_ONCE if register read fails
* move probing of the reset GPIO and reset controller link out of
common probe function, as they are not actually common
Changes since RFC v2:
* split into many small commits to ease review
* introduce helper functions to reduce code duplication
* use helpers for locking to make lock-skipping easier and less ugly
to implement.
* add dt-bindings for mediatek,mt7988-switch
Changes since initial RFC:
* use regmap for register access and move register access to bus-
specific driver
* move initialization of MT7531 SGMII PCS to MDIO driver
====================
Signed-off-by: David S. Miller <davem@davemloft.net>