Skip to contentSkip to conversation

cfg80211: Handling driver updated MU-EDCA params

PATCH Superseded Muna Sinada 2 participants 7 messages Dec 8, 2020 – Aug 12, 2021

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 cfg80211: Handling driver updated MU-EDCA params

Added necessary functions and attributes to be able to pass driver updated MU-EDCA parameters from mac80211 to user space.

---
 include/net/cfg80211.h       | 12 ++++++++++++
 include/uapi/linux/nl80211.h | 10 ++++++++++
 net/wireless/nl80211.c       | 36 ++++++++++++++++++++++++++++++++++++
 3 files changed, 58 insertions(+)
include/net/cfg80211.h +12 -0
index ab249ca5d5d1..83e6101ad681 100644
@@ -8038,4 +8038,16 @@ void cfg80211_update_owe_info_event(struct net_device *netdev,
  */
 void cfg80211_bss_flush(struct wiphy *wiphy);
 
+/**
+ * cfg80211_update_muedca_params_event - Notify the updated MU-EDCA parameters
+ *	to user space.
+ *
+ * @wiphy: the wiphy
+ * @params: Updated MU-EDCA parameters
+ * @gfp: allocation flags
+ */
+void cfg80211_update_muedca_params_event(struct wiphy *wiphy,
+					 struct ieee80211_mu_edca_param_set
+					 *params, gfp_t gfp);
+
 #endif /* __NET_CFG80211_H */
include/uapi/linux/nl80211.h +10 -0
index 3e0d4a038ab6..0cd2e33f3df8 100644
@@ -1178,6 +1178,11 @@
  *	includes the contents of the frame. %NL80211_ATTR_ACK flag is included
  *	if the recipient acknowledged the frame.
  *
+ * @NL80211_CMD_UPDATE_HE_MUEDCA_PARAMS: Updated MU-EDCA parameters from
+ *	driver. This event is used to update dynamic MU-EDCA parameters in
+ *	Beacon frame, coming from driver and now need to be reflected in
+ *	Beacon frame.
+ *
  * @NL80211_CMD_MAX: highest used command number
  * @__NL80211_CMD_AFTER_LAST: internal use
  */
@@ -1408,6 +1413,7 @@ enum nl80211_commands {
 
 	NL80211_CMD_CONTROL_PORT_FRAME_TX_STATUS,
 
+	NL80211_CMD_UPDATE_HE_MUEDCA_PARAMS,
 	/* add new commands above here */
 
 	/* used to define NL80211_CMD_MAX below */
@@ -2534,6 +2540,9 @@ enum nl80211_commands {
  *	This is a u8 attribute that encapsulates one of the values from
  *	&enum nl80211_sae_pwe_mechanism.
  *
+ * @NL80211_ATTR_HE_MUEDCA_PARAMS: MU-EDCA AC parameters for the
+ *	%NL80211_CMD_UPDATE_HE_MUEDCA_PARAMS command.
+ *
  * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3025,6 +3034,7 @@ enum nl80211_attrs {
 
 	NL80211_ATTR_SAE_PWE,
 
+	NL80211_ATTR_HE_MUEDCA_PARAMS,
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
net/wireless/nl80211.c +36 -0
index 8811a4b69f21..75493758ec8e 100644
@@ -17806,6 +17806,42 @@ void cfg80211_update_owe_info_event(struct net_device *netdev,
 }
 EXPORT_SYMBOL(cfg80211_update_owe_info_event);
 
+void cfg80211_update_muedca_params_event(struct wiphy *wiphy,
+					 struct ieee80211_mu_edca_param_set
+					 *params, gfp_t gfp)
+{
+	struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
+	struct sk_buff *msg;
+	void *hdr;
+
+	msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp);
+	if (!msg)
+		return;
+
+	hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_UPDATE_HE_MUEDCA_PARAMS);
+	if (!hdr)
+		goto nla_put_failure;
+
+	if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx))
+		goto nla_put_failure;
+
+	if (nla_put(msg, NL80211_ATTR_HE_MUEDCA_PARAMS,
+		    sizeof(struct ieee80211_mu_edca_param_set),
+		    (const void *)params))
+		goto nla_put_failure;
+
+	genlmsg_end(msg, hdr);
+
+	genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0,
+				NL80211_MCGRP_MLME, gfp);
+	return;
+
+nla_put_failure:
+	genlmsg_cancel(msg, hdr);
+	nlmsg_free(msg);
+}
+EXPORT_SYMBOL(cfg80211_update_muedca_params_event);
+
 /* initialisation/exit functions */
 
 int __init nl80211_init(void)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/2 mac80211: Handling driver updated MU-EDCA params

Added necessary function to pass through driver updated MU-EDCA parameters to user space.

