[PATCH 1/2] ath11k: add dbring debug support

Joe Perches joe at perches.com
Thu Dec 9 16:09:04 PST 2021


On Tue, 2021-11-09 at 12:02 +0530, Venkateswara Naralasetty wrote:
> Target copies spectral report and CFR report through dbring to
> host for further processing. This mechanism involves ring and
> buffer management in the Host, FW, and uCode, where improper
> tail pointer update issues are seen.
> 
> This dbring debug support help to debug such issues by tracking
> head and tail pointer movement along with the timestamp at which
> each buffer is received and replenished.

> @@ -1068,6 +1107,166 @@ static const struct file_operations fops_simulate_radar = {
>  	.open = simple_open
>  };
>  
> +static ssize_t ath11k_dbr_dump_debug_entries(struct file *file,
> +					     char __user *user_buf,
> +					     size_t count, loff_t *ppos)
> +{
> +	struct ath11k_db_ring_debug *db_ring_debug = file->private_data;
> +	static const char * const event_id_to_string[] = {"empty", "Rx", "Replenish"};
> +	int size = ATH11K_DBR_DEBUG_ENTRIES_MAX * 100;
> +	char *buf;
> +	int i, ret;
> +	int len = 0;
> +
> +	buf = kzalloc(size, GFP_KERNEL);
> +	if (!buf)
> +		return -ENOMEM;
> +
> +	len += scnprintf(buf + len, size - len, "------------------------------------\n");
> +	len += scnprintf(buf + len, size - len, "| idx | hp | tp | timestamp | event|\n");
> +	len += scnprintf(buf + len, size - len, "------------------------------------\n");
> +
> +	spin_lock_bh(&db_ring_debug->lock);
> +
> +	for (i = 0; i < db_ring_debug->num_ring_debug_entries; i++) {
> +		len += scnprintf(buf + len, size - len,
> +				 "|%4u|%8u|%8u|%11llu|%8s|\n", i,
> +				 db_ring_debug->entries[i].hp,
> +				 db_ring_debug->entries[i].tp,
> +				 db_ring_debug->entries[i].timestamp,
> +				 event_id_to_string[db_ring_debug->entries[i].event]);
> +	}

I think this would look a lot nicer column aligned along the | boundaries

	len += scnprintf(buf + len, size - len, "--------------------------------------------------------\n");
	len += scnprintf(buf + len, size - len, "|  idx |    hp    |    tp    |  timestamp  |   event   |\n");
	len += scnprintf(buf + len, size - len, "--------------------------------------------------------\n");

	spin_lock_bh(&db_ring_debug->lock);

	for (i = 0; i < db_ring_debug->num_ring_debug_entries; i++) {
		len += scnprintf(buf + len, size - len,
				 "| %4u | %8u | %8u | %11llu | %-9s |\n", i,
				 db_ring_debug->entries[i].hp,
				 db_ring_debug->entries[i].tp,
				 db_ring_debug->entries[i].timestamp,
				 event_id_to_string[db_ring_debug->entries[i].event]);





More information about the ath11k mailing list