Commit Graph

188 Commits (e4a9c3732cea3e3c8c704aad86636090ffe6b25f)

Author SHA1 Message Date
Krishna Gudipati d7be54cc5c [SCSI] bfa: FCS bug fixes.
- Added logic to initiate a PLOGI to the target, while processing a LOGO
  from the same target in Direct attach mode.
- Added logic to generate a FCCT Reject indicating unsupported command,
  upon receiving FCCT/FCGS requests.
- Added logic to set the fcpim in offline state and avoid any PRLI retries
  if a PRLI response is a reject with a reason Command Not Supported.
- Updated the FDMI Supported/Current speeds.
- Added logic to wait for the response  from the firmware before sending
  ACC to PLOGI and transitioning to subsequent states - while processing an
  Incoming PLOGI in online state.
- Added a wait state in the fcs_vport state machine - For case where
  FDISC is in progress and we get a vport delete request we wait for
  fdisc response and will transition to the appropriate state based on
  rsp status, else its causing both driver/fw resources to be not
  freed.
- Remove the fc_credit_recovery module param.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-06-29 17:12:11 -05:00
Krishna Gudipati 4507025d01 [SCSI] bfa: DMA memory allocation enhancement.
- Modified the design such that each BFA sub-module will provide
  the amount of DMA and KVA memory needed by it and queues the
  same request to the global dma and kva info queues.
- During the memory allocation we iterate over this queue to allocate
  the dma and kva memory requested by sub-modules.
- The change is needed to avoid requesting the aggregate amount of memory
  needed by all the BFA sub-modules as one contiguous chunk.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-06-29 17:11:09 -05:00
Krishna Gudipati 3fd459804f [SCSI] bfa: Brocade-1860 Fabric Adapter vHBA support.
- Introduced partitioning of the BFA resources.
- Added h/w queue ID in CPE messages, firmware uses h/w queue ID
  from messages to pick a matching RME queue.
- Added message header to bfa_reqq_produce(). h/w queue ID is set
  in the message header and firmware modules use h/w queue ID from
  message header instead of from cpqe event.
- Made changes to allow using all 256 queues of Brocade-1860 asic.
  Previously only a single queue per queue group was used.
- Added function tag to BFI message header. Only used by FC BFI
  messages.  Used to translate host tag to firmware tag. bfa_lpuid()
  is changed to bfa_fn_lpu() that encodes both PCI function and port
  ID in BFI message header.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-06-29 17:02:28 -05:00
Krishna Gudipati 10a0737924 [SCSI] bfa: Brocade-1860 Fabric Adapter PLL init fixes.
- If flash controller is halted unconditionally, this results in
  illegal write access to flash controller register domain. Since
  flash controller registers are only accessible once s_clk is started
  - added logic to check for WGN status and halt flash controller only
  if it is already running.
- Added check to wait for flash controller halt to be completed before
  proceeding with s_clk/l_clk initializations.
- Removed unnecessary reset logic for PMM 1T memory and moved memory
  initialization after flash access enable.
- Disable Brocade-1860 asic MBOX interrupt before PLL initialization.
- Remove reset enable for S_CLK/L_CLK after both PLL initializations
  are complete.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-06-29 16:59:59 -05:00
Krishna Gudipati a714134a85 [SCSI] bfa: Added Fabric Assigned Address(FAA) support
- Updated/added data structures and definitions to support FAA protocol.
- Modified the IOC state machine to support FAA.
- Introduced FAA feature configuration - enable/disable/query.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-06-29 16:59:01 -05:00
Krishna Gudipati 5a0adaedff [SCSI] bfa: IOC bug fixes.
- Add logic to handle the case where PCI mapping goes away when
  IOCPF state machine is waiting for semaphore.
- Added logic to unlock hw semaphore if the previos FW boot was
  from flash based and the current FW initialization attempt is from OS.
- Added fix to update hbfails and hb_count stats during hwerror event.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-06-29 16:57:52 -05:00
Krishna Gudipati 1a4d8e1bd8 [SCSI] bfa: Enable ASIC block configuration and query.
- Added ASIC block configuration APIs:
	- to create/delete/update the physical functions
	- to do adapter/port mode configuration
	- to query the current ASIC block configuration.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-06-29 16:56:05 -05:00
Krishna Gudipati 7bb66fc06e [SCSI] bfa: Update the driver version to 3.0.2.0
Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-06-29 16:04:05 -05:00
Krishna Gudipati b85daafe46 [SCSI] bfa: Add BSG interface to support ELS, CT and vendor commands.
- Added BSG interface support to BFA driver
- Adds support to send ELS/CT FC passthru commands and
  few vendor specific BSG requests.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-06-29 15:59:53 -05:00
Krishna Gudipati 75332a70a8 [SCSI] bfa: Driver initialization and model description fix
- Moved FCS initialization, which internally does the im_port creation
  as well as the scsi_host creation before bfa_init.

Once the bfa_init is complete & successful:
- Reset the FCS base port cfg params such as pwwn/nwwn and setup fc host
  params - based on the values learned during the ioc getattr request.
