platform/kernel/linux-rpi.git
15 months agowifi: iwlwifi: mvm: replace bss_info_changed() with vif_cfg/link_info_changed()
Gregory Greenman [Tue, 28 Mar 2023 07:59:04 +0000 (10:59 +0300)]
wifi: iwlwifi: mvm: replace bss_info_changed() with vif_cfg/link_info_changed()

These are two new handlers for MLO. As the configurations done in
bss_info_changed() are now split into two separate flows, use MLO
specific implementation instead of common functions with the non-MLO
code.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.7b238cae0895.Ieb87f204787fb1c7cb7562e1cbf54ef518d87123@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: add link_conf parameter for add/remove/change link
Gregory Greenman [Tue, 28 Mar 2023 07:59:03 +0000 (10:59 +0300)]
wifi: iwlwifi: mvm: add link_conf parameter for add/remove/change link

Add link_conf parameter and change all the relevant calls accordingly.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.374015eed2e3.Icbf15a18e2599b53f4fa1c92fe3db64b551b84b1@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: don't check dtim_period in new API
Johannes Berg [Tue, 28 Mar 2023 07:59:02 +0000 (10:59 +0300)]
wifi: iwlwifi: mvm: don't check dtim_period in new API

In newer firmware APIs the firmware is responsible for tracking
the DTIM period and other beacon timing, so we don't need to
wait with setting associated. In real MLO operation, mac80211
isn't tracking this anyway, and connections wouldn't work.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.02354241fede.Id957bed3851fdf1fe902d79a1b0338c6d80bc0e1@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: adjust SMPS for MLO
Gregory Greenman [Tue, 28 Mar 2023 07:59:01 +0000 (10:59 +0300)]
wifi: iwlwifi: mvm: adjust SMPS for MLO

Configure SMPS per-link. Add link_id parameter to
iwl_mvm_update_smps() and refactor iwl_mvm_intf_dual_chain_req()
since it has to handle all active links.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.da6a19db562c.Ic88b02338c8973f2934439ac3ee77c7451bc0054@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: add set_hw_timestamp to mld ops
Avraham Stern [Tue, 28 Mar 2023 07:59:00 +0000 (10:59 +0300)]
wifi: iwlwifi: mvm: add set_hw_timestamp to mld ops

