Commit d961284d authored by Yu Wang's avatar Yu Wang Committed by Kalle Valo

ath10k: correct the format of host memory chunks in wmi init command

This is a theoretical fix, the issue is found in code review.
When adding the host memory chunks into wmi-tlv init command,
there is no separate tlv header for each host memory chunk
in the struct array, which breaches the convention between
host and firmware, will result in mismatch between the two.

To fix this issue, add separate tlv headers for the host
memory chunks in wmi-tlv init command.
Signed-off-by: default avatarYu Wang <yyuwang@codeaurora.org>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 1c136e41
......@@ -1588,17 +1588,50 @@ ath10k_wmi_tlv_op_gen_pdev_set_param(struct ath10k *ar, u32 param_id,
return skb;
}
static void
ath10k_wmi_tlv_put_host_mem_chunks(struct ath10k *ar, void *host_mem_chunks)
{
struct host_memory_chunk *chunk;
struct wmi_tlv *tlv;
int i;
__le16 tlv_len, tlv_tag;
tlv_tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_WLAN_HOST_MEMORY_CHUNK);
tlv_len = __cpu_to_le16(sizeof(*chunk));
for (i = 0; i < ar->wmi.num_mem_chunks; i++) {
tlv = host_mem_chunks;
tlv->tag = tlv_tag;
tlv->len = tlv_len;
chunk = (void *)tlv->value;
chunk->ptr = __cpu_to_le32(ar->wmi.mem_chunks[i].paddr);
chunk->size = __cpu_to_le32(ar->wmi.mem_chunks[i].len);
chunk->req_id = __cpu_to_le32(ar->wmi.mem_chunks[i].req_id);
ath10k_dbg(ar, ATH10K_DBG_WMI,
"wmi-tlv chunk %d len %d, addr 0x%llx, id 0x%x\n",
i,
ar->wmi.mem_chunks[i].len,
(unsigned long long)ar->wmi.mem_chunks[i].paddr,
ar->wmi.mem_chunks[i].req_id);
host_mem_chunks += sizeof(*tlv);
host_mem_chunks += sizeof(*chunk);
}
}
static struct sk_buff *ath10k_wmi_tlv_op_gen_init(struct ath10k *ar)
{
struct sk_buff *skb;
struct wmi_tlv *tlv;
struct wmi_tlv_init_cmd *cmd;
struct wmi_tlv_resource_config *cfg;
struct wmi_host_mem_chunks *chunks;
void *chunks;
size_t len, chunks_len;
void *ptr;
chunks_len = ar->wmi.num_mem_chunks * sizeof(struct host_memory_chunk);
chunks_len = ar->wmi.num_mem_chunks *
(sizeof(struct host_memory_chunk) + sizeof(*tlv));
len = (sizeof(*tlv) + sizeof(*cmd)) +
(sizeof(*tlv) + sizeof(*cfg)) +
(sizeof(*tlv) + chunks_len);
......@@ -1701,7 +1734,7 @@ static struct sk_buff *ath10k_wmi_tlv_op_gen_init(struct ath10k *ar)
if (test_bit(WMI_SERVICE_TX_DATA_ACK_RSSI, ar->wmi.svc_map))
cfg->host_capab |= __cpu_to_le32(WMI_RSRC_CFG_FLAG_TX_ACK_RSSI);
ath10k_wmi_put_host_mem_chunks(ar, chunks);
ath10k_wmi_tlv_put_host_mem_chunks(ar, chunks);
ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv init\n");
return skb;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment