Skip to contentSkip to conversation

add target and host to transport classes

PATCH In review James Bottomley 1 participant 2 messages Sep 7, 2004 – Sep 10, 2004 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add target and host to transport classes

OK, I've polished this up quite a bit, and actually got the implementation to work in the SPI transport classes. It still needs to be commented and have all the failure cases sorted out, but this should be ready to play with. (Obviously, you need the target patch before this will apply.)

James

drivers/scsi/hosts.c +2 -0
diff -Nru a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
@@ -82,6 +82,8 @@
 	set_bit(SHOST_DEL, &shost->shost_state);
 
 	class_device_unregister(&shost->shost_classdev);
+	if (shost->transport_classdev.class)
+		class_device_unregister(&shost->transport_classdev);
 	device_del(&shost->shost_gendev);
 }
 
drivers/scsi/scsi_priv.h +0 -16
diff -Nru a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h
@@ -58,22 +58,6 @@
  */
 #define SCAN_WILD_CARD	~0
 
-/*
- * scsi_target: representation of a scsi target, for now, this is only
- * used for single_lun devices. If no one has active IO to the target,
- * starget_sdev_user is NULL, else it points to the active sdev.
- */
-struct scsi_target {
-	struct scsi_device	*starget_sdev_user;
-	struct device		dev;
-};
-
-#define to_scsi_target(d)	container_of(d, struct scsi_target, dev)
-static inline struct scsi_target *scsi_target(struct scsi_device *sdev)
-{
-	return to_scsi_target(sdev->sdev_gendev.parent);
-}
-
 /* hosts.c */
 extern int scsi_init_hosts(void);
 extern void scsi_exit_hosts(void);
drivers/scsi/scsi_scan.c +15 -40

96 lines not on this page · raw message

drivers/scsi/scsi_sysfs.c +112 -25

213 lines not on this page · raw message

drivers/scsi/scsi_transport_fc.c +4 -4
diff -Nru a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
@@ -156,10 +156,10 @@
 
 	memset(i, 0, sizeof(struct fc_internal));
 
-	i->t.attrs = &i->attrs[0];
-	i->t.class = &fc_transport_class;
-	i->t.setup = &fc_setup_transport_attrs;
-	i->t.size = sizeof(struct fc_transport_attrs);
+	i->t.device_attrs = &i->attrs[0];
+	i->t.device_class = &fc_transport_class;
+	i->t.device_setup = &fc_setup_transport_attrs;
+	i->t.device_size = sizeof(struct fc_transport_attrs);
 	i->f = ft;
 
 	SETUP_ATTRIBUTE_RD(port_id);
drivers/scsi/scsi_transport_spi.c +4 -4
diff -Nru a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c
@@ -666,10 +666,10 @@
 	memset(i, 0, sizeof(struct spi_internal));
 
 
-	i->t.attrs = &i->attrs[0];
-	i->t.class = &spi_transport_class;
-	i->t.setup = &spi_setup_transport_attrs;
-	i->t.size = sizeof(struct spi_transport_attrs);
+	i->t.device_attrs = &i->attrs[0];
+	i->t.device_class = &spi_transport_class;
+	i->t.device_setup = &spi_setup_transport_attrs;
+	i->t.device_size = sizeof(struct spi_transport_attrs);
 	i->f = ft;
 
 	SETUP_ATTRIBUTE(period);
include/scsi/scsi_device.h +25 -0
diff -Nru a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
@@ -129,6 +129,29 @@
 #define transport_class_to_sdev(class_dev) \
 	container_of(class_dev, struct scsi_device, transport_classdev)
 
