Skip to contentSkip to conversation

atk11: add EMA support

RFT/PATCH John Crispin 1 participant 1 message Oct 13, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

This patch adds EMA support to mac80211/EMA. Currently the patch will crash the FW. The RFT is aimed at the QCA team to help debug the FW crash.

---
 drivers/net/wireless/ath/ath11k/mac.c | 112 ++++++++++++++------
 drivers/net/wireless/ath/ath11k/wmi.c |   5 +-
 drivers/net/wireless/ath/ath11k/wmi.h |  27 ++++-
 include/net/cfg80211.h                |   2 +
 include/net/mac80211.h                |  79 ++++++++++++--
 include/uapi/linux/nl80211.h          |   3 +
 net/mac80211/cfg.c                    |  67 ++++++------
 net/mac80211/iface.c                  |   9 +-
 net/mac80211/tx.c                     | 143 ++++++++++++++++++++------
 net/wireless/nl80211.c                |   5 +-
 10 files changed, 338 insertions(+), 114 deletions(-)
drivers/net/wireless/ath/ath11k/mac.c +94 -25
Index: backports-20200628-4.4.60-9a94b73e75/drivers/net/wireless/ath/ath11k/mac.c
===================================================================
@@ -1069,32 +1069,19 @@ err_mon_del:
 	return ret;
 }
 
-static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif)
+static int __ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif, struct sk_buff *bcn,
+				       struct ieee80211_mutable_offsets offs,
+				       int ema_idx, int ema_cnt)
 {
 	struct ath11k *ar = arvif->ar;
 	struct ath11k_base *ab = ar->ab;
-	struct ieee80211_hw *hw = ar->hw;
-	struct ieee80211_vif *vif = arvif->vif;
-	struct ieee80211_mutable_offsets offs = {};
-	struct sk_buff *bcn;
 	struct ieee80211_mgmt *mgmt;
 	struct ieee80211_vht_cap *vht_cap;
+	u32 ema_param = 0;
 	u8 *ies;
 	int ret;
 	const u8 *vht_cap_ie;
 
-	if (arvif->vdev_type != WMI_VDEV_TYPE_AP)
-		return 0;
-
-	if (arvif->vif->multiple_bssid.non_transmitted)
-		return 0;
-
-	bcn = ieee80211_beacon_get_template_ema(hw, vif, &offs);
-	if (!bcn) {
-		ath11k_warn(ab, "failed to get beacon template from mac80211\n");
-		return -EPERM;
-	}
-
 	ies = bcn->data + ieee80211_get_hdrlen_from_skb(bcn);
 	ies += sizeof(mgmt->u.beacon);
 
@@ -1112,9 +1099,17 @@ static int ath11k_mac_setup_bcn_tmpl(str
 				    ies, (skb_tail_pointer(bcn) - ies)))
 		arvif->wpaie_present = true;
 
-	ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn);
+	if (ema_cnt) {
+		ema_param = ema_cnt << WMI_BEACON_EMA_PARAM_PERIODICITY_SHIFT;
+		ema_param |= ema_idx << WMI_BEACON_EMA_PARAM_TMPL_IDX_SHIFT;
+		ema_param |= (!ema_idx ? 1 : 0) <<
+			     WMI_BEACON_EMA_PARAM_FIRST_TMPL_SHIFT;
+		ema_param |= (ema_idx + 1 == ema_cnt ? 1 : 0) <<
+			     WMI_BEACON_EMA_PARAM_LAST_TMPL_SHIFT;
+	printk("%s:%s[%d]%x\n", __FILE__, __func__, __LINE__, ema_param);
+	}
 
