diff --git a/drivers/infiniband/ulp/iser/iser_memory.c b/drivers/infiniband/ulp/iser/iser_memory.c index 009be8889d71d05c7eeeb7d6684276ae54c76911..a7d2aab40ee68e1be397f489ecfd70896ed2d6b1 100644 --- a/drivers/infiniband/ulp/iser/iser_memory.c +++ b/drivers/infiniband/ulp/iser/iser_memory.c @@ -526,14 +526,14 @@ int iser_reg_rdma_mem(struct iscsi_iser_task *task, int err; use_dma_key = mem->dma_nents == 1 && (all_imm || !iser_always_reg) && - scsi_get_prot_op(task->sc) == SCSI_PROT_NORMAL; + scsi_prot_op_normal(task->sc); if (!use_dma_key) { desc = device->reg_ops->reg_desc_get(ib_conn); reg->mem_h = desc; } - if (scsi_get_prot_op(task->sc) == SCSI_PROT_NORMAL) + if (scsi_prot_op_normal(task->sc)) data_reg = reg; else data_reg = &task->desc.data_reg; @@ -542,7 +542,7 @@ int iser_reg_rdma_mem(struct iscsi_iser_task *task, if (unlikely(err)) goto err_reg; - if (scsi_get_prot_op(task->sc) != SCSI_PROT_NORMAL) { + if (!scsi_prot_op_normal(task->sc)) { struct iser_mem_reg *prot_reg = &task->desc.prot_reg; if (scsi_prot_sg_count(task->sc)) { diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index f78d2e5c1471d3faf22d8e5a9b98e566f1531189..234f6a3661febc634c32ee7e8d27974563e4eec8 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -389,7 +389,7 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task) return rc; } - if (scsi_get_prot_op(sc) != SCSI_PROT_NORMAL) + if (!scsi_prot_op_normal(sc)) task->protected = true; transfer_length = scsi_transfer_length(sc); diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 200b5bca1f5f441721d7633302fe651388548b84..615bda3a063285d818a21cce2dd57c7f52f21aee 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -4087,7 +4087,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, if ((lpfc_cmd->result == IOERR_RX_DMA_FAILED || lpfc_cmd->result == IOERR_TX_DMA_FAILED) && pIocbOut->iocb.unsli3.sli3_bg.bgstat) { - if (scsi_get_prot_op(cmd) != SCSI_PROT_NORMAL) { + if (!scsi_prot_op_normal(cmd)) { /* * This is a response for a BG enabled * cmd. Parse BG error @@ -4568,7 +4568,7 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd) } ndlp = rdata->pnode; - if ((scsi_get_prot_op(cmnd) != SCSI_PROT_NORMAL) && + if (!scsi_prot_op_normal(cmnd) && (!(phba->sli3_options & LPFC_SLI3_BG_ENABLED))) { lpfc_printf_log(phba, KERN_ERR, LOG_BG, @@ -4638,7 +4638,7 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd) lpfc_cmd->start_time = jiffies; cmnd->host_scribble = (unsigned char *)lpfc_cmd; - if (scsi_get_prot_op(cmnd) != SCSI_PROT_NORMAL) { + if (!scsi_prot_op_normal(cmnd)) { if (vport->phba->cfg_enable_bg) { lpfc_printf_vlog(vport, KERN_INFO, LOG_SCSI_CMD, diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index 119927220299e7ec9df947097d230f416fb48139..200fb8a6cf53d9de3c68c0047a32d430b9bc0231 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -1569,7 +1569,7 @@ qla24xx_dif_start_scsi(srb_t *sp) #define QDSS_GOT_Q_SPACE BIT_0 /* Only process protection or >16 cdb in this routine */ - if (scsi_get_prot_op(cmd) == SCSI_PROT_NORMAL) { + if (scsi_prot_op_normal(cmd)) { if (cmd->cmd_len <= 16) return qla24xx_start_scsi(sp); } @@ -1918,13 +1918,13 @@ qla2xxx_dif_start_scsi_mq(srb_t *sp) } if (!qpair->difdix_supported && - scsi_get_prot_op(cmd) != SCSI_PROT_NORMAL) { + !scsi_prot_op_normal(cmd)) { cmd->result = DID_NO_CONNECT << 16; return QLA_INTERFACE_ERROR; } /* Only process protection or >16 cdb in this routine */ - if (scsi_get_prot_op(cmd) == SCSI_PROT_NORMAL) { + if (scsi_prot_op_normal(cmd)) { if (cmd->cmd_len <= 16) return qla2xxx_start_scsi_mq(sp); } diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index ae9fd2d01004ad86b0c676a04cd7a15655d849d4..bde3e5925fd2e13acf1deaad399d0e1388b9dcb6 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -889,7 +889,7 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) } if (!vha->flags.difdix_supported && - scsi_get_prot_op(cmd) != SCSI_PROT_NORMAL) { + !scsi_prot_op_normal(cmd)) { ql_dbg(ql_dbg_io, vha, 0x3004, "DIF Cap not reg, fail DIF capable cmd's:%p.\n", cmd); diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index c891ada3c5c25c1b6f91a33af08765dfabb065b5..3b26ea119c8b6e047fc6a5f0f0252f38c8022bd0 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -271,6 +271,11 @@ static inline unsigned char scsi_get_prot_op(struct scsi_cmnd *scmd) return scmd->prot_op; } +static inline bool scsi_prot_op_normal(struct scsi_cmnd *scmd) +{ + return scmd->prot_op == SCSI_PROT_NORMAL; +} + enum scsi_prot_flags { SCSI_PROT_TRANSFER_PI = 1 << 0, SCSI_PROT_GUARD_CHECK = 1 << 1,