platform/kernel/linux-starfive.git
17 months agowifi: cfg80211: wext: hold wiphy lock in siwgenie
Johannes Berg [Tue, 6 Jun 2023 12:49:23 +0000 (14:49 +0200)]
wifi: cfg80211: wext: hold wiphy lock in siwgenie

Missed this ioctl since it's in wext-sme.c where we
usually get via a front-level ioctl handler in the
other files, but it should also hold the wiphy lock
to align the locking contract towards the driver.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: cfg80211: move wowlan disable under locks
Johannes Berg [Tue, 6 Jun 2023 12:49:22 +0000 (14:49 +0200)]
wifi: cfg80211: move wowlan disable under locks

This is a driver callback, and the driver should be able
to assume that it's called with the wiphy lock held. Move
the call up so that's true, it has no other effect since
the device is already unregistering and we cannot reach
this function through other paths.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: cfg80211: hold wiphy lock in pmsr work
Johannes Berg [Tue, 6 Jun 2023 12:49:21 +0000 (14:49 +0200)]
wifi: cfg80211: hold wiphy lock in pmsr work

Most code paths in cfg80211 already hold the wiphy lock,
mostly by virtue of being called from nl80211, so make
the pmsr cleanup worker also hold it, aligning the
locking promises between different parts of cfg80211.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: cfg80211: hold wiphy lock in auto-disconnect
Johannes Berg [Tue, 6 Jun 2023 12:49:20 +0000 (14:49 +0200)]
wifi: cfg80211: hold wiphy lock in auto-disconnect

Most code paths in cfg80211 already hold the wiphy lock,
mostly by virtue of being called from nl80211, so make
the auto-disconnect worker also hold it, aligning the
locking promises between different parts of cfg80211.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agoMerge wireless into wireless-next
Johannes Berg [Wed, 7 Jun 2023 17:43:52 +0000 (19:43 +0200)]
Merge wireless into wireless-next

There are a number of upcoming things in both the stack and
drivers that would otherwise conflict, so merge wireless to
wireless-next to be able to avoid those conflicts.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agoRevert "wifi: iwlwifi: update response for mcc_update command"
Johannes Berg [Tue, 6 Jun 2023 13:28:05 +0000 (15:28 +0200)]
Revert "wifi: iwlwifi: update response for mcc_update command"

