On 10/5/2024 3:52 AM, Roopni Devanathan wrote: > From: Rajat Soni <quic_rajson@xxxxxxxxxxx> > > Add support to request DMAC reset stats from firmware through HTT stats > type 45. These stats give debug SoC error stats such as reset count, reset > time, engage time and count, disengage time and count and destination > ring mask. > > Sample output: > ------------- > echo 45 > /sys/kernel/debug/ath12k/pci-0000\:06\:00.0/mac0/htt_stats_type > cat /sys/kernel/debug/ath12k/pci-0000\:06\:00.0/mac0/htt_stats > HTT_DMAC_RESET_STATS_TLV: > reset_count = 1 > reset_time_ms = 8036717648 > disengage_time_ms = 8036717648 > engage_time_ms = 8036717649 > disengage_count = 1 > engage_count = 1 > drain_dest_ring_mask = 0x0 > > Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.1.1-00214-QCAHKSWPL_SILICONZ-1 > Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4 > > Signed-off-by: Rajat Soni <quic_rajson@xxxxxxxxxxx> > Signed-off-by: Roopni Devanathan <quic_rdevanat@xxxxxxxxxxx> > --- > v2: > - Updated dependencies. No change in code. > --- > Depends-on: > [PATCH v2] wifi: ath12k: Modify print_array_to_buf() to support arrays with 1-based semantics > Link: https://lore.kernel.org/all/20241004085915.1788951-1-quic_rdevanat@xxxxxxxxxxx/ > > [PATCH v2 0/4] wifi: ath12k: Support Ring, SFM, Transmit MU, SelfGen stats, CCA stats > Link: https://lore.kernel.org/ath12k/20241005101816.3314728-1-quic_rdevanat@xxxxxxxxxxx/ > > [PATCH v2] wifi: ath12k: Support Pdev OBSS Stats > Link: https://lore.kernel.org/ath12k/20241005104206.3327143-1-quic_rdevanat@xxxxxxxxxxx/ > --- > --- > .../wireless/ath/ath12k/debugfs_htt_stats.c | 41 +++++++++++++++++++ > .../wireless/ath/ath12k/debugfs_htt_stats.h | 15 +++++++ > 2 files changed, 56 insertions(+) > > diff --git a/drivers/net/wireless/ath/ath12k/debugfs_htt_stats.c b/drivers/net/wireless/ath/ath12k/debugfs_htt_stats.c > index d890679a3f16..2debb253185c 100644 > --- a/drivers/net/wireless/ath/ath12k/debugfs_htt_stats.c > +++ b/drivers/net/wireless/ath/ath12k/debugfs_htt_stats.c > @@ -2502,6 +2502,44 @@ ath12k_htt_print_pdev_obss_pd_stats_tlv(const void *tag_buf, u16 tag_len, > stats_req->buf_len = len; > } > > +static void > +ath12k_htt_print_dmac_reset_stats_tlv(const void *tag_buf, u16 tag_len, > + struct debug_htt_stats_req *stats_req) > +{ > + const struct ath12k_htt_dmac_reset_stats_tlv *htt_stats_buf = tag_buf; > + u8 *buf = stats_req->buf; > + u32 len = stats_req->buf_len; > + u32 buf_len = ATH12K_HTT_STATS_BUF_SIZE; > + unsigned long time; > + > + if (tag_len < sizeof(*htt_stats_buf)) > + return; > + > + len += scnprintf(buf + len, buf_len - len, "HTT_DMAC_RESET_STATS_TLV:\n"); > + len += scnprintf(buf + len, buf_len - len, "reset_count = %u\n", > + le32_to_cpu(htt_stats_buf->reset_count)); > + time = ((unsigned long)le32_to_cpu(htt_stats_buf->reset_time_hi_ms) << 32) | > + le32_to_cpu(htt_stats_buf->reset_time_lo_ms); The v1 version was flagged by the Intel 0-DAY CI Kernel Test Service: https://lore.kernel.org/all/202410040200.Mwb85JzQ-lkp@xxxxxxxxx/ I believe you need to use u64 instead of unsigned long since unsigned long will only be 32 bits on a 32-bit system. Also suggest you refactor into a helper function to remove any ambiguity about the order of operations between (typecast) and <<, i.e.: /* untested */ static u64 ath12k_le32hilo_to_u64(__le32 hi, __le32 lo) { u64 hi64 = le32_to_cpu(hi); u64 lo64 = le32_to_cpu(lo); return (hi64 << 32) | lo64; }