2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2003-2009 Silicon Graphics International Corp.
5 * Copyright (c) 2011 Spectra Logic Corporation
6 * Copyright (c) 2015 Alexander Motin <mav@FreeBSD.org>
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions, and the following disclaimer,
14 * without modification.
15 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
16 * substantially similar to the "NO WARRANTY" disclaimer below
17 * ("Disclaimer") and any redistribution must be conditioned upon
18 * including a substantially similar Disclaimer requirement for further
19 * binary redistribution.
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
30 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
31 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGES.
34 * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl_ha.h#1 $
41 * CTL High Availability Modes:
43 * CTL_HA_MODE_ACT_STBY: Commands are serialized to the master side.
44 * No media access commands on slave side (Standby).
45 * CTL_HA_MODE_SER_ONLY: Commands are serialized to the master side.
46 * Media can be accessed on both sides.
47 * CTL_HA_MODE_XFER: Commands and data are forwarded to the
48 * master side for execution.
57 * Communication channel IDs for various system components. This is to
58 * make sure one CTL instance talks with another, one ZFS instance talks
68 * HA communication event notification. These are events generated by the
69 * HA communication subsystem.
71 * CTL_HA_EVT_MSG_RECV: Message received by the other node.
72 * CTL_HA_EVT_LINK_CHANGE: Communication channel status changed.
77 CTL_HA_EVT_LINK_CHANGE,
83 CTL_HA_STATUS_SUCCESS,
85 CTL_HA_STATUS_INVALID,
86 CTL_HA_STATUS_DISCONNECT,
98 typedef void (*ctl_ha_dt_cb)(struct ctl_ha_dt_req *);
100 struct ctl_ha_dt_req {
101 ctl_ha_dt_cmd command;
103 ctl_ha_dt_cb callback;
108 TAILQ_ENTRY(ctl_ha_dt_req) links;
112 ctl_ha_status ctl_ha_msg_init(struct ctl_softc *softc);
113 void ctl_ha_msg_shutdown(struct ctl_softc *softc);
114 ctl_ha_status ctl_ha_msg_destroy(struct ctl_softc *softc);
116 typedef void (*ctl_evt_handler)(ctl_ha_channel channel, ctl_ha_event event,
118 void ctl_ha_register_evthandler(ctl_ha_channel channel,
119 ctl_evt_handler handler);
121 ctl_ha_status ctl_ha_msg_register(ctl_ha_channel channel,
122 ctl_evt_handler handler);
123 ctl_ha_status ctl_ha_msg_recv(ctl_ha_channel channel, void *addr,
124 size_t len, int wait);
125 ctl_ha_status ctl_ha_msg_send(ctl_ha_channel channel, const void *addr,
126 size_t len, int wait);
127 ctl_ha_status ctl_ha_msg_send2(ctl_ha_channel channel, const void *addr,
128 size_t len, const void *addr2, size_t len2, int wait);
129 ctl_ha_status ctl_ha_msg_abort(ctl_ha_channel channel);
130 ctl_ha_status ctl_ha_msg_deregister(ctl_ha_channel channel);
132 struct ctl_ha_dt_req * ctl_dt_req_alloc(void);
133 void ctl_dt_req_free(struct ctl_ha_dt_req *req);
134 ctl_ha_status ctl_dt_single(struct ctl_ha_dt_req *req);
137 CTL_HA_LINK_OFFLINE = 0x00,
138 CTL_HA_LINK_UNKNOWN = 0x01,
139 CTL_HA_LINK_ONLINE = 0x02
142 #endif /* _CTL_HA_H_ */