diff options
author | Robert Love <robert.w.love@intel.com> | 2012-05-22 22:06:10 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-05-23 04:36:27 -0400 |
commit | 619fe4bed415e5d8a4749937f42b6a8a9031d4aa (patch) | |
tree | 8b52f6fd4b2ba58ef898f628aba8ab49111e1aa8 /include/scsi/libfcoe.h | |
parent | b7e94a1686c5daef4f649f7f4f839cc294f07710 (diff) |
[SCSI] fcoe: Allocate fcoe_ctlr with fcoe_interface, not as a member
Currently the fcoe_ctlr associated with an interface is allocated
as a member of struct fcoe_interface. This causes problems when
attempting to use the new fcoe_sysfs APIs which allow us to allocate
the fcoe_interface as private data to the 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
contains the fcoe_ctlr and its private data is the fcoe_interface.
This patch only allocates the fcoe_interface with the fcoe_ctlr, the
fcoe_ctlr_device will be added in a later patch, which will complete
the below diagram-
+------------------+
| fcoe_ctlr_device |
+------------------+
| fcoe_ctlr |
+------------------+
| fcoe_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>
Diffstat (limited to 'include/scsi/libfcoe.h')
-rw-r--r-- | include/scsi/libfcoe.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h index cfdb55f0937e..69eca4b7ce2b 100644 --- a/include/scsi/libfcoe.h +++ b/include/scsi/libfcoe.h | |||
@@ -159,6 +159,15 @@ struct fcoe_ctlr { | |||
159 | }; | 159 | }; |
160 | 160 | ||
161 | /** | 161 | /** |
162 | * fcoe_ctlr_priv() - Return the private data from a fcoe_ctlr | ||
163 | * @cltr: The fcoe_ctlr whose private data will be returned | ||
164 | */ | ||
165 | static inline void *fcoe_ctlr_priv(const struct fcoe_ctlr *ctlr) | ||
166 | { | ||
167 | return (void *)(ctlr + 1); | ||
168 | } | ||
169 | |||
170 | /** | ||
162 | * struct fcoe_fcf - Fibre-Channel Forwarder | 171 | * struct fcoe_fcf - Fibre-Channel Forwarder |
163 | * @list: list linkage | 172 | * @list: list linkage |
164 | * @time: system time (jiffies) when an advertisement was last received | 173 | * @time: system time (jiffies) when an advertisement was last received |