This reverts commit b70813e4a88f ("wifi: iwlwifi: update response
for mcc_update command") since it causes a merge conflict, and it
seems easier to redo the patch later.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agoRevert "wifi: iwlwifi: mvm: FTM initiator MLO support"
Johannes Berg [Tue, 6 Jun 2023 13:26:05 +0000 (15:26 +0200)]
Revert "wifi: iwlwifi: mvm: FTM initiator MLO support"

This reverts commit 1bcbb1208e9a ("wifi: iwlwifi: mvm: FTM
initiator MLO support") as it causes a merge conflict, and
we can defer and re-do those changes later.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: cfg80211: fix locking in regulatory disconnect
Johannes Berg [Tue, 6 Jun 2023 12:34:48 +0000 (14:34 +0200)]
wifi: cfg80211: fix locking in regulatory disconnect

This should use wiphy_lock() now instead of requiring the
RTNL, since __cfg80211_leave() via cfg80211_leave() is now
requiring that lock to be held.

Fixes: a05829a7222e ("cfg80211: avoid holding the RTNL when calling the driver")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: cfg80211: fix locking in sched scan stop work
Johannes Berg [Tue, 6 Jun 2023 12:34:47 +0000 (14:34 +0200)]
wifi: cfg80211: fix locking in sched scan stop work

This should use wiphy_lock() now instead of acquiring the
RTNL, since cfg80211_stop_sched_scan_req() now needs that.

Fixes: a05829a7222e ("cfg80211: avoid holding the RTNL when calling the driver")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: mac80211: stop warning after reconfig failures
Johannes Berg [Sun, 4 Jun 2023 09:11:28 +0000 (12:11 +0300)]
wifi: mac80211: stop warning after reconfig failures

If we have a reconfig failure in the driver, then we need
to shut down the network interface(s) at the network stack
level through cfg80211, which can result in a lot of those
"Failed check-sdata-in-driver check, ..." warnings, since
interfaces are considered to not be in the driver when the
reconfiguration fails, but we still need to go through all
the shutdown flow.

Avoid many of these warnings by storing the fact that the
stack experienced a reconfiguration failure and not doing
the warning in that case.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230604120651.3750c4ae6e76.I9e80d6026f59263c008a1a68f6cd6891ca0b93b0@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: mac80211_hwsim: Fix possible NULL dereference
Ilan Peer [Sun, 4 Jun 2023 09:11:27 +0000 (12:11 +0300)]
wifi: mac80211_hwsim: Fix possible NULL dereference

In a call to mac80211_hwsim_select_tx_link() the sta pointer might
be NULL, thus need to check that it is not NULL before accessing it.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230604120651.f4d889fc98c4.Iae85f527ed245a37637a874bb8b8c83d79812512@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: mac80211: consistently use u64 for BSS changes
Anjaneyulu [Sun, 4 Jun 2023 09:11:26 +0000 (12:11 +0300)]
wifi: mac80211: consistently use u64 for BSS changes

Currently, enum ieee80211_bss_change has more than 32 flags.
Change the type of the corresponding variables from u32 to u64.

Signed-off-by: Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230604120651.10354a05eaf1.If19359262fe2728dd523ea6d7c3aa7dc50940411@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: mac80211: batch recalc during STA flush
Johannes Berg [Sun, 4 Jun 2023 09:11:22 +0000 (12:11 +0300)]
wifi: mac80211: batch recalc during STA flush

When we flush stations, we first take them off the list
and then destroy them one by one. If we do the different
mode recalculations while destroying them, we cause the
following scenario:
 - STA 1 has 80 MHz - min chanctx width is now 80 MHz
 - STA 2 has 80 MHz
 - empty STA list
 - destroy STA 2
 - recalc min chanctx width -> results in 20 MHz as
   the STA list is already empty

This is broken, since as far as the driver is concerned
STA 1 still exists at this point, and this causes issues
at least with iwlwifi.

Fix - and also optimize - this by doing the recalc of
min chanctx width (and also P2P PS) only after all the
stations were removed.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230604120651.48d262b6b42d.Ia15532657c17535c28ec0c5df263b65f0f80663c@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: mac80211: move sta_info_move_state() up
Johannes Berg [Sun, 4 Jun 2023 09:11:21 +0000 (12:11 +0300)]
wifi: mac80211: move sta_info_move_state() up

To fix a sequencing issue, this code needs to be changed
a bit. Move it up in the file to prepare for that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230604120651.05bb735d7075.I984b5c194a0f84580247d73620a4e61a5f82a774@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: mac80211: recalc min chandef for new STA links
Johannes Berg [Sun, 4 Jun 2023 09:11:20 +0000 (12:11 +0300)]
wifi: mac80211: recalc min chandef for new STA links

When adding a new link to a station, this needs to cause a
recalculation of the minimum chandef since otherwise we can
have a higher bandwidth station connected on that link than
the link is operating at. Do the appropriate recalc.

Fixes: cb71f1d136a6 ("wifi: mac80211: add sta link addition/removal")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230604120651.377adf3c789a.I91bf28f399e16e6ac1f83bacd1029a698b4e6685@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: mac80211_hwsim: check the return value of nla_put_u32
Mukesh Sisodiya [Sun, 4 Jun 2023 09:11:19 +0000 (12:11 +0300)]
wifi: mac80211_hwsim: check the return value of nla_put_u32

Check the return value of nla_put_u32() and handle it accordingly.

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230604120651.de5168568cf6.Ie16442af9be879fd835506ba5dade780edecfb60@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: mac80211: provide a helper to fetch the medium synchronization delay
Emmanuel Grumbach [Sun, 4 Jun 2023 09:11:17 +0000 (12:11 +0300)]
wifi: mac80211: provide a helper to fetch the medium synchronization delay

There are drivers which need this information.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230604120651.b1043f3126e2.Iad3806f8bf8df07f52ef0a02cc3d0373c44a8c93@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: mac80211: refactor ieee80211_select_link_key()
Mukesh Sisodiya [Sun, 4 Jun 2023 09:11:14 +0000 (12:11 +0300)]
wifi: mac80211: refactor ieee80211_select_link_key()

Simplify ieee80211_select_link_key(), no functional changes are made.

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230604120651.a4e332755bb0.Iff4a2b6ed767b2a329c51c29bb597ece9ebe2af8@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: mac80211: use u64 to hold enum ieee80211_bss_change flags
Mukesh Sisodiya [Sun, 4 Jun 2023 09:11:13 +0000 (12:11 +0300)]
wifi: mac80211: use u64 to hold enum ieee80211_bss_change flags

The size of enum ieee80211_bss_change is bigger that 32,
so we need u64 to be used in a flag. Also pass u64
instead of u32 to ieee80211_reconfig_ap_links() for the same
reason.

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230604120651.d53b7018a4eb.I1adaa041de51d50d84a11226573e81ceac0fe90d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: mac80211: implement proper AP MLD HW restart
Johannes Berg [Thu, 4 May 2023 13:45:11 +0000 (16:45 +0300)]
wifi: mac80211: implement proper AP MLD HW restart

Previously, I didn't implement restarting here at all if the
interface is an MLD, so it only worked for non-MLO. Add the
needed code to restart an AP MLD correctly.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230504134511.828474-12-gregory.greenman@intel.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: mac80211: fetch and store the EML capability information
Emmanuel Grumbach [Thu, 4 May 2023 13:45:10 +0000 (16:45 +0300)]
wifi: mac80211: fetch and store the EML capability information

We need to teach the low level driver about the EML capability which
includes information for EMLSR / EMLMR operation.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230504134511.828474-11-gregory.greenman@intel.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: mac80211: skip EHT BSS membership selector
Johannes Berg [Thu, 4 May 2023 13:45:08 +0000 (16:45 +0300)]
wifi: mac80211: skip EHT BSS membership selector

Skip the EHT BSS membership selector for getting rates.
While at it, add the definitions for GLK and EPS, and
sort the list.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230504134511.828474-9-gregory.greenman@intel.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: mac80211_hwsim: avoid warning with MLO PS stations
Johannes Berg [Thu, 4 May 2023 13:45:07 +0000 (16:45 +0300)]
wifi: mac80211_hwsim: avoid warning with MLO PS stations

If the station disables all links it's in powersave and
we shouldn't transmit anything to it, but we don't handle
that correctly yet. For now, just avoid the warning, once
we really add support for this case we can revert to the
old warning.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230504134511.828474-8-gregory.greenman@intel.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: mac80211: remove element scratch_len
Johannes Berg [Tue, 6 Jun 2023 12:13:20 +0000 (14:13 +0200)]
wifi: mac80211: remove element scratch_len

This isn't used, and there isn't really a good way it
could be used, so just remove that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: mac80211: HW restart for MLO
Johannes Berg [Thu, 4 May 2023 13:45:05 +0000 (16:45 +0300)]
wifi: mac80211: HW restart for MLO

Implement proper reconfiguration for interfaces that are
doing MLO, in order to be able to recover from HW restart
correctly.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230504134511.828474-6-gregory.greenman@intel.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: pnvm: handle memory descriptor tlv
Gregory Greenman [Tue, 6 Jun 2023 07:43:10 +0000 (10:43 +0300)]
wifi: iwlwifi: pnvm: handle memory descriptor tlv

When PNVM is obtained from UEFI, there's an additional memory
descriptor TLV that has to be handled. It is the same TLV that
holds data in the reduced power tables. Also, in this TLV, the
actual data is located after address and size, so add the
corresponding offset.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230606103519.8c5f5ee8e30b.Id1893c9dec140b5ba4abe8a121c2e1a1d121d2d7@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: fw: don't use constant size with efi.get_variable
Gregory Greenman [Tue, 6 Jun 2023 07:43:09 +0000 (10:43 +0300)]
wifi: iwlwifi: fw: don't use constant size with efi.get_variable

Use efi.get_variable() with NULL pointer for data in order to
obtain entry size and then call it again with the correct size
to get the entry itself.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230606103519.ef95a8055a50.Iae5389baaf0a9a3c89469f7502275ee119d378b6@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: fw: clean up PNVM loading code
Johannes Berg [Tue, 6 Jun 2023 07:43:08 +0000 (10:43 +0300)]
wifi: iwlwifi: fw: clean up PNVM loading code

This code is a bit of a maze of gotos etc. Clean up the
code a bit to make the intent clearer.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230606103519.51fb5ee63f21.I20f270b2d47612e84643dc235c2940b8d9ed9930@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: Separate reading and parsing of reduce power table
Alon Giladi [Tue, 6 Jun 2023 07:43:07 +0000 (10:43 +0300)]
wifi: iwlwifi: Separate reading and parsing of reduce power table

It enables to better handle error cases. Also save the image till the
end of the loading and only then free it.

Signed-off-by: Alon Giladi <alon.giladi@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230606103519.71e3b3e0e794.Ifbe69ad99a7e805eb70e09280365821eb146b1c9@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: Enable loading of reduce-power tables into several segments
Alon Giladi [Tue, 6 Jun 2023 07:43:06 +0000 (10:43 +0300)]
wifi: iwlwifi: Enable loading of reduce-power tables into several segments

Replace the field reduce_power_dram with a struct that holds data about
the reduced-power tables drams regions. Generalize load_payloads_segments()
to work for both pnvm tables and reduction power tables.
Make required adjustments in the data structures.

Signed-off-by: Alon Giladi <alon.giladi@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230606103519.6fe66958f049.I85d80682229fc02fe354462cc9da40937558f30c@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: Use iwl_pnvm_image in reduce power tables flow
Alon Giladi [Tue, 6 Jun 2023 07:43:05 +0000 (10:43 +0300)]
wifi: iwlwifi: Use iwl_pnvm_image in reduce power tables flow

Generalize the parsing, loading, and setting of the power-reduce
tables, in order to support allocation of several DRAM payloads
in the future.

Signed-off-by: Alon Giladi <alon.giladi@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230606103519.564f1eead99b.Iaba653b21dc09aafc72b9bbb3928abddce0db50a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: Separate loading and setting of power reduce tables
Alon Giladi [Tue, 6 Jun 2023 07:43:04 +0000 (10:43 +0300)]
wifi: iwlwifi: Separate loading and setting of power reduce tables

Take the part that copies the tables into DRAM, out of the method
that sets the prph_scratch to make the code cleaner. Each of the
operations will get more complex in the future when it will also
support larger power-reduce tables images.

Signed-off-by: Alon Giladi <alon.giladi@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230606103519.7695684dc848.I13626cd318e5d68efec9618b2045f52788bff114@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: Implement loading and setting of fragmented pnvm image
Alon Giladi [Tue, 6 Jun 2023 07:43:03 +0000 (10:43 +0300)]
wifi: iwlwifi: Implement loading and setting of fragmented pnvm image

Save the pnvm payloads in several DRAM segments (not only in one as
used to). In addition, allocate a FW structure in DRAM that holds the
segments' addresses and forward its address to the FW. It's done when
FW has the capability to handle pnvm images this way (helps to process
large pnvm images).

Signed-off-by: Alon Giladi <alon.giladi@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230606103519.dbdad8995ce1.I986213527982637042532de3851a1bd8a11be87a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: Add support for fragmented pnvm images
Alon Giladi [Tue, 6 Jun 2023 07:43:02 +0000 (10:43 +0300)]
wifi: iwlwifi: Add support for fragmented pnvm images

Add support for fragmented pnvm images, depending on the FW capability.

Signed-off-by: Alon Giladi <alon.giladi@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230606103519.c49bfaf435a9.I0278312e7c3355b224cd870d4f8cf6578d12f03e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: Allow trans_pcie track more than 1 pnvm DRAM region
Alon Giladi [Tue, 6 Jun 2023 07:43:01 +0000 (10:43 +0300)]
wifi: iwlwifi: Allow trans_pcie track more than 1 pnvm DRAM region

Change the field pnvm_dram to an array that describes many regions
and add a counter to the number of pnvm regions that were allocated
in DRAM.

Signed-off-by: Alon Giladi <alon.giladi@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230606103519.bb206d71bf45.I627640701757bb2f234f8e18a3afbd6af1206658@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: Take loading and setting of pnvm image out of parsing part
Alon Giladi [Tue, 6 Jun 2023 07:43:00 +0000 (10:43 +0300)]
wifi: iwlwifi: Take loading and setting of pnvm image out of parsing part

Change iwl_pnvm_parse so it will only save the information into the
iwl_pnvm_image struct. This enables to use the parsing code for the
power reduce tables in the future.

Signed-off-by: Alon Giladi <alon.giladi@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230606103519.504b42fc1611.I4ddf6ad76d922d118fcbcc4f0e9ec003753d0b75@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: Separate loading and setting of pnvm image into two functions
Alon Giladi [Tue, 6 Jun 2023 07:42:59 +0000 (10:42 +0300)]
wifi: iwlwifi: Separate loading and setting of pnvm image into two functions

Take the part that is copying the pnvm image into DRAM, out of the
the method that sets the prph_scratch. Makes the code cleaner since
those 2 operations don't always happen together (loading should happen
only once while setting can happen more than once).
In addition, each operation will get more complex in the future when
it will support also larger pnvm images.

Signed-off-by: Alon Giladi <alon.giladi@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230606103519.4c0728239fd6.Ibc30a9fbdb6123dadbe2dbb89318dbd5ec01080a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: Generalize the parsing of the pnvm image
Alon Giladi [Tue, 6 Jun 2023 07:42:58 +0000 (10:42 +0300)]
wifi: iwlwifi: Generalize the parsing of the pnvm image

Generalize iwl_pnvm_parse(). This saves us from copying each payload
twice (first in the parsing and later when copying it to the dram).
Moreover, its  more compatible for handling larger pnvm tables in
the future (in which payloads won't be concatenated).

The main changes are:

1. Take out the concatenating of the payloads from the parsing level
2. Start using iwl_pnvm_image structure that will hold pointers to
payloads that should be delivered to fw, their sizes and number.

Signed-off-by: Alon Giladi <alon.giladi@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230606103519.06c02f380b6f.I03a3030fca194aa0c4bc2ecd18531f8914e98cfd@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: api: fix kernel-doc links
Johannes Berg [Thu, 1 Jun 2023 14:20:06 +0000 (17:20 +0300)]
wifi: iwlwifi: api: fix kernel-doc links

Some of the kernel-doc links are outdated due to other
changes, fix that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230601171633.85e2cf489893.Ie3889ea6f755b80c988543ccca56c67420c51b1f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: api: remove unused commands
Johannes Berg [Thu, 1 Jun 2023 14:20:05 +0000 (17:20 +0300)]
wifi: iwlwifi: api: remove unused commands

Some commands are no longer used and have broken kernel-doc links,
so just remove them.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230601171633.3dad4ad9b53e.I018abd02d6925950b8748dfb7a59db87255fc670@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: api: use __le16 instead of u16
Johannes Berg [Thu, 1 Jun 2023 14:20:04 +0000 (17:20 +0300)]
wifi: iwlwifi: api: use __le16 instead of u16

Even for reserved values we shouldn't use u16, that's just
error prone. Fix this to __le16.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230601171633.29ebf70aa64e.I1263f6724e1c70ff5541f447b9744f143ee736a3@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: api: link context action in kernel-doc
Johannes Berg [Thu, 1 Jun 2023 14:20:03 +0000 (17:20 +0300)]
wifi: iwlwifi: api: link context action in kernel-doc

This is clearer in kernel-doc than spelling out the prefix.
It also lets us generate better tracing data.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230601171633.e11ece794f60.I9874c7b0437071a2620d68ca5a16efed60da07a9@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: mvm: tell firmware about per-STA MFP enablement
Johannes Berg [Thu, 1 Jun 2023 06:52:46 +0000 (09:52 +0300)]
wifi: iwlwifi: mvm: tell firmware about per-STA MFP enablement

Indicate to the firmware for each station whether or not MFP
is used with this station. Note that we indicate MFP for it
before authorized since we don't know yet, and that will make
the firmware not handle should-be-protected management frames
without being able to check them.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230601095201.b1052f39af4c.I1b46b751d5808e65ea3d0e7b8b38209c5aecf042@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: mvm: send time sync only if needed
Johannes Berg [Wed, 31 May 2023 16:50:06 +0000 (19:50 +0300)]
wifi: iwlwifi: mvm: send time sync only if needed

If there's no peer configured then there's no point in sending
the command down to the firmware with an invalid peer address.

Fixes: cf85123a210f ("wifi: iwlwifi: mvm: support enabling and disabling HW timestamping")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230531194630.0fb9f81f1852.Idcc41b67d1fbb421e5ed9bac2177b948b7b4d1c9@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: mvm: remove warning for beacon filtering error
Johannes Berg [Wed, 31 May 2023 16:50:05 +0000 (19:50 +0300)]
wifi: iwlwifi: mvm: remove warning for beacon filtering error

This warning is sometimes happening if we force a FW error
while disconnecting, which is annoying but harmless.

However, it's also pointless to throw a warning here, since
the stack and driver state doesn't really help, so just
remove that so the driver will ignore the error if any.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230531194630.29fe6990d372.I00ff5dc7bfb4025a609f380a0a3911d842b72449@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: remove dead code in iwl_dump_ini_imr_get_size()
Mukesh Sisodiya [Wed, 31 May 2023 16:50:04 +0000 (19:50 +0300)]
wifi: iwlwifi: remove dead code in iwl_dump_ini_imr_get_size()

Remove the check for the IMR debug data size which
leads to dead code.

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230531194630.58eec8d40729.Ifb7d64706eed45726db804f36e785283dff7adab@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: Add Dell to ppag approved list
Alon Giladi [Wed, 31 May 2023 16:50:03 +0000 (19:50 +0300)]
wifi: iwlwifi: Add Dell to ppag approved list

Add 2 new entries for Dell in PPAG approved list.

Signed-off-by: Alon Giladi <alon.giladi@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230531194630.a2696f0538ef.I324e4a0cc4696c27830a490b79c42dfeff8ba074@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: mvm: FTM initiator MLO support
Avraham Stern [Wed, 31 May 2023 16:50:01 +0000 (19:50 +0300)]
wifi: iwlwifi: mvm: FTM initiator MLO support

When checking if the initiator is associated to the responder,
iterate over all active links.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230531194629.a0d86655e7d2.I8f140ca55094da1d73c387fc036394fb2c148c85@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: pcie: adjust Bz device timings
Johannes Berg [Wed, 31 May 2023 16:50:00 +0000 (19:50 +0300)]
wifi: iwlwifi: pcie: adjust Bz device timings

The 100ms shouldn't be needed, only 10ms. However after
reset we should have 10ms as well for these devices.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230531194629.9a5627c1ff18.Ifcfbccd5458bd9ebd496aa834284fb0facfcaaef@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: mvm: offload BTM response during D3
Haim Dreyfuss [Wed, 31 May 2023 16:49:59 +0000 (19:49 +0300)]
wifi: iwlwifi: mvm: offload BTM response during D3

There are mainly two types of BTM (BSS Transition Management)
requests, recommendations and notifications. For the first type,
a response is needed otherwise, most probably the STA will be
disconnected.
Since we don't want to wake up the host on it, set the BTM to reject
offload flag (if the device supports it) and rely on the FW to take
care of it. The FW will reject the BTM request and in case the AP
sends DEAUTH the FW can wake up the host to let it decide on the
next steps.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230531194629.d95ae6f2804c.I9457acc55bc23ce715c714b5088058f52540c224@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: do not log undefined DRAM buffers unnecessarily
Benjamin Berg [Wed, 31 May 2023 16:49:58 +0000 (19:49 +0300)]
wifi: iwlwifi: do not log undefined DRAM buffers unnecessarily

DRAM buffers that are not defined in the TLVs (or are unused in the
preset) would cause a log message. To avoid confusion, skip processing
buffers with an invalid (i.e. uninitialized) DRAM path.

This further reduces the noise of the message in cases where it is
unlikely to be helpful. Also update a related debug log string to better
describe what is happening.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230531194629.ecae60cf2d7f.Ib44a94d4aeb55dbb2e52edea8b69a09bc0f722c3@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: acpi: add other Google OEMs to the ppag approved list
Golan Ben Ami [Wed, 31 May 2023 16:49:57 +0000 (19:49 +0300)]
wifi: iwlwifi: acpi: add other Google OEMs to the ppag approved list

Add two new vendors to the PPAG approved vendor list
as Google OEMs.

Signed-off-by: Golan Ben Ami <golan.ben.ami@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230531194629.b89a3f9e3ae0.Iab1e13285c58ef1fee2a8bad8429eda4547b0b74@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: mvm: clarify EHT RU allocation bits
Johannes Berg [Wed, 31 May 2023 16:49:56 +0000 (19:49 +0300)]
wifi: iwlwifi: mvm: clarify EHT RU allocation bits

Calling this IWL_RX_PHY_DATA1_EHT_B0 is just confusing,
it's the RU allocation bit 0. Also then align the name
for B1-B7 accordingly.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230531194629.824edb28c0eb.Ia9f74573e3ac771911b679558984f1bfb36de674@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: mvm: support injection rate control
Johannes Berg [Wed, 31 May 2023 16:49:55 +0000 (19:49 +0300)]
wifi: iwlwifi: mvm: support injection rate control

Supporting controlling the frame rate during injection,
HT/VHT are supported in addition to legacy rates.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230531194629.85a662792649.I0847b47dec0dfb0290d7b15ebc6bc0a575eed7b5@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: Add vendors to TAS approved list
Alon Giladi [Wed, 31 May 2023 16:49:54 +0000 (19:49 +0300)]
wifi: iwlwifi: Add vendors to TAS approved list

Allows vendors to use the time average sar feature.

Signed-off-by: Alon Giladi <alon.giladi@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230531194629.845c205e4def.Iab5c849617ed7e13304e4dfc7def668659439946@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: iwlmei: fix compilation error
Avraham Stern [Wed, 31 May 2023 08:50:33 +0000 (11:50 +0300)]
wifi: iwlwifi: iwlmei: fix compilation error

The feature is still disabled (depends on BROKEN), but
the code had a compilation error after one of the merges.
Fix that.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230531085033.216028-1-gregory.greenman@intel.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: update response for mcc_update command
Abhishek Naik [Wed, 24 May 2023 17:42:11 +0000 (20:42 +0300)]
wifi: iwlwifi: update response for mcc_update command

Add support for the MCC update response version 8.
Versions 5-6 are already covered by the existing
flags conversion, and 7 isn't used.

The capabilities field in iwl_mcc_update_resp is 32 bits
wide now, and the flags moved, so some more changes are
needed.

While at it, convert the flags to bool (to avoid having
to deal with BIT(16) specially etc.) and use the
struct_size() macro for the memory allocation.

Signed-off-by: Abhishek Naik <abhishek.naik@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230524203151.fd9016f8f994.Ibddcb9fbfa74895f742c0ac20968720691c94853@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: support PPAG in China for older FW cmd version
Alon Giladi [Wed, 24 May 2023 17:42:10 +0000 (20:42 +0300)]
wifi: iwlwifi: support PPAG in China for older FW cmd version

Allows the China bit in the ppag flags to turn on also when
FW cmd version is 1 (if FW has the capability).

Signed-off-by: Alon Giladi <alon.giladi@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230524203151.3cc19e799eeb.I9054b1d63fd7ae2b5f0e416825b4b1dc9f79cc80@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: mvm: remove useless code
Johannes Berg [Wed, 24 May 2023 17:42:09 +0000 (20:42 +0300)]
wifi: iwlwifi: mvm: remove useless code

Setting the station to -EBUSY was originally done under
this lock, and the comment still refers to it. But this
no longer happens because that was removed when DQA was
removed. Remove the leftover code as well.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230524203151.30048b1cd0fd.Ie2c2ff6fd7c6e3ebf5b736de350dc15515970792@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: disable RX STBC when a device doesn't support it
Gregory Greenman [Wed, 24 May 2023 17:42:08 +0000 (20:42 +0300)]
wifi: iwlwifi: disable RX STBC when a device doesn't support it

Some devices, like step A0 of GL FM device doesn't support RX STBC
for VHT/HE. Add a workaround to remove it from capabilities in
this case.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230524203151.65c3e09813e5.Iadfd8cdb0ea5a8088ae3daa555c780c423951894@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: fw: Add new ODM vendor to ppag approved list
Ariel Malamud [Wed, 24 May 2023 17:42:07 +0000 (20:42 +0300)]
wifi: iwlwifi: fw: Add new ODM vendor to ppag approved list

Add new oem/odm pair to ppag approved vendors list
when specified by platform.

Signed-off-by: Ariel Malamud <ariel.malamud@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230524203151.549a57a1cf11.I7392b1cd31f4f7ee60aafe2093f4e82b1d6fd3a7@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: mvm: adjust csa notifications and commands to MLO
Gregory Greenman [Wed, 24 May 2023 17:42:06 +0000 (20:42 +0300)]
wifi: iwlwifi: mvm: adjust csa notifications and commands to MLO

In the following notifications and commands mac_id was replaced
with link_id:
* CANCEL_CHANNEL_SWITCH_CMD
* CHANNEL_SWITCH_START_NOTIF
* CHANNEL_SWITCH_ERROR_NOTIF

The logic around was not changed, so only adjust handling
mac/link id.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230524203151.6aa6e394f5fe.Ie9e78918511ca901f9f3966d774fa74a71a186e3@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: mvm: update the FW apis for LINK and MAC commands
Emmanuel Grumbach [Wed, 24 May 2023 17:42:05 +0000 (20:42 +0300)]
wifi: iwlwifi: mvm: update the FW apis for LINK and MAC commands

The firmware added new fields to be able to pass the link_id as the AP
knows it and the esr_transition_timeout.
For now, pass only the link_id since we don't have access to the
esr_transition_timeout yet.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230524203151.bf80ce717458.Icd4174911227c00cd12783fe1f517ae8097809b9@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: mvm: Make iwl_mvm_diversity_iter() MLO aware
Miri Korenblit [Wed, 24 May 2023 17:42:04 +0000 (20:42 +0300)]
wifi: iwlwifi: mvm: Make iwl_mvm_diversity_iter() MLO aware

This function is MLO related, so it should iterate over all the links,
and not only on deflink.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230524203151.56a9c709e987.I9716195ec288cce2c929338c254ee9add8cfcc1f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: don't silently ignore missing suspend or resume ops
Haim Dreyfuss [Wed, 24 May 2023 17:42:03 +0000 (20:42 +0300)]
wifi: iwlwifi: don't silently ignore missing suspend or resume ops

In case the driver doesn't implement suspend or resume operations
on the transport layer, notify the driver's upper layer.
Otherwise, we might access d3_status uninitialized.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230524203151.0c55e0ca92f1.I6870fe1683215e65d3d036f9b576b03b7b7257be@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: mvm: support PASN for MLO
Avraham Stern [Wed, 24 May 2023 17:42:02 +0000 (20:42 +0300)]
wifi: iwlwifi: mvm: support PASN for MLO

When adding a PASN station, the non MLD API was used. This results
in assert when operating as MLD. Fix it to use the MLD API when
operating as MLD. For now, the default link is used for the added
station.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230524203151.7c35dccc8a12.I7bc78cd16d7c750f42fdd60e07e839a860d279d2@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: mvm: dissolve iwl_mvm_mac_add_interface_common()
Johannes Berg [Wed, 24 May 2023 17:42:01 +0000 (20:42 +0300)]
wifi: iwlwifi: mvm: dissolve iwl_mvm_mac_add_interface_common()

This wasn't really common anymore, so dissolve it, it has a
pretty strange calling convention that's confusing.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230524203151.44320ab2e842.Ie1d6b9c28caca3b541ca383a4c0c8799b0e72fe0@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: mvm: make internal callback structs const
Johannes Berg [Wed, 24 May 2023 17:42:00 +0000 (20:42 +0300)]
wifi: iwlwifi: mvm: make internal callback structs const

There's no need for these to be writable, so they can
be const (and static).

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230524203151.c41eb6687868.I2dac1158e5723187bda1973aa49fde8a794621c8@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: mvm: use link ID in missed beacon notification
Yedidya Benshimol [Wed, 24 May 2023 17:41:59 +0000 (20:41 +0300)]
wifi: iwlwifi: mvm: use link ID in missed beacon notification

This new version of missed beacon notification uses link_id
instead of mac_id. Also add an option to use link id for
retrieving vif.

Signed-off-by: Yedidya Benshimol <yedidya.ben.shimol@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230524203151.17fe1cc632f1.Id1fabb532e2174712fe17d4ad86a2c8c64ae84da@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: cfg: freeze 22500 devices FW API
Golan Ben Ami [Wed, 24 May 2023 17:41:58 +0000 (20:41 +0300)]
wifi: iwlwifi: cfg: freeze 22500 devices FW API

FW version is now frozen for 22500 devices. Don't
allow newer versions in the driver.

Signed-off-by: Golan Ben Ami <golan.ben.ami@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230524203151.8a25ebf9134c.I3f1454498322ce28cb687d28c091c7ee092cefca@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: iwlwifi: mvm: Fix -Warray-bounds bug in iwl_mvm_wait_d3_notif()
Gustavo A. R. Silva [Fri, 2 Jun 2023 19:42:47 +0000 (13:42 -0600)]
wifi: iwlwifi: mvm: Fix -Warray-bounds bug in iwl_mvm_wait_d3_notif()

kmemdup() at line 2735 is not duplicating enough memory for
notif->tid_tear_down and notif->station_id. As it only duplicates
612 bytes: up to offsetofend(struct iwl_wowlan_info_notif,
received_beacons), this is the range of [0, 612) bytes.

2735 notif = kmemdup(notif_v1,
2736 offsetofend(struct iwl_wowlan_info_notif,
2737     received_beacons),
2738 GFP_ATOMIC);

which evidently does not cover bytes 612 and 613 for members
tid_tear_down and station_id in struct iwl_wowlan_info_notif.
See below:

$ pahole -C iwl_wowlan_info_notif drivers/net/wireless/intel/iwlwifi/mvm/d3.o
struct iwl_wowlan_info_notif {
struct iwl_wowlan_gtk_status_v3 gtk[2];          /*     0   488 */
/* --- cacheline 7 boundary (448 bytes) was 40 bytes ago --- */
struct iwl_wowlan_igtk_status igtk[2];           /*   488    80 */
/* --- cacheline 8 boundary (512 bytes) was 56 bytes ago --- */
__le64                     replay_ctr;           /*   568     8 */
/* --- cacheline 9 boundary (576 bytes) --- */
__le16                     pattern_number;       /*   576     2 */
__le16                     reserved1;            /*   578     2 */
__le16                     qos_seq_ctr[8];       /*   580    16 */
__le32                     wakeup_reasons;       /*   596     4 */
__le32                     num_of_gtk_rekeys;    /*   600     4 */
__le32                     transmitted_ndps;     /*   604     4 */
__le32                     received_beacons;     /*   608     4 */
u8                         tid_tear_down;        /*   612     1 */
u8                         station_id;           /*   613     1 */
u8                         reserved2[2];         /*   614     2 */

/* size: 616, cachelines: 10, members: 13 */
/* last cacheline: 40 bytes */
};

Therefore, when the following assignments take place, actually no memory
has been allocated for those objects:

2743 notif->tid_tear_down = notif_v1->tid_tear_down;
2744 notif->station_id = notif_v1->station_id;

Fix this by allocating space for the whole notif object and zero out the
remaining space in memory after member station_id.

This also fixes the following -Warray-bounds issues:
 CC      drivers/net/wireless/intel/iwlwifi/mvm/d3.o
drivers/net/wireless/intel/iwlwifi/mvm/d3.c: In function â€˜iwl_mvm_wait_d3_notif’:
drivers/net/wireless/intel/iwlwifi/mvm/d3.c:2743:30: warning: array subscript â€˜struct iwl_wowlan_info_notif[0]’ is partly outside array bounds of â€˜unsigned char[612]’ [-Warray-bounds=]
 2743 |                         notif->tid_tear_down = notif_v1->tid_tear_down;
      |
                 from drivers/net/wireless/intel/iwlwifi/mvm/d3.c:7:
In function â€˜kmemdup’,
    inlined from â€˜iwl_mvm_wait_d3_notif’ at drivers/net/wireless/intel/iwlwifi/mvm/d3.c:2735:12:
include/linux/fortify-string.h:765:16: note: object of size 612 allocated by â€˜__real_kmemdup’
  765 |         return __real_kmemdup(p, size, gfp);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/wireless/intel/iwlwifi/mvm/d3.c: In function â€˜iwl_mvm_wait_d3_notif’:
drivers/net/wireless/intel/iwlwifi/mvm/d3.c:2744:30: warning: array subscript â€˜struct iwl_wowlan_info_notif[0]’ is partly outside array bounds of â€˜unsigned char[612]’ [-Warray-bounds=]
 2744 |                         notif->station_id = notif_v1->station_id;
      |                              ^~
In function â€˜kmemdup’,
    inlined from â€˜iwl_mvm_wait_d3_notif’ at drivers/net/wireless/intel/iwlwifi/mvm/d3.c:2735:12:
include/linux/fortify-string.h:765:16: note: object of size 612 allocated by â€˜__real_kmemdup’
  765 |         return __real_kmemdup(p, size, gfp);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link: https://github.com/KSPP/linux/issues/306
Fixes: 905d50ddbc83 ("wifi: iwlwifi: mvm: support wowlan info notification version 2")
Cc: stable@vger.kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Acked-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/ZHpGN555FwAKGduH@work
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: mac80211: fix switch count in EMA beacons
Aditya Kumar Singh [Wed, 31 May 2023 06:20:12 +0000 (11:50 +0530)]
wifi: mac80211: fix switch count in EMA beacons

Currently, whenever an EMA beacon is formed, due to is_template
argument being false from the caller, the switch count is always
decremented once which is wrong.

Also if switch count is equal to profile periodicity, this makes
the switch count to reach till zero which triggers a WARN_ON_ONCE.

[  261.593915] CPU: 1 PID: 800 Comm: kworker/u8:3 Not tainted 5.4.213 #0
[  261.616143] Hardware name: Qualcomm Technologies, Inc. IPQ9574
[  261.622666] Workqueue: phy0 ath12k_get_link_bss_conf [ath12k]
[  261.629771] pstate: 60400005 (nZCv daif +PAN -UAO)
[  261.635595] pc : ieee80211_next_txq+0x1ac/0x1b8 [mac80211]
[  261.640282] lr : ieee80211_beacon_update_cntdwn+0x64/0xb4 [mac80211]
[...]
[  261.729683] Call trace:
[  261.734986]  ieee80211_next_txq+0x1ac/0x1b8 [mac80211]
[  261.737156]  ieee80211_beacon_cntdwn_is_complete+0xa28/0x1194 [mac80211]
[  261.742365]  ieee80211_beacon_cntdwn_is_complete+0xef4/0x1194 [mac80211]
[  261.749224]  ieee80211_beacon_get_template_ema_list+0x38/0x5c [mac80211]
[  261.755908]  ath12k_get_link_bss_conf+0xf8/0x33b4 [ath12k]
[  261.762590]  ath12k_get_link_bss_conf+0x390/0x33b4 [ath12k]
[  261.767881]  process_one_work+0x194/0x270
[  261.773346]  worker_thread+0x200/0x314
[  261.777514]  kthread+0x140/0x150
[  261.781158]  ret_from_fork+0x10/0x18

Fix this issue by making the is_template argument as true when fetching
the EMA beacons.

Fixes: bd54f3c29077 ("wifi: mac80211: generate EMA beacons in AP mode")
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
Link: https://lore.kernel.org/r/20230531062012.4537-1-quic_adisi@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: mac80211: don't translate beacon/presp addrs
Johannes Berg [Sun, 4 Jun 2023 09:11:15 +0000 (12:11 +0300)]
wifi: mac80211: don't translate beacon/presp addrs

Don't do link address translation for beacons and probe responses,
this leads to reporting multiple scan list entries for the same AP
(one with the MLD address) which just breaks things.

We might need to extend this in the future for some other (action)
frames that aren't MLD addressed.

Fixes: 42fb9148c078 ("wifi: mac80211: do link->MLD address translation on RX")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230604120651.62adead1b43a.Ifc25eed26ebf3b269f60b1ec10060156d0e7ec0d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: mac80211: mlme: fix non-inheritence element
Johannes Berg [Sun, 4 Jun 2023 09:11:16 +0000 (12:11 +0300)]
wifi: mac80211: mlme: fix non-inheritence element

There were two bugs when creating the non-inheritence
element:
 1) 'at_extension' needs to be declared outside the loop,
    otherwise the value resets every iteration and we
    can never really switch properly
 2) 'added' never got set to true, so we always cut off
    the extension element again at the end of the function

