Skip to content

Commit 0ade7d2

Browse files
yizouJames Bottomley
authored andcommitted
[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>
1 parent 21b7b2f commit 0ade7d2

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

‎include/scsi/libfcoe.h‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,5 +231,53 @@ static inline bool is_fip_mode(struct fcoe_ctlr *fip)
231231
return fip->state == FIP_ST_ENABLED;
232232
}
233233

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);
234282

235283
#endif /* _LIBFCOE_H */

0 commit comments

Comments
 (0)