Skip to content

Commit c6db66f

Browse files
Venkateswara NaralasettyRealzhq
authored andcommitted
FROMGIT: wifi: ath11k: Register relayfs entries for CFR dump
Provide a relayfs interface to collect the CFR dump from the user space. '/sys/kernel/debug/ieee80211/phyX/ath11k/cfr_capture' is exposed to user space to get CFR data. CFR format to user space: ___________________________________________ | CFR header | CFR payload | CFR tail data | |____________|_____________|_______________| CFR header contains the following fields, * Start magic number 0xDEADBEAF - 4 bytes * vendor id - 4 bytes * cfr metadata version - 1 byte * cfr data version - 1 byte * device type - 1 byte * platform type - 1 byte * CFR metadata length - 4 bytes * metadata - 92 bytes peer mac - 6 bytes capture status - 1 byte (1 for success 0 for failure) capture_bw - 1 byte channel_bw - 1 byte phy_mode - 1 byte prim20_chan - 2 bytes center_freq1 - 2 bytes center_freq2 - 2 bytes capture_mode - 1 byte capture_type - 1 byte sts_count - 1 byte num_rx_chain - 1 byte timestamp - 4 bytes length - 4 bytes chain_rssi - 32 bytes (4 bytes for each chain) chain_phase - 16 bytes (2 bytes for each chain) cfo_measurement - 4 bytes agc_gain - 8 bytes (1 bytes for each chain) rx_start_ts - 4 bytes CFR payload: CFR payload contains 8bytes of ucode header followed by the tone information. Tone order is positive tones, followed by PHY memory garbage, followed by negative tones. Dummy tones are uploaded to make number of tones always integer number of 64. Number of tones is not preamble type dependent. Each CFR tone has 14-bit I component and 14-bit Q component and is sign extended to 16-bit I/Q. Two tones are packed into one 64-bit unit as: [63:0] = [Tone1_Q(63:48) Tone1_I(47:32) Tone0_Q(31:16) Tone0_I(15:0)] CFR tail: end magic number 0xBEAFDEAD Tested-on: IPQ8074 hw2.0 PCI IPQ8074 WLAN.HK.2.5.0.1-00991-QCAHKSWPL_SILICONZ-1 Tested-on: WCN6855 hw2.1 PCI WLAN.HSP.1.1-04685-QCAHSPSWPL_V1_V2_SILICONZ_IOE-1 Signed-off-by: Venkateswara Naralasetty <quic_vnaralas@quicinc.com> Co-developed-by: Yu Zhang (Yuriy) <yu.zhang@oss.qualcomm.com> Signed-off-by: Yu Zhang (Yuriy) <yu.zhang@oss.qualcomm.com> Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com> Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com> Signed-off-by: Qian Zhang <qian.zhang@oss.qualcomm.com> Link: https://patch.msgid.link/20251230082520.3401007-3-qian.zhang@oss.qualcomm.com Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
1 parent 83f04b0 commit c6db66f

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

drivers/net/wireless/ath/ath11k/cfr.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,10 +416,45 @@ static void ath11k_cfr_debug_unregister(struct ath11k *ar)
416416
ar->cfr.enable_cfr = NULL;
417417
debugfs_remove(ar->cfr.cfr_unassoc);
418418
ar->cfr.cfr_unassoc = NULL;
419+
420+
relay_close(ar->cfr.rfs_cfr_capture);
421+
ar->cfr.rfs_cfr_capture = NULL;
419422
}
420423

424+
static struct dentry *ath11k_cfr_create_buf_file_handler(const char *filename,
425+
struct dentry *parent,
426+
umode_t mode,
427+
struct rchan_buf *buf,
428+
int *is_global)
429+
{
430+
struct dentry *buf_file;
431+
432+
buf_file = debugfs_create_file(filename, mode, parent, buf,
433+
&relay_file_operations);
434+
*is_global = 1;
435+
return buf_file;
436+
}
437+
438+
static int ath11k_cfr_remove_buf_file_handler(struct dentry *dentry)
439+
{
440+
debugfs_remove(dentry);
441+
442+
return 0;
443+
}
444+
445+
static const struct rchan_callbacks rfs_cfr_capture_cb = {
446+
.create_buf_file = ath11k_cfr_create_buf_file_handler,
447+
.remove_buf_file = ath11k_cfr_remove_buf_file_handler,
448+
};
449+
421450
static void ath11k_cfr_debug_register(struct ath11k *ar)
422451
{
452+
ar->cfr.rfs_cfr_capture = relay_open("cfr_capture",
453+
ar->debug.debugfs_pdev,
454+
ar->ab->hw_params.cfr_stream_buf_size,
455+
ar->ab->hw_params.cfr_num_stream_bufs,
456+
&rfs_cfr_capture_cb, NULL);
457+
423458
ar->cfr.enable_cfr = debugfs_create_file("enable_cfr", 0600,
424459
ar->debug.debugfs_pdev, ar,
425460
&fops_enable_cfr);

drivers/net/wireless/ath/ath11k/cfr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ struct ath11k_cfr {
6060
struct ath11k_look_up_table *lut;
6161
struct dentry *enable_cfr;
6262
struct dentry *cfr_unassoc;
63+
struct rchan *rfs_cfr_capture;
6364
u8 cfr_enabled_peer_cnt;
6465
u32 lut_num;
6566
u64 tx_evt_cnt;

0 commit comments

Comments
 (0)