1 /* 2 * iSCSI transport class definitions 3 * 4 * Copyright (C) IBM Corporation, 2004 5 * Copyright (C) Mike Christie, 2004 - 2005 6 * Copyright (C) Dmitry Yusupov, 2004 - 2005 7 * Copyright (C) Alex Aizman, 2004 - 2005 8 * 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 26 #include <scsi/iscsi_if.h> 27 28 /** 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 */ 46 struct 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); 71 }; 72 73 /* 74 * transport registration upcalls 75 */ 76 extern int iscsi_register_transport(struct iscsi_transport *tt); 77 extern int iscsi_unregister_transport(struct iscsi_transport *tt); 78 79 /* 80 * control plane upcalls 81 */ 82 extern void iscsi_conn_error(iscsi_connh_t conn, enum iscsi_err error); 83 extern int iscsi_recv_pdu(iscsi_connh_t conn, struct iscsi_hdr *hdr, 84 char *data, uint32_t data_size); 85 86 #endif 87