aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBob Copeland <me@bobcopeland.com>2011-01-24 23:32:55 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-01-28 15:44:27 -0500
commit0e4722524d5134dedd514d34991f02f2c1de23b4 (patch)
tree57815e9ba376d4b26cabde9b4ff4092b5b1217c4 /drivers
parentb453175d932c8ff42146992a1dac243104783902 (diff)
ath5k: use tracing for packet tx/rx dump
This adds a few tracepoints to ath5k driver transmit and receive callbacks in order to record packet traffic. We record the entire packet in the trace buffer so that the data can be extracted with trace-cmd and external plugins. Compared to the previous debugging calls, this approach removes an out-of-line function call from the tx and rx paths in the compiled-in-but-disabled case, while improving the ability to process the logged data. A new option, CONFIG_ATH5K_TRACER, is added so that one may disable the tracepoints completely. Signed-off-by: Bob Copeland <me@bobcopeland.com> Acked-by: Bruno Randolf <br1@einfach.org> Acked-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ath/ath5k/Kconfig11
-rw-r--r--drivers/net/wireless/ath/ath5k/base.c16
-rw-r--r--drivers/net/wireless/ath/ath5k/trace.h107
3 files changed, 128 insertions, 6 deletions
diff --git a/drivers/net/wireless/ath/ath5k/Kconfig b/drivers/net/wireless/ath/ath5k/Kconfig
index e0793319389d..e18a9aa7b6ca 100644
--- a/drivers/net/wireless/ath/ath5k/Kconfig
+++ b/drivers/net/wireless/ath/ath5k/Kconfig
@@ -40,6 +40,17 @@ config ATH5K_DEBUG
40 40
41 modprobe ath5k debug=0x00000400 41 modprobe ath5k debug=0x00000400
42 42
43config ATH5K_TRACER
44 bool "Atheros 5xxx tracer"
45 depends on ATH5K
46 depends on EVENT_TRACING
47 ---help---
48 Say Y here to enable tracepoints for the ath5k driver
49 using the kernel tracing infrastructure. Select this
50 option if you are interested in debugging the driver.
51
52 If unsure, say N.
53
43config ATH5K_AHB 54config ATH5K_AHB
44 bool "Atheros 5xxx AHB bus support" 55 bool "Atheros 5xxx AHB bus support"
45 depends on (ATHEROS_AR231X && !PCI) 56 depends on (ATHEROS_AR231X && !PCI)
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 8611f24cdf6a..c0927d7b7c6b 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -61,6 +61,9 @@
61#include "debug.h" 61#include "debug.h"
62#include "ani.h" 62#include "ani.h"
63 63
64#define CREATE_TRACE_POINTS
65#include "trace.h"
66
64int ath5k_modparam_nohwcrypt; 67int ath5k_modparam_nohwcrypt;
65module_param_named(nohwcrypt, ath5k_modparam_nohwcrypt, bool, S_IRUGO); 68module_param_named(nohwcrypt, ath5k_modparam_nohwcrypt, bool, S_IRUGO);
66MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption."); 69MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption.");
@@ -1379,7 +1382,7 @@ ath5k_receive_frame(struct ath5k_softc *sc, struct sk_buff *skb,
1379 sc->sbands[sc->curchan->band].bitrates[rxs->rate_idx].hw_value_short) 1382 sc->sbands[sc->curchan->band].bitrates[rxs->rate_idx].hw_value_short)
1380 rxs->flag |= RX_FLAG_SHORTPRE; 1383 rxs->flag |= RX_FLAG_SHORTPRE;
1381 1384
1382 ath5k_debug_dump_skb(sc, skb, "RX ", 0); 1385 trace_ath5k_rx(sc, skb);
1383 1386
1384 ath5k_update_beacon_rssi(sc, skb, rs->rs_rssi); 1387 ath5k_update_beacon_rssi(sc, skb, rs->rs_rssi);
1385 1388
@@ -1524,7 +1527,7 @@ ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb,
1524 unsigned long flags; 1527 unsigned long flags;
1525 int padsize; 1528 int padsize;
1526 1529
1527 ath5k_debug_dump_skb(sc, skb, "TX ", 1); 1530 trace_ath5k_tx(sc, skb, txq);
1528 1531
1529 /* 1532 /*
1530 * The hardware expects the header padded to 4 byte boundaries. 1533 * The hardware expects the header padded to 4 byte boundaries.
@@ -1573,7 +1576,7 @@ drop_packet:
1573 1576
1574static void 1577static void
1575ath5k_tx_frame_completed(struct ath5k_softc *sc, struct sk_buff *skb, 1578ath5k_tx_frame_completed(struct ath5k_softc *sc, struct sk_buff *skb,
1576 struct ath5k_tx_status *ts) 1579 struct ath5k_txq *txq, struct ath5k_tx_status *ts)
1577{ 1580{
1578 struct ieee80211_tx_info *info; 1581 struct ieee80211_tx_info *info;
1579 int i; 1582 int i;
@@ -1625,6 +1628,7 @@ ath5k_tx_frame_completed(struct ath5k_softc *sc, struct sk_buff *skb,
1625 else 1628 else
1626 sc->stats.antenna_tx[0]++; /* invalid */ 1629 sc->stats.antenna_tx[0]++; /* invalid */
1627 1630
1631 trace_ath5k_tx_complete(sc, skb, txq, ts);
1628 ieee80211_tx_status(sc->hw, skb); 1632 ieee80211_tx_status(sc->hw, skb);
1629} 1633}
1630 1634
@@ -1661,7 +1665,7 @@ ath5k_tx_processq(struct ath5k_softc *sc, struct ath5k_txq *txq)
1661 1665
1662 dma_unmap_single(sc->dev, bf->skbaddr, skb->len, 1666 dma_unmap_single(sc->dev, bf->skbaddr, skb->len,
1663 DMA_TO_DEVICE); 1667 DMA_TO_DEVICE);
1664 ath5k_tx_frame_completed(sc, skb, &ts); 1668 ath5k_tx_frame_completed(sc, skb, txq, &ts);
1665 } 1669 }
1666 1670
1667 /* 1671 /*
@@ -1803,8 +1807,6 @@ ath5k_beacon_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
1803 goto out; 1807 goto out;
1804 } 1808 }
1805 1809
1806 ath5k_debug_dump_skb(sc, skb, "BC ", 1);
1807
1808 ath5k_txbuf_free_skb(sc, avf->bbuf); 1810 ath5k_txbuf_free_skb(sc, avf->bbuf);
1809 avf->bbuf->skb = skb; 1811 avf->bbuf->skb = skb;
1810 ret = ath5k_beacon_setup(sc, avf->bbuf); 1812 ret = ath5k_beacon_setup(sc, avf->bbuf);
@@ -1899,6 +1901,8 @@ ath5k_beacon_send(struct ath5k_softc *sc)
1899 sc->opmode == NL80211_IFTYPE_MESH_POINT) 1901 sc->opmode == NL80211_IFTYPE_MESH_POINT)
1900 ath5k_beacon_update(sc->hw, vif); 1902 ath5k_beacon_update(sc->hw, vif);
1901 1903
1904 trace_ath5k_tx(sc, bf->skb, &sc->txqs[sc->bhalq]);
1905
1902 ath5k_hw_set_txdp(ah, sc->bhalq, bf->daddr); 1906 ath5k_hw_set_txdp(ah, sc->bhalq, bf->daddr);
1903 ath5k_hw_start_tx_dma(ah, sc->bhalq); 1907 ath5k_hw_start_tx_dma(ah, sc->bhalq);
1904 ATH5K_DBG(sc, ATH5K_DEBUG_BEACON, "TXDP[%u] = %llx (%p)\n", 1908 ATH5K_DBG(sc, ATH5K_DEBUG_BEACON, "TXDP[%u] = %llx (%p)\n",
diff --git a/drivers/net/wireless/ath/ath5k/trace.h b/drivers/net/wireless/ath/ath5k/trace.h
new file mode 100644
index 000000000000..2de68adb6240
--- /dev/null
+++ b/drivers/net/wireless/ath/ath5k/trace.h
@@ -0,0 +1,107 @@
1#if !defined(__TRACE_ATH5K_H) || defined(TRACE_HEADER_MULTI_READ)
2#define __TRACE_ATH5K_H
3
4#include <linux/tracepoint.h>
5#include "base.h"
6
7#ifndef CONFIG_ATH5K_TRACER
8#undef TRACE_EVENT
9#define TRACE_EVENT(name, proto, ...) \
10static inline void trace_ ## name(proto) {}
11#endif
12
13struct sk_buff;
14
15#define PRIV_ENTRY __field(struct ath5k_softc *, priv)
16#define PRIV_ASSIGN __entry->priv = priv
17
18#undef TRACE_SYSTEM
19#define TRACE_SYSTEM ath5k
20
21TRACE_EVENT(ath5k_rx,
22 TP_PROTO(struct ath5k_softc *priv, struct sk_buff *skb),
23 TP_ARGS(priv, skb),
24 TP_STRUCT__entry(
25 PRIV_ENTRY
26 __field(unsigned long, skbaddr)
27 __dynamic_array(u8, frame, skb->len)
28 ),
29 TP_fast_assign(
30 PRIV_ASSIGN;
31 __entry->skbaddr = (unsigned long) skb;
32 memcpy(__get_dynamic_array(frame), skb->data, skb->len);
33 ),
34 TP_printk(
35 "[%p] RX skb=%lx", __entry->priv, __entry->skbaddr
36 )
37);
38
39TRACE_EVENT(ath5k_tx,
40 TP_PROTO(struct ath5k_softc *priv, struct sk_buff *skb,
41 struct ath5k_txq *q),
42
43 TP_ARGS(priv, skb, q),
44
45 TP_STRUCT__entry(
46 PRIV_ENTRY
47 __field(unsigned long, skbaddr)
48 __field(u8, qnum)
49 __dynamic_array(u8, frame, skb->len)
50 ),
51
52 TP_fast_assign(
53 PRIV_ASSIGN;
54 __entry->skbaddr = (unsigned long) skb;
55 __entry->qnum = (u8) q->qnum;
56 memcpy(__get_dynamic_array(frame), skb->data, skb->len);
57 ),
58
59 TP_printk(
60 "[%p] TX skb=%lx q=%d", __entry->priv, __entry->skbaddr,
61 __entry->qnum
62 )
63);
64
65TRACE_EVENT(ath5k_tx_complete,
66 TP_PROTO(struct ath5k_softc *priv, struct sk_buff *skb,
67 struct ath5k_txq *q, struct ath5k_tx_status *ts),
68
69 TP_ARGS(priv, skb, q, ts),
70
71 TP_STRUCT__entry(
72 PRIV_ENTRY
73 __field(unsigned long, skbaddr)
74 __field(u8, qnum)
75 __field(u8, ts_status)
76 __field(s8, ts_rssi)
77 __field(u8, ts_antenna)
78 ),
79
80 TP_fast_assign(
81 PRIV_ASSIGN;
82 __entry->skbaddr = (unsigned long) skb;
83 __entry->qnum = (u8) q->qnum;
84 __entry->ts_status = ts->ts_status;
85 __entry->ts_rssi = ts->ts_rssi;
86 __entry->ts_antenna = ts->ts_antenna;
87 ),
88
89 TP_printk(
90 "[%p] TX end skb=%lx q=%d stat=%x rssi=%d ant=%x",
91 __entry->priv, __entry->skbaddr, __entry->qnum,
92 __entry->ts_status, __entry->ts_rssi, __entry->ts_antenna
93 )
94);
95
96#endif /* __TRACE_ATH5K_H */
97
98#ifdef CONFIG_ATH5K_TRACER
99
100#undef TRACE_INCLUDE_PATH
101#define TRACE_INCLUDE_PATH ../../drivers/net/wireless/ath/ath5k
102#undef TRACE_INCLUDE_FILE
103#define TRACE_INCLUDE_FILE trace
104
105#include <trace/define_trace.h>
106
107#endif