blob: ae5a17111968c7ca8bc8667a65d16393532ffbde [file] [log] [blame]
Nicholas Bellinger3f993062013-03-06 21:53:26 -08001#include <linux/module.h>
2#include <linux/list.h>
3#include "../../../drivers/target/iscsi/iscsi_target_core.h"
4
5struct iscsit_transport {
6#define ISCSIT_TRANSPORT_NAME 16
7 char name[ISCSIT_TRANSPORT_NAME];
8 int transport_type;
Nicholas Bellingerd703ce22013-08-17 14:27:56 -07009 int priv_size;
Nicholas Bellinger3f993062013-03-06 21:53:26 -080010 struct module *owner;
11 struct list_head t_node;
12 int (*iscsit_setup_np)(struct iscsi_np *, struct __kernel_sockaddr_storage *);
13 int (*iscsit_accept_np)(struct iscsi_np *, struct iscsi_conn *);
14 void (*iscsit_free_np)(struct iscsi_np *);
15 void (*iscsit_free_conn)(struct iscsi_conn *);
Nicholas Bellinger3f993062013-03-06 21:53:26 -080016 int (*iscsit_get_login_rx)(struct iscsi_conn *, struct iscsi_login *);
17 int (*iscsit_put_login_tx)(struct iscsi_conn *, struct iscsi_login *, u32);
18 int (*iscsit_immediate_queue)(struct iscsi_conn *, struct iscsi_cmd *, int);
19 int (*iscsit_response_queue)(struct iscsi_conn *, struct iscsi_cmd *, int);
20 int (*iscsit_get_dataout)(struct iscsi_conn *, struct iscsi_cmd *, bool);
21 int (*iscsit_queue_data_in)(struct iscsi_conn *, struct iscsi_cmd *);
22 int (*iscsit_queue_status)(struct iscsi_conn *, struct iscsi_cmd *);
23};
24
Nicholas Bellingerd703ce22013-08-17 14:27:56 -070025static inline void *iscsit_priv_cmd(struct iscsi_cmd *cmd)
26{
27 return (void *)(cmd + 1);
28}
29
Nicholas Bellinger3f993062013-03-06 21:53:26 -080030/*
31 * From iscsi_target_transport.c
32 */
33
34extern int iscsit_register_transport(struct iscsit_transport *);
35extern void iscsit_unregister_transport(struct iscsit_transport *);
36extern struct iscsit_transport *iscsit_get_transport(int);
37extern void iscsit_put_transport(struct iscsit_transport *);
38
39/*
40 * From iscsi_target.c
41 */
Nicholas Bellinger3f993062013-03-06 21:53:26 -080042extern int iscsit_setup_scsi_cmd(struct iscsi_conn *, struct iscsi_cmd *,
43 unsigned char *);
44extern void iscsit_set_unsoliticed_dataout(struct iscsi_cmd *);
45extern int iscsit_process_scsi_cmd(struct iscsi_conn *, struct iscsi_cmd *,
46 struct iscsi_scsi_req *);
47extern int iscsit_check_dataout_hdr(struct iscsi_conn *, unsigned char *,
48 struct iscsi_cmd **);
49extern int iscsit_check_dataout_payload(struct iscsi_cmd *, struct iscsi_data *,
50 bool);
Nicholas Bellinger778de362013-06-14 16:07:47 -070051extern int iscsit_setup_nop_out(struct iscsi_conn *, struct iscsi_cmd *,
52 struct iscsi_nopout *);
53extern int iscsit_process_nop_out(struct iscsi_conn *, struct iscsi_cmd *,
54 struct iscsi_nopout *);
Nicholas Bellinger3f993062013-03-06 21:53:26 -080055extern int iscsit_handle_logout_cmd(struct iscsi_conn *, struct iscsi_cmd *,
56 unsigned char *);
57extern int iscsit_handle_task_mgt_cmd(struct iscsi_conn *, struct iscsi_cmd *,
58 unsigned char *);
Nicholas Bellinger64534aa2013-06-14 16:46:16 -070059extern int iscsit_setup_text_cmd(struct iscsi_conn *, struct iscsi_cmd *,
60 struct iscsi_text *);
61extern int iscsit_process_text_cmd(struct iscsi_conn *, struct iscsi_cmd *,
62 struct iscsi_text *);
Nicholas Bellinger3f993062013-03-06 21:53:26 -080063extern void iscsit_build_rsp_pdu(struct iscsi_cmd *, struct iscsi_conn *,
64 bool, struct iscsi_scsi_rsp *);
65extern void iscsit_build_nopin_rsp(struct iscsi_cmd *, struct iscsi_conn *,
66 struct iscsi_nopin *, bool);
67extern void iscsit_build_task_mgt_rsp(struct iscsi_cmd *, struct iscsi_conn *,
68 struct iscsi_tm_rsp *);
Nicholas Bellinger889c8a62013-06-14 18:49:55 -070069extern int iscsit_build_text_rsp(struct iscsi_cmd *, struct iscsi_conn *,
70 struct iscsi_text_rsp *);
Nicholas Bellinger3f993062013-03-06 21:53:26 -080071extern void iscsit_build_reject(struct iscsi_cmd *, struct iscsi_conn *,
72 struct iscsi_reject *);
73extern int iscsit_build_logout_rsp(struct iscsi_cmd *, struct iscsi_conn *,
74 struct iscsi_logout_rsp *);
75extern int iscsit_logout_post_handler(struct iscsi_cmd *, struct iscsi_conn *);
76/*
77 * From iscsi_target_device.c
78 */
79extern void iscsit_increment_maxcmdsn(struct iscsi_cmd *, struct iscsi_session *);
80/*
Nicholas Bellingerb2cb9642013-07-03 03:05:37 -070081 * From iscsi_target_erl0.c
82 */
83extern void iscsit_cause_connection_reinstatement(struct iscsi_conn *, int);
84/*
Nicholas Bellinger3f993062013-03-06 21:53:26 -080085 * From iscsi_target_erl1.c
86 */
87extern void iscsit_stop_dataout_timer(struct iscsi_cmd *);
88
89/*
90 * From iscsi_target_tmr.c
91 */
92extern int iscsit_tmr_post_handler(struct iscsi_cmd *, struct iscsi_conn *);
93
94/*
95 * From iscsi_target_util.c
96 */
Nicholas Bellinger676687c2014-01-20 03:36:44 +000097extern struct iscsi_cmd *iscsit_allocate_cmd(struct iscsi_conn *, int);
Nicholas Bellinger561bf152013-07-03 03:58:58 -070098extern int iscsit_sequence_cmd(struct iscsi_conn *, struct iscsi_cmd *,
99 unsigned char *, __be32);
Nicholas Bellingerd703ce22013-08-17 14:27:56 -0700100extern void iscsit_release_cmd(struct iscsi_cmd *);