Commit Graph

1063432 Commits

Author SHA1 Message Date
Quentin Perret
4447d804f7 ANDROID: KVM: arm64: Expose kvm_flush_dcache_to_poc() in module_ops
Expose kvm_flush_dcache_to_poc() in the module_ops struct to allow CMOs
from pKVM modules.

Bug: 244543039
Bug: 244373730
Change-Id: I91d57a94effd2710d868591c6baf4a5672d149a4
Signed-off-by: Quentin Perret <qperret@google.com>
2022-12-07 14:35:27 +00:00
Quentin Perret
ca4247c356 ANDROID: KVM: arm64: Expose hyp fixmap helpers in module_ops
Expose the hyp_fixmap helpers in the module_ops struct to allow dynamic
mapping and unmapping of pages from pKVM modules.

Bug: 244543039
Bug: 244373730
Change-Id: I201db6044ed5eb4c2821a64a6b650b931dd2e389
Signed-off-by: Quentin Perret <qperret@google.com>
2022-12-07 14:35:27 +00:00
Quentin Perret
61229e6a03 ANDROID: KVM: arm64: Expose puts and putx64 in pKVM ABI
Expose the hyp_puts() and hyp_putx64() helpers in the module_ops struct
to allow logging messages on the UART from pKVM modules.

Bug: 244543039
Bug: 244373730
Change-Id: Ica578667297e5a1f94c370603c29482be89982a9
Signed-off-by: Quentin Perret <qperret@google.com>
2022-12-07 14:35:27 +00:00
Quentin Perret
b00bb0eab0 ANDROID: KVM: arm64: Add serial framework for pKVM
Debugging a hypervisor tends to be trickier than normal system code
such as the kernel. The lack of availability of a UART framework is a
significant contributor to that. In order to address this, introduce a
framework allowing to load serial drivers into the hypervisor.

Bug: 244543039
Bug: 244373730
Change-Id: I2e7a1fd9abc9d5aa9d95f1d271a997d54a8fd582
Signed-off-by: Quentin Perret <qperret@google.com>
2022-12-07 14:35:27 +00:00
Quentin Perret
8a846b7baf ANDROID: KVM: arm64: Expose __pkvm_create_private_mapping to pKVM modules
pKVM has an internal API allowing to create mappings in the 'private'
range of the hypervisor VA space for which there are no rules
constraining the VA-PA relation (hence comparable to the vmalloc area in
the kernel). This will be a useful API for hypervisor modules, so expose
it in the recently introduced module ops struct.

Bug: 244543039
Bug: 244373730
Change-Id: I2a8f958a02c3c3b9871224b65b00b207820a507a
Signed-off-by: Quentin Perret <qperret@google.com>
2022-12-07 14:35:27 +00:00
Quentin Perret
979197016b ANDROID: Add __pkvm_load_el2_module to symbol list
In order to allow loading el2 modules from kernel modules, let's expose
the __pkvm_load_el2_module() function in the GKI ABI.

Bug: 244543039
Bug: 244373730
Change-Id: I65410a02c67178427d4e0c115a24de1584f1adc7
Signed-off-by: Quentin Perret <qperret@google.com>
2022-12-07 14:35:27 +00:00
Quentin Perret
0e68921c2d ANDROID: KVM: arm64: Include .note.gnu.property in .hyp.rodata
Since .hyp.rodata sections of pKVM modules are emitted with SHT_MERGE,
ld.ldd feels free to attempt merging it with other sections.
Unfortunately, the pKVM module linker script doesn't always place them
in output sections, hence causing link failures:

  ld.lld: error: drivers/misc/pkvm-pl011/hyp/kvm_nvhe.tmp.o:(.hyp.rodata):
  offset is outside the section

In practice, ld.ldd only seems to attempt merging .note.gnu.property with
.hyp.rodata. To work around the problem, make sure to explicitely place
the .note.gnu.property in .hyp.rodata from the start, hence preventing
ld.ldd from trying to optimize further.

A preferable solution would be to teach ld.lld that merging pKVM modules
sections is a bad idea, or to make sure the sections are not emitted
with SHT_MERGE to begin with, but we couldn't find an obvious way to make
that happen. This workaround is nothing more than a pratical compromise.

