Skip to content

Commit d6c1b19

Browse files
hreineckemartinkpetersen
authored andcommitted
scsi: lpfc: Use unsigned type for num_sge
LUNs going into "failed ready running" state observed on >1T and on even numbers of size (2T, 4T, 6T, 8T and 10T). The issue occurs when DIF is enabled at the host. The kernel logs: Cannot setup S/G List for HBAIO segs 1/1 SGL 512 SCSI 256: 3 0 The host lpfc driver is failing to setup scatter/gather list (protection data) for the I/Os. The return type lpfc_bg_setup_sgl()/lpfc_bg_setup_sgl_prot() causes the compiler to remove the most significant bit. Use an unsigned type instead. Signed-off-by: Hannes Reinecke <hare@suse.de> [dwagner: added commit message] Signed-off-by: Daniel Wagner <dwagner@suse.de> Link: https://lore.kernel.org/r/20231220162658.12392-1-dwagner@suse.de Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 4e6c901 commit d6c1b19

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/scsi/lpfc/lpfc_scsi.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1918,16 +1918,16 @@ lpfc_bg_setup_bpl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc,
19181918
*
19191919
* Returns the number of SGEs added to the SGL.
19201920
**/
1921-
static int
1921+
static uint32_t
19221922
lpfc_bg_setup_sgl(struct lpfc_hba *phba, struct scsi_cmnd *sc,
19231923
struct sli4_sge *sgl, int datasegcnt,
19241924
struct lpfc_io_buf *lpfc_cmd)
19251925
{
19261926
struct scatterlist *sgde = NULL; /* s/g data entry */
19271927
struct sli4_sge_diseed *diseed = NULL;
19281928
dma_addr_t physaddr;
1929-
int i = 0, num_sge = 0, status;
1930-
uint32_t reftag;
1929+
int i = 0, status;
1930+
uint32_t reftag, num_sge = 0;
19311931
uint8_t txop, rxop;
19321932
#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
19331933
uint32_t rc;
@@ -2099,7 +2099,7 @@ lpfc_bg_setup_sgl(struct lpfc_hba *phba, struct scsi_cmnd *sc,
20992099
*
21002100
* Returns the number of SGEs added to the SGL.
21012101
**/
2102-
static int
2102+
static uint32_t
21032103
lpfc_bg_setup_sgl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc,
21042104
struct sli4_sge *sgl, int datacnt, int protcnt,
21052105
struct lpfc_io_buf *lpfc_cmd)
@@ -2123,8 +2123,8 @@ lpfc_bg_setup_sgl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc,
21232123
uint32_t rc;
21242124
#endif
21252125
uint32_t checking = 1;
2126-
uint32_t dma_offset = 0;
2127-
int num_sge = 0, j = 2;
2126+
uint32_t dma_offset = 0, num_sge = 0;
2127+
int j = 2;
21282128
struct sli4_hybrid_sgl *sgl_xtra = NULL;
21292129

21302130
sgpe = scsi_prot_sglist(sc);

0 commit comments

Comments
 (0)