-	kfree_skb(bcn);
+	ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn, ema_param);
 
 	if (ret)
 		ath11k_warn(ab, "failed to submit beacon template command: %d\n",
@@ -1123,12 +1118,80 @@ static int ath11k_mac_setup_bcn_tmpl(str
 	return ret;
 }
 
+static int ath11k_mac_setup_bcn_tmpl_ema(struct ath11k_vif *arvif)
+{
+	struct ath11k *ar = arvif->ar;
+	struct ieee80211_vif *vif = arvif->vif;
+	struct ieee80211_ema_bcn_list *bcn;
+	struct ieee80211_hw *hw = ar->hw;
+	struct list_head bcns;
+	int cnt, idx = 0, ret = 0;
+
+	INIT_LIST_HEAD(&bcns);
+	cnt = ieee80211_beacon_get_template_ema_list(hw, vif, &bcns);
+	if (!cnt){
+		ath11k_warn(ar->ab, "failed to get ema beacon template from mac80211\n");
+		return -EPERM;
+	}
+
+	printk("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
+	list_for_each_entry(bcn, &bcns, list) {
+		printk("%s:%s[%d]%d / %d\n", __FILE__, __func__, __LINE__, idx, cnt);
+		ret = __ath11k_mac_setup_bcn_tmpl(arvif, bcn->skb, bcn->offs, idx++, cnt);
+		if (ret)
+			break;
+	}
+printk("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
+
+	ieee80211_beacon_free_ema_list(&bcns);
+
+	return ret;
+}
+
+static int ath11k_mac_setup_bcn_tmpl_legacy(struct ath11k_vif *arvif)
+{
+	struct ath11k *ar = arvif->ar;
+	struct ieee80211_mutable_offsets offs = {};
+	struct ieee80211_vif *vif = arvif->vif;
+	struct ieee80211_hw *hw = ar->hw;
+	struct sk_buff *bcn;
+	int ret;
+
+	bcn = ieee80211_beacon_get_template(hw, vif, &offs);
+	if (!bcn) {
+		ath11k_warn(ar->ab, "failed to get beacon template from mac80211\n");
+		return -EPERM;
+	}
+
+	ret = __ath11k_mac_setup_bcn_tmpl(arvif, bcn, offs, 0, 0);
+
+	kfree_skb(bcn);
+
+	return ret;
+}
+
+static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif)
+{
+	if (arvif->vdev_type != WMI_VDEV_TYPE_AP)
+		return 0;
+
+	if (arvif->vif->multiple_bssid.parent)
+		return 0;
+
+	if (arvif->vif->multiple_bssid.flags & IEEE80211_VIF_MBSS_EMA_BEACON)
+		return ath11k_mac_setup_bcn_tmpl_ema(arvif);
+
+	return ath11k_mac_setup_bcn_tmpl_legacy(arvif);
+}
+
 void ath11k_mac_bcn_tx_event(struct ath11k_vif *arvif)
 {
 	struct ieee80211_vif *vif = arvif->vif, *child, *tmp;
 	int multiple_bssid = 0;
 
-	if (!vif->multiple_bssid.non_transmitted &&
+		return;
+
+/*	if (!vif->multiple_bssid_parent &&
 	    !list_empty(&vif->multiple_bssid.list)) {
 		if (vif->csa_active) {
 			if (ieee80211_csa_is_complete(vif)) {
@@ -1146,7 +1209,7 @@ void ath11k_mac_bcn_tx_event(struct ath1
 
 		multiple_bssid = 1;
 	}
-
+*/
 	if (!multiple_bssid)
 		return;
 
@@ -5449,7 +5512,7 @@ ath11k_mac_setup_vdev_create_params(stru
 	params->subtype = arvif->vdev_subtype;
 	params->pdev_id = pdev->pdev_id;
 	params->vdevid_trans = 0;
-	if (arvif->vif->multiple_bssid.non_transmitted) {
+	if (arvif->vif->multiple_bssid.flags & IEEE80211_VIF_MBSS_NON_TRANSMITTING) {
 		params->flags = WMI_HOST_VDEV_FLAGS_NON_TRANSMIT_AP;
 		parent = arvif->vif->multiple_bssid.parent;
 		if (!parent)
@@ -5457,10 +5520,13 @@ ath11k_mac_setup_vdev_create_params(stru
 		if (ar->hw->wiphy != ieee80211_vif_to_wdev(parent)->wiphy)
 			return -EINVAL;
 		params->vdevid_trans = ath11k_vif_to_arvif(parent)->vdev_id;
-	} else {
+	} else if (arvif->vif->multiple_bssid.flags & IEEE80211_VIF_MBSS_TRANSMITTING) {
 		params->flags = WMI_HOST_VDEV_FLAGS_TRANSMIT_AP;
 	}
 
+	if (arvif->vif->multiple_bssid.flags & IEEE80211_VIF_MBSS_EMA_BEACON)
+		params->flags |= WMI_HOST_VDEV_FLAGS_EMA_MODE;
+
 	if (pdev->cap.supported_bands & WMI_HOST_WLAN_2G_CAP) {
 		params->chains[NL80211_BAND_2GHZ].tx = ar->num_tx_chains;
 		params->chains[NL80211_BAND_2GHZ].rx = ar->num_rx_chains;
@@ -6095,7 +6161,7 @@ ath11k_mac_vdev_start_restart(struct ath
 
 	arg.channel.passive |= !!(chandef->chan->flags & IEEE80211_CHAN_NO_IR);
 
-	if (arvif->vif->multiple_bssid.non_transmitted) {
+	if (arvif->vif->multiple_bssid.flags & IEEE80211_VIF_MBSS_NON_TRANSMITTING) {
 		arg.mbss_capability_flags = WMI_HOST_VDEV_FLAGS_NON_TRANSMIT_AP;
 		parent = arvif->vif->multiple_bssid.parent;
 		if (!parent)
@@ -6103,10 +6169,13 @@ ath11k_mac_vdev_start_restart(struct ath
 		if (ar->hw->wiphy != ieee80211_vif_to_wdev(parent)->wiphy)
 			return -EINVAL;
 		arg.vdevid_trans = ath11k_vif_to_arvif(parent)->vdev_id;
-	} else {
+	} else if (arvif->vif->multiple_bssid.flags & IEEE80211_VIF_MBSS_TRANSMITTING) {
 		arg.mbss_capability_flags = WMI_HOST_VDEV_FLAGS_TRANSMIT_AP;
 	}
 
+	if (arvif->vif->multiple_bssid.flags & IEEE80211_VIF_MBSS_EMA_BEACON) {
+		arg.mbss_capability_flags |= WMI_HOST_VDEV_FLAGS_EMA_MODE;
+	}
 	ath11k_dbg(ab, ATH11K_DBG_MAC,
 		   "mac vdev %d start center_freq %d phymode %s\n",
 		   arg.vdev_id, arg.channel.freq,
drivers/net/wireless/ath/ath11k/wmi.c +6 -1
Index: backports-20200628-4.4.60-9a94b73e75/drivers/net/wireless/ath/ath11k/wmi.c
===================================================================
@@ -1788,7 +1788,7 @@ int ath11k_wmi_send_bcn_offload_control_
 
 int ath11k_wmi_bcn_tmpl(struct ath11k *ar, u32 vdev_id,
 			struct ieee80211_mutable_offsets *offs,
-			struct sk_buff *bcn)
+			struct sk_buff *bcn, u32 ema_params)
 {
 	struct ath11k_pdev_wmi *wmi = ar->wmi;
 	struct wmi_bcn_tmpl_cmd *cmd;
@@ -1814,6 +1814,7 @@ int ath11k_wmi_bcn_tmpl(struct ath11k *a
 	cmd->ext_csa_switch_count_offset = offs->csa_counter_offs[1];
 	cmd->buf_len = bcn->len;
 	cmd->mbssid_ie_offset = offs->multiple_bssid_offset;
+	cmd->ema_params = ema_params;
 
 	ptr = skb->data + sizeof(*cmd);
 
@@ -3727,6 +3728,8 @@ ath11k_wmi_copy_resource_config(struct w
 	wmi_cfg->sched_params = tg_cfg->sched_params;
 	wmi_cfg->twt_ap_pdev_count = tg_cfg->twt_ap_pdev_count;
 	wmi_cfg->twt_ap_sta_count = tg_cfg->twt_ap_sta_count;
+	wmi_cfg->ema_max_vap_cnt = tg_cfg->ema_max_vap_cnt;
+	wmi_cfg->ema_max_profile_period = tg_cfg->ema_max_profile_period;
 }
 
 static int ath11k_init_cmd_send(struct ath11k_pdev_wmi *wmi,
@@ -3959,6 +3962,8 @@ int ath11k_wmi_cmd_init(struct ath11k_ba
 	config.peer_map_unmap_v2_support = 1;
 	config.twt_ap_pdev_count = ab->num_radios;
 	config.twt_ap_sta_count = 1000;
+	config.ema_max_vap_cnt = 16;
+	config.ema_max_profile_period = 8;
 
 	memcpy(&wmi_sc->wlan_resource_config, &config, sizeof(config));
 
drivers/net/wireless/ath/ath11k/wmi.h +11 -1
Index: backports-20200628-4.4.60-9a94b73e75/drivers/net/wireless/ath/ath11k/wmi.h
===================================================================
@@ -2407,6 +2407,9 @@ struct wmi_resource_config {
 	u32 msdu_flow_override_config1;
 	u32 flags2;
 	u32 host_service_flags;
+	u32 max_rnr_neighbours;
+	u32 ema_max_vap_cnt;
+	u32 ema_max_profile_period;
 } __packed;
 
 struct wmi_service_ready_event {
@@ -3620,6 +3623,11 @@ struct wmi_get_pdev_temperature_cmd {
 
 #define WMI_BEACON_TX_BUFFER_SIZE	512
 
+#define WMI_BEACON_EMA_PARAM_PERIODICITY_SHIFT		0
+#define WMI_BEACON_EMA_PARAM_TMPL_IDX_SHIFT		8
+#define WMI_BEACON_EMA_PARAM_FIRST_TMPL_SHIFT		16
+#define WMI_BEACON_EMA_PARAM_LAST_TMPL_SHIFT		24
+
 struct wmi_bcn_tmpl_cmd {
 	u32 tlv_header;
 	u32 vdev_id;
@@ -5433,6 +5441,8 @@ struct target_resource_config {
 	u32 sched_params;
 	u32 twt_ap_pdev_count;
 	u32 twt_ap_sta_count;
+	u32 ema_max_vap_cnt;
+	u32 ema_max_profile_period;
 };
 
 enum wmi_tpc_pream_bw {
@@ -5647,7 +5657,7 @@ int ath11k_wmi_mgmt_send(struct ath11k *
 			 struct sk_buff *frame);
 int ath11k_wmi_bcn_tmpl(struct ath11k *ar, u32 vdev_id,
 			struct ieee80211_mutable_offsets *offs,
-			struct sk_buff *bcn);
+			struct sk_buff *bcn, u32 ema_param);
 int ath11k_wmi_vdev_down(struct ath11k *ar, u8 vdev_id);
 int ath11k_wmi_vdev_up(struct ath11k *ar, struct vdev_up_params *params);
 int ath11k_wmi_vdev_stop(struct ath11k *ar, u8 vdev_id);
include/net/cfg80211.h +3 -5
Index: backports-20200628-4.4.60-9a94b73e75/include/net/cfg80211.h
===================================================================
@@ -460,14 +460,14 @@ struct ieee80211_supported_band {
  *
  * @index: the index of this AP in the multi bssid group.
  * @count: the total number of multi bssid peer APs.
- * @parent: a non-transmitted bssid has a transmitted parent
- * @non_transmitted: Is this a non-transmitted bssid
+ * @parent: non-transmitted BSSs transmitted parents index
+ * @ema: Shall the beacons be sent out in EMA mode.
  */
 struct ieee80211_multiple_bssid {
 	u8 index;
 	u8 count;
 	u32 parent;
-	bool non_transmitted;
+	bool ema;
 };
 
 /**
@@ -614,7 +614,6 @@ static inline void wiphy_read_of_freq_li
  *	belonging to that MU-MIMO groupID; %NULL if not changed
  * @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring
  *	MU-MIMO packets going to the specified station; %NULL if not changed
- * @multiple_bssid: AP settings for multiple bssid
  */
 struct vif_params {
 	u32 flags;
@@ -622,7 +621,6 @@ struct vif_params {
 	u8 macaddr[ETH_ALEN];
 	const u8 *vht_mumimo_groups;
 	const u8 *vht_mumimo_follow_addr;
-	struct ieee80211_multiple_bssid	multiple_bssid;
 };
 
 /**
include/net/mac80211.h +76 -10

128 lines not on this page · raw message

include/uapi/linux/nl80211.h +3 -4
Index: backports-20200628-4.4.60-9a94b73e75/include/uapi/linux/nl80211.h
===================================================================
@@ -2522,9 +2522,6 @@ enum nl80211_commands {
  *	unsolicited broadcast probe response. It is a nested attribute, see
  *	&enum nl80211_unsol_bcast_probe_resp_attributes.
  *
- * @NL80211_ATTR_MULTIPLE_BSSID_NON_TRANSMITTING: Set the Non-Transmitted flag for this
- *	BSSIDs beacon.
- *
  * @NL80211_ATTR_MULTIPLE_BSSID_PARENT: If this is a Non-Transmitted BSSID, define
  *	the parent (transmitting) interface.
  *
@@ -2536,6 +2533,8 @@ enum nl80211_commands {
  * @NL80211_ATTR_MULTIPLE_BSSID_IES: The Elements that describe our multiple BSS group.
  *	these get passed separately as the kernel might need to split them up for EMA VAP.
  *
+ * @NL80211_ATTR_MULTIPLE_BSSID_EMA: Shall the multiple BSS beacons be sent out in EMA mode. 
+ *
  * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3024,11 +3023,11 @@ enum nl80211_attrs {
 
 	NL80211_ATTR_UNSOL_BCAST_PROBE_RESP,
 
-	NL80211_ATTR_MULTIPLE_BSSID_NON_TRANSMITTING,
 	NL80211_ATTR_MULTIPLE_BSSID_PARENT,
 	NL80211_ATTR_MULTIPLE_BSSID_INDEX,
 	NL80211_ATTR_MULTIPLE_BSSID_COUNT,
 	NL80211_ATTR_MULTIPLE_BSSID_IES,
+	NL80211_ATTR_MULTIPLE_BSSID_EMA,
 
 	/* add attributes here, update the policy in nl80211.c */
 
net/mac80211/cfg.c +27 -30

106 lines not on this page · raw message

net/mac80211/iface.c +4 -5
Index: backports-20200628-4.4.60-9a94b73e75/net/mac80211/iface.c
===================================================================
@@ -851,12 +851,11 @@ static void ieee80211_do_stop(struct iee
 	bool cancel_scan;
 	struct cfg80211_nan_func *func;
 
+	/* make sure the parent is already down */
 	if (sdata->vif.type == NL80211_IFTYPE_AP &&
-	    sdata->vif.multiple_bssid.non_transmitted)
-		/* make sure the parent is already down */
-		if (sdata->vif.multiple_bssid.parent &&
-		    ieee80211_sdata_running(vif_to_sdata(sdata->vif.multiple_bssid.parent)))
-			dev_close(vif_to_sdata(sdata->vif.multiple_bssid.parent)->wdev.netdev);
+	    sdata->vif.multiple_bssid.parent &&
+	    ieee80211_sdata_running(vif_to_sdata(sdata->vif.multiple_bssid.parent)))
+		dev_close(vif_to_sdata(sdata->vif.multiple_bssid.parent)->wdev.netdev);
 
 	clear_bit(SDATA_STATE_RUNNING, &sdata->state);
 
net/mac80211/tx.c +115 -33

252 lines not on this page · raw message

net/wireless/nl80211.c +8 -12
Index: backports-20200628-4.4.60-9a94b73e75/net/wireless/nl80211.c
===================================================================
@@ -758,10 +758,10 @@ static const struct nla_policy nl80211_p
 		NLA_POLICY_NESTED(fils_discovery_policy),
 	[NL80211_ATTR_UNSOL_BCAST_PROBE_RESP] =
 		NLA_POLICY_NESTED(unsol_bcast_probe_resp_policy),
-	[NL80211_ATTR_MULTIPLE_BSSID_NON_TRANSMITTING] = { .type = NLA_FLAG },
 	[NL80211_ATTR_MULTIPLE_BSSID_PARENT] = { .type = NLA_U32 },
 	[NL80211_ATTR_MULTIPLE_BSSID_INDEX] = { .type = NLA_U8 },
 	[NL80211_ATTR_MULTIPLE_BSSID_COUNT] = { .type = NLA_U8 },
+	[NL80211_ATTR_MULTIPLE_BSSID_EMA] = { .type = NLA_FLAG },
 	[NL80211_ATTR_MULTIPLE_BSSID_IES] = { .type = NLA_NESTED },
 };
 
@@ -3862,14 +3862,6 @@ static int nl80211_new_interface(struct
 			return err;
 	}
 
-	if (info->attrs[NL80211_ATTR_MULTIPLE_BSSID_NON_TRANSMITTING])
-		params.multiple_bssid.non_transmitted =
-			nla_get_flag(info->attrs[NL80211_ATTR_MULTIPLE_BSSID_NON_TRANSMITTING]);
-
-	if (info->attrs[NL80211_ATTR_MULTIPLE_BSSID_PARENT])
-		params.multiple_bssid.parent =
-			nla_get_u8(info->attrs[NL80211_ATTR_MULTIPLE_BSSID_PARENT]);
-
 	if (!cfg80211_iftype_allowed(&rdev->wiphy, type, params.use_4addr, 0))
 		return -EOPNOTSUPP;
 
@@ -5265,6 +5257,10 @@ static int nl80211_start_ap(struct sk_bu
 			return err;
 	}
 
+	if (info->attrs[NL80211_ATTR_MULTIPLE_BSSID_PARENT])
+		params.multiple_bssid.parent =
+			nla_get_u32(info->attrs[NL80211_ATTR_MULTIPLE_BSSID_PARENT]);
+
 	if (info->attrs[NL80211_ATTR_MULTIPLE_BSSID_INDEX])
 		params.multiple_bssid.index = nla_get_u8(
 				info->attrs[NL80211_ATTR_MULTIPLE_BSSID_INDEX]);
@@ -5272,10 +5268,10 @@ static int nl80211_start_ap(struct sk_bu
 	if (info->attrs[NL80211_ATTR_MULTIPLE_BSSID_COUNT])
 		params.multiple_bssid.count = nla_get_u8(
 				info->attrs[NL80211_ATTR_MULTIPLE_BSSID_COUNT]);
+	params.multiple_bssid.ema =
+		nla_get_flag(info->attrs[NL80211_ATTR_MULTIPLE_BSSID_EMA]);
 
-	if (params.multiple_bssid.non_transmitted &&
-	    !info->attrs[NL80211_ATTR_MULTIPLE_BSSID_PARENT])
-		return -EOPNOTSUPP;
+	printk("%s:%s[%d]%p %d %d %d\n", __FILE__, __func__, __LINE__, params.multiple_bssid.parent, params.multiple_bssid.index, params.multiple_bssid.count, params.multiple_bssid.ema);
 
 	nl80211_calculate_ap_params(&params);
 
Signature · 3 lines
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k