diff mbox series

[2/3] wifi: cfg80211: Extend cfg80211_update_owe_info_event() for MLD AP

Message ID 20221206080226.1702646-3-quic_vjakkam@quicinc.com
State Superseded
Headers show
Series [1/3] wifi: cfg80211: Extend cfg80211_new_sta() for MLD AP | expand

Commit Message

Veerendranath Jakkam Dec. 6, 2022, 8:02 a.m. UTC
Add support to offload OWE processing to user space for MLD AP. Send
link ID and peer's MLD address to user space when reporting
NL80211_CMD_UPDATE_OWE_INFO event in MLD AP mode.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
---
 drivers/net/wireless/quantenna/qtnfmac/event.c |  1 +
 include/net/cfg80211.h                         |  7 +++++++
 net/wireless/nl80211.c                         | 11 +++++++++++
 net/wireless/trace.h                           | 14 ++++++++++----
 4 files changed, 29 insertions(+), 4 deletions(-)

Comments

Johannes Berg Jan. 18, 2023, 3:42 p.m. UTC | #1
On Tue, 2022-12-06 at 13:32 +0530, Veerendranath Jakkam wrote:
> 
> + * @assoc_link_id: Indicates link ID of the AP MLD link on which (re)association
> + *	requested by peer. In non-MLD AP mode, it will be -1. Used only with OWE
> + *	update event (driver to user space).
> + * @peer_mld_addr: MLD address of the peer. For non-MLD peer, it will be all
> + *	zeros. Used only with OWE update event (driver to user space).


Similar here - why require setting assoc_link_id == -1 if
peer_mld_address can be left zeroes to indicate non-MLO connection?

That'd save you from updating the quantenna driver too, and

> --- a/net/wireless/nl80211.c
> +++ b/net/wireless/nl80211.c
> @@ -19776,6 +19776,17 @@ void cfg80211_update_owe_info_event(struct net_device *netdev,
>  	    nla_put(msg, NL80211_ATTR_IE, owe_info->ie_len, owe_info->ie))
>  		goto nla_put_failure;
>  
> +	if (owe_info->assoc_link_id != -1) {
> +		if (nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID,
> +			       owe_info->assoc_link_id))
> +			goto nla_put_failure;
> +
> +		if (!is_zero_ether_addr(owe_info->peer_mld_addr) &&
> +		    nla_put(msg, NL80211_ATTR_MLD_ADDR, ETH_ALEN,
> +			    owe_info->peer_mld_addr))
> +			goto nla_put_failure;
> +	}

here anyway you have that condition, so you could just lift the
is_zero_ether_addr() to the outer if?

johannes
Veerendranath Jakkam Jan. 21, 2023, 10:12 a.m. UTC | #2
On 1/18/2023 9:12 PM, Johannes Berg wrote:
> On Tue, 2022-12-06 at 13:32 +0530, Veerendranath Jakkam wrote:
>> + * @assoc_link_id: Indicates link ID of the AP MLD link on which (re)association
>> + *	requested by peer. In non-MLD AP mode, it will be -1. Used only with OWE
>> + *	update event (driver to user space).
>> + * @peer_mld_addr: MLD address of the peer. For non-MLD peer, it will be all
>> + *	zeros. Used only with OWE update event (driver to user space).
>
> Similar here - why require setting assoc_link_id == -1 if
> peer_mld_address can be left zeroes to indicate non-MLO connection?


"assoc_link_id" will be set to -1 when the AP operating in non-MLD mode, 
in that case peer_mld_addr can always be ignored since STAs always 
connects in non-MLO mode only.

When the AP operating in MLD mode, "assoc_link_id" should always be 
filled irrespective of the STA is MLD or not. This is needed to indicate 
user space about the event belong which affiliated AP of the AP MLD.

"peer_mld_addr" filled to indicate whether the peer is MLD or not.

Ex: if the AP operating in MLD mode and connected STA is non-MLD then 
"peer_mld_addr" will be all zeros but still "assoc_link_id" will set 
link ID of the corresponding AP under the AP MLD.

