ath10k: implement wmi echo command
authorMichal Kazior <michal.kazior@tieto.com>
Fri, 19 Aug 2016 10:37:41 +0000 (13:37 +0300)
committerKalle Valo <kvalo@qca.qualcomm.com>
Wed, 31 Aug 2016 07:27:26 +0000 (10:27 +0300)
Will be useful for implementing command barriers.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath10k/wmi-ops.h
drivers/net/wireless/ath/ath10k/wmi-tlv.c
drivers/net/wireless/ath/ath10k/wmi.c

index 64ebd304f9070672fe73d2c10ee80f1436d6ba6a..b1d88fa60d112cc0bfa54c193d4bf2fbe9d39a29 100644 (file)
@@ -194,6 +194,7 @@ struct wmi_ops {
        struct sk_buff *(*gen_pdev_bss_chan_info_req)
                                        (struct ath10k *ar,
                                         enum wmi_bss_survey_req_type type);
+       struct sk_buff *(*gen_echo)(struct ath10k *ar, u32 value);
 };
 
 int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id);
@@ -1382,4 +1383,20 @@ ath10k_wmi_pdev_bss_chan_info_request(struct ath10k *ar,
                                   wmi->cmd->pdev_bss_chan_info_request_cmdid);
 }
 
+static inline int
+ath10k_wmi_echo(struct ath10k *ar, u32 value)
+{
+       struct ath10k_wmi *wmi = &ar->wmi;
+       struct sk_buff *skb;
+
+       if (!wmi->ops->gen_echo)
+               return -EOPNOTSUPP;
+
+       skb = wmi->ops->gen_echo(ar, value);
+       if (IS_ERR(skb))
+               return PTR_ERR(skb);
+
+       return ath10k_wmi_cmd_send(ar, skb, wmi->cmd->echo_cmdid);
+}
+
 #endif
index e09337ee7c9664cccb3368faf59dc460845f5f80..cd595855af36692b50ea4c6d82ac1bda20d223d8 100644 (file)
@@ -3081,6 +3081,34 @@ ath10k_wmi_tlv_op_gen_adaptive_qcs(struct ath10k *ar, bool enable)
        return skb;
 }
 
+static struct sk_buff *
+ath10k_wmi_tlv_op_gen_echo(struct ath10k *ar, u32 value)
+{
+       struct wmi_echo_cmd *cmd;
+       struct wmi_tlv *tlv;
+       struct sk_buff *skb;
+       void *ptr;
+       size_t len;
+
+       len = sizeof(*tlv) + sizeof(*cmd);
+       skb = ath10k_wmi_alloc_skb(ar, len);
+       if (!skb)
+               return ERR_PTR(-ENOMEM);
+
+       ptr = (void *)skb->data;
+       tlv = ptr;
+       tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_ECHO_CMD);
+       tlv->len = __cpu_to_le16(sizeof(*cmd));
+       cmd = (void *)tlv->value;
+       cmd->value = cpu_to_le32(value);
+
+       ptr += sizeof(*tlv);
+       ptr += sizeof(*cmd);
+
+       ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv echo value 0x%08x\n", value);
+       return skb;
+}
+
 /****************/
 /* TLV mappings */
 /****************/
@@ -3485,6 +3513,7 @@ static const struct wmi_ops wmi_tlv_ops = {
        .gen_adaptive_qcs = ath10k_wmi_tlv_op_gen_adaptive_qcs,
        .fw_stats_fill = ath10k_wmi_main_op_fw_stats_fill,
        .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
+       .gen_echo = ath10k_wmi_tlv_op_gen_echo,
 };
 
 static const struct wmi_peer_flags_map wmi_tlv_peer_flags_map = {
index e67b254a8f8ebb4b1f856e735933699f3864a8ab..014c310208de4e3eb2d694f38446db92b83b2bb6 100644 (file)
@@ -7675,6 +7675,24 @@ ath10k_wmi_10_4_ext_resource_config(struct ath10k *ar,
        return skb;
 }
 
+static struct sk_buff *
+ath10k_wmi_op_gen_echo(struct ath10k *ar, u32 value)
+{
+       struct wmi_echo_cmd *cmd;
+       struct sk_buff *skb;
+
+       skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
+       if (!skb)
+               return ERR_PTR(-ENOMEM);
+
+       cmd = (struct wmi_echo_cmd *)skb->data;
+       cmd->value = cpu_to_le32(value);
+
+       ath10k_dbg(ar, ATH10K_DBG_WMI,
+                  "wmi echo value 0x%08x\n", value);
+       return skb;
+}
+
 static const struct wmi_ops wmi_ops = {
        .rx = ath10k_wmi_op_rx,
        .map_svc = wmi_main_svc_map,
@@ -7735,6 +7753,7 @@ static const struct wmi_ops wmi_ops = {
        .gen_delba_send = ath10k_wmi_op_gen_delba_send,
        .fw_stats_fill = ath10k_wmi_main_op_fw_stats_fill,
        .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
+       .gen_echo = ath10k_wmi_op_gen_echo,
        /* .gen_bcn_tmpl not implemented */
        /* .gen_prb_tmpl not implemented */
        /* .gen_p2p_go_bcn_ie not implemented */
@@ -7803,6 +7822,7 @@ static const struct wmi_ops wmi_10_1_ops = {
        .gen_delba_send = ath10k_wmi_op_gen_delba_send,
        .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill,
        .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
+       .gen_echo = ath10k_wmi_op_gen_echo,
        /* .gen_bcn_tmpl not implemented */
        /* .gen_prb_tmpl not implemented */
        /* .gen_p2p_go_bcn_ie not implemented */
@@ -7822,6 +7842,7 @@ static const struct wmi_ops wmi_10_2_ops = {
        .pull_svc_rdy = ath10k_wmi_10x_op_pull_svc_rdy_ev,
        .gen_pdev_set_rd = ath10k_wmi_10x_op_gen_pdev_set_rd,
        .gen_start_scan = ath10k_wmi_10x_op_gen_start_scan,
+       .gen_echo = ath10k_wmi_op_gen_echo,
 
        .pull_scan = ath10k_wmi_op_pull_scan_ev,
        .pull_mgmt_rx = ath10k_wmi_op_pull_mgmt_rx_ev,
@@ -7888,6 +7909,7 @@ static const struct wmi_ops wmi_10_2_4_ops = {
        .pull_svc_rdy = ath10k_wmi_10x_op_pull_svc_rdy_ev,
        .gen_pdev_set_rd = ath10k_wmi_10x_op_gen_pdev_set_rd,
        .gen_start_scan = ath10k_wmi_10x_op_gen_start_scan,
+       .gen_echo = ath10k_wmi_op_gen_echo,
 
        .pull_scan = ath10k_wmi_op_pull_scan_ev,
        .pull_mgmt_rx = ath10k_wmi_op_pull_mgmt_rx_ev,
@@ -8010,6 +8032,7 @@ static const struct wmi_ops wmi_10_4_ops = {
        .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,
+       .gen_echo = ath10k_wmi_op_gen_echo,
 };
 
 int ath10k_wmi_attach(struct ath10k *ar)