This shows another issue that we might add a list but no
extension list, but we need to make the extension list a
zero-length one in that case.

Fix all these issues. While at it, add a comment explaining
the trim.

Fixes: 81151ce462e5 ("wifi: mac80211: support MLO authentication/association with one link")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230604120651.3addaa5c4782.If3a78f9305997ad7ef4ba7ffc17a8234c956f613@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: cfg80211: reject bad AP MLD address
Johannes Berg [Sun, 4 Jun 2023 09:11:18 +0000 (12:11 +0300)]
wifi: cfg80211: reject bad AP MLD address

When trying to authenticate, if the AP MLD address isn't
a valid address, mac80211 can throw a warning. Avoid that
by rejecting such addresses.

Fixes: d648c23024bd ("wifi: nl80211: support MLO in auth/assoc")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230604120651.89188912bd1d.I8dbc6c8ee0cb766138803eec59508ef4ce477709@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: mac80211: use correct iftype HE cap
Johannes Berg [Sun, 4 Jun 2023 09:11:23 +0000 (12:11 +0300)]
wifi: mac80211: use correct iftype HE cap

We already check that the right iftype capa exists,
but then don't use it. Assign it to a variable so we
can actually use it, and then do that.

Fixes: bac2fd3d7534 ("mac80211: remove use of ieee80211_get_he_sta_cap()")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230604120651.0e908e5c5fdd.Iac142549a6144ac949ebd116b921a59ae5282735@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 months agowifi: mt76: mt7996: fix possible NULL pointer dereference in mt7996_mac_write_txwi()
Lorenzo Bianconi [Sun, 28 May 2023 10:28:49 +0000 (12:28 +0200)]
wifi: mt76: mt7996: fix possible NULL pointer dereference in mt7996_mac_write_txwi()

