mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-22 21:21:28 +00:00
qla2x00t-32gbit: Convert MAKE_HANDLE() from a define into an inline function
This patch allows sparse to verify the endianness of the arguments passed to make_handle(). Link: https://lore.kernel.org/r/20200220043441.20504-5-bvanassche@acm.org Cc: Roman Bolshakov <r.bolshakov@yadro.com> Cc: Daniel Wagner <dwagner@suse.de> Cc: Martin Wilck <mwilck@suse.com> Cc: Quinn Tran <qutran@marvell.com> Reviewed-by: Daniel Wagner <dwagner@suse.de> Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com> Acked-by: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> [ commit c25eb70a10243c1ad24e74375aceb65ab8951e93 upstream ] git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8814 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -141,7 +141,10 @@ typedef struct {
|
||||
#define LSD(x) ((uint32_t)((uint64_t)(x)))
|
||||
#define MSD(x) ((uint32_t)((((uint64_t)(x)) >> 16) >> 16))
|
||||
|
||||
#define MAKE_HANDLE(x, y) ((uint32_t)((((uint32_t)(x)) << 16) | (uint32_t)(y)))
|
||||
static inline uint32_t make_handle(uint16_t x, uint16_t y)
|
||||
{
|
||||
return ((uint32_t)x << 16) | y;
|
||||
}
|
||||
|
||||
/*
|
||||
* I/O register
|
||||
|
||||
@@ -530,7 +530,7 @@ __qla2x00_marker(struct scsi_qla_host *vha, struct qla_qpair *qpair,
|
||||
int_to_scsilun(lun, (struct scsi_lun *)&mrk24->lun);
|
||||
host_to_fcp_swap(mrk24->lun, sizeof(mrk24->lun));
|
||||
mrk24->vp_index = vha->vp_idx;
|
||||
mrk24->handle = MAKE_HANDLE(req->id, mrk24->handle);
|
||||
mrk24->handle = make_handle(req->id, mrk24->handle);
|
||||
} else {
|
||||
SET_TARGET_ID(ha, mrk->target, loop_id);
|
||||
mrk->lun = cpu_to_le16((uint16_t)lun);
|
||||
@@ -1661,7 +1661,7 @@ qla24xx_start_scsi(srb_t *sp)
|
||||
req->cnt -= req_cnt;
|
||||
|
||||
cmd_pkt = (struct cmd_type_7 *)req->ring_ptr;
|
||||
cmd_pkt->handle = MAKE_HANDLE(req->id, handle);
|
||||
cmd_pkt->handle = make_handle(req->id, handle);
|
||||
|
||||
/* Zero out remaining portion of packet. */
|
||||
/* tagged queuing modifier -- default is TSK_SIMPLE (0). */
|
||||
@@ -1849,7 +1849,7 @@ qla24xx_dif_start_scsi(srb_t *sp)
|
||||
|
||||
/* Fill-in common area */
|
||||
cmd_pkt = (struct cmd_type_crc_2 *)req->ring_ptr;
|
||||
cmd_pkt->handle = MAKE_HANDLE(req->id, handle);
|
||||
cmd_pkt->handle = make_handle(req->id, handle);
|
||||
|
||||
clr_ptr = (uint32_t *)cmd_pkt + 2;
|
||||
memset(clr_ptr, 0, REQUEST_ENTRY_SIZE - 8);
|
||||
@@ -1981,7 +1981,7 @@ qla2xxx_start_scsi_mq(srb_t *sp)
|
||||
req->cnt -= req_cnt;
|
||||
|
||||
cmd_pkt = (struct cmd_type_7 *)req->ring_ptr;
|
||||
cmd_pkt->handle = MAKE_HANDLE(req->id, handle);
|
||||
cmd_pkt->handle = make_handle(req->id, handle);
|
||||
|
||||
/* Zero out remaining portion of packet. */
|
||||
/* tagged queuing modifier -- default is TSK_SIMPLE (0). */
|
||||
@@ -2184,7 +2184,7 @@ qla2xxx_dif_start_scsi_mq(srb_t *sp)
|
||||
|
||||
/* Fill-in common area */
|
||||
cmd_pkt = (struct cmd_type_crc_2 *)req->ring_ptr;
|
||||
cmd_pkt->handle = MAKE_HANDLE(req->id, handle);
|
||||
cmd_pkt->handle = make_handle(req->id, handle);
|
||||
|
||||
clr_ptr = (uint32_t *)cmd_pkt + 2;
|
||||
memset(clr_ptr, 0, REQUEST_ENTRY_SIZE - 8);
|
||||
@@ -2497,7 +2497,7 @@ qla24xx_tm_iocb(srb_t *sp, struct tsk_mgmt_entry *tsk)
|
||||
|
||||
tsk->entry_type = TSK_MGMT_IOCB_TYPE;
|
||||
tsk->entry_count = 1;
|
||||
tsk->handle = MAKE_HANDLE(req->id, tsk->handle);
|
||||
tsk->handle = make_handle(req->id, tsk->handle);
|
||||
tsk->nport_handle = cpu_to_le16(fcport->loop_id);
|
||||
tsk->timeout = cpu_to_le16(ha->r_a_tov / 10 * 2);
|
||||
tsk->control_flags = cpu_to_le32(flags);
|
||||
@@ -3378,7 +3378,7 @@ sufficient_dsds:
|
||||
}
|
||||
|
||||
cmd_pkt = (struct cmd_type_6 *)req->ring_ptr;
|
||||
cmd_pkt->handle = MAKE_HANDLE(req->id, handle);
|
||||
cmd_pkt->handle = make_handle(req->id, handle);
|
||||
|
||||
/* Zero out remaining portion of packet. */
|
||||
/* tagged queuing modifier -- default is TSK_SIMPLE (0). */
|
||||
@@ -3449,7 +3449,7 @@ sufficient_dsds:
|
||||
goto queuing_error;
|
||||
|
||||
cmd_pkt = (struct cmd_type_7 *)req->ring_ptr;
|
||||
cmd_pkt->handle = MAKE_HANDLE(req->id, handle);
|
||||
cmd_pkt->handle = make_handle(req->id, handle);
|
||||
|
||||
/* Zero out remaining portion of packet. */
|
||||
/* tagged queuing modifier -- default is TSK_SIMPLE (0).*/
|
||||
@@ -3554,7 +3554,7 @@ qla24xx_abort_iocb(srb_t *sp, struct abort_entry_24xx *abt_iocb)
|
||||
memset(abt_iocb, 0, sizeof(struct abort_entry_24xx));
|
||||
abt_iocb->entry_type = ABORT_IOCB_TYPE;
|
||||
abt_iocb->entry_count = 1;
|
||||
abt_iocb->handle = cpu_to_le32(MAKE_HANDLE(req->id, sp->handle));
|
||||
abt_iocb->handle = cpu_to_le32(make_handle(req->id, sp->handle));
|
||||
if (sp->fcport) {
|
||||
abt_iocb->nport_handle = cpu_to_le16(sp->fcport->loop_id);
|
||||
abt_iocb->port_id[0] = sp->fcport->d_id.b.al_pa;
|
||||
@@ -3562,7 +3562,7 @@ qla24xx_abort_iocb(srb_t *sp, struct abort_entry_24xx *abt_iocb)
|
||||
abt_iocb->port_id[2] = sp->fcport->d_id.b.domain;
|
||||
}
|
||||
abt_iocb->handle_to_abort =
|
||||
cpu_to_le32(MAKE_HANDLE(aio->u.abt.req_que_no,
|
||||
cpu_to_le32(make_handle(aio->u.abt.req_que_no,
|
||||
aio->u.abt.cmd_hndl));
|
||||
abt_iocb->vp_index = vha->vp_idx;
|
||||
abt_iocb->req_que_no = cpu_to_le16(aio->u.abt.req_que_no);
|
||||
@@ -3929,7 +3929,7 @@ qla2x00_start_bidir(srb_t *sp, struct scsi_qla_host *vha, uint32_t tot_dsds)
|
||||
}
|
||||
|
||||
cmd_pkt = (struct cmd_bidir *)req->ring_ptr;
|
||||
cmd_pkt->handle = MAKE_HANDLE(req->id, handle);
|
||||
cmd_pkt->handle = make_handle(req->id, handle);
|
||||
|
||||
/* Zero out remaining portion of packet. */
|
||||
/* tagged queuing modifier -- default is TSK_SIMPLE (0).*/
|
||||
|
||||
@@ -2437,7 +2437,7 @@ qla24xx_login_fabric(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain,
|
||||
|
||||
lg->entry_type = LOGINOUT_PORT_IOCB_TYPE;
|
||||
lg->entry_count = 1;
|
||||
lg->handle = MAKE_HANDLE(req->id, lg->handle);
|
||||
lg->handle = make_handle(req->id, lg->handle);
|
||||
lg->nport_handle = cpu_to_le16(loop_id);
|
||||
lg->control_flags = cpu_to_le16(LCF_COMMAND_PLOGI);
|
||||
if (opt & BIT_0)
|
||||
@@ -2707,7 +2707,7 @@ qla24xx_fabric_logout(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain,
|
||||
req = vha->req;
|
||||
lg->entry_type = LOGINOUT_PORT_IOCB_TYPE;
|
||||
lg->entry_count = 1;
|
||||
lg->handle = MAKE_HANDLE(req->id, lg->handle);
|
||||
lg->handle = make_handle(req->id, lg->handle);
|
||||
lg->nport_handle = cpu_to_le16(loop_id);
|
||||
lg->control_flags =
|
||||
cpu_to_le16(LCF_COMMAND_LOGO|LCF_IMPL_LOGO|
|
||||
@@ -3197,9 +3197,9 @@ qla24xx_abort_command(srb_t *sp)
|
||||
|
||||
abt->entry_type = ABORT_IOCB_TYPE;
|
||||
abt->entry_count = 1;
|
||||
abt->handle = MAKE_HANDLE(req->id, abt->handle);
|
||||
abt->handle = make_handle(req->id, abt->handle);
|
||||
abt->nport_handle = cpu_to_le16(fcport->loop_id);
|
||||
abt->handle_to_abort = MAKE_HANDLE(req->id, handle);
|
||||
abt->handle_to_abort = make_handle(req->id, handle);
|
||||
abt->port_id[0] = fcport->d_id.b.al_pa;
|
||||
abt->port_id[1] = fcport->d_id.b.area;
|
||||
abt->port_id[2] = fcport->d_id.b.domain;
|
||||
@@ -3276,7 +3276,7 @@ __qla24xx_issue_tmf(char *name, uint32_t type, struct fc_port *fcport,
|
||||
|
||||
tsk->p.tsk.entry_type = TSK_MGMT_IOCB_TYPE;
|
||||
tsk->p.tsk.entry_count = 1;
|
||||
tsk->p.tsk.handle = MAKE_HANDLE(req->id, tsk->p.tsk.handle);
|
||||
tsk->p.tsk.handle = make_handle(req->id, tsk->p.tsk.handle);
|
||||
tsk->p.tsk.nport_handle = cpu_to_le16(fcport->loop_id);
|
||||
tsk->p.tsk.timeout = cpu_to_le16(ha->r_a_tov / 10 * 2);
|
||||
tsk->p.tsk.control_flags = cpu_to_le32(type);
|
||||
|
||||
@@ -3148,7 +3148,7 @@ qlafx00_start_scsi(srb_t *sp)
|
||||
|
||||
memset(&lcmd_pkt, 0, REQUEST_ENTRY_SIZE);
|
||||
|
||||
lcmd_pkt.handle = MAKE_HANDLE(req->id, sp->handle);
|
||||
lcmd_pkt.handle = make_handle(req->id, sp->handle);
|
||||
lcmd_pkt.reserved_0 = 0;
|
||||
lcmd_pkt.port_path_ctrl = 0;
|
||||
lcmd_pkt.reserved_1 = 0;
|
||||
@@ -3218,7 +3218,7 @@ qlafx00_tm_iocb(srb_t *sp, struct tsk_mgmt_entry_fx00 *ptm_iocb)
|
||||
memset(&tm_iocb, 0, sizeof(struct tsk_mgmt_entry_fx00));
|
||||
tm_iocb.entry_type = TSK_MGMT_IOCB_TYPE_FX00;
|
||||
tm_iocb.entry_count = 1;
|
||||
tm_iocb.handle = cpu_to_le32(MAKE_HANDLE(req->id, sp->handle));
|
||||
tm_iocb.handle = cpu_to_le32(make_handle(req->id, sp->handle));
|
||||
tm_iocb.reserved_0 = 0;
|
||||
tm_iocb.tgt_id = cpu_to_le16(sp->fcport->tgt_id);
|
||||
tm_iocb.control_flags = cpu_to_le32(fxio->u.tmf.flags);
|
||||
@@ -3244,9 +3244,9 @@ qlafx00_abort_iocb(srb_t *sp, struct abort_iocb_entry_fx00 *pabt_iocb)
|
||||
memset(&abt_iocb, 0, sizeof(struct abort_iocb_entry_fx00));
|
||||
abt_iocb.entry_type = ABORT_IOCB_TYPE_FX00;
|
||||
abt_iocb.entry_count = 1;
|
||||
abt_iocb.handle = cpu_to_le32(MAKE_HANDLE(req->id, sp->handle));
|
||||
abt_iocb.handle = cpu_to_le32(make_handle(req->id, sp->handle));
|
||||
abt_iocb.abort_handle =
|
||||
cpu_to_le32(MAKE_HANDLE(req->id, fxio->u.abt.cmd_hndl));
|
||||
cpu_to_le32(make_handle(req->id, fxio->u.abt.cmd_hndl));
|
||||
abt_iocb.tgt_id_sts = cpu_to_le16(sp->fcport->tgt_id);
|
||||
abt_iocb.req_que_no = cpu_to_le16(req->id);
|
||||
|
||||
|
||||
@@ -424,7 +424,7 @@ static inline int qla2x00_start_nvme_mq(srb_t *sp)
|
||||
req->cnt -= req_cnt;
|
||||
|
||||
cmd_pkt = (struct cmd_nvme *)req->ring_ptr;
|
||||
cmd_pkt->handle = MAKE_HANDLE(req->id, handle);
|
||||
cmd_pkt->handle = make_handle(req->id, handle);
|
||||
|
||||
/* Zero out remaining portion of packet. */
|
||||
clr_ptr = (uint32_t *)cmd_pkt + 2;
|
||||
|
||||
@@ -1773,7 +1773,7 @@ static int qlt_build_abts_resp_iocb(struct qla_tgt_mgmt_cmd *mcmd)
|
||||
qpair->req->outstanding_cmds[h] = (srb_t *)mcmd;
|
||||
}
|
||||
|
||||
resp->handle = MAKE_HANDLE(qpair->req->id, h);
|
||||
resp->handle = make_handle(qpair->req->id, h);
|
||||
resp->entry_type = ABTS_RESP_24XX;
|
||||
resp->entry_count = 1;
|
||||
resp->nport_handle = abts->nport_handle;
|
||||
@@ -2610,7 +2610,7 @@ static int qlt_24xx_build_ctio_pkt(struct qla_qpair *qpair,
|
||||
} else
|
||||
qpair->req->outstanding_cmds[h] = (srb_t *)prm->cmd;
|
||||
|
||||
pkt->handle = MAKE_HANDLE(qpair->req->id, h);
|
||||
pkt->handle = make_handle(qpair->req->id, h);
|
||||
pkt->handle |= CTIO_COMPLETION_HANDLE_MARK;
|
||||
pkt->nport_handle = cpu_to_le16(prm->cmd->loop_id);
|
||||
pkt->timeout = cpu_to_le16(QLA_TGT_TIMEOUT);
|
||||
@@ -3124,7 +3124,7 @@ qlt_build_ctio_crc2_pkt(struct qla_qpair *qpair, struct qla_tgt_prm *prm)
|
||||
} else
|
||||
qpair->req->outstanding_cmds[h] = (srb_t *)prm->cmd;
|
||||
|
||||
pkt->handle = MAKE_HANDLE(qpair->req->id, h);
|
||||
pkt->handle = make_handle(qpair->req->id, h);
|
||||
pkt->handle |= CTIO_COMPLETION_HANDLE_MARK;
|
||||
pkt->nport_handle = cpu_to_le16(prm->cmd->loop_id);
|
||||
pkt->timeout = cpu_to_le16(QLA_TGT_TIMEOUT);
|
||||
|
||||
Reference in New Issue
Block a user