wifi: ath11k: print debug level in debug messages
authorKalle Valo <quic_kvalo@quicinc.com>
Fri, 9 Jun 2023 14:24:27 +0000 (17:24 +0300)
committerKalle Valo <quic_kvalo@quicinc.com>
Tue, 13 Jun 2023 09:10:42 +0000 (12:10 +0300)
To make it easier understand the context of a debug message print the debug
level before the actual message. An example:

[21867.231900] ath11k_pci 0000:06:00.0: wmi processed regulatory ext channel list

The tracepoint call is not modified, it's better to userspace print the debug
level if needed.

Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.23

Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230609142440.24643-3-kvalo@kernel.org
drivers/net/wireless/ath/ath11k/debug.c
drivers/net/wireless/ath/ath11k/debug.h

index 958d874290624a338b1b9d0470d331fb07f3108d..f5c8a34c8802f0c177997f2aa053d4a69db8c2c9 100644 (file)
@@ -66,7 +66,7 @@ void __ath11k_dbg(struct ath11k_base *ab, enum ath11k_debug_mask mask,
        vaf.va = &args;
 
        if (ath11k_debug_mask & mask)
-               dev_printk(KERN_DEBUG, ab->dev, "%pV", &vaf);
+               dev_printk(KERN_DEBUG, ab->dev, "%s %pV", ath11k_dbg_str(mask), &vaf);
 
        trace_ath11k_log_dbg(ab, mask, &vaf);
 
index 0a9418c36bf4a6b2cfb929673c4f78dc5793d6eb..2dd84d8ed5a5bca33c059920bdb64c11f8bd8377 100644 (file)
@@ -28,6 +28,48 @@ enum ath11k_debug_mask {
        ATH11K_DBG_DP_RX        = 0x00004000,
 };
 
+static inline const char *ath11k_dbg_str(enum ath11k_debug_mask mask)
+{
+       switch (mask) {
+       case ATH11K_DBG_AHB:
+               return "ahb";
+       case ATH11K_DBG_WMI:
+               return "wmi";
+       case ATH11K_DBG_HTC:
+               return "htc";
+       case ATH11K_DBG_DP_HTT:
+               return "dp_htt";
+       case ATH11K_DBG_MAC:
+               return "mac";
+       case ATH11K_DBG_BOOT:
+               return "boot";
+       case ATH11K_DBG_QMI:
+               return "qmi";
+       case ATH11K_DBG_DATA:
+               return "data";
+       case ATH11K_DBG_MGMT:
+               return "mgmt";
+       case ATH11K_DBG_REG:
+               return "reg";
+       case ATH11K_DBG_TESTMODE:
+               return "testmode";
+       case ATH11k_DBG_HAL:
+               return "hal";
+       case ATH11K_DBG_PCI:
+               return "pci";
+       case ATH11K_DBG_DP_TX:
+               return "dp_tx";
+       case ATH11K_DBG_DP_RX:
+               return "dp_rx";
+
+       /* no default handler to allow compiler to check that the
+        * enum is fully handled
+        */
+       }
+
+       return "<?>";
+}
+
 __printf(2, 3) void ath11k_info(struct ath11k_base *ab, const char *fmt, ...);
 __printf(2, 3) void ath11k_err(struct ath11k_base *ab, const char *fmt, ...);
 __printf(2, 3) void ath11k_warn(struct ath11k_base *ab, const char *fmt, ...);