Commit Graph

1064108 Commits

Author SHA1 Message Date
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
Johannes Berg
8631763606 UPSTREAM: wifi: nl80211: set BSS to NULL if IS_ERR()
If the BSS lookup returned an error, set it to NULL so we
don't try to free it.

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

Bug: 253289327
Change-Id: I07544dc0867c37bacb1529b238043b50c5766f2e
(cherry picked from commit 9b6bf4d612)
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
161117be62 UPSTREAM: wifi: nl80211: add EML/MLD capabilities to per-iftype capabilities
We have the per-interface type capabilities, currently for
extended capabilities, add the EML/MLD capabilities there
to have this advertised by the driver.

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

Bug: 253289327
(cherry picked from commit 4e9c3af398)
Change-Id: I67be1c0c3d49687cc5821d7382bd291c470ffd20
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Johannes Berg
8eed1bc70a UPSTREAM: wifi: nl80211: better validate link ID for stations
If we add a station on an MLD, we need a link ID to see
where it lives (by default). Validate the link ID against
the valid_links.

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

Bug: 253289327
Change-Id: Idc331350beb22e7dd2139793fdcf251eb31d40ae
(cherry picked from commit efbfe5165e)
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Johannes Berg
da8fd80657 UPSTREAM: wifi: cfg80211: clean up links appropriately
This was missing earlier, we need to remove links when
interfaces are being destroyed, and we also need to
stop (AP) operations when a link is being destroyed.
Address these issues to remove many warnings that will
otherwise appear in mac80211.

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

Bug: 253289327
Change-Id: I5645aa4887d1a44a93c2ccf805c4e27977e007a3
(cherry picked from commit cdf0a0a80c)
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Johannes Berg
149110535d UPSTREAM: wifi: cfg80211: add ieee80211_chanwidth_rate_flags()
To simplify things when we don't have a full chandef,
add ieee80211_chanwidth_rate_flags().

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

Bug: 253289327
Change-Id: I7b103db6b889684713db512f25fd921e046cd2ef
(cherry picked from commit 19654a61bf)
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Johannes Berg
ad895360c7 UPSTREAM: wifi: cfg80211: extend cfg80211_rx_assoc_resp() for MLO
Extend the cfg80211_rx_assoc_resp() to cover multiple
BSSes, the AP MLD address and local link addresses
for MLO.

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

Bug: 253289327
Change-Id: I24880a53d87aeda72ab01419db58bd1eba16b206
(cherry picked from commit 5cd212cb64)
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Johannes Berg
252aa78538 UPSTREAM: wifi: cfg80211: put cfg80211_rx_assoc_resp() arguments into a struct
For MLO we'll need a lot more arguments, including all the
BSS pointers and link addresses, so move the data to a struct
to be able to extend it more easily later.

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

Bug: 253289327
(cherry picked from commit cd47c0f57a)
[cmllamas: fix trivial merge conflict in net/mac80211/mlme.c]
Change-Id: I5f6821618db032caae99451e91c15b75ed9afbd5
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Johannes Berg
a66db63925 BACKPORT: wifi: cfg80211: adjust assoc comeback for MLO
We only report the BSSID to userspace, so change the
argument from BSS struct pointer to AP address, which
we'll use to carry either the BSSID or AP MLD address.

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

Bug: 253289327
Change-Id: Ib890447b19eee64d64c315f6bd6b0f546db478b9
(cherry picked from commit e69dac88a1)
[Kiran Kumar Lokere: Skipped the changes in net/mac80211/mlme.c as
the conflict changes not present]
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Johannes Berg
90454d5775 UPSTREAM: wifi: cfg80211: prepare association failure APIs for MLO
For MLO, we need the ability to report back multiple BSS
structures to release, as well as the AP MLD address (if
attempting to make an MLO connection).

Unify cfg80211_assoc_timeout() and cfg80211_abandon_assoc()
into a new cfg80211_assoc_failure() that gets a structure
parameter with the necessary data.

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

Bug: 253289327
(cherry picked from commit f662d2f4e2)
Change-Id: Iab3b16948491b94e59275ecc414fac8e6d421ca9
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Johannes Berg
5ad5ef4285 BACKPORT: wifi: cfg80211: remove BSS pointer from cfg80211_disassoc_request
The race described by the comment in mac80211 hasn't existed
since the locking rework to use the same lock and for MLO we
need to pass the AP MLD address, so just pass the BSSID or
AP MLD address instead of the BSS struct pointer, and adjust
all the code accordingly.

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

Bug: 253289327
Change-Id: Ia8f0c411c06873b9f4992ee8d147e630c7698fc5
(cherry picked from commit 8f6e0dfc22)
[Kiran Kumar Lokere: Skipped the changes in net/mac80211/mlme.c and made
 changes required for compilation]
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Johannes Berg
3c03b7706e UPSTREAM: wifi: nl80211: acquire wdev mutex for dump_survey
At least the quantenna driver calls wdev_chandef() here
which now requires the lock, so acquire it.

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

