drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c

Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c

File Facts

System
Linux kernel
Corpus path
drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c
Extension
.c
Size
122706 bytes
Lines
4444
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: operation-table or driver-model contract
Status
pattern 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

static const struct file_operations iwl_dbgfs_##name##_ops = {		\
	.read = iwl_dbgfs_##name##_read,				\
	.open = simple_open,						\
	.llseek = generic_file_llseek,					\
};

#define DEBUGFS_WRITE_FILE_OPS(name)                                    \
static const struct file_operations iwl_dbgfs_##name##_ops = {          \
	.write = iwl_dbgfs_##name##_write,                              \
	.open = simple_open,						\
	.llseek = generic_file_llseek,					\
};

#define DEBUGFS_READ_WRITE_FILE_OPS(name)				\
static const struct file_operations iwl_dbgfs_##name##_ops = {		\
	.write = iwl_dbgfs_##name##_write,				\
	.read = iwl_dbgfs_##name##_read,				\
	.open = simple_open,						\
	.llseek = generic_file_llseek,					\
};

struct iwl_dbgfs_tx_queue_priv {
	struct iwl_trans *trans;
};

struct iwl_dbgfs_tx_queue_state {
	loff_t pos;
};

static void *iwl_dbgfs_tx_queue_seq_start(struct seq_file *seq, loff_t *pos)
{
	struct iwl_dbgfs_tx_queue_priv *priv = seq->private;
	struct iwl_dbgfs_tx_queue_state *state;

	if (*pos >= priv->trans->mac_cfg->base->num_of_queues)
		return NULL;

	state = kmalloc_obj(*state);
	if (!state)
		return NULL;
	state->pos = *pos;
	return state;
}

static void *iwl_dbgfs_tx_queue_seq_next(struct seq_file *seq,
					 void *v, loff_t *pos)
{
	struct iwl_dbgfs_tx_queue_priv *priv = seq->private;
	struct iwl_dbgfs_tx_queue_state *state = v;

	*pos = ++state->pos;

	if (*pos >= priv->trans->mac_cfg->base->num_of_queues)
		return NULL;

	return state;
}

static void iwl_dbgfs_tx_queue_seq_stop(struct seq_file *seq, void *v)
{
	kfree(v);
}

static int iwl_dbgfs_tx_queue_seq_show(struct seq_file *seq, void *v)
{
	struct iwl_dbgfs_tx_queue_priv *priv = seq->private;
	struct iwl_dbgfs_tx_queue_state *state = v;
	struct iwl_trans *trans = priv->trans;
	struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
	struct iwl_txq *txq = trans_pcie->txqs.txq[state->pos];

	seq_printf(seq, "hwq %.3u: used=%d stopped=%d ",
		   (unsigned int)state->pos,
		   !!test_bit(state->pos, trans_pcie->txqs.queue_used),
		   !!test_bit(state->pos, trans_pcie->txqs.queue_stopped));
	if (txq)
		seq_printf(seq,
			   "read=%u write=%u need_update=%d frozen=%d n_window=%d ampdu=%d",
			   txq->read_ptr, txq->write_ptr,
			   txq->need_update, txq->frozen,
			   txq->n_window, txq->ampdu);
	else
		seq_puts(seq, "(unallocated)");

	if (state->pos == trans->conf.cmd_queue)
		seq_puts(seq, " (HCMD)");
	seq_puts(seq, "\n");

	return 0;
}

Annotation

Implementation Notes