- Change needed to support BSG commands even on bfa init failure.
- Model description fixes for Brocade adapters.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-06-29 15:56:05 -05:00
Krishna Gudipati e2187d7f38 [SCSI] bfa: Enhancement for fcpim and IO tag handling.
- Enhancements to FCPIM module.
- Introduced IO tag management to allocate/release IOs to FCPIM module
  from a free IOtag pool.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-06-29 15:54:23 -05:00
Krishna Gudipati be540a991e [SCSI] bfa: FC credit recovery and misc bug fixes.
- Introduce FC credit recovery.
- Added module parameter to enable/disable credit recovery.

Bug Fixes:
- Removed check for ignoring plogi from initiator in switched fabric mode.
- The ABTS for PLOGI is going out few millisecs earlier due to FW
  timer calibration (around 300 miilisecs earlier). So there is a
  window if an accept comes during this time HBA would have initiated
  an ABORT.
- Added 1 to FC_ELS_TOV for compensating for FW timer.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-06-29 15:52:21 -05:00
Krishna Gudipati 8b070b4a02 [SCSI] bfa: Brocade-1860 Fabric Adapter 16Gbs support and flash controller fixes.
- Added support for 16Gbps.
- Added logic to flush pending mailbox command queue when IOC is disabled.
- Fix to Halt the flash controller during fw initialization - since
  when asic blck is programmed flash controller's continuous access
  blocks f/w access to flash.
- Added new asic based card types and modified IOC get card model routine.
- Added PLL init fix to do LPU reset every time we do a memory
  initialization, since not doing so will cause LPU to be
  uninitialized during driver load.
- Added fix to Halt flash controller before PLL initialization.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-06-29 15:50:50 -05:00
Krishna Gudipati 775c7742ad [SCSI] bfa: IOC and PLL init changes for Brocade-1860 Fabric Adapter.
- Introduced IOC poll mechanism which replaces current interrupt
  based FW READY method.
- The timer based poll routine in IOC will query the ioc_fwstate
  register to see if there is a state change in FW, and sends the READY event.
- Bug fixes in the new asic PLL initialization.
- Added logic to handle CPE/RME queue interrupts before iocfc config done.
  1. Use the queue_process flag to see if iocfc configuration is done
     in INTX mode.
  2. Split the MSIX handler installation in two - one for IOC intr
     handler and the other for cpe/rme queue handler - and delay
     assigning queue handlers until iocfc config is done in MSIX mode.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-06-29 15:46:19 -05:00
Krishna Gudipati dd5aaf4536 [SCSI] bfa: Changes to support vport disable and enable operations.
Made changes to FCS lport, vport state machines to support vport
enable / disable operations.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-06-29 15:37:48 -05:00
Krishna Gudipati 111892082e [SCSI] bfa: Brocade-1860 Fabric Adapter Hardware Enablement
- Added support for Brocade-1860 Fabric Adapter.
- Made changes to support single firmware image per asic type.
- Combined bfi_cbreg.h and bfi_ctreg.h defines into bfi_reg.h with
  only minimal defines used by host.
- Added changes to setup CPE/RME Queue register offsets based on
  firmware response.
- Removed queue register offset initializations and added register offsets
  to BFI config response message.
- Added Brocade-1860 asic specific interrupt status definitions and
  mailbox interfaces.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-06-29 15:31:31 -05:00
Krishna Gudipati 43ffdf4dfb [SCSI] bfa: Add pbc port disable check and fix LPS message name
- Add PBC port Disabled condition check.
- Rename incorrectly named LPS I2H messages.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-06-29 15:27:46 -05:00
Krishna Gudipati d37779f8d9 [SCSI] bfa: Introduce IOC event notification mechanism.
Introduced a generic event notification callback function that
receives IOC_ENABLED, IOC_DISABLED, IOC_FAILED events and notifies the
modules registered for these events.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-06-29 15:25:57 -05:00
Krishna Gudipati 85ce928dbb [SCSI] bfa: Introduced generic address len pair to represent DMA memory chunk.
- Avoid the use of hardware defined structure bfi_sge_s for DMA
  requests in host.

- Defined a generic address len pair to represent a DMA memory chunk
  (bfi_alen_s).

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2011-06-29 15:24:46 -05:00
Jing Huang 45d7f0cc58 [SCSI] bfa: kdump fix
Root cause: When kernel crashes, bfa IOC state machine and FW doesn't get
a notification and hence are not cleanly shutdown. So registers holding
driver/IOC state information are not reset back to valid disabled/parking
values. This causes subsequent driver initialization to hang during kdump
kernel boot.

