From d681a3315dffe87513ed87e11456b33e21dcfd65 Mon Sep 17 00:00:00 2001 From: Nilesh Javali Date: Thu, 23 Jul 2026 10:33:52 +0530 Subject: [PATCH] scsi: qla2xxx: Update VP control IOCB handling for 29xx series Update VP control IOCB command and response handling to support the 29xx series adapters, which use the 128-byte vp_ctrl_entry_24xx_ext layout. Change the qla25xx_ctrlvp_iocb() and qla_ctrlvp_completed() function signatures from typed struct pointers to void *, since callers already pass a generic ring-slot pointer. Both the standard 64-byte vp_ctrl_entry_24xx and the 128-byte vp_ctrl_entry_24xx_ext are layout-identical for every field touched in these helpers (entry_type, handle, entry_count, command, vp_count, vp_idx_map, entry_status, comp_status, vp_idx_failed), so a single struct vp_ctrl_entry_24xx * view handles both adapter families without an IS_QLA29XX() branch. Add a BUILD_BUG_ON size check for the extended structure. Signed-off-by: Nilesh Javali Reviewed-by: Hannes Reinecke Link: https://patch.msgid.link/20260723050413.3897522-36-njavali@marvell.com Signed-off-by: Martin K. Petersen (Oracle) --- drivers/scsi/qla2xxx/qla_iocb.c | 23 ++++++++++++++++------- drivers/scsi/qla2xxx/qla_isr.c | 13 +++++++++---- drivers/scsi/qla2xxx/qla_os.c | 1 + 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index b631fee8c430..7e3a415d2c43 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -4074,22 +4074,31 @@ qla_nvme_ls(srb_t *sp, struct pt_ls4_request *cmd_pkt) } static void -qla25xx_ctrlvp_iocb(srb_t *sp, struct vp_ctrl_entry_24xx *vce) +qla25xx_ctrlvp_iocb(srb_t *sp, void *pkt) { + /* + * vp_ctrl_entry_24xx_ext is layout-identical to vp_ctrl_entry_24xx + * for all fields touched here (entry_type, handle, entry_count, + * command, vp_count, vp_idx_map) -- they all sit at the same + * offsets and types in both structs, and the ext layout merely + * tacks on flags/id/hopct/reserved at offset 32+. So no + * IS_QLA29XX(ha) dispatch is needed on the issue path. + */ + struct vp_ctrl_entry_24xx *vce = pkt; int map, pos; - vce->entry_type = VP_CTRL_IOCB_TYPE; - vce->handle = sp->handle; - vce->entry_count = 1; - vce->command = cpu_to_le16(sp->u.iocb_cmd.u.ctrlvp.cmd); - vce->vp_count = cpu_to_le16(1); - /* * index map in firmware starts with 1; decrement index * this is ok as we never use index 0 */ map = (sp->u.iocb_cmd.u.ctrlvp.vp_index - 1) / 8; pos = (sp->u.iocb_cmd.u.ctrlvp.vp_index - 1) & 7; + + vce->entry_type = VP_CTRL_IOCB_TYPE; + vce->handle = sp->handle; + vce->entry_count = 1; + vce->command = cpu_to_le16(sp->u.iocb_cmd.u.ctrlvp.cmd); + vce->vp_count = cpu_to_le16(1); vce->vp_idx_map[map] |= 1 << pos; } diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index 8367aa005d1b..128138b4d16a 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -3000,13 +3000,19 @@ static void qla24xx_nvme_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, } static void qla_ctrlvp_completed(scsi_qla_host_t *vha, struct req_que *req, - struct vp_ctrl_entry_24xx *vce) + void *pkt) { const char func[] = "CTRLVP-IOCB"; + /* + * vp_ctrl_entry_24xx_ext overlays vp_ctrl_entry_24xx for all + * fields read here (entry_status, comp_status, vp_idx_failed), + * so the read goes through one struct vp_ctrl_entry_24xx * view. + */ + struct vp_ctrl_entry_24xx *vce = pkt; srb_t *sp; int rval = QLA_SUCCESS; - sp = qla2x00_get_sp_from_handle(vha, func, req, vce); + sp = qla2x00_get_sp_from_handle(vha, func, req, pkt); if (!sp) return; @@ -4228,8 +4234,7 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha, (struct mbx_24xx_entry *)pkt); break; case VP_CTRL_IOCB_TYPE: - qla_ctrlvp_completed(vha, rsp->req, - (struct vp_ctrl_entry_24xx *)pkt); + qla_ctrlvp_completed(vha, rsp->req, pkt); break; case PUREX_IOCB_TYPE: if (IS_QLA29XX(ha)) { diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 5f11c46821c1..ad070c0bf7db 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -8437,6 +8437,7 @@ qla2x00_module_init(void) BUILD_BUG_ON(sizeof(struct vf_evfp_entry_24xx) != 56); BUILD_BUG_ON(sizeof(struct vp_config_entry_24xx) != 64); BUILD_BUG_ON(sizeof(struct vp_ctrl_entry_24xx) != 64); + BUILD_BUG_ON(sizeof(struct vp_ctrl_entry_24xx_ext) != 128); BUILD_BUG_ON(sizeof(struct vp_rpt_id_entry_24xx) != 64); BUILD_BUG_ON(sizeof(sts21_entry_t) != 64); BUILD_BUG_ON(sizeof(sts22_entry_t) != 64);