Skip to content

Commit 05ab4e7

Browse files
Justin Teemartinkpetersen
authored andcommitted
scsi: lpfc: Restrict support for 32 byte CDBs to specific HBAs
An older generation of HBAs are failing FCP discovery due to usage of an outdated field in FCP command WQEs. Fix by checking the SLI Interface Type register for applicable support of 32 Byte CDB commands, and restore a setting for a WQE path using normal 16 byte CDBs. Fixes: af20bb7 ("scsi: lpfc: Add support for 32 byte CDBs") Cc: [email protected] # v6.10+ Signed-off-by: Justin Tee <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent fc318ca commit 05ab4e7

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

drivers/scsi/lpfc/lpfc_hw4.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4847,6 +4847,7 @@ struct fcp_iwrite64_wqe {
48474847
#define cmd_buff_len_SHIFT 16
48484848
#define cmd_buff_len_MASK 0x00000ffff
48494849
#define cmd_buff_len_WORD word3
4850+
/* Note: payload_offset_len field depends on ASIC support */
48504851
#define payload_offset_len_SHIFT 0
48514852
#define payload_offset_len_MASK 0x0000ffff
48524853
#define payload_offset_len_WORD word3
@@ -4863,6 +4864,7 @@ struct fcp_iread64_wqe {
48634864
#define cmd_buff_len_SHIFT 16
48644865
#define cmd_buff_len_MASK 0x00000ffff
48654866
#define cmd_buff_len_WORD word3
4867+
/* Note: payload_offset_len field depends on ASIC support */
48664868
#define payload_offset_len_SHIFT 0
48674869
#define payload_offset_len_MASK 0x0000ffff
48684870
#define payload_offset_len_WORD word3
@@ -4879,6 +4881,7 @@ struct fcp_icmnd64_wqe {
48794881
#define cmd_buff_len_SHIFT 16
48804882
#define cmd_buff_len_MASK 0x00000ffff
48814883
#define cmd_buff_len_WORD word3
4884+
/* Note: payload_offset_len field depends on ASIC support */
48824885
#define payload_offset_len_SHIFT 0
48834886
#define payload_offset_len_MASK 0x0000ffff
48844887
#define payload_offset_len_WORD word3

drivers/scsi/lpfc/lpfc_init.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4699,6 +4699,7 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev)
46994699
uint64_t wwn;
47004700
bool use_no_reset_hba = false;
47014701
int rc;
4702+
u8 if_type;
47024703

47034704
if (lpfc_no_hba_reset_cnt) {
47044705
if (phba->sli_rev < LPFC_SLI_REV4 &&
@@ -4773,10 +4774,24 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev)
47734774
shost->max_id = LPFC_MAX_TARGET;
47744775
shost->max_lun = vport->cfg_max_luns;
47754776
shost->this_id = -1;
4776-
if (phba->sli_rev == LPFC_SLI_REV4)
4777-
shost->max_cmd_len = LPFC_FCP_CDB_LEN_32;
4778-
else
4777+
4778+
/* Set max_cmd_len applicable to ASIC support */
4779+
if (phba->sli_rev == LPFC_SLI_REV4) {
4780+
if_type = bf_get(lpfc_sli_intf_if_type,
4781+
&phba->sli4_hba.sli_intf);
4782+
switch (if_type) {
4783+
case LPFC_SLI_INTF_IF_TYPE_2:
4784+
fallthrough;
4785+
case LPFC_SLI_INTF_IF_TYPE_6:
4786+
shost->max_cmd_len = LPFC_FCP_CDB_LEN_32;
4787+
break;
4788+
default:
4789+
shost->max_cmd_len = LPFC_FCP_CDB_LEN;
4790+
break;
4791+
}
4792+
} else {
47794793
shost->max_cmd_len = LPFC_FCP_CDB_LEN;
4794+
}
47804795

47814796
if (phba->sli_rev == LPFC_SLI_REV4) {
47824797
if (!phba->cfg_fcp_mq_threshold ||

drivers/scsi/lpfc/lpfc_scsi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4760,7 +4760,7 @@ static int lpfc_scsi_prep_cmnd_buf_s4(struct lpfc_vport *vport,
47604760

47614761
/* Word 3 */
47624762
bf_set(payload_offset_len, &wqe->fcp_icmd,
4763-
sizeof(struct fcp_cmnd32) + sizeof(struct fcp_rsp));
4763+
sizeof(struct fcp_cmnd) + sizeof(struct fcp_rsp));
47644764

47654765
/* Word 6 */
47664766
bf_set(wqe_ctxt_tag, &wqe->generic.wqe_com,

0 commit comments

Comments
 (0)