---
 include/net/mac80211.h | 15 +++++++++++++++
 net/mac80211/mlme.c    | 12 ++++++++++++
 net/mac80211/trace.h   | 20 ++++++++++++++++++++
 3 files changed, 47 insertions(+)
include/net/mac80211.h +15 -0
index 05c7524bab26..eeadddaf1f6a 100644
@@ -6695,4 +6695,19 @@ struct sk_buff *ieee80211_get_fils_discovery_tmpl(struct ieee80211_hw *hw,
 struct sk_buff *
 ieee80211_get_unsol_bcast_probe_resp_tmpl(struct ieee80211_hw *hw,
 					  struct ieee80211_vif *vif);
+
+/**
+ * ieee80211_update_muedca_params - update MU-EDCA parameters.
+ *
+ * This function is used to pass dynamically updated MU-EDCA parameters
+ * from driver to user space in order for parameters to be updated in beacon.
+ *
+ * @hw: pointer as obtained from ieee80211_alloc_hw()
+ * @params: updated MU-EDCA parameters
+ * @gfp: allocation flags
+ */
+void ieee80211_update_muedca_params(struct ieee80211_hw *hw,
+				    struct ieee80211_mu_edca_param_set
+				    *params, gfp_t gfp);
+
 #endif /* MAC80211_H */
net/mac80211/mlme.c +12 -0
index 6adfcb9c06dc..aba8fecf8284 100644
@@ -5934,3 +5934,15 @@ void ieee80211_cqm_beacon_loss_notify(struct ieee80211_vif *vif, gfp_t gfp)
 	cfg80211_cqm_beacon_loss_notify(sdata->dev, gfp);
 }
 EXPORT_SYMBOL(ieee80211_cqm_beacon_loss_notify);
+
+void ieee80211_update_muedca_params(struct ieee80211_hw *hw,
+				    struct ieee80211_mu_edca_param_set
+				    *params, gfp_t gfp)
+{
+	struct ieee80211_local *local = hw_to_local(hw);
+
+	trace_api_update_muedca_params(local, params);
+
+	cfg80211_update_muedca_params_event(local->hw.wiphy, params, gfp);
+}
+EXPORT_SYMBOL(ieee80211_update_muedca_params);
net/mac80211/trace.h +20 -0
index 89723907a094..4ede71bea435 100644
@@ -2767,6 +2767,26 @@ TRACE_EVENT(drv_sta_set_4addr,
 	)
 );
 
+TRACE_EVENT(api_update_muedca_params,
+	TP_PROTO(struct ieee80211_local *local,
+		 struct ieee80211_mu_edca_param_set *params),
+
+	TP_ARGS(local, params),
+
+	TP_STRUCT__entry(
+		LOCAL_ENTRY
+	),
+
+	TP_fast_assign(
+		LOCAL_ASSIGN;
+	),
+
+	TP_printk(
+		LOCAL_PR_FMT " updated MU-EDCA parameters",
+		LOCAL_PR_ARG
+	)
+);
+
 #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
 
 #undef TRACE_INCLUDE_PATH
Signature · 1 line
2.7.4
maintainer
#6 lore raw
In reply to Muna Sinada
Quoted 2 lines · Muna Sinada

Added necessary functions and attributes to be able to pass driver updated MU-EDCA parameters from mac80211 to user space.

Please write a proper commit message, in imperative voice.

Quoted 3 lines

+/**
+ * cfg80211_update_muedca_params_event - Notify the updated MU-EDCA parameters
+ * to user space.

"Notify the ... to" sounds really odd to me - "notify userspace about updated ..." or something?

Also this is missing a lot of commit message to explain what this does and when it's needed.

include/net/cfg80211.h void cfg80211_update_owe_info_event(struct net_device *netdev, · line 8051

Quoted 8 lines

+ *
+ * @wiphy: the wiphy
+ * @params: Updated MU-EDCA parameters
+ * @gfp: allocation flags
+ */

include/net/cfg80211.h +3 -0
+void cfg80211_update_muedca_params_event(struct wiphy *wiphy,
+					 struct ieee80211_mu_edca_param_set
+					 *params, gfp_t gfp);

that line breaking is awful

