Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 246882
b: refs/heads/master
c: fbc29d6
h: refs/heads/master
v: v3
  • Loading branch information
Sujith Manoharan authored and John W. Linville committed Apr 13, 2011
1 parent b897af4 commit 3596bfe
Show file tree
Hide file tree
Showing 5 changed files with 196 additions and 53 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 821f9414c0546fbc99a999e9dc613d1756e1de8a
refs/heads/master: fbc29d6c3da58bc51416f65a50bdb419d4ea85b8
36 changes: 28 additions & 8 deletions trunk/drivers/net/wireless/ath/ath9k/htc.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,31 @@ struct ath9k_htc_target_rate {
struct ath9k_htc_rate rates;
};

struct ath9k_htc_target_stats {
__be32 tx_shortretry;
__be32 tx_longretry;
__be32 tx_xretries;
__be32 ht_txunaggr_xretry;
__be32 ht_tx_xretries;
struct ath9k_htc_target_int_stats {
__be32 rx;
__be32 rxorn;
__be32 rxeol;
__be32 txurn;
__be32 txto;
__be32 cst;
} __packed;

struct ath9k_htc_target_tx_stats {
__be32 xretries;
__be32 fifoerr;
__be32 filtered;
__be32 timer_exp;
__be32 shortretries;
__be32 longretries;
__be32 qnull;
__be32 encap_fail;
__be32 nobuf;
} __packed;

struct ath9k_htc_target_rx_stats {
__be32 nobuf;
__be32 host_send;
__be32 host_done;
} __packed;

#define ATH9K_HTC_MAX_VIF 2
Expand Down Expand Up @@ -340,14 +359,15 @@ struct ath_rx_stats {

struct ath9k_debug {
struct dentry *debugfs_phy;
struct dentry *debugfs_tgt_stats;
struct dentry *debugfs_tgt_int_stats;
struct dentry *debugfs_tgt_tx_stats;
struct dentry *debugfs_tgt_rx_stats;
struct dentry *debugfs_xmit;
struct dentry *debugfs_recv;
struct dentry *debugfs_slot;
struct dentry *debugfs_queue;
struct ath_tx_stats tx_stats;
struct ath_rx_stats rx_stats;
u32 txrate;
};

#else
Expand Down
185 changes: 155 additions & 30 deletions trunk/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,48 +24,157 @@ static int ath9k_debugfs_open(struct inode *inode, struct file *file)
return 0;
}

static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
static ssize_t read_file_tgt_int_stats(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath9k_htc_priv *priv = file->private_data;
struct ath9k_htc_target_stats cmd_rsp;
struct ath9k_htc_target_int_stats cmd_rsp;
char buf[512];
unsigned int len = 0;
int ret = 0;

memset(&cmd_rsp, 0, sizeof(cmd_rsp));

WMI_CMD(WMI_TGT_STATS_CMDID);
WMI_CMD(WMI_INT_STATS_CMDID);
if (ret)
return -EINVAL;

len += snprintf(buf + len, sizeof(buf) - len,
"%20s : %10u\n", "RX",
be32_to_cpu(cmd_rsp.rx));

len += snprintf(buf + len, sizeof(buf) - len,
"%20s : %10u\n", "RXORN",
be32_to_cpu(cmd_rsp.rxorn));

len += snprintf(buf + len, sizeof(buf) - len,
"%20s : %10u\n", "RXEOL",
be32_to_cpu(cmd_rsp.rxeol));

len += snprintf(buf + len, sizeof(buf) - len,
"%20s : %10u\n", "TXURN",
be32_to_cpu(cmd_rsp.txurn));

len += snprintf(buf + len, sizeof(buf) - len,
"%20s : %10u\n", "TXTO",
be32_to_cpu(cmd_rsp.txto));

len += snprintf(buf + len, sizeof(buf) - len,
"%20s : %10u\n", "CST",
be32_to_cpu(cmd_rsp.cst));

if (len > sizeof(buf))
len = sizeof(buf);

return simple_read_from_buffer(user_buf, count, ppos, buf, len);
}

static const struct file_operations fops_tgt_int_stats = {
.read = read_file_tgt_int_stats,
.open = ath9k_debugfs_open,
.owner = THIS_MODULE,
.llseek = default_llseek,
};

static ssize_t read_file_tgt_tx_stats(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath9k_htc_priv *priv = file->private_data;
struct ath9k_htc_target_tx_stats cmd_rsp;
char buf[512];
unsigned int len = 0;
int ret = 0;

memset(&cmd_rsp, 0, sizeof(cmd_rsp));

WMI_CMD(WMI_TX_STATS_CMDID);
if (ret)
return -EINVAL;

len += snprintf(buf + len, sizeof(buf) - len,
"%20s : %10u\n", "Xretries",
be32_to_cpu(cmd_rsp.xretries));

len += snprintf(buf + len, sizeof(buf) - len,
"%20s : %10u\n", "FifoErr",
be32_to_cpu(cmd_rsp.fifoerr));

len += snprintf(buf + len, sizeof(buf) - len,
"%20s : %10u\n", "Filtered",
be32_to_cpu(cmd_rsp.filtered));

len += snprintf(buf + len, sizeof(buf) - len,
"%19s : %10u\n", "TX Short Retries",
be32_to_cpu(cmd_rsp.tx_shortretry));
"%20s : %10u\n", "TimerExp",
be32_to_cpu(cmd_rsp.timer_exp));

len += snprintf(buf + len, sizeof(buf) - len,
"%19s : %10u\n", "TX Long Retries",
be32_to_cpu(cmd_rsp.tx_longretry));
"%20s : %10u\n", "ShortRetries",
be32_to_cpu(cmd_rsp.shortretries));

