/** * beiscsi_session_destroy - destroys iscsi session * @cls_session: pointer to iscsi cls session * * Destroys iSCSI session instance and releases * resources allocated for it. */ void beiscsi_session_destroy(struct iscsi_cls_session *cls_session) { struct iscsi_session *sess = cls_session->dd_data; struct beiscsi_session *beiscsi_sess = sess->dd_data; pci_pool_destroy(beiscsi_sess->bhs_pool); iscsi2_session_teardown(cls_session); }
static void iscsi_iser_session_destroy(struct iscsi_cls_session *cls_session) { struct Scsi_Host *shost = iscsi_session_to_shost(cls_session); iscsi2_session_teardown(cls_session); iscsi2_host_remove(shost); iscsi2_host_free(shost); }
/** * beiscsi_session_create - creates a new iscsi session * @cmds_max: max commands supported * @qdepth: max queue depth supported * @initial_cmdsn: initial iscsi CMDSN */ struct iscsi_cls_session *beiscsi_session_create(struct iscsi_endpoint *ep, u16 cmds_max, u16 qdepth, u32 initial_cmdsn) { struct Scsi_Host *shost; struct beiscsi_endpoint *beiscsi_ep; struct iscsi_cls_session *cls_session; struct beiscsi_hba *phba; struct iscsi_session *sess; struct beiscsi_session *beiscsi_sess; struct beiscsi_io_task *io_task; SE_DEBUG(DBG_LVL_8, "In beiscsi_session_create\n"); if (!ep) { SE_DEBUG(DBG_LVL_1, "beiscsi_session_create: invalid ep \n"); return NULL; } beiscsi_ep = ep->dd_data; phba = beiscsi_ep->phba; shost = phba->shost; if (cmds_max > beiscsi_ep->phba->params.wrbs_per_cxn) { shost_printk(KERN_ERR, shost, "Cannot handle %d cmds." "Max cmds per session supported is %d. Using %d. " "\n", cmds_max, beiscsi_ep->phba->params.wrbs_per_cxn, beiscsi_ep->phba->params.wrbs_per_cxn); cmds_max = beiscsi_ep->phba->params.wrbs_per_cxn; } cls_session = iscsi2_session_setup(&beiscsi_iscsi_transport, shost, cmds_max, sizeof(*beiscsi_sess), sizeof(*io_task), initial_cmdsn, ISCSI_MAX_TARGET); if (!cls_session) return NULL; sess = cls_session->dd_data; beiscsi_sess = sess->dd_data; beiscsi_sess->bhs_pool = pci_pool_create("beiscsi_bhs_pool", phba->pcidev, sizeof(struct be_cmd_bhs), 64, 0); if (!beiscsi_sess->bhs_pool) goto destroy_sess; return cls_session; destroy_sess: iscsi2_session_teardown(cls_session); return NULL; }