include/uapi/linux/nl80211.h enum nl80211_commands { · line 1417

Quoted 6 lines
include/uapi/linux/nl80211.h +1 -0
@@ -1408,6 +1413,7 @@ enum nl80211_commands {
 
 	NL80211_CMD_CONTROL_PORT_FRAME_TX_STATUS,
 
+	NL80211_CMD_UPDATE_HE_MUEDCA_PARAMS,
 	/* add new commands above here */

a blank line would be nice

Quoted 5 lines
include/uapi/linux/nl80211.h +0 -0
  *	This is a u8 attribute that encapsulates one of the values from
  *	&enum nl80211_sae_pwe_mechanism.

*
+ * @NL80211_ATTR_HE_MUEDCA_PARAMS: MU-EDCA AC parameters for the
+ * %NL80211_CMD_UPDATE_HE_MUEDCA_PARAMS command.

That should explain the data type.

include/uapi/linux/nl80211.h enum nl80211_attrs { · line 3038

Quoted 9 lines

* @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use

include/uapi/linux/nl80211.h +1 -0
@@ -3025,6 +3034,7 @@ enum nl80211_attrs {
 
 	NL80211_ATTR_SAE_PWE,
 
+	NL80211_ATTR_HE_MUEDCA_PARAMS,
 	/* add attributes here, update the policy in nl80211.c */

blank line again

net/wireless/nl80211.c void cfg80211_update_owe_info_event(struct net_device *netdev, · line 17811

Quoted 3 lines
net/wireless/nl80211.c +3 -0
+void cfg80211_update_muedca_params_event(struct wiphy *wiphy,
+					 struct ieee80211_mu_edca_param_set
+					 *params, gfp_t gfp)

line breaks are awful

probably should have tracing.

johannes

maintainer
#2 lore raw

Re: [PATCH 2/2] mac80211: Handling driver updated MU-EDCA params

In reply to Muna Sinada

net/mac80211/mlme.c void ieee80211_cqm_beacon_loss_notify(struct ieee80211_vif *vif, gfp_t gfp) · line 5948

Quoted 13 lines
net/mac80211/mlme.c +11 -0
+void ieee80211_update_muedca_params(struct ieee80211_hw *hw,
+				    struct ieee80211_mu_edca_param_set
+				    *params, gfp_t gfp)
+{
+	struct ieee80211_local *local = hw_to_local(hw);
+
+	trace_api_update_muedca_params(local, params);
+
+	cfg80211_update_muedca_params_event(local->hw.wiphy, params, gfp);
+}
+EXPORT_SYMBOL(ieee80211_update_muedca_params);

I see no reason to have this trivial wrapper.

johannes

#3 lore raw

RE: [PATCH 2/2] mac80211: Handling driver updated MU-EDCA params

Hello Johannes,

I saw on your review comment that this wrapper is not needed. I wanted to confirm with you if it would be ok to call a cfg80211 API from a mac80211 based driver, since that is what would be done if this wrapper is removed. Additionally, another reason I have this wrapper is so I can place a tracepoint. What are your thoughts about this?

Thank you,
Muna

-----Original Message-----
From: Johannes Berg <[email protected]>
Sent: Friday, February 12, 2021 12:49 AM
To: Muna Sinada <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH 2/2] mac80211: Handling driver updated MU-EDCA params

net/mac80211/mlme.c void ieee80211_cqm_beacon_loss_notify(struct ieee80211_vif *vif, gfp_t gfp) · line 5948

Quoted 11 lines
net/mac80211/mlme.c +10 -0
+void ieee80211_update_muedca_params(struct ieee80211_hw *hw,
+				    struct ieee80211_mu_edca_param_set
+				    *params, gfp_t gfp)
+{
+	struct ieee80211_local *local = hw_to_local(hw);
+
+	trace_api_update_muedca_params(local, params);
+
+	cfg80211_update_muedca_params_event(local->hw.wiphy, params, gfp); } 
+EXPORT_SYMBOL(ieee80211_update_muedca_params);

I see no reason to have this trivial wrapper.

johannes

maintainer
#4 lore raw

Re: [PATCH 2/2] mac80211: Handling driver updated MU-EDCA params

Quoted 6 lines · Muna Sinada

Hello Johannes,

I saw on your review comment that this wrapper is not needed. I wanted to confirm with you if it would be ok to call a cfg80211 API from a mac80211 based driver, since that is what would be done if this wrapper is removed.

Yes, that's fine.

Quoted 2 lines

Additionally, another reason I have this wrapper is so I can place a
tracepoint. What are your thoughts about this?

You already have a tracepoint on cfg80211, seems sufficient?

johannes

#5 lore raw

RE: [PATCH 2/2] mac80211: Handling driver updated MU-EDCA params

Hello Johannes,

Please drop this patch.

Thank you,
Muna

-----Original Message-----
From: Johannes Berg <[email protected]>
Sent: Wednesday, August 11, 2021 3:07 AM
To: Muna Sinada <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH 2/2] mac80211: Handling driver updated MU-EDCA params

Quoted 6 lines · Muna Sinada

Hello Johannes,

I saw on your review comment that this wrapper is not needed. I wanted to confirm with you if it would be ok to call a cfg80211 API from a mac80211 based driver, since that is what would be done if this wrapper is removed.

Yes, that's fine.

Quoted 2 lines

Additionally, another reason I have this wrapper is so I can place a
tracepoint. What are your thoughts about this?

You already have a tracepoint on cfg80211, seems sufficient?

johannes