blob: 9e4197af8708e1056a08f4c01d423581a075bef1 [file] [log] [blame]
Nicholas Bellingere48354c2011-07-23 06:43:04 +00001#ifndef ISCSI_TARGET_UTIL_H
2#define ISCSI_TARGET_UTIL_H
3
Bart Van Assche8dcf07b2016-11-14 15:47:14 -08004#include <linux/types.h>
5#include <scsi/iscsi_proto.h> /* itt_t */
6
Nicholas Bellingere48354c2011-07-23 06:43:04 +00007#define MARKER_SIZE 8
8
Bart Van Assche8dcf07b2016-11-14 15:47:14 -08009struct iscsi_cmd;
10struct iscsi_conn;
11struct iscsi_conn_recovery;
12struct iscsi_session;
13
Nicholas Bellingere48354c2011-07-23 06:43:04 +000014extern int iscsit_add_r2t_to_list(struct iscsi_cmd *, u32, u32, int, u32);
15extern struct iscsi_r2t *iscsit_get_r2t_for_eos(struct iscsi_cmd *, u32, u32);
16extern struct iscsi_r2t *iscsit_get_r2t_from_list(struct iscsi_cmd *);
17extern void iscsit_free_r2t(struct iscsi_r2t *, struct iscsi_cmd *);
18extern void iscsit_free_r2ts_from_list(struct iscsi_cmd *);
Nicholas Bellingercdb72662013-03-06 22:09:17 -080019extern struct iscsi_cmd *iscsit_alloc_cmd(struct iscsi_conn *, gfp_t);
Nicholas Bellinger676687c2014-01-20 03:36:44 +000020extern struct iscsi_cmd *iscsit_allocate_cmd(struct iscsi_conn *, int);
Nicholas Bellingere48354c2011-07-23 06:43:04 +000021extern struct iscsi_seq *iscsit_get_seq_holder_for_datain(struct iscsi_cmd *, u32);
22extern struct iscsi_seq *iscsit_get_seq_holder_for_r2t(struct iscsi_cmd *);
23extern struct iscsi_r2t *iscsit_get_holder_for_r2tsn(struct iscsi_cmd *, u32);
Nicholas Bellinger561bf152013-07-03 03:58:58 -070024extern int iscsit_sequence_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
25 unsigned char * ,__be32 cmdsn);
Nicholas Bellingere48354c2011-07-23 06:43:04 +000026extern int iscsit_check_unsolicited_dataout(struct iscsi_cmd *, unsigned char *);
Nicholas Bellingere48354c2011-07-23 06:43:04 +000027extern struct iscsi_cmd *iscsit_find_cmd_from_itt_or_dump(struct iscsi_conn *,
Christoph Hellwig66c7db62012-09-26 08:00:39 -040028 itt_t, u32);
Nicholas Bellingere48354c2011-07-23 06:43:04 +000029extern struct iscsi_cmd *iscsit_find_cmd_from_ttt(struct iscsi_conn *, u32);
30extern int iscsit_find_cmd_for_recovery(struct iscsi_session *, struct iscsi_cmd **,
Christoph Hellwig66c7db62012-09-26 08:00:39 -040031 struct iscsi_conn_recovery **, itt_t);
Nicholas Bellingere48354c2011-07-23 06:43:04 +000032extern void iscsit_add_cmd_to_immediate_queue(struct iscsi_cmd *, struct iscsi_conn *, u8);
33extern struct iscsi_queue_req *iscsit_get_cmd_from_immediate_queue(struct iscsi_conn *);
Nicholas Bellingera4467012016-10-30 17:30:08 -070034extern int iscsit_add_cmd_to_response_queue(struct iscsi_cmd *, struct iscsi_conn *, u8);
Nicholas Bellingere48354c2011-07-23 06:43:04 +000035extern struct iscsi_queue_req *iscsit_get_cmd_from_response_queue(struct iscsi_conn *);
36extern void iscsit_remove_cmd_from_tx_queues(struct iscsi_cmd *, struct iscsi_conn *);
Roland Dreierd5627ac2012-10-31 09:16:46 -070037extern bool iscsit_conn_all_queues_empty(struct iscsi_conn *);
Nicholas Bellingere48354c2011-07-23 06:43:04 +000038extern void iscsit_free_queue_reqs_for_conn(struct iscsi_conn *);
39extern void iscsit_release_cmd(struct iscsi_cmd *);
Nicholas Bellinger131e6ab2014-03-22 14:55:56 -070040extern void __iscsit_free_cmd(struct iscsi_cmd *, bool, bool);
Nicholas Bellingeraafc9d12013-05-31 00:49:41 -070041extern void iscsit_free_cmd(struct iscsi_cmd *, bool);
Nicholas Bellingere48354c2011-07-23 06:43:04 +000042extern int iscsit_check_session_usage_count(struct iscsi_session *);
43extern void iscsit_dec_session_usage_count(struct iscsi_session *);
44extern void iscsit_inc_session_usage_count(struct iscsi_session *);
Nicholas Bellingere48354c2011-07-23 06:43:04 +000045extern struct iscsi_conn *iscsit_get_conn_from_cid(struct iscsi_session *, u16);
46extern struct iscsi_conn *iscsit_get_conn_from_cid_rcfr(struct iscsi_session *, u16);
47extern void iscsit_check_conn_usage_count(struct iscsi_conn *);
48extern void iscsit_dec_conn_usage_count(struct iscsi_conn *);
49extern void iscsit_inc_conn_usage_count(struct iscsi_conn *);
50extern void iscsit_mod_nopin_response_timer(struct iscsi_conn *);
51extern void iscsit_start_nopin_response_timer(struct iscsi_conn *);
52extern void iscsit_stop_nopin_response_timer(struct iscsi_conn *);
53extern void __iscsit_start_nopin_timer(struct iscsi_conn *);
54extern void iscsit_start_nopin_timer(struct iscsi_conn *);
55extern void iscsit_stop_nopin_timer(struct iscsi_conn *);
56extern int iscsit_send_tx_data(struct iscsi_cmd *, struct iscsi_conn *, int);
57extern int iscsit_fe_sendpage_sg(struct iscsi_cmd *, struct iscsi_conn *);
58extern int iscsit_tx_login_rsp(struct iscsi_conn *, u8, u8);
59extern void iscsit_print_session_params(struct iscsi_session *);
60extern int iscsit_print_dev_to_proc(char *, char **, off_t, int);
61extern int iscsit_print_sessions_to_proc(char *, char **, off_t, int);
62extern int iscsit_print_tpg_to_proc(char *, char **, off_t, int);
63extern int rx_data(struct iscsi_conn *, struct kvec *, int, int);
64extern int tx_data(struct iscsi_conn *, struct kvec *, int, int);
65extern void iscsit_collect_login_stats(struct iscsi_conn *, u8, u8);
66extern struct iscsi_tiqn *iscsit_snmp_get_tiqn(struct iscsi_conn *);
67
68#endif /*** ISCSI_TARGET_UTIL_H ***/