In mld ops, set_hw_timestamp was not set. Fix it.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.7b24a582b763.Ieb3139d41f1a01b2b566adecd32450da1bcdd5fa@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: add link to firmware earlier
Johannes Berg [Tue, 28 Mar 2023 07:58:59 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: add link to firmware earlier

The firmware now allows adding a link that's not yet bound
to a PHY context. Make use of that to align the driver with
mac80211's API expectations. For now, just add the link at
the same time as the MAC since we don't yet have real MLD
support, but that'll obviously change later. This fixes an
issue with apStaId tracking in the firmware.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.097e5008b637.I4e75c6c11e21c08d28ff6a066be36629d3975db6@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: adjust some PS and PM methods to MLD
Gregory Greenman [Tue, 28 Mar 2023 07:58:58 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: adjust some PS and PM methods to MLD

When using mvm vif PS/PM related properties, consider all links.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.8d9e18f7d74b.I048fc17405ecdddc1f6fe72859013cc4878b2a3b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: adjust mld_mac_ctxt_/beacon_changed() for MLO
Gregory Greenman [Tue, 28 Mar 2023 07:58:57 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: adjust mld_mac_ctxt_/beacon_changed() for MLO

HE/EHT support is reported to FW if there's at least one link
that supports it. Configure beacon separately for each link.
Don't send the beacon template before adding the MAC.

Co-developed-by: Johannes Berg <johannes.berg@intel.com>
Co-developed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.5ef4efeda2dd.I6ebda2b71c964b9aa63240c9fa1ee0d28099fe6e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: adjust smart fifo configuration to MLO
Gregory Greenman [Tue, 28 Mar 2023 07:58:56 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: adjust smart fifo configuration to MLO

Consider properties of all available links for smart FIFO
configuration.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.870ff175b82c.Iada56a474a0770ae5469b31d635cc05405dbfb87@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: align to the LINK cmd update in the FW
Miri Korenblit [Tue, 28 Mar 2023 07:58:55 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: align to the LINK cmd update in the FW

The LINK cmd host api has been updated. Align the driver to the
new changes. Also, temporary use mac_id for link_id.
Using the phy_id as the link_id is wrong since we might have 2 macs
operating on the same phy - in this case we will have 2 different
links (one for each mac) with the same link_id. On the other hand,
since we don't have MLO implemented yet, we won't have 2 different
links of the same mac. Therefore, we can use the mac_id as the
link_id.

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/20230328104948.78ae716884fe.Icfeb2794d9652baaccf9b0cdddbd751d0db4f952@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: always use the sta->addr as the peers addr
Miri Korenblit [Tue, 28 Mar 2023 07:58:54 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: always use the sta->addr as the peers addr

Currently we're setting the sta->addr as the peers address only if
the iftype is NL80211_IFTYPE_AP, otherwise we are setting the bssid to
be the addr. This causes bugs in TDLS. Fix this by always using the
sta->addr.

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/20230328104948.4c104c3074c4.I78912bb85251033e60db99a65165890779203612@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: modify link instead of removing it during csa
Miri Korenblit [Tue, 28 Mar 2023 07:58:53 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: modify link instead of removing it during csa

During CSA the PHY used by the link is changing, So the driver
needs to modify the links phy to the FW. Currently the driver is doing
it by removing the link and adding a new one with the new phy_id, but the
FW expects the link only to be modified. Fix this by modifying the links
phy_id instead of removing it and adding a new one

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/20230328104948.c07ca7aace29.I4ed5c77f4afe1b5da19322734e2f84d51aa541ad@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: fix crash on queue removal for MLD API too
Miri Korenblit [Tue, 28 Mar 2023 07:58:52 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: fix crash on queue removal for MLD API too

The patch linked below fixes the crash on queue removal bug only
for the non-MLD API. Do the same for the MLD API.

Fixes: c5a976cf6a75 ("wifi: iwlwifi: modify new queue allocation command")
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/20230328104948.527dace26147.Ia215df5833634f95688a979f39fae70c1ac4e027@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: fix "modify_mask" value in the link cmd.
Miri Korenblit [Tue, 28 Mar 2023 07:58:51 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: fix "modify_mask" value in the link cmd.

This bitmap indicates what fields of the cmd got changed.
A field will be ignored by the FW if the corresponding flag wasn't set.
There are a few cases in which we currently set the wrong bits when
sending this cmd, which caused FW asserts. Fix this by setting the
correct bits in each case.

Fixes: 1ab26632332e ("wifi: iwlwifi: mvm: Add an add_interface() callback for mld mode")
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/20230328104948.19ddbee0c98d.I595abb79d0419c9a21e5234303c2c3fd5290a52a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: add all missing ops to iwl_mvm_mld_ops
Miri Korenblit [Tue, 28 Mar 2023 07:58:50 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: add all missing ops to iwl_mvm_mld_ops

Add all the callbacks that are not changing with the
new MLD API and register to mac80211 with the new ops.

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/20230328104948.a2f724342522.I5d1d6a8f5f14e6275da56ea704c3c0063fee5226@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: add support for post_channel_switch in MLD mode
Miri Korenblit [Tue, 28 Mar 2023 07:58:49 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: add support for post_channel_switch in MLD mode

Adjust the existing iwl_mvm_post_channel_switch()
to the new MLD API and use it in the new MLD ieee80211_ops

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/20230328104948.fa3992f7dfd2.Ie298a9b1522e956d7b699f0432795548bc6e47f9@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: unite sta_modify_disable_tx flows
Miri Korenblit [Tue, 28 Mar 2023 07:58:48 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: unite sta_modify_disable_tx flows

These flows are the same in both MLD API and the current API,
except for the commands that are being sent during this flows.
Instead of checking each time before calling these floews
what API we use and then call the correct function, call always the old
one, which in turn will call the new one in case we're using the MLD
API.

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/20230328104948.5692d8dea9be.Ib1882b2c2f0b0603abc4b7d4a0ecc45cd1fbf9a7@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: add cancel/remain_on_channel for MLD mode
Miri Korenblit [Tue, 28 Mar 2023 07:58:47 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: add cancel/remain_on_channel for MLD mode

Add an MLD version of the remain_on_channel and
cancel_remain_on_channel callbacks.

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/20230328104948.b51813dbebd4.Ia25bbd63d3138e4759237ce2be0cd0436fe01c0a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: refactor iwl_mvm_roc()
Miri Korenblit [Tue, 28 Mar 2023 07:58:46 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: refactor iwl_mvm_roc()

This flow is almost the same for both MLD and non-MLD modes,
except for some function calls. Therefore there is no reason to
add an MLD version of this flow. Instead - put the parts that are unique
for each mode in helper functions, and in the next patch each version of
this flow will call the common part with pointers to its specific
helper functions.

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/20230328104948.61bc077a7f3c.Ia3aa81d3293792bf8f80528dbc67a711ce334b32@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: add some new MLD ops
Miri Korenblit [Tue, 28 Mar 2023 07:58:45 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: add some new MLD ops

Add MLD version of bss_info_changed/switch_vif_chanctx/
config_iface_filter and conf_tx() callbacks.

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/20230328104948.9c83c253d610.Ibf2006be9ece87896c17cb43dfe3654ac73d81ff@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: add sta handling flows for MLD mode
Miri Korenblit [Tue, 28 Mar 2023 07:58:44 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: add sta handling flows for MLD mode

In MLD mode we have a new STA cmd. As a result, it is also changes
the flows of adding/updating/removing and handling state of
a station. Add these flows.

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/20230328104948.b5548cfd8fe3.I70f9c8f3c95e18d5c9af0a5681e0830893509531@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: add an indication that the new MLD API is used
Miri Korenblit [Tue, 28 Mar 2023 07:58:43 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: add an indication that the new MLD API is used

WE can't mix between the new MLD API and the old API.
I.e. - we can't send one of the new cmds and then one of the old ones.
This will cause a FW assert. So we need an indication what API should be
used. We use the new API if:
1. FW supports it
2. We are registered to mac80211 with the new MLD ops
Add an indication which will only be true if both conditions are true.

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/20230328104948.5756b0907403.I0adce36d1783cce23d0e080e3c4a8953db33b515@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: sta preparation for MLO
Gregory Greenman [Tue, 28 Mar 2023 07:58:42 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: sta preparation for MLO

Split iwl_mvm_sta into general and link specific parts. As a first
step, all link dependent parameters reside in deflink.

The change was done mostly using the spatch below with some manual
adjustments.

@iwl_mvm_sta@
struct iwl_mvm_sta *s;
identifier var = {sta_id, lq_sta, avg_energy};
@@

(
  s->
-    var
+    deflink.var
)

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104948.34eace06d583.I1f8c5e919a71b21030460fbdd220d42401b688b1@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: vif preparation for MLO
Gregory Greenman [Tue, 28 Mar 2023 07:58:41 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: vif preparation for MLO

In MLO, some fields of iwl_mvm_vif should be defined in the
context of a link. Define a separate structure for these fields and
add a deflink object to hold it as part of iwl_mvm_vif. Non-MLO legacy
code will use only deflink object while MLO related code will use the
corresponding link from the link array.

It follows the strategy applied in mac80211 for introducing MLO
changes.

The below spatch takes care of updating all driver code to access
fields separated into MLD specific data structure via deflink (need
to convert all references to the fields listed in var to deflink.var
and also to take care of calls like iwl_mvm_vif_from_mac80211(vif)->field).

  @iwl_mld_vif@
  struct iwl_mvm_vif *v;
  struct ieee80211_vif *vv;
  identifier fn;
  identifier var = {bssid, ap_sta_id, bcast_sta, mcast_sta,
                    beacon_stats, smps_requests, probe_resp_data,
    he_ru_2mhz_block, cab_queue, phy_ctxt,
                    queue_params};
  @@

  (
    v->
  -    var
  +    deflink.var
  |
    fn(vv)->
  -    var
  +    deflink.var
  )

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104948.4896576f0a9f.Ifaf0187c96b9fe52b24bd629331165831a877691@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: nl80211: support advertising S1G capabilities
Kieran Frewen [Thu, 23 Feb 2023 21:29:17 +0000 (10:29 +1300)]
wifi: nl80211: support advertising S1G capabilities

Include S1G capabilities in netlink band info messages.

Signed-off-by: Kieran Frewen <kieran.frewen@morsemicro.com>
Co-developed-by: Gilad Itzkovitch <gilad.itzkovitch@morsemicro.com>
Signed-off-by: Gilad Itzkovitch <gilad.itzkovitch@morsemicro.com>
Link: https://lore.kernel.org/r/20230223212917.4010246-1-gilad.itzkovitch@virscient.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: mac80211: S1G capabilities information element in probe request
Kieran Frewen [Thu, 23 Feb 2023 03:25:12 +0000 (16:25 +1300)]
wifi: mac80211: S1G capabilities information element in probe request

Add the missing S1G capabilities information element to probe requests.

Signed-off-by: Kieran Frewen <kieran.frewen@morsemicro.com>
Co-developed-by: Gilad Itzkovitch <gilad.itzkovitch@morsemicro.com>
Signed-off-by: Gilad Itzkovitch <gilad.itzkovitch@morsemicro.com>
Link: https://lore.kernel.org/r/20230223032512.3848105-1-gilad.itzkovitch@virscient.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agomac80211: minstrel_ht: remove unused n_supported variable
Tom Rix [Sat, 25 Mar 2023 13:26:10 +0000 (09:26 -0400)]
mac80211: minstrel_ht: remove unused n_supported variable

clang with W=1 reports
net/mac80211/rc80211_minstrel_ht.c:1711:6: error: variable
  'n_supported' set but not used [-Werror,-Wunused-but-set-variable]
        int n_supported = 0;
            ^
This variable is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Link: https://lore.kernel.org/r/20230325132610.1334820-1-trix@redhat.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: Use 64-bit division helper in iwl_mvm_get_crosstimestamp_fw()
Nathan Chancellor [Wed, 29 Mar 2023 17:32:46 +0000 (10:32 -0700)]
wifi: iwlwifi: mvm: Use 64-bit division helper in iwl_mvm_get_crosstimestamp_fw()

There is a 64-bit division in iwl_mvm_get_crosstimestamp_fw(), which
results in a link failure when building 32-bit architectures with clang:

  ld.lld: error: undefined symbol: __udivdi3
  >>> referenced by ptp.c
  >>>               drivers/net/wireless/intel/iwlwifi/mvm/ptp.o:(iwl_mvm_phc_get_crosstimestamp) in archive vmlinux.a

GCC has optimizations for division by a constant that clang does not
implement, so this issue is not visible when building with GCC.

Use the 64-bit division helper div_u64(), which takes a u64 dividend and
u32 divisor, which matches this situation and prevents the emission of a
libcall for the division.

Fixes: 21fb8da6ebe4 ("wifi: iwlwifi: mvm: read synced time from firmware if supported")
Reported-by: Arnd Bergmann <arnd@arndb.de>
Link: https://github.com/ClangBuiltLinux/linux/issues/1826
Reported-by: "kernelci.org bot" <bot@kernelci.org>
Link: https://lore.kernel.org/6423173a.620a0220.3d5cc.6358@mx.google.com/
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agomac80211_hwsim: add PMSR report support via virtio
Jaewan Kim [Wed, 22 Mar 2023 13:16:37 +0000 (13:16 +0000)]
mac80211_hwsim: add PMSR report support via virtio

PMSR (a.k.a. peer measurement) is generalized measurement between two
devices with Wi-Fi support. And currently FTM (a.k.a. fine time measurement
or flight time measurement) is the one and only measurement.

Add the necessary functionality to allow mac80211_hwsim to report PMSR
result. The result would come from the wmediumd, where other Wi-Fi
devices' information are kept. mac80211_hwsim only need to deliver the
result to the userspace.

In detail, add new mac80211_hwsim attributes HWSIM_CMD_REPORT_PMSR, and
HWSIM_ATTR_PMSR_RESULT. When mac80211_hwsim receives the PMSR result with
command HWSIM_CMD_REPORT_PMSR and detail with attribute
HWSIM_ATTR_PMSR_RESULT, received data is parsed to cfg80211_pmsr_result and
resent to the userspace by cfg80211_pmsr_report().

To help receive the details of PMSR result, hwsim_rate_info_attributes is
added to receive rate_info without complex bitrate calculation. (i.e. send
rate_info without adding inverse of nl80211_put_sta_rate()).

Signed-off-by: Jaewan Kim <jaewan@google.com>
Link: https://lore.kernel.org/r/20230322131637.2633968-6-jaewan@google.com
[fix uninitialized return value when there are no reports]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agomac80211_hwsim: add PMSR abort support via virtio
Jaewan Kim [Wed, 22 Mar 2023 13:16:36 +0000 (13:16 +0000)]
mac80211_hwsim: add PMSR abort support via virtio

PMSR (a.k.a. peer measurement) is generalized measurement between two
devices with Wi-Fi support. And currently FTM (a.k.a. fine time
measurement or flight time measurement) is the one and only measurement.

Add necessary functionalities for mac80211_hwsim to abort previous PMSR
request. The abortion request is sent to the wmedium where the PMSR request
is actually handled.

In detail, add new mac80211_hwsim command HWSIM_CMD_ABORT_PMSR. When
mac80211_hwsim receives the PMSR abortion request via
ieee80211_ops.abort_pmsr, the received cfg80211_pmsr_request is resent to
the wmediumd with command HWSIM_CMD_ABORT_PMSR and attribute
HWSIM_ATTR_PMSR_REQUEST. The attribute is formatted as the same way as
nl80211_pmsr_start() expects.

Signed-off-by: Jaewan Kim <jaewan@google.com>
Link: https://lore.kernel.org/r/20230322131637.2633968-5-jaewan@google.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agomac80211_hwsim: add PMSR request support via virtio
Jaewan Kim [Wed, 22 Mar 2023 13:16:35 +0000 (13:16 +0000)]
mac80211_hwsim: add PMSR request support via virtio

PMSR (a.k.a. peer measurement) is generalized measurement between two
Wi-Fi devices. And currently FTM (a.k.a. fine time measurement or flight
time measurement) is the one and only measurement. FTM is measured by
RTT (a.k.a. round trip time) of packets between two Wi-Fi devices.

Add necessary functionalities for mac80211_hwsim to start PMSR request by
passthrough the request to wmediumd via virtio. mac80211_hwsim can't
measure RTT for real because mac80211_hwsim the software simulator and
packets are sent almost immediately for real. This change expect wmediumd
to have all the location information of devices, so passthrough requests
to wmediumd.

In detail, add new mac80211_hwsim command HWSIM_CMD_ABORT_PMSR. When
mac80211_hwsim receives the PMSR start request via
ieee80211_ops.start_pmsr, the received cfg80211_pmsr_request is resent to
the wmediumd with command HWSIM_CMD_START_PMSR and attribute
HWSIM_ATTR_PMSR_REQUEST. The attribute is formatted as the same way as
nl80211_pmsr_start() expects.

Signed-off-by: Jaewan Kim <jaewan@google.com>
Link: https://lore.kernel.org/r/20230322131637.2633968-4-jaewan@google.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: nl80211: make nl80211_send_chandef non-static
Jaewan Kim [Wed, 22 Mar 2023 13:16:34 +0000 (13:16 +0000)]
wifi: nl80211: make nl80211_send_chandef non-static

Expose nl80211_send_chandef functionality for mac80211_hwsim or vendor
netlink can use it where needed.

Signed-off-by: Jaewan Kim <jaewan@google.com>
Reviewed-by: Michal Kubiak <michal.kubiak@intel.com>
Link: https://lore.kernel.org/r/20230322131637.2633968-3-jaewan@google.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agomac80211_hwsim: add PMSR capability support
Jaewan Kim [Wed, 22 Mar 2023 13:16:33 +0000 (13:16 +0000)]
mac80211_hwsim: add PMSR capability support

PMSR (a.k.a. peer measurement) is generalized measurement between two
Wi-Fi devices. And currently FTM (a.k.a. fine time measurement or flight
time measurement) is the one and only measurement. FTM is measured by
RTT (a.k.a. round trip time) of packets between two Wi-Fi devices.

Add necessary functionality to allow mac80211_hwsim to be configured with
PMSR capability. The capability is mandatory to accept incoming PMSR
request because nl80211_pmsr_start() ignores incoming the request without
the PMSR capability.

In detail, add new mac80211_hwsim attribute HWSIM_ATTR_PMSR_SUPPORT.
HWSIM_ATTR_PMSR_SUPPORT is used to set PMSR capability when creating a new
radio. To send extra capability details, HWSIM_ATTR_PMSR_SUPPORT can have
nested PMSR capability attributes defined in the nl80211.h. Data format is
the same as cfg80211_pmsr_capabilities.

If HWSIM_ATTR_PMSR_SUPPORT is specified, mac80211_hwsim builds
cfg80211_pmsr_capabilities and sets wiphy.pmsr_capa.

Signed-off-by: Jaewan Kim <jaewan@google.com>
Link: https://lore.kernel.org/r/20230322131637.2633968-2-jaewan@google.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agomac80211: support RNR for EMA AP
Aloka Dixit [Thu, 23 Mar 2023 11:38:01 +0000 (04:38 -0700)]
mac80211: support RNR for EMA AP

Generate EMA beacons, each including MBSSID and RNR elements at a given
index. If number of stored RNR elements is more than the number of
MBSSID elements then add those in every EMA beacon.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Link: https://lore.kernel.org/r/20230323113801.6903-3-quic_alokad@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agocfg80211: support RNR for EMA AP
Aloka Dixit [Thu, 23 Mar 2023 11:38:00 +0000 (04:38 -0700)]
cfg80211: support RNR for EMA AP

As per IEEE Std 802.11ax-2021, 11.1.3.8.3 Discovery of a nontransmitted
BSSID profile, an EMA AP that transmits a Beacon frame carrying a partial
list of nontransmitted BSSID profiles should include in the frame
a Reduced Neighbor Report element carrying information for at least the
nontransmitted BSSIDs that are not present in the Multiple BSSID element
carried in that frame.
Add new nested attribute NL80211_ATTR_EMA_RNR_ELEMS to support the above.
Number of RNR elements must be more than or equal to the number of
MBSSID elements. This attribute can be used only when EMA is enabled.
Userspace is responsible for splitting the RNR into multiple elements such
that each element excludes the non-transmitting profiles already included
in the MBSSID element (%NL80211_ATTR_MBSSID_ELEMS) at the same index.
Each EMA beacon will be generated by adding MBSSID and RNR elements
at the same index. If the userspace provides more RNR elements than the
number of MBSSID elements then these will be added in every EMA beacon.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Link: https://lore.kernel.org/r/20230323113801.6903-2-quic_alokad@quicinc.com
[Johannes: validate elements]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: mac80211: use bullet list for amsdu_mesh_control formats list
Bagas Sanjaya [Thu, 23 Mar 2023 09:24:54 +0000 (16:24 +0700)]
wifi: mac80211: use bullet list for amsdu_mesh_control formats list

Commit fe4a6d2db3ba ("wifi: mac80211: implement support for yet
another mesh A-MSDU format") expands amsdu_mesh_control list to
multi-line list. However, the expansion triggers Sphinx warning:

Documentation/driver-api/80211/mac80211-advanced:214: ./net/mac80211/sta_info.h:628: WARNING: Unexpected indentation.

Use bullet list instead to fix the warning.

Link: https://lore.kernel.org/linux-next/20230323141548.659479ef@canb.auug.org.au/
Fixes: fe4a6d2db3bad4 ("wifi: mac80211: implement support for yet another mesh A-MSDU format")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: fix NULL deref in iwl_mvm_mld_disable_txq
Gregory Greenman [Thu, 23 Mar 2023 22:35:43 +0000 (00:35 +0200)]
wifi: iwlwifi: mvm: fix NULL deref in iwl_mvm_mld_disable_txq

Check sta pointer for NULL and don't crash if it is.

Fixes: 006c152ac9e5 ("wifi: iwlwifi: mvm: add support for the new STA related commands")
Reported-by: Dan Carpenter <error27@gmail.com>
Link: https://lore.kernel.org/linux-wireless/20230314194113.132873ce015c.I7b12a77e5be066730762e6ceeeaa7190293c3df1@changeid/
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: mac80211_hwsim: EMA support
Aloka Dixit [Tue, 6 Dec 2022 00:50:40 +0000 (16:50 -0800)]
wifi: mac80211_hwsim: EMA support

Add support enhanced multi-BSS advertisements (EMA)
for profile periodicity up to 3 beacons.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Link: https://lore.kernel.org/r/20221206005040.3177-5-quic_alokad@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: mac80211_hwsim: Multiple BSSID support
Aloka Dixit [Tue, 6 Dec 2022 00:50:39 +0000 (16:50 -0800)]
wifi: mac80211_hwsim: Multiple BSSID support

Advertise multiple BSSID support for up to 8 interfaces.
Do not send beacons from the non-transmitting interfaces.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Link: https://lore.kernel.org/r/20221206005040.3177-4-quic_alokad@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: mac80211_hwsim: move beacon transmission to a separate function
Aloka Dixit [Tue, 6 Dec 2022 00:50:38 +0000 (16:50 -0800)]
wifi: mac80211_hwsim: move beacon transmission to a separate function

Move the beacon transmission to a separate function to facilitate
addition of EMA beacon transmission.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Link: https://lore.kernel.org/r/20221206005040.3177-3-quic_alokad@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: mac80211: generate EMA beacons in AP mode
Aloka Dixit [Tue, 6 Dec 2022 00:50:37 +0000 (16:50 -0800)]
wifi: mac80211: generate EMA beacons in AP mode

Add APIs to generate an array of beacons for an EMA AP (enhanced
multiple BSSID advertisements), each including a single MBSSID element.
EMA profile periodicity equals the count of elements.

- ieee80211_beacon_get_template_ema_list() - Generate and return all
EMA beacon templates. Drivers must call ieee80211_beacon_free_ema_list()
to free the memory. No change in the prototype for the existing API,
ieee80211_beacon_get_template(), which should be used for non-EMA AP.

- ieee80211_beacon_get_template_ema_index() - Generate a beacon which
includes the multiple BSSID element at the given index. Drivers can use
this function in a loop until NULL is returned which indicates end of
available MBSSID elements.

- ieee80211_beacon_free_ema_list() - free the memory allocated for the
list of EMA beacon templates.

Modify existing functions ieee80211_beacon_get_ap(),
ieee80211_get_mbssid_beacon_len() and ieee80211_beacon_add_mbssid()
to accept a new parameter for EMA index.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Co-developed-by: John Crispin <john@phrozen.org>
Signed-off-by: John Crispin <john@phrozen.org>
Link: https://lore.kernel.org/r/20221206005040.3177-2-quic_alokad@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: nl80211: Update the documentation of NL80211_SCAN_FLAG_COLOCATED_6GHZ
Manikanta Pubbisetty [Wed, 8 Mar 2023 10:45:56 +0000 (16:15 +0530)]
wifi: nl80211: Update the documentation of NL80211_SCAN_FLAG_COLOCATED_6GHZ

Currently when NL80211_SCAN_FLAG_COLOCATED_6GHZ is set in the scan flags,
in addition to the co-located APs, PSC channels in the 6 GHz band would
also be scanned if the user space has asked for it. In other words, the
scan would happen on PSC channels & co-located 6 GHz channels that were
reported in the RNR IE.

Update the documentation of NL80211_SCAN_FLAG_COLOCATED_6GHZ flag to
reflect the above said behavior.

Signed-off-by: Manikanta Pubbisetty <quic_mpubbise@quicinc.com>
Link: https://lore.kernel.org/r/20230308104556.9399-1-quic_mpubbise@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: mac80211: implement support for yet another mesh A-MSDU format
Felix Fietkau [Tue, 14 Mar 2023 09:59:56 +0000 (10:59 +0100)]
wifi: mac80211: implement support for yet another mesh A-MSDU format

MT7996 hardware supports mesh A-MSDU subframes in hardware, but uses a
big-endian length field

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Link: https://lore.kernel.org/r/20230314095956.62085-7-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: mac80211: add mesh fast-rx support
Felix Fietkau [Tue, 14 Mar 2023 09:59:55 +0000 (10:59 +0100)]
wifi: mac80211: add mesh fast-rx support

This helps bring down rx CPU usage by avoiding calls to the rx handlers in
the slow path. Supports forwarding and local rx, including A-MSDU.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Link: https://lore.kernel.org/r/20230314095956.62085-6-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: mac80211: use mesh header cache to speed up mesh forwarding
Felix Fietkau [Tue, 14 Mar 2023 09:59:54 +0000 (10:59 +0100)]
wifi: mac80211: use mesh header cache to speed up mesh forwarding

Significantly reduces mesh forwarding path CPU usage and enables the
direct use of iTXQ.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Link: https://lore.kernel.org/r/20230314095956.62085-5-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: mac80211: mesh fast xmit support
Felix Fietkau [Tue, 14 Mar 2023 09:59:53 +0000 (10:59 +0100)]
wifi: mac80211: mesh fast xmit support

Previously, fast xmit only worked on interface types where initially a
sta lookup is performed, and a cached header can be attached to the sta,
requiring only some fields to be updated at runtime.

This technique is not directly applicable for a mesh device type due
to the dynamic nature of the topology and protocol. There are more
addresses that need to be filled, and there is an extra header with a
dynamic length based on the addressing mode.

Change the code to cache entries contain a copy of the mesh subframe header +
bridge tunnel header, as well as an embedded struct ieee80211_fast_tx, which
contains the information for building the 802.11 header.

Add a mesh specific early fast xmit call, which looks up a cached entry and
adds only the mesh subframe header, before passing it over to the generic
fast xmit code.

To ensure the changes in network are reflected in these cached headers,
flush affected cached entries on path changes, as well as other conditions
that currently trigger a fast xmit check in other modes (key changes etc.)

This code is loosely based on a previous implementation by:
Sriram R <quic_srirrama@quicinc.com>

Cc: Sriram R <quic_srirrama@quicinc.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Link: https://lore.kernel.org/r/20230314095956.62085-4-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: mac80211: fix race in mesh sequence number assignment
Felix Fietkau [Tue, 14 Mar 2023 09:59:51 +0000 (10:59 +0100)]
wifi: mac80211: fix race in mesh sequence number assignment

Since the sequence number is shared across different tx queues, it needs
to be atomic in order to avoid accidental duplicate assignment

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Link: https://lore.kernel.org/r/20230314095956.62085-2-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: mac80211: add support for letting drivers register tc offload support
Felix Fietkau [Tue, 21 Mar 2023 09:12:48 +0000 (10:12 +0100)]
wifi: mac80211: add support for letting drivers register tc offload support

On newer MediaTek SoCs (e.g. MT7986), WLAN->WLAN or WLAN->Ethernet flows can
be offloaded by the SoC. In order to support that, the .ndo_setup_tc op is
needed.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Link: https://lore.kernel.org/r/20230321091248.30947-1-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: Add debugfs to get TAS status
Abhishek Naik [Mon, 20 Mar 2023 10:33:19 +0000 (12:33 +0200)]
wifi: iwlwifi: mvm: Add debugfs to get TAS status

Add debugfs file in mvm to retrieve TAS status per LMAC,
TAS block list, current mcc, OEM name and OEM allowed list.

Signed-off-by: Abhishek Naik <abhishek.naik@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230320122330.8efc8c41efae.I94e1a6efb9c33e2cdbcf4bf3ed2384005397dee9@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: support enabling and disabling HW timestamping
Avraham Stern [Mon, 20 Mar 2023 10:33:18 +0000 (12:33 +0200)]
wifi: iwlwifi: mvm: support enabling and disabling HW timestamping

Instead of enabling HW timestamping by default every time a station
is connected, disable it by default and enable it only upon request
for a specific station. HW timestamping can be enabled for only one
peer at a time.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230320122330.62b98fbf545b.I450c1017ada7900a71a63d879bb542a08e3166c8@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: Update configurations for Bnj device
Mukesh Sisodiya [Mon, 20 Mar 2023 10:33:17 +0000 (12:33 +0200)]
wifi: iwlwifi: Update configurations for Bnj device

Add missing rf support for spacific rf for BnJ device

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230320122330.eeb7ebb9ed87.I30c3938221aeb6f6ba2c84b1a77eea54c9dd3ba1@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: refactor iwl_mvm_add_sta(), iwl_mvm_rm_sta()
Miri Korenblit [Mon, 20 Mar 2023 10:33:16 +0000 (12:33 +0200)]
wifi: iwlwifi: mvm: refactor iwl_mvm_add_sta(), iwl_mvm_rm_sta()

As we have a new MLD STA cmd, there will be a different function to
add/remove a station in MLD mode. But both functions will share a
common part. Put this part in a separate function which will be used
later in adding/removing a sta in MLD mode.

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/20230320122330.d01e0c9ccdc3.I5e9e27c3b363b36209a0ff960d2e59708e7ff0bf@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: remove not needed initializations
Miri Korenblit [Mon, 20 Mar 2023 10:33:15 +0000 (12:33 +0200)]
wifi: iwlwifi: mvm: remove not needed initializations

In iwl_mvm_add_sta() we're initializing the new allocated mvm_sta.
We are setting some fields to zero even though it was allocated with
kzalloc, for the case of HW restart. But in such a case we will never
get to this initializations due to the goto statement that we have in
this case. Remove these initializations.

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/20230320122330.c0b4d1e986a5.I6959bf1aca74c865e3c1edbf711f5fe8fb8c0c9f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: refactor iwl_mvm_sta_send_to_fw()
Miri Korenblit [Mon, 20 Mar 2023 10:33:14 +0000 (12:33 +0200)]
wifi: iwlwifi: mvm: refactor iwl_mvm_sta_send_to_fw()

We have a new STA cmd as part of the new MLD API. There are some
parts of sending the STA cmd which are common to both the old and
the new one. Put this parts in functions which will later be used
to send the new STA cmd.

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/20230320122330.4da940bd7384.I3a66990fbffe9611b5e41f3686c2aff37ba2eb56@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: refactor iwl_mvm_sta
Miri Korenblit [Mon, 20 Mar 2023 10:33:13 +0000 (12:33 +0200)]
wifi: iwlwifi: mvm: refactor iwl_mvm_sta

As the new MLD API is introduced, we have a new enumeration
for the different station types. Since struct iwl_mvm_sta's
sta_type field will be in use for both new and old API,
change its type to a unified one, so it can hold both.

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/20230320122330.c8b86d8ddd3e.I9581235860b91654b4f6c3a8797c777702690998@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: refactor iwl_mvm_cfg_he_sta()
Miri Korenblit [Mon, 20 Mar 2023 10:33:12 +0000 (12:33 +0200)]
wifi: iwlwifi: mvm: refactor iwl_mvm_cfg_he_sta()

This function sends the STA_HE_CTXT_CMD, which won't be used in the
new MLD API. Instead, a part of the fields of this command
will be in the new STA cmd. Put the parts that are common to both
commands in functions, which will later be used in sending the new
STA cmd.

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/20230320122330.19b9b6c346ab.I0b8512eb64d8f03ff83879bafe9707f897d5b3c6@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: Don't send MAC CTXT cmd after deauthorization
Miri Korenblit [Mon, 20 Mar 2023 10:33:11 +0000 (12:33 +0200)]
wifi: iwlwifi: mvm: Don't send MAC CTXT cmd after deauthorization

We used to send a MAC CTXT cmd to ask the FW to not pass MCAST frames
if we're associated but not authorized, because we don't have the
keys in that stage, and after authorization - we sent the cmd again
to ask the FW to pass MCAST, as we have the keys now.
The patch linked below was changing this strategy to always allow
MCAST frames, and if we're not authorized - the driver will drop them.
But we're still sending the MAC CTXT cmd after deaouthorization even
though we don't tell the FW to not pass MCAST frames anymore.
Basically we don't tell the FW anything new with this cmd.
Fix this by not sending MAC CTXT command after deauthorization.
For authorization we're sending the cmd to configure other changes too,
so keep it.

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/20230320122330.11b3481bc497.I9672acff9cfc00e7e1a187e7178caa3a1911a1b5@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: add stop_ap() and leave_ibss() callbacks for MLD mode
Miri Korenblit [Mon, 20 Mar 2023 10:33:10 +0000 (12:33 +0200)]
wifi: iwlwifi: mvm: add stop_ap() and leave_ibss() callbacks for MLD mode

This is another patch in the series adding all the ops
for the new MLD ieee80211_ops.
The callbacks added here use the new MLD FW API

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/20230320122330.42b0d4726b8d.I0755baace47c0ab1d9d70137448125d3140ef3af@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: add start_ap() and join_ibss() callbacks for MLD mode
Miri Korenblit [Mon, 20 Mar 2023 10:33:09 +0000 (12:33 +0200)]
wifi: iwlwifi: mvm: add start_ap() and join_ibss() callbacks for MLD mode

This is another patch in the series adding all the ops
for the new MLD ieee80211_ops.
The callbacks added here use the new MLD FW API

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/20230320122330.3eb485c359fc.I28be198ea9389083d5a01f68c92763722613ba9b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: select ptp cross timestamp from multiple reads
Avraham Stern [Mon, 20 Mar 2023 10:33:08 +0000 (12:33 +0200)]
wifi: iwlwifi: mvm: select ptp cross timestamp from multiple reads

iwl_mvm_get_sync_time() reads the gp2 from the device and then
reads the system clock. Since the two reads are not done atomically,
unexpected delays may happen between the two reads (e.g. context
switch) which make it inaccurate.
In order to improve the accuracy of the cross timestamp, call
iwl_mvm_get_sync_time() multiple times in a loop and take the
result in which the difference between the two clock is the smallest.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230320122330.d9e6f8f8998a.I569939ec4ddf0c6c64c112e7d0c30583f5509d9a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: implement PHC clock adjustments
Avraham Stern [Mon, 20 Mar 2023 10:33:07 +0000 (12:33 +0200)]
wifi: iwlwifi: mvm: implement PHC clock adjustments

Implement the following PHC operations:
1. adjtime - for adding an offset to the PHC clock time.
2. adjfine - for adjusting the PHC clock frequency.
3. gettime64 - for getting the PHC clock time. This function returns
   the time as adjusted by adjtime and adjfine.

The adjusted time will also be used for time sync frames timestamping.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230320122330.f59750deeee4.I110a7e3ac3c6d39d9dbe1fe77001e3f5bc3814eb@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: enable TX beacon protection
Johannes Berg [Mon, 20 Mar 2023 10:33:06 +0000 (12:33 +0200)]
wifi: iwlwifi: mvm: enable TX beacon protection

Check hardware/firmware support and enable TX beacon protection
as well if supported, programming the key into the firmware as
usual.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230320122330.6a90a4f4f469.Ia028dea75f9a8eed40786d876d51f97fb3142688@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: add support for timing measurement
Krishnanand Prabhu [Mon, 20 Mar 2023 10:33:05 +0000 (12:33 +0200)]
wifi: iwlwifi: mvm: add support for timing measurement

Add support for timing measurement in extended capabilities, used for
time synchronization.

Signed-off-by: Krishnanand Prabhu <krishnanand.prabhu@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230320122330.001d2b459ece.I15ab8fc214edc35f1f362006a9e1a22b89e7ed8e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: report hardware timestamps in RX/TX status
Avraham Stern [Mon, 20 Mar 2023 10:33:04 +0000 (12:33 +0200)]
wifi: iwlwifi: mvm: report hardware timestamps in RX/TX status

For TM/FTM frames, report the hardware timestamps reported by the
fw as part of the RX/TX status. Since the fw reports the timestamps
in a dedicated notification (and not as part of the RX/TX status),
hold the frame until the fw timestamps notification is received.
Timestamping is enabled when a station is connected and disabled
when disconnected. For AP interface, only the first station will
have timestamping enabled since the fw only supports timestamping
for one peer.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230320122330.e0392d498101.I9bf12c8ecfb3f17253a13dc48a48647ddd6e7855@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: read synced time from firmware if supported
Avraham Stern [Mon, 20 Mar 2023 10:33:03 +0000 (12:33 +0200)]
wifi: iwlwifi: mvm: read synced time from firmware if supported

If the firmware supports reading synced GP2/ATRB timestamps,
read the synced timestamps from firmware instead of reading the
GP2 register and the system time separately. Reading the synced
time from firmware should be more accurate.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230320122330.a6be5f0b5580.Idedb496a5943fa496143066ffbed08185a8c4582@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: iwlwifi: mvm: add support for PTP HW clock (PHC)
Krishnanand Prabhu [Mon, 20 Mar 2023 10:33:02 +0000 (12:33 +0200)]
wifi: iwlwifi: mvm: add support for PTP HW clock (PHC)

Add support to enable/disable PHC clock. The PHC clock includes support
for fetching the cross timestamp i.e. a non-atomic snapshot of the current
time from the hardware (WiFi device) clock and system clock (wall-clock)
simultaneously.

Signed-off-by: Krishnanand Prabhu <krishnanand.prabhu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230320122330.ae1d64f513b9.Ib3b6ad61c9fa2fc5908f1e0d6f59f4af6eec1a77@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 months agowifi: rtl8xxxu: Support new chip RTL8710BU aka RTL8188GU
Bitterblue Smith [Mon, 13 Mar 2023 13:58:14 +0000 (15:58 +0200)]
wifi: rtl8xxxu: Support new chip RTL8710BU aka RTL8188GU

This chip is found in cheap "free driver" USB adapters from Aliexpress.
Initially they pretend to be a CD-ROM containing the driver for Windows.
"Ejecting" switches the device to wifi mode.

Features: 2.4 GHz, b/g/n mode, 1T1R, 150 Mbps.

This chip is more unique than other Realtek chips:

* The registers at addresses 0x0-0xff, which all the other chips use,
  can't be used here. New registers at 0x8000-0x80ff must be used
  instead. And it's not a simple matter of adding 0x8000: 0x2
  (REG_SYS_FUNC) became 0x8004, 0x80 (REG_MCU_FW_DL) became 0x8090,
  etc.

* Also there are a few new registers which must be accessed indirectly
  because their addresses don't fit in 16 bits. No other chips seem to
  have these.

* The vendor driver compiles to 8188gu.ko, but the code calls the chip
  RTL8710B(U) pretty much everywhere, including messages visible to the
  user.

Another difference compared to the other chips supported by rtl8xxxu is
that it has a new PHY status struct, or three of them actually, from
which we extract the RSSI, among other things. This is not unique,
though, just new. The chips supported by rtw88 also use it.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/4edbe29f-00b9-8eef-9789-20bed0b141e2@gmail.com
15 months agowifi: rtl8xxxu: RTL8192EU always needs full init
Bitterblue Smith [Mon, 13 Mar 2023 13:42:59 +0000 (15:42 +0200)]
wifi: rtl8xxxu: RTL8192EU always needs full init

Always run the entire init sequence (rtl8xxxu_init_device()) for
RTL8192EU. It's what the vendor driver does too.

This fixes a bug where the device is unable to connect after
rebooting:

wlp3s0f3u2: send auth to ... (try 1/3)
wlp3s0f3u2: send auth to ... (try 2/3)
wlp3s0f3u2: send auth to ... (try 3/3)
wlp3s0f3u2: authentication with ... timed out

Rebooting leaves the device powered on (partially? at least the
firmware is still running), but not really in a working state.

Cc: stable@vger.kernel.org
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Acked-by: Jes Sorensen <jes@trained-monkey.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/4eb111a9-d4c4-37d0-b376-4e202de7153c@gmail.com
16 months agowifi: iwlwifi: Avoid disabling GCC specific flag with clang
Nathan Chancellor [Thu, 16 Mar 2023 03:28:29 +0000 (20:28 -0700)]
wifi: iwlwifi: Avoid disabling GCC specific flag with clang

Clang errors:

  drivers/net/wireless/intel/iwlwifi/iwl-devtrace.c:15:32: error: unknown warning group '-Wsuggest-attribute=format', ignored [-Werror,-Wunknown-warning-option]
  #pragma GCC diagnostic ignored "-Wsuggest-attribute=format"
                                 ^
  1 error generated.

The warning being disabled by this pragma is GCC specific. Guard its use
with CONFIG_CC_IS_GCC so that it is not used with clang to clear up the
error.

Fixes: 4eca8cbf7ba8 ("wifi: iwlwifi: suppress printf warnings in tracing")
Link: https://github.com/ClangBuiltLinux/linux/issues/1818
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20230315-iwlwifi-fix-pragma-v1-1-ad23f92c4739@kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: suppress printf warnings in tracing
Johannes Berg [Wed, 15 Mar 2023 12:29:20 +0000 (13:29 +0100)]
wifi: iwlwifi: suppress printf warnings in tracing

This can't really be fixed due to the macro layout of
tracepoints (you'd need a special tracepoint macro for
when this is needed), so just suppress the warnings.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: fw: pnvm: fix uefi reduced TX power loading
Johannes Berg [Tue, 14 Mar 2023 17:49:34 +0000 (19:49 +0200)]
wifi: iwlwifi: fw: pnvm: fix uefi reduced TX power loading

There are a number of issues here:
 * if trans->reduce_power_loaded is already true, we call
   iwl_trans_set_reduce_power() with an uninitialized len
   value
 * in this case we also clobber a previous load/setting
 * if iwl_uefi_get_reduced_power() returns an ERR_PTR() we
   try to kfree() it

Move the iwl_trans_set_reduce_power() call into the success
case only to fix these issues.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230314194113.aa2cf2281f5d.I33b4ab3427f1921c184c52fecd0f46781a89dc8a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: Update configurations for Bnj and Bz devices
Mukesh Sisodiya [Tue, 14 Mar 2023 17:49:33 +0000 (19:49 +0200)]
wifi: iwlwifi: Update configurations for Bnj and Bz devices

Add missing rf support for Bz device and B-Step for BnJ device

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230314194113.14c373dcfe15.I96b96a8b149ac181e962f4b82e0d15b172823d0f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: mvm: rs: print BAD_RATE for invalid HT/VHT index
Johannes Berg [Tue, 14 Mar 2023 17:49:32 +0000 (19:49 +0200)]
wifi: iwlwifi: mvm: rs: print BAD_RATE for invalid HT/VHT index

If there's a rate->index that maps inside the range but
to an uninitialized value, then that's also a bad rate,
avoid printing "(nil)" in that case and rather print the
"BAD_RATE" string instead as in the else branch.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230314194113.06b38d160fc5.I45a9254d3658b1ce796aa4c427193d3cbf638d7e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: Replace space with tabs as code indent
Solomon Tan [Tue, 14 Mar 2023 17:49:31 +0000 (19:49 +0200)]
wifi: iwlwifi: Replace space with tabs as code indent

This patch addresses the checkpatch.pl warning that code indent should
use tabs.

Signed-off-by: Solomon Tan <solomonbstoner@protonmail.ch>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230314194113.eaca2a9b08f2.Ic81d60185c13cfc750bf93fbabac57314cb5de13@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: Add required space before open '('
Solomon Tan [Tue, 14 Mar 2023 17:49:30 +0000 (19:49 +0200)]
wifi: iwlwifi: Add required space before open '('

This patch addresses the error from checkpatch.pl that a space is
required before an open parenthesis.

Signed-off-by: Solomon Tan <solomonbstoner@protonmail.ch>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230314194113.a21ba1967d94.Iaa52fc6517ea9efb3efc7b1b98f4df2a288de1c3@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: Remove prohibited spaces
Solomon Tan [Tue, 14 Mar 2023 17:49:29 +0000 (19:49 +0200)]
wifi: iwlwifi: Remove prohibited spaces

This patch addresses the error from checkpatch.pl regarding the presence
of prohibited spaces.

Signed-off-by: Solomon Tan <solomonbstoner@protonmail.ch>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230314194113.557d6841a166.I0957923fe9ea20c1ec9140477033548ccfe93e9a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: fix typos in comment
Julia Lawall [Tue, 14 Mar 2023 17:49:28 +0000 (19:49 +0200)]
wifi: iwlwifi: fix typos in comment

Spelling mistakes (triple letters) in comment.
Detected with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230314194113.fb2fc470e949.I1f3a347b533bcdb6bcd310f752ab3349800efb49@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: mvm: remove setting of 'sta' parameter
Tom Rix [Tue, 14 Mar 2023 17:49:27 +0000 (19:49 +0200)]
wifi: iwlwifi: mvm: remove setting of 'sta' parameter

cppcheck reports
[drivers/net/wireless/intel/iwlwifi/mvm/rs.c:2686]: (warning) Assignment of function parameter has no effect outside the function. Did you forget dereferencing it?

The setting of the 'sta' parameter is not needed.  In the if-check that sets it
to NULL, mvm_sta is also set to NULL.  Then the next statement checks if
mvm_sta is NULL and does an early return. So remove setting sta.

Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230314194113.711fe28cfdd6.I2f723f9d44f65720baaf3e84b72109759350a8f5@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: mvm: add an unassign_vif_chanctx() callback for MLD mode
Miri Korenblit [Tue, 14 Mar 2023 17:49:26 +0000 (19:49 +0200)]
wifi: iwlwifi: mvm: add an unassign_vif_chanctx() callback for MLD mode

This is another patch in the series adding all the ops
for the new MLD ieee80211_ops.
The callback added here uses the new MLD FW API

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/20230314194113.5d4bcd384425.I263eef3aad8efe23a597843fe7c56924038c8fdc@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: mvm: refactor __iwl_mvm_unassign_vif_chanctx()
Miri Korenblit [Tue, 14 Mar 2023 17:49:25 +0000 (19:49 +0200)]
wifi: iwlwifi: mvm: refactor __iwl_mvm_unassign_vif_chanctx()

Since parts of the functionality of this function is going to be used
also by the MLD version of it, put in a separate function the parts
that are common for both MLD and non-MLD modes.
The common function will later be used in the MLD ops.

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/20230314194113.fa05929badb9.I2222dc86cf7d7a7bb58c6a2f2529c8089bfe58b4@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: mvm: add an assign_vif_chanctx() callback for MLD mode
Miri Korenblit [Tue, 14 Mar 2023 17:49:24 +0000 (19:49 +0200)]
wifi: iwlwifi: mvm: add an assign_vif_chanctx() callback for MLD mode

This is another patch in the series adding all the ops
for the new MLD ieee80211_ops.
The callback added here uses the new MLD FW API.

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/20230314194113.d3753975e720.I45f89cc81370d2cf8d4f51748ccb3ec675eff1bd@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: mvm: refactor __iwl_mvm_assign_vif_chanctx()
Miri Korenblit [Tue, 14 Mar 2023 17:49:23 +0000 (19:49 +0200)]
wifi: iwlwifi: mvm: refactor __iwl_mvm_assign_vif_chanctx()

Since parts of the functionality of this function is going to be used
also by the MLD version of it, put in a separate function the parts
that are common for both MLD and non-MLD modes.
The common function will later be used in the MLD ops.

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/20230314194113.844755701cac.I1c650718ad2381eabc38f4103c1aac67936a1ffc@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: mvm: Add a remove_interface() callback for mld mode
Miri Korenblit [Tue, 14 Mar 2023 17:49:22 +0000 (19:49 +0200)]
wifi: iwlwifi: mvm: Add a remove_interface() callback for mld mode

As the MLD mode and its new APIs are introduced,
we've decided to add a new ieee80211_ops dedicated for
MLD callbacks. Add the MLD remove_interface() callback
which uses the new MLD APIs.

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/20230314194113.b87c5c0a4b6b.I631173a73d6ffd7232aa539ea8b356a222fac398@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: mvm: Add an add_interface() callback for mld mode
Miri Korenblit [Tue, 14 Mar 2023 17:49:21 +0000 (19:49 +0200)]
wifi: iwlwifi: mvm: Add an add_interface() callback for mld mode

As the MLD mode and its new APIs are introduced,
we've decided to add a new ieee80211_ops dedicated for
MLD callbacks. Add the MLD add_interface() callback
which uses the new MLD APIs added the previous patches.

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/20230314194113.6adc29bff39b.I97ed469028009be9392dcc6f7b5ffbe45f4b2c43@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: mvm: add support for the new STA related commands
Miri Korenblit [Tue, 14 Mar 2023 17:49:20 +0000 (19:49 +0200)]
wifi: iwlwifi: mvm: add support for the new STA related commands

As a part of the new MLD FW API changes, we have new commands for STA
related operations (add/remove/aux/disable tx).
Add structures and enum definitions, along with part of the functions
that sends this commands.
This functions will be in used and more will be added in the next patches.

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/20230314194113.132873ce015c.I7b12a77e5be066730762e6ceeeaa7190293c3df1@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: mvm: add support for the new LINK command
Miri Korenblit [Tue, 14 Mar 2023 17:49:19 +0000 (19:49 +0200)]
wifi: iwlwifi: mvm: add support for the new LINK command

As a part of the new MLD FW API changes, we have a new LINK command
to add/remove/configure a link.
Add structures and enum definitions, along with the functions that
sends this command (i.e. add, remove and change mac ctxt).
These functions will be in used in the next patches.

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/20230314194113.d7808329effb.I13bea2db206b78540bc866bc3ab755ad5be78c53@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: mvm: add support for the new MAC CTXT command
Miri Korenblit [Tue, 14 Mar 2023 17:49:18 +0000 (19:49 +0200)]
wifi: iwlwifi: mvm: add support for the new MAC CTXT command

As a part of the new MLD FW API changes, we have a new MAC CTXT command.
Add structures and enum definitions, along with the functions that
sends this command (i.e. add, remove and change mac ctxt).
This functions will be in used in the next patches.

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/20230314194113.99a41a5bc55f.I310312c829f5f2f69b64fcddce487b1eab80165b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: mvm: Refactor MAC_CONTEXT_CMD sending flow
Miri Korenblit [Tue, 14 Mar 2023 17:49:17 +0000 (19:49 +0200)]
wifi: iwlwifi: mvm: Refactor MAC_CONTEXT_CMD sending flow

Refactor MAC_CONTEXT_CMD sending flow:

1. As the new MLD API is introduced, there are some common fields in
both the old and new APIs. The MAC_CONTEXT_CMD of the non-MLD API
has common fields with the link and mac commands of the new MLD API.
Put this common parts in functions so it can be used later by the
new MLD API.

2. Use iwl_mvm_mac_ctxt_send_cmd when removing a mac instead of
implementing the same functionality once again.

3. Change the debug print when sending the command to be more specific,
so it will be easy to distinguish later if the old or new mac command
was sent.

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/20230314194113.3ab62700db4e.I2e353b308667c215aa456c160e0d90de2b9b85cc@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: mvm: Refactor STA_HE_CTXT_CMD sending flow
Miri Korenblit [Tue, 14 Mar 2023 17:49:16 +0000 (19:49 +0200)]
wifi: iwlwifi: mvm: Refactor STA_HE_CTXT_CMD sending flow

Refactor STA_HE_CTXT_CMD sending flow:

1. As the new MLD API is introduced, there are some common fields in
both the old and new APIs. The STA_HE_CTXT_CMD of the non-MLD API
has common fields with the link and mac commands of the new MLD API.
Put this common parts in functions so it can be used later by the
new MLD API.

2. The HE capability which indicates whether the NIC is ack-enabled or
not is the same for all bands. No need to take it from the specific
band which is currently in use. Take it from the low band - this
simplifies the code and doesn't require a phy_ctxt.

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/20230314194113.7ca960596953.Ifc3e816461abbd69c6fd87752342afcedfebc293@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: yoyo: Add driver defined dump file name
Mukesh Sisodiya [Tue, 14 Mar 2023 17:49:15 +0000 (19:49 +0200)]
wifi: iwlwifi: yoyo: Add driver defined dump file name

Add driver defined dump file name extension for beacon loss
and FW Assert case.

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230314194113.2a2ee92995e9.I38fff588e32276796cd757309fc811241f827c7a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: yoyo: Add new tlv for dump file name extension
Mukesh Sisodiya [Tue, 14 Mar 2023 17:49:14 +0000 (19:49 +0200)]
wifi: iwlwifi: yoyo: Add new tlv for dump file name extension

Add tlv in dump file for dump file name extension.

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Greenman, Gregory <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230314194113.ffc28212994e.Ie5f10709548497061f95c1634d942dd2facf72ec@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: mvm: avoid sta lookup in queue alloc
Johannes Berg [Tue, 14 Mar 2023 17:49:13 +0000 (19:49 +0200)]
wifi: iwlwifi: mvm: avoid sta lookup in queue alloc

In FW restart scenarios, we allocate the queues from the
iwl_mvm_realloc_queues_after_restart() function, but that
is called before we insert the station ID into our map
(mvm->fw_id_to_mac_id).

However, in all cases where we're actually allocating a
queue for a "real" (not bcast, aux, ...) station we have
the sta pointer already, so just pass it along to use it
instead of looking it up.

This fixes an issue where after restart we only allocated
a queue of size 16 (due to the ordering issue described
above), and thus never got good throughput again since no
aggregates could be formed on transmit.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230314194113.4d70868003e8.I3476fee5c12f5b1af2be5e2f38a9df7d66d02b62@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agoMAINTAINERS: adjust file entries after wifi driver movement
Lukas Bulwahn [Tue, 14 Mar 2023 04:18:48 +0000 (05:18 +0100)]
MAINTAINERS: adjust file entries after wifi driver movement

Commit f79cbc77abde ("wifi: move mac80211_hwsim and virt_wifi to virtual
directory") and commit 298e50ad8eb8 ("wifi: move raycs, wl3501 and
rndis_wlan to legacy directory") move remaining wireless drivers into
subdirectories, but does not adjust the entries in MAINTAINERS.

Hence, ./scripts/get_maintainer.pl --self-test=patterns complains about
broken references.

Repair these file references in those wireless driver sections.

Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230314041848.5120-1-lukas.bulwahn@gmail.com
16 months agoMerge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
Kalle Valo [Mon, 13 Mar 2023 13:50:44 +0000 (15:50 +0200)]
Merge ath-next from git://git./linux/kernel/git/kvalo/ath.git

ath.git patches for v6.4. Major changes:

ath10k

* enable threaded napi on WCN3990

ath11k

* push MU-MIMO params from hostapd to hardware

* tx ack signal support for management packets

16 months agowifi: brcmfmac: slab-out-of-bounds read in brcmf_get_assoc_ies()
Jisoo Jang [Thu, 9 Mar 2023 10:44:57 +0000 (19:44 +0900)]
wifi: brcmfmac: slab-out-of-bounds read in brcmf_get_assoc_ies()

Fix a slab-out-of-bounds read that occurs in kmemdup() called from
brcmf_get_assoc_ies().
The bug could occur when assoc_info->req_len, data from a URB provided
by a USB device, is bigger than the size of buffer which is defined as
WL_EXTRA_BUF_MAX.

Add the size check for req_len/resp_len of assoc_info.

Found by a modified version of syzkaller.

[   46.592467][    T7] ==================================================================
[   46.594687][    T7] BUG: KASAN: slab-out-of-bounds in kmemdup+0x3e/0x50
[   46.596572][    T7] Read of size 3014656 at addr ffff888019442000 by task kworker/0:1/7
[   46.598575][    T7]
[   46.599157][    T7] CPU: 0 PID: 7 Comm: kworker/0:1 Tainted: G           O      5.14.0+ #145
[   46.601333][    T7] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org 04/01/2014
[   46.604360][    T7] Workqueue: events brcmf_fweh_event_worker
[   46.605943][    T7] Call Trace:
[   46.606584][    T7]  dump_stack_lvl+0x8e/0xd1
[   46.607446][    T7]  print_address_description.constprop.0.cold+0x93/0x334
[   46.608610][    T7]  ? kmemdup+0x3e/0x50
[   46.609341][    T7]  kasan_report.cold+0x79/0xd5
[   46.610151][    T7]  ? kmemdup+0x3e/0x50
[   46.610796][    T7]  kasan_check_range+0x14e/0x1b0
[   46.611691][    T7]  memcpy+0x20/0x60
[   46.612323][    T7]  kmemdup+0x3e/0x50
[   46.612987][    T7]  brcmf_get_assoc_ies+0x967/0xf60
[   46.613904][    T7]  ? brcmf_notify_vif_event+0x3d0/0x3d0
[   46.614831][    T7]  ? lock_chain_count+0x20/0x20
[   46.615683][    T7]  ? mark_lock.part.0+0xfc/0x2770
[   46.616552][    T7]  ? lock_chain_count+0x20/0x20
[   46.617409][    T7]  ? mark_lock.part.0+0xfc/0x2770
[   46.618244][    T7]  ? lock_chain_count+0x20/0x20
[   46.619024][    T7]  brcmf_bss_connect_done.constprop.0+0x241/0x2e0
[   46.620019][    T7]  ? brcmf_parse_configure_security.isra.0+0x2a0/0x2a0
[   46.620818][    T7]  ? __lock_acquire+0x181f/0x5790
[   46.621462][    T7]  brcmf_notify_connect_status+0x448/0x1950
[   46.622134][    T7]  ? rcu_read_lock_bh_held+0xb0/0xb0
[   46.622736][    T7]  ? brcmf_cfg80211_join_ibss+0x7b0/0x7b0
[   46.623390][    T7]  ? find_held_lock+0x2d/0x110
[   46.623962][    T7]  ? brcmf_fweh_event_worker+0x19f/0xc60
[   46.624603][    T7]  ? mark_held_locks+0x9f/0xe0
[   46.625145][    T7]  ? lockdep_hardirqs_on_prepare+0x3e0/0x3e0
[   46.625871][    T7]  ? brcmf_cfg80211_join_ibss+0x7b0/0x7b0
[   46.626545][    T7]  brcmf_fweh_call_event_handler.isra.0+0x90/0x100
[   46.627338][    T7]  brcmf_fweh_event_worker+0x557/0xc60
[   46.627962][    T7]  ? brcmf_fweh_call_event_handler.isra.0+0x100/0x100
[   46.628736][    T7]  ? rcu_read_lock_sched_held+0xa1/0xd0
[   46.629396][    T7]  ? rcu_read_lock_bh_held+0xb0/0xb0
[   46.629970][    T7]  ? lockdep_hardirqs_on_prepare+0x273/0x3e0
[   46.630649][    T7]  process_one_work+0x92b/0x1460
[   46.631205][    T7]  ? pwq_dec_nr_in_flight+0x330/0x330
[   46.631821][    T7]  ? rwlock_bug.part.0+0x90/0x90
[   46.632347][    T7]  worker_thread+0x95/0xe00
[   46.632832][    T7]  ? __kthread_parkme+0x115/0x1e0
[   46.633393][    T7]  ? process_one_work+0x1460/0x1460
[   46.633957][    T7]  kthread+0x3a1/0x480
[   46.634369][    T7]  ? set_kthread_struct+0x120/0x120
[   46.634933][    T7]  ret_from_fork+0x1f/0x30
[   46.635431][    T7]
[   46.635687][    T7] Allocated by task 7:
[   46.636151][    T7]  kasan_save_stack+0x1b/0x40
[   46.636628][    T7]  __kasan_kmalloc+0x7c/0x90
[   46.637108][    T7]  kmem_cache_alloc_trace+0x19e/0x330
[   46.637696][    T7]  brcmf_cfg80211_attach+0x4a0/0x4040
[   46.638275][    T7]  brcmf_attach+0x389/0xd40
[   46.638739][    T7]  brcmf_usb_probe+0x12de/0x1690
[   46.639279][    T7]  usb_probe_interface+0x2aa/0x760
[   46.639820][    T7]  really_probe+0x205/0xb70
[   46.640342][    T7]  __driver_probe_device+0x311/0x4b0
[   46.640876][    T7]  driver_probe_device+0x4e/0x150
[   46.641445][    T7]  __device_attach_driver+0x1cc/0x2a0
[   46.642000][    T7]  bus_for_each_drv+0x156/0x1d0
[   46.642543][    T7]  __device_attach+0x23f/0x3a0
[   46.643065][    T7]  bus_probe_device+0x1da/0x290
[   46.643644][    T7]  device_add+0xb7b/0x1eb0
[   46.644130][    T7]  usb_set_configuration+0xf59/0x16f0
[   46.644720][    T7]  usb_generic_driver_probe+0x82/0xa0
[   46.645295][    T7]  usb_probe_device+0xbb/0x250
[   46.645786][    T7]  really_probe+0x205/0xb70
[   46.646258][    T7]  __driver_probe_device+0x311/0x4b0
[   46.646804][    T7]  driver_probe_device+0x4e/0x150
[   46.647387][    T7]  __device_attach_driver+0x1cc/0x2a0
[   46.647926][    T7]  bus_for_each_drv+0x156/0x1d0
[   46.648454][    T7]  __device_attach+0x23f/0x3a0
[   46.648939][    T7]  bus_probe_device+0x1da/0x290
[   46.649478][    T7]  device_add+0xb7b/0x1eb0
[   46.649936][    T7]  usb_new_device.cold+0x49c/0x1029
[   46.650526][    T7]  hub_event+0x1c98/0x3950
[   46.650975][    T7]  process_one_work+0x92b/0x1460
[   46.651535][    T7]  worker_thread+0x95/0xe00
[   46.651991][    T7]  kthread+0x3a1/0x480
[   46.652413][    T7]  ret_from_fork+0x1f/0x30
[   46.652885][    T7]
[   46.653131][    T7] The buggy address belongs to the object at ffff888019442000
[   46.653131][    T7]  which belongs to the cache kmalloc-2k of size 2048
[   46.654669][    T7] The buggy address is located 0 bytes inside of
[   46.654669][    T7]  2048-byte region [ffff888019442000ffff888019442800)
[   46.656137][    T7] The buggy address belongs to the page:
[   46.656720][    T7] page:ffffea0000651000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x19440
[   46.657792][    T7] head:ffffea0000651000 order:3 compound_mapcount:0 compound_pincount:0
[   46.658673][    T7] flags: 0x100000000010200(slab|head|node=0|zone=1)
[   46.659422][    T7] raw: 0100000000010200 0000000000000000 dead000000000122 ffff888100042000
[   46.660363][    T7] raw: 0000000000000000 0000000000080008 00000001ffffffff 0000000000000000
[   46.661236][    T7] page dumped because: kasan: bad access detected
[   46.661956][    T7] page_owner tracks the page as allocated
[   46.662588][    T7] page last allocated via order 3, migratetype Unmovable, gfp_mask 0x52a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 7, ts 31136961085, free_ts 0
[   46.664271][    T7]  prep_new_page+0x1aa/0x240
[   46.664763][    T7]  get_page_from_freelist+0x159a/0x27c0
[   46.665340][    T7]  __alloc_pages+0x2da/0x6a0
[   46.665847][    T7]  alloc_pages+0xec/0x1e0
[   46.666308][    T7]  allocate_slab+0x380/0x4e0
[   46.666770][    T7]  ___slab_alloc+0x5bc/0x940
[   46.667264][    T7]  __slab_alloc+0x6d/0x80
[   46.667712][    T7]  kmem_cache_alloc_trace+0x30a/0x330
[   46.668299][    T7]  brcmf_usbdev_qinit.constprop.0+0x50/0x470
[   46.668885][    T7]  brcmf_usb_probe+0xc97/0x1690
[   46.669438][    T7]  usb_probe_interface+0x2aa/0x760
[   46.669988][    T7]  really_probe+0x205/0xb70
[   46.670487][    T7]  __driver_probe_device+0x311/0x4b0
[   46.671031][    T7]  driver_probe_device+0x4e/0x150
[   46.671604][    T7]  __device_attach_driver+0x1cc/0x2a0
[   46.672192][    T7]  bus_for_each_drv+0x156/0x1d0
[   46.672739][    T7] page_owner free stack trace missing
[   46.673335][    T7]
[   46.673620][    T7] Memory state around the buggy address:
[   46.674213][    T7]  ffff888019442700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[   46.675083][    T7]  ffff888019442780: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[   46.675994][    T7] >ffff888019442800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   46.676875][    T7]                    ^
[   46.677323][    T7]  ffff888019442880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   46.678190][    T7]  ffff888019442900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   46.679052][    T7] ==================================================================
[   46.679945][    T7] Disabling lock debugging due to kernel taint
[   46.680725][    T7] Kernel panic - not syncing:

Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Jisoo Jang <jisoo.jang@yonsei.ac.kr>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230309104457.22628-1-jisoo.jang@yonsei.ac.kr
16 months agowifi: rtw88: fix memory leak in rtw_usb_probe()
Dongliang Mu [Thu, 9 Mar 2023 02:16:36 +0000 (10:16 +0800)]
wifi: rtw88: fix memory leak in rtw_usb_probe()

drivers/net/wireless/realtek/rtw88/usb.c:876 rtw_usb_probe()
warn: 'hw' from ieee80211_alloc_hw() not released on lines: 811

Fix this by modifying return to a goto statement.

Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230309021636.528601-1-dzm91@hust.edu.cn
16 months agowifi: rtw89: coex: Add v5 firmware cycle status report
Ching-Te Ku [Wed, 8 Mar 2023 05:32:25 +0000 (13:32 +0800)]
wifi: rtw89: coex: Add v5 firmware cycle status report

To support v5 version firmware cycle report, apply the related structure
and functions. v5 cycle report add a group of status to show how the
free-run/TDMA training goes to. It is a firmware mechanism that can auto
adjust coexistence mode between TDMA and free run mechanism at 3 antenna
solution. v5 version provide more reference data to let the mechanism
make decision.

Signed-off-by: Ching-Te Ku <ku920601@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/20230308053225.24377-8-pkshih@realtek.com
16 months agowifi: rtw89: coex: Add v2 Bluetooth scan info
Ching-Te Ku [Wed, 8 Mar 2023 05:32:24 +0000 (13:32 +0800)]
wifi: rtw89: coex: Add v2 Bluetooth scan info

Compare to v1 and v2 removed some not usable parameters. Save firmware
code size. The information can show how frequent and how long the
Bluetooth scan do. It will help to debug coexistence issue.

Signed-off-by: Ching-Te Ku <ku920601@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/20230308053225.24377-7-pkshih@realtek.com
16 months agowifi: rtw89: coex: Fix wrong structure assignment at null data report
Ching-Te Ku [Wed, 8 Mar 2023 05:32:23 +0000 (13:32 +0800)]
wifi: rtw89: coex: Fix wrong structure assignment at null data report

Correct pointer assignment of v1 null data report. It doesn't really
change logic at all, but it looks more readable.

Signed-off-by: Ching-Te Ku <ku920601@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/20230308053225.24377-6-pkshih@realtek.com
16 months agowifi: rtw89: coex: Add register monitor report v2 format
Ching-Te Ku [Wed, 8 Mar 2023 05:32:22 +0000 (13:32 +0800)]
wifi: rtw89: coex: Add register monitor report v2 format

The v2 firmware report reduce its maximum register numbers from 30 to 20,
it can help to save firmware code size.

Signed-off-by: Ching-Te Ku <ku920601@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/20230308053225.24377-5-pkshih@realtek.com