Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e25854f2 authored by Michal Kazior's avatar Michal Kazior Committed by Kalle Valo
Browse files

ath10k: implement wmi echo command



Will be useful for implementing command barriers.

Signed-off-by: default avatarMichal Kazior <michal.kazior@tieto.com>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent ebce1a5e
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -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
+29 −0
Original line number Diff line number Diff line
@@ -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 = {
+23 −0
Original line number Diff line number Diff line
@@ -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)