Fix description: during the initialization of first PCI function, reset
corresponding register when unclean shutown is detect by reading chip
registers. This will make sure that ioc/fw gets clean re-initialization.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <jbottomley@parallels.com>
2011-05-24 12:38:02 -04:00
Krishna Gudipati 7c38c05b3e [SCSI] bfa: Move debugfs initialization before bfa init.
Move the initialization of debugfs before bfa init, to enable us to
collect driver/firmware traces if init fails.  Also add a printk to
display message on bfa_init failure.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-05-01 10:55:56 -05:00
Jing Huang 61338a0b34 [SCSI] bfa: firmware download fix
This patch includes fixes for two issues releated to firmware download
implementation: 1) Merged memory leak fix provided by Jesper Juhl
<jj@chaosbits.net>. Basically we need to call release_firmware() after
request_firmware(). 2) fixed issues with the firmware download interface
as pointed out by Rolf Eike Beer <eike@sf-mail.de> in linux-scsi. Rearranged
the code and fixed related function protypes.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-05-01 10:53:49 -05:00
Lucas De Marchi 25985edced Fix common misspellings
Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2011-03-31 11:26:23 -03:00
Linus Torvalds 008d23e485 Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (43 commits)
  Documentation/trace/events.txt: Remove obsolete sched_signal_send.
  writeback: fix global_dirty_limits comment runtime -> real-time
  ppc: fix comment typo singal -> signal
  drivers: fix comment typo diable -> disable.
  m68k: fix comment typo diable -> disable.
  wireless: comment typo fix diable -> disable.
  media: comment typo fix diable -> disable.
  remove doc for obsolete dynamic-printk kernel-parameter
  remove extraneous 'is' from Documentation/iostats.txt
  Fix spelling milisec -> ms in snd_ps3 module parameter description
  Fix spelling mistakes in comments
  Revert conflicting V4L changes
  i7core_edac: fix typos in comments
  mm/rmap.c: fix comment
  sound, ca0106: Fix assignment to 'channel'.
  hrtimer: fix a typo in comment
  init/Kconfig: fix typo
  anon_inodes: fix wrong function name in comment
  fix comment typos concerning "consistent"
  poll: fix a typo in comment
  ...

Fix up trivial conflicts in:
 - drivers/net/wireless/iwlwifi/iwl-core.c (moved to iwl-legacy.c)
 - fs/ext4/ext4.h

Also fix missed 'diabled' typo in drivers/net/bnx2x/bnx2x.h while at it.
2011-01-13 10:05:56 -08:00
Jing Huang 8f4bfadd20 [SCSI] bfa: remove unused defintions and misc cleanups
This patch removes unused functions, data strucutres, and definitions.  It
also includes misc comment and formatting cleanups.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-31 09:43:31 -06:00
Jing Huang 2f2f40a458 [SCSI] bfa: remove inactive functions
This patch removes some inactive functions and macros.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-31 09:38:53 -06:00
Jing Huang d4b671c58e [SCSI] bfa: replace bfa_assert with WARN_ON
Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-31 09:36:53 -06:00
Jiri Kosina 4b7bd36470 Merge branch 'master' into for-next
Conflicts:
	MAINTAINERS
	arch/arm/mach-omap2/pm24xx.c
	drivers/scsi/bfa/bfa_fcpim.c

Needed to update to apply fixes for which the old branch was too
outdated.
2010-12-22 18:57:02 +01:00
Krishna Gudipati 395eb20238 [SCSI] bfa: Update the driver version to 2.3.2.3
Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-21 12:37:18 -06:00
Krishna Gudipati 15821f05b7 [SCSI] bfa: io tag handling and minor bug fix.
Fix iotag handling:

1) Update and check io tag for retry case.
2) Clearing upper 3 bits in io tag when an IO completes.
   The 3 upper bits in io tags are used for counting FCP exchange retry.
   Un-cleared bits will cause firmware to access invalid memory when the
   same io tag is used for an IO to a target that doesn't support FCP
   exchange retry.
3) Only check the effective bits when validating an iotag.

Other minor fixes:

1) Added trace to get FC header type with assert of unhandled packet received.
   Ignore the type FC_TYPE_FC_FSS (FC_XS).
2) Fixed the adapter info display check - to check for fcmode flag even.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-21 12:37:17 -06:00
Krishna Gudipati b704495c67 [SCSI] bfa: direct attach mode fix.
- Direct attach is not working due to the check of PID in fcxp_send request.
- Added logic to set the lps->lp_pid with the PID assigned for n2n mode.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-21 12:37:16 -06:00
Krishna Gudipati f1d584d70f [SCSI] bfa: IOC auto recovery fix.
- Made IOC auto_recovery synchronized and not timer based.
- Only one PCI function will attempt to recover and reinitialize
  the ASIC on a failure, after all the active PCI fns
  acknowledge the IOC failure.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-21 12:37:15 -06:00
Krishna Gudipati f3a060ca57 [SCSI] bfa: Store port configuration in flash for persistency.
When the bfa driver is loaded a flogi is sent without the knowledge of
trunking configuration. This normal flogi causes the switch ports
which had trunking enabled to go to persistent offline.  Solution is
to store the port configuration (which has trunking info) in the flash
for persistency. The firmware will read this configuration when the
very first fcport enable is received.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-21 12:37:12 -06:00
Krishna Gudipati 4e78efefa3 [SCSI] bfa: IOC fwtrace save logic & state machine fixes.
- Move fw trace save logic to bfa_ioc_sm_fail_entry(),
  so that fw trace is saved irrespective of the cause of the failure.
- Make bfa_ioc_sm_fail() a failure parking state.
- Rename bfa_ioc_sm_initfail() to a more appropriate bfa_ioc_sm_fail_retry()
  as it is no longer a parking state.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-21 12:37:11 -06:00
