Add support for AP (P2P_GO) UAPSD.

Signed-off-by: Janusz Dziedzic <janusz.dzied...@tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |   43 ++++++++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 5b433ee..94ac7b8 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -873,7 +873,7 @@ static void ath10k_peer_assoc_h_ht(struct ath10k *ar,
 }
 
 /*
- * FIXME: Handle UAPSD later.
+ * FIXME: Handle STA UAPSD later.
  */
 static void ath10k_peer_assoc_h_qos(struct ath10k *ar,
                                    struct ath10k_vif *arvif,
@@ -881,9 +881,49 @@ static void ath10k_peer_assoc_h_qos(struct ath10k *ar,
                                    struct ieee80211_bss_conf *bss_conf,
                                    struct wmi_peer_assoc_complete_arg *arg)
 {
+       u32 uapsd = 0;
+       u32 max_sp = 0;
+
        if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
                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;
+
+                       if (sta->uapsd_queues & 
IEEE80211_WMM_IE_STA_QOSINFO_AC_VO)
+                               uapsd |= WMI_AP_PS_UAPSD_AC0_DELIVERY_EN |
+                                        WMI_AP_PS_UAPSD_AC0_TRIGGER_EN;
+                       if (sta->uapsd_queues & 
IEEE80211_WMM_IE_STA_QOSINFO_AC_VI)
+                               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_BK)
+                               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_BE)
+                               uapsd |= WMI_AP_PS_UAPSD_AC3_DELIVERY_EN |
+                                        WMI_AP_PS_UAPSD_AC3_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);
+               }
+
        } else if (arvif->vdev_type == WMI_VDEV_TYPE_STA) {
                if (bss_conf->qos)
                        arg->peer_flags |= WMI_PEER_QOS;
@@ -2721,6 +2761,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
-- 
1.7.9.5

_______________________________________________
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel

Reply via email to