aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorSujith Manoharan <c_manoha@qca.qualcomm.com>2012-11-28 04:38:54 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-11-30 13:38:15 -0500
commita145daf7f04696d0cec98d5328760fe65fe418c5 (patch)
tree9b39043c4ba827a65d524a2afda047d1f8b01659 /drivers/net/wireless
parentde7b7604eae91f00cd587f8541eec11a7fc505aa (diff)
ath9k: Implement sta_add_debugfs/sta_remove_debugfs
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h5
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.c90
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.h9
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c10
4 files changed, 111 insertions, 3 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 60bf784e5573..86e26a19efda 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -259,6 +259,7 @@ struct ath_atx_tid {
259}; 259};
260 260
261struct ath_node { 261struct ath_node {
262 struct ath_softc *sc;
262 struct ieee80211_sta *sta; /* station struct we're part of */ 263 struct ieee80211_sta *sta; /* station struct we're part of */
263 struct ieee80211_vif *vif; /* interface with which we're associated */ 264 struct ieee80211_vif *vif; /* interface with which we're associated */
264 struct ath_atx_tid tid[IEEE80211_NUM_TIDS]; 265 struct ath_atx_tid tid[IEEE80211_NUM_TIDS];
@@ -269,6 +270,10 @@ struct ath_node {
269 u8 mpdudensity; 270 u8 mpdudensity;
270 271
271 bool sleeping; 272 bool sleeping;
273
274#if defined(CONFIG_MAC80211_DEBUGFS) && defined(CONFIG_ATH9K_DEBUGFS)
275 struct dentry *node_stat;
276#endif
272}; 277};
273 278
274#define AGGR_CLEANUP BIT(1) 279#define AGGR_CLEANUP BIT(1)
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index cb5e45798ac4..13ff9edc2401 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -1509,6 +1509,96 @@ static const struct file_operations fops_btcoex = {
1509}; 1509};
1510#endif 1510#endif
1511 1511
1512static ssize_t read_file_node_stat(struct file *file, char __user *user_buf,
1513 size_t count, loff_t *ppos)
1514{
1515 struct ath_node *an = file->private_data;
1516 struct ath_softc *sc = an->sc;
1517 struct ath_atx_tid *tid;
1518 struct ath_atx_ac *ac;
1519 struct ath_txq *txq;
1520 u32 len = 0, size = 4096;
1521 char *buf;
1522 size_t retval;
1523 int tidno, acno;
1524
1525 buf = kzalloc(size, GFP_KERNEL);
1526 if (buf == NULL)
1527 return -ENOMEM;
1528
1529 if (!an->sta->ht_cap.ht_supported) {
1530 len = snprintf(buf, size, "%s\n",
1531 "HT not supported");
1532 goto exit;
1533 }
1534
1535 len = snprintf(buf, size, "Max-AMPDU: %d\n",
1536 an->maxampdu);
1537 len += snprintf(buf + len, size - len, "MPDU Density: %d\n\n",
1538 an->mpdudensity);
1539
1540 len += snprintf(buf + len, size - len,
1541 "%2s%7s\n", "AC", "SCHED");
1542
1543 for (acno = 0, ac = &an->ac[acno];
1544 acno < IEEE80211_NUM_ACS; acno++, ac++) {
1545 txq = ac->txq;
1546 ath_txq_lock(sc, txq);
1547 len += snprintf(buf + len, size - len,
1548 "%2d%7d\n",
1549 acno, ac->sched);
1550 ath_txq_unlock(sc, txq);
1551 }
1552
1553 len += snprintf(buf + len, size - len,
1554 "\n%3s%11s%10s%10s%10s%10s%9s%6s%8s\n",
1555 "TID", "SEQ_START", "SEQ_NEXT", "BAW_SIZE",
1556 "BAW_HEAD", "BAW_TAIL", "BAR_IDX", "SCHED", "PAUSED");
1557
1558 for (tidno = 0, tid = &an->tid[tidno];
1559 tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
1560 txq = tid->ac->txq;
1561 ath_txq_lock(sc, txq);
1562 len += snprintf(buf + len, size - len,
1563 "%3d%11d%10d%10d%10d%10d%9d%6d%8d\n",
1564 tid->tidno, tid->seq_start, tid->seq_next,
1565 tid->baw_size, tid->baw_head, tid->baw_tail,
1566 tid->bar_index, tid->sched, tid->paused);
1567 ath_txq_unlock(sc, txq);
1568 }
1569exit:
1570 retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
1571 kfree(buf);
1572
1573 return retval;
1574}
1575
1576static const struct file_operations fops_node_stat = {
1577 .read = read_file_node_stat,
1578 .open = simple_open,
1579 .owner = THIS_MODULE,
1580 .llseek = default_llseek,
1581};
1582
1583void ath9k_sta_add_debugfs(struct ieee80211_hw *hw,
1584 struct ieee80211_vif *vif,
1585 struct ieee80211_sta *sta,
1586 struct dentry *dir)
1587{
1588 struct ath_node *an = (struct ath_node *)sta->drv_priv;
1589 an->node_stat = debugfs_create_file("node_stat", S_IRUGO,
1590 dir, an, &fops_node_stat);
1591}
1592
1593void ath9k_sta_remove_debugfs(struct ieee80211_hw *hw,
1594 struct ieee80211_vif *vif,
1595 struct ieee80211_sta *sta,
1596 struct dentry *dir)
1597{
1598 struct ath_node *an = (struct ath_node *)sta->drv_priv;
1599 debugfs_remove(an->node_stat);
1600}
1601
1512/* Ethtool support for get-stats */ 1602/* Ethtool support for get-stats */
1513 1603
1514#define AMKSTR(nm) #nm "_BE", #nm "_BK", #nm "_VI", #nm "_VO" 1604#define AMKSTR(nm) #nm "_BE", #nm "_BK", #nm "_VI", #nm "_VO"
diff --git a/drivers/net/wireless/ath/ath9k/debug.h b/drivers/net/wireless/ath/ath9k/debug.h
index bfc21b37cb18..72d4893311b1 100644
--- a/drivers/net/wireless/ath/ath9k/debug.h
+++ b/drivers/net/wireless/ath/ath9k/debug.h
@@ -315,7 +315,14 @@ void ath9k_get_et_stats(struct ieee80211_hw *hw,
315void ath9k_get_et_strings(struct ieee80211_hw *hw, 315void ath9k_get_et_strings(struct ieee80211_hw *hw,
316 struct ieee80211_vif *vif, 316 struct ieee80211_vif *vif,
317 u32 sset, u8 *data); 317 u32 sset, u8 *data);
318 318void ath9k_sta_add_debugfs(struct ieee80211_hw *hw,
319 struct ieee80211_vif *vif,
320 struct ieee80211_sta *sta,
321 struct dentry *dir);
322void ath9k_sta_remove_debugfs(struct ieee80211_hw *hw,
323 struct ieee80211_vif *vif,
324 struct ieee80211_sta *sta,
325 struct dentry *dir);
319#else 326#else
320 327
321#define RX_STAT_INC(c) /* NOP */ 328#define RX_STAT_INC(c) /* NOP */
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index ffae384276a6..be30a9af1528 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -331,6 +331,7 @@ static void ath_node_attach(struct ath_softc *sc, struct ieee80211_sta *sta,
331 u8 density; 331 u8 density;
332 an = (struct ath_node *)sta->drv_priv; 332 an = (struct ath_node *)sta->drv_priv;
333 333
334 an->sc = sc;
334 an->sta = sta; 335 an->sta = sta;
335 an->vif = vif; 336 an->vif = vif;
336 337
@@ -2275,7 +2276,12 @@ struct ieee80211_ops ath9k_ops = {
2275 2276
2276#ifdef CONFIG_ATH9K_DEBUGFS 2277#ifdef CONFIG_ATH9K_DEBUGFS
2277 .get_et_sset_count = ath9k_get_et_sset_count, 2278 .get_et_sset_count = ath9k_get_et_sset_count,
2278 .get_et_stats = ath9k_get_et_stats, 2279 .get_et_stats = ath9k_get_et_stats,
2279 .get_et_strings = ath9k_get_et_strings, 2280 .get_et_strings = ath9k_get_et_strings,
2281#endif
2282
2283#if defined(CONFIG_MAC80211_DEBUGFS) && defined(CONFIG_ATH9K_DEBUGFS)
2284 .sta_add_debugfs = ath9k_sta_add_debugfs,
2285 .sta_remove_debugfs = ath9k_sta_remove_debugfs,
2280#endif 2286#endif
2281}; 2287};