Bug: 244543039
Reported-by: Will Deacon <will@kernel.org>
Suggested-by: Will Deacon <will@kernel.org>
Change-Id: Iae902bdfd21915f552e218515cd77881a95fef2d
Signed-off-by: Quentin Perret <qperret@google.com>
2022-12-07 14:35:27 +00:00
Quentin Perret
1c2e782ae5 ANDROID: KVM: arm64: Allow loading modules to the pKVM hypervisor
All nVHE hypervisor code is currently required to be statically linked
into the kernel image. Sadly, scaling pKVM will inevitably require
running _some_ hardware-specific code in the hypervisor due to the
absence of architecture requirements regarding IOMMU implementations or
power management, for example.

In order to address this issue, introduce the ability to load modules
in the pKVM hypervisor at run-time. pKVM modules are expected to be
embedded inside kernel modules, and to be loaded into pKVM when their
kernel counterpart is loaded at EL1. pKVM module loading is defined as a
privileged operation -- all of them must be loaded while the host kernel
is still part of the trusted computing base.

Bug: 244543039
Bug: 244373730
Co-authored-by: Vincent Donnefort <vdonnefort@google.com>
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
Signed-off-by: Quentin Perret <qperret@google.com>
Change-Id: If8e5d3ac0a2893c892aff09e5b51d3b8e14693f8
2022-12-07 14:35:27 +00:00
Quentin Perret
b1bd8930b8 ANDROID: KVM: arm64: Refactor nvhe Makefile
Building and linking hypervisor modules into kernel modules involves
very similar problems to building and linking the KVM nVHE hypervisor
object into the kernel image. In order to re-use the same building
procedure, let's factor out and generalize the nVHE makefile in a way
that allows it to be re-used for module builds.

Bug: 244543039
Bug: 244373730
Change-Id: I89b2630f8cfd3ce5b624300fc277749be4fc9e04
Signed-off-by: Quentin Perret <qperret@google.com>
[vdonnefort@: Merge with updated nvhe/Makefile]
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
2022-12-07 14:35:27 +00:00
Quentin Perret
9cb398bd05 ANDROID: KVM: arm64: Make gen-hyprel emit delimiters
The start and end pointers of the hyp relocs section are currently
specified in the vmlinux linker script. In order to ease re-using the
same relocation procedure for hypervisor modules, emit the delimiters
from the generated hyp-reloc.S file directly.

Bug: 244543039
Bug: 244373730
Change-Id: I845af2d40e1dd13301069537c6325f6a6f381ce4
Signed-off-by: Quentin Perret <qperret@google.com>
2022-12-07 14:35:27 +00:00
Quentin Perret
e13fa0a19e ANDROID: KVM: arm64: Move gen-hyprel into a tool directory
In order to allow re-use of the gen-hyprel tool to build hypervisor
modules in the future, move it up to the arm64 tools folder.

Bug: 244543039
Bug: 244373730
Change-Id: I188a2dac1acf4974213499970cc29552807497eb
Signed-off-by: Quentin Perret <qperret@google.com>
2022-12-07 14:35:27 +00:00
Vincent Donnefort
780c4654ab ANDROID: KVM: arm64: Add mapping removal interface for nVHE hyp
The new pkvm_remove_mappings() allows the caller to unmap a memory range
from the hypervisor.

This is to allow later introduction of in-hypervisor tracing.

Bug: 244543039
Bug: 229972309
Change-Id: I9edc7c2ae55c4b7f5d464d26ce3351b5fd4bf9f3
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
2022-12-07 14:35:27 +00:00
Quentin Perret
83ead5ea7b ANDROID: arm64: patching: Add aarch64_addr_write()
The process of applying hypervisor relocations involves patching
addresses in the hypervisor object. In the existing KVM nVHE relocation
procedure, the relocations are applied early enough for write-permission
not to be a problem when touching e.g. the rodata section. But applying
relocations on hypervisor modules embedded in a kernel module proves
more challenging, as the kernel module loader will actively map text and
rodata sections read-only. In order to allow patching in those sections,
let's introduce a new helper function using the text fixmap to
temporarily map the relevant pages writable.

