CFLAGS_trace.o := -I$(src)
 CFLAGS_usb_trace.o := -I$(src)
+CFLAGS_mt76x02_trace.o := -I$(src)
 
 mt76x02-lib-y := mt76x02_util.o mt76x02_mac.o mt76x02_mcu.o \
                 mt76x02_eeprom.o mt76x02_phy.o mt76x02_mmio.o \
-                mt76x02_txrx.o
+                mt76x02_txrx.o mt76x02_trace.o
 
 mt76x02-usb-y := mt76x02_usb_mcu.o mt76x02_usb_core.o
 
 
  */
 
 #include "mt76x02.h"
+#include "mt76x02_trace.h"
 
 enum mt76x02_cipher_type
 mt76x02_mac_get_key_info(struct ieee80211_key_conf *key, u8 *key_data)
 
        return mt76x02_mac_process_rate(status, rate);
 }
+
+void mt76x02_mac_poll_tx_status(struct mt76x02_dev *dev, bool irq)
+{
+       struct mt76x02_tx_status stat = {};
+       unsigned long flags;
+       u8 update = 1;
+       bool ret;
+
+       if (!test_bit(MT76_STATE_RUNNING, &dev->mt76.state))
+               return;
+
+       trace_mac_txstat_poll(dev);
+
+       while (!irq || !kfifo_is_full(&dev->txstatus_fifo)) {
+               spin_lock_irqsave(&dev->mt76.mmio.irq_lock, flags);
+               ret = mt76x02_mac_load_tx_status(&dev->mt76, &stat);
+               spin_unlock_irqrestore(&dev->mt76.mmio.irq_lock, flags);
+
+               if (!ret)
+                       break;
+
+               trace_mac_txstat_fetch(dev, &stat);
+
+               if (!irq) {
+                       mt76x02_send_tx_status(&dev->mt76, &stat, &update);
+                       continue;
+               }
+
+               kfifo_put(&dev->txstatus_fifo, stat);
+       }
+}
+EXPORT_SYMBOL_GPL(mt76x02_mac_poll_tx_status);
 
 void mt76x02_mac_write_txwi(struct mt76_dev *dev, struct mt76x02_txwi *txwi,
                            struct sk_buff *skb, struct mt76_wcid *wcid,
                            struct ieee80211_sta *sta, int len);
+void mt76x02_mac_poll_tx_status(struct mt76x02_dev *dev, bool irq);
 #endif
 
--- /dev/null
+/*
+ * Copyright (C) 2016 Felix Fietkau <nbd@nbd.name>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <linux/module.h>
+
+#ifndef __CHECKER__
+#define CREATE_TRACE_POINTS
+#include "mt76x02_trace.h"
+
+#endif
 
--- /dev/null
+/*
+ * Copyright (C) 2016 Felix Fietkau <nbd@nbd.name>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if !defined(__MT76x02_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
+#define __MT76x02_TRACE_H
+
+#include <linux/tracepoint.h>
+#include "mt76x02.h"
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM mt76x02
+
+#define MAXNAME                32
+#define DEV_ENTRY      __array(char, wiphy_name, 32)
+#define DEV_ASSIGN     strlcpy(__entry->wiphy_name, wiphy_name(mt76_hw(dev)->wiphy), MAXNAME)
+#define DEV_PR_FMT     "%s"
+#define DEV_PR_ARG     __entry->wiphy_name
+
+#define TXID_ENTRY     __field(u8, wcid) __field(u8, pktid)
+#define TXID_ASSIGN    __entry->wcid = wcid; __entry->pktid = pktid
+#define TXID_PR_FMT    " [%d:%d]"
+#define TXID_PR_ARG    __entry->wcid, __entry->pktid
+
+DECLARE_EVENT_CLASS(dev_evt,
+       TP_PROTO(struct mt76x02_dev *dev),
+       TP_ARGS(dev),
+       TP_STRUCT__entry(
+               DEV_ENTRY
+       ),
+       TP_fast_assign(
+               DEV_ASSIGN;
+       ),
+       TP_printk(DEV_PR_FMT, DEV_PR_ARG)
+);
+
+DEFINE_EVENT(dev_evt, mac_txstat_poll,
+       TP_PROTO(struct mt76x02_dev *dev),
+       TP_ARGS(dev)
+);
+
+TRACE_EVENT(mac_txstat_fetch,
+       TP_PROTO(struct mt76x02_dev *dev,
+                struct mt76x02_tx_status *stat),
+
+       TP_ARGS(dev, stat),
+
+       TP_STRUCT__entry(
+               DEV_ENTRY
+               TXID_ENTRY
+               __field(bool, success)
+               __field(bool, aggr)
+               __field(bool, ack_req)
+               __field(u16, rate)
+               __field(u8, retry)
+       ),
+
+       TP_fast_assign(
+               DEV_ASSIGN;
+               __entry->success = stat->success;
+               __entry->aggr = stat->aggr;
+               __entry->ack_req = stat->ack_req;
+               __entry->wcid = stat->wcid;
+               __entry->pktid = stat->pktid;
+               __entry->rate = stat->rate;
+               __entry->retry = stat->retry;
+       ),
+
+       TP_printk(
+               DEV_PR_FMT TXID_PR_FMT
+               " success:%d aggr:%d ack_req:%d"
+               " rate:%04x retry:%d",
+               DEV_PR_ARG, TXID_PR_ARG,
+               __entry->success, __entry->aggr, __entry->ack_req,
+               __entry->rate, __entry->retry
+       )
+);
+
+#endif
+
+#undef TRACE_INCLUDE_PATH
+#define TRACE_INCLUDE_PATH .
+#undef TRACE_INCLUDE_FILE
+#define TRACE_INCLUDE_FILE mt76x02_trace
+
+#include <trace/define_trace.h>
 
                          struct sk_buff *skb);
 void mt76x2_mac_set_beacon_enable(struct mt76x02_dev *dev, u8 vif_idx, bool val);
 
-void mt76x2_mac_poll_tx_status(struct mt76x02_dev *dev, bool irq);
 void mt76x2_mac_process_tx_status_fifo(struct mt76x02_dev *dev);
 
 void mt76x2_mac_work(struct work_struct *work);
 
                mt76_queue_kick(dev, &dev->mt76.q_tx[MT_TXQ_PSD]);
 
        if (intr & MT_INT_TX_STAT) {
-               mt76x2_mac_poll_tx_status(dev, true);
+               mt76x02_mac_poll_tx_status(dev, true);
                tasklet_schedule(&dev->tx_tasklet);
        }
 
 
        for (i = MT_TXQ_MCU; i >= 0; i--)
                mt76_queue_tx_cleanup(dev, i, false);
 
-       mt76x2_mac_poll_tx_status(dev, false);
+       mt76x02_mac_poll_tx_status(dev, false);
        mt76x02_irq_enable(&dev->mt76, MT_INT_TX_DONE_ALL);
 }
 
 
                       get_unaligned_le16(addr + 4));
 }
 
-void mt76x2_mac_poll_tx_status(struct mt76x02_dev *dev, bool irq)
-{
-       struct mt76x02_tx_status stat = {};
-       unsigned long flags;
-       u8 update = 1;
-       bool ret;
-
-       if (!test_bit(MT76_STATE_RUNNING, &dev->mt76.state))
-               return;
-
-       trace_mac_txstat_poll(dev);
-
-       while (!irq || !kfifo_is_full(&dev->txstatus_fifo)) {
-               spin_lock_irqsave(&dev->mt76.mmio.irq_lock, flags);
-               ret = mt76x02_mac_load_tx_status(&dev->mt76, &stat);
-               spin_unlock_irqrestore(&dev->mt76.mmio.irq_lock, flags);
-
-               if (!ret)
-                       break;
-
-               trace_mac_txstat_fetch(dev, &stat);
-
-               if (!irq) {
-                       mt76x02_send_tx_status(&dev->mt76, &stat, &update);
-                       continue;
-               }
-
-               kfifo_put(&dev->txstatus_fifo, stat);
-       }
-}
-
 static void
 mt76x2_mac_queue_txdone(struct mt76x02_dev *dev, struct sk_buff *skb,
                        void *txwi_ptr)
        struct mt76x2_tx_info *txi = mt76x2_skb_tx_info(skb);
        struct mt76x02_txwi *txwi = txwi_ptr;
 
-       mt76x2_mac_poll_tx_status(dev, false);
+       mt76x02_mac_poll_tx_status(dev, false);
 
        txi->tries = 0;
        txi->jiffies = jiffies;
 
 #define TXID_PR_FMT    " [%d:%d]"
 #define TXID_PR_ARG    __entry->wcid, __entry->pktid
 
-DECLARE_EVENT_CLASS(dev_evt,
-       TP_PROTO(struct mt76x02_dev *dev),
-       TP_ARGS(dev),
-       TP_STRUCT__entry(
-               DEV_ENTRY
-       ),
-       TP_fast_assign(
-               DEV_ASSIGN;
-       ),
-       TP_printk(DEV_PR_FMT, DEV_PR_ARG)
-);
-
 DECLARE_EVENT_CLASS(dev_txid_evt,
        TP_PROTO(struct mt76x02_dev *dev, u8 wcid, u8 pktid),
        TP_ARGS(dev, wcid, pktid),
        )
 );
 
-DEFINE_EVENT(dev_evt, mac_txstat_poll,
-       TP_PROTO(struct mt76x02_dev *dev),
-       TP_ARGS(dev)
-);
-
 DEFINE_EVENT(dev_txid_evt, mac_txdone_add,
        TP_PROTO(struct mt76x02_dev *dev, u8 wcid, u8 pktid),
        TP_ARGS(dev, wcid, pktid)
 );
 
-TRACE_EVENT(mac_txstat_fetch,
-       TP_PROTO(struct mt76x02_dev *dev,
-                struct mt76x02_tx_status *stat),
-
-       TP_ARGS(dev, stat),
-
-       TP_STRUCT__entry(
-               DEV_ENTRY
-               TXID_ENTRY
-               __field(bool, success)
-               __field(bool, aggr)
-               __field(bool, ack_req)
-               __field(u16, rate)
-               __field(u8, retry)
-       ),
-
-       TP_fast_assign(
-               DEV_ASSIGN;
-               __entry->success = stat->success;
-               __entry->aggr = stat->aggr;
-               __entry->ack_req = stat->ack_req;
-               __entry->wcid = stat->wcid;
-               __entry->pktid = stat->pktid;
-               __entry->rate = stat->rate;
-               __entry->retry = stat->retry;
-       ),
-
-       TP_printk(
-               DEV_PR_FMT TXID_PR_FMT
-               " success:%d aggr:%d ack_req:%d"
-               " rate:%04x retry:%d",
-               DEV_PR_ARG, TXID_PR_ARG,
-               __entry->success, __entry->aggr, __entry->ack_req,
-               __entry->rate, __entry->retry
-       )
-);
-
-
 TRACE_EVENT(dev_irq,
        TP_PROTO(struct mt76x02_dev *dev, u32 val, u32 mask),