Maggie Zhang da99dcc98d [SCSI] bfa: remove unused functions and misc cleanups
Remove unused functions and fix checkpatch errors. Misc cleanups in
comment and formatting.

Signed-off-by: Maggie Zhang <xmzhang@brocade.com>
Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-21 12:32:58 -06:00
Maggie Zhang f16a17507b [SCSI] bfa: remove all OS wrappers
Remove OS wrapper functions/macros, and as a result remove bfa_os_inc.h.

Signed-off-by: Maggie Zhang <xmzhang@brocade.com>
Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-21 12:32:56 -06:00
Maggie Zhang f314878ab9 [SCSI] bfa: remove all SCSI IO callbacks
Remove SCSI IO callbacks, and as a result remove bfa_cb_ioim.h.

Signed-off-by: Maggie Zhang <xmzhang@brocade.com>
Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-21 12:32:47 -06:00
Maggie Zhang e3e7d3eebb [SCSI] bfa: scatter gather processing change
Modified scatter gather processing to use the kernel provided
scsi_for_each_sg() macro.

1) Instead of allocating and setting up sgpg in bfa_ioim_sge_setup(),
   we only do allocation.  As a result, we remove
   bfa_ioim_sgpg_setup() and rename bfa_ioim_sge_setup() to
   bfa_ioim_sgpg_alloc().

2) bfa_ioim_send_ioreq() call scsi_for_each_sg() to handle both inline
   and sgpg setup.

Signed-off-by: Maggie Zhang <xmzhang@brocade.com>
Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-21 12:32:45 -06:00
Maggie Zhang b77ee1fb10 [SCSI] bfa: remove a file with small size
Removed bfa_drv.c, merged it to bfa_core.c and modified Makefile.

Signed-off-by: Maggie Zhang <xmzhang@brocade.com>
Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-21 12:32:44 -06:00
Maggie Zhang f7f73812e9 [SCSI] bfa: clean up one line functions
Cleaned up one line functions.

Signed-off-by: Maggie Zhang <xmzhang@brocade.com>
Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-21 12:32:43 -06:00
Maggie Zhang df0f1933eb [SCSI] bfa: remove unused and empty functions
Removed unused and empty functions.

Signed-off-by: Maggie Zhang <xmzhang@brocade.com>
Signed-off-by: Jing Huang <xmzhang@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-21 12:24:50 -06:00
Maggie 50444a3400 [SCSI] bfa: fix endianess sparse check warnings
First round of fix for the endianess check warnings from make C=2 CF="-D__CHECK_ENDIAN__".

Signed-off-by: Maggie <xmzhang@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-21 12:24:17 -06:00
Maggie 52f94b6fd0 [SCSI] bfa: fix regular sparse check warnings.
Fix all sparse check warnings from make C=2.

Signed-off-by: Maggie <xmzhang@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-21 12:24:16 -06:00
Jing Huang 8816624222 [SCSI] bfa: rename log_level to bfa_log_level
Rename log_level to bfa_log_level to make the global variable more bfa
specific and avoid clashes with other drivers which was causing a
build failure.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-12-20 12:28:34 -06:00
Jeff Garzik f281233d3e SCSI host lock push-down
Move the mid-layer's ->queuecommand() invocation from being locked
with the host lock to being unlocked to facilitate speeding up the
critical path for drivers who don't need this lock taken anyway.

The patch below presents a simple SCSI host lock push-down as an
equivalent transformation.  No locking or other behavior should change
with this patch.  All existing bugs and locking orders are preserved.

Additionally, add one parameter to queuecommand,
	struct Scsi_Host *
and remove one parameter from queuecommand,
	void (*done)(struct scsi_cmnd *)

Scsi_Host* is a convenient pointer that most host drivers need anyway,
and 'done' is redundant to struct scsi_cmnd->scsi_done.

