drivers/scsi/elx/libefc/efc_domain.c

Source file repositories/reference/linux-study-clean/drivers/scsi/elx/libefc/efc_domain.c

File Facts

System
Linux kernel
Corpus path
drivers/scsi/elx/libefc/efc_domain.c
Extension
.c
Size
26481 bytes
Lines
1089
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 (!domain) {
			domain = efc_domain_alloc(efc, fcf_wwn);
			if (!domain) {
				efc_log_err(efc, "efc_domain_alloc() failed\n");
				rc = -1;
				break;
			}
			efc_sm_transition(&domain->drvsm, __efc_domain_init,
					  NULL);
		}
		efc_domain_post_event(domain, EFC_EVT_DOMAIN_FOUND, drec);
		break;
	}

	case EFC_HW_DOMAIN_LOST:
		domain_trace(domain, "EFC_HW_DOMAIN_LOST:\n");
		efc->hold_frames = true;
		efc_domain_post_event(domain, EFC_EVT_DOMAIN_LOST, NULL);
		break;

	case EFC_HW_DOMAIN_ALLOC_OK:
		domain_trace(domain, "EFC_HW_DOMAIN_ALLOC_OK:\n");
		efc_domain_post_event(domain, EFC_EVT_DOMAIN_ALLOC_OK, NULL);
		break;

	case EFC_HW_DOMAIN_ALLOC_FAIL:
		domain_trace(domain, "EFC_HW_DOMAIN_ALLOC_FAIL:\n");
		efc_domain_post_event(domain, EFC_EVT_DOMAIN_ALLOC_FAIL,
				      NULL);
		break;

	case EFC_HW_DOMAIN_ATTACH_OK:
		domain_trace(domain, "EFC_HW_DOMAIN_ATTACH_OK:\n");
		efc_domain_post_event(domain, EFC_EVT_DOMAIN_ATTACH_OK, NULL);
		break;

	case EFC_HW_DOMAIN_ATTACH_FAIL:
		domain_trace(domain, "EFC_HW_DOMAIN_ATTACH_FAIL:\n");
		efc_domain_post_event(domain,
				      EFC_EVT_DOMAIN_ATTACH_FAIL, NULL);
		break;

	case EFC_HW_DOMAIN_FREE_OK:
		domain_trace(domain, "EFC_HW_DOMAIN_FREE_OK:\n");
		efc_domain_post_event(domain, EFC_EVT_DOMAIN_FREE_OK, NULL);
		break;

	case EFC_HW_DOMAIN_FREE_FAIL:
		domain_trace(domain, "EFC_HW_DOMAIN_FREE_FAIL:\n");
		efc_domain_post_event(domain, EFC_EVT_DOMAIN_FREE_FAIL, NULL);
		break;

	default:
		efc_log_warn(efc, "unsupported event %#x\n", event);
	}
	spin_unlock_irqrestore(&efc->lock, flags);

	if (efc->domain && domain->req_accept_frames) {
		domain->req_accept_frames = false;
		efc->hold_frames = false;
	}

	return rc;
}

static void
_efc_domain_free(struct kref *arg)
{
	struct efc_domain *domain = container_of(arg, struct efc_domain, ref);
	struct efc *efc = domain->efc;

	if (efc->domain_free_cb)
		(*efc->domain_free_cb)(efc, efc->domain_free_cb_arg);

	kfree(domain);
}

void
efc_domain_free(struct efc_domain *domain)
{
	struct efc *efc;

	efc = domain->efc;

	/* Hold frames to clear the domain pointer from the xport lookup */
	efc->hold_frames = false;

	efc_log_debug(efc, "Domain free: wwn %016llX\n", domain->fcf_wwn);

	xa_destroy(&domain->lookup);

Annotation

Implementation Notes