lpfc: Update lpfc to revision 12.8.0.5
Subsystems (3)
cover lpfc: Update lpfc to revision 12.8.0.5
Update lpfc to revision 12.8.0.5
Patches include several small fixes and the addition of a FDMI registration for vendor MIB data.
The patches were cut against Martin's 5.10/scsi-queue tree
James Smart (9):
lpfc: fix invalid sleeping context in lpfc_sli4_nvmet_alloc
lpfc: fix scheduling call while in softirq context in lpfc_unreg_rpi
lpfc: Re-fix use after free in lpfc_rq_buf_free()
lpfc: Removed unused macros in lpfc_attr.c.
lpfc: Fix duplicate wq_create_version check
lpfc: Enlarge max_sectors in scsi templates
lpfc: Add FDMI Vendor MIB support
lpfc: Reject CT request for MIB commands
lpfc: Update lpfc version to 12.8.0.5
drivers/scsi/lpfc/lpfc.h | 6 +- drivers/scsi/lpfc/lpfc_attr.c | 14 +- drivers/scsi/lpfc/lpfc_bsg.c | 21 +- drivers/scsi/lpfc/lpfc_ct.c | 371 +++++++++++++++++++++++++++++-- drivers/scsi/lpfc/lpfc_disc.h | 2 + drivers/scsi/lpfc/lpfc_els.c | 6 + drivers/scsi/lpfc/lpfc_hbadisc.c | 41 +++- drivers/scsi/lpfc/lpfc_hw.h | 7 +- drivers/scsi/lpfc/lpfc_hw4.h | 10 +- drivers/scsi/lpfc/lpfc_init.c | 66 ++++-- drivers/scsi/lpfc/lpfc_mem.c | 11 +- drivers/scsi/lpfc/lpfc_nvme.c | 18 +- drivers/scsi/lpfc/lpfc_scsi.c | 4 +- drivers/scsi/lpfc/lpfc_sli.c | 80 +++++-- drivers/scsi/lpfc/lpfc_sli4.h | 14 +- drivers/scsi/lpfc/lpfc_version.h | 2 +- 16 files changed, 563 insertions(+), 110 deletions(-)
Signature · 1 line
2.26.2
PATCH 1/9 lpfc: fix invalid sleeping context in lpfc_sli4_nvmet_alloc
The following calltrace was seen:
BUG: sleeping function called from invalid context at mm/slab.h:494 ... Call Trace: dump_stack+0x9a/0xf0 ___might_sleep.cold.63+0x13d/0x178 slab_pre_alloc_hook+0x6a/0x90 kmem_cache_alloc_trace+0x3a/0x2d0 lpfc_sli4_nvmet_alloc+0x4c/0x280 [lpfc] lpfc_post_rq_buffer+0x2e7/0xa60 [lpfc] lpfc_sli4_hba_setup+0x6b4c/0xa4b0 [lpfc] lpfc_pci_probe_one_s4.isra.15+0x14f8/0x2280 [lpfc] lpfc_pci_probe_one+0x260/0x2880 [lpfc] local_pci_probe+0xd4/0x180 work_for_cpu_fn+0x51/0xa0 process_one_work+0x8f0/0x17b0 worker_thread+0x536/0xb50 kthread+0x30c/0x3d0 ret_from_fork+0x3a/0x50
A prior patch introduced a spin_lock_irqsave(hbalock) in the lpfc_post_rq_buffer() routine. Call trace is seen as the hbalock is held with interrupts disabled during a GFP_KERNEL allocation in lpfc_sli4_nvmet_alloc().
Fix by reordering locking so that hbalock not held when calling sli4_nvmet_alloc() (aka rqb_buf_list()).
--- drivers/scsi/lpfc/lpfc_mem.c | 4 +--- drivers/scsi/lpfc/lpfc_sli.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 5 deletions(-)
drivers/scsi/lpfc/lpfc_mem.c +1 -3
@@ -588,8 +588,6 @@ lpfc_sli4_rb_free(struct lpfc_hba *phba, struct hbq_dmabuf *dmab)* Description: Allocates a DMA-mapped receive buffer from the lpfc_hrb_pool PCI * pool along a non-DMA-mapped container for it. * -* Notes: Not interrupt-safe. Must be called with no locks held. -* * Returns: * pointer to HBQ on success * NULL on failure
@@ -599,7 +597,7 @@ lpfc_sli4_nvmet_alloc(struct lpfc_hba *phba) {struct rqb_dmabuf *dma_buf; - dma_buf =kzalloc (sizeof (struct rqb_dmabuf ),GFP_KERNEL ); + dma_buf =kzalloc (sizeof (*dma_buf),GFP_KERNEL );if (!dma_buf)return NULL ;
drivers/scsi/lpfc/lpfc_sli.c +8 -2
@@ -7248,12 +7248,16 @@ lpfc_post_rq_buffer(struct lpfc_hba *phba, struct lpfc_queue *hrq,struct rqb_dmabuf *rqb_buffer;LIST_HEAD (rqb_buf_list); -spin_lock_irqsave (&phba->hbalock, flags); rqbp = hrq->rqbp;for (i =0 ; i < count; i++) { +spin_lock_irqsave (&phba->hbalock, flags);/* IF RQ is already full, don't bother */ -if (rqbp->buffer_count + i >= rqbp->entry_count -1 ) +if (rqbp->buffer_count + i >= rqbp->entry_count -1 ) { +spin_unlock_irqrestore (&phba->hbalock, flags);break ; + } +spin_unlock_irqrestore (&phba->hbalock, flags); + rqb_buffer = rqbp->rqb_alloc_buffer (phba);if (!rqb_buffer)break ;
@@ -7262,6 +7266,8 @@ lpfc_post_rq_buffer(struct lpfc_hba *phba, struct lpfc_queue *hrq, rqb_buffer->idx = idx;list_add_tail (&rqb_buffer->hbuf.list, &rqb_buf_list); } + +spin_lock_irqsave (&phba->hbalock, flags);while (!list_empty (&rqb_buf_list)) { list_remove_head(&rqb_buf_list, rqb_buffer, struct rqb_dmabuf, hbuf.list);
Signature · 1 line
2.26.2
PATCH 2/9 lpfc: fix scheduling call while in softirq context in lpfc_unreg_rpi
In reply to James SmartThe following call trace was seen during hba reset testing:
BUG: scheduling while atomic: swapper/2/0/0x10000100 ... Call Trace: dump_stack+0x19/0x1b __schedule_bug+0x64/0x72 __schedule+0x782/0x840 __cond_resched+0x26/0x30 _cond_resched+0x3a/0x50 mempool_alloc+0xa0/0x170 lpfc_unreg_rpi+0x151/0x630 [lpfc] lpfc_sli_abts_recover_port+0x171/0x190 [lpfc] lpfc_sli4_abts_err_handler+0xb2/0x1f0 [lpfc] lpfc_sli4_io_xri_aborted+0x256/0x300 [lpfc] lpfc_sli4_sp_handle_abort_xri_wcqe.isra.51+0xa3/0x190 [lpfc] lpfc_sli4_fp_handle_cqe+0x89/0x4d0 [lpfc] __lpfc_sli4_process_cq+0xdb/0x2e0 [lpfc] __lpfc_sli4_hba_process_cq+0x41/0x100 [lpfc] lpfc_cq_poll_hdler+0x1a/0x30 [lpfc] irq_poll_softirq+0xc7/0x100 __do_softirq+0xf5/0x280 call_softirq+0x1c/0x30 do_softirq+0x65/0xa0 irq_exit+0x105/0x110 do_IRQ+0x56/0xf0 common_interrupt+0x16a/0x16a
With the conversion to blk_io_poll for better interrupt latency in normal cases, it introduced this code path, executed when io aborts or logouts are seen, which attempts to allocate memory for a mailbox command to be issued. The allocation is GFP_KERNEL, thus it could attempt to sleep.
Fix by creating a work element that performs the event handling for the remote port. This will have the mailbox commands and other items performed in the work element, not the irq. A much better method as the "irq" routine does not stall while performing all this deep handling code.
Ensure that allocation failures are handled and send LOGO on failure.
Additionally, enlarged the mailbox memory pool to reduce the possibility of additional allocation in this path.
--- drivers/scsi/lpfc/lpfc.h | 2 +- drivers/scsi/lpfc/lpfc_disc.h | 2 + drivers/scsi/lpfc/lpfc_hbadisc.c | 35 +++++++++++++++++ drivers/scsi/lpfc/lpfc_init.c | 46 +++++++++++++---------- drivers/scsi/lpfc/lpfc_mem.c | 5 ++- drivers/scsi/lpfc/lpfc_nvme.c | 18 ++++++--- drivers/scsi/lpfc/lpfc_sli.c | 64 ++++++++++++++++++++++++++------ drivers/scsi/lpfc/lpfc_sli4.h | 6 +-- 8 files changed, 136 insertions(+), 42 deletions(-)
drivers/scsi/lpfc/lpfc.h +1 -1
@@ -753,7 +753,7 @@ struct lpfc_hba {#define HBA_SP_QUEUE_EVT 0x8/* Slow-path qevt posted to worker thread*/ #define HBA_POST_RECEIVE_BUFFER 0x10/* Rcv buffers need to be posted */ #define HBA_PERSISTENT_TOPO 0x20/* Persistent topology support in hba */ -#define ELS_XRI_ABORT_EVENT 0x40 +#define ELS_XRI_ABORT_EVENT 0x40/* ELS_XRI abort event was queued */ #define ASYNC_EVENT 0x80#define LINK_DISABLED 0x100/* Link disabled by user */ #define FCF_TS_INPROG 0x200/* FCF table scan in progress */
drivers/scsi/lpfc/lpfc_disc.h +2 -0
@@ -41,6 +41,7 @@ enum lpfc_work_type {LPFC_EVT_DEV_LOSS ,LPFC_EVT_FASTPATH_MGMT_EVT ,LPFC_EVT_RESET_HBA , + LPFC_EVT_RECOVER_PORT };/* structure used to queue event to the discovery tasklet */
@@ -128,6 +129,7 @@ struct lpfc_nodelist {struct lpfc_vport *vport;struct lpfc_work_evt els_retry_evt;struct lpfc_work_evt dev_loss_evt; +struct lpfc_work_evt recovery_evt;struct kref kref;atomic_t cmd_pending;uint32_t cmd_qdepth;
drivers/scsi/lpfc/lpfc_hbadisc.c +35 -0
@@ -551,6 +551,15 @@ lpfc_work_list_done(struct lpfc_hba *phba) fcf_inuse, nlp_did);break ; +case LPFC_EVT_RECOVER_PORT : + ndlp = (struct lpfc_nodelist *)(evtp->evt_arg1); +lpfc_sli_abts_recover_port (ndlp->vport, ndlp); + free_evt =0 ; +/* decrement the node reference count held for +* this queued work +*/ +lpfc_nlp_put (ndlp); +break ;case LPFC_EVT_ONLINE :if (phba->link_state <LPFC_LINK_DOWN ) *(int *) (evtp->evt_arg1) =lpfc_online (phba);
@@ -4487,6 +4496,8 @@ lpfc_initialize_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,INIT_LIST_HEAD (&ndlp->els_retry_evt.evt_listp);INIT_LIST_HEAD (&ndlp->dev_loss_evt.evt_listp);timer_setup (&ndlp->nlp_delayfunc, lpfc_els_retry_delay,0 ); +INIT_LIST_HEAD (&ndlp->recovery_evt.evt_listp); + ndlp->nlp_DID = did; ndlp->vport = vport; ndlp->phba = vport->phba;
@@ -4984,6 +4995,29 @@ lpfc_unreg_rpi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)mempool_free (mbox, phba->mbox_mem_pool); acc_plogi =1 ; } + }else { +lpfc_printf_vlog (vport,KERN_INFO , +LOG_NODE |LOG_DISCOVERY , +"1444 Failed to allocate mempool " +"unreg_rpi UNREG x%x, " +"DID x%x, flag x%x, " +"ndlp x%px\n" , + ndlp->nlp_rpi, ndlp->nlp_DID, + ndlp->nlp_flag, ndlp); + +/* Because mempool_alloc failed, we +* will issue a LOGO here and keep the rpi alive if +* not unloading. +*/ +if (!(vport->load_flag &FC_UNLOADING )) { + ndlp->nlp_flag &= ~NLP_UNREG_INP ; +lpfc_issue_els_logo (vport, ndlp,0 ); + ndlp->nlp_prev_state = ndlp->nlp_state; +lpfc_nlp_set_state (vport, ndlp, +NLP_STE_NPR_NODE ); + } + +return 1 ; }lpfc_no_rpi (phba, ndlp); out:
@@ -5187,6 +5221,7 @@ lpfc_cleanup_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)list_del_init (&ndlp->els_retry_evt.evt_listp);list_del_init (&ndlp->dev_loss_evt.evt_listp); +list_del_init (&ndlp->recovery_evt.evt_listp);lpfc_cleanup_vports_rrqs (vport, ndlp);if (phba->sli_rev ==LPFC_SLI_REV4 ) ndlp->nlp_flag |=NLP_RELEASE_RPI ;
drivers/scsi/lpfc/lpfc_init.c +27 -19
94 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_mem.c +3 -2
@@ -46,6 +46,7 @@#define LPFC_MEM_POOL_SIZE 64/* max elem in non-DMA safety pool */ #define LPFC_DEVICE_DATA_POOL_SIZE 64/* max elements in device data pool */ #define LPFC_RRQ_POOL_SIZE 256/* max elements in non-DMA pool */ +#define LPFC_MBX_POOL_SIZE 256/* max elements in MBX non-DMA pool */ int lpfc_mem_alloc_active_rrq_pool_s4 (struct lpfc_hba *phba) {
@@ -111,8 +112,8 @@ lpfc_mem_alloc(struct lpfc_hba *phba, int align) pool->current_count++; } - phba->mbox_mem_pool =mempool_create_kmalloc_pool (LPFC_MEM_POOL_SIZE , -sizeof (LPFC_MBOXQ_t)); + phba->mbox_mem_pool =mempool_create_kmalloc_pool (LPFC_MBX_POOL_SIZE , +sizeof (LPFC_MBOXQ_t));if (!phba->mbox_mem_pool) goto fail_free_mbuf_pool;
drivers/scsi/lpfc/lpfc_nvme.c +13 -5
@@ -2280,6 +2280,8 @@ lpfc_nvme_lport_unreg_wait(struct lpfc_vport *vport,int ret, i, pending =0 ;struct lpfc_sli_ring *pring;struct lpfc_hba *phba = vport->phba; +struct lpfc_sli4_hdw_queue *qp; +int abts_scsi, abts_nvme;/* Host transport has to clean up and confirm requiring an indefinite * wait. Print a message if a 10 second wait expires and renew the
@@ -2290,17 +2292,23 @@ lpfc_nvme_lport_unreg_wait(struct lpfc_vport *vport, ret =wait_for_completion_timeout (lport_unreg_cmp, wait_tmo);if (unlikely (!ret)) { pending =0 ; + abts_scsi =0 ; + abts_nvme =0 ;for (i =0 ; i < phba->cfg_hdw_queue; i++) { - pring = phba->sli4_hba.hdwq[i].io_wq->pring; + qp = &phba->sli4_hba.hdwq[i]; + pring = qp->io_wq->pring;if (!pring)continue ; -if (pring->txcmplq_cnt) - pending += pring->txcmplq_cnt; + pending += pring->txcmplq_cnt; + abts_scsi += qp->abts_scsi_io_bufs; + abts_nvme += qp->abts_nvme_io_bufs; }lpfc_printf_vlog (vport,KERN_ERR ,LOG_TRACE_EVENT ,"6176 Lport x%px Localport x%px wait " -"timed out. Pending %d. Renewing.\n" , - lport, vport->localport, pending); +"timed out. Pending %d [%d:%d]. " +"Renewing.\n" , + lport, vport->localport, pending, + abts_scsi, abts_nvme);continue ; }break ;
drivers/scsi/lpfc/lpfc_sli.c +52 -12
114 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_sli4.h +3 -3
@@ -920,8 +920,9 @@ struct lpfc_sli4_hba {struct list_head sp_queue_event;struct list_head sp_cqe_event_pool;struct list_head sp_asynce_work_queue; -struct list_head sp_fcp_xri_aborted_work_queue; +spinlock_t asynce_list_lock;/* protect sp_asynce_work_queue list */ struct list_head sp_els_xri_aborted_work_queue; +spinlock_t els_xri_abrt_list_lock;/* protect els_xri_aborted list */ struct list_head sp_unsol_work_queue;struct lpfc_sli4_link link_state;struct lpfc_sli4_lnk_info lnk_info;
@@ -1103,8 +1104,7 @@ void lpfc_sli4_async_event_proc(struct lpfc_hba *);void lpfc_sli4_fcf_redisc_event_proc (struct lpfc_hba *);int lpfc_sli4_resume_rpi (struct lpfc_nodelist *,void (*)(struct lpfc_hba *,LPFC_MBOXQ_t *),void *); -void lpfc_sli4_fcp_xri_abort_event_proc (struct lpfc_hba *); -void lpfc_sli4_els_xri_abort_event_proc (struct lpfc_hba *); +void lpfc_sli4_els_xri_abort_event_proc (struct lpfc_hba *phba);void lpfc_sli4_nvme_xri_aborted (struct lpfc_hba *phba,struct sli4_wcqe_xri_aborted *axri,struct lpfc_io_buf *lpfc_ncmd);
Signature · 1 line
2.26.2
PATCH 3/9 lpfc: Re-fix use after free in lpfc_rq_buf_free()
In reply to James SmartA commit (9816ef6ecbc1) was made to correct a use after free condition in lpfc_rq_buf_free(). Unfortunately, a subsequent patch cut on a tree without the fix inadvertantly reverted the fix.
Put the fix back: move the freeing of the rqb_entry to after the print function that references it.
--- drivers/scsi/lpfc/lpfc_mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_mem.c +1 -1
@@ -721,7 +721,6 @@ lpfc_rq_buf_free(struct lpfc_hba *phba, struct lpfc_dmabuf *mp) drqe.address_hi =putPaddrHigh (rqb_entry->dbuf.phys); rc =lpfc_sli4_rq_put (rqb_entry->hrq, rqb_entry->drq, &hrqe, &drqe);if (rc <0 ) { - (rqbp->rqb_free_buffer)(phba, rqb_entry); lpfc_printf_log(phba, KERN_ERR, LOG_INIT, "6409 Cannot post to HRQ %d: %x %x %x " "DRQ %x %x\n",
@@ -731,6 +730,7 @@ lpfc_rq_buf_free(struct lpfc_hba *phba, struct lpfc_dmabuf *mp) rqb_entry->hrq->entry_count, rqb_entry->drq->host_index, rqb_entry->drq->hba_index); + (rqbp->rqb_free_buffer)(phba, rqb_entry); }else {list_add_tail (&rqb_entry->hbuf.list, &rqbp->rqb_buffer_list); rqbp->buffer_count++;
Signature · 1 line
2.26.2
PATCH 4/9 lpfc: Removed unused macros in lpfc_attr.c.
In reply to James SmartRemoved unused MRQ-related defines that are not referenced.
--- drivers/scsi/lpfc/lpfc_attr.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/scsi/lpfc/lpfc_attr.c +0 -4
@@ -57,10 +57,6 @@#define LPFC_MIN_DEVLOSS_TMO 1#define LPFC_MAX_DEVLOSS_TMO 255 -#define LPFC_DEF_MRQ_POST 512 -#define LPFC_MIN_MRQ_POST 512 -#define LPFC_MAX_MRQ_POST 2048 -/* * Write key size should be multiple of 4. If write key is changed * make sure that library write key is also changed.
Signature · 1 line
2.26.2
PATCH 5/9 lpfc: Fix duplicate wq_create_version check
In reply to James SmartDuring code reviews duplicate code sections were found to determine the
WQ Create version. The duplication was potentially overriding logic
that validated page size.
--- drivers/scsi/lpfc/lpfc_sli.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/scsi/lpfc/lpfc_sli.c +0 -6
@@ -15896,12 +15896,6 @@ lpfc_wq_create(struct lpfc_hba *phba, struct lpfc_queue *wq,else wq_create_version =LPFC_Q_CREATE_VERSION_0 ; - -if (phba->sli4_hba.pc_sli4_params.wqsize &LPFC_WQ_SZ128_SUPPORT ) - wq_create_version =LPFC_Q_CREATE_VERSION_1 ; -else - wq_create_version =LPFC_Q_CREATE_VERSION_0 ; -switch (wq_create_version) {case LPFC_Q_CREATE_VERSION_1 : bf_set(lpfc_mbx_wq_create_wqe_count, &wq_create->u.request_1,
Signature · 1 line
2.26.2
PATCH 6/9 lpfc: Enlarge max_sectors in scsi templates
In reply to James SmartThe driver supports arbitrarily large sgl lists and the current value for max_sectors is limiting.
Change the max_sectors value to the largest value. This was actually done prior but it only corrected one template and that template was later removed.
So change the remaining 2 templates. Other areas which hard-set the sectors value should be inheriting what is in the template.
--- drivers/scsi/lpfc/lpfc_init.c | 5 +---- drivers/scsi/lpfc/lpfc_scsi.c | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-)
drivers/scsi/lpfc/lpfc_init.c +1 -4
@@ -4343,16 +4343,13 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev)/* Seed physical port template */ memcpy (template, &lpfc_template,sizeof (*template)); -if (use_no_reset_hba) { +if (use_no_reset_hba)/* template is for a no reset SCSI Host */ - template->max_sectors =0xffff ; template->eh_host_reset_handler =NULL ; - }/* Template for all vports this physical port creates */ memcpy (&phba->vport_template, &lpfc_template,sizeof (*template)); - phba->vport_template.max_sectors =0xffff ; phba->vport_template.shost_attrs = lpfc_vport_attrs; phba->vport_template.eh_bus_reset_handler =NULL ; phba->vport_template.eh_host_reset_handler =NULL ;
drivers/scsi/lpfc/lpfc_scsi.c +2 -2
@@ -6029,7 +6029,7 @@ struct scsi_host_template lpfc_template_nvme = { .sg_tablesize = 1, .cmd_per_lun = 1, .shost_attrs = lpfc_hba_attrs, - .max_sectors = 0xFFFF, + .max_sectors = 0xFFFFFFFF, .vendor_id = LPFC_NL_VENDOR_ID, .track_queue_depth = 0, };
@@ -6054,7 +6054,7 @@ struct scsi_host_template lpfc_template = { .sg_tablesize = LPFC_DEFAULT_SG_SEG_CNT, .cmd_per_lun = LPFC_CMD_PER_LUN, .shost_attrs = lpfc_hba_attrs, - .max_sectors = 0xFFFF, + .max_sectors = 0xFFFFFFFF, .vendor_id = LPFC_NL_VENDOR_ID, .change_queue_depth = scsi_change_queue_depth, .track_queue_depth = 1,
Signature · 1 line
2.26.2
PATCH 7/9 lpfc: Add FDMI Vendor MIB support
In reply to James SmartAdd vendor-specific MIB support
Created new attribute lpfc_enable_mi, which by default is enabled.
Add command definition bits for sli-4 parameters that recognize whether the adapter has MIB information support and what revision of MIB data. Using the adapter information, register vendor-specific MIB support with FDMI. The registration will be done every link up.
During FDMI registration, encountered a couple of errors when reverting to FDMI rev1. Code needed to exist once reverting. Fixed these.
--- drivers/scsi/lpfc/lpfc.h | 4 ++- drivers/scsi/lpfc/lpfc_attr.c | 10 ++++++ drivers/scsi/lpfc/lpfc_ct.c | 60 ++++++++++++++++++++++++++++++++ drivers/scsi/lpfc/lpfc_els.c | 6 ++++ drivers/scsi/lpfc/lpfc_hbadisc.c | 6 ++-- drivers/scsi/lpfc/lpfc_hw.h | 4 ++- drivers/scsi/lpfc/lpfc_hw4.h | 10 ++++-- drivers/scsi/lpfc/lpfc_init.c | 15 ++++++++ drivers/scsi/lpfc/lpfc_sli4.h | 8 +++++ 9 files changed, 117 insertions(+), 6 deletions(-)
drivers/scsi/lpfc/lpfc.h +3 -1
@@ -744,7 +744,8 @@ struct lpfc_hba {#define LS_NPIV_FAB_SUPPORTED 0x2/* Fabric supports NPIV */ #define LS_IGNORE_ERATT 0x4/* intr handler should ignore ERATT */ #define LS_MDS_LINK_DOWN 0x8/* MDS Diagnostics Link Down */ -#define LS_MDS_LOOPBACK 0x10/* MDS Diagnostics Link Up (Loopback) */ +#define LS_MDS_LOOPBACK 0x10/* MDS Diagnostics Link Up (Loopback) */ +#define LS_CT_VEN_RPA 0x20/* Vendor RPA sent to switch */ uint32_t hba_flag;/* hba generic flags */ #define HBA_ERATT_HANDLED 0x1/* This flag is set when eratt handled */
@@ -922,6 +923,7 @@ struct lpfc_hba {#define LPFC_ENABLE_NVME 2#define LPFC_ENABLE_BOTH 3uint32_t cfg_enable_pbde; +uint32_t cfg_enable_mi;struct nvmet_fc_target_port *targetport;lpfc_vpd_t vpd;/* vital product data */
drivers/scsi/lpfc/lpfc_attr.c +10 -0
@@ -6134,6 +6134,14 @@ LPFC_BBCR_ATTR_RW(enable_bbcr, 1, 0, 1, "Enable BBC Recovery");*/ LPFC_ATTR_RW (enable_dpp,1 ,0 ,1 ,"Enable Direct Packet Push" ); +/* +* lpfc_enable_mi: Enable FDMI MIB +* 0 = disabled +* 1 = enabled (default) +* Value range is [0,1]. +*/ +LPFC_ATTR_R (enable_mi,1 ,0 ,1 ,"Enable MI" ); +struct device_attribute *lpfc_hba_attrs[] = { &dev_attr_nvme_info, &dev_attr_scsi_stat,
@@ -6251,6 +6259,7 @@ struct device_attribute *lpfc_hba_attrs[] = { &dev_attr_lpfc_ras_fwlog_func, &dev_attr_lpfc_enable_bbcr, &dev_attr_lpfc_enable_dpp, + &dev_attr_lpfc_enable_mi, NULL, };
@@ -7355,6 +7364,7 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)lpfc_irq_chann_init (phba, lpfc_irq_chann);lpfc_enable_bbcr_init (phba, lpfc_enable_bbcr);lpfc_enable_dpp_init (phba, lpfc_enable_dpp); +lpfc_enable_mi_init (phba, lpfc_enable_mi);if (phba->sli_rev !=LPFC_SLI_REV4 ) {/* NVME only supported on SLI4 */
drivers/scsi/lpfc/lpfc_ct.c +60 -0
96 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_els.c +6 -0
@@ -3335,6 +3335,12 @@ lpfc_issue_els_rscn(struct lpfc_vport *vport, uint8_t retry)lpfc_els_free_iocb (phba, elsiocb);return 1 ; } + +/* Only keep the ndlp if RDF is being sent */ +if (!phba->cfg_enable_mi || + phba->sli4_hba.pc_sli4_params.mi_ver <LPFC_MIB3_SUPPORT ) +return 0 ; +/* This will cause the callback-function lpfc_cmpl_els_cmd to * trigger the release of node. */
drivers/scsi/lpfc/lpfc_hbadisc.c +4 -2
@@ -3171,7 +3171,7 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, struct lpfc_mbx_read_top *la) } phba->fc_topology =bf_get (lpfc_mbx_read_top_topology, la); - phba->link_flag &= ~LS_NPIV_FAB_SUPPORTED ; + phba->link_flag &= ~(LS_NPIV_FAB_SUPPORTED |LS_CT_VEN_RPA ); shost =lpfc_shost_from_vport (vport);if (phba->fc_topology ==LPFC_TOPOLOGY_LOOP ) {
@@ -4105,7 +4105,9 @@ lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)/* Issue SCR just before NameServer GID_FT Query */ lpfc_issue_els_scr (vport,0 ); -lpfc_issue_els_rdf (vport,0 ); +if (!phba->cfg_enable_mi || + phba->sli4_hba.pc_sli4_params.mi_ver <LPFC_MIB3_SUPPORT ) +lpfc_issue_els_rdf (vport,0 ); } vport->fc_ns_retry =0 ;
drivers/scsi/lpfc/lpfc_hw.h +3 -1
@@ -1465,7 +1465,7 @@ struct lpfc_fdmi_reg_portattr {#define LPFC_FDMI2_HBA_ATTR 0x0002efff/* -* Port Attrubute Types +* Port Attribute Types */ #define RPRT_SUPPORTED_FC4_TYPES 0x1/* 32 byte binary array */ #define RPRT_SUPPORTED_SPEED 0x2/* 32-bit unsigned int */
@@ -1483,6 +1483,7 @@ struct lpfc_fdmi_reg_portattr {#define RPRT_PORT_STATE 0x101/* 32-bit unsigned int */ #define RPRT_DISC_PORT 0x102/* 32-bit unsigned int */ #define RPRT_PORT_ID 0x103/* 32-bit unsigned int */ +#define RPRT_VENDOR_MI 0xf047/* vendor ascii string */ #define RPRT_SMART_SERVICE 0xf100/* 4 to 256 byte ASCII string */ #define RPRT_SMART_GUID 0xf101/* 8 byte WWNN + 8 byte WWPN */ #define RPRT_SMART_VERSION 0xf102/* 4 to 256 byte ASCII string */
@@ -1515,6 +1516,7 @@ struct lpfc_fdmi_reg_portattr {#define LPFC_FDMI_SMART_ATTR_port_info 0x00100000/* Vendor specific */ #define LPFC_FDMI_SMART_ATTR_qos 0x00200000/* Vendor specific */ #define LPFC_FDMI_SMART_ATTR_security 0x00400000/* Vendor specific */ +#define LPFC_FDMI_VENDOR_ATTR_mi 0x00800000/* Vendor specific */ /* Bit mask for FDMI-1 defined PORT attributes */ #define LPFC_FDMI1_PORT_ATTR 0x0000003f
drivers/scsi/lpfc/lpfc_hw4.h +8 -2
@@ -3506,8 +3506,14 @@ struct lpfc_sli4_parameters {#define cfg_max_tow_xri_MASK 0x0000ffff#define cfg_max_tow_xri_WORD word20 -uint32_t word21;/* RESERVED */ -uint32_t word22;/* RESERVED */ +uint32_t word21; +#define cfg_mib_bde_cnt_SHIFT 16 +#define cfg_mib_bde_cnt_MASK 0x000000ff +#define cfg_mib_bde_cnt_WORD word21 +#define cfg_mi_ver_SHIFT 0 +#define cfg_mi_ver_MASK 0x0000ffff +#define cfg_mi_ver_WORD word21 +uint32_t mib_size;uint32_t word23;/* RESERVED */ uint32_t word24;
drivers/scsi/lpfc/lpfc_init.c +15 -0
@@ -12315,6 +12315,21 @@ lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)else phba->nsler =0 ; +/* Save PB info for use during HBA setup */ + sli4_params->mi_ver =bf_get (cfg_mi_ver, mbx_sli4_parameters); + sli4_params->mib_bde_cnt =bf_get (cfg_mib_bde_cnt, mbx_sli4_parameters); + sli4_params->mib_size = mbx_sli4_parameters->mib_size; + sli4_params->mi_value =LPFC_DFLT_MIB_VAL ; + +/* Next we check for Vendor MIB support */ +if (sli4_params->mi_ver && phba->cfg_enable_mi) + phba->cfg_fdmi_on =LPFC_FDMI_SUPPORT ; + +lpfc_printf_log (phba,KERN_INFO ,LOG_INIT , +"6461 MIB attr %d enable %d FDMI %d buf %d:%d\n" , + sli4_params->mi_ver, phba->cfg_enable_mi, + sli4_params->mi_value, sli4_params->mib_bde_cnt, + sli4_params->mib_size);return 0 ; }
drivers/scsi/lpfc/lpfc_sli4.h +8 -0
@@ -549,6 +549,14 @@ struct lpfc_pc_sli4_params {uint32_t hdr_pp_align;uint32_t sgl_pages_max;uint32_t sgl_pp_align; +uint32_t mib_size; +uint16_t mi_ver; +#define LPFC_MIB1_SUPPORT 1 +#define LPFC_MIB2_SUPPORT 2 +#define LPFC_MIB3_SUPPORT 3 +uint16_t mi_value; +#define LPFC_DFLT_MIB_VAL 2 +uint8_t mib_bde_cnt;uint8_t cqv;uint8_t mqv;uint8_t wqv;
Signature · 1 line
2.26.2
PATCH 8/9 lpfc: Reject CT request for MIB commands
In reply to James SmartNow that MIB support was registered with FDMI, the driver may receive CT requests for MIB-related commands. At this time, no command is supported. However, the driver needs to be graceful and reject the CT request.
This patch adds identification of the requests as well as sending the reject response.
--- drivers/scsi/lpfc/lpfc_bsg.c | 21 +-- drivers/scsi/lpfc/lpfc_ct.c | 311 ++++++++++++++++++++++++++++++++--- drivers/scsi/lpfc/lpfc_hw.h | 3 + 3 files changed, 296 insertions(+), 39 deletions(-)
drivers/scsi/lpfc/lpfc_bsg.c +1 -20
@@ -939,28 +939,9 @@ lpfc_bsg_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,INIT_LIST_HEAD (&head);list_add_tail (&head, &piocbq->list); -if (piocbq->iocb.ulpBdeCount ==0 || - piocbq->iocb.un.cont64[0 ].tus.f.bdeSize ==0 ) - goto error_ct_unsol_exit; - -if (phba->link_state ==LPFC_HBA_ERROR || - (!(phba->sli.sli_flag &LPFC_SLI_ACTIVE ))) - goto error_ct_unsol_exit; - -if (phba->sli3_options &LPFC_SLI3_HBQ_ENABLED ) - dmabuf = bdeBuf1; -else { - dma_addr =getPaddr (piocbq->iocb.un.cont64[0 ].addrHigh, - piocbq->iocb.un.cont64[0 ].addrLow); - dmabuf =lpfc_sli_ringpostbuf_get (phba, pring, dma_addr); - } -if (dmabuf ==NULL ) - goto error_ct_unsol_exit; - ct_req = (struct lpfc_sli_ct_request *)dmabuf->virt; + ct_req = (struct lpfc_sli_ct_request *)bdeBuf1; evt_req_id = ct_req->FsType; cmd = ct_req->CommandResponse.bits.CmdRsp; -if (!(phba->sli3_options &LPFC_SLI3_HBQ_ENABLED )) -lpfc_sli_ringpostbuf_put (phba, pring, dmabuf);spin_lock_irqsave (&phba->ct_ev_lock, flags);list_for_each_entry (evt, &phba->ct_ev_waiters, node) {
drivers/scsi/lpfc/lpfc_ct.c +292 -19
359 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_hw.h +3 -0
@@ -1380,6 +1380,9 @@ struct lpfc_fdmi_reg_hba {struct lpfc_fdmi_reg_port_list rpl; }; +/******** MI MIB ********/ +#define SLI_CT_MIB_Subtypes 0x11 +/* * Register HBA Attributes (RHAT) */
Signature · 1 line
2.26.2
PATCH 9/9 lpfc: Update lpfc version to 12.8.0.5
In reply to James SmartUpdate lpfc version to 12.8.0.5
--- drivers/scsi/lpfc/lpfc_version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_version.h +1 -1
@@ -20,7 +20,7 @@* included with this package. * *******************************************************************/ -#define LPFC_DRIVER_VERSION "12.8.0.4" +#define LPFC_DRIVER_VERSION "12.8.0.5"#define LPFC_DRIVER_NAME "lpfc"/* Used for SLI 2/3 */
Signature · 1 line
2.26.2
Martin K. Petersen
AppliedJames,
Quoted 4 lines
Update lpfc to revision 12.8.0.5
Patches include several small fixes and the addition of a FDMI registration for vendor MIB data.
Applied to 5.11/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Martin K. Petersen
AppliedQuoted 8 lines · James Smart
Update lpfc to revision 12.8.0.5
Patches include several small fixes and the addition of a FDMI registration for vendor MIB data.
The patches were cut against Martin's 5.10/scsi-queue tree
[...]
Applied to 5.11/scsi-queue, thanks!
[1/9] scsi: lpfc: Fix invalid sleeping context in lpfc_sli4_nvmet_alloc()
https://git.kernel.org/mkp/scsi/c/62e3a931db60 [2/9] scsi: lpfc: Fix scheduling call while in softirq context in lpfc_unreg_rpi https://git.kernel.org/mkp/scsi/c/e7dab164a9aa [3/9] scsi: lpfc: Re-fix use after free in lpfc_rq_buf_free() https://git.kernel.org/mkp/scsi/c/e5785d3ec32f [4/9] scsi: lpfc: Removed unused macros in lpfc_attr.c https://git.kernel.org/mkp/scsi/c/7cbef585a12a [5/9] scsi: lpfc: Fix duplicate wq_create_version check https://git.kernel.org/mkp/scsi/c/f5201f87ccaf [6/9] scsi: lpfc: Enlarge max_sectors in scsi host templates https://git.kernel.org/mkp/scsi/c/7c30bb62ed5d [7/9] scsi: lpfc: Add FDMI Vendor MIB support https://git.kernel.org/mkp/scsi/c/8aaa7bcf07a2 [8/9] scsi: lpfc: Reject CT request for MIB commands https://git.kernel.org/mkp/scsi/c/b67b59443282 [9/9] scsi: lpfc: Update lpfc version to 12.8.0.5 https://git.kernel.org/mkp/scsi/c/56ae4919f9ed
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering