scsi: qla2xxx: Introduce qla2x00_els_dcmd2_free()
This patch reduces code duplication. Cc: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Tested-by: Himanshu Madhani <hmadhani@marvell.com> Reviewed-by: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
897def2004
commit
c6e58160a2
|
@ -455,7 +455,7 @@ struct srb_iocb {
|
||||||
struct els_logo_payload *els_logo_pyld;
|
struct els_logo_payload *els_logo_pyld;
|
||||||
dma_addr_t els_logo_pyld_dma;
|
dma_addr_t els_logo_pyld_dma;
|
||||||
} els_logo;
|
} els_logo;
|
||||||
struct {
|
struct els_plogi {
|
||||||
#define ELS_DCMD_PLOGI 0x3
|
#define ELS_DCMD_PLOGI 0x3
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
uint32_t els_cmd;
|
uint32_t els_cmd;
|
||||||
|
|
|
@ -45,6 +45,8 @@ extern int qla2x00_local_device_login(scsi_qla_host_t *, fc_port_t *);
|
||||||
|
|
||||||
extern int qla24xx_els_dcmd_iocb(scsi_qla_host_t *, int, port_id_t);
|
extern int qla24xx_els_dcmd_iocb(scsi_qla_host_t *, int, port_id_t);
|
||||||
extern int qla24xx_els_dcmd2_iocb(scsi_qla_host_t *, int, fc_port_t *, bool);
|
extern int qla24xx_els_dcmd2_iocb(scsi_qla_host_t *, int, fc_port_t *, bool);
|
||||||
|
extern void qla2x00_els_dcmd2_free(scsi_qla_host_t *vha,
|
||||||
|
struct els_plogi *els_plogi);
|
||||||
|
|
||||||
extern void qla2x00_update_fcports(scsi_qla_host_t *);
|
extern void qla2x00_update_fcports(scsi_qla_host_t *);
|
||||||
|
|
||||||
|
|
|
@ -3119,17 +3119,7 @@ void qla24xx_sp_unmap(scsi_qla_host_t *vha, srb_t *sp)
|
||||||
|
|
||||||
switch (sp->type) {
|
switch (sp->type) {
|
||||||
case SRB_ELS_DCMD:
|
case SRB_ELS_DCMD:
|
||||||
if (c->u.els_plogi.els_plogi_pyld)
|
qla2x00_els_dcmd2_free(vha, &c->u.els_plogi);
|
||||||
dma_free_coherent(&vha->hw->pdev->dev,
|
|
||||||
c->u.els_plogi.tx_size,
|
|
||||||
c->u.els_plogi.els_plogi_pyld,
|
|
||||||
c->u.els_plogi.els_plogi_pyld_dma);
|
|
||||||
|
|
||||||
if (c->u.els_plogi.els_resp_pyld)
|
|
||||||
dma_free_coherent(&vha->hw->pdev->dev,
|
|
||||||
c->u.els_plogi.rx_size,
|
|
||||||
c->u.els_plogi.els_resp_pyld,
|
|
||||||
c->u.els_plogi.els_resp_pyld_dma);
|
|
||||||
break;
|
break;
|
||||||
case SRB_CT_PTHRU_CMD:
|
case SRB_CT_PTHRU_CMD:
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -2717,6 +2717,21 @@ qla2x00_els_dcmd2_iocb_timeout(void *data)
|
||||||
sp->done(sp, QLA_FUNCTION_TIMEOUT);
|
sp->done(sp, QLA_FUNCTION_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void qla2x00_els_dcmd2_free(scsi_qla_host_t *vha, struct els_plogi *els_plogi)
|
||||||
|
{
|
||||||
|
if (els_plogi->els_plogi_pyld)
|
||||||
|
dma_free_coherent(&vha->hw->pdev->dev,
|
||||||
|
els_plogi->tx_size,
|
||||||
|
els_plogi->els_plogi_pyld,
|
||||||
|
els_plogi->els_plogi_pyld_dma);
|
||||||
|
|
||||||
|
if (els_plogi->els_resp_pyld)
|
||||||
|
dma_free_coherent(&vha->hw->pdev->dev,
|
||||||
|
els_plogi->rx_size,
|
||||||
|
els_plogi->els_resp_pyld,
|
||||||
|
els_plogi->els_resp_pyld_dma);
|
||||||
|
}
|
||||||
|
|
||||||
static void qla2x00_els_dcmd2_sp_done(srb_t *sp, int res)
|
static void qla2x00_els_dcmd2_sp_done(srb_t *sp, int res)
|
||||||
{
|
{
|
||||||
fc_port_t *fcport = sp->fcport;
|
fc_port_t *fcport = sp->fcport;
|
||||||
|
@ -2748,17 +2763,7 @@ static void qla2x00_els_dcmd2_sp_done(srb_t *sp, int res)
|
||||||
if (!e) {
|
if (!e) {
|
||||||
struct srb_iocb *elsio = &sp->u.iocb_cmd;
|
struct srb_iocb *elsio = &sp->u.iocb_cmd;
|
||||||
|
|
||||||
if (elsio->u.els_plogi.els_plogi_pyld)
|
qla2x00_els_dcmd2_free(vha, &elsio->u.els_plogi);
|
||||||
dma_free_coherent(&sp->vha->hw->pdev->dev,
|
|
||||||
elsio->u.els_plogi.tx_size,
|
|
||||||
elsio->u.els_plogi.els_plogi_pyld,
|
|
||||||
elsio->u.els_plogi.els_plogi_pyld_dma);
|
|
||||||
|
|
||||||
if (elsio->u.els_plogi.els_resp_pyld)
|
|
||||||
dma_free_coherent(&sp->vha->hw->pdev->dev,
|
|
||||||
elsio->u.els_plogi.rx_size,
|
|
||||||
elsio->u.els_plogi.els_resp_pyld,
|
|
||||||
elsio->u.els_plogi.els_resp_pyld_dma);
|
|
||||||
sp->free(sp);
|
sp->free(sp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2858,18 +2863,7 @@ qla24xx_els_dcmd2_iocb(scsi_qla_host_t *vha, int els_opcode,
|
||||||
|
|
||||||
out:
|
out:
|
||||||
fcport->flags &= ~(FCF_ASYNC_SENT);
|
fcport->flags &= ~(FCF_ASYNC_SENT);
|
||||||
if (elsio->u.els_plogi.els_plogi_pyld)
|
qla2x00_els_dcmd2_free(vha, &elsio->u.els_plogi);
|
||||||
dma_free_coherent(&sp->vha->hw->pdev->dev,
|
|
||||||
elsio->u.els_plogi.tx_size,
|
|
||||||
elsio->u.els_plogi.els_plogi_pyld,
|
|
||||||
elsio->u.els_plogi.els_plogi_pyld_dma);
|
|
||||||
|
|
||||||
if (elsio->u.els_plogi.els_resp_pyld)
|
|
||||||
dma_free_coherent(&sp->vha->hw->pdev->dev,
|
|
||||||
elsio->u.els_plogi.rx_size,
|
|
||||||
elsio->u.els_plogi.els_resp_pyld,
|
|
||||||
elsio->u.els_plogi.els_resp_pyld_dma);
|
|
||||||
|
|
||||||
sp->free(sp);
|
sp->free(sp);
|
||||||
done:
|
done:
|
||||||
return rval;
|
return rval;
|
||||||
|
|
Loading…
Reference in a new issue