Skip to content

Commit

Permalink
mwifiex: add dump data debug support
Browse files Browse the repository at this point in the history
This patch is to add support for data hexdump debug feature.
It is controlled by level debug_mask in adapter structure.

Signed-off-by: Zhaoyang Liu <liuzy@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  • Loading branch information
Zhaoyang Liu authored and Kalle Valo committed May 26, 2015
1 parent c687a00 commit 868093a
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
11 changes: 9 additions & 2 deletions drivers/net/wireless/mwifiex/cmdevt.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv,
"cmd: DNLD_CMD: %#x, act %#x, len %d, seqno %#x\n", cmd_code,
le16_to_cpu(*(__le16 *) ((u8 *) host_cmd + S_DS_GEN)), cmd_size,
le16_to_cpu(host_cmd->seq_num));
mwifiex_dbg_dump(adapter, CMD_D, "cmd buffer:", host_cmd, cmd_size);

if (adapter->iface_type == MWIFIEX_USB) {
tmp = cpu_to_le32(MWIFIEX_USB_TYPE_CMD);
Expand Down Expand Up @@ -286,6 +287,8 @@ static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter)
le16_to_cpu(sleep_cfm_buf->action),
le16_to_cpu(sleep_cfm_buf->size),
le16_to_cpu(sleep_cfm_buf->seq_num));
mwifiex_dbg_dump(adapter, CMD_D, "SLEEP_CFM buffer: ", sleep_cfm_buf,
le16_to_cpu(sleep_cfm_buf->size));

if (adapter->iface_type == MWIFIEX_USB) {
sleep_cfm_tmp =
Expand Down Expand Up @@ -362,8 +365,9 @@ int mwifiex_alloc_cmd_buffer(struct mwifiex_adapter *adapter)
for (i = 0; i < MWIFIEX_NUM_OF_CMD_BUFFER; i++) {
cmd_array[i].skb = dev_alloc_skb(MWIFIEX_SIZE_OF_CMD_BUFFER);
if (!cmd_array[i].skb) {
dev_err(adapter->dev, "ALLOC_CMD_BUF: out of memory\n");
return -1;
dev_err(adapter->dev,
"unable to allocate command buffer\n");
return -ENOMEM;
}
}

Expand Down Expand Up @@ -460,6 +464,7 @@ int mwifiex_process_event(struct mwifiex_adapter *adapter)
}

dev_dbg(adapter->dev, "EVENT: cause: %#x\n", eventcause);
mwifiex_dbg_dump(adapter, EVT_D, "Event Buf:", skb->data, skb->len);

if (priv->bss_role == MWIFIEX_BSS_ROLE_UAP)
ret = mwifiex_process_uap_event(priv);
Expand Down Expand Up @@ -826,6 +831,8 @@ int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter)
"cmd: CMD_RESP: 0x%x, result %d, len %d, seqno 0x%x\n",
orig_cmdresp_no, cmdresp_result,
le16_to_cpu(resp->size), le16_to_cpu(resp->seq_num));
mwifiex_dbg_dump(adapter, CMD_D, "CMD_RESP buffer:", resp,
le16_to_cpu(resp->size));

if (!(orig_cmdresp_no & HostCmd_RET_BIT)) {
dev_err(adapter->dev, "CMD_RESP: invalid cmd resp\n");
Expand Down
9 changes: 9 additions & 0 deletions drivers/net/wireless/mwifiex/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,15 @@ do { \
dev_info((adapter)->dev, fmt, ## args); \
} while (0)

#define DEBUG_DUMP_DATA_MAX_LEN 128
#define mwifiex_dbg_dump(adapter, dbg_mask, str, buf, len) \
do { \
if ((adapter)->debug_mask & MWIFIEX_DBG_##dbg_mask) \
print_hex_dump(KERN_DEBUG, str, \
DUMP_PREFIX_OFFSET, 16, 1, \
buf, len, false); \
} while (0)

struct mwifiex_dbg {
u32 num_cmd_host_to_card_failure;
u32 num_cmd_sleep_cfm_host_to_card_failure;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/mwifiex/pcie.c
Original file line number Diff line number Diff line change
Expand Up @@ -1721,7 +1721,7 @@ static int mwifiex_pcie_process_event_ready(struct mwifiex_adapter *adapter)
len is 2 bytes followed by type which is 2 bytes */
memcpy(&data_len, skb_cmd->data, sizeof(__le16));
evt_len = le16_to_cpu(data_len);

skb_trim(skb_cmd, evt_len);
skb_pull(skb_cmd, INTF_HEADER_LEN);
dev_dbg(adapter->dev, "info: Event length: %d\n", evt_len);

Expand Down
3 changes: 3 additions & 0 deletions drivers/net/wireless/mwifiex/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -2125,6 +2125,9 @@ int mwifiex_handle_event_ext_scan_report(struct mwifiex_private *priv,
dev_dbg(adapter->dev,
"EXT_SCAN: size %d, returned %d APs...",
scan_resp_size, num_of_set);
mwifiex_dbg_dump(adapter, CMD_D, "EXT_SCAN buffer:", buf,
scan_resp_size +
sizeof(struct mwifiex_event_scan_result));

tlv = (struct mwifiex_ie_types_data *)scan_resp;

Expand Down
5 changes: 5 additions & 0 deletions drivers/net/wireless/mwifiex/txrx.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ int mwifiex_handle_rx_packet(struct mwifiex_adapter *adapter,
return -1;
}

mwifiex_dbg_dump(adapter, DAT_D, "rx pkt:", skb->data,
min_t(size_t, skb->len, DEBUG_DUMP_DATA_MAX_LEN));

memset(rx_info, 0, sizeof(*rx_info));
rx_info->bss_num = priv->bss_num;
rx_info->bss_type = priv->bss_type;
Expand Down Expand Up @@ -112,6 +115,8 @@ int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb,
skb, tx_param);
}
}
mwifiex_dbg_dump(adapter, DAT_D, "tx pkt:", skb->data,
min_t(size_t, skb->len, DEBUG_DUMP_DATA_MAX_LEN));

switch (ret) {
case -ENOSR:
Expand Down

0 comments on commit 868093a

Please sign in to comment.