drivers/scsi/elx/libefc_sli/sli4.c

Source file repositories/reference/linux-study-clean/drivers/scsi/elx/libefc_sli/sli4.c

File Facts

System
Linux kernel
Corpus path
drivers/scsi/elx/libefc_sli/sli4.c
Extension
.c
Size
133605 bytes
Lines
5156
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 (le32_to_cpu(mcqe->dw3_flags) & SLI4_MCQE_AE) {
			*etype = SLI4_QENTRY_ASYNC;
		} else {
			*etype = SLI4_QENTRY_MQ;
			rc = sli_cqe_mq(sli4, mcqe);
		}
		*q_id = -1;
	} else {
		rc = sli_fc_cqe_parse(sli4, cq, cqe, etype, q_id);
	}

	return rc;
}

int
sli_abort_wqe(struct sli4 *sli, void *buf, enum sli4_abort_type type,
	      bool send_abts, u32 ids, u32 mask, u16 tag, u16 cq_id)
{
	struct sli4_abort_wqe *abort = buf;

	memset(buf, 0, sli->wqe_size);

	switch (type) {
	case SLI4_ABORT_XRI:
		abort->criteria = SLI4_ABORT_CRITERIA_XRI_TAG;
		if (mask) {
			efc_log_warn(sli, "%#x aborting XRI %#x warning non-zero mask",
				     mask, ids);
			mask = 0;
		}
		break;
	case SLI4_ABORT_ABORT_ID:
		abort->criteria = SLI4_ABORT_CRITERIA_ABORT_TAG;
		break;
	case SLI4_ABORT_REQUEST_ID:
		abort->criteria = SLI4_ABORT_CRITERIA_REQUEST_TAG;
		break;
	default:
		efc_log_info(sli, "unsupported type %#x\n", type);
		return -EIO;
	}

	abort->ia_ir_byte |= send_abts ? 0 : 1;

	/* Suppress ABTS retries */
	abort->ia_ir_byte |= SLI4_ABRT_WQE_IR;

	abort->t_mask = cpu_to_le32(mask);
	abort->t_tag  = cpu_to_le32(ids);
	abort->command = SLI4_WQE_ABORT;
	abort->request_tag = cpu_to_le16(tag);

	abort->dw10w0_flags = cpu_to_le16(SLI4_ABRT_WQE_QOSD);

	abort->cq_id = cpu_to_le16(cq_id);
	abort->cmdtype_wqec_byte |= SLI4_CMD_ABORT_WQE;

	return 0;
}

int
sli_els_request64_wqe(struct sli4 *sli, void *buf, struct efc_dma *sgl,
		      struct sli_els_params *params)
{
	struct sli4_els_request64_wqe *els = buf;
	struct sli4_sge *sge = sgl->virt;
	bool is_fabric = false;
	struct sli4_bde *bptr;

	memset(buf, 0, sli->wqe_size);

	bptr = &els->els_request_payload;
	if (sli->params.sgl_pre_registered) {
		els->qosd_xbl_hlm_iod_dbde_wqes &= ~SLI4_REQ_WQE_XBL;

		els->qosd_xbl_hlm_iod_dbde_wqes |= SLI4_REQ_WQE_DBDE;
		bptr->bde_type_buflen =
			cpu_to_le32((SLI4_BDE_TYPE_VAL(64)) |
				    (params->xmit_len & SLI4_BDE_LEN_MASK));

		bptr->u.data.low  = sge[0].buffer_address_low;
		bptr->u.data.high = sge[0].buffer_address_high;
	} else {
		els->qosd_xbl_hlm_iod_dbde_wqes |= SLI4_REQ_WQE_XBL;

		bptr->bde_type_buflen =
			cpu_to_le32((SLI4_BDE_TYPE_VAL(BLP)) |
				    ((2 * sizeof(struct sli4_sge)) &
				     SLI4_BDE_LEN_MASK));
		bptr->u.blp.low  = cpu_to_le32(lower_32_bits(sgl->phys));

Annotation

Implementation Notes