Skip to contentSkip to conversation

ath10k: WMI add AP PS

PATCH New Janusz Dziedzic 2 participants 4 messages May 9, 2013 – May 14, 2013 Qualcomm Atheros ATH10K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 ath10k: WMI add AP PS

Add AP power save (UAPSD) structures, enums.

---
 drivers/net/wireless/ath/ath10k/wmi.c |   26 +++++++++++++
 drivers/net/wireless/ath/ath10k/wmi.h |   68 +++++++++++++++++++++++++++++++++
 2 files changed, 94 insertions(+)
drivers/net/wireless/ath/ath10k/wmi.c +26 -0
index d2d712d..bd1f076 100644
@@ -1903,6 +1903,32 @@ int ath10k_wmi_set_sta_ps_param(struct ath10k *ar, u32 vdev_id,
 	return ath10k_wmi_cmd_send(ar, skb, WMI_STA_POWERSAVE_PARAM_CMDID);
 }
 
+int ath10k_wmi_set_ap_ps_param(struct ath10k *ar, u32 vdev_id, const u8 *mac,
+			       enum wmi_ap_ps_peer_param param_id, u32 value)
+{
+	struct wmi_ap_ps_peer_cmd *cmd;
+	struct sk_buff *skb;
+
+	if (!mac)
+		return -EINVAL;
+
+	skb = ath10k_wmi_alloc_skb(sizeof(*cmd));
+	if (!skb)
+		return -ENOMEM;
+
+	cmd = (struct wmi_ap_ps_peer_cmd *)skb->data;
+	cmd->vdev_id = __cpu_to_le32(vdev_id);
+	cmd->param_id = __cpu_to_le32(param_id);
+	cmd->param_value = __cpu_to_le32(value);
+	memcpy(&cmd->peer_macaddr, mac, ETH_ALEN);
+
+	ath10k_dbg(ATH10K_DBG_WMI,
+		   "wmi ap ps param vdev_id 0x%X param %d value %d mac_addr %pM\n",
+		   vdev_id, param_id, value, mac);
+
+	return ath10k_wmi_cmd_send(ar, skb, WMI_AP_PS_PEER_PARAM_CMDID);
+}
+
 int ath10k_wmi_scan_chan_list(struct ath10k *ar,
 			      const struct wmi_scan_chan_list_arg *arg)
 {
drivers/net/wireless/ath/ath10k/wmi.h +68 -0

80 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v2 2/3 ath10k: add AP UAPSD support

Add support for AP (P2P_GO) UAPSD.

To test this functionality you can use wpa_supplicant, and enable AP UAPSD:
- p2p_set go_apsd 1
- p2p_group_add (or configure SoftAP) After that our P2P_GO/AP will indicate support for UAPSD in beacon/probe_resp WME IE. Now you can connect UAPSD capable station with configured UAPSD AC trigger/delivery bits.

---
 drivers/net/wireless/ath/ath10k/mac.c |   85 ++++++++++++++++++++++++++++++---
 1 file changed, 78 insertions(+), 7 deletions(-)
drivers/net/wireless/ath/ath10k/mac.c +78 -7
index 818b8e6..110ad3d 100644
@@ -906,21 +906,91 @@ static void ath10k_peer_assoc_h_ht(struct ath10k *ar,
 		   arg->peer_num_spatial_streams);
 }
 
