drivers/net/wireless/intel/iwlegacy/4965-debug.c

Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/iwlegacy/4965-debug.c

File Facts

System
Linux kernel
Corpus path
drivers/net/wireless/intel/iwlegacy/4965-debug.c
Extension
.c
Size
29768 bytes
Lines
735
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0-only
/******************************************************************************
*
* Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
*
* Contact Information:
*  Intel Linux Wireless <ilw@linux.intel.com>
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
*****************************************************************************/
#include "common.h"
#include "4965.h"

static const char *fmt_value = "  %-30s %10u\n";
static const char *fmt_table = "  %-30s %10u  %10u  %10u  %10u\n";
static const char *fmt_header =
    "%-32s    current  cumulative       delta         max\n";

static int
il4965_stats_flag(struct il_priv *il, char *buf, int bufsz)
{
	int p = 0;
	u32 flag;

	flag = le32_to_cpu(il->_4965.stats.flag);

	p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n", flag);
	if (flag & UCODE_STATS_CLEAR_MSK)
		p += scnprintf(buf + p, bufsz - p,
			       "\tStatistics have been cleared\n");
	p += scnprintf(buf + p, bufsz - p, "\tOperational Frequency: %s\n",
		       (flag & UCODE_STATS_FREQUENCY_MSK) ? "2.4 GHz" :
		       "5.2 GHz");
	p += scnprintf(buf + p, bufsz - p, "\tTGj Narrow Band: %s\n",
		       (flag & UCODE_STATS_NARROW_BAND_MSK) ? "enabled" :
		       "disabled");

	return p;
}

static ssize_t
il4965_ucode_rx_stats_read(struct file *file, char __user *user_buf,
			   size_t count, loff_t *ppos)
{
	struct il_priv *il = file->private_data;
	int pos = 0;
	char *buf;
	int bufsz =
	    sizeof(struct stats_rx_phy) * 40 +
	    sizeof(struct stats_rx_non_phy) * 40 +
	    sizeof(struct stats_rx_ht_phy) * 40 + 400;
	ssize_t ret;
	struct stats_rx_phy *ofdm, *accum_ofdm, *delta_ofdm, *max_ofdm;
	struct stats_rx_phy *cck, *accum_cck, *delta_cck, *max_cck;
	struct stats_rx_non_phy *general, *accum_general;
	struct stats_rx_non_phy *delta_general, *max_general;
	struct stats_rx_ht_phy *ht, *accum_ht, *delta_ht, *max_ht;

	if (!il_is_alive(il))
		return -EAGAIN;

	buf = kzalloc(bufsz, GFP_KERNEL);
	if (!buf) {
		IL_ERR("Can not allocate Buffer\n");
		return -ENOMEM;
	}

	/*
	 * the statistic information display here is based on
	 * the last stats notification from uCode
	 * might not reflect the current uCode activity
	 */
	ofdm = &il->_4965.stats.rx.ofdm;
	cck = &il->_4965.stats.rx.cck;
	general = &il->_4965.stats.rx.general;
	ht = &il->_4965.stats.rx.ofdm_ht;
	accum_ofdm = &il->_4965.accum_stats.rx.ofdm;
	accum_cck = &il->_4965.accum_stats.rx.cck;
	accum_general = &il->_4965.accum_stats.rx.general;
	accum_ht = &il->_4965.accum_stats.rx.ofdm_ht;
	delta_ofdm = &il->_4965.delta_stats.rx.ofdm;
	delta_cck = &il->_4965.delta_stats.rx.cck;
	delta_general = &il->_4965.delta_stats.rx.general;
	delta_ht = &il->_4965.delta_stats.rx.ofdm_ht;
	max_ofdm = &il->_4965.max_delta.rx.ofdm;
	max_cck = &il->_4965.max_delta.rx.cck;
	max_general = &il->_4965.max_delta.rx.general;
	max_ht = &il->_4965.max_delta.rx.ofdm_ht;

	pos += il4965_stats_flag(il, buf, bufsz);
	pos +=

Annotation

Implementation Notes