ath10k: implement wmi_pdev_bss_chan_info_request
authorRajkumar Manoharan <rmanohar@qti.qualcomm.com>
Wed, 27 Apr 2016 10:53:20 +0000 (16:23 +0530)
committerKalle Valo <kvalo@qca.qualcomm.com>
Fri, 6 May 2016 15:55:37 +0000 (18:55 +0300)
Add WMI ops to send pdev_bss_chan_info_request command to target.
This command will be used to retrieve updated cycle counters and noise
floor value of current operating channel (bss channel).

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath10k/wmi-ops.h
drivers/net/wireless/ath/ath10k/wmi.c
drivers/net/wireless/ath/ath10k/wmi.h

index 7fb00dc..64ebd30 100644 (file)
@@ -191,6 +191,9 @@ struct wmi_ops {
                                               u32 fw_feature_bitmap);
        int (*get_vdev_subtype)(struct ath10k *ar,
                                enum wmi_vdev_subtype subtype);
+       struct sk_buff *(*gen_pdev_bss_chan_info_req)
+                                       (struct ath10k *ar,
+                                        enum wmi_bss_survey_req_type type);
 };
 
 int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id);
@@ -1361,4 +1364,22 @@ ath10k_wmi_get_vdev_subtype(struct ath10k *ar, enum wmi_vdev_subtype subtype)
        return ar->wmi.ops->get_vdev_subtype(ar, subtype);
 }
 
+static inline int
+ath10k_wmi_pdev_bss_chan_info_request(struct ath10k *ar,
+                                     enum wmi_bss_survey_req_type type)
+{
+       struct ath10k_wmi *wmi = &ar->wmi;
+       struct sk_buff *skb;
+
+       if (!wmi->ops->gen_pdev_bss_chan_info_req)
+               return -EOPNOTSUPP;
+
+       skb = wmi->ops->gen_pdev_bss_chan_info_req(ar, type);
+       if (IS_ERR(skb))
+               return PTR_ERR(skb);
+
+       return ath10k_wmi_cmd_send(ar, skb,
+                                  wmi->cmd->pdev_bss_chan_info_request_cmdid);
+}
+
 #endif
index 39a54a5..5471f24 100644 (file)
@@ -521,7 +521,8 @@ static struct wmi_cmd_map wmi_10_2_4_cmd_map = {
        .vdev_filter_neighbor_rx_packets_cmdid = WMI_CMD_UNSUPPORTED,
        .mu_cal_start_cmdid = WMI_CMD_UNSUPPORTED,
        .set_cca_params_cmdid = WMI_CMD_UNSUPPORTED,
-       .pdev_bss_chan_info_request_cmdid = WMI_CMD_UNSUPPORTED,
+       .pdev_bss_chan_info_request_cmdid =
+               WMI_10_2_PDEV_BSS_CHAN_INFO_REQUEST_CMDID,
 };
 
 /* 10.4 WMI cmd track */
@@ -6637,6 +6638,26 @@ ath10k_wmi_10_2_op_gen_pdev_get_temperature(struct ath10k *ar)
        return skb;
 }
 
+static struct sk_buff *
+ath10k_wmi_10_2_op_gen_pdev_bss_chan_info(struct ath10k *ar,
+                                         enum wmi_bss_survey_req_type type)
+{
+       struct wmi_pdev_chan_info_req_cmd *cmd;
+       struct sk_buff *skb;
+
+       skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
+       if (!skb)
+               return ERR_PTR(-ENOMEM);
+
+       cmd = (struct wmi_pdev_chan_info_req_cmd *)skb->data;
+       cmd->type = __cpu_to_le32(type);
+
+       ath10k_dbg(ar, ATH10K_DBG_WMI,
+                  "wmi pdev bss info request type %d\n", type);
+
+       return skb;
+}
+
 /* This function assumes the beacon is already DMA mapped */
 static struct sk_buff *
 ath10k_wmi_op_gen_beacon_dma(struct ath10k *ar, u32 vdev_id, const void *bcn,
@@ -7736,6 +7757,7 @@ static const struct wmi_ops wmi_10_2_4_ops = {
        .gen_init = ath10k_wmi_10_2_op_gen_init,
        .gen_peer_assoc = ath10k_wmi_10_2_op_gen_peer_assoc,
        .gen_pdev_get_temperature = ath10k_wmi_10_2_op_gen_pdev_get_temperature,
+       .gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info,
 
        /* shared with 10.1 */
        .map_svc = wmi_10x_svc_map,
@@ -7862,6 +7884,7 @@ static const struct wmi_ops wmi_10_4_ops = {
        .gen_request_stats = ath10k_wmi_op_gen_request_stats,
        .gen_pdev_get_temperature = ath10k_wmi_10_2_op_gen_pdev_get_temperature,
        .get_vdev_subtype = ath10k_wmi_10_4_op_get_vdev_subtype,
+       .gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info,
 };
 
 int ath10k_wmi_attach(struct ath10k *ar)
index 084b113..30c6a83 100644 (file)
@@ -6488,6 +6488,16 @@ enum wmi_host_platform_type {
        WMI_HOST_PLATFORM_LOW_PERF,
 };
 
+enum wmi_bss_survey_req_type {
+       WMI_BSS_SURVEY_REQ_TYPE_READ = 1,
+       WMI_BSS_SURVEY_REQ_TYPE_READ_CLEAR,
+};
+
+struct wmi_pdev_chan_info_req_cmd {
+       __le32 type;
+       __le32 reserved;
+} __packed;
+
 struct ath10k;
 struct ath10k_vif;
 struct ath10k_fw_stats_pdev;