Minimal code disturbance was attempted with this change.  Most drivers
needed only two one-line modifications for their host lock push-down.

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Acked-by: James Bottomley <James.Bottomley@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-11-16 13:33:23 -08:00
Uwe Kleine-König b595076a18 tree-wide: fix comment/printk typos
"gadget", "through", "command", "maintain", "maintain", "controller", "address",
"between", "initiali[zs]e", "instead", "function", "select", "already",
"equal", "access", "management", "hierarchy", "registration", "interest",
"relative", "memory", "offset", "already",

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-11-01 15:38:34 -04:00
Jing Huang 5fbe25c7a6 [SCSI] bfa: fix comments for c files
This patch addresses the comments from Randy Dunlap (Randy.Dunlap@oracle.com)
regarding comment blocks that begining with "/**". bfa driver comments
currently do not follow kernel-doc convention, we hence replace all
/** with /* and **/ with */.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25 16:28:09 -05:00
Jing Huang acdc79a60c [SCSI] bfa: fix comments for header files
This patch addresses the comments from Randy Dunlap (Randy.Dunlap@oracle.com)
regarding comment blocks that begining with "/**". bfa driver comments
currently do not follow kernel-doc convention, we hence replace all
/** with /* and **/ with */.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25 16:26:57 -05:00
Jing Huang e0a08a30c9 [SCSI] bfa: fix frame size over 1024 compile warning
Fix compile warning for frame size over 1024 in gcc 4.4.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25 16:25:35 -05:00
Jing Huang 5344026065 [SCSI] bfa: remove os wrapper functions and macros
This patch replaces register access functions and macros with the the ones
provided by linux.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25 16:18:20 -05:00
Jing Huang ba816ea8e2 [SCSI] bfa: replace endian swap macros with the ones provided by linux
Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25 16:17:14 -05:00
Jing Huang 6a18b1675f [SCSI] bfa: remove os wrapper and unused functions
This patch removes os wrapper and unused functions.
bfa_os_assign(), bfa_os_memset(), bfa_os_memcpy(), bfa_os_udelay()
bfa_os_vsprintf(), bfa_os_snprintf(), and bfa_os_get_clock() are replaced with
direct assignment or native linux functions. Some unused functions related to VF
(Vitual fabric) are also removed.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-10-25 16:15:58 -05:00
Krishna Gudipati a36c61f902 [SCSI] bfa: cleanup driver
We have flattened the BFA hierarchy and also reduced the number of
source and header files we used to have earlier.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-09-16 22:54:24 -04:00
Linus Torvalds 26df0766a7 Merge branch 'params' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus
* 'params' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus: (22 commits)
  param: don't deref arg in __same_type() checks
  param: update drivers/acpi/debug.c to new scheme
  param: use module_param in drivers/message/fusion/mptbase.c
  ide: use module_param_named rather than module_param_call
  param: update drivers/char/ipmi/ipmi_watchdog.c to new scheme
  param: lock if_sdio's lbs_helper_name and lbs_fw_name against sysfs changes.
  param: lock myri10ge_fw_name against sysfs changes.
  param: simple locking for sysfs-writable charp parameters
  param: remove unnecessary writable charp
  param: add kerneldoc to moduleparam.h
  param: locking for kernel parameters
  param: make param sections const.
  param: use free hook for charp (fix leak of charp parameters)
  param: add a free hook to kernel_param_ops.
  param: silence .init.text references from param ops
  Add param ops struct for hvc_iucv driver.
  nfs: update for module_param_named API change
  AppArmor: update for module_param_named API change
  param: use ops in struct kernel_param, rather than get and set fns directly
  param: move the EXPORT_SYMBOL to after the definitions.
  ...
2010-08-12 10:01:59 -07:00
Andrew Morton a737b88df8 scsi: remove private BIT macros
A couple of scsi drivers define a BIT() macro, duplicating the one in
bitops.h.

Cc: Jing Huang <huangj@brocade.com>
Cc: Robert Love <robert.w.love@intel.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-08-11 08:59:01 -07:00
Roel Kluin 6de61f9d24 bfa: wrong fcport H2I message tested in bfa_fcport_isr()
It appears that the wrong fcport H2I message was tested

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Acked-by: Jing Huang <huangj@Brocade.COM>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-08-11 08:59:01 -07:00
Yong Zhang 6d154db6b3 scsi: bfa: correct onstack wait_queue_head declaration
Use DECLARE_WAIT_QUEUE_HEAD_ONSTACK to make lockdep happy

Signed-off-by: Yong Zhang <yong.zhang0@gmail.com>
Cc: Jing Huang <huangj@brocade.com>
Cc: James E.J. Bottomley <James.Bottomley@suse.de>
Cc: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-08-11 08:59:01 -07:00
Rusty Russell d6d1b650ae param: simple locking for sysfs-writable charp parameters
Since the writing to sysfs can free the old one, we need to block that
when we access the charp variables.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Phil Carmody <ext-phil.2.carmody@nokia.com>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Dan Williams <dcbw@redhat.com>
Cc: John W. Linville <linville@tuxdriver.com>
Cc: Jing Huang <huangj@brocade.com>
Cc: James E.J. Bottomley <James.Bottomley@suse.de>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: David S. Miller <davem@davemloft.net>
Cc: user-mode-linux-devel@lists.sourceforge.net
Cc: libertas-dev@lists.infradead.org
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: linux-scsi@vger.kernel.org
Cc: linux-usb@vger.kernel.org
2010-08-11 23:04:31 +09:30
Linus Torvalds 3cfc2c42c1 Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (48 commits)
  Documentation: update broken web addresses.
  fix comment typo "choosed" -> "chosen"
  hostap:hostap_hw.c Fix typo in comment
  Fix spelling contorller -> controller in comments
  Kconfig.debug: FAIL_IO_TIMEOUT: typo Faul -> Fault
  fs/Kconfig: Fix typo Userpace -> Userspace
  Removing dead MACH_U300_BS26
  drivers/infiniband: Remove unnecessary casts of private_data
  fs/ocfs2: Remove unnecessary casts of private_data
  libfc: use ARRAY_SIZE
  scsi: bfa: use ARRAY_SIZE
  drm: i915: use ARRAY_SIZE
  drm: drm_edid: use ARRAY_SIZE
  synclink: use ARRAY_SIZE
  block: cciss: use ARRAY_SIZE
  comment typo fixes: charater => character
  fix comment typos concerning "challenge"
  arm: plat-spear: fix typo in kerneldoc
  reiserfs: typo comment fix
  update email address
  ...
