]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ath11k: add spatial reuse support
authorJohn Crispin <john@phrozen.org>
Mon, 25 Nov 2019 16:36:29 +0000 (16:36 +0000)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 27 Nov 2019 15:46:51 +0000 (17:46 +0200)
Trigger the WMI call en/disabling OBSS PD when the bss config changes or we
assoc to an AP that broadcasts the IE.

Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ath/ath11k/mac.c
drivers/net/wireless/ath/ath11k/wmi.c
drivers/net/wireless/ath/ath11k/wmi.h

index 70945d121fbaef13ff83f08d949d74ff7efe60cd..c25817c51d873a2b1d9a6e4c09a92b231756a223 100644 (file)
@@ -1612,6 +1612,12 @@ static void ath11k_bss_assoc(struct ieee80211_hw *hw,
                                        1);
        if (ret)
                ath11k_warn(ar->ab, "Unable to authorize BSS peer: %d\n", ret);
+
+       ret = ath11k_wmi_send_obss_spr_cmd(ar, arvif->vdev_id,
+                                          &bss_conf->he_obss_pd);
+       if (ret)
+               ath11k_warn(ar->ab, "failed to set vdev %i OBSS PD parameters: %d\n",
+                           arvif->vdev_id, ret);
 }
 
 static void ath11k_bss_disassoc(struct ieee80211_hw *hw,
@@ -1916,6 +1922,10 @@ static void ath11k_mac_op_bss_info_changed(struct ieee80211_hw *hw,
                        ath11k_wmi_send_twt_disable_cmd(ar, ar->pdev_idx);
        }
 
+       if (changed & BSS_CHANGED_HE_OBSS_PD)
+               ath11k_wmi_send_obss_spr_cmd(ar, arvif->vdev_id,
+                                            &info->he_obss_pd);
+
        mutex_unlock(&ar->conf_mutex);
 }
 
index 7aa66e8eecb6d34be89fc7df8d44d17143644ba0..2c3c973f5f7c5cd291ce7d4962fd46dbf9397d2c 100644 (file)
@@ -2541,6 +2541,41 @@ ath11k_wmi_send_twt_disable_cmd(struct ath11k *ar, u32 pdev_id)
        return ret;
 }
 
+int
+ath11k_wmi_send_obss_spr_cmd(struct ath11k *ar, u32 vdev_id,
+                            struct ieee80211_he_obss_pd *he_obss_pd)
+{
+       struct ath11k_pdev_wmi *wmi = ar->wmi;
+       struct ath11k_base *ab = wmi->wmi_sc->ab;
+       struct wmi_obss_spatial_reuse_params_cmd *cmd;
+       struct sk_buff *skb;
+       int ret, len;
+
+       len = sizeof(*cmd);
+
+       skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, len);
+       if (!skb)
+               return -ENOMEM;
+
+       cmd = (void *)skb->data;
+       cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG,
+                                    WMI_TAG_OBSS_SPATIAL_REUSE_SET_CMD) |
+                         FIELD_PREP(WMI_TLV_LEN, len - TLV_HDR_SIZE);
+       cmd->vdev_id = vdev_id;
+       cmd->enable = he_obss_pd->enable;
+       cmd->obss_min = he_obss_pd->min_offset;
+       cmd->obss_max = he_obss_pd->max_offset;
+
+       ret = ath11k_wmi_cmd_send(wmi, skb,
+                                 WMI_PDEV_OBSS_PD_SPATIAL_REUSE_CMDID);
+       if (ret) {
+               ath11k_warn(ab,
+                           "Failed to send WMI_PDEV_OBSS_PD_SPATIAL_REUSE_CMDID");
+               dev_kfree_skb(skb);
+       }
+       return ret;
+}
+
 static void
 ath11k_fill_band_to_mac_param(struct ath11k_base  *soc,
                              struct wmi_host_pdev_band_to_mac *band_to_mac)
index b5c53f2ac5ccc08e4a4d040a188143b2c152a781..7d5690c65279ba8072273342d031adcf774cdd54 100644 (file)
@@ -172,6 +172,8 @@ enum wmi_cmd_group {
        WMI_GRP_WLM            = 0x3c,
        WMI_GRP_11K_OFFLOAD    = 0x3d,
        WMI_GRP_TWT            = 0x3e,
+       WMI_GRP_MOTION_DET     = 0x3f,
+       WMI_GRP_SPATIAL_REUSE  = 0x40,
 };
 
 #define WMI_CMD_GRP(grp_id) (((grp_id) << 12) | 0x1)
@@ -539,6 +541,9 @@ enum wmi_tlv_cmd_id {
        WMI_TWT_DEL_DIALOG_CMDID,
        WMI_TWT_PAUSE_DIALOG_CMDID,
        WMI_TWT_RESUME_DIALOG_CMDID,
+       WMI_PDEV_OBSS_PD_SPATIAL_REUSE_CMDID =
+                               WMI_TLV_CMD(WMI_GRP_SPATIAL_REUSE),
+       WMI_PDEV_OBSS_PD_SPATIAL_REUSE_SET_DEF_OBSS_THRESH_CMDID,
 };
 
 enum wmi_tlv_event_id {
@@ -4559,6 +4564,15 @@ struct wmi_twt_disable_params_cmd {
        u32 pdev_id;
 };
 
+struct wmi_obss_spatial_reuse_params_cmd {
+       u32 tlv_header;
+       u32 pdev_id;
+       u32 enable;
+       s32 obss_min;
+       s32 obss_max;
+       u32 vdev_id;
+};
+
 struct target_resource_config {
        u32 num_vdevs;
        u32 num_peers;
@@ -4746,4 +4760,6 @@ void ath11k_wmi_fw_stats_fill(struct ath11k *ar,
 int ath11k_wmi_simulate_radar(struct ath11k *ar);
 int ath11k_wmi_send_twt_enable_cmd(struct ath11k *ar, u32 pdev_id);
 int ath11k_wmi_send_twt_disable_cmd(struct ath11k *ar, u32 pdev_id);
+int ath11k_wmi_send_obss_spr_cmd(struct ath11k *ar, u32 vdev_id,
+                                struct ieee80211_he_obss_pd *he_obss_pd);
 #endif