ath10k: Enable pktlog for rx data packets

Pktlog was not enabled for rx data packets.
Enable pktlog capture for rx data packets.

CRs-Fixed: 2091228
Change-Id: I8f489065081ba4da7ad7f5b8e271272279124abc
Signed-off-by: Rakesh Pillai <pillair@codeaurora.org>
This commit is contained in:
Rakesh Pillai 2017-08-10 20:17:37 +05:30
parent 2e035860df
commit 473722a7fc
5 changed files with 74 additions and 11 deletions

View file

@ -2644,14 +2644,14 @@ static void ath10k_process_ieee_hdr(void *data)
dir = (wh->i_fc[1] & IEEE80211_FC1_DIR_MASK);
if (dir == IEEE80211_FC1_DIR_TODS)
ath10k_extract_frame_header(&wh->i_addr1, &wh->i_addr2,
&wh->i_addr3);
ath10k_extract_frame_header(wh->i_addr1, wh->i_addr2,
wh->i_addr3);
else if (dir == IEEE80211_FC1_DIR_FROMDS)
ath10k_extract_frame_header(&wh->i_addr2, &wh->i_addr3,
&wh->i_addr1);
ath10k_extract_frame_header(wh->i_addr2, wh->i_addr3,
wh->i_addr1);
else
ath10k_extract_frame_header(&wh->i_addr3, &wh->i_addr2,
&wh->i_addr1);
ath10k_extract_frame_header(wh->i_addr3, wh->i_addr2,
wh->i_addr1);
}
static void ath10k_pktlog_process_rx(struct ath10k *ar, struct sk_buff *skb)
@ -2717,6 +2717,46 @@ static void ath10k_pktlog_process_rx(struct ath10k *ar, struct sk_buff *skb)
}
}
int ath10k_rx_record_pktlog(struct ath10k *ar, struct sk_buff *skb)
{
struct sk_buff *pktlog_skb;
struct ath_pktlog_hdr *pl_hdr;
struct ath_pktlog_rx_info *pktlog_rx_info;
struct htt_rx_desc *rx_desc = (void *)skb->data - sizeof(*rx_desc);
if (!ar->debug.pktlog_filter)
return 0;
pktlog_skb = dev_alloc_skb(sizeof(struct ath_pktlog_hdr) +
sizeof(struct htt_rx_desc) -
sizeof(struct htt_host_fw_desc_base));
if (!pktlog_skb)
return -ENOMEM;
pktlog_rx_info = (struct ath_pktlog_rx_info *)pktlog_skb->data;
pl_hdr = &pktlog_rx_info->pl_hdr;
pl_hdr->flags = (1 << ATH10K_PKTLOG_FLG_FRM_TYPE_REMOTE_S);
pl_hdr->missed_cnt = 0;
pl_hdr->mac_id = 0;
pl_hdr->log_type = ATH10K_PKTLOG_TYPE_RX_STAT;
pl_hdr->flags |= ATH10K_PKTLOG_HDR_SIZE_16;
pl_hdr->size = sizeof(*rx_desc) -
sizeof(struct htt_host_fw_desc_base);
pl_hdr->timestamp =
cpu_to_le32(rx_desc->ppdu_end.wcn3990.rx_pkt_end.phy_timestamp_1);
pl_hdr->type_specific_data = 0xDEADAA;
memcpy((void *)pktlog_rx_info + sizeof(struct ath_pktlog_hdr),
(void *)rx_desc + sizeof(struct htt_host_fw_desc_base),
pl_hdr->size);
ath10k_pktlog_process_rx(ar, pktlog_skb);
dev_kfree_skb_any(pktlog_skb);
return 0;
}
static void ath10k_pktlog_htc_tx_complete(struct ath10k *ar,
struct sk_buff *skb)
{

View file

@ -84,7 +84,7 @@ struct ath_pktlog_hdr {
__le16 flags;
__le16 missed_cnt;
u8 log_type;
u8 macId;
u8 mac_id;
__le16 size;
__le32 timestamp;
__le32 type_specific_data;
@ -164,6 +164,7 @@ struct ath10k_fw_crash_data *
ath10k_debug_get_new_fw_crash_data(struct ath10k *ar);
void ath10k_debug_dbglog_add(struct ath10k *ar, u8 *buffer, int len);
int ath10k_rx_record_pktlog(struct ath10k *ar, struct sk_buff *skb);
#define ATH10K_DFS_STAT_INC(ar, c) (ar->debug.dfs_stats.c++)
void ath10k_debug_get_et_strings(struct ieee80211_hw *hw,
@ -221,6 +222,12 @@ static inline void ath10k_debug_dbglog_add(struct ath10k *ar, u8 *buffer,
{
}
static inline int ath10k_rx_record_pktlog(struct ath10k *ar,
struct sk_buff *skb)
{
return 0;
}
static inline struct ath10k_fw_crash_data *
ath10k_debug_get_new_fw_crash_data(struct ath10k *ar)
{

View file

@ -1745,16 +1745,21 @@ struct ath10k_htt {
#define RX_HTT_HDR_STATUS_LEN 64
/* This structure layout is programmed via rx ring setup
* so that FW knows how to transfer the rx descriptor to the host.
* Buffers like this are placed on the rx ring. */
struct htt_rx_desc {
struct htt_host_fw_desc_base {
union {
/* This field is filled on the host using the msdu buffer
* from htt_rx_indication */
struct fw_rx_desc_base fw_desc;
u32 pad;
} __packed;
};
/* This structure layout is programmed via rx ring setup
* so that FW knows how to transfer the rx descriptor to the host.
* Buffers like this are placed on the rx ring.
*/
struct htt_rx_desc {
struct htt_host_fw_desc_base fw_desc_base;
struct {
struct rx_attention attention;
struct rx_frag_info frag_info;

View file

@ -969,6 +969,7 @@ static void ath10k_process_rx(struct ath10k *ar,
trace_ath10k_rx_hdr(ar, skb->data, skb->len);
trace_ath10k_rx_payload(ar, skb->data, skb->len);
ath10k_rx_record_pktlog(ar, skb);
ieee80211_rx_napi(ar->hw, NULL, skb, &ar->napi);
}

View file

@ -984,6 +984,16 @@ struct ath10k_shadow_reg_address {
extern struct ath10k_shadow_reg_value wcn3990_shadow_reg_value;
extern struct ath10k_shadow_reg_address wcn3990_shadow_reg_address;
#define ATH10K_PKTLOG_HDR_SIZE_16 0x8000
enum {
ATH10k_PKTLOG_FLG_FRM_TYPE_LOCAL_S = 0,
ATH10K_PKTLOG_FLG_FRM_TYPE_REMOTE_S,
ATH10K_PKTLOG_FLG_FRM_TYPE_CLONE_S,
ATH10K_PKTLOG_FLG_FRM_TYPE_CBF_S,
ATH10K_PKTLOG_FLG_FRM_TYPE_UNKNOWN_S
};
enum ath10k_pktlog_type {
ATH10K_PKTLOG_TYPE_TX_CTRL = 1,
ATH10K_PKTLOG_TYPE_TX_STAT,