Bug: 253289327
Change-Id: Ib8205cf6e8b8b55a4329238304dcc39c4e3f8a34
(cherry picked from commit 284b38b690)
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Johannes Berg
c88777af1f UPSTREAM: wifi: cfg80211: drop BSS elements from assoc trace for now
For multi-link operation, this cannot work as the req->bss pointer
will be NULL, and we'll need to do more work on this to really add
tracing for the MLO case here. Drop the BSS elements for now as
they're not the most useful thing, and it's hard to size things
correctly for the MLO case (without adding a lot of code that's
also executed when tracing isn't enabled.)

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 253289327
Change-Id: Ib78175f0ac472f6c1a1c02c989bcb296f1e6a88a
(cherry picked from commit 1d4c0f0405)
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Johannes Berg
ae5afa8851 UPSTREAM: wifi: cfg80211: make cfg80211_auth_request::key_idx signed
We might assign -1 to it in some cases when key is NULL,
which means the key_idx isn't used but can lead to a
warning from static checkers such as smatch.

Make the struct member signed simply to avoid that, we
only need a range of -1..3 anyway.

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

Bug: 253289327
Change-Id: Iaaa6e53137530af1c5364de880c7e0947abd19bc
(cherry picked from commit 23cc6d8c37)
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Shaul Triebitz
c2c70cf947 UPSTREAM: wifi: nl80211: enable setting the link address at new station
Since for an MLD station the default link is added together
with the add station command, allow also setting the link
MAC address.
Otherwise, it is needed to use the modify link API only
for setting the link MAC address.

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

Bug: 253289327
Change-Id: I4eb0da6b2b666d4b2bcb53f810cda471278c575b
(cherry picked from commit c0d6701261)
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Johannes Berg
631c80f058 UPSTREAM: wifi: nl80211: hold wdev mutex for station APIs
Since this will need to refer - at least in part - to the link
stations of an MLD, hold the wdev mutex for driver convenience.

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

Bug: 253289327
Change-Id: Ied1bcd18d50c11be89c9f1570ac4ce56fea84728
(cherry picked from commit 3d1cc7cdf2)
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Johannes Berg
05744901bd UPSTREAM: wifi: nl80211: hold wdev mutex for channel switch APIs
Since we deal with links in an MLD here, hold the wdev
mutex now.

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

Bug: 253289327
Change-Id: I4025ae8a2a3a206fe0bf7c1051bbbbec6df71943
(cherry picked from commit 4e2f3d67e3)
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Johannes Berg
13338f9dc3 UPSTREAM: wifi: nl80211: hold wdev mutex in add/mod/del link station
Since we deal with links, and that requires looking at wdev links,
we should hold the wdev mutex for driver convenience.

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

Bug: 253289327
Change-Id: I8fe86027eb3a9c4fa32832114c76eb1146088938
(cherry picked from commit 858fd1880b)
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Shaul Triebitz
cf8f4f7b56 BACKPORT: wifi: cfg80211/mac80211: separate link params from station params
Put the link_station_parameters structure in the station_parameters
structure (and remove the station_parameters fields already existing
in link_station_parameters).
Now, for an MLD station, the default link is added together with
the station.

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

Bug: 248430009
Change-Id: Iab7cd899b27f6e4b5664c223b3b14c9045fcfa0a
(cherry picked from commit b95eb7f0ee)
[Kiran Kumar Lokere: Skipped the changes in net/mac80211/cfg.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
Sriram R
af6fc28081 BACKPORT: mac80211: prepare sta handling for MLO support
Currently in mac80211 each STA object is represented
using sta_info datastructure with the associated
STA specific information and drivers access ieee80211_sta
part of it.

With MLO (Multi Link Operation) support being added
in 802.11be standard, though the association is logically
with a single Multi Link capable STA, at the physical level
communication can happen via different advertised
links (uniquely identified by Channel, operating class,
BSSID) and hence the need to handle multiple link
STA parameters within a composite sta_info object
called the MLD STA. The different link STA part of
MLD STA are identified using the link address which can
be same or different as the MLD STA address and unique
link id based on the link vif.

To support extension of such a model, the sta_info
datastructure is modified to hold multiple link STA
objects with link specific params currently within
sta_info moved to this new structure. Similarly this is
done for ieee80211_sta as well which will be accessed
within mac80211 as well as by drivers, hence trivial
driver changes are expected to support this.

For current non MLO supported drivers, only one link STA
is present and link information is accessed via 'deflink'
member.

For MLO drivers, we still need to define the APIs etc. to
get the correct link ID and access the correct part of
the station info.

Currently in mac80211, all link STA info are accessed directly
via deflink. These will be updated to access via link pointers
indexed by link id with MLO support patches, with link id
being 0 for non MLO supported cases.

Except for couple of macro related changes, below spatch takes
care of updating mac80211 and driver code to access to the
link STA info via deflink.

  @ieee80211_sta@
  struct ieee80211_sta *s;
  struct sta_info *si;
  identifier var = {supp_rates, ht_cap, vht_cap, he_cap, he_6ghz_capa, eht_cap, rx_nss, bandwidth, txpwr};
  @@

  (
    s->
  -    var
  +    deflink.var
  |
   si->sta.
  -    var
  +    deflink.var
  )

  @sta_info@
  struct sta_info *si;
  identifier var = {gtk, pcpu_rx_stats, rx_stats, rx_stats_avg, status_stats, tx_stats, cur_max_bandwidth};
  @@

  (
    si->
  -    var
  +    deflink.var
  )

Signed-off-by: Sriram R <quic_srirrama@quicinc.com>
Link: https://lore.kernel.org/r/1649086883-13246-1-git-send-email-quic_srirrama@quicinc.com
[remove MLO-drivers notes from commit message, not clear yet; run spatch]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 255532233
(cherry picked from commit 046d2e7c50)
Change-Id: I70b73777b22e74f6e4745d2feafe0d7599211454
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Shaul Triebitz
de01c4d258 UPSTREAM: wifi: cfg80211: add API to add/modify/remove a link station
Add an API for adding/modifying/removing a link of a station.

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

Bug: 253289327
(cherry picked from commit 577e5b8c39)
Change-Id: I8aeb58751079cb1698aee358fb501025993907bd
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Andrei Otcheretianski
51f7d197a5 UPSTREAM: wifi: cfg80211: Allow MLO TX with link source address
Management frames are transmitted from link address and not device
address. Allow that.

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

Bug: 253289327
Change-Id: I8d5cd8b6773531745bd60007d94b2a126c6d4054
(cherry picked from commit 6df2810ac9)
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Veerendranath Jakkam
f1ee9a834e UPSTREAM: wifi: nl80211: fix sending link ID info of associated BSS
commit dd374f84ba ("wifi: nl80211: expose link ID for associated
BSSes") used a top-level attribute to send link ID of the associated
BSS in the nested attribute NL80211_ATTR_BSS. But since NL80211_ATTR_BSS
is a nested attribute of the attributes defined in enum nl80211_bss,
define a new attribute in enum nl80211_bss and use it for sending the
link ID of the BSS.

Fixes: dd374f84ba ("wifi: nl80211: expose link ID for associated BSSes")
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Link: https://lore.kernel.org/r/20220708122607.1836958-1-quic_vjakkam@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 238597250
(cherry picked from commit 3c512307de)
Change-Id: Id00e1f6a1a5b41e0b91e1840394adb80cbe313a4
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Veerendranath Jakkam
c2102849df UPSTREAM: wifi: cfg80211: fix a comment in cfg80211_mlme_mgmt_tx()
A comment in cfg80211_mlme_mgmt_tx() is describing this API used only
for transmitting action frames. Fix the comment since
cfg80211_mlme_mgmt_tx() can be used to transmit any management frame.

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

Bug: 238597250
(cherry picked from commit c528d7a275)
Change-Id: I43b8a64c8be2325a4dca3c4998c67cb9b406d0f7
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Veerendranath Jakkam
8089024abf UPSTREAM: wifi: nl80211: Fix reading NL80211_ATTR_MLO_LINK_ID in nl80211_pre_doit
nl80211_pre_doit() using nla_get_u16() to read u8 attribute
NL80211_ATTR_MLO_LINK_ID. Fix this by using nla_get_u8() to
read NL80211_ATTR_MLO_LINK_ID attribute.

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

Bug: 238597250
(cherry picked from commit ff3821bc35)
Change-Id: I4a22fdb477cc32ca5484472e66b03054ecf43852
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00
Aloka Dixit
fe8d2fb083 UPSTREAM: wifi: nl80211: retrieve EHT related elements in AP mode
Add support to retrieve EHT capabilities and EHT operation elements
passed by the userspace in the beacon template and store the pointers
in struct cfg80211_ap_settings to be used by the drivers.

Co-developed-by: Vikram Kandukuri <quic_vikram@quicinc.com>
Signed-off-by: Vikram Kandukuri <quic_vikram@quicinc.com>
Co-developed-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Link: https://lore.kernel.org/r/20220523064904.28523-1-quic_alokad@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 238103864
Change-Id: If5998e279b39136a6f9b24a9ceedbc0248fe7810
(cherry picked from commit 8bc65d38ee)
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
55417f945d UPSTREAM: wifi: cfg80211: Increase akm_suites array size in cfg80211_crypto_settings
Increase akm_suites array size in struct cfg80211_crypto_settings to 10
and advertise the capability to userspace. This allows userspace to send
more than two AKMs to driver in netlink commands such as
NL80211_CMD_CONNECT.

This capability is needed for implementing WPA3-Personal transition mode
correctly with any driver that handles roaming internally. Currently,
the possible AKMs for multi-AKM connect can include PSK, PSK-SHA-256,
SAE, FT-PSK and FT-SAE. Since the count is already 5, increasing
the akm_suites array size to 10 should be reasonable for future
usecases.

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

Bug: 233387627
(cherry picked from commit ecad3b0b99)
Change-Id: I8ef778df6d5fb288bc505a38833663e572bc7286
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2022-12-07 00:37:19 +00:00