Introduction

 

The following blog post discusses on the procedure of enabling Debug flag in FMAC driver.

 

Steps

 

1. If you are building against the running kernel , then enable the following flags in the .config file while preparing the brcmfmac module.

 

CPTCFG_BRCM_TRACING=y

CPTCFG_BRCMDBG=y

CPTCFG_BRCMFMAC_PROTO_BCDC=y

CPTCFG_BRCMFMAC_PROTO_MSGBUF=y

 

else if you are building with the kernel source, then modify the .config of the kernel source with the following

 

CONFIG_BRCMDBG=y

CONFIG_DEBUG_FS=y

 

2. Compile the brcmfmac driver source  for the kernel for which it is being used.

 

#apply the required patch from the latest release.

#patch -p1<diff_fix_linux-v4.12_kernel_for_brcmfmac_build.patch

$make -C <path_to_kernel_src> M=<fmac_source_dir>

To build against the running kernel use:

$ make -C /lib/modules/`uname -r`/build M=$PWD

 

3. Enable brcmfmac debug log

 

$echo 8 > /proc/sys/kernel/printk

 

4. Insert the driver module with the required message level as module parameter.

list out the parameters accepted by the brcmfmac driver that is inserted in the kernel.

 

$ls /sys/module/brcmfmac/parameters/

$insmod brcmfmac.ko debug=${BRCMF_Message_Level}

 

Following are a list of Message levels defined in the debug.h(/v4.14.52-backports/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h)

 

#define BRCMF_TRACE_VAL 0x00000002

#define BRCMF_INFO_VAL 0x00000004

#define BRCMF_DATA_VAL 0x00000008

#define BRCMF_CTL_VAL 0x00000010

#define BRCMF_TIMER_VAL 0x00000020

#define BRCMF_HDRS_VAL 0x00000040

#define BRCMF_BYTES_VAL 0x00000080

#define BRCMF_INTR_VAL 0x00000100

#define BRCMF_GLOM_VAL 0x00000200

#define BRCMF_EVENT_VAL 0x00000400

#define BRCMF_BTA_VAL 0x00000800

#define BRCMF_FIL_VAL 0x00001000

#define BRCMF_USB_VAL 0x00002000

#define BRCMF_SCAN_VAL 0x00004000

#define BRCMF_CONN_VAL 0x00008000

#define BRCMF_BCDC_VAL 0x00010000

#define BRCMF_SDIO_VAL 0x00020000

#define BRCMF_MSGBUF_VAL 0x00040000

#define BRCMF_PCIE_VAL 0x00080000

#define BRCMF_FWCON_VAL 0x00100000

#define BRCMF_ULP_VAL 0x00200000

 

eg: To enable wifi fw console log

$ insmod brcmfmac.ko debug=0x00100006 (TRACE, INFO and WIFI_FW_LOG)

eg: To enable Trace

$ insmod brcmfmac.ko debug=0x6 (TRACE and INFO )

 

For further details on the functions associatied with fmac debug, please look into the source code  @

/v4.14.52-backports/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c