+static void ath10k_peer_assoc_h_qos_ap(struct ath10k *ar,
+				       struct ath10k_vif *arvif,
+				       struct ieee80211_sta *sta,
+				       struct ieee80211_bss_conf *bss_conf,
+				       struct wmi_peer_assoc_complete_arg *arg)
+{
+	u32 uapsd = 0;
+	u32 max_sp = 0;
+
+	if (sta->wme)
+		arg->peer_flags |= WMI_PEER_QOS;
+
+	if (sta->wme && sta->uapsd_queues) {
+		ath10k_dbg(ATH10K_DBG_MAC, "uapsd_queues: 0x%X, max_sp: %d\n",
+			   sta->uapsd_queues, sta->max_sp);
+
+		arg->peer_flags |= WMI_PEER_APSD;
+		arg->peer_flags |= WMI_RC_UAPSD_FLAG;
+
+		if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VO)
+			uapsd |= WMI_AP_PS_UAPSD_AC3_DELIVERY_EN |
+				 WMI_AP_PS_UAPSD_AC3_TRIGGER_EN;
+		if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VI)
+			uapsd |= WMI_AP_PS_UAPSD_AC2_DELIVERY_EN |
+				 WMI_AP_PS_UAPSD_AC2_TRIGGER_EN;
+		if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_BK)
+			uapsd |= WMI_AP_PS_UAPSD_AC1_DELIVERY_EN |
+				 WMI_AP_PS_UAPSD_AC1_TRIGGER_EN;
+		if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_BE)
+			uapsd |= WMI_AP_PS_UAPSD_AC0_DELIVERY_EN |
+				 WMI_AP_PS_UAPSD_AC0_TRIGGER_EN;
+
+
+		if (sta->max_sp < MAX_WMI_AP_PS_PEER_PARAM_MAX_SP)
+			max_sp = sta->max_sp;
+
+		ath10k_wmi_set_ap_ps_param(ar, arvif->vdev_id,
+					   sta->addr,
+					   WMI_AP_PS_PEER_PARAM_UAPSD,
+					   uapsd);
+
+		ath10k_wmi_set_ap_ps_param(ar, arvif->vdev_id,
+					   sta->addr,
+					   WMI_AP_PS_PEER_PARAM_MAX_SP,
+					   max_sp);
+
+		/* TODO setup this based on STA listen interval and
+		   beacon interval. Currently we don't know
+		   sta->listen_interval - mac80211 patch required.
+		   Currently use 10 seconds */
+		ath10k_wmi_set_ap_ps_param(ar, arvif->vdev_id,
+					   sta->addr,
+					   WMI_AP_PS_PEER_PARAM_AGEOUT_TIME,
+					   10);
+	}
+}
+
 /*
- * FIXME: Handle UAPSD later.
+ * FIXME: Handle STA UAPSD later.
  */
+static void ath10k_peer_assoc_h_qos_sta(struct ath10k *ar,
+					struct ath10k_vif *arvif,
+					struct ieee80211_sta *sta,
+					struct ieee80211_bss_conf *bss_conf,
+					struct wmi_peer_assoc_complete_arg *arg)
+{
+	if (bss_conf->qos)
+		arg->peer_flags |= WMI_PEER_QOS;
+}
+
 static void ath10k_peer_assoc_h_qos(struct ath10k *ar,
 				    struct ath10k_vif *arvif,
 				    struct ieee80211_sta *sta,
 				    struct ieee80211_bss_conf *bss_conf,
 				    struct wmi_peer_assoc_complete_arg *arg)
 {
-	if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
-		if (sta->wme)
-			arg->peer_flags |= WMI_PEER_QOS;
-	} else if (arvif->vdev_type == WMI_VDEV_TYPE_STA) {
-		if (bss_conf->qos)
-			arg->peer_flags |= WMI_PEER_QOS;
+	switch (arvif->vdev_type) {
+	case WMI_VDEV_TYPE_AP:
+		ath10k_peer_assoc_h_qos_ap(ar, arvif, sta, bss_conf, arg);
+		break;
+	case WMI_VDEV_TYPE_STA:
+		ath10k_peer_assoc_h_qos_sta(ar, arvif, sta, bss_conf, arg);
+		break;
+	default:
+		break;
 	}
 }
 
@@ -2820,6 +2890,7 @@ int ath10k_mac_register(struct ath10k *ar)
 	ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
 	ar->hw->wiphy->max_remain_on_channel_duration = 5000;
 
+	ar->hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD;
 	/*
 	 * on LL hardware queues are managed entirely by the FW
 	 * so we only advertise to mac we can do the queues thing
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v2 3/3 ath10k: enable STA UAPSD support

In reply to Janusz Dziedzic

Enable UAPSD support for STA mode.

By default mac80211 enable UAPSD for
Voice AC. So, to test this functionality
we need AP with enable UAPSD and run traffic using VO AC (eg. ping -Q 0xFF). After sending such ping from AP->STA, HW/FW should not get this data after AP indicate this in beacon->pvb. Instead should wait host will send trigger frame (could be ping STA->AP). For non-UAPSD ACs standard PS should be used (NULL frames, PSPOLL).

---
 drivers/net/wireless/ath/ath10k/core.h |    1 +
 drivers/net/wireless/ath/ath10k/mac.c  |   78 ++++++++++++++++++++++++++++----
 2 files changed, 71 insertions(+), 8 deletions(-)
drivers/net/wireless/ath/ath10k/core.h +1 -0
index 6c681cf..bef85fb 100644
@@ -217,6 +217,7 @@ struct ath10k_vif {
 	union {
 		struct {
 			u8 bssid[ETH_ALEN];
+			u32 uapsd;
 		} sta;
 		struct {
 			/* 127 stations; wmi limit */
drivers/net/wireless/ath/ath10k/mac.c +70 -8

112 lines not on this page · raw message

Signature · 1 line
1.7.9.5