Lines Matching refs:device

109 	ib_device_t *device;
119 device = entry->ptr;
120 if (device->node_guid == htonll(guid)) {
121 ASSERT(device->reg_state == IB_DEV_CLOSE);
122 ASSERT(device->node_type == RDMA_NODE_IB_CA);
123 ASSERT(device->clnt_hdl == (ofs_client_p_t)ofs_client);
124 return (device);
203 ib_device_t *device;
206 /* re-use the device once it was created */
208 device = get_device(ofs_client, event->ev_hca_guid);
209 if (device == NULL) {
210 device = kmem_alloc(sizeof (ib_device_t), KM_SLEEP);
211 device->node_type = RDMA_NODE_IB_CA;
212 device->reg_state = IB_DEV_CLOSE;
213 device->clnt_hdl = (ofs_client_p_t)ofs_client;
214 device->node_guid = htonll(event->ev_hca_guid);
215 device->data = NULL;
218 llist_head_init(&device->list, device);
219 llist_add_tail(&device->list, &ofs_client->device_list);
221 device->hca_hdl = NULL;
222 device->local_dma_lkey = 0;
223 device->phys_port_cnt = 0;
227 &device->hca_hdl);
232 device->reg_state = IB_DEV_OPEN;
233 ibt_set_hca_private(device->hca_hdl, device);
235 rtn = ibt_query_hca(device->hca_hdl, &hattr);
237 device->reg_state = IB_DEV_CLOSE;
238 rtn = ibt_close_hca(device->hca_hdl);
244 (void) sprintf(device->name, "%x:%x:%x",
247 device->local_dma_lkey = hattr.hca_reserved_lkey;
248 device->phys_port_cnt = hattr.hca_nports;
249 ibt_set_hca_private(device->hca_hdl, device);
253 ofs_client->ib_client->add(device);
262 struct ib_device *device;
265 device = ibt_get_hca_private(hdl);
266 if (device->reg_state == IB_DEV_OPEN) {
270 ofs_client->ib_client->remove(device);
273 device->reg_state = IB_DEV_CLOSE;
275 rtn = ibt_close_hca(device->hca_hdl);
299 * register callbacks for IB device addition and removal. When an IB
300 * device is added, each registered client's add method will be called
301 * (in the order the clients were registered), and when a device is
317 ib_device_t *device;
392 device = kmem_zalloc(sizeof (ib_device_t), KM_NOSLEEP);
393 if (device == NULL) {
400 device->node_guid = htonll(guidp[i]);
401 device->node_type = RDMA_NODE_IB_CA;
402 device->reg_state = IB_DEV_CLOSE;
403 device->clnt_hdl = (ofs_client_p_t)ofs_client;
404 llist_head_init(&device->list, device);
405 llist_add_tail(&device->list, &ofs_client->device_list);
408 &device->hca_hdl);
413 device->reg_state = IB_DEV_OPEN;
415 rtn = ibt_query_hca(device->hca_hdl, &hattr);
422 client, device->hca_hdl, rtn);
426 (void) sprintf(device->name, "%x:%x:%x",
429 device->local_dma_lkey = hattr.hca_reserved_lkey;
430 device->phys_port_cnt = hattr.hca_nports;
431 ibt_set_hca_private(device->hca_hdl, device);
435 client->add(device);
454 device = entry->ptr;
459 if (device->reg_state == IB_DEV_OPEN) {
463 client->remove(device);
465 device->reg_state = IB_DEV_CLOSE;
466 rtn = ibt_close_hca(device->hca_hdl);
475 device = entry->ptr;
476 /* de-link and free the device */
478 kmem_free(device, sizeof (ib_device_t));
508 * will receive a remove callback for each IB device still registered.
514 ib_device_t *device;
528 device = entry->ptr;
533 if (device->reg_state == IB_DEV_OPEN) {
537 client->remove(device);
539 device->reg_state = IB_DEV_CLOSE;
540 rtn = ibt_close_hca(device->hca_hdl);
555 device = entry->ptr;
556 /* de-link and free the device */
558 kmem_free(device, sizeof (ib_device_t));
606 * @device:Device to get context for
612 void *ib_get_client_data(struct ib_device *device,
621 ASSERT(device != 0 && client != 0);
626 "ib_get_client_data: device: 0x%p, client: 0x%p => "
627 "no ofs_client", device, client);
634 if (ib_device->node_guid == device->node_guid) {
642 "ib_get_client_data: device: 0x%p, client: 0x%p => "
643 "no ib_device found", device, client);
650 "ib_get_client_data: device: 0x%p, client: 0x%p",
651 device, client);
658 * @device:Device to set context for
663 * ib_get_client_data(). If the specified device is not found, the function
666 void ib_set_client_data(struct ib_device *device, struct ib_client *client,
674 ASSERT(device != 0 && client != 0);
679 device->name, client->name);
686 if (ib_device->node_guid == device->node_guid) {
693 device->name, client->name);
701 "ib_set_client_data: device: 0x%p, client: 0x%p, "
702 "data: 0x%p", device, client, data);
706 * ib_query_device - Query IB device attributes
707 * @device:Device to query
710 * ib_query_device() returns the attributes of a device through the
714 ib_query_device(struct ib_device *device, struct ib_device_attr *attr)
716 ofs_client_t *ofs_client = (ofs_client_t *)device->clnt_hdl;
721 if (device->reg_state != IB_DEV_OPEN) {
724 "ib_query_device: device: 0x%p => "
725 "invalid device state (%d)", device, device->reg_state);
728 if ((rtn = ibt_query_hca(device->hca_hdl, &hattr)) != IBT_SUCCESS) {
731 "ib_query_device: device: 0x%p => "
732 "ibt_query_hca failed w/ 0x%x", device, rtn);
738 "ib_query_device: device: 0x%p, attr: 0x%p, rtn: 0x%p",
739 device, attr, rtn);
807 ib_alloc_pd(struct ib_device *device)
809 ofs_client_t *ofs_client = (ofs_client_t *)device->clnt_hdl;
815 "ib_alloc_pd: device: 0x%p => no sufficient memory",
816 device);
821 if (device->reg_state != IB_DEV_OPEN) {
824 "ib_alloc_pd: device: 0x%p => invalid device state (%d)",
825 device, device->reg_state);
830 "ib_alloc_pd: device: 0x%p", device);
832 rtn = ibt_alloc_pd(device->hca_hdl, IBT_PD_NO_FLAGS, &pd->ibt_pd);
836 pd->device = device;
838 "ib_alloc_pd: device: 0x%p, pd: 0x%p, ibt_pd: 0x%p, "
839 "rtn: 0x%x", device, pd, pd->ibt_pd, rtn);
845 "ib_alloc_pd: device: 0x%p, pd: 0x%p, ibt_pd: 0x%p => "
846 "ibt_alloc_pd failed w/ 0x%x", device, pd, pd->ibt_pd, rtn);
861 ofs_client_t *ofs_client = (ofs_client_t *)pd->device->clnt_hdl;
865 if (pd->device->reg_state != IB_DEV_OPEN) {
868 "ib_dealloc_pd: pd: 0x%p => invalid device state (%d)",
869 pd, pd->device->reg_state);
876 rtn = ibt_free_pd(pd->device->hca_hdl, pd->ibt_pd);
881 "ib_dealloc_pd: pd: 0x%p, device: 0x%p, ibt_pd: 0x%p, "
882 "rtn: 0x%x", pd, pd->device, pd->ibt_pd, rtn);
921 * ib_create_cq - Creates a CQ on the specified device.
922 * @device: The device on which to create the CQ.
938 ib_create_cq(struct ib_device *device, ib_comp_handler comp_handler,
942 ofs_client_t *ofs_client = (ofs_client_t *)device->clnt_hdl;
950 "ib_create_cq: device: 0x%p, comp_handler: 0x%p, "
952 "comp_vector: %p => no sufficient memory", device,
958 if (device->reg_state != IB_DEV_OPEN) {
961 "ib_create_cq: device: 0x%p, comp_handler: 0x%p, "
963 "comp_vector: %p => invalid device state (%d)", device,
965 device->reg_state);
970 "ib_create_cq: device: 0x%p, comp_handler: 0x%p, "
972 "comp_vector: %d", device, comp_handler, event_handler,
978 rtn = ibt_alloc_cq(device->hca_hdl, &cq_attr, &cq->ibt_cq, &real_size);
982 cq->device = device;
991 "ib_create_cq: device: 0x%p, cqe: 0x%x, ibt_cq: 0x%p, "
992 "rtn: 0x%x", device, cqe, cq->ibt_cq, rtn);
998 "ib_create_cq: device: 0x%p, cqe: 0x%x, ibt_cq: 0x%p => "
999 "ibt_alloc_cq failed w/ 0x%x", device, cqe, cq->ibt_cq, rtn);
1016 ofs_client_t *ofs_client = (ofs_client_t *)cq->device->clnt_hdl;
1020 if (cq->device->reg_state != IB_DEV_OPEN) {
1023 "ib_destroy_cq: cq: 0x%p => invalid device state (%d)",
1024 cq, cq->device->reg_state);
1068 ofs_client_t *ofs_client = pd->device->clnt_hdl;
1103 if (pd->device->reg_state != IB_DEV_OPEN) {
1108 "invalid device state (%d)", pd, qp_init_attr,
1109 pd->device->reg_state);
1148 rtn = ibt_alloc_qp(pd->device->hca_hdl, IBT_RC_RQP, &attrs,
1152 rtn = ibt_alloc_qp(pd->device->hca_hdl, IBT_UD_RQP, &attrs,
1156 rtn = ibt_alloc_special_qp(pd->device->hca_hdl,
1161 rtn = ibt_alloc_special_qp(pd->device->hca_hdl,
1182 qp->device = pd->device;
1196 "ib_create_qp: device: 0x%p, pd: 0x%x, init_attr: 0x%p, "
1197 "rtn: 0x%x", pd->device, pd, qp_init_attr, rtn);
1203 "ib_create_qp: device: 0x%p, pd: 0x%x, init_attr: 0x%p => "
1204 "ibt_alloc_(special)_qp failed w/ rtn: 0x%x", pd->device, pd,
1228 ofs_client_t *ofs_client = (ofs_client_t *)qp->device->clnt_hdl;
1232 if (qp->device->reg_state != IB_DEV_OPEN) {
1235 "ib_destroy_qp: qp: 0x%p => invalid device state (%d)",
1236 qp, qp->device->reg_state);
1307 ofs_client_t *ofs_client = cq->device->clnt_hdl;
1310 if (cq->device->reg_state != IB_DEV_OPEN) {
1647 ofs_client_t *ofs_client = qp->device->clnt_hdl;
1650 if (qp->device->reg_state != IB_DEV_OPEN) {
1653 "ib_modify_qp: qp: 0x%p => invalid device state (%d)",
1654 qp, qp->device->reg_state);
1658 rtn = ibt_query_hca(qp->device->hca_hdl, &hattr);
1664 qp, qp->device->hca_hdl, rtn);
2264 ofs_client_t *ofs_client = (ofs_client_t *)cq->device->clnt_hdl;
2267 if (cq->device->reg_state != IB_DEV_OPEN) {
2270 "ib_poll_cq: cq: 0x%p => invalid device state (%d)",
2271 cq, cq->device->reg_state);
2314 ib_get_ibt_hca_hdl(struct ib_device *device)
2316 return (device->hca_hdl);