Bug: 244543039
Bug: 244373730
Change-Id: I9dcdade1927e5bc121db87bc950fb70a374c44cd
Signed-off-by: Quentin Perret <qperret@google.com>
2022-12-07 14:35:27 +00:00
Quentin Perret
6e55e6e747 ANDROID: arm64: patching: Refactor __aarch64_insn_write()
In order to allow the re-use of __arch64_insn_write() to fixup
relocations in pKVM modules, refactor it into a more abstract
__arch64_text_write() function which also takes a size as parameter.

No functional changes intended.

Bug: 244543039
Bug: 244373730
Change-Id: I60d789d8a4b1271deeb2f6ac6d3b7fc55bdbb465
Signed-off-by: Quentin Perret <qperret@google.com>
2022-12-07 14:35:27 +00:00
Sami Tolvanen
c7eab89707 UPSTREAM: cfi: Use __builtin_function_start
Clang 14 added support for the __builtin_function_start function,
which allows us to implement the function_nocfi macro without
architecture-specific inline assembly and in a way that also works
with static initializers.

Change CONFIG_CFI_CLANG to depend on Clang >= 14, define
function_nocfi using __builtin_function_start, and remove the arm64
inline assembly implementation.

Link: ec2e26eaf6
Link: https://github.com/ClangBuiltLinux/linux/issues/1353
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Tested-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Will Deacon <will@kernel.org> # arm64
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Kees Cook <keescook@chromium.org>

Bug: 244543039
Bug: 244373730
Link: https://lore.kernel.org/r/20220405221618.633743-1-samitolvanen@google.com
(cherry picked from commit e6f3b3c9c1)
Change-Id: I71d0e805fc66123107ff51f6e30d689948d64fa1
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
2022-12-07 14:35:27 +00:00
James Prestwood
0c9fc56eeb UPSTREAM: wifi: nl80211: Add POWERED_ADDR_CHANGE feature
Add a new extended feature bit signifying that the wireless hardware
supports changing the MAC address while the underlying net_device is
powered. Note that this has a different meaning from
IFF_LIVE_ADDR_CHANGE as additional restrictions might be imposed by
the hardware, such as:

 - No connection is active on this interface, carrier is off
 - No scan is in progress
 - No offchannel operations are in progress

Signed-off-by: James Prestwood <prestwoj@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: Bug: 253289327
(cherry picked from commit a36c421690)
Change-Id: If579ffacd49fdf478c310e8ff991ca220abafbf9
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Paul Zhang
56b8b1c79d UPSTREAM: wifi: cfg80211: Fix bitrates overflow issue
When invoking function cfg80211_calculate_bitrate_eht about
(320 MHz, EHT-MCS 13, EHT-NSS 2, EHT-GI 0), which means the
parameters as flags: 0x80, bw: 7, mcs: 13, eht_gi: 0, nss: 2,
this formula (result * rate->nss) will overflow and causes
the returned bitrate to be 3959 when it should be 57646.

Here is the explanation:
 u64 tmp;
 u32 result;
 …
 /* tmp = result = 4 * rates_996[0]
  *     = 4 * 480388888 = 0x72889c60
  */
 tmp = result;

 /* tmp = 0x72889c60 * 6144 = 0xabccea90000 */
 tmp *= SCALE;

 /* tmp = 0xabccea90000 / mcs_divisors[13]
  *     = 0xabccea90000 / 5120 = 0x8970bba6
  */
 do_div(tmp, mcs_divisors[rate->mcs]);

 /* result = 0x8970bba6 */
 result = tmp;

 /* normally (result * rate->nss) = 0x8970bba6 * 2 = 0x112e1774c,
  * but since result is u32, (result * rate->nss) = 0x12e1774c,
  * overflow happens and it loses the highest bit.
  * Then result =  0x12e1774c / 8 = 39595753,
  */
 result = (result * rate->nss) / 8;

Signed-off-by: Paul Zhang <quic_paulz@quicinc.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 253289327
(cherry picked from commit 18429c51c7)
Change-Id: I0f6e6247be15cc0496539e8d7432d01d7add0cc9
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Tamizh Chelvam Raja
e7471649b8 UPSTREAM: wifi: cfg80211: fix MCS divisor value
The Bitrate for HE/EHT MCS6 is calculated wrongly due to the
incorrect MCS divisor value for mcs6. Fix it with the proper
value.

previous mcs_divisor value = (11769/6144) = 1.915527

fixed mcs_divisor value = (11377/6144) = 1.851725

