Skip to content

Commit 52d8210

Browse files
Merge patch series "Update lpfc to revision 14.4.0.1"
Justin Tee <[email protected]> says: Update lpfc to revision 14.4.0.1 This patch set contains updates to log messaging, bug fixes related to unregistration, interrupt handling, resource recovery, and clean up patches regarding the abuse of hbalock and void pointers in the driver. The patches were cut against Martin's 6.9/scsi-queue tree. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2 parents 48c0b76 + 0fa215e commit 52d8210

16 files changed

+177
-185
lines changed

drivers/scsi/lpfc/lpfc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,6 @@ struct lpfc_hba {
13331333
struct timer_list fabric_block_timer;
13341334
unsigned long bit_flags;
13351335
atomic_t num_rsrc_err;
1336-
atomic_t num_cmd_success;
13371336
unsigned long last_rsrc_error_time;
13381337
unsigned long last_ramp_down_time;
13391338
#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
@@ -1438,6 +1437,7 @@ struct lpfc_hba {
14381437
struct timer_list inactive_vmid_poll;
14391438

14401439
/* RAS Support */
1440+
spinlock_t ras_fwlog_lock; /* do not take while holding another lock */
14411441
struct lpfc_ras_fwlog ras_fwlog;
14421442

14431443
uint32_t iocb_cnt;

drivers/scsi/lpfc/lpfc_attr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5865,9 +5865,9 @@ lpfc_ras_fwlog_buffsize_set(struct lpfc_hba *phba, uint val)
58655865
if (phba->cfg_ras_fwlog_func != PCI_FUNC(phba->pcidev->devfn))
58665866
return -EINVAL;
58675867

5868-
spin_lock_irq(&phba->hbalock);
5868+
spin_lock_irq(&phba->ras_fwlog_lock);
58695869
state = phba->ras_fwlog.state;
5870-
spin_unlock_irq(&phba->hbalock);
5870+
spin_unlock_irq(&phba->ras_fwlog_lock);
58715871

58725872
if (state == REG_INPROGRESS) {
58735873
lpfc_printf_log(phba, KERN_ERR, LOG_SLI, "6147 RAS Logging "

drivers/scsi/lpfc/lpfc_bsg.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2513,7 +2513,7 @@ static int lpfcdiag_loop_self_reg(struct lpfc_hba *phba, uint16_t *rpi)
25132513
return -ENOMEM;
25142514
}
25152515

2516-
dmabuff = (struct lpfc_dmabuf *)mbox->ctx_buf;
2516+
dmabuff = mbox->ctx_buf;
25172517
mbox->ctx_buf = NULL;
25182518
mbox->ctx_ndlp = NULL;
25192519
status = lpfc_sli_issue_mbox_wait(phba, mbox, LPFC_MBOX_TMO);
@@ -3376,7 +3376,7 @@ lpfc_bsg_issue_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
33763376
unsigned long flags;
33773377
uint8_t *pmb, *pmb_buf;
33783378

3379-
dd_data = pmboxq->ctx_ndlp;
3379+
dd_data = pmboxq->ctx_u.dd_data;
33803380

33813381
/*
33823382
* The outgoing buffer is readily referred from the dma buffer,
@@ -3553,7 +3553,7 @@ lpfc_bsg_issue_mbox_ext_handle_job(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
35533553
struct lpfc_sli_config_mbox *sli_cfg_mbx;
35543554
uint8_t *pmbx;
35553555

3556-
dd_data = pmboxq->ctx_buf;
3556+
dd_data = pmboxq->ctx_u.dd_data;
35573557

35583558
/* Determine if job has been aborted */
35593559
spin_lock_irqsave(&phba->ct_ev_lock, flags);
@@ -3940,7 +3940,7 @@ lpfc_bsg_sli_cfg_read_cmd_ext(struct lpfc_hba *phba, struct bsg_job *job,
39403940
pmboxq->mbox_cmpl = lpfc_bsg_issue_read_mbox_ext_cmpl;
39413941

39423942
/* context fields to callback function */
3943-
pmboxq->ctx_buf = dd_data;
3943+
pmboxq->ctx_u.dd_data = dd_data;
39443944
dd_data->type = TYPE_MBOX;
39453945
dd_data->set_job = job;
39463946
dd_data->context_un.mbox.pmboxq = pmboxq;
@@ -4112,7 +4112,7 @@ lpfc_bsg_sli_cfg_write_cmd_ext(struct lpfc_hba *phba, struct bsg_job *job,
41124112
pmboxq->mbox_cmpl = lpfc_bsg_issue_write_mbox_ext_cmpl;
41134113

41144114
/* context fields to callback function */
4115-
pmboxq->ctx_buf = dd_data;
4115+
pmboxq->ctx_u.dd_data = dd_data;
41164116
dd_data->type = TYPE_MBOX;
41174117
dd_data->set_job = job;
41184118
dd_data->context_un.mbox.pmboxq = pmboxq;
@@ -4460,7 +4460,7 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct bsg_job *job,
44604460
pmboxq->mbox_cmpl = lpfc_bsg_issue_write_mbox_ext_cmpl;
44614461

44624462
/* context fields to callback function */
4463-
pmboxq->ctx_buf = dd_data;
4463+
pmboxq->ctx_u.dd_data = dd_data;
44644464
dd_data->type = TYPE_MBOX;
44654465
dd_data->set_job = job;
44664466
dd_data->context_un.mbox.pmboxq = pmboxq;
@@ -4747,7 +4747,7 @@ lpfc_bsg_issue_mbox(struct lpfc_hba *phba, struct bsg_job *job,
47474747
if (mbox_req->inExtWLen || mbox_req->outExtWLen) {
47484748
from = pmbx;
47494749
ext = from + sizeof(MAILBOX_t);
4750-
pmboxq->ctx_buf = ext;
4750+
pmboxq->ext_buf = ext;
47514751
pmboxq->in_ext_byte_len =
47524752
mbox_req->inExtWLen * sizeof(uint32_t);
47534753
pmboxq->out_ext_byte_len =
@@ -4875,7 +4875,7 @@ lpfc_bsg_issue_mbox(struct lpfc_hba *phba, struct bsg_job *job,
48754875
pmboxq->mbox_cmpl = lpfc_bsg_issue_mbox_cmpl;
48764876

48774877
/* 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;
48794879
dd_data->type = TYPE_MBOX;
48804880
dd_data->set_job = job;
48814881
dd_data->context_un.mbox.pmboxq = pmboxq;
@@ -5070,12 +5070,12 @@ lpfc_bsg_get_ras_config(struct bsg_job *job)
50705070
bsg_reply->reply_data.vendor_reply.vendor_rsp;
50715071

50725072
/* Current logging state */
5073-
spin_lock_irq(&phba->hbalock);
5073+
spin_lock_irq(&phba->ras_fwlog_lock);
50745074
if (ras_fwlog->state == ACTIVE)
50755075
ras_reply->state = LPFC_RASLOG_STATE_RUNNING;
50765076
else
50775077
ras_reply->state = LPFC_RASLOG_STATE_STOPPED;
5078-
spin_unlock_irq(&phba->hbalock);
5078+
spin_unlock_irq(&phba->ras_fwlog_lock);
50795079

50805080
ras_reply->log_level = phba->ras_fwlog.fw_loglevel;
50815081
ras_reply->log_buff_sz = phba->cfg_ras_fwlog_buffsize;
@@ -5132,13 +5132,13 @@ lpfc_bsg_set_ras_config(struct bsg_job *job)
51325132

51335133
if (action == LPFC_RASACTION_STOP_LOGGING) {
51345134
/* Check if already disabled */
5135-
spin_lock_irq(&phba->hbalock);
5135+
spin_lock_irq(&phba->ras_fwlog_lock);
51365136
if (ras_fwlog->state != ACTIVE) {
5137-
spin_unlock_irq(&phba->hbalock);
5137+
spin_unlock_irq(&phba->ras_fwlog_lock);
51385138
rc = -ESRCH;
51395139
goto ras_job_error;
51405140
}
5141-
spin_unlock_irq(&phba->hbalock);
5141+
spin_unlock_irq(&phba->ras_fwlog_lock);
51425142

51435143
/* Disable logging */
51445144
lpfc_ras_stop_fwlog(phba);
@@ -5149,10 +5149,10 @@ lpfc_bsg_set_ras_config(struct bsg_job *job)
51495149
* FW-logging with new log-level. Return status
51505150
* "Logging already Running" to caller.
51515151
**/
5152-
spin_lock_irq(&phba->hbalock);
5152+
spin_lock_irq(&phba->ras_fwlog_lock);
51535153
if (ras_fwlog->state != INACTIVE)
51545154
action_status = -EINPROGRESS;
5155-
spin_unlock_irq(&phba->hbalock);
5155+
spin_unlock_irq(&phba->ras_fwlog_lock);
51565156

51575157
/* Enable logging */
51585158
rc = lpfc_sli4_ras_fwlog_init(phba, log_level,
@@ -5268,13 +5268,13 @@ lpfc_bsg_get_ras_fwlog(struct bsg_job *job)
52685268
goto ras_job_error;
52695269

52705270
/* Logging to be stopped before reading */
5271-
spin_lock_irq(&phba->hbalock);
5271+
spin_lock_irq(&phba->ras_fwlog_lock);
52725272
if (ras_fwlog->state == ACTIVE) {
5273-
spin_unlock_irq(&phba->hbalock);
5273+
spin_unlock_irq(&phba->ras_fwlog_lock);
52745274
rc = -EINPROGRESS;
52755275
goto ras_job_error;
52765276
}
5277-
spin_unlock_irq(&phba->hbalock);
5277+
spin_unlock_irq(&phba->ras_fwlog_lock);
52785278

52795279
if (job->request_len <
52805280
sizeof(struct fc_bsg_request) +

drivers/scsi/lpfc/lpfc_debugfs.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2194,12 +2194,12 @@ static int lpfc_debugfs_ras_log_data(struct lpfc_hba *phba,
21942194

21952195
memset(buffer, 0, size);
21962196

2197-
spin_lock_irq(&phba->hbalock);
2197+
spin_lock_irq(&phba->ras_fwlog_lock);
21982198
if (phba->ras_fwlog.state != ACTIVE) {
2199-
spin_unlock_irq(&phba->hbalock);
2199+
spin_unlock_irq(&phba->ras_fwlog_lock);
22002200
return -EINVAL;
22012201
}
2202-
spin_unlock_irq(&phba->hbalock);
2202+
spin_unlock_irq(&phba->ras_fwlog_lock);
22032203

22042204
list_for_each_entry_safe(dmabuf, next,
22052205
&phba->ras_fwlog.fwlog_buff_list, list) {
@@ -2250,13 +2250,13 @@ lpfc_debugfs_ras_log_open(struct inode *inode, struct file *file)
22502250
int size;
22512251
int rc = -ENOMEM;
22522252

2253-
spin_lock_irq(&phba->hbalock);
2253+
spin_lock_irq(&phba->ras_fwlog_lock);
22542254
if (phba->ras_fwlog.state != ACTIVE) {
2255-
spin_unlock_irq(&phba->hbalock);
2255+
spin_unlock_irq(&phba->ras_fwlog_lock);
22562256
rc = -EINVAL;
22572257
goto out;
22582258
}
2259-
spin_unlock_irq(&phba->hbalock);
2259+
spin_unlock_irq(&phba->ras_fwlog_lock);
22602260

22612261
if (check_mul_overflow(LPFC_RAS_MIN_BUFF_POST_SIZE,
22622262
phba->cfg_ras_fwlog_buffsize, &size))

drivers/scsi/lpfc/lpfc_els.c

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4437,23 +4437,23 @@ lpfc_els_retry_delay(struct timer_list *t)
44374437
unsigned long flags;
44384438
struct lpfc_work_evt *evtp = &ndlp->els_retry_evt;
44394439

4440+
/* Hold a node reference for outstanding queued work */
4441+
if (!lpfc_nlp_get(ndlp))
4442+
return;
4443+
44404444
spin_lock_irqsave(&phba->hbalock, flags);
44414445
if (!list_empty(&evtp->evt_listp)) {
44424446
spin_unlock_irqrestore(&phba->hbalock, flags);
4447+
lpfc_nlp_put(ndlp);
44434448
return;
44444449
}
44454450

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);
44554454
spin_unlock_irqrestore(&phba->hbalock, flags);
4456-
return;
4455+
4456+
lpfc_worker_wake_up(phba);
44574457
}
44584458

44594459
/**
@@ -7238,7 +7238,7 @@ lpfc_get_rdp_info(struct lpfc_hba *phba, struct lpfc_rdp_context *rdp_context)
72387238
goto rdp_fail;
72397239
mbox->vport = rdp_context->ndlp->vport;
72407240
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;
72427242
rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT);
72437243
if (rc == MBX_NOT_FINISHED) {
72447244
lpfc_mbox_rsrc_cleanup(phba, mbox, MBOX_THD_UNLOCKED);
@@ -7290,15 +7290,14 @@ int lpfc_get_sfp_info_wait(struct lpfc_hba *phba,
72907290
mbox->in_ext_byte_len = DMP_SFF_PAGE_A0_SIZE;
72917291
mbox->out_ext_byte_len = DMP_SFF_PAGE_A0_SIZE;
72927292
mbox->mbox_offset_word = 5;
7293-
mbox->ctx_buf = virt;
7293+
mbox->ext_buf = virt;
72947294
} else {
72957295
bf_set(lpfc_mbx_memory_dump_type3_length,
72967296
&mbox->u.mqe.un.mem_dump_type3, DMP_SFF_PAGE_A0_SIZE);
72977297
mbox->u.mqe.un.mem_dump_type3.addr_lo = putPaddrLow(mp->phys);
72987298
mbox->u.mqe.un.mem_dump_type3.addr_hi = putPaddrHigh(mp->phys);
72997299
}
73007300
mbox->vport = phba->pport;
7301-
mbox->ctx_ndlp = (struct lpfc_rdp_context *)rdp_context;
73027301

73037302
rc = lpfc_sli_issue_mbox_wait(phba, mbox, 30);
73047303
if (rc == MBX_NOT_FINISHED) {
@@ -7307,7 +7306,7 @@ int lpfc_get_sfp_info_wait(struct lpfc_hba *phba,
73077306
}
73087307

73097308
if (phba->sli_rev == LPFC_SLI_REV4)
7310-
mp = (struct lpfc_dmabuf *)(mbox->ctx_buf);
7309+
mp = mbox->ctx_buf;
73117310
else
73127311
mp = mpsave;
73137312

@@ -7350,15 +7349,14 @@ int lpfc_get_sfp_info_wait(struct lpfc_hba *phba,
73507349
mbox->in_ext_byte_len = DMP_SFF_PAGE_A2_SIZE;
73517350
mbox->out_ext_byte_len = DMP_SFF_PAGE_A2_SIZE;
73527351
mbox->mbox_offset_word = 5;
7353-
mbox->ctx_buf = virt;
7352+
mbox->ext_buf = virt;
73547353
} else {
73557354
bf_set(lpfc_mbx_memory_dump_type3_length,
73567355
&mbox->u.mqe.un.mem_dump_type3, DMP_SFF_PAGE_A2_SIZE);
73577356
mbox->u.mqe.un.mem_dump_type3.addr_lo = putPaddrLow(mp->phys);
73587357
mbox->u.mqe.un.mem_dump_type3.addr_hi = putPaddrHigh(mp->phys);
73597358
}
73607359

7361-
mbox->ctx_ndlp = (struct lpfc_rdp_context *)rdp_context;
73627360
rc = lpfc_sli_issue_mbox_wait(phba, mbox, 30);
73637361
if (bf_get(lpfc_mqe_status, &mbox->u.mqe)) {
73647362
rc = 1;
@@ -7500,9 +7498,9 @@ lpfc_els_lcb_rsp(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
75007498
int rc;
75017499

75027500
mb = &pmb->u.mb;
7503-
lcb_context = (struct lpfc_lcb_context *)pmb->ctx_ndlp;
7501+
lcb_context = pmb->ctx_u.lcb;
75047502
ndlp = lcb_context->ndlp;
7505-
pmb->ctx_ndlp = NULL;
7503+
memset(&pmb->ctx_u, 0, sizeof(pmb->ctx_u));
75067504
pmb->ctx_buf = NULL;
75077505

75087506
shdr = (union lpfc_sli4_cfg_shdr *)
@@ -7642,7 +7640,7 @@ lpfc_sli4_set_beacon(struct lpfc_vport *vport,
76427640
lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON,
76437641
LPFC_MBOX_OPCODE_SET_BEACON_CONFIG, len,
76447642
LPFC_SLI4_MBX_EMBED);
7645-
mbox->ctx_ndlp = (void *)lcb_context;
7643+
mbox->ctx_u.lcb = lcb_context;
76467644
mbox->vport = phba->pport;
76477645
mbox->mbox_cmpl = lpfc_els_lcb_rsp;
76487646
bf_set(lpfc_mbx_set_beacon_port_num, &mbox->u.mqe.un.beacon_config,
@@ -8639,9 +8637,9 @@ lpfc_els_rsp_rls_acc(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
86398637
mb = &pmb->u.mb;
86408638

86418639
ndlp = pmb->ctx_ndlp;
8642-
rxid = (uint16_t)((unsigned long)(pmb->ctx_buf) & 0xffff);
8643-
oxid = (uint16_t)(((unsigned long)(pmb->ctx_buf) >> 16) & 0xffff);
8644-
pmb->ctx_buf = NULL;
8640+
rxid = (uint16_t)(pmb->ctx_u.ox_rx_id & 0xffff);
8641+
oxid = (uint16_t)((pmb->ctx_u.ox_rx_id >> 16) & 0xffff);
8642+
memset(&pmb->ctx_u, 0, sizeof(pmb->ctx_u));
86458643
pmb->ctx_ndlp = NULL;
86468644

86478645
if (mb->mbxStatus) {
@@ -8745,8 +8743,7 @@ lpfc_els_rcv_rls(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
87458743
mbox = mempool_alloc(phba->mbox_mem_pool, GFP_ATOMIC);
87468744
if (mbox) {
87478745
lpfc_read_lnk_stat(phba, mbox);
8748-
mbox->ctx_buf = (void *)((unsigned long)
8749-
(ox_id << 16 | ctx));
8746+
mbox->ctx_u.ox_rx_id = ox_id << 16 | ctx;
87508747
mbox->ctx_ndlp = lpfc_nlp_get(ndlp);
87518748
if (!mbox->ctx_ndlp)
87528749
goto node_err;

0 commit comments

Comments
 (0)