Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch '6.9/s/lpfc2' into 6.10/s/lpfc

Pull in bug fix update from 6.9/scsi-fixes to accommodate 14.4.0.2
series.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

+177 -185
+1 -1
drivers/scsi/lpfc/lpfc.h
··· 1333 1333 struct timer_list fabric_block_timer; 1334 1334 unsigned long bit_flags; 1335 1335 atomic_t num_rsrc_err; 1336 - atomic_t num_cmd_success; 1337 1336 unsigned long last_rsrc_error_time; 1338 1337 unsigned long last_ramp_down_time; 1339 1338 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS ··· 1437 1438 struct timer_list inactive_vmid_poll; 1438 1439 1439 1440 /* RAS Support */ 1441 + spinlock_t ras_fwlog_lock; /* do not take while holding another lock */ 1440 1442 struct lpfc_ras_fwlog ras_fwlog; 1441 1443 1442 1444 uint32_t iocb_cnt;
+2 -2
drivers/scsi/lpfc/lpfc_attr.c
··· 5865 5865 if (phba->cfg_ras_fwlog_func != PCI_FUNC(phba->pcidev->devfn)) 5866 5866 return -EINVAL; 5867 5867 5868 - spin_lock_irq(&phba->hbalock); 5868 + spin_lock_irq(&phba->ras_fwlog_lock); 5869 5869 state = phba->ras_fwlog.state; 5870 - spin_unlock_irq(&phba->hbalock); 5870 + spin_unlock_irq(&phba->ras_fwlog_lock); 5871 5871 5872 5872 if (state == REG_INPROGRESS) { 5873 5873 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, "6147 RAS Logging "
+18 -18
drivers/scsi/lpfc/lpfc_bsg.c
··· 2513 2513 return -ENOMEM; 2514 2514 } 2515 2515 2516 - dmabuff = (struct lpfc_dmabuf *)mbox->ctx_buf; 2516 + dmabuff = mbox->ctx_buf; 2517 2517 mbox->ctx_buf = NULL; 2518 2518 mbox->ctx_ndlp = NULL; 2519 2519 status = lpfc_sli_issue_mbox_wait(phba, mbox, LPFC_MBOX_TMO); ··· 3376 3376 unsigned long flags; 3377 3377 uint8_t *pmb, *pmb_buf; 3378 3378 3379 - dd_data = pmboxq->ctx_ndlp; 3379 + dd_data = pmboxq->ctx_u.dd_data; 3380 3380 3381 3381 /* 3382 3382 * The outgoing buffer is readily referred from the dma buffer, ··· 3553 3553 struct lpfc_sli_config_mbox *sli_cfg_mbx; 3554 3554 uint8_t *pmbx; 3555 3555 3556 - dd_data = pmboxq->ctx_buf; 3556 + dd_data = pmboxq->ctx_u.dd_data; 3557 3557 3558 3558 /* Determine if job has been aborted */ 3559 3559 spin_lock_irqsave(&phba->ct_ev_lock, flags); ··· 3940 3940 pmboxq->mbox_cmpl = lpfc_bsg_issue_read_mbox_ext_cmpl; 3941 3941 3942 3942 /* context fields to callback function */ 3943 - pmboxq->ctx_buf = dd_data; 3943 + pmboxq->ctx_u.dd_data = dd_data; 3944 3944 dd_data->type = TYPE_MBOX; 3945 3945 dd_data->set_job = job; 3946 3946 dd_data->context_un.mbox.pmboxq = pmboxq; ··· 4112 4112 pmboxq->mbox_cmpl = lpfc_bsg_issue_write_mbox_ext_cmpl; 4113 4113 4114 4114 /* context fields to callback function */ 4115 - pmboxq->ctx_buf = dd_data; 4115 + pmboxq->ctx_u.dd_data = dd_data; 4116 4116 dd_data->type = TYPE_MBOX; 4117 4117 dd_data->set_job = job; 4118 4118 dd_data->context_un.mbox.pmboxq = pmboxq; ··· 4460 4460 pmboxq->mbox_cmpl = lpfc_bsg_issue_write_mbox_ext_cmpl; 4461 4461 4462 4462 /* context fields to callback function */ 4463 - pmboxq->ctx_buf = dd_data; 4463 + pmboxq->ctx_u.dd_data = dd_data; 4464 4464 dd_data->type = TYPE_MBOX; 4465 4465 dd_data->set_job = job; 4466 4466 dd_data->context_un.mbox.pmboxq = pmboxq; ··· 4747 4747 if (mbox_req->inExtWLen || mbox_req->outExtWLen) { 4748 4748 from = pmbx; 4749 4749 ext = from + sizeof(MAILBOX_t); 4750 - pmboxq->ctx_buf = ext; 4750 + pmboxq->ext_buf = ext; 4751 4751 pmboxq->in_ext_byte_len = 4752 4752 mbox_req->inExtWLen * sizeof(uint32_t); 4753 4753 pmboxq->out_ext_byte_len = ··· 4875 4875 pmboxq->mbox_cmpl = lpfc_bsg_issue_mbox_cmpl; 4876 4876 4877 4877 /* setup context field to pass wait_queue pointer to wake function */ 4878 - pmboxq->ctx_ndlp = dd_data; 4878 + pmboxq->ctx_u.dd_data = dd_data; 4879 4879 dd_data->type = TYPE_MBOX; 4880 4880 dd_data->set_job = job; 4881 4881 dd_data->context_un.mbox.pmboxq = pmboxq; ··· 5070 5070 bsg_reply->reply_data.vendor_reply.vendor_rsp; 5071 5071 5072 5072 /* Current logging state */ 5073 - spin_lock_irq(&phba->hbalock); 5073 + spin_lock_irq(&phba->ras_fwlog_lock); 5074 5074 if (ras_fwlog->state == ACTIVE) 5075 5075 ras_reply->state = LPFC_RASLOG_STATE_RUNNING; 5076 5076 else 5077 5077 ras_reply->state = LPFC_RASLOG_STATE_STOPPED; 5078 - spin_unlock_irq(&phba->hbalock); 5078 + spin_unlock_irq(&phba->ras_fwlog_lock); 5079 5079 5080 5080 ras_reply->log_level = phba->ras_fwlog.fw_loglevel; 5081 5081 ras_reply->log_buff_sz = phba->cfg_ras_fwlog_buffsize; ··· 5132 5132 5133 5133 if (action == LPFC_RASACTION_STOP_LOGGING) { 5134 5134 /* Check if already disabled */ 5135 - spin_lock_irq(&phba->hbalock); 5135 + spin_lock_irq(&phba->ras_fwlog_lock); 5136 5136 if (ras_fwlog->state != ACTIVE) { 5137 - spin_unlock_irq(&phba->hbalock); 5137 + spin_unlock_irq(&phba->ras_fwlog_lock); 5138 5138 rc = -ESRCH; 5139 5139 goto ras_job_error; 5140 5140 } 5141 - spin_unlock_irq(&phba->hbalock); 5141 + spin_unlock_irq(&phba->ras_fwlog_lock); 5142 5142 5143 5143 /* Disable logging */ 5144 5144 lpfc_ras_stop_fwlog(phba); ··· 5149 5149 * FW-logging with new log-level. Return status 5150 5150 * "Logging already Running" to caller. 5151 5151 **/ 5152 - spin_lock_irq(&phba->hbalock); 5152 + spin_lock_irq(&phba->ras_fwlog_lock); 5153 5153 if (ras_fwlog->state != INACTIVE) 5154 5154 action_status = -EINPROGRESS; 5155 - spin_unlock_irq(&phba->hbalock); 5155 + spin_unlock_irq(&phba->ras_fwlog_lock); 5156 5156 5157 5157 /* Enable logging */ 5158 5158 rc = lpfc_sli4_ras_fwlog_init(phba, log_level, ··· 5268 5268 goto ras_job_error; 5269 5269 5270 5270 /* Logging to be stopped before reading */ 5271 - spin_lock_irq(&phba->hbalock); 5271 + spin_lock_irq(&phba->ras_fwlog_lock); 5272 5272 if (ras_fwlog->state == ACTIVE) { 5273 - spin_unlock_irq(&phba->hbalock); 5273 + spin_unlock_irq(&phba->ras_fwlog_lock); 5274 5274 rc = -EINPROGRESS; 5275 5275 goto ras_job_error; 5276 5276 } 5277 - spin_unlock_irq(&phba->hbalock); 5277 + spin_unlock_irq(&phba->ras_fwlog_lock); 5278 5278 5279 5279 if (job->request_len < 5280 5280 sizeof(struct fc_bsg_request) +
+6 -6
drivers/scsi/lpfc/lpfc_debugfs.c
··· 2194 2194 2195 2195 memset(buffer, 0, size); 2196 2196 2197 - spin_lock_irq(&phba->hbalock); 2197 + spin_lock_irq(&phba->ras_fwlog_lock); 2198 2198 if (phba->ras_fwlog.state != ACTIVE) { 2199 - spin_unlock_irq(&phba->hbalock); 2199 + spin_unlock_irq(&phba->ras_fwlog_lock); 2200 2200 return -EINVAL; 2201 2201 } 2202 - spin_unlock_irq(&phba->hbalock); 2202 + spin_unlock_irq(&phba->ras_fwlog_lock); 2203 2203 2204 2204 list_for_each_entry_safe(dmabuf, next, 2205 2205 &phba->ras_fwlog.fwlog_buff_list, list) { ··· 2250 2250 int size; 2251 2251 int rc = -ENOMEM; 2252 2252 2253 - spin_lock_irq(&phba->hbalock); 2253 + spin_lock_irq(&phba->ras_fwlog_lock); 2254 2254 if (phba->ras_fwlog.state != ACTIVE) { 2255 - spin_unlock_irq(&phba->hbalock); 2255 + spin_unlock_irq(&phba->ras_fwlog_lock); 2256 2256 rc = -EINVAL; 2257 2257 goto out; 2258 2258 } 2259 - spin_unlock_irq(&phba->hbalock); 2259 + spin_unlock_irq(&phba->ras_fwlog_lock); 2260 2260 2261 2261 if (check_mul_overflow(LPFC_RAS_MIN_BUFF_POST_SIZE, 2262 2262 phba->cfg_ras_fwlog_buffsize, &size))
+21 -24
drivers/scsi/lpfc/lpfc_els.c
··· 4437 4437 unsigned long flags; 4438 4438 struct lpfc_work_evt *evtp = &ndlp->els_retry_evt; 4439 4439 4440 + /* Hold a node reference for outstanding queued work */ 4441 + if (!lpfc_nlp_get(ndlp)) 4442 + return; 4443 + 4440 4444 spin_lock_irqsave(&phba->hbalock, flags); 4441 4445 if (!list_empty(&evtp->evt_listp)) { 4442 4446 spin_unlock_irqrestore(&phba->hbalock, flags); 4447 + lpfc_nlp_put(ndlp); 4443 4448 return; 4444 4449 } 4445 4450 4446 - /* We need to hold the node by incrementing the reference 4447 - * count until the queued work is done 4448 - */ 4449 - evtp->evt_arg1 = lpfc_nlp_get(ndlp); 4450 - if (evtp->evt_arg1) { 4451 - evtp->evt = LPFC_EVT_ELS_RETRY; 4452 - list_add_tail(&evtp->evt_listp, &phba->work_list); 4453 - lpfc_worker_wake_up(phba); 4454 - } 4451 + evtp->evt_arg1 = ndlp; 4452 + evtp->evt = LPFC_EVT_ELS_RETRY; 4453 + list_add_tail(&evtp->evt_listp, &phba->work_list); 4455 4454 spin_unlock_irqrestore(&phba->hbalock, flags); 4456 - return; 4455 + 4456 + lpfc_worker_wake_up(phba); 4457 4457 } 4458 4458 4459 4459 /** ··· 7238 7238 goto rdp_fail; 7239 7239 mbox->vport = rdp_context->ndlp->vport; 7240 7240 mbox->mbox_cmpl = lpfc_mbx_cmpl_rdp_page_a0; 7241 - mbox->ctx_ndlp = (struct lpfc_rdp_context *)rdp_context; 7241 + mbox->ctx_u.rdp = rdp_context; 7242 7242 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT); 7243 7243 if (rc == MBX_NOT_FINISHED) { 7244 7244 lpfc_mbox_rsrc_cleanup(phba, mbox, MBOX_THD_UNLOCKED); ··· 7290 7290 mbox->in_ext_byte_len = DMP_SFF_PAGE_A0_SIZE; 7291 7291 mbox->out_ext_byte_len = DMP_SFF_PAGE_A0_SIZE; 7292 7292 mbox->mbox_offset_word = 5; 7293 - mbox->ctx_buf = virt; 7293 + mbox->ext_buf = virt; 7294 7294 } else { 7295 7295 bf_set(lpfc_mbx_memory_dump_type3_length, 7296 7296 &mbox->u.mqe.un.mem_dump_type3, DMP_SFF_PAGE_A0_SIZE); ··· 7298 7298 mbox->u.mqe.un.mem_dump_type3.addr_hi = putPaddrHigh(mp->phys); 7299 7299 } 7300 7300 mbox->vport = phba->pport; 7301 - mbox->ctx_ndlp = (struct lpfc_rdp_context *)rdp_context; 7302 7301 7303 7302 rc = lpfc_sli_issue_mbox_wait(phba, mbox, 30); 7304 7303 if (rc == MBX_NOT_FINISHED) { ··· 7306 7307 } 7307 7308 7308 7309 if (phba->sli_rev == LPFC_SLI_REV4) 7309 - mp = (struct lpfc_dmabuf *)(mbox->ctx_buf); 7310 + mp = mbox->ctx_buf; 7310 7311 else 7311 7312 mp = mpsave; 7312 7313 ··· 7349 7350 mbox->in_ext_byte_len = DMP_SFF_PAGE_A2_SIZE; 7350 7351 mbox->out_ext_byte_len = DMP_SFF_PAGE_A2_SIZE; 7351 7352 mbox->mbox_offset_word = 5; 7352 - mbox->ctx_buf = virt; 7353 + mbox->ext_buf = virt; 7353 7354 } else { 7354 7355 bf_set(lpfc_mbx_memory_dump_type3_length, 7355 7356 &mbox->u.mqe.un.mem_dump_type3, DMP_SFF_PAGE_A2_SIZE); ··· 7357 7358 mbox->u.mqe.un.mem_dump_type3.addr_hi = putPaddrHigh(mp->phys); 7358 7359 } 7359 7360 7360 - mbox->ctx_ndlp = (struct lpfc_rdp_context *)rdp_context; 7361 7361 rc = lpfc_sli_issue_mbox_wait(phba, mbox, 30); 7362 7362 if (bf_get(lpfc_mqe_status, &mbox->u.mqe)) { 7363 7363 rc = 1; ··· 7498 7500 int rc; 7499 7501 7500 7502 mb = &pmb->u.mb; 7501 - lcb_context = (struct lpfc_lcb_context *)pmb->ctx_ndlp; 7503 + lcb_context = pmb->ctx_u.lcb; 7502 7504 ndlp = lcb_context->ndlp; 7503 - pmb->ctx_ndlp = NULL; 7505 + memset(&pmb->ctx_u, 0, sizeof(pmb->ctx_u)); 7504 7506 pmb->ctx_buf = NULL; 7505 7507 7506 7508 shdr = (union lpfc_sli4_cfg_shdr *) ··· 7640 7642 lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON, 7641 7643 LPFC_MBOX_OPCODE_SET_BEACON_CONFIG, len, 7642 7644 LPFC_SLI4_MBX_EMBED); 7643 - mbox->ctx_ndlp = (void *)lcb_context; 7645 + mbox->ctx_u.lcb = lcb_context; 7644 7646 mbox->vport = phba->pport; 7645 7647 mbox->mbox_cmpl = lpfc_els_lcb_rsp; 7646 7648 bf_set(lpfc_mbx_set_beacon_port_num, &mbox->u.mqe.un.beacon_config, ··· 8637 8639 mb = &pmb->u.mb; 8638 8640 8639 8641 ndlp = pmb->ctx_ndlp; 8640 - rxid = (uint16_t)((unsigned long)(pmb->ctx_buf) & 0xffff); 8641 - oxid = (uint16_t)(((unsigned long)(pmb->ctx_buf) >> 16) & 0xffff); 8642 - pmb->ctx_buf = NULL; 8642 + rxid = (uint16_t)(pmb->ctx_u.ox_rx_id & 0xffff); 8643 + oxid = (uint16_t)((pmb->ctx_u.ox_rx_id >> 16) & 0xffff); 8644 + memset(&pmb->ctx_u, 0, sizeof(pmb->ctx_u)); 8643 8645 pmb->ctx_ndlp = NULL; 8644 8646 8645 8647 if (mb->mbxStatus) { ··· 8743 8745 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_ATOMIC); 8744 8746 if (mbox) { 8745 8747 lpfc_read_lnk_stat(phba, mbox); 8746 - mbox->ctx_buf = (void *)((unsigned long) 8747 - (ox_id << 16 | ctx)); 8748 + mbox->ctx_u.ox_rx_id = ox_id << 16 | ctx; 8748 8749 mbox->ctx_ndlp = lpfc_nlp_get(ndlp); 8749 8750 if (!mbox->ctx_ndlp) 8750 8751 goto node_err;
+16 -17
drivers/scsi/lpfc/lpfc_hbadisc.c
··· 257 257 if (evtp->evt_arg1) { 258 258 evtp->evt = LPFC_EVT_DEV_LOSS; 259 259 list_add_tail(&evtp->evt_listp, &phba->work_list); 260 + spin_unlock_irqrestore(&phba->hbalock, iflags); 260 261 lpfc_worker_wake_up(phba); 262 + return; 261 263 } 262 264 spin_unlock_irqrestore(&phba->hbalock, iflags); 263 265 } else { ··· 277 275 lpfc_disc_state_machine(vport, ndlp, NULL, 278 276 NLP_EVT_DEVICE_RM); 279 277 } 280 - 281 278 } 282 - 283 - return; 284 279 } 285 280 286 281 /** ··· 3428 3429 lpfc_mbx_cmpl_read_sparam(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) 3429 3430 { 3430 3431 MAILBOX_t *mb = &pmb->u.mb; 3431 - struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *)pmb->ctx_buf; 3432 + struct lpfc_dmabuf *mp = pmb->ctx_buf; 3432 3433 struct lpfc_vport *vport = pmb->vport; 3433 3434 struct Scsi_Host *shost = lpfc_shost_from_vport(vport); 3434 3435 struct serv_parm *sp = &vport->fc_sparam; ··· 3736 3737 struct lpfc_mbx_read_top *la; 3737 3738 struct lpfc_sli_ring *pring; 3738 3739 MAILBOX_t *mb = &pmb->u.mb; 3739 - struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *)(pmb->ctx_buf); 3740 + struct lpfc_dmabuf *mp = pmb->ctx_buf; 3740 3741 uint8_t attn_type; 3741 3742 3742 3743 /* Unblock ELS traffic */ ··· 3850 3851 lpfc_mbx_cmpl_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) 3851 3852 { 3852 3853 struct lpfc_vport *vport = pmb->vport; 3853 - struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *)pmb->ctx_buf; 3854 - struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; 3854 + struct lpfc_dmabuf *mp = pmb->ctx_buf; 3855 + struct lpfc_nodelist *ndlp = pmb->ctx_ndlp; 3855 3856 3856 3857 /* The driver calls the state machine with the pmb pointer 3857 3858 * but wants to make sure a stale ctx_buf isn't acted on. ··· 4065 4066 * the dump routine is a single-use construct. 4066 4067 */ 4067 4068 if (pmb->ctx_buf) { 4068 - mp = (struct lpfc_dmabuf *)pmb->ctx_buf; 4069 + mp = pmb->ctx_buf; 4069 4070 lpfc_mbuf_free(phba, mp->virt, mp->phys); 4070 4071 kfree(mp); 4071 4072 pmb->ctx_buf = NULL; ··· 4088 4089 4089 4090 if (phba->sli_rev == LPFC_SLI_REV4) { 4090 4091 byte_count = pmb->u.mqe.un.mb_words[5]; 4091 - mp = (struct lpfc_dmabuf *)pmb->ctx_buf; 4092 + mp = pmb->ctx_buf; 4092 4093 if (byte_count > sizeof(struct static_vport_info) - 4093 4094 offset) 4094 4095 byte_count = sizeof(struct static_vport_info) ··· 4168 4169 { 4169 4170 struct lpfc_vport *vport = pmb->vport; 4170 4171 MAILBOX_t *mb = &pmb->u.mb; 4171 - struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; 4172 + struct lpfc_nodelist *ndlp = pmb->ctx_ndlp; 4172 4173 4173 4174 pmb->ctx_ndlp = NULL; 4174 4175 ··· 4306 4307 lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) 4307 4308 { 4308 4309 MAILBOX_t *mb = &pmb->u.mb; 4309 - struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; 4310 + struct lpfc_nodelist *ndlp = pmb->ctx_ndlp; 4310 4311 struct lpfc_vport *vport = pmb->vport; 4311 4312 int rc; 4312 4313 ··· 4430 4431 { 4431 4432 struct lpfc_vport *vport = pmb->vport; 4432 4433 MAILBOX_t *mb = &pmb->u.mb; 4433 - struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; 4434 + struct lpfc_nodelist *ndlp = pmb->ctx_ndlp; 4434 4435 4435 4436 pmb->ctx_ndlp = NULL; 4436 4437 if (mb->mbxStatus) { ··· 5173 5174 struct lpfc_vport *vport = pmb->vport; 5174 5175 struct lpfc_nodelist *ndlp; 5175 5176 5176 - ndlp = (struct lpfc_nodelist *)(pmb->ctx_ndlp); 5177 + ndlp = pmb->ctx_ndlp; 5177 5178 if (!ndlp) 5178 5179 return; 5179 5180 lpfc_issue_els_logo(vport, ndlp, 0); ··· 5495 5496 if ((mb = phba->sli.mbox_active)) { 5496 5497 if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) && 5497 5498 !(mb->mbox_flag & LPFC_MBX_IMED_UNREG) && 5498 - (ndlp == (struct lpfc_nodelist *)mb->ctx_ndlp)) { 5499 + (ndlp == mb->ctx_ndlp)) { 5499 5500 mb->ctx_ndlp = NULL; 5500 5501 mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; 5501 5502 } ··· 5506 5507 list_for_each_entry(mb, &phba->sli.mboxq_cmpl, list) { 5507 5508 if ((mb->u.mb.mbxCommand != MBX_REG_LOGIN64) || 5508 5509 (mb->mbox_flag & LPFC_MBX_IMED_UNREG) || 5509 - (ndlp != (struct lpfc_nodelist *)mb->ctx_ndlp)) 5510 + (ndlp != mb->ctx_ndlp)) 5510 5511 continue; 5511 5512 5512 5513 mb->ctx_ndlp = NULL; ··· 5516 5517 list_for_each_entry_safe(mb, nextmb, &phba->sli.mboxq, list) { 5517 5518 if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) && 5518 5519 !(mb->mbox_flag & LPFC_MBX_IMED_UNREG) && 5519 - (ndlp == (struct lpfc_nodelist *)mb->ctx_ndlp)) { 5520 + (ndlp == mb->ctx_ndlp)) { 5520 5521 list_del(&mb->list); 5521 5522 lpfc_mbox_rsrc_cleanup(phba, mb, MBOX_THD_LOCKED); 5522 5523 ··· 6356 6357 lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) 6357 6358 { 6358 6359 MAILBOX_t *mb = &pmb->u.mb; 6359 - struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; 6360 + struct lpfc_nodelist *ndlp = pmb->ctx_ndlp; 6360 6361 struct lpfc_vport *vport = pmb->vport; 6361 6362 6362 6363 pmb->ctx_ndlp = NULL;
+8 -5
drivers/scsi/lpfc/lpfc_init.c
··· 460 460 return -EIO; 461 461 } 462 462 463 - mp = (struct lpfc_dmabuf *)pmb->ctx_buf; 463 + mp = pmb->ctx_buf; 464 464 465 465 /* This dmabuf was allocated by lpfc_read_sparam. The dmabuf is no 466 466 * longer needed. Prevent unintended ctx_buf access as the mbox is ··· 2217 2217 /* Cleanup any outstanding ELS commands */ 2218 2218 lpfc_els_flush_all_cmd(phba); 2219 2219 psli->slistat.link_event++; 2220 - lpfc_read_topology(phba, pmb, (struct lpfc_dmabuf *)pmb->ctx_buf); 2220 + lpfc_read_topology(phba, pmb, pmb->ctx_buf); 2221 2221 pmb->mbox_cmpl = lpfc_mbx_cmpl_read_topology; 2222 2222 pmb->vport = vport; 2223 2223 /* Block ELS IOCBs until we have processed this mbox command */ ··· 5454 5454 phba->sli.slistat.link_event++; 5455 5455 5456 5456 /* Create lpfc_handle_latt mailbox command from link ACQE */ 5457 - lpfc_read_topology(phba, pmb, (struct lpfc_dmabuf *)pmb->ctx_buf); 5457 + lpfc_read_topology(phba, pmb, pmb->ctx_buf); 5458 5458 pmb->mbox_cmpl = lpfc_mbx_cmpl_read_topology; 5459 5459 pmb->vport = phba->pport; 5460 5460 ··· 6347 6347 phba->sli.slistat.link_event++; 6348 6348 6349 6349 /* Create lpfc_handle_latt mailbox command from link ACQE */ 6350 - lpfc_read_topology(phba, pmb, (struct lpfc_dmabuf *)pmb->ctx_buf); 6350 + lpfc_read_topology(phba, pmb, pmb->ctx_buf); 6351 6351 pmb->mbox_cmpl = lpfc_mbx_cmpl_read_topology; 6352 6352 pmb->vport = phba->pport; 6353 6353 ··· 7704 7704 ((phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) ? 7705 7705 "NVME" : " "), 7706 7706 (phba->nvmet_support ? "NVMET" : " ")); 7707 + 7708 + /* ras_fwlog state */ 7709 + spin_lock_init(&phba->ras_fwlog_lock); 7707 7710 7708 7711 /* Initialize the IO buffer list used by driver for SLI3 SCSI */ 7709 7712 spin_lock_init(&phba->scsi_buf_list_get_lock); ··· 13058 13055 rc = request_threaded_irq(eqhdl->irq, 13059 13056 &lpfc_sli4_hba_intr_handler, 13060 13057 &lpfc_sli4_hba_intr_handler_th, 13061 - IRQF_ONESHOT, name, eqhdl); 13058 + 0, name, eqhdl); 13062 13059 if (rc) { 13063 13060 lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, 13064 13061 "0486 MSI-X fast-path (%d) "
+10 -20
drivers/scsi/lpfc/lpfc_mbox.c
··· 102 102 { 103 103 struct lpfc_dmabuf *mp; 104 104 105 - mp = (struct lpfc_dmabuf *)mbox->ctx_buf; 105 + mp = mbox->ctx_buf; 106 106 mbox->ctx_buf = NULL; 107 107 108 108 /* Release the generic BPL buffer memory. */ ··· 204 204 uint16_t region_id) 205 205 { 206 206 MAILBOX_t *mb; 207 - void *ctx; 208 207 209 208 mb = &pmb->u.mb; 210 - ctx = pmb->ctx_buf; 211 209 212 210 /* Setup to dump VPD region */ 213 211 memset(pmb, 0, sizeof (LPFC_MBOXQ_t)); ··· 217 219 mb->un.varDmp.word_cnt = (DMP_RSP_SIZE / sizeof (uint32_t)); 218 220 mb->un.varDmp.co = 0; 219 221 mb->un.varDmp.resp_offset = 0; 220 - pmb->ctx_buf = ctx; 221 222 mb->mbxOwner = OWN_HOST; 222 223 return; 223 224 } ··· 233 236 lpfc_dump_wakeup_param(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) 234 237 { 235 238 MAILBOX_t *mb; 236 - void *ctx; 237 239 238 240 mb = &pmb->u.mb; 239 - /* Save context so that we can restore after memset */ 240 - ctx = pmb->ctx_buf; 241 241 242 242 /* Setup to dump VPD region */ 243 243 memset(pmb, 0, sizeof(LPFC_MBOXQ_t)); ··· 248 254 mb->un.varDmp.word_cnt = WAKE_UP_PARMS_WORD_SIZE; 249 255 mb->un.varDmp.co = 0; 250 256 mb->un.varDmp.resp_offset = 0; 251 - pmb->ctx_buf = ctx; 252 257 return; 253 258 } 254 259 ··· 365 372 /* Save address for later completion and set the owner to host so that 366 373 * the FW knows this mailbox is available for processing. 367 374 */ 368 - pmb->ctx_buf = (uint8_t *)mp; 375 + pmb->ctx_buf = mp; 369 376 mb->mbxOwner = OWN_HOST; 370 377 return (0); 371 378 } ··· 1809 1816 } 1810 1817 /* Reinitialize the context pointers to avoid stale usage. */ 1811 1818 mbox->ctx_buf = NULL; 1812 - mbox->context3 = NULL; 1819 + memset(&mbox->ctx_u, 0, sizeof(mbox->ctx_u)); 1813 1820 kfree(mbox->sge_array); 1814 1821 /* Finally, free the mailbox command itself */ 1815 1822 mempool_free(mbox, phba->mbox_mem_pool); ··· 2359 2366 { 2360 2367 MAILBOX_t *mb; 2361 2368 int rc = FAILURE; 2362 - struct lpfc_rdp_context *rdp_context = 2363 - (struct lpfc_rdp_context *)(mboxq->ctx_ndlp); 2369 + struct lpfc_rdp_context *rdp_context = mboxq->ctx_u.rdp; 2364 2370 2365 2371 mb = &mboxq->u.mb; 2366 2372 if (mb->mbxStatus) ··· 2377 2385 static void 2378 2386 lpfc_mbx_cmpl_rdp_page_a2(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox) 2379 2387 { 2380 - struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *)mbox->ctx_buf; 2381 - struct lpfc_rdp_context *rdp_context = 2382 - (struct lpfc_rdp_context *)(mbox->ctx_ndlp); 2388 + struct lpfc_dmabuf *mp = mbox->ctx_buf; 2389 + struct lpfc_rdp_context *rdp_context = mbox->ctx_u.rdp; 2383 2390 2384 2391 if (bf_get(lpfc_mqe_status, &mbox->u.mqe)) 2385 2392 goto error_mbox_free; ··· 2392 2401 /* Save the dma buffer for cleanup in the final completion. */ 2393 2402 mbox->ctx_buf = mp; 2394 2403 mbox->mbox_cmpl = lpfc_mbx_cmpl_rdp_link_stat; 2395 - mbox->ctx_ndlp = (struct lpfc_rdp_context *)rdp_context; 2404 + mbox->ctx_u.rdp = rdp_context; 2396 2405 if (lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT) == MBX_NOT_FINISHED) 2397 2406 goto error_mbox_free; 2398 2407 ··· 2407 2416 lpfc_mbx_cmpl_rdp_page_a0(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox) 2408 2417 { 2409 2418 int rc; 2410 - struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *)(mbox->ctx_buf); 2411 - struct lpfc_rdp_context *rdp_context = 2412 - (struct lpfc_rdp_context *)(mbox->ctx_ndlp); 2419 + struct lpfc_dmabuf *mp = mbox->ctx_buf; 2420 + struct lpfc_rdp_context *rdp_context = mbox->ctx_u.rdp; 2413 2421 2414 2422 if (bf_get(lpfc_mqe_status, &mbox->u.mqe)) 2415 2423 goto error; ··· 2438 2448 mbox->u.mqe.un.mem_dump_type3.addr_hi = putPaddrHigh(mp->phys); 2439 2449 2440 2450 mbox->mbox_cmpl = lpfc_mbx_cmpl_rdp_page_a2; 2441 - mbox->ctx_ndlp = (struct lpfc_rdp_context *)rdp_context; 2451 + mbox->ctx_u.rdp = rdp_context; 2442 2452 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT); 2443 2453 if (rc == MBX_NOT_FINISHED) 2444 2454 goto error;
+6 -6
drivers/scsi/lpfc/lpfc_nportdisc.c
··· 300 300 int rc; 301 301 302 302 ndlp = login_mbox->ctx_ndlp; 303 - save_iocb = login_mbox->context3; 303 + save_iocb = login_mbox->ctx_u.save_iocb; 304 304 305 305 if (mb->mbxStatus == MBX_SUCCESS) { 306 306 /* Now that REG_RPI completed successfully, ··· 640 640 if (!login_mbox->ctx_ndlp) 641 641 goto out; 642 642 643 - login_mbox->context3 = save_iocb; /* For PLOGI ACC */ 643 + login_mbox->ctx_u.save_iocb = save_iocb; /* For PLOGI ACC */ 644 644 645 645 spin_lock_irq(&ndlp->lock); 646 646 ndlp->nlp_flag |= (NLP_ACC_REGLOGIN | NLP_RCV_PLOGI); ··· 682 682 struct lpfc_nodelist *ndlp; 683 683 uint32_t cmd; 684 684 685 - elsiocb = (struct lpfc_iocbq *)mboxq->ctx_buf; 686 - ndlp = (struct lpfc_nodelist *)mboxq->ctx_ndlp; 685 + elsiocb = mboxq->ctx_u.save_iocb; 686 + ndlp = mboxq->ctx_ndlp; 687 687 vport = mboxq->vport; 688 688 cmd = elsiocb->drvrTimeout; 689 689 ··· 1875 1875 /* cleanup any ndlp on mbox q waiting for reglogin cmpl */ 1876 1876 if ((mb = phba->sli.mbox_active)) { 1877 1877 if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) && 1878 - (ndlp == (struct lpfc_nodelist *)mb->ctx_ndlp)) { 1878 + (ndlp == mb->ctx_ndlp)) { 1879 1879 ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND; 1880 1880 lpfc_nlp_put(ndlp); 1881 1881 mb->ctx_ndlp = NULL; ··· 1886 1886 spin_lock_irq(&phba->hbalock); 1887 1887 list_for_each_entry_safe(mb, nextmb, &phba->sli.mboxq, list) { 1888 1888 if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) && 1889 - (ndlp == (struct lpfc_nodelist *)mb->ctx_ndlp)) { 1889 + (ndlp == mb->ctx_ndlp)) { 1890 1890 ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND; 1891 1891 lpfc_nlp_put(ndlp); 1892 1892 list_del(&mb->list);
+2 -2
drivers/scsi/lpfc/lpfc_nvme.c
··· 2616 2616 /* No concern about the role change on the nvme remoteport. 2617 2617 * The transport will update it. 2618 2618 */ 2619 - spin_lock_irq(&vport->phba->hbalock); 2619 + spin_lock_irq(&ndlp->lock); 2620 2620 ndlp->fc4_xpt_flags |= NVME_XPT_UNREG_WAIT; 2621 - spin_unlock_irq(&vport->phba->hbalock); 2621 + spin_unlock_irq(&ndlp->lock); 2622 2622 2623 2623 /* Don't let the host nvme transport keep sending keep-alives 2624 2624 * on this remoteport. Vport is unloading, no recovery. The
+4 -19
drivers/scsi/lpfc/lpfc_scsi.c
··· 167 167 struct Scsi_Host *shost; 168 168 struct scsi_device *sdev; 169 169 unsigned long new_queue_depth; 170 - unsigned long num_rsrc_err, num_cmd_success; 170 + unsigned long num_rsrc_err; 171 171 int i; 172 172 173 173 num_rsrc_err = atomic_read(&phba->num_rsrc_err); 174 - num_cmd_success = atomic_read(&phba->num_cmd_success); 175 174 176 175 /* 177 176 * The error and success command counters are global per ··· 185 186 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { 186 187 shost = lpfc_shost_from_vport(vports[i]); 187 188 shost_for_each_device(sdev, shost) { 188 - new_queue_depth = 189 - sdev->queue_depth * num_rsrc_err / 190 - (num_rsrc_err + num_cmd_success); 191 - if (!new_queue_depth) 192 - new_queue_depth = sdev->queue_depth - 1; 189 + if (num_rsrc_err >= sdev->queue_depth) 190 + new_queue_depth = 1; 193 191 else 194 192 new_queue_depth = sdev->queue_depth - 195 - new_queue_depth; 193 + num_rsrc_err; 196 194 scsi_change_queue_depth(sdev, new_queue_depth); 197 195 } 198 196 } 199 197 lpfc_destroy_vport_work_array(phba, vports); 200 198 atomic_set(&phba->num_rsrc_err, 0); 201 - atomic_set(&phba->num_cmd_success, 0); 202 199 } 203 200 204 201 /** ··· 5331 5336 } 5332 5337 err = lpfc_bg_scsi_prep_dma_buf(phba, lpfc_cmd); 5333 5338 } else { 5334 - if (vport->phba->cfg_enable_bg) { 5335 - lpfc_printf_vlog(vport, 5336 - KERN_INFO, LOG_SCSI_CMD, 5337 - "9038 BLKGRD: rcvd PROT_NORMAL cmd: " 5338 - "x%x reftag x%x cnt %u pt %x\n", 5339 - cmnd->cmnd[0], 5340 - scsi_prot_ref_tag(cmnd), 5341 - scsi_logical_block_count(cmnd), 5342 - (cmnd->cmnd[1]>>5)); 5343 - } 5344 5339 err = lpfc_scsi_prep_dma_buf(phba, lpfc_cmd); 5345 5340 } 5346 5341
+49 -50
drivers/scsi/lpfc/lpfc_sli.c
··· 1217 1217 empty = list_empty(&phba->active_rrq_list); 1218 1218 list_add_tail(&rrq->list, &phba->active_rrq_list); 1219 1219 phba->hba_flag |= HBA_RRQ_ACTIVE; 1220 + spin_unlock_irqrestore(&phba->hbalock, iflags); 1220 1221 if (empty) 1221 1222 lpfc_worker_wake_up(phba); 1222 - spin_unlock_irqrestore(&phba->hbalock, iflags); 1223 1223 return 0; 1224 1224 out: 1225 1225 spin_unlock_irqrestore(&phba->hbalock, iflags); ··· 2830 2830 */ 2831 2831 pmboxq->mbox_flag |= LPFC_MBX_WAKE; 2832 2832 spin_lock_irqsave(&phba->hbalock, drvr_flag); 2833 - pmbox_done = (struct completion *)pmboxq->context3; 2833 + pmbox_done = pmboxq->ctx_u.mbox_wait; 2834 2834 if (pmbox_done) 2835 2835 complete(pmbox_done); 2836 2836 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); ··· 2885 2885 if (!test_bit(FC_UNLOADING, &phba->pport->load_flag) && 2886 2886 pmb->u.mb.mbxCommand == MBX_REG_LOGIN64 && 2887 2887 !pmb->u.mb.mbxStatus) { 2888 - mp = (struct lpfc_dmabuf *)pmb->ctx_buf; 2888 + mp = pmb->ctx_buf; 2889 2889 if (mp) { 2890 2890 pmb->ctx_buf = NULL; 2891 2891 lpfc_mbuf_free(phba, mp->virt, mp->phys); ··· 2914 2914 } 2915 2915 2916 2916 if (pmb->u.mb.mbxCommand == MBX_REG_LOGIN64) { 2917 - ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; 2917 + ndlp = pmb->ctx_ndlp; 2918 2918 lpfc_nlp_put(ndlp); 2919 2919 } 2920 2920 2921 2921 if (pmb->u.mb.mbxCommand == MBX_UNREG_LOGIN) { 2922 - ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; 2922 + ndlp = pmb->ctx_ndlp; 2923 2923 2924 2924 /* Check to see if there are any deferred events to process */ 2925 2925 if (ndlp) { ··· 2952 2952 2953 2953 /* This nlp_put pairs with lpfc_sli4_resume_rpi */ 2954 2954 if (pmb->u.mb.mbxCommand == MBX_RESUME_RPI) { 2955 - ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; 2955 + ndlp = pmb->ctx_ndlp; 2956 2956 lpfc_nlp_put(ndlp); 2957 2957 } 2958 2958 ··· 5819 5819 goto out_free_mboxq; 5820 5820 } 5821 5821 5822 - mp = (struct lpfc_dmabuf *)mboxq->ctx_buf; 5822 + mp = mboxq->ctx_buf; 5823 5823 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); 5824 5824 5825 5825 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, ··· 6849 6849 { 6850 6850 struct lpfc_ras_fwlog *ras_fwlog = &phba->ras_fwlog; 6851 6851 6852 - spin_lock_irq(&phba->hbalock); 6852 + spin_lock_irq(&phba->ras_fwlog_lock); 6853 6853 ras_fwlog->state = INACTIVE; 6854 - spin_unlock_irq(&phba->hbalock); 6854 + spin_unlock_irq(&phba->ras_fwlog_lock); 6855 6855 6856 6856 /* Disable FW logging to host memory */ 6857 6857 writel(LPFC_CTL_PDEV_CTL_DDL_RAS, ··· 6894 6894 ras_fwlog->lwpd.virt = NULL; 6895 6895 } 6896 6896 6897 - spin_lock_irq(&phba->hbalock); 6897 + spin_lock_irq(&phba->ras_fwlog_lock); 6898 6898 ras_fwlog->state = INACTIVE; 6899 - spin_unlock_irq(&phba->hbalock); 6899 + spin_unlock_irq(&phba->ras_fwlog_lock); 6900 6900 } 6901 6901 6902 6902 /** ··· 6998 6998 goto disable_ras; 6999 6999 } 7000 7000 7001 - spin_lock_irq(&phba->hbalock); 7001 + spin_lock_irq(&phba->ras_fwlog_lock); 7002 7002 ras_fwlog->state = ACTIVE; 7003 - spin_unlock_irq(&phba->hbalock); 7003 + spin_unlock_irq(&phba->ras_fwlog_lock); 7004 7004 mempool_free(pmb, phba->mbox_mem_pool); 7005 7005 7006 7006 return; ··· 7032 7032 uint32_t len = 0, fwlog_buffsize, fwlog_entry_count; 7033 7033 int rc = 0; 7034 7034 7035 - spin_lock_irq(&phba->hbalock); 7035 + spin_lock_irq(&phba->ras_fwlog_lock); 7036 7036 ras_fwlog->state = INACTIVE; 7037 - spin_unlock_irq(&phba->hbalock); 7037 + spin_unlock_irq(&phba->ras_fwlog_lock); 7038 7038 7039 7039 fwlog_buffsize = (LPFC_RAS_MIN_BUFF_POST_SIZE * 7040 7040 phba->cfg_ras_fwlog_buffsize); ··· 7095 7095 mbx_fwlog->u.request.lwpd.addr_lo = putPaddrLow(ras_fwlog->lwpd.phys); 7096 7096 mbx_fwlog->u.request.lwpd.addr_hi = putPaddrHigh(ras_fwlog->lwpd.phys); 7097 7097 7098 - spin_lock_irq(&phba->hbalock); 7098 + spin_lock_irq(&phba->ras_fwlog_lock); 7099 7099 ras_fwlog->state = REG_INPROGRESS; 7100 - spin_unlock_irq(&phba->hbalock); 7100 + spin_unlock_irq(&phba->ras_fwlog_lock); 7101 7101 mbox->vport = phba->pport; 7102 7102 mbox->mbox_cmpl = lpfc_sli4_ras_mbox_cmpl; 7103 7103 ··· 8766 8766 8767 8767 mboxq->vport = vport; 8768 8768 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); 8769 - mp = (struct lpfc_dmabuf *)mboxq->ctx_buf; 8769 + mp = mboxq->ctx_buf; 8770 8770 if (rc == MBX_SUCCESS) { 8771 8771 memcpy(&vport->fc_sparam, mp->virt, sizeof(struct serv_parm)); 8772 8772 rc = 0; ··· 9548 9548 } 9549 9549 9550 9550 /* Copy the mailbox extension data */ 9551 - if (pmbox->in_ext_byte_len && pmbox->ctx_buf) { 9552 - lpfc_sli_pcimem_bcopy(pmbox->ctx_buf, 9551 + if (pmbox->in_ext_byte_len && pmbox->ext_buf) { 9552 + lpfc_sli_pcimem_bcopy(pmbox->ext_buf, 9553 9553 (uint8_t *)phba->mbox_ext, 9554 9554 pmbox->in_ext_byte_len); 9555 9555 } ··· 9562 9562 = MAILBOX_HBA_EXT_OFFSET; 9563 9563 9564 9564 /* Copy the mailbox extension data */ 9565 - if (pmbox->in_ext_byte_len && pmbox->ctx_buf) 9565 + if (pmbox->in_ext_byte_len && pmbox->ext_buf) 9566 9566 lpfc_memcpy_to_slim(phba->MBslimaddr + 9567 9567 MAILBOX_HBA_EXT_OFFSET, 9568 - pmbox->ctx_buf, pmbox->in_ext_byte_len); 9568 + pmbox->ext_buf, pmbox->in_ext_byte_len); 9569 9569 9570 9570 if (mbx->mbxCommand == MBX_CONFIG_PORT) 9571 9571 /* copy command data into host mbox for cmpl */ ··· 9688 9688 lpfc_sli_pcimem_bcopy(phba->mbox, mbx, 9689 9689 MAILBOX_CMD_SIZE); 9690 9690 /* Copy the mailbox extension data */ 9691 - if (pmbox->out_ext_byte_len && pmbox->ctx_buf) { 9691 + if (pmbox->out_ext_byte_len && pmbox->ext_buf) { 9692 9692 lpfc_sli_pcimem_bcopy(phba->mbox_ext, 9693 - pmbox->ctx_buf, 9693 + pmbox->ext_buf, 9694 9694 pmbox->out_ext_byte_len); 9695 9695 } 9696 9696 } else { ··· 9698 9698 lpfc_memcpy_from_slim(mbx, phba->MBslimaddr, 9699 9699 MAILBOX_CMD_SIZE); 9700 9700 /* Copy the mailbox extension data */ 9701 - if (pmbox->out_ext_byte_len && pmbox->ctx_buf) { 9701 + if (pmbox->out_ext_byte_len && pmbox->ext_buf) { 9702 9702 lpfc_memcpy_from_slim( 9703 - pmbox->ctx_buf, 9703 + pmbox->ext_buf, 9704 9704 phba->MBslimaddr + 9705 9705 MAILBOX_HBA_EXT_OFFSET, 9706 9706 pmbox->out_ext_byte_len); ··· 11373 11373 unsigned long iflags; 11374 11374 struct lpfc_work_evt *evtp = &ndlp->recovery_evt; 11375 11375 11376 + /* Hold a node reference for outstanding queued work */ 11377 + if (!lpfc_nlp_get(ndlp)) 11378 + return; 11379 + 11376 11380 spin_lock_irqsave(&phba->hbalock, iflags); 11377 11381 if (!list_empty(&evtp->evt_listp)) { 11378 11382 spin_unlock_irqrestore(&phba->hbalock, iflags); 11383 + lpfc_nlp_put(ndlp); 11379 11384 return; 11380 11385 } 11381 11386 11382 - /* Incrementing the reference count until the queued work is done. */ 11383 - evtp->evt_arg1 = lpfc_nlp_get(ndlp); 11384 - if (!evtp->evt_arg1) { 11385 - spin_unlock_irqrestore(&phba->hbalock, iflags); 11386 - return; 11387 - } 11387 + evtp->evt_arg1 = ndlp; 11388 11388 evtp->evt = LPFC_EVT_RECOVER_PORT; 11389 11389 list_add_tail(&evtp->evt_listp, &phba->work_list); 11390 11390 spin_unlock_irqrestore(&phba->hbalock, iflags); ··· 13262 13262 /* setup wake call as IOCB callback */ 13263 13263 pmboxq->mbox_cmpl = lpfc_sli_wake_mbox_wait; 13264 13264 13265 - /* setup context3 field to pass wait_queue pointer to wake function */ 13265 + /* setup ctx_u field to pass wait_queue pointer to wake function */ 13266 13266 init_completion(&mbox_done); 13267 - pmboxq->context3 = &mbox_done; 13267 + pmboxq->ctx_u.mbox_wait = &mbox_done; 13268 13268 /* now issue the command */ 13269 13269 retval = lpfc_sli_issue_mbox(phba, pmboxq, MBX_NOWAIT); 13270 13270 if (retval == MBX_BUSY || retval == MBX_SUCCESS) { ··· 13272 13272 msecs_to_jiffies(timeout * 1000)); 13273 13273 13274 13274 spin_lock_irqsave(&phba->hbalock, flag); 13275 - pmboxq->context3 = NULL; 13275 + pmboxq->ctx_u.mbox_wait = NULL; 13276 13276 /* 13277 13277 * if LPFC_MBX_WAKE flag is set the mailbox is completed 13278 13278 * else do not free the resources. ··· 13813 13813 lpfc_sli_pcimem_bcopy(mbox, pmbox, 13814 13814 MAILBOX_CMD_SIZE); 13815 13815 if (pmb->out_ext_byte_len && 13816 - pmb->ctx_buf) 13816 + pmb->ext_buf) 13817 13817 lpfc_sli_pcimem_bcopy( 13818 13818 phba->mbox_ext, 13819 - pmb->ctx_buf, 13819 + pmb->ext_buf, 13820 13820 pmb->out_ext_byte_len); 13821 13821 } 13822 13822 if (pmb->mbox_flag & LPFC_MBX_IMED_UNREG) { ··· 13830 13830 pmbox->un.varWords[0], 0); 13831 13831 13832 13832 if (!pmbox->mbxStatus) { 13833 - mp = (struct lpfc_dmabuf *) 13834 - (pmb->ctx_buf); 13835 - ndlp = (struct lpfc_nodelist *) 13836 - pmb->ctx_ndlp; 13833 + mp = pmb->ctx_buf; 13834 + ndlp = pmb->ctx_ndlp; 13837 13835 13838 13836 /* Reg_LOGIN of dflt RPI was 13839 13837 * successful. new lets get ··· 14338 14340 mcqe_status, 14339 14341 pmbox->un.varWords[0], 0); 14340 14342 if (mcqe_status == MB_CQE_STATUS_SUCCESS) { 14341 - mp = (struct lpfc_dmabuf *)(pmb->ctx_buf); 14342 - ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; 14343 + mp = pmb->ctx_buf; 14344 + ndlp = pmb->ctx_ndlp; 14343 14345 14344 14346 /* Reg_LOGIN of dflt RPI was successful. Mark the 14345 14347 * node as having an UNREG_LOGIN in progress to stop ··· 19821 19823 * lpfc_sli4_resume_rpi - Remove the rpi bitmask region 19822 19824 * @ndlp: pointer to lpfc nodelist data structure. 19823 19825 * @cmpl: completion call-back. 19824 - * @arg: data to load as MBox 'caller buffer information' 19826 + * @iocbq: data to load as mbox ctx_u information 19825 19827 * 19826 19828 * This routine is invoked to remove the memory region that 19827 19829 * provided rpi via a bitmask. 19828 19830 **/ 19829 19831 int 19830 19832 lpfc_sli4_resume_rpi(struct lpfc_nodelist *ndlp, 19831 - void (*cmpl)(struct lpfc_hba *, LPFC_MBOXQ_t *), void *arg) 19833 + void (*cmpl)(struct lpfc_hba *, LPFC_MBOXQ_t *), 19834 + struct lpfc_iocbq *iocbq) 19832 19835 { 19833 19836 LPFC_MBOXQ_t *mboxq; 19834 19837 struct lpfc_hba *phba = ndlp->phba; ··· 19858 19859 lpfc_resume_rpi(mboxq, ndlp); 19859 19860 if (cmpl) { 19860 19861 mboxq->mbox_cmpl = cmpl; 19861 - mboxq->ctx_buf = arg; 19862 + mboxq->ctx_u.save_iocb = iocbq; 19862 19863 } else 19863 19864 mboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl; 19864 19865 mboxq->ctx_ndlp = ndlp; ··· 20675 20676 if (lpfc_sli4_dump_cfg_rg23(phba, mboxq)) 20676 20677 goto out; 20677 20678 mqe = &mboxq->u.mqe; 20678 - mp = (struct lpfc_dmabuf *)mboxq->ctx_buf; 20679 + mp = mboxq->ctx_buf; 20679 20680 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); 20680 20681 if (rc) 20681 20682 goto out; ··· 21034 21035 (mb->u.mb.mbxCommand == MBX_REG_VPI)) 21035 21036 mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; 21036 21037 if (mb->u.mb.mbxCommand == MBX_REG_LOGIN64) { 21037 - act_mbx_ndlp = (struct lpfc_nodelist *)mb->ctx_ndlp; 21038 + act_mbx_ndlp = mb->ctx_ndlp; 21038 21039 21039 21040 /* This reference is local to this routine. The 21040 21041 * reference is removed at routine exit. ··· 21063 21064 21064 21065 mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; 21065 21066 if (mb->u.mb.mbxCommand == MBX_REG_LOGIN64) { 21066 - ndlp = (struct lpfc_nodelist *)mb->ctx_ndlp; 21067 + ndlp = mb->ctx_ndlp; 21067 21068 /* Unregister the RPI when mailbox complete */ 21068 21069 mb->mbox_flag |= LPFC_MBX_IMED_UNREG; 21069 21070 restart_loop = 1; ··· 21083 21084 while (!list_empty(&mbox_cmd_list)) { 21084 21085 list_remove_head(&mbox_cmd_list, mb, LPFC_MBOXQ_t, list); 21085 21086 if (mb->u.mb.mbxCommand == MBX_REG_LOGIN64) { 21086 - ndlp = (struct lpfc_nodelist *)mb->ctx_ndlp; 21087 + ndlp = mb->ctx_ndlp; 21087 21088 mb->ctx_ndlp = NULL; 21088 21089 if (ndlp) { 21089 21090 spin_lock(&ndlp->lock);
+24 -6
drivers/scsi/lpfc/lpfc_sli.h
··· 1 1 /******************************************************************* 2 2 * This file is part of the Emulex Linux Device Driver for * 3 3 * Fibre Channel Host Bus Adapters. * 4 - * Copyright (C) 2017-2023 Broadcom. All Rights Reserved. The term * 4 + * Copyright (C) 2017-2024 Broadcom. All Rights Reserved. The term * 5 5 * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * 6 6 * Copyright (C) 2004-2016 Emulex. All rights reserved. * 7 7 * EMULEX and SLI are trademarks of Emulex. * ··· 182 182 struct lpfc_mqe mqe; 183 183 } u; 184 184 struct lpfc_vport *vport; /* virtual port pointer */ 185 - void *ctx_ndlp; /* an lpfc_nodelist pointer */ 186 - void *ctx_buf; /* an lpfc_dmabuf pointer */ 187 - void *context3; /* a generic pointer. Code must 188 - * accommodate the actual datatype. 189 - */ 185 + struct lpfc_nodelist *ctx_ndlp; /* caller ndlp pointer */ 186 + struct lpfc_dmabuf *ctx_buf; /* caller buffer information */ 187 + void *ext_buf; /* extended buffer for extended mbox 188 + * cmds. Not a generic pointer. 189 + * Use for storing virtual address. 190 + */ 191 + 192 + /* Pointers that are seldom used during mbox execution, but require 193 + * a saved context. 194 + */ 195 + union { 196 + unsigned long ox_rx_id; /* Used in els_rsp_rls_acc */ 197 + struct lpfc_rdp_context *rdp; /* Used in get_rdp_info */ 198 + struct lpfc_lcb_context *lcb; /* Used in set_beacon */ 199 + struct completion *mbox_wait; /* Used in issue_mbox_wait */ 200 + struct bsg_job_data *dd_data; /* Used in bsg_issue_mbox_cmpl 201 + * and 202 + * bsg_issue_mbox_ext_handle_job 203 + */ 204 + struct lpfc_iocbq *save_iocb; /* Used in defer_plogi_acc and 205 + * lpfc_mbx_cmpl_resume_rpi 206 + */ 207 + } ctx_u; 190 208 191 209 void (*mbox_cmpl) (struct lpfc_hba *, struct lpfcMboxq *); 192 210 uint8_t mbox_flag;
+4 -3
drivers/scsi/lpfc/lpfc_sli4.h
··· 1 1 /******************************************************************* 2 2 * This file is part of the Emulex Linux Device Driver for * 3 3 * Fibre Channel Host Bus Adapters. * 4 - * Copyright (C) 2017-2023 Broadcom. All Rights Reserved. The term * 4 + * Copyright (C) 2017-2024 Broadcom. All Rights Reserved. The term * 5 5 * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * 6 6 * Copyright (C) 2009-2016 Emulex. All rights reserved. * 7 7 * EMULEX and SLI are trademarks of Emulex. * ··· 1118 1118 void lpfc_sli4_remove_rpis(struct lpfc_hba *); 1119 1119 void lpfc_sli4_async_event_proc(struct lpfc_hba *); 1120 1120 void lpfc_sli4_fcf_redisc_event_proc(struct lpfc_hba *); 1121 - int lpfc_sli4_resume_rpi(struct lpfc_nodelist *, 1122 - void (*)(struct lpfc_hba *, LPFC_MBOXQ_t *), void *); 1121 + int lpfc_sli4_resume_rpi(struct lpfc_nodelist *ndlp, 1122 + void (*cmpl)(struct lpfc_hba *, LPFC_MBOXQ_t *), 1123 + struct lpfc_iocbq *iocbq); 1123 1124 void lpfc_sli4_els_xri_abort_event_proc(struct lpfc_hba *phba); 1124 1125 void lpfc_sli4_nvme_pci_offline_aborted(struct lpfc_hba *phba, 1125 1126 struct lpfc_io_buf *lpfc_ncmd);
+1 -1
drivers/scsi/lpfc/lpfc_version.h
··· 20 20 * included with this package. * 21 21 *******************************************************************/ 22 22 23 - #define LPFC_DRIVER_VERSION "14.4.0.0" 23 + #define LPFC_DRIVER_VERSION "14.4.0.1" 24 24 #define LPFC_DRIVER_NAME "lpfc" 25 25 26 26 /* Used for SLI 2/3 */
+5 -5
drivers/scsi/lpfc/lpfc_vport.c
··· 166 166 } 167 167 } 168 168 169 - mp = (struct lpfc_dmabuf *)pmb->ctx_buf; 169 + mp = pmb->ctx_buf; 170 170 memcpy(&vport->fc_sparam, mp->virt, sizeof (struct serv_parm)); 171 171 memcpy(&vport->fc_nodename, &vport->fc_sparam.nodeName, 172 172 sizeof (struct lpfc_name)); ··· 674 674 lpfc_free_sysfs_attr(vport); 675 675 lpfc_debugfs_terminate(vport); 676 676 677 - /* Remove FC host to break driver binding. */ 678 - fc_remove_host(shost); 679 - scsi_remove_host(shost); 680 - 681 677 /* Send the DA_ID and Fabric LOGO to cleanup Nameserver entries. */ 682 678 ndlp = lpfc_findnode_did(vport, Fabric_DID); 683 679 if (!ndlp) ··· 716 720 lpfc_discovery_wait(vport); 717 721 718 722 skip_logo: 723 + 724 + /* Remove FC host to break driver binding. */ 725 + fc_remove_host(shost); 726 + scsi_remove_host(shost); 719 727 720 728 lpfc_cleanup(vport); 721 729