blob: f25041c386ec26481d9814821118446848d6e252 [file] [log] [blame]
Alex Aizman39e84792005-08-04 19:31:00 -07001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * iSCSI transport class definitions
3 *
4 * Copyright (C) IBM Corporation, 2004
Alex Aizman39e84792005-08-04 19:31:00 -07005 * Copyright (C) Mike Christie, 2004 - 2005
6 * Copyright (C) Dmitry Yusupov, 2004 - 2005
7 * Copyright (C) Alex Aizman, 2004 - 2005
Linus Torvalds1da177e2005-04-16 15:20:36 -07008 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */
23#ifndef SCSI_TRANSPORT_ISCSI_H
24#define SCSI_TRANSPORT_ISCSI_H
25
Alex Aizman39e84792005-08-04 19:31:00 -070026#include <scsi/iscsi_if.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070027
Alex Aizman39e84792005-08-04 19:31:00 -070028/**
29 * struct iscsi_transport - iSCSI Transport template
30 *
31 * @name: transport name
32 * @caps: iSCSI Data-Path capabilities
33 * @create_session: create new iSCSI session object
34 * @destroy_session: destroy existing iSCSI session object
35 * @create_conn: create new iSCSI connection
36 * @bind_conn: associate this connection with existing iSCSI session
37 * and specified transport descriptor
38 * @destroy_conn: destroy inactive iSCSI connection
39 * @set_param: set iSCSI Data-Path operational parameter
40 * @start_conn: set connection to be operational
41 * @stop_conn: suspend/recover/terminate connection
42 * @send_pdu: send iSCSI PDU, Login, Logout, NOP-Out, Reject, Text.
43 *
44 * Template API provided by iSCSI Transport
45 */
46struct iscsi_transport {
47 struct module *owner;
48 char *name;
49 unsigned int caps;
50 struct scsi_host_template *host_template;
51 int hostdata_size;
52 int max_lun;
53 unsigned int max_conn;
54 unsigned int max_cmd_len;
55 iscsi_sessionh_t (*create_session) (uint32_t initial_cmdsn,
56 struct Scsi_Host *shost);
57 void (*destroy_session) (iscsi_sessionh_t session);
58 iscsi_connh_t (*create_conn) (iscsi_sessionh_t session, uint32_t cid);
59 int (*bind_conn) (iscsi_sessionh_t session, iscsi_connh_t conn,
60 uint32_t transport_fd, int is_leading);
61 int (*start_conn) (iscsi_connh_t conn);
62 void (*stop_conn) (iscsi_connh_t conn, int flag);
63 void (*destroy_conn) (iscsi_connh_t conn);
64 int (*set_param) (iscsi_connh_t conn, enum iscsi_param param,
65 uint32_t value);
66 int (*get_param) (iscsi_connh_t conn, enum iscsi_param param,
67 uint32_t *value);
68 int (*send_pdu) (iscsi_connh_t conn, struct iscsi_hdr *hdr,
69 char *data, uint32_t data_size);
70 void (*get_stats) (iscsi_connh_t conn, struct iscsi_stats *stats);
Linus Torvalds1da177e2005-04-16 15:20:36 -070071};
72
73/*
Alex Aizman39e84792005-08-04 19:31:00 -070074 * transport registration upcalls
Linus Torvalds1da177e2005-04-16 15:20:36 -070075 */
Alex Aizman39e84792005-08-04 19:31:00 -070076extern int iscsi_register_transport(struct iscsi_transport *tt);
77extern int iscsi_unregister_transport(struct iscsi_transport *tt);
Linus Torvalds1da177e2005-04-16 15:20:36 -070078
79/*
Alex Aizman39e84792005-08-04 19:31:00 -070080 * control plane upcalls
Linus Torvalds1da177e2005-04-16 15:20:36 -070081 */
Alex Aizman39e84792005-08-04 19:31:00 -070082extern void iscsi_conn_error(iscsi_connh_t conn, enum iscsi_err error);
83extern int iscsi_recv_pdu(iscsi_connh_t conn, struct iscsi_hdr *hdr,
84 char *data, uint32_t data_size);
Linus Torvalds1da177e2005-04-16 15:20:36 -070085
86#endif