summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bnx2fc/bnx2fc_hwi.c
Commit message (Collapse)AuthorAgeFilesLines
* bnx2fc: fix memory leak in bnx2fc_allocate_hash_table()Maurizio Lombardi2014-05-191-12/+19
| | | | | | | | | In case of error, the bnx2fc_allocate_hash_table() didn't free all the memory it allocated. Signed-off-by: Maurizio Lombardi <mlombard@redhat.com> Acked-by: Eddie Wai <eddie.wai@broadcom.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
* bnx2fc: fix memory leak and potential NULL pointer dereference.Maurizio Lombardi2014-05-191-14/+20
| | | | | | | | | | | | | If bnx2fc_allocate_hash_table() for some reasons fails, it is possible that the hash_tbl_segments or the hash_tbl_pbl pointers are NULL. In this case bnx2fc_free_hash_table() will panic the system. this patch also fixes a memory leak, the hash_tbl_segments pointer was never freed. Signed-off-by: Maurizio Lombardi <mlombard@redhat.com> Acked-by: Eddie Wai <eddie.wai@broadcom.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
* bnx2fc: remove unused variable hash_table_sizeMaurizio Lombardi2014-05-191-3/+0Star
| | | | | | | | hash_table_size is not used by the bnx2fc_free_hash_table() function. Signed-off-by: Maurizio Lombardi <mlombard@redhat.com> Acked-by: Eddie Wai <eddie.wai@broadcom.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
* bnx2x, cnic, bnx2i, bnx2fc: Fix bnx2i and bnx2fc regressions.Michael Chan2013-09-181-2/+1Star
| | | | | | | | | | | | | | | | commit b9871bcfd211d316adee317608dab44c58d6ea2d bnx2x: VF RSS support - PF side changed the configuration of the doorbell HW and it broke iSCSI and FCoE. We fix this by making compatible changes to the doorbell address in bnx2i and bnx2fc. For the userspace driver, we need to pass a modified CID so that the existing userspace driver will calculate the correct doorbell address and continue to work. Signed-off-by: Ariel Elior <ariele@broadcom.com> Signed-off-by: Eddie Wai <eddie.wai@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* [SCSI] bnx2fc: Update copyright datesBhanu Prakash Gollapudi2013-05-021-1/+1
| | | | | Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* [SCSI] bnx2fc: Enable cached tasks to improve performanceBhanu Prakash Gollapudi2013-05-021-1/+5
| | | | | | | | Set perf_config to 3 during firmware initialization to enable both cached connections as well as cached tasks. Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* bnx2x, bnx2fc: Use per port max exchange resourcesBhanu Prakash Gollapudi2013-04-251-9/+13
| | | | | | | | | | | | | | | The firmware supports a maximum of 4K FCoE exchanges. In 4-port devices, or when working in multi-function mode, this resource needs to be distributed between the various possible FCoE functions. This information needs to be calculated by bnx2x and propagated into bnx2fc via cnic. bnx2fc can then use this value to calculate corresponding xid resources instead of using global constants. Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* [SCSI] bnx2fc: Map the doorbell register between offload and enable requestsBhanu Prakash Gollapudi2013-01-301-19/+6Star
| | | | | | | | | | | | | We used to map doorbell register after FW enable request is complete. This causes a race condition when unsolicited event is received, and FW sends a CQE for it. Since the doorbell is not mapped, driver does not arm CQ, which means FW will not notify the driver for further CQ completions. To resolve this, map the doorbell between offload and enable, so that driver is ready to receive the unsolicited packets and arm the CQ as soon as FW enable is performed. Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* [SCSI] bnx2fc: remove useless calls to memset().Cyril Roelandt2013-01-291-4/+0Star
| | | | | | | | | These calls are followed by calls to memcpy() on the same memory area, so they can be safely removed. Signed-off-by: Cyril Roelandt <tipecaml@gmail.com> Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* treewide: fix typo of "suppport" in various commentsMasanari Iida2012-11-191-1/+1
| | | | | Signed-off-by: Masanari Iida <standby24x7@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* [SCSI] bnx2fc: Improve error recovery by handling parity errorsBhanu Prakash Gollapudi2012-07-201-1/+3
| | | | | | | | | | | | | During parity errors, the ramrods are not issued to FW. bnx2fc waits for the timeout value, and proceeds with cleaning up the IOs. Since we are already out-of-sync with FW, cleanup commands timeout too, and do not get the completion. This operation takes 36 secs for each session to upload causing huge delays. To fix this, bnx2fc now gets a PARITY_ERROR from cnic driver, and upon failure, the driver does not issue any commands to the FW and finishes the upload process sooner. Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* [SCSI] bnx2fc: Allocate fcoe_ctlr with bnx2fc_interface, not as a memberRobert Love2012-05-231-18/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the fcoe_ctlr associated with an interface is allocated as a member of struct bnx2fc_interface. This causes problems when when later patches attempt to use the new fcoe_sysfs APIs which allow us to allocate the bnx2fc_interface as private data to a fcoe_ctlr_device instance. The problem is that libfcoe wants to be able use pointer math to find a fcoe_ctlr's fcoe_ctlr_device as well as finding a fcoe_ctlr_device's assocated fcoe_ctlr. To do this we need to allocate the fcoe_ctlr_device, with private data for the LLD. The private data will contain the fcoe_ctlr and its private data will be the bnx2fc_interface. +-------------------+ | fcoe_ctlr_device | +-------------------+ | fcoe_ctlr | +-------------------+ | bnx2fc_interface | +-------------------+ This prep work will allow us to go from a fcoe_ctlr_device instance to its fcoe_ctlr as well as from a fcoe_ctlr to its fcoe_ctlr_device once the fcoe_sysfs API is in use (later patches in this series). Signed-off-by: Robert Love <robert.w.love@intel.com> Tested-by: Ross Brattain <ross.b.brattain@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* bnx2fc: HSI dependent changes for 7.2.xx FWBhanu Prakash Gollapudi2012-02-211-3/+9
| | | | | | | | with Tx only section for single cached SGEs. Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* [SCSI] bnx2fc: No abort issued for REC when it times outBhanu Prakash Gollapudi2011-09-171-2/+4
| | | | | | | | | | ABTS was not issued for timed out REC, as REC completion handler exits out if the IO completed. Check for timed out REC and issue ABTS before proceeding with further processing in REC completion handler. Also, initialize rec_retry and srr_retry before starting the IO. Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* [SCSI] bnx2fc: Fix NULL pointer deref during arm_cq.Bhanu Prakash Gollapudi2011-08-271-3/+7
| | | | | | | | | | | | There exists a race condition between CQ doorbell unmap and IO completion path that arms the CQ which causes a NULL dereference. Protect the ctx_base with cq_lock to avoid this. Also, wait for the CQ doorbell to be successfully mapped before arming the CQ. Also, do not count uncolicited CQ completions for free_sqes. Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* [SCSI] bnx2fc: Update copyright and bump version to 1.0.4Bhanu Prakash Gollapudi2011-07-281-1/+1
| | | | | Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* [SCSI] bnx2fc: Tx BDs cache in write tasksBhanu Prakash Gollapudi2011-07-281-7/+22
| | | | | | | | When there is a single BD for the entire data to be transmitted, use the BD inside the SGL context and set the cached SGE indication in the task context Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* [SCSI] bnx2fc: Do not arm CQ when there are no CQEsBhanu Prakash Gollapudi2011-07-281-2/+4
| | | | | Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* [SCSI] bnx2fc: HSI changes for tapeBhanu Prakash Gollapudi2011-07-281-4/+26
| | | | | | | | Program the firmware task structure with init_flags indicating the device is 'sequence level error recovery' capable. Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* [SCSI] bnx2fc: Handle REC_TOV error code from firmwareBhanu Prakash Gollapudi2011-07-281-29/+111
| | | | | | | | | | Driver decides to initiate REC on REC_TOV timer pop. The firmware maintains the REC timer and informs the driver as a firmware error message, which is an unsolicited event to the driver. Driver also issues REC on other unsolicited events from firmware that indicate data loss. Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* [SCSI] bnx2fc: Support 'sequence cleanup' taskBhanu Prakash Gollapudi2011-07-281-0/+97
| | | | | | | | | | | For the devices that support sequence level error recovery, based on the REC response, the firmware has to be informed about the offset from which the retransmission should happen. Driver initiates sequence cleanup task to firmware so that the firmware can program the task. Upon the sequence cleanup completion, SRR is issued to retransmit the sequence. Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* [SCSI] bnx2fc: Enable REC & CONF support for the sessionBhanu Prakash Gollapudi2011-07-271-0/+12
| | | | | | | | | Based on PRLI response, identify if the target is FCP-2 (seq level error recovery) capable, and appropriately set the corresponding CONF, REC flags when offloading the session. Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* [SCSI] bnx2fc: Introduce interface structure for each vlan interfaceBhanu Prakash Gollapudi2011-07-271-43/+55
| | | | | | | | | | | | | | | | | | Currently, bnx2fc has a hba structure that can work with only a single vlan interface. When there is a change in vlan id, it does not have the capability to switch to different vlan interface. To solve this problem, a new structure called 'interface' has been introduced, and each hba can now have multiple interfaces, one per vlan id. Most of the patch is a moving the interface specific fields from hba to the interface structure, and appropriately modifying the dereferences. A list of interfaces (if_list) is maintained along with adapter list. During a create call, the interface structure is allocated and added to if_list and deleted & freed on a destroy call. Link events are propagated to all interfaces belonging to the hba. Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* [SCSI] bnx2fc: Replace printks with KERN_ALERT to KERN_ERR/KERN_INFOBhanu Prakash Gollapudi2011-07-261-11/+12
| | | | | Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6Linus Torvalds2011-07-231-1/+23
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (77 commits) [SCSI] fix crash in scsi_dispatch_cmd() [SCSI] sr: check_events() ignore GET_EVENT when TUR says otherwise [SCSI] bnx2i: Fixed kernel panic due to illegal usage of sc->request->cpu [SCSI] bfa: Update the driver version to 3.0.2.1 [SCSI] bfa: Driver and BSG enhancements. [SCSI] bfa: Added support to query PHY. [SCSI] bfa: Added HBA diagnostics support. [SCSI] bfa: Added support for flash configuration [SCSI] bfa: Added support to obtain SFP info. [SCSI] bfa: Added support for CEE info and stats query. [SCSI] bfa: Extend BSG interface. [SCSI] bfa: FCS bug fixes. [SCSI] bfa: DMA memory allocation enhancement. [SCSI] bfa: Brocade-1860 Fabric Adapter vHBA support. [SCSI] bfa: Brocade-1860 Fabric Adapter PLL init fixes. [SCSI] bfa: Added Fabric Assigned Address(FAA) support [SCSI] bfa: IOC bug fixes. [SCSI] bfa: Enable ASIC block configuration and query. [SCSI] bnx2i: Updated copyright and bump version [SCSI] bnx2i: Modified to skip CNIC registration if iSCSI is not supported ... Fix up some trivial conflicts in: - drivers/scsi/bnx2fc/{bnx2fc.h,bnx2fc_fcoe.c}: Crazy broadcom version number conflicts - drivers/target/tcm_fc/tfc_cmd.c Just trivial cleanups done on adjacent lines
| * [SCSI] bnx2fc: Fix kernel panic when deleting NPIV portsBhanu Prakash Gollapudi2011-06-291-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | Deleting NPIV port causes a kernel panic when the NPIV port is in the same zone as the physical port and shares the same LUN. This happens due to the fact that vport destroy and unsolicited ELS are scheduled to run on the same workqueue, and vport destroy destroys the lport and the unsolicited ELS tries to access the invalid lport. This patch fixes this issue by maintaining a list of valid lports and verifying if the lport is valid or not before accessing it. Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
* | New 7.0 FW: bnx2x, cnic, bnx2i, bnx2fcVlad Zolotarov2011-06-151-205/+237
|/ | | | | | | | | | | | | | | | | | | | | | | | | | New FW/HSI (7.0): - Added support to 578xx chips - Improved HSI - much less driver's direct access to the FW internal memory needed. New implementation of the HSI handling layer in the bnx2x (bnx2x_sp.c): - Introduced chip dependent objects that have chip independent interfaces for configuration of MACs, multicast addresses, Rx mode, indirection table, fast path queues and function initialization/cleanup. - Objects functionality is based on the private function pointers, which allows not only a per-chip but also PF/VF differentiation while still preserving the same interface towards the driver. - Objects interface is not influenced by the HSI changes which do not require providing new parameters keeping the code outside the bnx2x_sp.c invariant with regard to such HSI chnages. Changes in a CNIC, bnx2fc and bnx2i modules due to the new HSI. Signed-off-by: Vladislav Zolotarov <vladz@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@conan.davemloft.net>
* [SCSI] bnx2fc: introduce missing kfreeJulia Lawall2011-05-011-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Error handling code following a kmalloc should free the allocated data. The semantic match that finds the problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // <smpl> @r exists@ local idexpression x; statement S; expression E; identifier f,f1,l; position p1,p2; expression *ptr != NULL; @@ x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...); ... if (x == NULL) S <... when != x when != if (...) { <+...x...+> } ( x->f1 = E | (x->f1 == NULL || ...) | f(...,x->f1,...) ) ...> ( return \(0\|<+...x...+>\|ptr\); | return@p2 ...; ) @script:python@ p1 << r.p1; p2 << r.p2; @@ print "* file: %s kmalloc %s return %s" % (p1[0].file,p1[0].line,p2[0].line) // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Acked-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
* [SCSI] bnx2fc: Fix MTU issue by using static MTUBhanu Gollapudi2011-03-231-1/+1
| | | | | | | | | bnx2x now uses seperate MTUs for networking and FCoE. FCoE MTU is fixed to 2500 and bnx2fc now needs to match this logic by using FCOE_MTU instead of netdev->mtu. Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
* [SCSI] bnx2fc: Call bnx2fc_return_rqe and bnx2fc_get_next_rqe with tgt lock heldNithin Sujir2011-03-231-2/+11
| | | | | | | | | | | tgt lock is needed during - bnx2fc_return_rqe to protect the rq_prod_idx. bnx2fc_get_next_rqe to protect rq_cons_idx Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
* [SCSI] bnx2fc: Broadcom FCoE offload driverBhanu Gollapudi2011-03-011-0/+1868
This driver is for Broadcom Netxtreme II 57712 chip. The following patch contains the driver sources for bnx2fc driver. libfc/libfcoe changes to enable bnx2fc have already gone through the fcoe tree. bnx2fc is a SCSI low level driver that interfaces with SCSI midlayer, libfc, libfcoe, cnic modules. bnx2fc driver uses services of libfc for slow path operations such as FIP and fabric discovery. The fast path IO perations are performed after offloading the session information to the underlying FCoE firmware. Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@suse.de>