2010-08-04 15:31:02 -07:00
Jing Huang ab2a9ba189 [SCSI] bfa: add debugfs support
- Add debugfs support to obtain firmware trace, driver trace
  and read/write to registers.

- debugfs hierarchy:
  /sys/kernel/debug/bfa/host#
   where the host number corresponds to the one under /sys/class/scsi_host/host#

- Following are the new debugfs entries added:
  drvtrc: collect current driver trace
  fwtrc: collect current firmware trace.
  fwsave: collect last saved fw trace as a result of firmware crash.
  regwr: write one word to chip register
  regrd: read one or more words from chip register.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:04:32 -05:00
Jing Huang 08a17ced7a [SCSI] bfa: update driver version string
Update driver version to 2.2.2.1

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:04:29 -05:00
Jing Huang c54d557c3f [SCSI] bfa: vport fixes
This patch fixes 3 bugs in vport create/delete.
1) Replace scsi_add_host() with scsi_add_host_with_dma()
2) Fix rmmod hang when there are vports configured. This is due to a race
condition between the workqueue destroy in pci remove context and the vport
delete works being handled. The fix is to use a counter to track the
vport delete work, so that workqueue destroy will not be called until all
configured vports are deleted from workqueue.
3) Fix rmmmod crash when there are PBC vport configured. PBC is not allowed
to be deleted dynamically. However, if someone try to delete it, it leaves the
vport is wrong state. The fix is to restore the vport back to original state
when the attempt to delete pbc vport delete is failed.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:04:28 -05:00
Jing Huang 8a4adf1c90 [SCSI] bfa: fix wrong arg to callback
This patch fixes the issue of passing wrong argument to callback function.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:04:26 -05:00
Jing Huang ba8345821a [SCSI] bfa: add ioc state checking
This patch adds ioc state checking while enabling a port.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:04:23 -05:00
Jing Huang 604158ade0 [SCSI] bfa: add description for module parameters
Add description for bfa driver module parameters.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:04:22 -05:00
Jing Huang 07b2838669 [SCSI] bfa: update to support BOFM
Update bfa driver API and data structure to support BOFM (IBM BladeCenter
Open Fabric Manager).

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:04:21 -05:00
Jing Huang 56d218fc93 [SCSI] bfa: fix possible IO double completion
While processing the ioim in callback functions, the ioim is still in io_q.
During this time, if the itnim goes offline, the ioim is requeued from
itnim->io_q into itnim->delay_comp_q although the request is already completed.
This results in requeing the ioim into the callback queue if the ioim is not
freed by the time the ioim is requeued. This results in double completion of
the ioim. To fix this, whenever a response is received from firmware for an
ioim, deque it from io_q and enque to fcpim->comp_q. This will eliminate any
possibility of itnim picking any ioim for which the response is already
received.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:04:20 -05:00
Jing Huang db954c04cb [SCSI] bfa: fix link state structure
When the FCoE Linkup event is sent to the host, the link_state
(struct bfa_pport_link_s) structure is copied to the RME buf to be sent to
the host. But the size of this structure(164 bytes) is larger than the
reserved RME buffer size(128 byes). The following changes reduce the size
of the structure to be less than RME buffer size(128 bytes):
- Remove the trunk and loop info from link_state structure, because both trunk
  and loop are not supported.
- Combine qos_vc_attr and fcf into an union.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:04:18 -05:00
Jing Huang 36d345a703 [SCSI] bfa: add dynamic queue selection
Add new bfa functionality to support dynamic queue selection (IO redirection).
IO redirection can only be enabled when QoS is disabled.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:04:17 -05:00
Jing Huang 4b5e759dca [SCSI] bfa: fix uf post and rport fcpim state machine
BFA UF module did not hold lock when seding uf post buffer message to firmware
causing CPE-Q corruption. Fix is to check present of FCS and if FCS present
hold lock while posting UF buffers.

Handle PRLO with sending acc to it and relogin with rport. Discard fcxp
before any state change.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:04:16 -05:00
Jing Huang df2a52a6c8 [SCSI] bfa: fix chip and memory initialization
Clear PSS memory reset that is set as part of power-on-reset (pci reset).
Complete PMM memory reset before BISTR start. Clear EDRAM BISTR start bit
after fixed delay. BISTR DONE bit status is not getting set. Use a fixed
1ms delay for BISTR now. Expose PMM IT memory definitions to host.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:04:15 -05:00
Jing Huang 9aeb6802dd [SCSI] bfa: update to support firmware configuation
Update related data structures to support firmeare configuration.
Add AEN events related to firmware configuation.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:04:14 -05:00
Jing Huang 3e98cc013f [SCSI] bfa: add PBC port disable handling
Add PBC port disable handling in BFA and return the appropriate status from
BFA APIs. In bfa_fcs_lport.c, handle OFFLINE event to avoid BFA_ASSERT.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:04:13 -05:00
Jing Huang 41188cf5a6 [SCSI] bfa: fix prli retry issues
Add a max retry limit for PRLI retries. Max retry limit (5) is same as used
in rport PLOGI. Once the retries are exhausted, invoke rport offline so that
existing logic of rport re-discovery can kick-in. Also fixed a bug in rport.c
where one less retry was happening.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:04:11 -05:00
Jing Huang c507341713 [SCSI] bfa: fix rport speed setting
When a rport goes offline, its speed setting was not reset. Subsequently, if
the rport was not deleted due to it coming back online within rport del
timeout, previously discovered speed would continue to show up. The fix is to
reset the speed when processing rport offline transition.

