2 * User/Kernel Transport IPC API Ioctl/NETLINK/etc
4 * Copyright (C) 2005 Dmitry Yusupov, Alex Aizman
5 * maintained by open-iscsi@googlegroups.com
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published
9 * by the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * See the file COPYING included with this distribution for more details.
19 * NOTE: OSes must implement this API in terms of user's control-plane re-use.
26 #include <sys/_iovec.h>
37 struct iscsi_ev_context
;
40 * When handling async events, the initiator may not be able to
41 * handle the event in the same context, so this allows the interface
42 * code to call into the initiator to shedule handling.
44 struct iscsi_ipc_ev_clbk
{
45 void (*create_session
) (uint32_t host_no
, uint32_t sid
);
46 void (*destroy_session
) (uint32_t host_no
, uint32_t sid
);
48 struct iscsi_ev_context
*(*get_ev_context
) (struct iscsi_conn
*conn
,
50 void (*put_ev_context
) (struct iscsi_ev_context
*ev_context
);
51 int (*sched_ev_context
) (struct iscsi_ev_context
*ev_context
,
52 struct iscsi_conn
*conn
,
53 unsigned long tmo
, int event
);
56 extern void ipc_register_ev_callback(struct iscsi_ipc_ev_clbk
*ipc_ev_clbk
);
59 * struct iscsi_ipc - Open-iSCSI Interface for Kernel IPC
61 * All functions allowed to return POSIX kind of error. i.e. 0 - OK, non-zero
62 * means IPC error and errno set.
69 int (*ctldev_open
) (void);
71 void (*ctldev_close
) (void);
73 int (*ctldev_handle
) (void);
75 int (*sendtargets
) (uint64_t transport_handle
, uint32_t host_no
,
76 struct sockaddr
*addr
);
78 int (*create_session
) (uint64_t transport_handle
, uint64_t ep_handle
,
79 uint32_t initial_cmdsn
, uint16_t cmds_max
,
80 uint16_t qdepth
, uint32_t *out_sid
,
83 int (*destroy_session
) (uint64_t transport_handle
, uint32_t sid
);
85 int (*unbind_session
) (uint64_t transport_handle
, uint32_t sid
);
87 int (*create_conn
) (uint64_t transport_handle
,
88 uint32_t sid
, uint32_t cid
, uint32_t *out_cid
);
90 int (*destroy_conn
) (uint64_t transport_handle
, uint32_t sid
,
93 int (*bind_conn
) (uint64_t transport_handle
, uint32_t sid
,
94 uint32_t cid
, uint64_t transport_eph
,
95 int is_leading
, int *retcode
);
97 int (*set_param
) (uint64_t transport_handle
, uint32_t sid
,
98 uint32_t cid
, enum iscsi_param param
,
99 void *value
, int type
);
101 int (*set_host_param
) (uint64_t transport_handle
, uint32_t host_no
,
102 enum iscsi_host_param param
,
103 void *value
, int type
);
105 /* not implemented yet */
106 int (*get_param
) (uint64_t transport_handle
, uint32_t sid
,
107 uint32_t cid
, enum iscsi_param param
,
108 uint32_t *value
, int *retcode
);
110 int (*get_stats
) (uint64_t transport_handle
, uint32_t sid
,
111 uint32_t cid
, char *statsbuf
, int statsbuf_max
);
113 int (*start_conn
) (uint64_t transport_handle
, uint32_t sid
,
114 uint32_t cid
, int *retcode
);
116 int (*stop_conn
) (uint64_t transport_handle
, uint32_t sid
,
117 uint32_t cid
, int flag
);
119 int (*read
) (char *data
, int count
);
121 void (*send_pdu_begin
) (uint64_t transport_handle
, uint32_t sid
,
122 uint32_t cid
, int hdr_size
, int data_size
);
124 int (*send_pdu_end
) (uint64_t transport_handle
, uint32_t sid
,
125 uint32_t cid
, int *retcode
);
127 int (*writev
) (enum iscsi_uevent_e type
, struct iovec
*iovp
, int count
);
129 int (*recv_pdu_begin
) (struct iscsi_conn
*conn
);
131 int (*recv_pdu_end
) (struct iscsi_conn
*conn
);
134 #endif /* ISCSI_IPC_H */