blob: daef9daa500c11f0ff7d92151fafbf9080a80e02 [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 *);
Nicholas Bellingerdefd8842014-02-03 12:54:39 -080015 void (*iscsit_wait_conn)(struct iscsi_conn *);
Nicholas Bellinger3f993062013-03-06 21:53:26 -080016 void (*iscsit_free_conn)(struct iscsi_conn *);
Nicholas Bellinger3f993062013-03-06 21:53:26 -080017 int (*iscsit_get_login_rx)(struct iscsi_conn *, struct iscsi_login *);
18 int (*iscsit_put_login_tx)(struct iscsi_conn *, struct iscsi_login *, u32);
19 int (*iscsit_immediate_queue)(struct iscsi_conn *, struct iscsi_cmd *, int);
20 int (*iscsit_response_queue)(struct iscsi_conn *, struct iscsi_cmd *, int);
21 int (*iscsit_get_dataout)(struct iscsi_conn *, struct iscsi_cmd *, bool);
22 int (*iscsit_queue_data_in)(struct iscsi_conn *, struct iscsi_cmd *);
23 int (*iscsit_queue_status)(struct iscsi_conn *, struct iscsi_cmd *);
Nicholas Bellinger131e6ab2014-03-22 14:55:56 -070024 void (*iscsit_aborted_task)(struct iscsi_conn *, struct iscsi_cmd *);
Nicholas Bellingere70beee2014-04-02 12:52:38 -070025 enum target_prot_op (*iscsit_get_sup_prot_ops)(struct iscsi_conn *);
Nicholas Bellinger3f993062013-03-06 21:53:26 -080026};
27
Nicholas Bellingerd703ce22013-08-17 14:27:56 -070028static inline void *iscsit_priv_cmd(struct iscsi_cmd *cmd)
29{
30 return (void *)(cmd + 1);
31}
32
Nicholas Bellinger3f993062013-03-06 21:53:26 -080033/*
34 * From iscsi_target_transport.c
35 */
36
37extern int iscsit_register_transport(struct iscsit_transport *);
38extern void iscsit_unregister_transport(struct iscsit_transport *);
39extern struct iscsit_transport *iscsit_get_transport(int);
40extern void iscsit_put_transport(struct iscsit_transport *);
41
42/*
43 * From iscsi_target.c
44 */
Nicholas Bellinger3f993062013-03-06 21:53:26 -080045extern int iscsit_setup_scsi_cmd(struct iscsi_conn *, struct iscsi_cmd *,
46 unsigned char *);
47extern void iscsit_set_unsoliticed_dataout(struct iscsi_cmd *);
48extern int iscsit_process_scsi_cmd(struct iscsi_conn *, struct iscsi_cmd *,
49 struct iscsi_scsi_req *);
50extern int iscsit_check_dataout_hdr(struct iscsi_conn *, unsigned char *,
51 struct iscsi_cmd **);
52extern int iscsit_check_dataout_payload(struct iscsi_cmd *, struct iscsi_data *,
53 bool);
Nicholas Bellinger778de362013-06-14 16:07:47 -070054extern int iscsit_setup_nop_out(struct iscsi_conn *, struct iscsi_cmd *,
55 struct iscsi_nopout *);
56extern int iscsit_process_nop_out(struct iscsi_conn *, struct iscsi_cmd *,
57 struct iscsi_nopout *);
Nicholas Bellinger3f993062013-03-06 21:53:26 -080058extern int iscsit_handle_logout_cmd(struct iscsi_conn *, struct iscsi_cmd *,
59 unsigned char *);
60extern int iscsit_handle_task_mgt_cmd(struct iscsi_conn *, struct iscsi_cmd *,
61 unsigned char *);
Nicholas Bellinger64534aa2013-06-14 16:46:16 -070062extern int iscsit_setup_text_cmd(struct iscsi_conn *, struct iscsi_cmd *,
63 struct iscsi_text *);
64extern int iscsit_process_text_cmd(struct iscsi_conn *, struct iscsi_cmd *,
65 struct iscsi_text *);
Nicholas Bellinger3f993062013-03-06 21:53:26 -080066extern void iscsit_build_rsp_pdu(struct iscsi_cmd *, struct iscsi_conn *,
67 bool, struct iscsi_scsi_rsp *);
68extern void iscsit_build_nopin_rsp(struct iscsi_cmd *, struct iscsi_conn *,
69 struct iscsi_nopin *, bool);
70extern void iscsit_build_task_mgt_rsp(struct iscsi_cmd *, struct iscsi_conn *,
71 struct iscsi_tm_rsp *);
Nicholas Bellinger889c8a62013-06-14 18:49:55 -070072extern int iscsit_build_text_rsp(struct iscsi_cmd *, struct iscsi_conn *,
Sagi Grimberg22c7aaa2014-06-10 18:27:59 +030073 struct iscsi_text_rsp *,
74 enum iscsit_transport_type);
Nicholas Bellinger3f993062013-03-06 21:53:26 -080075extern void iscsit_build_reject(struct iscsi_cmd *, struct iscsi_conn *,
76 struct iscsi_reject *);
77extern int iscsit_build_logout_rsp(struct iscsi_cmd *, struct iscsi_conn *,
78 struct iscsi_logout_rsp *);
79extern int iscsit_logout_post_handler(struct iscsi_cmd *, struct iscsi_conn *);
80/*
81 * From iscsi_target_device.c
82 */
83extern void iscsit_increment_maxcmdsn(struct iscsi_cmd *, struct iscsi_session *);
84/*
Nicholas Bellingerb2cb9642013-07-03 03:05:37 -070085 * From iscsi_target_erl0.c
86 */
87extern void iscsit_cause_connection_reinstatement(struct iscsi_conn *, int);
88/*
Nicholas Bellinger3f993062013-03-06 21:53:26 -080089 * From iscsi_target_erl1.c
90 */
91extern void iscsit_stop_dataout_timer(struct iscsi_cmd *);
92
93/*
94 * From iscsi_target_tmr.c
95 */
96extern int iscsit_tmr_post_handler(struct iscsi_cmd *, struct iscsi_conn *);
97
98/*
99 * From iscsi_target_util.c
100 */
Nicholas Bellinger676687c2014-01-20 03:36:44 +0000101extern struct iscsi_cmd *iscsit_allocate_cmd(struct iscsi_conn *, int);
Nicholas Bellinger561bf152013-07-03 03:58:58 -0700102extern int iscsit_sequence_cmd(struct iscsi_conn *, struct iscsi_cmd *,
103 unsigned char *, __be32);
Nicholas Bellingerd703ce22013-08-17 14:27:56 -0700104extern void iscsit_release_cmd(struct iscsi_cmd *);