+/*
+ * scsi_target: representation of a scsi target, for now, this is only
+ * used for single_lun devices. If no one has active IO to the target,
+ * starget_sdev_user is NULL, else it points to the active sdev.
+ */
+struct scsi_target {
+	struct scsi_device	*starget_sdev_user;
+	struct device		dev;
+	unsigned int		id; /* target id ... replace
+				     * scsi_device.id eventually */
+	struct class_device	transport_classdev;
+	unsigned long		create:1; /* signal that it needs to be added */
+	unsigned long		transport_data[0];
+} __attribute__((aligned(sizeof(unsigned long))));
+
+#define to_scsi_target(d)	container_of(d, struct scsi_target, dev)
+static inline struct scsi_target *scsi_target(struct scsi_device *sdev)
+{
+	return to_scsi_target(sdev->sdev_gendev.parent);
+}
+#define transport_class_to_starget(class_dev) \
+	container_of(class_dev, struct scsi_target, transport_classdev)
+
 extern struct scsi_device *__scsi_add_device(struct Scsi_Host *,
 		uint, uint, uint, void *hostdata);
 #define scsi_add_device(host, channel, target, lun) \
@@ -191,6 +214,8 @@
 				 enum scsi_device_state state);
 extern int scsi_device_quiesce(struct scsi_device *sdev);
 extern void scsi_device_resume(struct scsi_device *sdev);
+extern void scsi_target_quiesce(struct scsi_target *);
+extern void scsi_target_resume(struct scsi_target *);
 extern const char *scsi_device_state_name(enum scsi_device_state);
 static inline int scsi_device_online(struct scsi_device *sdev)
 {
include/scsi/scsi_host.h +10 -0
diff -Nru a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
@@ -511,6 +511,13 @@
 	struct list_head sht_legacy_list;
 
 	/*
+	 * Points to the transport data (if any) which is allocated
+	 * separately
+	 */
+	void *transport_data;
+	struct class_device transport_classdev;
+
+	/*
 	 * We should ensure that this is aligned, both for better performance
 	 * and also because some compilers (m68k) don't automatically force
 	 * alignment to a long boundary.
@@ -522,6 +529,9 @@
 	container_of(d, struct Scsi_Host, shost_gendev)
 #define		class_to_shost(d)	\
 	container_of(d, struct Scsi_Host, shost_classdev)
+#define		transport_classdev_to_shost(class_dev) \
+	container_of(class_dev, struct Scsi_Host, transport_classdev)
+
 
 extern struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *, int);
 extern int scsi_add_host(struct Scsi_Host *, struct device *);
include/scsi/scsi_transport.h +15 -7
diff -Nru a/include/scsi/scsi_transport.h b/include/scsi/scsi_transport.h
@@ -24,18 +24,26 @@
 	/* The NULL terminated list of transport attributes
 	 * that should be exported.
 	 */
-	struct class_device_attribute **attrs;
+	struct class_device_attribute **device_attrs;
+	struct class_device_attribute **target_attrs;
+	struct class_device_attribute **host_attrs;
+
 
 	/* The transport class that the device is in */
-	struct class *class;
+	struct class *device_class;
+	struct class *target_class;
+	struct class *host_class;
+
+	/* Constructor functions */
+	int (*device_setup)(struct scsi_device *);
+	int (*target_setup)(struct scsi_target *);
+	int (*host_setup)(struct Scsi_Host *);
 
-	/* Constructor/Destructor functions */
-	int (* setup)(struct scsi_device *);
-	void (* cleanup)(struct scsi_device *);
 	/* The size of the specific transport attribute structure (a
 	 * space of this size will be left at the end of the
-	 * scsi_device structure */
-	int	size;
+	 * scsi_* structure */
+	int	device_size;
+	int	target_size;
 };
 
 #endif /* SCSI_TRANSPORT_H */
#1 lore raw
Quoted 5 lines · James Bottomley

OK, I've polished this up quite a bit, and actually got the implementation to work in the SPI transport classes. It still needs to be commented and have all the failure cases sorted out, but this should be ready to play with. (Obviously, you need the target patch before this will apply.)

When I tried to use the host part, several problems turned up in it, so this is an updated version with (hopefully) all the host issues fixed.

James

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/09/09 16:17:17-05:00 [email protected]
# Add host and target transport class abstractions
#

