diff --git a/README.md b/README.md index 4124302..d5d3f72 100644 --- a/README.md +++ b/README.md @@ -229,3 +229,32 @@ The Wi-Fi-reset recovery behavior tracked in limitation: after an airplane-mode or hotspot reset, Bluetooth may require a physical unplug/replug of the adapter. + +### Debug Logging + +The Wi-Fi driver's log is set by its `aicwf_dbg_level` parameter, a mask. The default, `0x203`, logs errors +(`0x1`), information (`0x2`) and firmware messages (`0x200`). Add `0x8` for debug detail: `0x20b`. + +At the default level the log keeps a summary of what is routine: + +- the firmware patch table: one line with the number of entries written, and any failure; +- 4-address frames that a build without `CONFIG_SUPPORT_4ADDR` drops: the first at once, then a count at most + once a minute. + +With `0x8` it also logs each patch-table entry, and each dropped 4-address frame with a dump of it. + +To set it for the running driver (back to the default with `0x203`): + +```bash +echo 0x20b | sudo tee /sys/module/aic8800_fdrv/parameters/aicwf_dbg_level +``` + +The patch table is written when the adapter starts, so to log its entries, set the level before the driver loads, +then load it or plug the adapter in: + +```bash +echo 'options aic8800_fdrv aicwf_dbg_level=0x20b' | sudo tee /etc/modprobe.d/aic8800-debug.conf +sudo modprobe -r aic8800_fdrv && sudo modprobe aic8800_fdrv +``` + +Remove that file to go back to the default at the next load. diff --git a/drivers/aic8800/aic8800_fdrv/aicwf_compat_8800d80n.c b/drivers/aic8800/aic8800_fdrv/aicwf_compat_8800d80n.c index 2d7f978..9995af3 100644 --- a/drivers/aic8800/aic8800_fdrv/aicwf_compat_8800d80n.c +++ b/drivers/aic8800/aic8800_fdrv/aicwf_compat_8800d80n.c @@ -176,16 +176,21 @@ int aicwf_plat_patch_table_load_8800d80n(struct rwnx_hw *rwnx_hw) AICWFDBG(LOGINFO, "tbl size = %d \n", size); if (!err) { + int written = 0; + for (i = 0; i < (size / 4); i += 2) { if ((dst[i] == 0x0) || (dst[i] == 0xFFFFFFFF)) { break; // end of tbl } AICWFDBG(LOGDEBUG, "patch_tbl: %x %x\n", dst[i], dst[i+1]); err = rwnx_send_dbg_mem_write_req(rwnx_hw, dst[i], dst[i+1]); + if (!err) + written++; } if (err) { AICWFDBG(LOGERROR, "tbl bin upload fail: %x, err:%d\r\n", dst[i], err); } + AICWFDBG(LOGINFO, "patch_tbl: %s: %d entries written (each at debug level)\n", filename, written); } if (dst) { diff --git a/drivers/aic8800/aic8800_fdrv/aicwf_compat_8800dc.c b/drivers/aic8800/aic8800_fdrv/aicwf_compat_8800dc.c index bdc7a04..b622382 100644 --- a/drivers/aic8800/aic8800_fdrv/aicwf_compat_8800dc.c +++ b/drivers/aic8800/aic8800_fdrv/aicwf_compat_8800dc.c @@ -2748,13 +2748,18 @@ int aicwf_patch_table_load(struct rwnx_hw *rwnx_hw, char *filename) } if (!err && (i < size)) { + int written = 0; + for (i =(128/4); i < (size/4); i +=2) { AICWFDBG(LOGDEBUG, "patch_tbl: %x %x\n", dst[i], dst[i+1]); err = rwnx_send_dbg_mem_write_req(rwnx_hw, dst[i], dst[i+1]); + if (!err) + written++; } if (err) { AICWFDBG(LOGERROR, "bin upload fail: %x, err:%d\r\n", dst[i], err); } + AICWFDBG(LOGINFO, "patch_tbl: %s: %d entries written (each at debug level)\n", filename, written); } if (dst) { diff --git a/drivers/aic8800/aic8800_fdrv/rwnx_defs.h b/drivers/aic8800/aic8800_fdrv/rwnx_defs.h index 3363bcc..1a38654 100644 --- a/drivers/aic8800/aic8800_fdrv/rwnx_defs.h +++ b/drivers/aic8800/aic8800_fdrv/rwnx_defs.h @@ -935,6 +935,10 @@ struct rwnx_hw { ktime_t last_time; char last_alpha2[3]; + /* 4-address frames dropped (a build without CONFIG_SUPPORT_4ADDR): counted, and said at most once a minute. */ + unsigned int fouraddr_dropped; + unsigned long fouraddr_said; + }; u8 *rwnx_build_bcn(struct rwnx_bcn *bcn, struct cfg80211_beacon_data *new); diff --git a/drivers/aic8800/aic8800_fdrv/rwnx_rx.c b/drivers/aic8800/aic8800_fdrv/rwnx_rx.c index 1ecfee0..2e6bd64 100644 --- a/drivers/aic8800/aic8800_fdrv/rwnx_rx.c +++ b/drivers/aic8800/aic8800_fdrv/rwnx_rx.c @@ -2427,8 +2427,17 @@ check_len_update: #ifndef CONFIG_SUPPORT_4ADDR if (hw_rxhdr->flags_is_4addr) { - dev_dbg(rwnx_hw->dev, "4addr Frame received (%d), skb->len:%u\n", hw_rxhdr->flags_vif_idx, skb->len); - print_hex_dump_debug("4addr ", DUMP_PREFIX_NONE, 16, 1, skb->data, skb->len, false); + rwnx_hw->fouraddr_dropped++; + if (!rwnx_hw->fouraddr_said || time_after(jiffies, rwnx_hw->fouraddr_said + 60 * HZ)) { + AICWFDBG(LOGINFO, "4addr frames dropped (this build has no CONFIG_SUPPORT_4ADDR): %u since the last count; " + "aicwf_dbg_level with 0x8 (debug) logs each one\n", rwnx_hw->fouraddr_dropped); + rwnx_hw->fouraddr_dropped = 0; + rwnx_hw->fouraddr_said = jiffies ? jiffies : 1; + } + if (aicwf_dbg_level & LOGDEBUG) { + AICWFDBG(LOGDEBUG, "4addr Frame received (%d), skb->len:%u\n", hw_rxhdr->flags_vif_idx, skb->len); + print_hex_dump(KERN_DEBUG, "4addr ", DUMP_PREFIX_NONE, 16, 1, skb->data, skb->len, false); + } dev_kfree_skb(skb); goto end; }