Exemplo n.º 1
0
static int
csio_vport_disable(struct fc_vport *fc_vport, bool disable)
{
	struct csio_lnode *ln = *(struct csio_lnode **)fc_vport->dd_data;
	struct Scsi_Host *shost = csio_ln_to_shost(ln);
	struct csio_hw *hw = csio_lnode_to_hw(ln);

	/* disable vport */
	if (disable) {
		/* Quiesce ios and send stop event to lnode */
		scsi_block_requests(shost);
		spin_lock_irq(&hw->lock);
		csio_scsim_cleanup_io_lnode(csio_hw_to_scsim(hw), ln);
		csio_lnode_stop(ln);
		spin_unlock_irq(&hw->lock);
		scsi_unblock_requests(shost);

		/* Free vnp */
		csio_fcoe_free_vnp(hw, ln);
		fc_vport_set_state(fc_vport, FC_VPORT_DISABLED);
		csio_ln_err(ln, "vport disabled\n");
		return 0;
	} else {
		/* enable vport */
		fc_vport_set_state(fc_vport, FC_VPORT_INITIALIZING);
		if (csio_fcoe_alloc_vnp(hw, ln)) {
			csio_ln_err(ln, "vport enabled failed.\n");
			return -1;
		}
		csio_ln_err(ln, "vport enabled\n");
		return 0;
	}
}
Exemplo n.º 2
0
static int
csio_vport_delete(struct fc_vport *fc_vport)
{
	struct csio_lnode *ln = *(struct csio_lnode **)fc_vport->dd_data;
	struct Scsi_Host *shost = csio_ln_to_shost(ln);
	struct csio_hw *hw = csio_lnode_to_hw(ln);
	int rmv;

	spin_lock_irq(&hw->lock);
	rmv = csio_is_hw_removing(hw);
	spin_unlock_irq(&hw->lock);

	if (rmv) {
		csio_shost_exit(ln);
		return 0;
	}

	/* Quiesce ios and send remove event to lnode */
	scsi_block_requests(shost);
	spin_lock_irq(&hw->lock);
	csio_scsim_cleanup_io_lnode(csio_hw_to_scsim(hw), ln);
	csio_lnode_close(ln);
	spin_unlock_irq(&hw->lock);
	scsi_unblock_requests(shost);

	/* Free vnp */
	if (fc_vport->vport_state !=  FC_VPORT_DISABLED)
		csio_fcoe_free_vnp(hw, ln);

	csio_shost_exit(ln);
	return 0;
}
Exemplo n.º 3
0
int
lpfc_ioctl_lip(struct lpfc_hba * phba, LPFCCMDINPUT_t * cip, void *dataout)
{
    struct lpfc_sli *psli;
    struct lpfc_sli_ring *pring;
    LPFC_MBOXQ_t *pmboxq;
    int mbxstatus;
    int i, rc;

    psli = &phba->sli;

    rc = 0;

    mbxstatus = MBXERR_ERROR;
    if (phba->hba_state == LPFC_HBA_READY) {
        if ((pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_ATOMIC)) == 0) {
            return ENOMEM;
        }

        scsi_block_requests(phba->host);

        i = 0;
        pring = &psli->ring[psli->fcp_ring];
        while (pring->txcmplq_cnt) {
            if (i++ > 500) {	/* wait up to 5 seconds */
                break;
            }

            mdelay(10);
        }
        memset((void *)pmboxq, 0, sizeof (LPFC_MBOXQ_t));
        lpfc_init_link(phba, pmboxq, phba->cfg_topology,
                       phba->cfg_link_speed);

        mbxstatus =
            lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2);

        if (mbxstatus == MBX_TIMEOUT) {
            /*
             * Let SLI layer to release mboxq if mbox command completed after timeout.
             */
            pmboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
        } else {
            mempool_free( pmboxq, phba->mbox_mem_pool);
        }

        if ((mbxstatus != MBX_SUCCESS) || (pmboxq->mb.mbxStatus))
            rc = ENODEV;

        scsi_unblock_requests(phba->host);
    } else
        rc = EACCES;

    memcpy(dataout, (char *)&mbxstatus, sizeof (uint16_t));

    return (rc);
}
Exemplo n.º 4
0
void mv_ial_block_requests(struct IALAdapter *pAdapter, MV_U8 channelIndex)
{
    if (MV_TRUE == pAdapter->host[channelIndex]->hostBlocked)
    {
        return;
    }

    if ((pAdapter->ialCommonExt.channelState[channelIndex] != CHANNEL_READY) &&
         (pAdapter->ialCommonExt.channelState[channelIndex] != CHANNEL_NOT_CONNECTED))
    {
        pAdapter->host[channelIndex]->hostBlocked = MV_TRUE;
        mvLogMsg(MV_IAL_LOG_ID,  MV_DEBUG, "[%d,%d]: blocking SCSI host.\n",
                 pAdapter->mvSataAdapter.adapterId, channelIndex);
        scsi_block_requests(pAdapter->host[channelIndex]->scsihost);
    }
    else
    {
        pAdapter->host[channelIndex]->hostBlocked = MV_FALSE;
    }
}