linux/drivers/scsi/bnx2fc
Robert Love 9d34876f82 libfcoe: Make fcoe_sysfs optional / fix fnic NULL exception
fnic doesn't use any of the create/destroy/enable/disable interfaces
either from the (legacy) module paramaters or the (new) fcoe_sysfs
interfaces. When fcoe_sysfs was introduced fnic wasn't changed since
it wasn't using the interfaces. libfcoe incorrectly assumed that that
all of its users were using fcoe_sysfs and when adding and deleting
FCFs would assume the existance of a fcoe_ctlr_device. fnic was not
allocating this structure because it doesn't care about the standard
user interfaces (fnic starts on link only). If/When libfcoe tried to use
the fcoe_ctlr_device's lock for the first time a NULL pointer exception
would be triggered.

Since fnic doesn't care about sysfs or user interfaces, the solution
is to drop libfcoe's assumption that all drivers are using fcoe_sysfs.

This patch accomplishes this by changing some of the structure
relationships.

We need a way to determine when a LLD is using fcoe_sysfs or not and
we can do that by checking for the existance of the fcoe_ctlr_device.
Prior to this patch, it was assumed that the fcoe_ctlr structure was
allocated with the fcoe_ctlr_device and immediately followed it in
memory. To reach the fcoe_ctlr_device we would simply go back in memory
from the fcoe_ctlr to get the fcoe_ctlr_device.

Since fnic doesn't allocate the fcoe_ctlr_device, we cannot keep that
assumption. This patch adds a pointer from the fcoe_ctlr to the
fcoe_ctlr_device. For bnx2fc and fcoe we will continue to allocate the
two structures together, but then we'll set the ctlr->cdev pointer
to point at the fcoe_ctlr_device. fnic will not change and will continue
to allocate the fcoe_ctlr itself, and ctlr->cdev will remain NULL.

When libfcoe adds fcoe_fcf's to the fcoe_ctlr it will check if ctlr->cdev
is set and only if so will it continue to interact with fcoe_sysfs.

Signed-off-by: Robert Love <robert.w.love@intel.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Tested-by: Hiral Patel <hiralpat@cisco.com>
2013-10-11 13:25:40 -07:00
..
57xx_hsi_bnx2fc.h New 7.0 FW: bnx2x, cnic, bnx2i, bnx2fc 2011-06-15 10:56:37 -04:00
Kconfig cnic: Fix select dependencies in bnx2fc/bnx2i Kconfig. 2011-08-12 03:00:47 -07:00
Makefile [SCSI] bnx2fc: Reduce object size by consolidating formats 2012-07-20 08:58:17 +01:00
bnx2fc.h [SCSI] bnx2fc: Bumped version to 1.0.14 2013-05-02 07:32:26 -07:00
bnx2fc_constants.h cnic: Fix parity error code conflict 2012-03-21 21:57:36 -04:00
bnx2fc_debug.c [SCSI] bnx2fc: Reduce object size by consolidating formats 2012-07-20 08:58:17 +01:00
bnx2fc_debug.h [SCSI] bnx2fc: Reduce object size by consolidating formats 2012-07-20 08:58:17 +01:00
bnx2fc_els.c [SCSI] bnx2fc: Update copyright dates 2013-05-02 07:32:25 -07:00
bnx2fc_fcoe.c libfcoe: Make fcoe_sysfs optional / fix fnic NULL exception 2013-10-11 13:25:40 -07:00
bnx2fc_hwi.c [SCSI] bnx2fc: Update copyright dates 2013-05-02 07:32:25 -07:00
bnx2fc_io.c [SCSI] bnx2fc: Update copyright dates 2013-05-02 07:32:25 -07:00
bnx2fc_tgt.c [SCSI] bnx2fc: Update copyright dates 2013-05-02 07:32:25 -07:00