#   This patch makes a transport class be composed of up to three individual
#   device classes representing potential interfaces on the scsi_device,
#   scsi_target and Scsi_Host.  A class only has to implement at least one
#   of these, but may optionally implement more.
#   
#   Signed-off-by: James Bottomley <[email protected]>
# 
# drivers/scsi/scsi_scan.c
#   2004/09/09 16:16:26-05:00 [email protected] +15 -40
#   Add host and target transport class abstractions
# 
# drivers/scsi/scsi_priv.h
#   2004/09/09 16:16:26-05:00 [email protected] +0 -16
#   Add host and target transport class abstractions
# 
# drivers/scsi/hosts.c
#   2004/09/09 16:16:26-05:00 [email protected] +15 -1
#   Add host and target transport class abstractions
# 
# include/scsi/scsi_device.h
#   2004/09/09 16:16:25-05:00 [email protected] +26 -1
#   Add host and target transport class abstractions
# 
# drivers/scsi/scsi_transport_spi.c
#   2004/09/09 16:16:25-05:00 [email protected] +8 -8
#   Add host and target transport class abstractions
# 
# drivers/scsi/scsi_transport_fc.c
#   2004/09/09 16:16:25-05:00 [email protected] +5 -5
#   Add host and target transport class abstractions
# 
# drivers/scsi/scsi_sysfs.c
#   2004/09/09 16:16:25-05:00 [email protected] +112 -25
#   Add host and target transport class abstractions
# 
# include/scsi/scsi_transport_spi.h
#   2004/09/09 16:16:24-05:00 [email protected] +10 -10
#   Add host and target transport class abstractions
# 
# include/scsi/scsi_transport_fc.h
#   2004/09/09 16:16:24-05:00 [email protected] +3 -3
#   Add host and target transport class abstractions
# 
# include/scsi/scsi_transport.h
#   2004/09/09 16:16:24-05:00 [email protected] +16 -7
#   Add host and target transport class abstractions
# 
# include/scsi/scsi_host.h
#   2004/09/09 16:16:24-05:00 [email protected] +10 -0
#   Add host and target transport class abstractions
# 
diff -Nru a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
--- a/drivers/scsi/hosts.c	2004-09-10 07:44:30 +00:00
+++ b/drivers/scsi/hosts.c	2004-09-10 07:44:30 +00:00
@@ -82,6 +82,8 @@
 	set_bit(SHOST_DEL, &shost->shost_state);

class_device_unregister(&shost->shost_classdev);
+ if (shost->transport_classdev.class)
+ class_device_unregister(&shost->transport_classdev);
device_del(&shost->shost_gendev);
}

@@ -154,6 +156,7 @@

scsi_proc_hostdir_rm(shost->hostt);
scsi_destroy_command_freelist(shost);
+ kfree(shost->shost_data);

/*
* Some drivers (eg aha1542) do scsi_register()/scsi_unregister()
@@ -278,15 +281,26 @@
snprintf(shost->shost_classdev.class_id, BUS_ID_SIZE, "host%d",
shost->host_no);

+ if (shost->transportt->host_size &&
+ (shost->shost_data = kmalloc(shost->transportt->host_size,
+ GFP_KERNEL)) == NULL)
+ goto fail_destroy_freelist;
+
+ if (shost->transportt->host_setup)
+ shost->transportt->host_setup(shost);
+
shost->eh_notify = &complete;
rval = kernel_thread(scsi_error_handler, shost, 0); if (rval < 0)
- goto fail_destroy_freelist;
+ goto fail_free_shost_data;
wait_for_completion(&complete); shost->eh_notify = NULL;
+
scsi_proc_hostdir_add(shost->hostt); return shost;

+ fail_free_shost_data:
+ kfree(shost->shost_data);
fail_destroy_freelist:
scsi_destroy_command_freelist(shost);
fail_kfree:

drivers/scsi/scsi_priv.h +0 -16
diff -Nru a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h
@@ -58,22 +58,6 @@
  */
 #define SCAN_WILD_CARD	~0
 
