[SCSI] libfcoe: add fcoe_transport structure defines to include/scsi/libfcoe.h
authorYi Zou <yi.zou@intel.com>
Sat, 29 Jan 2011 00:04:50 +0000 (16:04 -0800)
committerJames Bottomley <James.Bottomley@suse.de>
Sat, 12 Feb 2011 17:05:29 +0000 (11:05 -0600)
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>
include/scsi/libfcoe.h

index feb6a94c90eae10c8c23207134caebe69ac52b6a..efb6ae5b94ad7a44e221edb54cab3eb06093bb3e 100644 (file)
@@ -231,5 +231,53 @@ static inline bool is_fip_mode(struct fcoe_ctlr *fip)
        return fip->state == FIP_ST_ENABLED;
 }
 
+/* helper for FCoE SW HBA drivers, can include subven and subdev if needed. The
+ * modpost would use pci_device_id table to auto-generate formatted module alias
+ * into the corresponding .mod.c file, but there may or may not be a pci device
+ * id table for FCoE drivers so we use the following helper for build the fcoe
+ * driver module alias.
+ */
+#define MODULE_ALIAS_FCOE_PCI(ven, dev) \
+       MODULE_ALIAS("fcoe-pci:"        \
+               "v" __stringify(ven)    \
+               "d" __stringify(dev) "sv*sd*bc*sc*i*")
+
+/* the name of the default FCoE transport driver fcoe.ko */
+#define FCOE_TRANSPORT_DEFAULT "fcoe"
+
+/* struct fcoe_transport - The FCoE transport interface
+ * @name:      a vendor specific name for their FCoE transport driver
+ * @attached:  whether this transport is already attached
+ * @list:      list linkage to all attached transports
+ * @match:     handler to allow the transport driver to match up a given netdev
+ * @create:    handler to sysfs entry of create for FCoE instances
+ * @destroy:   handler to sysfs entry of destroy for FCoE instances
+ * @enable:    handler to sysfs entry of enable for FCoE instances
+ * @disable:   handler to sysfs entry of disable for FCoE instances
+ */
+struct fcoe_transport {
+       char name[IFNAMSIZ];
+       bool attached;
+       struct list_head list;
+       bool (*match) (struct net_device *device);
+       int (*create) (struct net_device *device, enum fip_state fip_mode);
+       int (*destroy) (struct net_device *device);
+       int (*enable) (struct net_device *device);
+       int (*disable) (struct net_device *device);
+};
+
+/**
+ * struct netdev_list
+ * A mapping from netdevice to fcoe_transport
+ */
+struct fcoe_netdev_mapping {
+       struct list_head list;
+       struct net_device *netdev;
+       struct fcoe_transport *ft;
+};
+
+/* fcoe transports registration and deregistration */
+int fcoe_transport_attach(struct fcoe_transport *ft);
+int fcoe_transport_detach(struct fcoe_transport *ft);
 
 #endif /* _LIBFCOE_H */