summaryrefslogtreecommitdiff
path: root/sys/scsi/mpathvar.h
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2011-04-05 14:25:43 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2011-04-05 14:25:43 +0000
commit6894d524815751209e596eb2888fc36dcdadc461 (patch)
treed8a9ea654578c297b377d0d406e592d7cf3749ad /sys/scsi/mpathvar.h
parent09931756bf164ec239559a8c39bd52706b27241e (diff)
move forward with scsi multipathing.
the big change is how paths between mpath capable devices and the kernel are managed. originally the midlayer would steal the links to the devices and hide them behind mpath. all the changes an adapter made to a link (eg activate or detach), the midlayer had to test if it was an mpath link and then call special mpath code to handle it. the original code also assumed that all paths behaved the same, but the reality is that different devices have different command sets and behaviours. figuring out which behaviour to pick and prioritising them is basically the same job autoconf does with match and attach. rather than special casing mpath in the midlayer and reimplimenting autoconf, this turns paths into actual device drivers with match and attach routines. after they figure out if the path is active, they then give it to mpath(4) to use as a backend. i have written drivers for symmetric access devices (sym(4)) where all paths to the same logical unit are as good as each other, lsi/engenio arrays (rdac(4), and emc arrays (emc(4)). the rdac and emc drivers only detect active paths at attach time, the do not cope if the controller changes state unless you unplug the path and plug it in again to retest the active state. they also do not have support for directing array failover. operating and hoplugging has been tested with mpii(4), fc and sas mpi(4), and iscsi via vscsi (claudio did this too). ok krw@ deraadt@
Diffstat (limited to 'sys/scsi/mpathvar.h')
-rw-r--r--sys/scsi/mpathvar.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/sys/scsi/mpathvar.h b/sys/scsi/mpathvar.h
new file mode 100644
index 00000000000..8a1357a500b
--- /dev/null
+++ b/sys/scsi/mpathvar.h
@@ -0,0 +1,55 @@
+/* $OpenBSD: mpathvar.h,v 1.1 2011/04/05 14:25:42 dlg Exp $ */
+
+/*
+ * Copyright (c) 2010 David Gwynne <dlg@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _SYS_SCSI_MPATH_H_
+#define _SYS_SCSI_MPATH_H_
+
+struct mpath_dev;
+struct mpath_group;
+
+struct mpath_ops {
+ char op_name[16];
+ void (*op_start)(struct scsi_xfer *);
+ int (*op_checksense)(struct scsi_xfer *);
+ int (*op_online)(struct scsi_link *);
+ int (*op_offline)(struct scsi_link *);
+};
+
+struct mpath_path {
+ /* the path driver must set these */
+ struct scsi_xshandler p_xsh;
+ struct scsi_link *p_link;
+ struct mpath_ops *p_ops;
+ int p_gid;
+
+ /* the follwoing are private to mpath.c */
+ TAILQ_ENTRY(mpath_path) p_entry;
+ struct mpath_dev *p_dev;
+ int p_state;
+};
+
+int mpath_path_probe(struct scsi_link *);
+int mpath_path_attach(struct mpath_path *);
+void mpath_path_state(struct mpath_path *, int);
+int mpath_path_detach(struct mpath_path *);
+
+void mpath_start(struct mpath_path *, struct scsi_xfer *);
+
+struct device *mpath_bootdv(struct device *);
+
+#endif /* _SYS_SCSI_MPATH_H_ */