In rport attributes, rport's with unknown speed were indicated as TRL
enforced.  The right thing do to would be to use TRL default speed to
determine if TRL is enforced, when TRL is enabled.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:04:10 -05:00
Jing Huang 7c8146510c [SCSI] bfa: fix interrupt coalescing setting
Do not update the coalesce flag of the intr_attr struct in driver config area
on config response.  This is to prevent the coalesce flag being reported as on
after an ioc disable/enable even if it was set to off before disable.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:04:09 -05:00
Jing Huang 4f1806bc3c [SCSI] bfa: use standards defined timeout for ELS/CT
Use standards defined 2 * RA_TOV as a timeout for ELS Request retries.
And standards defined 3 * RA_TOV as a timeout for FC-CT Request retries.
Also, added a check to send RPSC2 to a Brocade Fabric only.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:04:08 -05:00
Jing Huang b85d045ee8 [SCSI] bfa: statistics and typo fix
- Added time stamp for fcport stats reset
- Added new fileds to the statistics data structures.
- Typo removal and minor cleanup.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:04:07 -05:00
Jing Huang 15b64a835d [SCSI] bfa: ioc attributes fix
This patch fixes the APIs to obtain ioc attributes
- fix API to obtain wwpn, wwnn, and mac.
- add API to get mfg wwpn, wwnn, and mac.
- fix API to obtain wwn of boot target.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:04:06 -05:00
Jing Huang 1769f990fc [SCSI] bfa: vport state machine fix
Vport state machine does not cleanup associated lport in some states: while
waiting for fdisc response or fdisc failure state. The fixe is to cleanup lport
on vport delete in all states.  In fdisc state, discard fdisc response and
delete lport and wait for lport deletecompletion. in error state, delete lport
and wait for delete completion.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:04:05 -05:00
Jing Huang d9883548a0 [SCSI] bfa: PBC vport create
This patch enables creating PBC vport.
During fcs init, fcs will read PBC vport using bfa iocfc API and invoke fcb
callback to add the pbc vport entries into a list. The pbc vport list will be
traversed in the subsequent pci probe process and vport will be created using
fc transport provided vport create function.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:04:04 -05:00
Jing Huang ed96932470 [SCSI] bfa: enable basic PBC support
The patch includes the driver side changes to enable basic PBC (PreBoot
Configuration) feature.
- Data structure changes and new definitions for PBC.
- APIs to access PBC info.
- Remove unused code.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:04:04 -05:00
Jing Huang 293f82d59e [SCSI] bfa: enable new hardware
This patch enables support of new mezzanine cards for HP and IBM blade server.

- Add new pciids for HP and IBM mezzanine card.
- Add a new firmware image for HP mezzanine card, which is running in
  FC only mode. Rename firmware image to reflect the difference. Change the
  firmware download code accordingly for the above changes.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-07-27 12:04:03 -05:00
Kulikov Vasiliy 501af8d110 scsi: bfa: use ARRAY_SIZE
Change sizeof(x) / sizeof(*x) to ARRAY_SIZE(x).

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-07-20 17:14:35 +02:00
Uwe Kleine-König 698f93159a fix comment/printk typos concerning "already"
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-07-11 21:45:40 +02:00
Jiri Kosina f1bbbb6912 Merge branch 'master' into for-next 2010-06-16 18:08:13 +02:00
Uwe Kleine-König 421f91d21a fix typos concerning "initiali[zs]e"
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-06-16 18:05:05 +02:00
Krishna Gudipati 7873ca4e44 [SCSI] bfa: fix system crash when reading sysfs fc_host statistics
The port data structure related to fc_host statistics collection is
not initialized. This causes system crash when reading the fc_host
statistics. The fix is to initialize port structure during driver
attach.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-05-25 10:05:40 -05:00
Linus Torvalds 33cf23b0a5 Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (182 commits)
  [SCSI] aacraid: add an ifdef'd device delete case instead of taking the device offline
  [SCSI] aacraid: prohibit access to array container space
  [SCSI] aacraid: add support for handling ATA pass-through commands.
  [SCSI] aacraid: expose physical devices for models with newer firmware
  [SCSI] aacraid: respond automatically to volumes added by config tool
  [SCSI] fcoe: fix fcoe module ref counting
  [SCSI] libfcoe: FIP Keep-Alive messages for VPorts are sent with incorrect port_id and wwn
  [SCSI] libfcoe: Fix incorrect MAC address clearing
  [SCSI] fcoe: fix a circular locking issue with rtnl and sysfs mutex
  [SCSI] libfc: Move the port_id into lport
  [SCSI] fcoe: move link speed checking into its own routine
  [SCSI] libfc: Remove extra pointer check
  [SCSI] libfc: Remove unused fc_get_host_port_type
  [SCSI] fcoe: fixes wrong error exit in fcoe_create
  [SCSI] libfc: set seq_id for incoming sequence
  [SCSI] qla2xxx: Updates to ISP82xx support.
  [SCSI] qla2xxx: Optionally disable target reset.
  [SCSI] qla2xxx: ensure flash operation and host reset via sg_reset are mutually exclusive
  [SCSI] qla2xxx: Silence bogus warning by gcc for wrap and did.
  [SCSI] qla2xxx: T10 DIF support added.
  ...
