summaryrefslogtreecommitdiff
path: root/drivers/scsi/lpfc
AgeCommit message (Collapse)Author
2017-08-24scsi: lpfc: lpfc version bump 11.4.0.3Dick Kennedy
Update driver version to 11.4.0.3 Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-08-24scsi: lpfc: fix "integer constant too large" error on 32bit archsMaurizio Lombardi
cc1: warnings being treated as errors drivers/scsi/lpfc/lpfc_init.c: In function 'lpfc_get_wwpn': drivers/scsi/lpfc/lpfc_init.c:3253: error: integer constant is too large for 'long' type Signed-off-by: Maurizio Lombardi <mlombard@redhat.com> Signed-off-by: James Smart <james.smart@broadcom.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-08-24scsi: lpfc: Add Buffer to Buffer credit recovery supportJames Smart
Add Buffer to buffer credit recovery support to the driver. This is a negotiated feature with the peer that allows for both sides to detect dropped RRDY's and FC Frames and recover credit. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-08-24scsi: lpfc: remove console log clutterJames Smart
Change hw queue binding messages to info - not error. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-08-24scsi: lpfc: Fix bad sgl reposting after 2nd adapter resetDick Kennedy
Port issue was fixed, the hbacmd reset would take more than 8 minutes to complete. There were conflicting NVME SGL posting/reposting responsibilities between lpfc_online()/lpfc_sli4_hba_setup() and lpfc_nvme_create_localport(). The lpfc_online() causes a REPOST on existing NVME SGLs which is not released during the fc port reset. However, lpfc_nvme_create_localport() wants to allocate new NVME buffers and post them. Both cancelled out each other which had a side effect of hosing the mailbox handling that was used to remove the sgl lists - causing multiple 60s mbx timeouts. Fix by preserving all SGL lists over the fc port reset. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-08-24scsi: lpfc: Fix nvme target failure after 2nd adapter resetDick Kennedy
The nonrecovery occurred because the lpfc nvme initiator function did not reestablish its localport creation with the nvme host transport in lpfc_oneline. Because of that, an NVME rport binding could not take place. Corrected by recreating the localport in the adapter reset recovery routine. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-08-24scsi: lpfc: Fix relative offset error on large nvmet target iosDick Kennedy
If the nvmet_fc transport breaks an io into multiple sequences, the driver will improperly set the relative offset on the 2nd through N sequences. Correct by properly formatting the hw cmd so the relative offset is picked up from the hw cmd. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-08-24scsi: lpfc: Fix MRQ > 1 context list handlingDick Kennedy
Various oops including cpu LOCKUPs were seen. For asynchronously received ius where the driver must assign exchange resources, the resources were on a single get (free) list and put list (finished, waiting to be put on get list). As all cpus are sharing the lists, an interrupt for a receive frame may have to wait for all the other cpus to place their done work onto the put list before it can acquire the lock to pull from the list. Fix by breaking the resource lists into per-cpu lists or at least more than 1 list with cpu's sharing the lists). A cpu would allocate from the free list for its own cpu, and put its done work on the its own put list - avoiding the contention. As cpu load may vary, when empty, a cpu may grab from another cpu, thereby changing resource distribution. But searching for a resource only occurs on 1 or a few cpus until a single resource can be allocated. if the condition reoccurs, it starts looking at a different cpu. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-08-24scsi: lpfc: Limit amount of work processed in IRQDick Kennedy
Various oops being seen on being in the ISR too long and cpu lockups, when under heavy load. The amount of work being posted off of completion queues kept the ISR running almost all the time Correct the issue by limiting the amount of work per iteration. [mkp: typo] Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-08-24scsi: lpfc: Correct issues with FAWWN and FDISCsDick Kennedy
When using fabric-assigned WWNs, the switch doesn't like copy of the FLOGI payload, which includes valid VVL bits, to be used as the FDISC payload. Rather than wait for corrected switch firmware, ensure the VVL bits are marked invalid on FDISCs. [mkp: typo] Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-08-24scsi: lpfc: Fix NVME PRLI handling during RSCNDick Kennedy
A race condition was found whereby the initiator would receive the RSCN for a new NVME device before it had a chance to register its FC4 support with the fabric. Thus, when queried by the initiator, it would see that the target supported FC-NVME. Corrected by making the assumption that the target always supports FC-NVME thus a PRLI is sent. It's ok for the target to reject it. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-08-24scsi: lpfc: Fix crash in lpfc nvmet when fc port is resetDick Kennedy
In adapter reset tests, an oops was seen with a NULL pointer in lpfc_free_rq_buffer+0x20/0x60 The driver is failing to properly repost the nvmet sgl list when recovering from the reset. Thus the driver eventually trys to walk an errant buffer list. Corrected the sgl buffer recovery as well as strengthening the initialization of the bufferlist. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-08-24scsi: lpfc: Fix duplicate NVME rport entries and namespaces.Dick Kennedy
After lip, the driver sometimes would have two rports for the same device, allowing the namespaces to be duplicated by nvme. In lpfc_plogi_confirm_nport() the driver was not swapping the nrport maintained by the ndlp's undergoing address swapping. This allowed the 2nd rport to sneak in as it was considered a separate device. This patch adds the fixes to Swap the nrport in each ndlp and take care of the reference counts on the ndlps similar to FCP rports. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-08-24scsi: lpfc: Fix handling of FCP and NVME FC4 types in Pt2Pt topologyDick Kennedy
After link bounce in a NVME Pt2Pt config, the driver managed to map the same nport twice, resulting in multiple device nodes for the same namespace. In Pt2Pt, the driver must send PRLI's for both (scsi) FCP and NVME rather than using fabric aids. The driver was inconsistent on handling various PRLI completions, especially rejects, which had reject codes cross the different protocol PRLI completions. Fixed to perform the following: if nvmet mode (fc port can only be a nvme target) - rejects all unsolicitly FCP PRLI's. Never issues a FCP PRLI. The multiple protocol PRLI's are sent simultaneously. However, driver will now only state transition after both PRLI's are complete. New flags were added to aid tracking the responses from the different PRLI's. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-08-24scsi: lpfc: Correct return error codes to align with nvme_fc transportDick Kennedy
Modify driver return error codes to align with host nvme transport. Driver isn't returning Exxx error codes to properly reflect out of resource or connectivity conditions (-EBUSY), yet there were hard error conditions returning -EBUSY. Ensure the following situations return the proper return code: - Temporary failures or temporary resource availability: -EBUSY - Connectivity issues: -ENODEV All others are treated as hard errors and return an -Exxx value that indicates the type of error. Also, lpfc_sli4_issue_wqe() was modified to not translate error from -Exxx to WQE state. This allows lpfc_nvme_fcp_io_submit() routine to just return whatever -E value was returned from other routines. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-08-24scsi: lpfc: convert info messages to standard messagesDick Kennedy
Transitioned some informational discovery messages to now always be displayed when log_verbose is set. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-08-24scsi: lpfc: Fix oops when NVME Target is discovered in a nonNVME environmentDick Kennedy
lpfc oops when it discovers a NVME target but is configured for SCSI only operation. Oops is in lpfc_nvme_register_port+0x33/0x300. The localport is not valid so it should not have been referenced. Added validity check for localport Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-08-24scsi: lpfc: Fix rediscovery on switch blade pullDick Kennedy
When the switch blade is pulled out then plugged back in, the driver does not issue a PLOGI to the target When the switch blade is pulled out, it does not reset the link. The driver ends up issuing a LOGO to the target, and finally sees devloss. Since the driver believes that a LOGO is outstanding, it does not issue a PLOGI to the target upon link up Correct by placing the ndlp in UNUSED state When devloss happens in LOGO_ISSUE state. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-08-24scsi: lpfc: Fix loop mode target discoveryDick Kennedy
The driver does not discover targets when in loop mode. The NLP type is correctly getting set when a fabric connection is detected but, not for loop. The unknown NLP type means that the driver does not issue a PRLI when in loop topology. Thus target discovery fails. Fix by checking the topology during discovery. If it is loop, set the NLP FC4 type to FCP. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-08-24scsi: lpfc: Fix plogi collision that causes illegal state transitionDick Kennedy
Message "0271 Illegal State Transition: node" seen in logs, all luns are unuseable for that target. A window exists in the rcv_plogi path where if the state is plogi issue but the driver has not issued a plogi, then two reglogins will be sent for the same RPI. The first one to complete will advance the state to prli issue the second one will be detected as an illegal state, and leave the node in an unusable state. Correct the completion routine for the PLOGI ACC that detects the state change when the driver starts discovery on the node again and drop the REGLOGIN mailbox command. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-08-24scsi: lpfc: remove useless code in lpfc_sli4_bsg_link_diag_testGustavo A. R. Silva
Remove variable assignments. The value stored in local variable _rc_ is overwritten at line 2448:rc = lpfc_sli4_bsg_set_link_diag_state(phba, 0); before it can be used. Addresses-Coverity-ID: 1226935 Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Acked-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-08-07scsi: lpfc: Replace PCI pool old APIRomain Perier
The PCI pool API is deprecated. This commit replaces the PCI pool old API by the appropriate function with the DMA pool API. It also updates some comments, accordingly. Signed-off-by: Romain Perier <romain.perier@collabora.com> Reviewed-by: Peter Senna Tschudin <peter.senna@collabora.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-07-11Merge branch 'for-linus' of git://git.kernel.dk/linux-blockLinus Torvalds
Pull more block updates from Jens Axboe: "This is a followup for block changes, that didn't make the initial pull request. It's a bit of a mixed bag, this contains: - A followup pull request from Sagi for NVMe. Outside of fixups for NVMe, it also includes a series for ensuring that we properly quiesce hardware queues when browsing live tags. - Set of integrity fixes from Dmitry (mostly), fixing various issues for folks using DIF/DIX. - Fix for a bug introduced in cciss, with the req init changes. From Christoph. - Fix for a bug in BFQ, from Paolo. - Two followup fixes for lightnvm/pblk from Javier. - Depth fix from Ming for blk-mq-sched. - Also from Ming, performance fix for mtip32xx that was introduced with the dynamic initialization of commands" * 'for-linus' of git://git.kernel.dk/linux-block: (44 commits) block: call bio_uninit in bio_endio nvmet: avoid unneeded assignment of submit_bio return value nvme-pci: add module parameter for io queue depth nvme-pci: compile warnings in nvme_alloc_host_mem() nvmet_fc: Accept variable pad lengths on Create Association LS nvme_fc/nvmet_fc: revise Create Association descriptor length lightnvm: pblk: remove unnecessary checks lightnvm: pblk: control I/O flow also on tear down cciss: initialize struct scsi_req null_blk: fix error flow for shared tags during module_init block: Fix __blkdev_issue_zeroout loop nvme-rdma: unconditionally recycle the request mr nvme: split nvme_uninit_ctrl into stop and uninit virtio_blk: quiesce/unquiesce live IO when entering PM states mtip32xx: quiesce request queues to make sure no submissions are inflight nbd: quiesce request queues to make sure no submissions are inflight nvme: kick requeue list when requeueing a request instead of when starting the queues nvme-pci: quiesce/unquiesce admin_q instead of start/stop its hw queues nvme-loop: quiesce/unquiesce admin_q instead of start/stop its hw queues nvme-fc: quiesce/unquiesce admin_q instead of start/stop its hw queues ...
2017-07-06Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsiLinus Torvalds
Pull SCSI updates from James Bottomley: "This is mostly updates of the usual suspects: lpfc, qla2xxx, bnx2fc, qedf, hpsa, hisi_sas, smartpqi, cxlflash, aacraid, csiostor along with a host of minor and miscellaneous changes" * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (276 commits) qla2xxx: Fix NVMe entry_type for iocb packet on BE system scsi: qla2xxx: avoid unused-function warning scsi: snic: fix a couple of spelling mistakes/typos scsi: qla2xxx: fix a bunch of typos and spelling mistakes scsi: lpfc: don't double count abort errors scsi: lpfc: spin_lock_irq() is not nestable scsi: hisi_sas: optimise DMA slot memory scsi: ibmvfc: constify dev_pm_ops structures. scsi: ibmvscsi: constify dev_pm_ops structures. scsi: cxlflash: Update debug prints in reset handlers scsi: cxlflash: Update send_tmf() parameters scsi: cxlflash: Avoid double free of character device scsi: Add STARGET_CREATED_REMOVE state to scsi_target_state scsi: ses: do not add a device to an enclosure if enclosure_add_links() fails. scsi: ufs: flush eh_work when eh_work scheduled. scsi: qla2xxx: Protect access to qpair members with qpair->qp_lock scsi: sun_esp: fix device reference leaks scsi: fnic: changing queue command to return result DID_IMM_RETRY when rport is init scsi: fnic: correct speed display and add support for 25,40 and 100G scsi: fnic: added timestamp reporting in fnic debug stats ...
2017-07-05Merge branch 'work.misc-set_fs' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs Pull misc user access cleanups from Al Viro: "The first pile is assorted getting rid of cargo-culted access_ok(), cargo-culted set_fs() and field-by-field copyouts. The same description applies to a lot of stuff in other branches - this is just the stuff that didn't fit into a more specific topical branch" * 'work.misc-set_fs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: Switch flock copyin/copyout primitives to copy_{from,to}_user() fs/fcntl: return -ESRCH in f_setown when pid/pgid can't be found fs/fcntl: f_setown, avoid undefined behaviour fs/fcntl: f_setown, allow returning error lpfc debugfs: get rid of pointless access_ok() adb: get rid of pointless access_ok() isdn: get rid of pointless access_ok() compat statfs: switch to copy_to_user() fs/locks: don't mess with the address limit in compat_fcntl64 nfsd_readlink(): switch to vfs_get_link() drbd: ->sendpage() never needed set_fs() fs/locks: pass kernel struct flock to fcntl_getlk/setlk fs: locks: Fix some troubles at kernel-doc comments
2017-07-03t10-pi: Move opencoded contants to common headerDmitry Monakhov
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2017-07-01scsi: lpfc: don't double count abort errorsDan Carpenter
If lpfc_nvmet_unsol_fcp_issue_abort() fails then we accidentally increment "tgtp->xmt_abort_rsp_error" and then two lines later we increment it a second time. Fixes: 547077a44b3b ("scsi: lpfc: Adding additional stats counters for nvme.") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-07-01scsi: lpfc: spin_lock_irq() is not nestableDan Carpenter
We're calling spin_lock_irq() multiple times, the problem is that on the first spin_unlock_irq() then we will re-enable IRQs and we don't want that. Fixes: 966bb5b71196 ("scsi: lpfc: Break up IO ctx list into a separate get and put list") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-06-26Merge remote-tracking branch 'jl/locks-4.13' into work.misc-set_fsAl Viro
2017-06-26scsi: lpfc: fix refcount error on node listJames Smart
A change in remote port removal introduced a spurious put which can cause a premature structure teardown. The affects were most notable when the driver attempted to unload as a null pointer would be hit. Fix by removing the unnecessary put. Signed-off-by: James Smart <james.smart@broadcom.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-06-26scsi: lpfc: Fix nvme io stoppage after link bounceJames Smart
On link down, transport is calling driver to abort outstanding ios. Driver erroneously rejects the abort if the port indicates it isn't logged in - which will be the case after the link down. Thus, the io can't clean up. This prevents reconnection at the transport level. Fix by allowing abort to proceed. Signed-off-by: James Smart <james.smart@broadcom.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-06-19scsi: lpfc: update to revision to 11.4.0.1James Smart
Set lpfc driver revision to 11.4.0.1 Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-06-19scsi: lpfc: Driver responds LS_RJT to Beacon Off ELS - LinuxJames Smart
Beacon OFF from switch is rejected by driver. Driver fails Beacon OFF if frequency is set to 0. As per fc-ls spec, status, capability, frequency and duration fields are only applicable for Beacon ON. Remove frequency and type checks. Reject Beacon ON if duration is non zero. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-06-19scsi: lpfc: Fix crash in lpfc_sli_ringtxcmpl_put when nvmet gets an abort ↵James Smart
request. When running nvme detach-ns /dev/nvme0n1 -n 1 command, the nvmet lpfc driver crashes with this stack dump: kernel BUG at /root/NVME/lpfc_8.4/lpfc_sli.c:1393! invalid opcode: 0000 [#1] SMP Workqueue: nvmet-fc-cpu0 nvmet_fc_do_work_on_cpu [nvmet_fc] lpfc_sli4_issue_wqe+0x357/0x440 [lpfc] lpfc_nvmet_xmt_fcp_abort+0x36b/0x5c0 [lpfc] nvmet_fc_abort_op+0x30/0x50 [nvmet_fc] nvmet_fc_do_work_on_cpu+0xd9/0x130 [nvmet_fc] process_one_work+0x14e/0x410 worker_thread+0x116/0x490 kthread+0xc7/0xe0 ret_from_fork+0x3f/0x70 Crash is due to an uninitialized iocbq->vport pointer. Explicitly set the iocbq->vport field to phba->pport in lpfc_nvmet_sol_fcp_issue_abort as it does all abort iocbq initialization in the routine. Using phba->pport is ok because target does not support NPIV instances. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-06-19scsi: lpfc: Fix crash doing IO with resetsJames Smart
During every reset, IOCBs are allocated. So, at one point, number of allocated IOCBs reaches maximum limit and lpfc_sli_next_iotag fails. Allocate IOCBs only during initialization. Reuse them after every reset instead of allocating new set of IOCBs. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-06-19scsi: lpfc: Fix crash after firmware flash when IO is running.James Smart
OS crashes after the completion of firmware download. Failure in posting SCSI SGL buffers because number of SGL buffers is less than total count. Some of the pending IOs are not completed by driver. SGL buffers for these IOs are not added back to the list. Pending IOs are not completed because lpfc_wq_list list is initialized before completion of pending IOs. Postpone lpfc_wq_list reinitialization by moving lpfc_sli4_queue_destroy() after lpfc_hba_down_post(). Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-06-19scsi: lpfc: Fix SLI3 drivers attempting NVME ELS commands.James Smart
In a server with an 8G adapter and a 32G adapter, running NVME and FCP, the server would crash with the following stack. RIP: 0010: ... lpfc_nvme_register_port+0x38/0x420 [lpfc] lpfc_nlp_state_cleanup+0x154/0x4f0 [lpfc] lpfc_nlp_set_state+0x9d/0x1a0 [lpfc] lpfc_cmpl_prli_prli_issue+0x35f/0x440 [lpfc] lpfc_disc_state_machine+0x78/0x1c0 [lpfc] lpfc_cmpl_els_prli+0x17c/0x1f0 [lpfc] lpfc_sli_sp_handle_rspiocb+0x39b/0x6b0 [lpfc] lpfc_sli_handle_slow_ring_event_s3+0x134/0x2d0 [lpfc] lpfc_work_done+0x8ac/0x13b0 [lpfc] lpfc_do_work+0xf1/0x1b0 [lpfc] Crash, on the 8G adapter, is due to a vport which does not have a nvme local port structure. It's not supposed to have one. NVME is not supported on the 8G adapter, so the NVME PRLI, which started this flow shouldn't have been sent in the first place. Correct discovery engine to recognize when on an SLI3 rport, which doesn't support SLI3, if the rport supports only NVME, don't send a NVME PRLI. Instead, as no FC4 will be used, a LOGO is sent. If rport is FCP and NVME, only execute the SCSI PRLI. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-06-19scsi: lpfc: Break up IO ctx list into a separate get and put listJames Smart
Since unsol rcv ISR and command cmpl ISR both access/lock this list, separate get/put lists will reduce contention. Replaced struct list_head lpfc_nvmet_ctx_list; with struct list_head lpfc_nvmet_ctx_get_list; struct list_head lpfc_nvmet_ctx_put_list; and all correpsonding locks and counters. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-06-19scsi: lpfc: Reduce time spent in IRQ for received NVME commandsJames Smart
Removed unnecessary bzero of context area. Due to size of sg list, added a substantial delay and played havoc on cpu caches. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-06-19scsi: lpfc: Vport creation is failing with "Link Down" errorJames Smart
Vport creation fails for SLI-3 adapters. Mailbox submission fails because mailbox interrupt is disabled. Mailbox interrupt is disabled during port reset. Do reset only for physical port. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-06-19scsi: lpfc: Fix nvme_info sysfs output to be consistentJames Smart
First line of nvme_info output is not consistent. There is an Extra colon in the format. First line of output will contain one of the following strings: NVME Initiator Enabled NVME Target Enabled NVME Disabled Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-06-19scsi: lpfc: Fix system panic when express lane enabled.James Smart
There is a null pointer dereference that can happen in the FOF interrupt handler. The driver was not setting up cq->assoc_qp_for sli4_hba->oas_cq. Initialize cq->assoc_qp before accessing it. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-06-12scsi: lpfc: update to revision to 11.4.0.0James Smart
Set lpfc driver revision to 11.4.0.0 Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-06-12scsi: lpfc: Add auto EQ delay logicJames Smart
Administrator intervention is currently required to get good numbers when switching from running latency tests to IOPS tests. The configured interrupt coalescing values will greatly effect the results of these tests. Currently, the driver has a single coalescing value set by values of the module attribute. This patch changes the driver to support auto-configuration of the coalescing value based on the total number of outstanding IOs and average number of CQEs processed per interrupt for an EQ. Values are checked every 5 seconds. The driver defaults to the automatic selection. Automatic selection can be disabled by the new lpfc_auto_imax module_parameter. Older hardware can only change interrupt coalescing by mailbox command. Newer hardware supports change via a register. The patch support both. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-06-12scsi: lpfc: Fix defects reported by Coverity ScanJames Smart
Addressed the following reported defects: ** CID 1411552: Control flow issues (MISSING_BREAK) /drivers/scsi/lpfc/lpfc_sli.c: 13259 in lpfc_sli4_nvmet_handle_rcqe() ** CID 1411553: Memory - illegal accesses (OVERRUN) /drivers/scsi/lpfc/lpfc_sli.c: 16218 in lpfc_fc_frame_check() ** CID 1411553: Memory - illegal accesses (OVERRUN) Overrunning array "lpfc_rctl_names" of 202 8-byte elements at element index 244 (byte offset 1952) using index "fc_hdr->fh_r_ctl" (which evaluates to 244). ** CID 1411554: Null pointer dereferences (REVERSE_INULL) /drivers/scsi/lpfc/lpfc_nvmet.c: 2131 in lpfc_nvmet_unsol_fcp_abort_cmp() ** CID 1411555: Memory - illegal accesses (UNINIT) /drivers/scsi/lpfc/lpfc_nvmet.c: 180 in lpfc_nvmet_ctxbuf_post() Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-06-12scsi: lpfc: Fix vports not logging into targetJames Smart
vports cannot login to target. For vports, lpfc_nodelist is allocated for targets only on completion of GFF_ID command. Driver checks if lpfc_nodelist exists for target before sending GFF_ID. So, GFF_ID and PLOGI are not sent. As mentioned by the comment in lpfc_prep_node_fc4type() routine, do not send GFF_ID only if this NPortID is previously identified as FCP target. Send GFF_ID if it is a newly identified remote port from GID_FT response. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-06-12scsi: lpfc: Fix PRLI retry handling when target rejects it.James Smart
The nvmet driver was rejecting the initiator's PRLI because its reg_rpi for the PLOGI was still outstanding. The initiator would resend the PRLI without delay and get the same answer. The PRLI retries would exhaust causing the nvme initiator to set the nvmet ndlp to UNMAPPED. The driver's lpfc_els_retry handler did not have a policy for an LS_RJT with explanation CMD_IN_PROGRESS for PRLI or NVME_PRLI. This caused the delay to remain at 0 but retry set 1. Fix: When the ELS response is LS_RJT, TPC and the command was PRLI or NVME_PRLI, just set the delay to 1000 mS to get a 1 second delay on the PRLI retry. This was enough to allow the REG_RPI to complete at the target. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-06-12scsi: lpfc: Null pointer dereference when log_verbose is set to 0xffffffffJames Smart
Kernel panic when log_verbose is set to 0xffffffff phba->pport is dereferenced before it is initialized Fix: Do not dereference phba->pport if it is NULL Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-06-12scsi: lpfc: Fix System panic after loading the driverJames Smart
System panic with general protection fault during driver load The driver uses a static array sli4_hba.handler_name to store the irq handler names. If the io_channel_irqs exceeds the pre-allocated size (32+1), then the driver will overwrite other fields of sli4_hba. Fix: Dynamically allocate handler_name. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-06-12scsi: lpfc: Fix crash on powering off BFS VM with passthrough deviceJames Smart
Null pointer dereference when BFS VM is powered off The driver incorrectly uses sli3_ring on SLI-4 adapters Use the correct ring structure based on sli_rev Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <james.smart@broadcom.com> Tested-by: Raphael Silva <raphasil@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>