mt76: move mac_txdone tracepoint in mt76 module
authorLorenzo Bianconi <lorenzo@kernel.org>
Sun, 29 Dec 2019 10:03:06 +0000 (11:03 +0100)
committerFelix Fietkau <nbd@nbd.name>
Fri, 14 Feb 2020 09:06:03 +0000 (10:06 +0100)
Move mac_txdone tracepoint in common code in order to
be reused by mt7603 and mt7615 drivers

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7603/mac.c
drivers/net/wireless/mediatek/mt76/mt7615/mac.c
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
drivers/net/wireless/mediatek/mt76/mt76x02_trace.h
drivers/net/wireless/mediatek/mt76/trace.c
drivers/net/wireless/mediatek/mt76/trace.h

index 2a384fd..8f5ca92 100644 (file)
@@ -4,6 +4,7 @@
 #include <linux/timekeeping.h>
 #include "mt7603.h"
 #include "mac.h"
+#include "../trace.h"
 
 #define MT_PSE_PAGE_SIZE       128
 
@@ -1193,6 +1194,8 @@ mt7603_mac_add_txs_skb(struct mt7603_dev *dev, struct mt7603_sta *sta, int pid,
        if (pid < MT_PACKET_ID_FIRST)
                return false;
 
+       trace_mac_txdone(mdev, sta->wcid.idx, pid);
+
        mt76_tx_status_lock(mdev, &list);
        skb = mt76_tx_status_skb_get(mdev, &sta->wcid, pid, &list);
        if (skb) {
index 004ab58..de80e8c 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/etherdevice.h>
 #include <linux/timekeeping.h>
 #include "mt7615.h"
+#include "../trace.h"
 #include "../dma.h"
 #include "mac.h"
 
@@ -1218,6 +1219,8 @@ static bool mt7615_mac_add_txs_skb(struct mt7615_dev *dev,
        if (pid < MT_PACKET_ID_FIRST)
                return false;
 
+       trace_mac_txdone(mdev, sta->wcid.idx, pid);
+
        mt76_tx_status_lock(mdev, &list);
        skb = mt76_tx_status_skb_get(mdev, &sta->wcid, pid, &list);
        if (skb) {
index 484cb57..8345f76 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "mt76x02.h"
 #include "mt76x02_trace.h"
+#include "trace.h"
 
 void mt76x02_mac_reset_counters(struct mt76x02_dev *dev)
 {
@@ -910,7 +911,7 @@ void mt76x02_tx_complete_skb(struct mt76_dev *mdev, enum mt76_txq_id qid,
 
        txwi_ptr = mt76_get_txwi_ptr(mdev, e->txwi);
        txwi = (struct mt76x02_txwi *)txwi_ptr;
-       trace_mac_txdone_add(dev, txwi->wcid, txwi->pktid);
+       trace_mac_txdone(mdev, txwi->wcid, txwi->pktid);
 
        mt76_tx_complete_skb(mdev, e->skb);
 }
index eea9afe..6a98092 100644 (file)
@@ -20,7 +20,6 @@
 #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
 
@@ -36,28 +35,6 @@ DECLARE_EVENT_CLASS(dev_evt,
        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),
-       TP_STRUCT__entry(
-               DEV_ENTRY
-               TXID_ENTRY
-       ),
-       TP_fast_assign(
-               DEV_ASSIGN;
-               TXID_ASSIGN;
-       ),
-       TP_printk(
-               DEV_PR_FMT TXID_PR_FMT,
-               DEV_PR_ARG, TXID_PR_ARG
-       )
-);
-
-DEFINE_EVENT(dev_txid_evt, mac_txdone_add,
-       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)
index 3c63f3b..f199fcd 100644 (file)
@@ -9,6 +9,7 @@
 #define CREATE_TRACE_POINTS
 #include "trace.h"
 
+EXPORT_TRACEPOINT_SYMBOL_GPL(mac_txdone);
 EXPORT_TRACEPOINT_SYMBOL_GPL(dev_irq);
 
 #endif
index 41706a8..c3d0ef8 100644 (file)
@@ -14,7 +14,7 @@
 
 #define MAXNAME                32
 #define DEV_ENTRY      __array(char, wiphy_name, 32)
-#define DEV_ASSIGN     strlcpy(__entry->wiphy_name,    \
+#define DEVICE_ASSIGN  strlcpy(__entry->wiphy_name,    \
                                wiphy_name(dev->hw->wiphy), MAXNAME)
 #define DEV_PR_FMT     "%s"
 #define DEV_PR_ARG     __entry->wiphy_name
 #define REG_PR_FMT     " %04x=%08x"
 #define REG_PR_ARG     __entry->reg, __entry->val
 
+#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_reg_evt,
        TP_PROTO(struct mt76_dev *dev, u32 reg, u32 val),
        TP_ARGS(dev, reg, val),
@@ -32,7 +37,7 @@ DECLARE_EVENT_CLASS(dev_reg_evt,
                REG_ENTRY
        ),
        TP_fast_assign(
-               DEV_ASSIGN;
+               DEVICE_ASSIGN;
                REG_ASSIGN;
        ),
        TP_printk(
@@ -63,7 +68,7 @@ TRACE_EVENT(dev_irq,
        ),
 
        TP_fast_assign(
-               DEV_ASSIGN;
+               DEVICE_ASSIGN;
                __entry->val = val;
                __entry->mask = mask;
        ),
@@ -74,6 +79,28 @@ TRACE_EVENT(dev_irq,
        )
 );
 
+DECLARE_EVENT_CLASS(dev_txid_evt,
+       TP_PROTO(struct mt76_dev *dev, u8 wcid, u8 pktid),
+       TP_ARGS(dev, wcid, pktid),
+       TP_STRUCT__entry(
+               DEV_ENTRY
+               TXID_ENTRY
+       ),
+       TP_fast_assign(
+               DEVICE_ASSIGN;
+               TXID_ASSIGN;
+       ),
+       TP_printk(
+               DEV_PR_FMT TXID_PR_FMT,
+               DEV_PR_ARG, TXID_PR_ARG
+       )
+);
+
+DEFINE_EVENT(dev_txid_evt, mac_txdone,
+       TP_PROTO(struct mt76_dev *dev, u8 wcid, u8 pktid),
+       TP_ARGS(dev, wcid, pktid)
+);
+
 #endif
 
 #undef TRACE_INCLUDE_PATH