---

veeru
diff mbox series

Patch

diff --git a/drivers/net/wireless/quantenna/qtnfmac/event.c b/drivers/net/wireless/quantenna/qtnfmac/event.c
index 4fafe370101a..f0158737aed6 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/event.c
+++ b/drivers/net/wireless/quantenna/qtnfmac/event.c
@@ -662,6 +662,7 @@  qtnf_event_handle_update_owe(struct qtnf_vif *vif,
 	memcpy(ie, owe_ev->ies, ie_len);
 	owe_info.ie_len = ie_len;
 	owe_info.ie = ie;
+	owe_info.assoc_link_id = -1;
 
 	pr_info("%s: external OWE processing: peer=%pM\n",
 		vif->netdev->name, owe_ev->peer);
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 15619e0f5f0b..36cecfa217f1 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -3890,12 +3890,19 @@  struct cfg80211_pmsr_request {
  *	the IEs of the remote peer in the event from the host driver and
  *	the constructed IEs by the user space in the request interface.
  * @ie_len: Length of IEs in octets.
+ * @assoc_link_id: Indicates link ID of the AP MLD link on which (re)association
+ *	requested by peer. In non-MLD AP mode, it will be -1. Used only with OWE
+ *	update event (driver to user space).
+ * @peer_mld_addr: MLD address of the peer. For non-MLD peer, it will be all
+ *	zeros. Used only with OWE update event (driver to user space).
  */
 struct cfg80211_update_owe_info {
 	u8 peer[ETH_ALEN] __aligned(2);
 	u16 status;
 	const u8 *ie;
 	size_t ie_len;
+	int assoc_link_id;
+	u8 peer_mld_addr[ETH_ALEN] __aligned(2);
 };
 
 /**
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 5a20bf8b85d6..77254ed3b054 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -19776,6 +19776,17 @@  void cfg80211_update_owe_info_event(struct net_device *netdev,
 	    nla_put(msg, NL80211_ATTR_IE, owe_info->ie_len, owe_info->ie))
 		goto nla_put_failure;
 
+	if (owe_info->assoc_link_id != -1) {
+		if (nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID,
+			       owe_info->assoc_link_id))
+			goto nla_put_failure;
+
+		if (!is_zero_ether_addr(owe_info->peer_mld_addr) &&
+		    nla_put(msg, NL80211_ATTR_MLD_ADDR, ETH_ALEN,
+			    owe_info->peer_mld_addr))
+			goto nla_put_failure;
+	}
+
 	genlmsg_end(msg, hdr);
 
 	genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0,
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index a405c3edbc47..68b933d28070 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -3755,14 +3755,20 @@  TRACE_EVENT(cfg80211_update_owe_info_event,
 	    TP_STRUCT__entry(WIPHY_ENTRY
 			     NETDEV_ENTRY
 			     MAC_ENTRY(peer)
-			     __dynamic_array(u8, ie, owe_info->ie_len)),
+			     __dynamic_array(u8, ie, owe_info->ie_len)
+			     __field(int, assoc_link_id)
+			     MAC_ENTRY(peer_mld_addr)),
 	    TP_fast_assign(WIPHY_ASSIGN;
 			   NETDEV_ASSIGN;
 			   MAC_ASSIGN(peer, owe_info->peer);
 			   memcpy(__get_dynamic_array(ie), owe_info->ie,
-				  owe_info->ie_len);),
-	    TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", peer: " MAC_PR_FMT,
-		      WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(peer))
+				  owe_info->ie_len);
+			   __entry->assoc_link_id = owe_info->assoc_link_id;
+			   MAC_ASSIGN(peer_mld_addr, owe_info->peer_mld_addr);),
+	    TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", peer: " MAC_PR_FMT
+		      ", assoc_link_id: %d, peer_mld_addr: " MAC_PR_FMT,
+		      WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(peer),
+		      __entry->assoc_link_id, MAC_PR_ARG(peer_mld_addr))
 );
 
 TRACE_EVENT(cfg80211_bss_color_notify,