Skip to content

Commit c7ee3bd

Browse files
Quinn TranChristoph Hellwig
authored andcommitted
qla2xxx: fix sparse warnings introduced by previous target mode t10-dif patch
Fix sparse warnings introduce by "qla2xxx: T10-Dif: add T10-PI support". Signed-off-by: Quinn Tran <quinn.tran@qlogic.com> Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent 3fb4b16 commit c7ee3bd

File tree

3 files changed

+26
-21
lines changed

3 files changed

+26
-21
lines changed

drivers/scsi/qla2xxx/qla_def.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,16 +1648,16 @@ typedef struct {
16481648
*/
16491649
struct crc_context {
16501650
uint32_t handle; /* System handle. */
1651-
uint32_t ref_tag;
1652-
uint16_t app_tag;
1651+
__le32 ref_tag;
1652+
__le16 app_tag;
16531653
uint8_t ref_tag_mask[4]; /* Validation/Replacement Mask*/
16541654
uint8_t app_tag_mask[2]; /* Validation/Replacement Mask*/
1655-
uint16_t guard_seed; /* Initial Guard Seed */
1656-
uint16_t prot_opts; /* Requested Data Protection Mode */
1657-
uint16_t blk_size; /* Data size in bytes */
1655+
__le16 guard_seed; /* Initial Guard Seed */
1656+
__le16 prot_opts; /* Requested Data Protection Mode */
1657+
__le16 blk_size; /* Data size in bytes */
16581658
uint16_t runt_blk_guard; /* Guard value for runt block (tape
16591659
* only) */
1660-
uint32_t byte_count; /* Total byte count/ total data
1660+
__le32 byte_count; /* Total byte count/ total data
16611661
* transfer count */
16621662
union {
16631663
struct {
@@ -1671,10 +1671,10 @@ struct crc_context {
16711671
uint32_t reserved_6;
16721672
} nobundling;
16731673
struct {
1674-
uint32_t dif_byte_count; /* Total DIF byte
1674+
__le32 dif_byte_count; /* Total DIF byte
16751675
* count */
16761676
uint16_t reserved_1;
1677-
uint16_t dseg_count; /* Data segment count */
1677+
__le16 dseg_count; /* Data segment count */
16781678
uint32_t reserved_2;
16791679
uint32_t data_address[2];
16801680
uint32_t data_length;

drivers/scsi/qla2xxx/qla_target.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1997,7 +1997,7 @@ qlt_set_t10dif_tags(struct se_cmd *se_cmd, struct crc_context *ctx)
19971997
* have been immplemented by TCM, before AppTag is avail.
19981998
* Look for modesense_handlers[]
19991999
*/
2000-
ctx->app_tag = __constant_cpu_to_le16(0);
2000+
ctx->app_tag = 0;
20012001
ctx->app_tag_mask[0] = 0x0;
20022002
ctx->app_tag_mask[1] = 0x0;
20032003

@@ -2079,6 +2079,7 @@ qlt_build_ctio_crc2_pkt(struct qla_tgt_prm *prm, scsi_qla_host_t *vha)
20792079
struct se_cmd *se_cmd = &cmd->se_cmd;
20802080
uint32_t h;
20812081
struct atio_from_isp *atio = &prm->cmd->atio;
2082+
uint16_t t16;
20822083

20832084
sgc = 0;
20842085
ha = vha->hw;
@@ -2175,8 +2176,13 @@ qlt_build_ctio_crc2_pkt(struct qla_tgt_prm *prm, scsi_qla_host_t *vha)
21752176
pkt->initiator_id[1] = atio->u.isp24.fcp_hdr.s_id[1];
21762177
pkt->initiator_id[2] = atio->u.isp24.fcp_hdr.s_id[0];
21772178
pkt->exchange_addr = atio->u.isp24.exchange_addr;
2178-
pkt->ox_id = swab16(atio->u.isp24.fcp_hdr.ox_id);
2179-
pkt->flags |= (atio->u.isp24.attr << 9);
2179+
2180+
/* silence compile warning */
2181+
t16 = be16_to_cpu(atio->u.isp24.fcp_hdr.ox_id);
2182+
pkt->ox_id = cpu_to_le16(t16);
2183+
2184+
t16 = (atio->u.isp24.attr << 9);
2185+
pkt->flags |= cpu_to_le16(t16);
21802186
pkt->relative_offset = cpu_to_le32(prm->cmd->offset);
21812187

21822188
/* Set transfer direction */
@@ -2251,8 +2257,7 @@ qlt_build_ctio_crc2_pkt(struct qla_tgt_prm *prm, scsi_qla_host_t *vha)
22512257

22522258
if (bundling && prm->prot_seg_cnt) {
22532259
/* Walks dif segments */
2254-
pkt->add_flags |=
2255-
__constant_cpu_to_le16(CTIO_CRC2_AF_DIF_DSD_ENA);
2260+
pkt->add_flags |= CTIO_CRC2_AF_DIF_DSD_ENA;
22562261

22572262
cur_dsd = (uint32_t *) &crc_ctx_pkt->u.bundling.dif_address;
22582263
if (qla24xx_walk_and_build_prot_sglist(ha, NULL, cur_dsd,

drivers/scsi/qla2xxx/qla_target.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ struct fcp_hdr {
316316
uint8_t seq_id;
317317
uint8_t df_ctl;
318318
uint16_t seq_cnt;
319-
uint16_t ox_id;
319+
__be16 ox_id;
320320
uint16_t rx_id;
321321
uint32_t parameter;
322322
} __packed;
@@ -441,7 +441,7 @@ struct ctio7_to_24xx {
441441
union {
442442
struct {
443443
uint16_t reserved1;
444-
uint16_t flags;
444+
__le16 flags;
445445
uint32_t residual;
446446
uint16_t ox_id;
447447
uint16_t scsi_status;
@@ -527,7 +527,7 @@ struct ctio_crc2_to_fw {
527527

528528
uint32_t handle; /* System handle. */
529529
uint16_t nport_handle; /* N_PORT handle. */
530-
uint16_t timeout; /* Command timeout. */
530+
__le16 timeout; /* Command timeout. */
531531

532532
uint16_t dseg_count; /* Data segment count. */
533533
uint8_t vp_index;
@@ -538,15 +538,15 @@ struct ctio_crc2_to_fw {
538538
uint8_t reserved1;
539539
uint32_t exchange_addr; /* rcv exchange address */
540540
uint16_t reserved2;
541-
uint16_t flags; /* refer to CTIO7 flags values */
541+
__le16 flags; /* refer to CTIO7 flags values */
542542
uint32_t residual;
543-
uint16_t ox_id;
543+
__le16 ox_id;
544544
uint16_t scsi_status;
545-
uint32_t relative_offset;
545+
__le32 relative_offset;
546546
uint32_t reserved5;
547-
uint32_t transfer_length; /* total fc transfer length */
547+
__le32 transfer_length; /* total fc transfer length */
548548
uint32_t reserved6;
549-
uint32_t crc_context_address[2];/* Data segment address. */
549+
__le32 crc_context_address[2];/* Data segment address. */
550550
uint16_t crc_context_len; /* Data segment length. */
551551
uint16_t reserved_1; /* MUST be set to 0. */
552552
} __packed;

0 commit comments

Comments
 (0)