diff options
author | Yi Zou <yi.zou@intel.com> | 2011-01-28 19:04:50 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2011-02-12 12:05:29 -0500 |
commit | 0ade7d290b6aa8b1626a4077b853c02cd12415c2 (patch) | |
tree | 619937351ebf204f9a70b7518169cd4c50127282 /include/scsi | |
parent | 21b7b2f557f4b105a4b7d739671d1ce6b867d3e6 (diff) |
[SCSI] libfcoe: add fcoe_transport structure defines to include/scsi/libfcoe.h
add the fcoe_transport struct to the common libfcoe.h header so all fcoe
transport provides can use it to attach itself as an fcoe transport. This
is the header part, and the next patch will be the transport code itself.
Signed-off-by: Yi Zou <yi.zou@intel.com>
Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'include/scsi')
-rw-r--r-- | include/scsi/libfcoe.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h index feb6a94c90ea..efb6ae5b94ad 100644 --- a/include/scsi/libfcoe.h +++ b/include/scsi/libfcoe.h | |||
@@ -231,5 +231,53 @@ static inline bool is_fip_mode(struct fcoe_ctlr *fip) | |||
231 | return fip->state == FIP_ST_ENABLED; | 231 | return fip->state == FIP_ST_ENABLED; |
232 | } | 232 | } |
233 | 233 | ||
234 | /* helper for FCoE SW HBA drivers, can include subven and subdev if needed. The | ||
235 | * modpost would use pci_device_id table to auto-generate formatted module alias | ||
236 | * into the corresponding .mod.c file, but there may or may not be a pci device | ||
237 | * id table for FCoE drivers so we use the following helper for build the fcoe | ||
238 | * driver module alias. | ||
239 | */ | ||
240 | #define MODULE_ALIAS_FCOE_PCI(ven, dev) \ | ||
241 | MODULE_ALIAS("fcoe-pci:" \ | ||
242 | "v" __stringify(ven) \ | ||
243 | "d" __stringify(dev) "sv*sd*bc*sc*i*") | ||
244 | |||
245 | /* the name of the default FCoE transport driver fcoe.ko */ | ||
246 | #define FCOE_TRANSPORT_DEFAULT "fcoe" | ||
247 | |||
248 | /* struct fcoe_transport - The FCoE transport interface | ||
249 | * @name: a vendor specific name for their FCoE transport driver | ||
250 | * @attached: whether this transport is already attached | ||
251 | * @list: list linkage to all attached transports | ||
252 | * @match: handler to allow the transport driver to match up a given netdev | ||
253 | * @create: handler to sysfs entry of create for FCoE instances | ||
254 | * @destroy: handler to sysfs entry of destroy for FCoE instances | ||
255 | * @enable: handler to sysfs entry of enable for FCoE instances | ||
256 | * @disable: handler to sysfs entry of disable for FCoE instances | ||
257 | */ | ||
258 | struct fcoe_transport { | ||
259 | char name[IFNAMSIZ]; | ||
260 | bool attached; | ||
261 | struct list_head list; | ||
262 | bool (*match) (struct net_device *device); | ||
263 | int (*create) (struct net_device *device, enum fip_state fip_mode); | ||
264 | int (*destroy) (struct net_device *device); | ||
265 | int (*enable) (struct net_device *device); | ||
266 | int (*disable) (struct net_device *device); | ||
267 | }; | ||
268 | |||
269 | /** | ||
270 | * struct netdev_list | ||
271 | * A mapping from netdevice to fcoe_transport | ||
272 | */ | ||
273 | struct fcoe_netdev_mapping { | ||
274 | struct list_head list; | ||
275 | struct net_device *netdev; | ||
276 | struct fcoe_transport *ft; | ||
277 | }; | ||
278 | |||
279 | /* fcoe transports registration and deregistration */ | ||
280 | int fcoe_transport_attach(struct fcoe_transport *ft); | ||
281 | int fcoe_transport_detach(struct fcoe_transport *ft); | ||
234 | 282 | ||
235 | #endif /* _LIBFCOE_H */ | 283 | #endif /* _LIBFCOE_H */ |