Fixes: 9c97c88d2f ("cfg80211: Add support to calculate and report 4096-QAM HE rates")
Signed-off-by: Tamizh Chelvam Raja <quic_tamizhr@quicinc.com>
Link: https://lore.kernel.org/r/20220908181034.9936-1-quic_tamizhr@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 253289327
Change-Id: I3c826970eeb42c538c4b6a0c8efffe13e622df76
(cherry picked from commit 64e966d1e8)
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Johannes Berg
0dfcd40430 UPSTREAM: wifi: nl80211: add MLD address to assoc BSS entries
Add an MLD address attribute to BSS entries that the interface
is currently associated with to help userspace figure out what's
going on.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 253289327
(cherry picked from commit 6522047c65)
Change-Id: I1fc7a2091f3c2b3f1581dd2f281bfd383d68cf2c
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Jinpeng Cui
49c71cf2d7 UPSTREAM: wifi: nl80211: remove redundant err variable
Return value from rdev_set_mcast_rate() directly instead of
taking this in another redundant variable.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Jinpeng Cui <cui.jinpeng2@zte.com.cn>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 253289327
Change-Id: I51b4422895e8ddd9522f8e2c4ea3c8131989f32c
(cherry picked from commit a21cd7d63b)
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Veerendranath Jakkam
2d76ef755c BACKPORT: wifi: cfg80211: Add link_id to cfg80211_ch_switch_started_notify()
Add link_id parameter to cfg80211_ch_switch_started_notify() to allow
driver to indicate on which link channel switch started on MLD.

Send the data to userspace so it knows as well.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Link: https://lore.kernel.org/r/20220722131143.3438042-1-quic_vjakkam@quicinc.com
Link: https://lore.kernel.org/r/20220722131143.3438042-2-quic_vjakkam@quicinc.com
[squash two patches]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 243994705
(cherry picked from commit b8c9024e0e)
[cmllamas: fix minor merge conflict in net/mac80211/cfg.c]
Change-Id: I82e18b7cea893d5ab45217457712e63b2fc8c764
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Veerendranath Jakkam
81b44bd648 UPSTREAM: wifi: nl80211: send MLO links channel info in GET_INTERFACE
Currently, MLO link level channel information not sent to
userspace when NL80211_CMD_GET_INTERFACE requested on MLD.

Add support to send channel information for all valid links
for NL80211_CMD_GET_INTERFACE request.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Link: https://lore.kernel.org/r/20220722131000.3437894-1-quic_vjakkam@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 243994705
(cherry picked from commit 7a77cd47ec)
Change-Id: I8e6bec5369e87c1dfab419491963c877dde1c5fd
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Johannes Berg
d1e18aab78 BACKPORT: wifi: cfg80211/mac80211: check EHT capability size correctly
For AP/non-AP the EHT MCS/NSS subfield size differs, the
4-octet subfield is only used for 20 MHz-only non-AP STA.
Pass an argument around everywhere to be able to parse it
properly.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 253289327
Change-Id: I40a3f916cf6bb26ab0e7e36fbb32fefefeb3645b
(cherry picked from commit ea5cba269f)
[Kiran Kumar Lokere: Skipped changes in net/mac80211 due to missing
dependency changes]
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Veerendranath Jakkam
22428dd3fd UPSTREAM: wifi: cfg80211: Add link_id parameter to various key operations for MLO
Add support for various key operations on MLD by adding new parameter
link_id. Pass the link_id received from userspace to driver for add_key,
get_key, del_key, set_default_key, set_default_mgmt_key and
set_default_beacon_key to support configuring keys specific to each MLO
link. Userspace must not specify link ID for MLO pairwise key since it
is common for all the MLO links.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Link: https://lore.kernel.org/r/20220730052643.1959111-4-quic_vjakkam@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 241223350
(cherry picked from commit e7a7b84e33)
[cmllamas: fix trivial merge conflict in
 drivers/net/wireless/microchip/wilc1000/cfg80211.c]
