History log of /linux-master/drivers/scsi/bfa/bfa.h
Revision Date Author Comments
# 37126399 22-Feb-2024 Arnd Bergmann <arnd@arndb.de>

scsi: bfa: Fix function pointer type mismatch for state machines

The bfa driver is full of state machines and a generic abstraction layer
for them. This relies on casting function pointers, but that is no longer
allowed when CONFIG_CFI_CLANG is enabled and causes a huge number of
warnings like:

drivers/scsi/bfa/bfad.c:169:3: error: cast from 'void (*)(struct bfad_s *, enum bfad_sm_event)' to 'bfa_sm_t' (aka 'void (*)(void *, int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
bfa_sm_set_state(bfad, bfad_sm_created);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Rework the mechanism to no longer require the function pointer casts, by
having separate types for each individual state machine. This in turn
requires moving the enum definitions for each state machine into the header
files in order to define the typedef.

Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20240222124433.2046570-2-arnd@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# b6960023 22-Feb-2024 Arnd Bergmann <arnd@arndb.de>

scsi: bfa: Fix function pointer type mismatch for hcb_qe->cbfn

Some callback functions used here take a boolean argument, others take a
status argument. This breaks KCFI type checking, so clang now warns about
the function pointer cast:

drivers/scsi/bfa/bfad_bsg.c:2138:29: error: cast from 'void (*)(void *, enum bfa_status)' to 'bfa_cb_cbfn_t' (aka 'void (*)(void *, enum bfa_boolean)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]

Assuming the code is actually correct here and the callers always match the
argument types of the callee, rework this to replace the explicit cast with
a union of the two pointer types. This does not change the behavior of the
code, so if something is actually broken here, a larger rework may be
necessary.

Fixes: 37ea0558b87a ("[SCSI] bfa: Added support to collect and reset fcport stats")
Fixes: 3ec4f2c8bff2 ("[SCSI] bfa: Added support to configure QOS and collect stats.")
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20240222124433.2046570-1-arnd@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 52fa7bf9 29-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 292

Based on 1 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license gpl version 2
as published by the free software foundation this program is
distributed in the hope that it will be useful but without any
warranty without even the implied warranty of merchantability or
fitness for a particular purpose see the gnu general public license
for more details

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

has been chosen to replace the boilerplate/reference in 66 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190529141901.606369721@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# fb24ea52 22-Feb-2019 Will Deacon <will@kernel.org>

drivers: Remove explicit invocations of mmiowb()

mmiowb() is now implied by spin_unlock() on architectures that require
it, so there is no reason to call it from driver code. This patch was
generated using coccinelle:

@mmiowb@
@@
- mmiowb();

and invoked as:

$ for d in drivers include/linux/qed sound; do \
spatch --include-headers --sp-file mmiowb.cocci --dir $d --in-place; done

NOTE: mmiowb() has only ever guaranteed ordering in conjunction with
spin_unlock(). However, pairing each mmiowb() removal in this patch with
the corresponding call to spin_unlock() is not at all trivial, so there
is a small chance that this change may regress any drivers incorrectly
relying on mmiowb() to order MMIO writes between CPUs using lock-free
synchronisation. If you've ended up bisecting to this commit, you can
reintroduce the mmiowb() calls using wmb() instead, which should restore
the old behaviour on all architectures other than some esoteric ia64
systems.

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>


# 31e1d569 26-Nov-2015 Anil Gurumurthy <anil.gurumurthy@qlogic.com>

bfa: File header and user visible string changes

Signed-off-by: Sudarsana Kalluru <sudarsana.kalluru@qlogic.com>
Signed-off-by: Anil Gurumurthy <anil.gurumurthy@qlogic.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 889d0d42 26-Nov-2015 Anil Gurumurthy <anil.gurumurthy@qlogic.com>

bfa: Update copyright messages

Signed-off-by: Sudarsana Kalluru <sudarsana.kalluru@qlogic.com>
Signed-off-by: Anil Gurumurthy <anil.gurumurthy@qlogic.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# db9d8a75 13-Mar-2012 Krishna Gudipati <kgudipat@brocade.com>

[SCSI] bfa: Revised Fabric Assigned Address(FAA) feature implementation.

Made changes to the Fabric Assigned Address(FAA) feature implementation.
Introduced the IOCFC state machine, which now handles the FAA logic,
IOC and BFA sub-modules enablement.
Removed un-wanted FAA enable/disable routines; FAA is enabled by default.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>


# 83763d59 20-Jul-2011 Krishna Gudipati <kgudipat@brocade.com>

[SCSI] bfa: Introduced initiator based lun masking feature.

- Added support to enable initiator based lun masking.
- Initiator based Lun masking works similar to zoning where
initiator port is allowed to see only those LUNs which are
configured to be seen.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>


# 45c5dc1d 20-Jul-2011 Krishna Gudipati <kgudipat@brocade.com>

[SCSI] bfa: Add support to store driver configuration in flash.

- Added dconf (Driver Config) BFA sub-module.
- The dconf sub-module provides interfaces and manages flash writes
to the flash DRV parition.
- dconf sub-module also ensures that the whole 64K DRV partition is updated
on a flash write.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>


# 37ea0558 20-Jul-2011 Krishna Gudipati <kgudipat@brocade.com>

[SCSI] bfa: Added support to collect and reset fcport stats

- Added support to collect and reset fcport stats.
- Modified design to allow multiple requests for fcport stats.
- fcport will remember the stats request in its stats_pending
queue and service each of the queued requests after receiving
a firmware response for the prior request.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>


# ca6e0ea7 20-Jul-2011 Krishna Gudipati <kgudipat@brocade.com>

[SCSI] bfa: Update RME interrupt handling.

- Made changes to always acknowledge RME interrupt and update
consumer index (CI) when RME interrupt is generated.
- Made changes to have ASIC specific hw_rspq_ack() handler.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>


# 5a54b1d5 24-Jun-2011 Krishna Gudipati <kgudipat@brocade.com>

[SCSI] bfa: Added support for flash configuration

- Added flash sub-module.
- Implemented the interface to read/erase/update flash partition.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>


# 60138066 24-Jun-2011 Krishna Gudipati <kgudipat@brocade.com>

[SCSI] bfa: Extend BSG interface.

- Added support to collect driver/fw stats.
- Added support to perform adapter/ioc enable, disable operations.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>


# 4507025d 24-Jun-2011 Krishna Gudipati <kgudipat@brocade.com>

[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>


# 3fd45980 24-Jun-2011 Krishna Gudipati <kgudipat@brocade.com>

[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>


# a714134a 24-Jun-2011 Krishna Gudipati <kgudipat@brocade.com>

[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>


# 775c7742 13-Jun-2011 Krishna Gudipati <kgudipat@brocade.com>

[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>


# 11189208 13-Jun-2011 Krishna Gudipati <kgudipat@brocade.com>

[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>


# 8f4bfadd 26-Dec-2010 Jing Huang <huangj@brocade.com>

[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>


# d4b671c5 26-Dec-2010 Jing Huang <huangj@brocade.com>

[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>


# f16a1750 09-Dec-2010 Maggie Zhang <xmzhang@brocade.com>

[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>


# b77ee1fb 09-Dec-2010 Maggie Zhang <xmzhang@brocade.com>

[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>


# f7f73812 09-Dec-2010 Maggie Zhang <xmzhang@brocade.com>

[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>


# df0f1933 09-Dec-2010 Maggie Zhang <xmzhang@brocade.com>

[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>


# acdc79a6 18-Oct-2010 Jing Huang <huangj@brocade.com>

[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>


# 53440260 18-Oct-2010 Jing Huang <huangj@brocade.com>

[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>


# a36c61f9 15-Sep-2010 Krishna Gudipati <kgudipat@brocade.com>

[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>