FreeBSD/sys/dev/iser/iser_verbs.c
/**
 * based on the resolved device node GUID see if there already allocated
 * device for this device. If there's no such, create one.
 */
based on the resolved device node GUID see if there already allocated
device for this device. If there's no such, create one.
based on the resolved device node GUID see if there already allocated device for this device . If there ' s no such create one .
static struct iser_device *
iser_device_find_by_ib_device(struct rdma_cm_id *cma_id)
{
	struct iser_device *device;
	sx_xlock(&ig.device_list_mutex);
	list_for_each_entry(device, &ig.device_list, ig_list)
		if (device->ib_device->node_guid == cma_id->device->node_guid)
			goto inc_refcnt;
	device = malloc(sizeof *device, M_ISER_VERBS, M_WAITOK | M_ZERO);
	if (device == NULL)
		goto out;
	device->ib_device = cma_id->device;
	if (iser_create_device_ib_res(device)) {
		free(device, M_ISER_VERBS);
		device = NULL;
		goto out;
	}
	list_add(&device->ig_list, &ig.device_list);
inc_refcnt:
	device->refcount++;
	ISER_INFO("device %p refcount %d", device, device->refcount);
out:
	sx_xunlock(&ig.device_list_mutex);
	return (device);
}
static struct iser_device * iser_device_find_by_ib_device ( struct rdma_cm_id * cma_id ) { struct iser_device * device ; sx_xlock ( & ig . device_list_mutex ) ; list_for_each_entry ( device , & ig . device_list , ig_list ) if ( device -> ib_device -> node_guid == cma_id -> device -> node_guid ) goto inc_refcnt ; device = malloc ( sizeof * device , M_ISER_VERBS , M_WAITOK | M_ZERO ) ; if ( device == NULL ) goto out ; device -> ib_device = cma_id -> device ; if ( iser_create_device_ib_res ( device ) ) { free ( device , M_ISER_VERBS ) ; device = NULL ; goto out ; } list_add ( & device -> ig_list , & ig . device_list ) ; inc_refcnt : device -> refcount ++ ; ISER_INFO ( " " , device , device -> refcount ) ; out : sx_xunlock ( & ig . device_list_mutex ) ; return ( device ) ; }
based on the resolved device node GUID see if there already allocated
 device for this device.
based on the resolved device node GUID see if there already allocated device for this device .
/* find if there's a match using the node GUID */ /* assign this device to the device */ /* init the device and link it into ig device list */