-/*
- * scsi_target: representation of a scsi target, for now, this is only
- * used for single_lun devices. If no one has active IO to the target,
- * starget_sdev_user is NULL, else it points to the active sdev.
- */
-struct scsi_target {
-	struct scsi_device	*starget_sdev_user;
-	struct device		dev;
-};
-
-#define to_scsi_target(d)	container_of(d, struct scsi_target, dev)
-static inline struct scsi_target *scsi_target(struct scsi_device *sdev)
-{
-	return to_scsi_target(sdev->sdev_gendev.parent);
-}
-
 /* hosts.c */
 extern int scsi_init_hosts(void);
 extern void scsi_exit_hosts(void);
drivers/scsi/scsi_scan.c +15 -40

96 lines not on this page · raw message

drivers/scsi/scsi_sysfs.c +112 -25

213 lines not on this page · raw message

drivers/scsi/scsi_transport_fc.c +5 -5
diff -Nru a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
@@ -84,7 +84,7 @@
 	struct scsi_device *sdev = transport_class_to_sdev(cdev);	\
 	struct fc_transport_attrs *tp;					\
 	struct fc_internal *i = to_fc_internal(sdev->host->transportt);	\
-	tp = (struct fc_transport_attrs *)&sdev->transport_data;	\
+	tp = (struct fc_transport_attrs *)&sdev->sdev_data;		\
 	if (i->f->get_##field)						\
 		i->f->get_##field(sdev);				\
 	return snprintf(buf, 20, format_string, cast tp->field);	\
@@ -156,10 +156,10 @@
 
 	memset(i, 0, sizeof(struct fc_internal));
 
-	i->t.attrs = &i->attrs[0];
-	i->t.class = &fc_transport_class;
-	i->t.setup = &fc_setup_transport_attrs;
-	i->t.size = sizeof(struct fc_transport_attrs);
+	i->t.device_attrs = &i->attrs[0];
+	i->t.device_class = &fc_transport_class;
+	i->t.device_setup = &fc_setup_transport_attrs;
+	i->t.device_size = sizeof(struct fc_transport_attrs);
 	i->f = ft;
 
 	SETUP_ATTRIBUTE_RD(port_id);
drivers/scsi/scsi_transport_spi.c +8 -8
diff -Nru a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c
@@ -44,8 +44,8 @@
 #define SPI_MAX_ECHO_BUFFER_SIZE	4096
 
 /* Private data accessors (keep these out of the header file) */
-#define spi_dv_pending(x) (((struct spi_transport_attrs *)&(x)->transport_data)->dv_pending)
-#define spi_dv_sem(x) (((struct spi_transport_attrs *)&(x)->transport_data)->dv_sem)
+#define spi_dv_pending(x) (((struct spi_transport_attrs *)&(x)->sdev_data)->dv_pending)
+#define spi_dv_sem(x) (((struct spi_transport_attrs *)&(x)->sdev_data)->dv_sem)
 
 struct spi_internal {
 	struct scsi_transport_template t;
@@ -127,7 +127,7 @@
 	struct scsi_device *sdev = transport_class_to_sdev(cdev);	\
 	struct spi_transport_attrs *tp;					\
 	struct spi_internal *i = to_spi_internal(sdev->host->transportt); \
-	tp = (struct spi_transport_attrs *)&sdev->transport_data;	\
+	tp = (struct spi_transport_attrs *)&sdev->sdev_data;		\
 	if (i->f->get_##field)						\
 		i->f->get_##field(sdev);				\
 	return snprintf(buf, 20, format_string, tp->field);		\
@@ -185,7 +185,7 @@
 	const char *str;
 	struct spi_internal *i = to_spi_internal(sdev->host->transportt);
 
-	tp = (struct spi_transport_attrs *)&sdev->transport_data;
+	tp = (struct spi_transport_attrs *)&sdev->sdev_data;
 
 	if (i->f->get_period)
 		i->f->get_period(sdev);
@@ -666,10 +666,10 @@
 	memset(i, 0, sizeof(struct spi_internal));
 
 
-	i->t.attrs = &i->attrs[0];
-	i->t.class = &spi_transport_class;
-	i->t.setup = &spi_setup_transport_attrs;
-	i->t.size = sizeof(struct spi_transport_attrs);
+	i->t.device_attrs = &i->attrs[0];
+	i->t.device_class = &spi_transport_class;
+	i->t.device_setup = &spi_setup_transport_attrs;
+	i->t.device_size = sizeof(struct spi_transport_attrs);
 	i->f = ft;
 
 	SETUP_ATTRIBUTE(period);
include/scsi/scsi_device.h +26 -1
diff -Nru a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
@@ -120,7 +120,7 @@
 	struct class_device	transport_classdev;
 
 	enum scsi_device_state sdev_state;
-	unsigned long		transport_data[0];
+	unsigned long		sdev_data[0];
 } __attribute__((aligned(sizeof(unsigned long))));
 #define	to_scsi_device(d)	\
 	container_of(d, struct scsi_device, sdev_gendev)
@@ -129,6 +129,29 @@
 #define transport_class_to_sdev(class_dev) \
 	container_of(class_dev, struct scsi_device, transport_classdev)
 
+/*
+ * scsi_target: representation of a scsi target, for now, this is only
+ * used for single_lun devices. If no one has active IO to the target,
+ * starget_sdev_user is NULL, else it points to the active sdev.
+ */
+struct scsi_target {
+	struct scsi_device	*starget_sdev_user;
+	struct device		dev;
+	unsigned int		id; /* target id ... replace
+				     * scsi_device.id eventually */
+	struct class_device	transport_classdev;
+	unsigned long		create:1; /* signal that it needs to be added */
+	unsigned long		starget_data[0];
+} __attribute__((aligned(sizeof(unsigned long))));
+
+#define to_scsi_target(d)	container_of(d, struct scsi_target, dev)
+static inline struct scsi_target *scsi_target(struct scsi_device *sdev)
+{
+	return to_scsi_target(sdev->sdev_gendev.parent);
+}
+#define transport_class_to_starget(class_dev) \
+	container_of(class_dev, struct scsi_target, transport_classdev)
+
 extern struct scsi_device *__scsi_add_device(struct Scsi_Host *,
 		uint, uint, uint, void *hostdata);
 #define scsi_add_device(host, channel, target, lun) \
@@ -191,6 +214,8 @@
 				 enum scsi_device_state state);
 extern int scsi_device_quiesce(struct scsi_device *sdev);
 extern void scsi_device_resume(struct scsi_device *sdev);
+extern void scsi_target_quiesce(struct scsi_target *);
+extern void scsi_target_resume(struct scsi_target *);
 extern const char *scsi_device_state_name(enum scsi_device_state);
 static inline int scsi_device_online(struct scsi_device *sdev)
 {
include/scsi/scsi_host.h +10 -0
diff -Nru a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
@@ -511,6 +511,13 @@
 	struct list_head sht_legacy_list;
 
 	/*
+	 * Points to the transport data (if any) which is allocated
+	 * separately
+	 */
+	void *shost_data;
+	struct class_device transport_classdev;
+
+	/*
 	 * We should ensure that this is aligned, both for better performance
 	 * and also because some compilers (m68k) don't automatically force
 	 * alignment to a long boundary.
@@ -522,6 +529,9 @@
 	container_of(d, struct Scsi_Host, shost_gendev)
 #define		class_to_shost(d)	\
 	container_of(d, struct Scsi_Host, shost_classdev)
+#define		transport_class_to_shost(class_dev) \
+	container_of(class_dev, struct Scsi_Host, transport_classdev)
+
 
 extern struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *, int);
 extern int scsi_add_host(struct Scsi_Host *, struct device *);
include/scsi/scsi_transport.h +16 -7
diff -Nru a/include/scsi/scsi_transport.h b/include/scsi/scsi_transport.h
@@ -24,18 +24,27 @@
 	/* The NULL terminated list of transport attributes
 	 * that should be exported.
 	 */
-	struct class_device_attribute **attrs;
+	struct class_device_attribute **device_attrs;
+	struct class_device_attribute **target_attrs;
+	struct class_device_attribute **host_attrs;
+
 
 	/* The transport class that the device is in */
-	struct class *class;
+	struct class *device_class;
+	struct class *target_class;
+	struct class *host_class;
+
+	/* Constructor functions */
+	int (*device_setup)(struct scsi_device *);
+	int (*target_setup)(struct scsi_target *);
+	int (*host_setup)(struct Scsi_Host *);
 
-	/* Constructor/Destructor functions */
-	int (* setup)(struct scsi_device *);
-	void (* cleanup)(struct scsi_device *);
 	/* The size of the specific transport attribute structure (a
 	 * space of this size will be left at the end of the
-	 * scsi_device structure */
-	int	size;
+	 * scsi_* structure */
+	int	device_size;
+	int	target_size;
+	int	host_size;
 };
 
 #endif /* SCSI_TRANSPORT_H */
include/scsi/scsi_transport_fc.h +3 -3
diff -Nru a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
@@ -31,9 +31,9 @@
 };
 
 /* accessor functions */
