diff options
author | Robert Love <robert.w.love@intel.com> | 2012-05-22 22:06:16 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-05-23 04:38:11 -0400 |
commit | fd8f89027d816cb023edf6bfd4c744f194150a05 (patch) | |
tree | 39bee0ea5c853794a3e6e9500758b7577b65351a /drivers/scsi/bnx2fc/bnx2fc.h | |
parent | 619fe4bed415e5d8a4749937f42b6a8a9031d4aa (diff) |
[SCSI] bnx2fc: Allocate fcoe_ctlr with bnx2fc_interface, not as a member
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>
Diffstat (limited to 'drivers/scsi/bnx2fc/bnx2fc.h')
-rw-r--r-- | drivers/scsi/bnx2fc/bnx2fc.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/scsi/bnx2fc/bnx2fc.h b/drivers/scsi/bnx2fc/bnx2fc.h index f2b8875a6863..0578fa0dc14b 100644 --- a/drivers/scsi/bnx2fc/bnx2fc.h +++ b/drivers/scsi/bnx2fc/bnx2fc.h | |||
@@ -228,13 +228,16 @@ struct bnx2fc_interface { | |||
228 | struct packet_type fip_packet_type; | 228 | struct packet_type fip_packet_type; |
229 | struct workqueue_struct *timer_work_queue; | 229 | struct workqueue_struct *timer_work_queue; |
230 | struct kref kref; | 230 | struct kref kref; |
231 | struct fcoe_ctlr ctlr; | ||
232 | u8 vlan_enabled; | 231 | u8 vlan_enabled; |
233 | int vlan_id; | 232 | int vlan_id; |
234 | bool enabled; | 233 | bool enabled; |
235 | }; | 234 | }; |
236 | 235 | ||
237 | #define bnx2fc_from_ctlr(fip) container_of(fip, struct bnx2fc_interface, ctlr) | 236 | #define bnx2fc_from_ctlr(x) \ |
237 | ((struct bnx2fc_interface *)((x) + 1)) | ||
238 | |||
239 | #define bnx2fc_to_ctlr(x) \ | ||
240 | ((struct fcoe_ctlr *)(((struct fcoe_ctlr *)(x)) - 1)) | ||
238 | 241 | ||
239 | struct bnx2fc_lport { | 242 | struct bnx2fc_lport { |
240 | struct list_head list; | 243 | struct list_head list; |