drivers/scsi/snic/snic_res.c

Source file repositories/reference/linux-study-clean/drivers/scsi/snic/snic_res.c

File Facts

System
Linux kernel
Corpus path
drivers/scsi/snic/snic_res.c
Extension
.c
Size
6747 bytes
Lines
282
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 (ret) { \
			SNIC_HOST_ERR(snic->shost, \
				      "Error getting %s, %d\n", #m, ret); \
			return ret; \
		} \
	} while (0)

	GET_CONFIG(wq_enet_desc_count);
	GET_CONFIG(maxdatafieldsize);
	GET_CONFIG(intr_timer);
	GET_CONFIG(intr_timer_type);
	GET_CONFIG(flags);
	GET_CONFIG(io_throttle_count);
	GET_CONFIG(port_down_timeout);
	GET_CONFIG(port_down_io_retries);
	GET_CONFIG(luns_per_tgt);
	GET_CONFIG(xpt_type);
	GET_CONFIG(hid);

	c->wq_enet_desc_count = min_t(u32,
				      VNIC_SNIC_WQ_DESCS_MAX,
				      max_t(u32,
					    VNIC_SNIC_WQ_DESCS_MIN,
					    c->wq_enet_desc_count));

	c->wq_enet_desc_count = ALIGN(c->wq_enet_desc_count, 16);

	c->maxdatafieldsize = min_t(u32,
				    VNIC_SNIC_MAXDATAFIELDSIZE_MAX,
				    max_t(u32,
					  VNIC_SNIC_MAXDATAFIELDSIZE_MIN,
					  c->maxdatafieldsize));

	c->io_throttle_count = min_t(u32,
				     VNIC_SNIC_IO_THROTTLE_COUNT_MAX,
				     max_t(u32,
					   VNIC_SNIC_IO_THROTTLE_COUNT_MIN,
					   c->io_throttle_count));

	c->port_down_timeout = min_t(u32,
				     VNIC_SNIC_PORT_DOWN_TIMEOUT_MAX,
				     c->port_down_timeout);

	c->port_down_io_retries = min_t(u32,
				     VNIC_SNIC_PORT_DOWN_IO_RETRIES_MAX,
				     c->port_down_io_retries);

	c->luns_per_tgt = min_t(u32,
				VNIC_SNIC_LUNS_PER_TARGET_MAX,
				max_t(u32,
				      VNIC_SNIC_LUNS_PER_TARGET_MIN,
				      c->luns_per_tgt));

	c->intr_timer = min_t(u32, VNIC_INTR_TIMER_MAX, c->intr_timer);

	SNIC_INFO("vNIC resources wq %d\n", c->wq_enet_desc_count);
	SNIC_INFO("vNIC mtu %d intr timer %d\n",
		  c->maxdatafieldsize,
		  c->intr_timer);

	SNIC_INFO("vNIC flags 0x%x luns per tgt %d\n",
		  c->flags,
		  c->luns_per_tgt);

	SNIC_INFO("vNIC io throttle count %d\n", c->io_throttle_count);
	SNIC_INFO("vNIC port down timeout %d port down io retries %d\n",
		  c->port_down_timeout,
		  c->port_down_io_retries);

	SNIC_INFO("vNIC back end type = %d\n", c->xpt_type);
	SNIC_INFO("vNIC hid = %d\n", c->hid);

	return 0;
}

void
snic_get_res_counts(struct snic *snic)
{
	snic->wq_count = svnic_dev_get_res_count(snic->vdev, RES_TYPE_WQ);
	SNIC_BUG_ON(snic->wq_count == 0);
	snic->cq_count = svnic_dev_get_res_count(snic->vdev, RES_TYPE_CQ);
	SNIC_BUG_ON(snic->cq_count == 0);
	snic->intr_count = svnic_dev_get_res_count(snic->vdev,
						  RES_TYPE_INTR_CTRL);
	SNIC_BUG_ON(snic->intr_count == 0);
}

void
snic_free_vnic_res(struct snic *snic)
{

Annotation

Implementation Notes