Fix possible NULL pointer dereference on mvif pointer in
mt7996_mac_write_txwi routine.

Fixes: 15ee62e73705 ("wifi: mt76: mt7996: enable BSS_CHANGED_BASIC_RATES support")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/2637628a84f42ad6d7b774e706f041d5b45c8cb5.1685269638.git.lorenzo@kernel.org
17 months agowifi: rtw89: remove redundant check of entering LPS
Ping-Ke Shih [Sat, 27 May 2023 08:29:39 +0000 (16:29 +0800)]
wifi: rtw89: remove redundant check of entering LPS

Originally, add this check rule to prevent entering LPS if more than one
vif (in station mode) connect to AP. Since we have checked this by previous
commit, remove this redundant check.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230527082939.11206-4-pkshih@realtek.com
17 months agowifi: rtw89: correct PS calculation for SUPPORTS_DYNAMIC_PS
Ping-Ke Shih [Sat, 27 May 2023 08:29:38 +0000 (16:29 +0800)]
wifi: rtw89: correct PS calculation for SUPPORTS_DYNAMIC_PS

This driver relies on IEEE80211_CONF_PS of hw->conf.flags to turn off PS or
turn on dynamic PS controlled by driver and firmware. Though this would be
incorrect, it did work before because the flag is always recalculated until
the commit 28977e790b5d ("wifi: mac80211: skip powersave recalc if driver SUPPORTS_DYNAMIC_PS")
is introduced by kernel 5.20 to skip to recalculate IEEE80211_CONF_PS
of hw->conf.flags if driver sets SUPPORTS_DYNAMIC_PS.