len += snprintf(buf + len, sizeof(buf) - len,
"%19s : %10u\n", "TX Xretries",
be32_to_cpu(cmd_rsp.tx_xretries));
"%20s : %10u\n", "LongRetries",
be32_to_cpu(cmd_rsp.longretries));

len += snprintf(buf + len, sizeof(buf) - len,
"%19s : %10u\n", "TX Unaggr. Xretries",
be32_to_cpu(cmd_rsp.ht_txunaggr_xretry));
"%20s : %10u\n", "QueueNull",
be32_to_cpu(cmd_rsp.qnull));

len += snprintf(buf + len, sizeof(buf) - len,
"%19s : %10u\n", "TX Xretries (HT)",
be32_to_cpu(cmd_rsp.ht_tx_xretries));
"%20s : %10u\n", "EncapFail",
be32_to_cpu(cmd_rsp.encap_fail));

len += snprintf(buf + len, sizeof(buf) - len,
"%19s : %10u\n", "TX Rate", priv->debug.txrate);
"%20s : %10u\n", "NoBuf",
be32_to_cpu(cmd_rsp.nobuf));

if (len > sizeof(buf))
len = sizeof(buf);

return simple_read_from_buffer(user_buf, count, ppos, buf, len);
}

static const struct file_operations fops_tgt_stats = {
.read = read_file_tgt_stats,
static const struct file_operations fops_tgt_tx_stats = {
.read = read_file_tgt_tx_stats,
.open = ath9k_debugfs_open,
.owner = THIS_MODULE,
.llseek = default_llseek,
};

static ssize_t read_file_tgt_rx_stats(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath9k_htc_priv *priv = file->private_data;
struct ath9k_htc_target_rx_stats cmd_rsp;
char buf[512];
unsigned int len = 0;
int ret = 0;

memset(&cmd_rsp, 0, sizeof(cmd_rsp));

WMI_CMD(WMI_RX_STATS_CMDID);
if (ret)
return -EINVAL;

len += snprintf(buf + len, sizeof(buf) - len,
"%20s : %10u\n", "NoBuf",
be32_to_cpu(cmd_rsp.nobuf));

len += snprintf(buf + len, sizeof(buf) - len,
"%20s : %10u\n", "HostSend",
be32_to_cpu(cmd_rsp.host_send));

len += snprintf(buf + len, sizeof(buf) - len,
"%20s : %10u\n", "HostDone",
be32_to_cpu(cmd_rsp.host_done));

if (len > sizeof(buf))
len = sizeof(buf);

return simple_read_from_buffer(user_buf, count, ppos, buf, len);
}

static const struct file_operations fops_tgt_rx_stats = {
.read = read_file_tgt_rx_stats,
.open = ath9k_debugfs_open,
.owner = THIS_MODULE,
.llseek = default_llseek,
Expand Down Expand Up @@ -286,29 +395,29 @@ static ssize_t read_file_queue(struct file *file, char __user *user_buf,
char buf[512];
unsigned int len = 0;

len += snprintf(buf + len, sizeof(buf) - len, "%16s : %3d\n",
len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n",
"Mgmt endpoint", skb_queue_len(&priv->tx.mgmt_ep_queue));

len += snprintf(buf + len, sizeof(buf) - len, "%16s : %3d\n",
len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n",
"Cab endpoint", skb_queue_len(&priv->tx.cab_ep_queue));

len += snprintf(buf + len, sizeof(buf) - len, "%16s : %3d\n",
len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n",
"Data BE endpoint", skb_queue_len(&priv->tx.data_be_queue));

len += snprintf(buf + len, sizeof(buf) - len, "%16s : %3d\n",
len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n",
"Data BK endpoint", skb_queue_len(&priv->tx.data_bk_queue));

len += snprintf(buf + len, sizeof(buf) - len, "%16s : %3d\n",
len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n",
"Data VI endpoint", skb_queue_len(&priv->tx.data_vi_queue));

len += snprintf(buf + len, sizeof(buf) - len, "%16s : %3d\n",
len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n",
"Data VO endpoint", skb_queue_len(&priv->tx.data_vo_queue));

len += snprintf(buf + len, sizeof(buf) - len, "%16s : %3d\n",
len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n",
"Failed queue", skb_queue_len(&priv->tx.tx_failed));

spin_lock_bh(&priv->tx.tx_lock);
len += snprintf(buf + len, sizeof(buf) - len, "%16s : %3d\n",
len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n",
"Queued count", priv->tx.queued_cnt);
spin_unlock_bh(&priv->tx.tx_lock);

Expand Down Expand Up @@ -339,12 +448,26 @@ int ath9k_htc_init_debug(struct ath_hw *ah)
if (!priv->debug.debugfs_phy)
goto err;

priv->debug.debugfs_tgt_stats = debugfs_create_file("tgt_stats", S_IRUSR,
priv->debug.debugfs_phy,
priv, &fops_tgt_stats);
if (!priv->debug.debugfs_tgt_stats)
priv->debug.debugfs_tgt_int_stats = debugfs_create_file("tgt_int_stats",
S_IRUSR,
priv->debug.debugfs_phy,
priv, &fops_tgt_int_stats);
if (!priv->debug.debugfs_tgt_int_stats)
goto err;

priv->debug.debugfs_tgt_tx_stats = debugfs_create_file("tgt_tx_stats",
S_IRUSR,
priv->debug.debugfs_phy,
priv, &fops_tgt_tx_stats);
if (!priv->debug.debugfs_tgt_tx_stats)
goto err;

priv->debug.debugfs_tgt_rx_stats = debugfs_create_file("tgt_rx_stats",
S_IRUSR,
priv->debug.debugfs_phy,
priv, &fops_tgt_rx_stats);
if (!priv->debug.debugfs_tgt_rx_stats)
goto err;

priv->debug.debugfs_xmit = debugfs_create_file("xmit", S_IRUSR,
priv->debug.debugfs_phy,
Expand Down Expand Up @@ -386,7 +509,9 @@ void ath9k_htc_exit_debug(struct ath_hw *ah)
debugfs_remove(priv->debug.debugfs_slot);
debugfs_remove(priv->debug.debugfs_recv);
debugfs_remove(priv->debug.debugfs_xmit);
debugfs_remove(priv->debug.debugfs_tgt_stats);
debugfs_remove(priv->debug.debugfs_tgt_int_stats);
debugfs_remove(priv->debug.debugfs_tgt_tx_stats);
debugfs_remove(priv->debug.debugfs_tgt_rx_stats);
debugfs_remove(priv->debug.debugfs_phy);
}

Expand Down
19 changes: 8 additions & 11 deletions trunk/drivers/net/wireless/ath/ath9k/wmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,18 @@ static const char *wmi_cmd_to_name(enum wmi_cmd_id wmi_cmd)
return "WMI_RC_RATE_UPDATE_CMDID";
case WMI_TARGET_IC_UPDATE_CMDID:
return "WMI_TARGET_IC_UPDATE_CMDID";
case WMI_TGT_STATS_CMDID:
return "WMI_TGT_STATS_CMDID";
case WMI_TX_AGGR_ENABLE_CMDID:
return "WMI_TX_AGGR_ENABLE_CMDID";
case WMI_TGT_DETACH_CMDID:
return "WMI_TGT_DETACH_CMDID";
case WMI_NODE_UPDATE_CMDID:
return "WMI_NODE_UPDATE_CMDID";
case WMI_INT_STATS_CMDID:
return "WMI_INT_STATS_CMDID";
case WMI_TX_STATS_CMDID:
return "WMI_TX_STATS_CMDID";
case WMI_RX_STATS_CMDID:
return "WMI_RX_STATS_CMDID";
case WMI_AGGR_LIMIT_CMD:
return "WMI_AGGR_LIMIT_CMD";
}
Expand Down Expand Up @@ -134,9 +140,6 @@ void ath9k_wmi_event_tasklet(unsigned long data)
struct sk_buff *skb = NULL;
unsigned long flags;
u16 cmd_id;
#ifdef CONFIG_ATH9K_HTC_DEBUGFS
__be32 txrate;
#endif

do {
spin_lock_irqsave(&wmi->wmi_lock, flags);
Expand All @@ -160,12 +163,6 @@ void ath9k_wmi_event_tasklet(unsigned long data)
ieee80211_queue_work(wmi->drv_priv->hw,
&wmi->drv_priv->fatal_work);
break;
case WMI_TXRATE_EVENTID:
#ifdef CONFIG_ATH9K_HTC_DEBUGFS
txrate = ((struct wmi_event_txrate *)wmi_event)->txrate;
wmi->drv_priv->debug.txrate = be32_to_cpu(txrate);
#endif
break;
case WMI_TXSTATUS_EVENTID:
spin_lock_bh(&priv->tx.tx_lock);
if (priv->tx.flags & ATH9K_HTC_OP_TX_DRAIN) {
Expand Down
7 changes: 4 additions & 3 deletions trunk/drivers/net/wireless/ath/ath9k/wmi.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#ifndef WMI_H
#define WMI_H


struct wmi_event_txrate {
__be32 txrate;
struct {
Expand Down Expand Up @@ -106,9 +105,12 @@ enum wmi_cmd_id {
WMI_RC_STATE_CHANGE_CMDID,
WMI_RC_RATE_UPDATE_CMDID,
WMI_TARGET_IC_UPDATE_CMDID,
WMI_TGT_STATS_CMDID,
WMI_TX_AGGR_ENABLE_CMDID,
WMI_TGT_DETACH_CMDID,
WMI_NODE_UPDATE_CMDID,
WMI_INT_STATS_CMDID,
WMI_TX_STATS_CMDID,
WMI_RX_STATS_CMDID,
WMI_AGGR_LIMIT_CMD = 0x0026,
};

Expand All @@ -119,7 +121,6 @@ enum wmi_event_id {
WMI_TXTO_EVENTID,
WMI_BMISS_EVENTID,
WMI_DELBA_EVENTID,
WMI_TXRATE_EVENTID,
WMI_TXSTATUS_EVENTID,
};

Expand Down

0 comments on commit 3596bfe

Please sign in to comment.