2010-05-21 07:19:18 -07:00
Jing Huang 8637ac3340 [SCSI] bfa: fix compilation warning in powerpc
Fix the compilation warning in powerpc. The same change also fixes endian
issue we found in powerpc test. This patch has been tested in x86 and
powerpc platform. it is created using scsi-misc-2.6.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-05-01 14:12:11 -05:00
Jiri Kosina 6c9468e9eb Merge branch 'master' into for-next 2010-04-23 02:08:44 +02:00
Jing Huang 077424e2e2 [SCSI] bfa: sg addr big endian fix
sg address in IO request is not set up correctly for big endian platform.
add new macros to properly swap the address.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 09:24:23 -05:00
Jing Huang 42b426ecb4 [SCSI] bfa: protect idr using bfad_mutex
idr is a global resource, protect it with global bfad_mutex.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 09:24:20 -05:00
Jing Huang b3522f08ec [SCSI] bfa: use pci_iomap() and pci_iounmap()
Use pci_iomap() and pci_iounmap() to simplify the code. Remove uncessary #ifdef
check for ia64 (it was added as a workaound for some RHEL 5.x release which
doesn't export iounmap function)

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 09:24:19 -05:00
Jing Huang 2eba0d4c00 [SCSI] bfa: fix the issue of not handling scsi_cmnd sg chaining case
Currently the driver doesn't take into consideraion of possible sg chaining
when it walks through the sg list. This is fixed by using the sg_next()
which automatically handles the chaining case. Obosolete code is removed
as a result of this change.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 09:24:17 -05:00
Jing Huang b504293fe9 [SCSI] bfa: add fc transport class based vport create/delete
Use duplicate fc transport template for physical and vitual port. Add
vport create/delete/disalbe functions in the transport template of physical
port. Changes to make the vport create/delete function to work under this
framework.

Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 09:24:16 -05:00
Julia Lawall 4644efabde [SCSI] bfa: eliminate useless code
The variable bfa_itnim is initialized twice to the same (side effect-free)
expression.  Drop one initialization.

A simplified version of the semantic match that finds this problem is:
(http://coccinelle.lip6.fr/)

// <smpl>
@forall@
idexpression *x;
identifier f!=ERR_PTR;
@@

x = f(...)
... when != x
(
x = f(...,<+...x...+>,...)
|
* x = f(...)
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Jing Huang <huangj@brocade.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-04-11 09:23:32 -05:00
Tejun Heo 5a0e3ad6af include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files.  percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed.  Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability.  As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

  http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
  only the necessary includes are there.  ie. if only gfp is used,
  gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
  blocks and try to put the new include such that its order conforms
  to its surrounding.  It's put in the include block which contains
  core kernel includes, in the same order that the rest are ordered -
  alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
  doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
  because the file doesn't have fitting include block), it prints out
  an error message indicating which .h file needs to be added to the
  file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
   over 4000 files, deleting around 700 includes and adding ~480 gfp.h
   and ~3000 slab.h inclusions.  The script emitted errors for ~400
   files.

2. Each error was manually checked.  Some didn't need the inclusion,
   some needed manual addition while adding it to implementation .h or
   embedding .c file was more appropriate for others.  This step added
   inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
   from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
   e.g. lib/decompress_*.c used malloc/free() wrappers around slab
   APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
   editing them as sprinkling gfp.h and slab.h inclusions around .h
   files could easily lead to inclusion dependency hell.  Most gfp.h
   inclusion directives were ignored as stuff from gfp.h was usually
   wildly available and often used in preprocessor macros.  Each
   slab.h inclusion directive was examined and added manually as
   necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
   were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
   distributed build env didn't work with gcov compiles) and a few
   more options had to be turned off depending on archs to make things
   build (like ipr on powerpc/64 which failed due to missing writeq).

   * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
   * powerpc and powerpc64 SMP allmodconfig
   * sparc and sparc64 SMP allmodconfig
   * ia64 SMP allmodconfig
   * s390 SMP allmodconfig
   * alpha SMP allmodconfig
   * um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
   a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-30 22:02:32 +09:00
Thomas Weber 8839316121 Fix typos in comments
[Ss]ytem => [Ss]ystem
udpate => update
paramters => parameters
orginal => original

Signed-off-by: Thomas Weber <swirl@gmx.li>
Acked-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-03-16 11:47:56 +01:00
Krishna Gudipati d55f88f027 [SCSI] bfa: Update the driver version to 2.1.2.1.
Upgrade the upstream driver from 2.0.0.0 to 2.1.2.1.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-03-07 13:28:38 +05:30