-#define fc_port_id(x)	(((struct fc_transport_attrs *)&(x)->transport_data)->port_id)
-#define fc_node_name(x)	(((struct fc_transport_attrs *)&(x)->transport_data)->node_name)
-#define fc_port_name(x)	(((struct fc_transport_attrs *)&(x)->transport_data)->port_name)
+#define fc_port_id(x)	(((struct fc_transport_attrs *)&(x)->sdev_data)->port_id)
+#define fc_node_name(x)	(((struct fc_transport_attrs *)&(x)->sdev_data)->node_name)
+#define fc_port_name(x)	(((struct fc_transport_attrs *)&(x)->sdev_data)->port_name)
 
 /* The functions by which the transport class and the driver communicate */
 struct fc_function_template {
include/scsi/scsi_transport_spi.h +10 -10
diff -Nru a/include/scsi/scsi_transport_spi.h b/include/scsi/scsi_transport_spi.h
@@ -41,16 +41,16 @@
 };
 
 /* accessor functions */
-#define spi_period(x)	(((struct spi_transport_attrs *)&(x)->transport_data)->period)
-#define spi_offset(x)	(((struct spi_transport_attrs *)&(x)->transport_data)->offset)
-#define spi_width(x)	(((struct spi_transport_attrs *)&(x)->transport_data)->width)
-#define spi_iu(x)	(((struct spi_transport_attrs *)&(x)->transport_data)->iu)
-#define spi_dt(x)	(((struct spi_transport_attrs *)&(x)->transport_data)->dt)
-#define spi_qas(x)	(((struct spi_transport_attrs *)&(x)->transport_data)->qas)
-#define spi_wr_flow(x)	(((struct spi_transport_attrs *)&(x)->transport_data)->wr_flow)
-#define spi_rd_strm(x)	(((struct spi_transport_attrs *)&(x)->transport_data)->rd_strm)
-#define spi_rti(x)	(((struct spi_transport_attrs *)&(x)->transport_data)->rti)
-#define spi_pcomp_en(x)	(((struct spi_transport_attrs *)&(x)->transport_data)->pcomp_en)
+#define spi_period(x)	(((struct spi_transport_attrs *)&(x)->sdev_data)->period)
+#define spi_offset(x)	(((struct spi_transport_attrs *)&(x)->sdev_data)->offset)
+#define spi_width(x)	(((struct spi_transport_attrs *)&(x)->sdev_data)->width)
+#define spi_iu(x)	(((struct spi_transport_attrs *)&(x)->sdev_data)->iu)
+#define spi_dt(x)	(((struct spi_transport_attrs *)&(x)->sdev_data)->dt)
+#define spi_qas(x)	(((struct spi_transport_attrs *)&(x)->sdev_data)->qas)
+#define spi_wr_flow(x)	(((struct spi_transport_attrs *)&(x)->sdev_data)->wr_flow)
+#define spi_rd_strm(x)	(((struct spi_transport_attrs *)&(x)->sdev_data)->rd_strm)
+#define spi_rti(x)	(((struct spi_transport_attrs *)&(x)->sdev_data)->rti)
+#define spi_pcomp_en(x)	(((struct spi_transport_attrs *)&(x)->sdev_data)->pcomp_en)
 
 /* The functions by which the transport class and the driver communicate */
 struct spi_function_template {