Change-Id: I423057a29c0795c58ff013fd2a4b54bc5ced0217
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Veerendranath Jakkam
b19a3e20ee UPSTREAM: wifi: cfg80211: Prevent cfg80211_wext_siwencodeext() on MLD
Currently, MLO support is not added for WEXT code and WEXT handlers are
prevented on MLDs. Prevent WEXT handler cfg80211_wext_siwencodeext()
also on MLD which is missed in commit 7b0a0e3c3a ("wifi: cfg80211: do
some rework towards MLO link APIs")

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Link: https://lore.kernel.org/r/20220730052643.1959111-3-quic_vjakkam@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 243994705
(cherry picked from commit aa129bcd34)
Change-Id: I7810adfdb0550f2c968245cdc7332f3c61691ef7
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Veerendranath Jakkam
60cc532e54 UPSTREAM: wifi: cfg80211: reject connect response with MLO params for WEP
MLO connections are not supposed to use WEP security. Reject connect
response of MLO connection if WEP security mode is used.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Link: https://lore.kernel.org/r/20220730052643.1959111-2-quic_vjakkam@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 243994705
(cherry picked from commit 5ec245e4d1)
Change-Id: If1579d023e9026d044ac5c0fbd4481ebaabc316c
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Shaul Triebitz
a0b6aabf37 UPSTREAM: wifi: cfg80211: add link id to txq params
The Tx queue parameters are per link, so add the link ID
from nl80211 parameters to the API.

While at it, lock the wdev when calling into the driver
so it (and we) can check the link ID appropriately.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 253289327
Change-Id: I170af82c4d916103cdac672840f4176acb8baf77
(cherry picked from commit 9d2bb84d54)
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Shaul Triebitz
b4657b40c0 UPSTREAM: wifi: cfg80211: get correct AP link chandef
When checking for channel regulatory validity, use the
AP link chandef (and not mesh's chandef).

Fixes: 7b0a0e3c3a ("wifi: cfg80211: do some rework towards MLO link APIs")
Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 243994705
(cherry picked from commit bc1857619c)
Change-Id: Ia99a855e384f6d2e318122205f0b1f20a58e000a
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Ilan Peer
2bcf9d62a9 UPSTREAM: wifi: cfg80211: Update RNR parsing to align with Draft P802.11be_D2.0
Based on changes in the specification the TBTT information in
the RNR can include MLD information, so update the parsing to
allow extracting the short SSID information in such a case.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 253289327
Change-Id: Iafe63711d161c03a7857d60bddefc3f6f381c81c
(cherry picked from commit dd1671ed4a)
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Veerendranath Jakkam
44d9457c01 UPSTREAM: wifi: cfg80211: Fix validating BSS pointers in __cfg80211_connect_result
Driver's SME is allowed to fill either BSSID or BSS pointers in struct
cfg80211_connect_resp_params when indicating connect response but a
check in __cfg80211_connect_result() is giving unnecessary warning when
driver's SME fills only BSSID pointer and not BSS pointer in struct
cfg80211_connect_resp_params.

In case of mac80211 with auth/assoc path, it is always expected to fill
BSS pointers in struct cfg80211_connect_resp_params when calling
__cfg80211_connect_result() since cfg80211 must have hold BSS pointers
in cfg80211_mlme_assoc().

So, skip the check for the drivers which support cfg80211 connect
callback, for example with brcmfmac is one such driver which had the
warning:

WARNING: CPU: 5 PID: 514 at net/wireless/sme.c:786 __cfg80211_connect_result+0x2fc/0x5c0 [cfg80211]

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Fixes: efbabc1165 ("cfg80211: Indicate MLO connection info in connect and roam callbacks")
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
[kvalo@kernel.org: add more info to the commit log]
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220805135259.4126630-1-quic_vjakkam@quicinc.com

Bug: 255532233
(cherry picked from commit baa56dfe2c)
Change-Id: I52d592cd76ae3ae9e9a645b60bdd80377018fbc6
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Ilan Peer
49226f8453 BACKPORT: wifi: mac80211: Align with Draft P802.11be_D2.0
Align the mac80211 implementation with P802.11be_D2.0.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 253289327
Change-Id: I1032e96976efaa1241b499e72c44b5cfd0b26c68
(cherry picked from commit 062e8e02df)
[Kiran Kumar Lokere: Skipped changes in drivers/net/wireless/mac80211_hwsim.c
due to missing dependency changes]
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Ilan Peer
6f2cd3f078 BACKPORT: wifi: mac80211: Align with Draft P802.11be_D1.5
Align the mac80211 implementation with P802.11be_D1.5.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 253289327
Change-Id: If9b9aaef928558d1beaf3264432caa5f2ccd1d7f
(cherry picked from commit 1e0b3b0b6c)
[Kiran Kumar Lokere: Skipped changes in net/mac80211 due to missing
dependency changes]
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Johannes Berg
14ebe97a3b UPSTREAM: wifi: nl80211: add MLO link ID to the NL80211_CMD_FRAME TX API
Allow optionally specifying the link ID to transmit on,
which can be done instead of the link frequency, on an
MLD addressed frame. Both can also be omitted in which
case the frame must be MLD addressed and link selection
(and address translation) will be done on lower layers.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 253289327
(cherry picked from commit 95f498bb49)
Change-Id: I12414db5d8b52f87b3a06e06fdfbe9e24f631e78
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Johannes Berg
408df1a698 UPSTREAM: wifi: cfg80211: report link ID in NL80211_CMD_FRAME
If given by the underlying driver, report the link ID for
MLO in NL80211_CMD_FRAME.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 253289327
Change-Id: I52721391ac497bbe6c9a4589e9f68757d8d6a070
(cherry picked from commit 6074c9e574)
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Avraham Stern
0675fe6390 UPSTREAM: wifi: cfg80211: add hardware timestamps to frame RX info
Add hardware timestamps to management frame RX info.
This shall be used by drivers that support hardware timestamping for
Timing measurement and Fine timing measurement action frames RX.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 253289327
Change-Id: Iebcd830a2dff6e2b678b58a29435ecbc9cdbc7c9
(cherry picked from commit 1ff715ffa0)
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Avraham Stern
9749ade622 UPSTREAM: wifi: cfg80211/nl80211: move rx management data into a struct
The functions for reporting rx management take many arguments.
Collect all the arguments into a struct, which also make it easier
to add more arguments if needed.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 253289327
Change-Id: I1476f8b4ce6c60ac2383905c2b3cbb45c15cb32d
(cherry picked from commit 00b3d84010)
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Avraham Stern
d1ca56669b UPSTREAM: wifi: cfg80211: add a function for reporting TX status with hardware timestamps
Add a function for reporting TX status with hardware timestamps. This
function shall be used for reporting the TX status of Timing
measurement and Fine timing measurement action frames by devices that
support reporting hardware timestamps.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 253289327
Change-Id: Ic46fcb91b6ff4a4e5a90b6ab176be9595a56f0a8
(cherry picked from commit ea7d50c925)
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Avraham Stern
78051cd7b3 UPSTREAM: wifi: nl80211: add RX and TX timestamp attributes
Add attributes for reporting hardware timestamps for management frames
RX and TX. These attributes will be used for reporting hardware
timestamps for Timing measurement and Fine Timing Measurement action
frames, which will allow userspace applications to measure the path
delay between devices and sync clocks.

For TX, these attributes are used for reporting the frame RX time and
the ack TX time. For TX, they are used for reporting the frame TX time
and the ack RX time.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 253289327
(cherry picked from commit 80b0ed70a2)
Change-Id: I2b9404936ac089f05fccb972d3fa3e8aec9306cc
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Johannes Berg
664979644b BACKPORT: wifi: nl80211/mac80211: clarify link ID in control port TX
Clarify the link ID behaviour in control port TX, we need it
to select the link to transmit on for both MLD and non-MLD
receivers, but select the link address as the SA only if the
receiver is not an MLD.

Fixes: 67207bab93 ("wifi: cfg80211/mac80211: Support control port TX from specific link")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 253289327
Change-Id: Ia0884899da06d0ed9109922b8f2144d261782b4c
(cherry picked from commit 9dd1953846)
[Kiran Kumar Lokere: Skipped the changes in net/mac80211/tx.c]
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Johannes Berg
19b0fd0f5b UPSTREAM: wifi: nl80211: require MLD address on link STA add/modify
We always need the MLD address and link ID to add or
modify the link STA, so require it in the API.

Fixes: 577e5b8c39 ("wifi: cfg80211: add API to add/modify/remove a link station")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 253289327
Change-Id: If8538d272b84233b7b18bd5a21504bd7afd1428c
(cherry picked from commit 8876c67e62)
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Johannes Berg
868dce210c UPSTREAM: wifi: cfg80211: add cfg80211_get_iftype_ext_capa()
Add a helper function cfg80211_get_iftype_ext_capa() to
look up interface type-specific (extended) capabilities.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 253289327
Change-Id: I53f6168698e99001dc4fec61f89742e7d375ab83
(cherry picked from commit 7464f66515)
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Johannes Berg
e67ee6880d UPSTREAM: wifi: nl80211: fix some attribute policy entries
The new NL80211_CMD_ADD_LINK_STA and NL80211_CMD_MODIFY_LINK_STA
commands have strict policy validation, so fix the policy so it
can be validated correctly.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 253289327
Change-Id: I90e12da0a5e16361e57c4fc641795649f7f904ce
(cherry picked from commit ff5c4dc4cd)
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Johannes Berg
fc547e5784 UPSTREAM: wifi: nl80211: reject fragmented and non-inheritance elements
The underlying mac80211 code cannot deal with fragmented
elements for purposes of sorting the elements into the
association frame, so reject those inside the link. We
might want to reject them inside the assoc frame, but
they're used today for FILS, so cannot do that.

The non-inheritance element inside the links similarly
cannot be handled by mac80211, and outside the links it
makes no sense.

Reject both since using them could lead to an incorrect
implementation.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 253289327
Change-Id: Id53cc57e4ac7ad94b0450293e7ccf9be30fec250
(cherry picked from commit df35f3164e)
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Johannes Berg
61f067f659 UPSTREAM: wifi: nl80211: reject link specific elements on assoc link
When we associate, we'll include all the elements for the
link we're sending the association request on in the frame
and the specific ones for other links in the multi-link
element container. Prohibit adding link-specific elements
for the association link.

Fixes: d648c23024 ("wifi: nl80211: support MLO in auth/assoc")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 253289327
Change-Id: I80612e622ae70c57280809a57cf1a4e433b84589
(cherry picked from commit 34d76a14f8)
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Johannes Berg
e69e556555 UPSTREAM: wifi: cfg80211: set country_elem to NULL
The link loop will always have a valid link so that
it's always set, but static checkers don't always
see that, so set it to NULL explicitly.

Fixes: efbabc1165 ("cfg80211: Indicate MLO connection info in connect and roam callbacks")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 253289327
Change-Id: I6e904f9645e6cd63f67a2dbd14b14b59ee2690b8
(cherry picked from commit e3d331c9b6)
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Johannes Berg
a60bc52f1a UPSTREAM: wifi: nl80211: advertise MLO support
At least while we don't have any more specific interface
combinations support, add a simple flag for MLO support,
we can keep this later based on something other than the
wiphy flag.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 253289327
Change-Id: I23f34c7e11c9b2e43aae5a9a70e1c98c644ba058
(cherry picked from commit fa2ca639c4)
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Ilan Peer
8baa308fa7 UPSTREAM: wifi: nl80211: allow link ID in set_wiphy with frequency
This simplifies hostapd implementation, since it didn't
switch to NL80211_CMD_SET_CHANNEL.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 253289327
Change-Id: I8ff64675ac7eeb5474333d544bbf31844843e650
(cherry picked from commit 69c3f2d30c)
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Andrei Otcheretianski
95c387ed66 BACKPORT: wifi: cfg80211/mac80211: Support control port TX from specific link
In case of authentication with a legacy station, link addressed EAPOL
frames should be sent. Support it.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 253289327
Change-Id: Ic35514c528507b24caaf063c7c8ff37e22075d11
(cherry picked from commit 67207bab93)
[Kiran Kumar Lokere: Skipped the changes in net/mac80211/tx.c and made
changes required for compilation]
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Andrei Otcheretianski
9962736e1d UPSTREAM: wifi: nl80211: Support MLD parameters in nl80211_set_station()
Set the MLD parameters in NL80211_CMD_SET_STATION handling
to be able to change an MLD station.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 253289327
Change-Id: I9ff53b4e371d64e03773ea93fb372b92f4809e76
(cherry picked from commit d2bc52498b)
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Johannes Berg
3ae6cace0d UPSTREAM: wifi: nl80211: check MLO support in authenticate
We should check that MLO connections are supported before
attempting to authenticate with MLO parameters, check that.

Fixes: d648c23024 ("wifi: nl80211: support MLO in auth/assoc")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 253289327
Change-Id: Ia6a190a08d4e90a7f80e65a4b000b875cf61f997
(cherry picked from commit 45aaf17c0c)
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00