Correct this by doing recalculation while BSS_CHANGED_PS is changed and
interface is added or removed. For now, it is allowed to enter PS only if
single one station vif is working, and it could possible to have PS per
vif after firmware can support it. Without this fix, driver doesn't
enter PS anymore that causes higher power consumption.

Fixes: e3ec7017f6a2 ("rtw89: add Realtek 802.11ax driver")
Cc: stable@vger.kernel.org # 6.1+
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230527082939.11206-3-pkshih@realtek.com
17 months agowifi: rtw88: correct PS calculation for SUPPORTS_DYNAMIC_PS
Ping-Ke Shih [Sat, 27 May 2023 08:29:37 +0000 (16:29 +0800)]
wifi: rtw88: correct PS calculation for SUPPORTS_DYNAMIC_PS

This driver relies on IEEE80211_CONF_PS of hw->conf.flags to turn off PS or
turn on dynamic PS controlled by driver and firmware. Though this would be
incorrect, it did work before because the flag is always recalculated until
the commit 28977e790b5d ("wifi: mac80211: skip powersave recalc if driver SUPPORTS_DYNAMIC_PS")
is introduced by kernel 5.20 to skip to recalculate IEEE80211_CONF_PS
of hw->conf.flags if driver sets SUPPORTS_DYNAMIC_PS.

