Search Linux Wireless

Re: [PATCH 1/2] ath5k: use tracing for packet tx/rx dump

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2011/1/25 Bob Copeland <me@xxxxxxxxxxxxxxx>:
> 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@xxxxxxxxxxxxxxx>
> ---
>
> Âdrivers/net/wireless/ath/ath5k/Kconfig | Â 11 +++
> Âdrivers/net/wireless/ath/ath5k/base.c Â| Â 16 +++--
> Âdrivers/net/wireless/ath/ath5k/trace.h | Â107 ++++++++++++++++++++++++++++++++
> Â3 files changed, 128 insertions(+), 6 deletions(-)
> Âcreate mode 100644 drivers/net/wireless/ath/ath5k/trace.h
>
> diff --git a/drivers/net/wireless/ath/ath5k/Kconfig b/drivers/net/wireless/ath/ath5k/Kconfig
> index e079331..e18a9aa 100644
> --- a/drivers/net/wireless/ath/ath5k/Kconfig
> +++ b/drivers/net/wireless/ath/ath5k/Kconfig
> @@ -40,6 +40,17 @@ config ATH5K_DEBUG
>
> Â Â Â Â Âmodprobe ath5k debug=0x00000400
>
> +config ATH5K_TRACER
> + Â Â Â bool "Atheros 5xxx tracer"
> + Â Â Â depends on ATH5K
> + Â Â Â depends on EVENT_TRACING
> + Â Â Â ---help---
> + Â Â Â Â Say Y here to enable tracepoints for the ath5k driver
> + Â Â Â Â using the kernel tracing infrastructure. ÂSelect this
> + Â Â Â Â option if you are interested in debugging the driver.
> +
> + Â Â Â Â If unsure, say N.
> +
> Âconfig ATH5K_AHB
> Â Â Â Âbool "Atheros 5xxx AHB bus support"
> Â Â Â Âdepends on (ATHEROS_AR231X && !PCI)
> diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
> index 14377ac..9c59cb6 100644
> --- a/drivers/net/wireless/ath/ath5k/base.c
> +++ b/drivers/net/wireless/ath/ath5k/base.c
> @@ -61,6 +61,9 @@
> Â#include "debug.h"
> Â#include "ani.h"
>
> +#define CREATE_TRACE_POINTS
> +#include "trace.h"
> +
> Âint ath5k_modparam_nohwcrypt;
> Âmodule_param_named(nohwcrypt, ath5k_modparam_nohwcrypt, bool, S_IRUGO);
> ÂMODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption.");
> @@ -1384,7 +1387,7 @@ ath5k_receive_frame(struct ath5k_softc *sc, struct sk_buff *skb,
> Â Â Â Â Â Âsc->sbands[sc->curchan->band].bitrates[rxs->rate_idx].hw_value_short)
> Â Â Â Â Â Â Â Ârxs->flag |= RX_FLAG_SHORTPRE;
>
> - Â Â Â ath5k_debug_dump_skb(sc, skb, "RX Â", 0);
> + Â Â Â trace_ath5k_rx(sc, skb);
>
> Â Â Â Âath5k_update_beacon_rssi(sc, skb, rs->rs_rssi);
>
> @@ -1529,7 +1532,7 @@ ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb,
> Â Â Â Âunsigned long flags;
> Â Â Â Âint padsize;
>
> - Â Â Â ath5k_debug_dump_skb(sc, skb, "TX Â", 1);
> + Â Â Â trace_ath5k_tx(sc, skb, txq);
>
> Â Â Â Â/*
> Â Â Â Â * The hardware expects the header padded to 4 byte boundaries.
> @@ -1578,7 +1581,7 @@ drop_packet:
>
> Âstatic void
> Âath5k_tx_frame_completed(struct ath5k_softc *sc, struct sk_buff *skb,
> - Â Â Â Â Â Â Â Â Â Â Â Âstruct ath5k_tx_status *ts)
> + Â Â Â Â Â Â Â Â Â Â Â Âstruct ath5k_txq *txq, struct ath5k_tx_status *ts)
> Â{
> Â Â Â Âstruct ieee80211_tx_info *info;
> Â Â Â Âint i;
> @@ -1630,6 +1633,7 @@ ath5k_tx_frame_completed(struct ath5k_softc *sc, struct sk_buff *skb,
> Â Â Â Âelse
> Â Â Â Â Â Â Â Âsc->stats.antenna_tx[0]++; /* invalid */
>
> + Â Â Â trace_ath5k_tx_complete(sc, skb, txq, ts);
> Â Â Â Âieee80211_tx_status(sc->hw, skb);
> Â}
>
> @@ -1666,7 +1670,7 @@ ath5k_tx_processq(struct ath5k_softc *sc, struct ath5k_txq *txq)
>
> Â Â Â Â Â Â Â Â Â Â Â Âdma_unmap_single(sc->dev, bf->skbaddr, skb->len,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ÂDMA_TO_DEVICE);
> - Â Â Â Â Â Â Â Â Â Â Â ath5k_tx_frame_completed(sc, skb, &ts);
> + Â Â Â Â Â Â Â Â Â Â Â ath5k_tx_frame_completed(sc, skb, txq, &ts);
> Â Â Â Â Â Â Â Â}
>
> Â Â Â Â Â Â Â Â/*
> @@ -1808,8 +1812,6 @@ ath5k_beacon_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
> Â Â Â Â Â Â Â Âgoto out;
> Â Â Â Â}
>
> - Â Â Â ath5k_debug_dump_skb(sc, skb, "BC Â", 1);
> -
> Â Â Â Âath5k_txbuf_free_skb(sc, avf->bbuf);
> Â Â Â Âavf->bbuf->skb = skb;
> Â Â Â Âret = ath5k_beacon_setup(sc, avf->bbuf);
> @@ -1904,6 +1906,8 @@ ath5k_beacon_send(struct ath5k_softc *sc)
> Â Â Â Â Â Â Â Â Â Â Â Âsc->opmode == NL80211_IFTYPE_MESH_POINT)
> Â Â Â Â Â Â Â Âath5k_beacon_update(sc->hw, vif);
>
> + Â Â Â trace_ath5k_tx(sc, bf->skb, &sc->txqs[sc->bhalq]);
> +
> Â Â Â Âath5k_hw_set_txdp(ah, sc->bhalq, bf->daddr);
> Â Â Â Âath5k_hw_start_tx_dma(ah, sc->bhalq);
> Â Â Â Â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 0000000..2de68ad
> --- /dev/null
> +++ b/drivers/net/wireless/ath/ath5k/trace.h
> @@ -0,0 +1,107 @@
> +#if !defined(__TRACE_ATH5K_H) || defined(TRACE_HEADER_MULTI_READ)
> +#define __TRACE_ATH5K_H
> +
> +#include <linux/tracepoint.h>
> +#include "base.h"
> +
> +#ifndef CONFIG_ATH5K_TRACER
> +#undef TRACE_EVENT
> +#define TRACE_EVENT(name, proto, ...) \
> +static inline void trace_ ## name(proto) {}
> +#endif
> +
> +struct sk_buff;
> +
> +#define PRIV_ENTRY Â__field(struct ath5k_softc *, priv)
> +#define PRIV_ASSIGN __entry->priv = priv
> +
> +#undef TRACE_SYSTEM
> +#define TRACE_SYSTEM ath5k
> +
> +TRACE_EVENT(ath5k_rx,
> + Â Â Â TP_PROTO(struct ath5k_softc *priv, struct sk_buff *skb),
> + Â Â Â TP_ARGS(priv, skb),
> + Â Â Â TP_STRUCT__entry(
> + Â Â Â Â Â Â Â PRIV_ENTRY
> + Â Â Â Â Â Â Â __field(unsigned long, skbaddr)
> + Â Â Â Â Â Â Â __dynamic_array(u8, frame, skb->len)
> + Â Â Â ),
> + Â Â Â TP_fast_assign(
> + Â Â Â Â Â Â Â PRIV_ASSIGN;
> + Â Â Â Â Â Â Â __entry->skbaddr = (unsigned long) skb;
> + Â Â Â Â Â Â Â memcpy(__get_dynamic_array(frame), skb->data, skb->len);
> + Â Â Â ),
> + Â Â Â TP_printk(
> + Â Â Â Â Â Â Â "[%p] RX skb=%lx", __entry->priv, __entry->skbaddr
> + Â Â Â )
> +);
> +
> +TRACE_EVENT(ath5k_tx,
> + Â Â Â TP_PROTO(struct ath5k_softc *priv, struct sk_buff *skb,
> + Â Â Â Â Â Â Â Âstruct ath5k_txq *q),
> +
> + Â Â Â TP_ARGS(priv, skb, q),
> +
> + Â Â Â TP_STRUCT__entry(
> + Â Â Â Â Â Â Â PRIV_ENTRY
> + Â Â Â Â Â Â Â __field(unsigned long, skbaddr)
> + Â Â Â Â Â Â Â __field(u8, qnum)
> + Â Â Â Â Â Â Â __dynamic_array(u8, frame, skb->len)
> + Â Â Â ),
> +
> + Â Â Â TP_fast_assign(
> + Â Â Â Â Â Â Â PRIV_ASSIGN;
> + Â Â Â Â Â Â Â __entry->skbaddr = (unsigned long) skb;
> + Â Â Â Â Â Â Â __entry->qnum = (u8) q->qnum;
> + Â Â Â Â Â Â Â memcpy(__get_dynamic_array(frame), skb->data, skb->len);
> + Â Â Â ),
> +
> + Â Â Â TP_printk(
> + Â Â Â Â Â Â Â "[%p] TX skb=%lx q=%d", __entry->priv, __entry->skbaddr,
> + Â Â Â Â Â Â Â __entry->qnum
> + Â Â Â )
> +);
> +
> +TRACE_EVENT(ath5k_tx_complete,
> + Â Â Â TP_PROTO(struct ath5k_softc *priv, struct sk_buff *skb,
> + Â Â Â Â Â Â Â Âstruct ath5k_txq *q, struct ath5k_tx_status *ts),
> +
> + Â Â Â TP_ARGS(priv, skb, q, ts),
> +
> + Â Â Â TP_STRUCT__entry(
> + Â Â Â Â Â Â Â PRIV_ENTRY
> + Â Â Â Â Â Â Â __field(unsigned long, skbaddr)
> + Â Â Â Â Â Â Â __field(u8, qnum)
> + Â Â Â Â Â Â Â __field(u8, ts_status)
> + Â Â Â Â Â Â Â __field(s8, ts_rssi)
> + Â Â Â Â Â Â Â __field(u8, ts_antenna)
> + Â Â Â ),
> +
> + Â Â Â TP_fast_assign(
> + Â Â Â Â Â Â Â PRIV_ASSIGN;
> + Â Â Â Â Â Â Â __entry->skbaddr = (unsigned long) skb;
> + Â Â Â Â Â Â Â __entry->qnum = (u8) q->qnum;
> + Â Â Â Â Â Â Â __entry->ts_status = ts->ts_status;
> + Â Â Â Â Â Â Â __entry->ts_rssi = Âts->ts_rssi;
> + Â Â Â Â Â Â Â __entry->ts_antenna = ts->ts_antenna;
> + Â Â Â ),
> +
> + Â Â Â TP_printk(
> + Â Â Â Â Â Â Â "[%p] TX end skb=%lx q=%d stat=%x rssi=%d ant=%x",
> + Â Â Â Â Â Â Â __entry->priv, __entry->skbaddr, __entry->qnum,
> + Â Â Â Â Â Â Â __entry->ts_status, __entry->ts_rssi, __entry->ts_antenna
> + Â Â Â )
> +);
> +
> +#endif /* __TRACE_ATH5K_H */
> +
> +#ifdef CONFIG_ATH5K_TRACER
> +
> +#undef TRACE_INCLUDE_PATH
> +#define TRACE_INCLUDE_PATH ../../drivers/net/wireless/ath/ath5k
> +#undef TRACE_INCLUDE_FILE
> +#define TRACE_INCLUDE_FILE trace
> +
> +#include <trace/define_trace.h>
> +
> +#endif
> --
> 1.7.1.1
>

Acked-by: Nick Kossifidis <mickflemm@xxxxxxxxx>



-- 
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux