drivers/scsi/elx/efct/efct_xport.c

Source file repositories/reference/linux-study-clean/drivers/scsi/elx/efct/efct_xport.c

File Facts

System
Linux kernel
Corpus path
drivers/scsi/elx/efct/efct_xport.c
Extension
.c
Size
28815 bytes
Lines
1112
Domain
Driver Families
Bucket
drivers/scsi
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

if (IS_ERR(efct->sess_debugfs_dir)) {
			efc_log_err(efct,
				    "failed to create debugfs entry for sessions\n");
			goto debugfs_fail;
		}
		atomic_inc(&efct_debugfs_count);
	}

	return 0;

debugfs_fail:
	return -EIO;
}

static void efct_xport_delete_debugfs(struct efct *efct)
{
	/* Remove session debugfs directory */
	debugfs_remove(efct->sess_debugfs_dir);
	efct->sess_debugfs_dir = NULL;
	atomic_dec(&efct_debugfs_count);

	if (atomic_read(&efct_debugfs_count) == 0) {
		/* remove root debugfs directory */
		debugfs_remove(efct_debugfs_root);
		efct_debugfs_root = NULL;
	}
}

int
efct_xport_attach(struct efct_xport *xport)
{
	struct efct *efct = xport->efct;
	int rc;

	rc = efct_hw_setup(&efct->hw, efct, efct->pci);
	if (rc) {
		efc_log_err(efct, "%s: Can't setup hardware\n", efct->desc);
		return rc;
	}

	efct_hw_parse_filter(&efct->hw, (void *)efct->filter_def);

	xport->io_pool = efct_io_pool_create(efct, efct->hw.config.n_sgl);
	if (!xport->io_pool) {
		efc_log_err(efct, "Can't allocate IO pool\n");
		return -ENOMEM;
	}

	return 0;
}

static void
efct_xport_link_stats_cb(int status, u32 num_counters,
			 struct efct_hw_link_stat_counts *counters, void *arg)
{
	union efct_xport_stats_u *result = arg;

	result->stats.link_stats.link_failure_error_count =
		counters[EFCT_HW_LINK_STAT_LINK_FAILURE_COUNT].counter;
	result->stats.link_stats.loss_of_sync_error_count =
		counters[EFCT_HW_LINK_STAT_LOSS_OF_SYNC_COUNT].counter;
	result->stats.link_stats.primitive_sequence_error_count =
		counters[EFCT_HW_LINK_STAT_PRIMITIVE_SEQ_COUNT].counter;
	result->stats.link_stats.invalid_transmission_word_error_count =
		counters[EFCT_HW_LINK_STAT_INVALID_XMIT_WORD_COUNT].counter;
	result->stats.link_stats.crc_error_count =
		counters[EFCT_HW_LINK_STAT_CRC_COUNT].counter;

	complete(&result->stats.done);
}

static void
efct_xport_host_stats_cb(int status, u32 num_counters,
			 struct efct_hw_host_stat_counts *counters, void *arg)
{
	union efct_xport_stats_u *result = arg;

	result->stats.host_stats.transmit_kbyte_count =
		counters[EFCT_HW_HOST_STAT_TX_KBYTE_COUNT].counter;
	result->stats.host_stats.receive_kbyte_count =
		counters[EFCT_HW_HOST_STAT_RX_KBYTE_COUNT].counter;
	result->stats.host_stats.transmit_frame_count =
		counters[EFCT_HW_HOST_STAT_TX_FRAME_COUNT].counter;
	result->stats.host_stats.receive_frame_count =
		counters[EFCT_HW_HOST_STAT_RX_FRAME_COUNT].counter;

	complete(&result->stats.done);
}

static void

Annotation

Implementation Notes