/** * beiscsi_ep_connect - Ask chip to create TCP Conn * @scsi_host: Pointer to scsi_host structure * @dst_addr: The IP address of Target * @non_blocking: blocking or non-blocking call * * This routines first asks chip to create a connection and then allocates an EP */ struct iscsi_endpoint * beiscsi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr, int non_blocking) { struct beiscsi_hba *phba; struct beiscsi_endpoint *beiscsi_ep; struct iscsi_endpoint *ep; int ret; SE_DEBUG(DBG_LVL_8, "In beiscsi_ep_connect\n"); if (shost) phba = iscsi_host_priv(shost); else { ret = -ENXIO; SE_DEBUG(DBG_LVL_1, "shost is NULL\n"); return ERR_PTR(ret); } if (phba->state != BE_ADAPTER_UP) { ret = -EBUSY; SE_DEBUG(DBG_LVL_1, "The Adapter state is Not UP\n"); return ERR_PTR(ret); } ep = iscsi_create_endpoint(sizeof(struct beiscsi_endpoint)); if (!ep) { ret = -ENOMEM; return ERR_PTR(ret); } beiscsi_ep = ep->dd_data; beiscsi_ep->phba = phba; beiscsi_ep->openiscsi_ep = ep; ret = beiscsi_open_conn(ep, NULL, dst_addr, non_blocking); if (ret) { SE_DEBUG(DBG_LVL_1, "Failed in beiscsi_open_conn\n"); goto free_ep; } return ep; free_ep: iscsi_destroy_endpoint(ep); return ERR_PTR(ret); }
static struct iscsi_endpoint * iscsi_iser_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr, int non_blocking) { int err; struct iser_conn *ib_conn; struct iscsi_endpoint *ep; ep = iscsi_create_endpoint(sizeof(*ib_conn)); if (!ep) return ERR_PTR(-ENOMEM); ib_conn = ep->dd_data; ib_conn->ep = ep; iser_conn_init(ib_conn); err = iser_connect(ib_conn, NULL, (struct sockaddr_in *)dst_addr, non_blocking); if (err) return ERR_PTR(err); return ep; }