FreeBSD/sys/dev/iser/iser_verbs.c
/**
 * iser_free_ib_conn_res - release IB related resources
 * @iser_conn: iser connection struct
 * @destroy: indicator if we need to try to release the
 *     iser device and memory regoins pool (only iscsi
 *     shutdown and DEVICE_REMOVAL will use this).
 *
 * This routine is called with the iser state mutex held
 * so the cm_id removal is out of here. It is Safe to
 * be invoked multiple times.
 */
release IB related resources
@iser_conn: iser connection struct
@destroy: indicator if we need to try to release the
iser device and memory regoins pool (only iscsi
shutdown and DEVICE_REMOVAL will use this).

This routine is called with the iser state mutex held
so the cm_id removal is out of here. It is Safe to
be invoked multiple times.
release IB related resources @iser_conn : iser connection struct @destroy : indicator if we need to try to release the iser device and memory regoins pool ( only iscsi shutdown and DEVICE_REMOVAL will use this ) . This routine is called with the iser state mutex held so the cm_id removal is out of here . It is Safe to be invoked multiple times .
void
iser_free_ib_conn_res(struct iser_conn *iser_conn,
				  bool destroy)
{
	struct ib_conn *ib_conn = &iser_conn->ib_conn;
	struct iser_device *device = ib_conn->device;
	ISER_INFO("freeing conn %p cma_id %p qp %p",
		  iser_conn, ib_conn->cma_id, ib_conn->qp);
	if (ib_conn->qp != NULL) {
		mtx_lock(&ig.connlist_mutex);
		ib_conn->comp->active_qps--;
		mtx_unlock(&ig.connlist_mutex);
		rdma_destroy_qp(ib_conn->cma_id);
		ib_conn->qp = NULL;
	}
	if (destroy) {
		if (iser_conn->login_buf)
			iser_free_login_buf(iser_conn);
		if (iser_conn->rx_descs)
			iser_free_rx_descriptors(iser_conn);
		if (device != NULL) {
			iser_device_try_release(device);
			ib_conn->device = NULL;
		}
	}
}
void iser_free_ib_conn_res ( struct iser_conn * iser_conn , bool destroy ) { struct ib_conn * ib_conn = & iser_conn -> ib_conn ; struct iser_device * device = ib_conn -> device ; ISER_INFO ( " " , iser_conn , ib_conn -> cma_id , ib_conn -> qp ) ; if ( ib_conn -> qp != NULL ) { mtx_lock ( & ig . connlist_mutex ) ; ib_conn -> comp -> active_qps -- ; mtx_unlock ( & ig . connlist_mutex ) ; rdma_destroy_qp ( ib_conn -> cma_id ) ; ib_conn -> qp = NULL ; } if ( destroy ) { if ( iser_conn -> login_buf ) iser_free_login_buf ( iser_conn ) ; if ( iser_conn -> rx_descs ) iser_free_rx_descriptors ( iser_conn ) ; if ( device != NULL ) { iser_device_try_release ( device ) ; ib_conn -> device = NULL ; } } }
iser_free_ib_conn_res - release IB related resources
 @iser_conn: iser connection struct
 @destroy: indicator if we need to try to release the
     iser device and memory regoins pool (only iscsi
     shutdown and DEVICE_REMOVAL will use this).
iser_free_ib_conn_res - release IB related resources @iser_conn : iser connection struct @destroy : indicator if we need to try to release the iser device and memory regoins pool ( only iscsi shutdown and DEVICE_REMOVAL will use this ) .