Correct this by doing recalculation while BSS_CHANGED_PS is changed and
interface is added or removed. It is allowed to enter PS only if single
one station vif is working. Without this fix, driver doesn't enter PS
anymore that causes higher power consumption.

Fixes: bcde60e599fb ("rtw88: remove misleading module parameter rtw_fw_support_lps")
Cc: stable@vger.kernel.org # 6.1+
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230527082939.11206-2-pkshih@realtek.com
17 months agowifi: brcmutil: use helper function pktq_empty() instead of open code
Juhee Kang [Sat, 27 May 2023 11:49:54 +0000 (20:49 +0900)]
wifi: brcmutil: use helper function pktq_empty() instead of open code

pktq_empty was added in commit 5b435de0d786 ("net: wireless: add brcm80211
drivers") but it is currently not being utilized in some areas. This commit
replaces the open code with the pktq_empty() function.

Signed-off-by: Juhee Kang <claudiajkang@gmail.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230527114954.3281-2-claudiajkang@gmail.com
17 months agowifi: rtlwifi: use helper function rtl_get_hdr()
Juhee Kang [Sat, 27 May 2023 11:49:53 +0000 (20:49 +0900)]
wifi: rtlwifi: use helper function rtl_get_hdr()

Although rtl_get_hdr was added in commit 3dad618b7b92 ("rtlwifi: Change
wifi.h for rtl8192se and rtl8192de"), it is currently not being utilized
in some areas. This commit replaces the open code with the rtl_get_hdr()
function.

Signed-off-by: Juhee Kang <claudiajkang@gmail.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230527114954.3281-1-claudiajkang@gmail.com
17 months agowifi: rtw88: usb: silence log flooding error message
Sascha Hauer [Wed, 24 May 2023 10:39:34 +0000 (12:39 +0200)]
wifi: rtw88: usb: silence log flooding error message

When receiving more rx packets than the kernel can handle the driver
drops the packets and issues an error message. This is bad for two
reasons. The logs are flooded with myriads of messages, but then time
consumed for printing messages in that critical code path brings down
the device. After some time of excessive rx load the driver responds
with:

rtw_8822cu 1-1:1.2: failed to get tx report from firmware
rtw_8822cu 1-1:1.2: firmware failed to report density after scan
rtw_8822cu 1-1:1.2: firmware failed to report density after scan

The device stops working until being replugged.

Fix this by lowering the priority to debug level and also by
ratelimiting it.

Fixes: a82dfd33d1237 ("wifi: rtw88: Add common USB chip support")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230524103934.1019096-1-s.hauer@pengutronix.de
17 months agowifi: ray_cs: add sanity check on local->sram/rmem/amem
Dongliang Mu [Thu, 16 Mar 2023 13:32:36 +0000 (21:32 +0800)]
wifi: ray_cs: add sanity check on local->sram/rmem/amem

The ray_config uses ray_release as its unified error handling function.
However, it does not know if local->sram/rmem/amem succeeds or not.

Fix this by adding sanity check on local->sram/rmem/amem in the
ray_relase.

Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230316133236.556198-3-dzm91@hust.edu.cn
17 months agowifi: ray_cs: remove one redundant del_timer
Dongliang Mu [Thu, 16 Mar 2023 13:32:35 +0000 (21:32 +0800)]
wifi: ray_cs: remove one redundant del_timer

In ray_detach, it and its child function ray_release both call
del_timer(_sync) on the same timer.

Fix this by removing the del_timer_sync in the ray_detach, and revising
the del_timer to del_timer_sync.

Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230316133236.556198-2-dzm91@hust.edu.cn
17 months agowifi: mt76: mt7615: fix possible race in mt7615_mac_sta_poll
Lorenzo Bianconi [Wed, 24 May 2023 14:39:32 +0000 (16:39 +0200)]
wifi: mt76: mt7615: fix possible race in mt7615_mac_sta_poll

Grab sta_poll_lock spinlock in mt7615_mac_sta_poll routine in order to
avoid possible races with mt7615_mac_add_txs() or mt7615_mac_fill_rx()
removing msta pointer from sta_poll_list.

Fixes: a621372a04ac ("mt76: mt7615: rework mt7615_mac_sta_poll for usb code")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/48b23404b759de4f1db2ef85975c72a4aeb1097c.1684938695.git.lorenzo@kernel.org
17 months agowifi: ray_cs: Fix an error handling path in ray_probe()
Christophe JAILLET [Sat, 20 May 2023 08:13:22 +0000 (10:13 +0200)]
wifi: ray_cs: Fix an error handling path in ray_probe()

Should ray_config() fail, some resources need to be released as already
done in the remove function.

While at it, remove a useless and erroneous comment. The probe is
ray_probe(), not ray_attach().

Fixes: 15b99ac17295 ("[PATCH] pcmcia: add return value to _config() functions")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/8c544d18084f8b37dd108e844f7e79e85ff708ff.1684570373.git.christophe.jaillet@wanadoo.fr
17 months agowifi: wl3501_cs: Fix an error handling path in wl3501_probe()
Christophe JAILLET [Sat, 20 May 2023 08:05:08 +0000 (10:05 +0200)]
wifi: wl3501_cs: Fix an error handling path in wl3501_probe()

Should wl3501_config() fail, some resources need to be released as already
done in the remove function.

Fixes: 15b99ac17295 ("[PATCH] pcmcia: add return value to _config() functions")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/7cc9c9316489b7d69b36aeb0edd3123538500b41.1684569865.git.christophe.jaillet@wanadoo.fr
17 months agowifi: atmel: Fix an error handling path in atmel_probe()
Christophe JAILLET [Sat, 20 May 2023 07:53:14 +0000 (09:53 +0200)]
wifi: atmel: Fix an error handling path in atmel_probe()

Should atmel_config() fail, some resources need to be released as already
done in the remove function.

While at it, remove a useless and erroneous comment. The probe is
atmel_probe(), not atmel_attach().

Fixes: 15b99ac17295 ("[PATCH] pcmcia: add return value to _config() functions")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/1e65f174607a83348034197fa7d603bab10ba4a9.1684569156.git.christophe.jaillet@wanadoo.fr
17 months agowifi: orinoco: Fix an error handling path in orinoco_cs_probe()
Christophe JAILLET [Sat, 20 May 2023 07:38:22 +0000 (09:38 +0200)]
wifi: orinoco: Fix an error handling path in orinoco_cs_probe()

Should orinoco_cs_config() fail, some resources need to be released as
already done in the remove function.

While at it, remove a useless and erroneous comment. The probe is
orinoco_cs_probe(), not orinoco_cs_attach().

Fixes: 15b99ac17295 ("[PATCH] pcmcia: add return value to _config() functions")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/e24735ce4d82901d5f7ea08419eea53bfdde3d65.1684568286.git.christophe.jaillet@wanadoo.fr
17 months agowifi: orinoco: Fix an error handling path in spectrum_cs_probe()
Christophe JAILLET [Sat, 20 May 2023 07:29:46 +0000 (09:29 +0200)]
wifi: orinoco: Fix an error handling path in spectrum_cs_probe()

Should spectrum_cs_config() fail, some resources need to be released as
already done in the remove function.

While at it, remove a useless and erroneous comment. The probe is
spectrum_cs_probe(), not spectrum_cs_attach().

Fixes: 15b99ac17295 ("[PATCH] pcmcia: add return value to _config() functions")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/c0bc0c21c58ca477fc5521607615bafbf2aef8eb.1684567733.git.christophe.jaillet@wanadoo.fr
17 months agowifi: rtw89: use flexible array member in rtw89_btc_btf_tlv
Arnd Bergmann [Tue, 23 May 2023 11:32:35 +0000 (13:32 +0200)]
wifi: rtw89: use flexible array member in rtw89_btc_btf_tlv

struct rtw89_btc_btf_tlv contains a one-byte member that is intended as a
flexible array:

In function 'fortify_memcpy_chk',
    inlined from '_append_tdma' at drivers/net/wireless/realtek/rtw89/coex.c:1579:3:
include/linux/fortify-string.h:583:25: error: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror=attribute-warning]
  583 |                         __write_overflow_field(p_size_field, size);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Make this actually use a flexible array to let the compiler understand.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230523113241.2772811-1-arnd@kernel.org
17 months agowifi: rtw89: 8851b: rfk: Fix spelling mistake KIP_RESOTRE -> KIP_RESTORE
Colin Ian King [Mon, 22 May 2023 08:59:24 +0000 (09:59 +0100)]
wifi: rtw89: 8851b: rfk: Fix spelling mistake KIP_RESOTRE -> KIP_RESTORE

There is a spelling mistake in a literal string. Fix it.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230522085924.913649-1-colin.i.king@gmail.com
17 months agowifi: rtw89: use struct to access register-based H2C/C2H
Ping-Ke Shih [Mon, 22 May 2023 12:25:13 +0000 (20:25 +0800)]
wifi: rtw89: use struct to access register-based H2C/C2H

The register-based H2C/C2H are used to exchange commands and events with
firmware. The exchange data is limited, but it is relatively simple,
because it can work before HCI initialization. To make these code clean,
use struct to access them. This patch doesn't change logic at all.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230522122513.13559-6-pkshih@realtek.com
17 months agowifi: rtw89: use struct and le32_get_bits() to access RX descriptor
Ping-Ke Shih [Mon, 22 May 2023 12:25:12 +0000 (20:25 +0800)]
wifi: rtw89: use struct and le32_get_bits() to access RX descriptor

RX descriptor is to provide basic and important information related to
packets, such as packet size, security, MAC ID and so on. Change to use
struct to access these fields, and not change logic at all.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230522122513.13559-5-pkshih@realtek.com
17 months agowifi: rtw89: use struct and le32_get_bits() to access received PHY status IEs
Ping-Ke Shih [Mon, 22 May 2023 12:25:11 +0000 (20:25 +0800)]
wifi: rtw89: use struct and le32_get_bits() to access received PHY status IEs

PHY status IEs generated by BB hardware is to provide more detail
information related to received packets, such as RSSI and bandwidth.

To avoid type casting, change buf type from u8* to void* as well.

This patch doesn't change logic at all.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230522122513.13559-4-pkshih@realtek.com
17 months agowifi: rtw89: use struct and le32_get_bits to access RX info
Ping-Ke Shih [Mon, 22 May 2023 12:25:10 +0000 (20:25 +0800)]
wifi: rtw89: use struct and le32_get_bits to access RX info

If received packet type is PPDU status, RX info provides information
attached by MAC hardware, and mention how long BB information attached.

This conversion patch doesn't change logic at all.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230522122513.13559-3-pkshih@realtek.com
17 months agowifi: rtw89: add chip_ops::query_rxdesc() and rxd_len as helpers to support newer...
Ping-Ke Shih [Mon, 22 May 2023 12:25:09 +0000 (20:25 +0800)]
wifi: rtw89: add chip_ops::query_rxdesc() and rxd_len as helpers to support newer chips

The next generation chips use different RX descriptor format, so add
a chip_ops to hook suitable handlers. Also, the length of RX descriptor is
different, so add a variable to store the length according to chip and
descriptor content dynamically. Then, the code can be more general.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230522122513.13559-2-pkshih@realtek.com
17 months agowifi: rtw89: 8851b: add 8851be to Makefile and Kconfig
Ping-Ke Shih [Fri, 19 May 2023 03:15:00 +0000 (11:15 +0800)]
wifi: rtw89: 8851b: add 8851be to Makefile and Kconfig

Since 8851BE is ready, so add 8851BE to Makefile and Kconfig. Currently,
it can support STA, AP and monitor modes with good performance.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230519031500.21087-8-pkshih@realtek.com
17 months agowifi: rtw89: add tx_wake notify for 8851B
Chin-Yen Lee [Fri, 19 May 2023 03:14:59 +0000 (11:14 +0800)]
wifi: rtw89: add tx_wake notify for 8851B

8851B has the same issue: management frames get stuck when WiFi
chip enters low PS mode, so we also add notify wake function to
trigger WiFi chip wake before forwarding management frames.

Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230519031500.21087-7-pkshih@realtek.com