Nicholas Bellinger | e48354c | 2011-07-23 06:43:04 +0000 | [diff] [blame] | 1 | #ifndef ISCSI_TARGET_UTIL_H |
| 2 | #define ISCSI_TARGET_UTIL_H |
| 3 | |
Bart Van Assche | 8dcf07b | 2016-11-14 15:47:14 -0800 | [diff] [blame] | 4 | #include <linux/types.h> |
| 5 | #include <scsi/iscsi_proto.h> /* itt_t */ |
| 6 | |
Nicholas Bellinger | e48354c | 2011-07-23 06:43:04 +0000 | [diff] [blame] | 7 | #define MARKER_SIZE 8 |
| 8 | |
Bart Van Assche | 8dcf07b | 2016-11-14 15:47:14 -0800 | [diff] [blame] | 9 | struct iscsi_cmd; |
| 10 | struct iscsi_conn; |
| 11 | struct iscsi_conn_recovery; |
| 12 | struct iscsi_session; |
| 13 | |
Nicholas Bellinger | e48354c | 2011-07-23 06:43:04 +0000 | [diff] [blame] | 14 | extern int iscsit_add_r2t_to_list(struct iscsi_cmd *, u32, u32, int, u32); |
| 15 | extern struct iscsi_r2t *iscsit_get_r2t_for_eos(struct iscsi_cmd *, u32, u32); |
| 16 | extern struct iscsi_r2t *iscsit_get_r2t_from_list(struct iscsi_cmd *); |
| 17 | extern void iscsit_free_r2t(struct iscsi_r2t *, struct iscsi_cmd *); |
| 18 | extern void iscsit_free_r2ts_from_list(struct iscsi_cmd *); |
Nicholas Bellinger | cdb7266 | 2013-03-06 22:09:17 -0800 | [diff] [blame] | 19 | extern struct iscsi_cmd *iscsit_alloc_cmd(struct iscsi_conn *, gfp_t); |
Nicholas Bellinger | 676687c | 2014-01-20 03:36:44 +0000 | [diff] [blame] | 20 | extern struct iscsi_cmd *iscsit_allocate_cmd(struct iscsi_conn *, int); |
Nicholas Bellinger | e48354c | 2011-07-23 06:43:04 +0000 | [diff] [blame] | 21 | extern struct iscsi_seq *iscsit_get_seq_holder_for_datain(struct iscsi_cmd *, u32); |
| 22 | extern struct iscsi_seq *iscsit_get_seq_holder_for_r2t(struct iscsi_cmd *); |
| 23 | extern struct iscsi_r2t *iscsit_get_holder_for_r2tsn(struct iscsi_cmd *, u32); |
Nicholas Bellinger | 561bf15 | 2013-07-03 03:58:58 -0700 | [diff] [blame] | 24 | extern int iscsit_sequence_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, |
| 25 | unsigned char * ,__be32 cmdsn); |
Nicholas Bellinger | e48354c | 2011-07-23 06:43:04 +0000 | [diff] [blame] | 26 | extern int iscsit_check_unsolicited_dataout(struct iscsi_cmd *, unsigned char *); |
Nicholas Bellinger | e48354c | 2011-07-23 06:43:04 +0000 | [diff] [blame] | 27 | extern struct iscsi_cmd *iscsit_find_cmd_from_itt_or_dump(struct iscsi_conn *, |
Christoph Hellwig | 66c7db6 | 2012-09-26 08:00:39 -0400 | [diff] [blame] | 28 | itt_t, u32); |
Nicholas Bellinger | e48354c | 2011-07-23 06:43:04 +0000 | [diff] [blame] | 29 | extern struct iscsi_cmd *iscsit_find_cmd_from_ttt(struct iscsi_conn *, u32); |
| 30 | extern int iscsit_find_cmd_for_recovery(struct iscsi_session *, struct iscsi_cmd **, |
Christoph Hellwig | 66c7db6 | 2012-09-26 08:00:39 -0400 | [diff] [blame] | 31 | struct iscsi_conn_recovery **, itt_t); |
Nicholas Bellinger | e48354c | 2011-07-23 06:43:04 +0000 | [diff] [blame] | 32 | extern void iscsit_add_cmd_to_immediate_queue(struct iscsi_cmd *, struct iscsi_conn *, u8); |
| 33 | extern struct iscsi_queue_req *iscsit_get_cmd_from_immediate_queue(struct iscsi_conn *); |
Nicholas Bellinger | a446701 | 2016-10-30 17:30:08 -0700 | [diff] [blame] | 34 | extern int iscsit_add_cmd_to_response_queue(struct iscsi_cmd *, struct iscsi_conn *, u8); |
Nicholas Bellinger | e48354c | 2011-07-23 06:43:04 +0000 | [diff] [blame] | 35 | extern struct iscsi_queue_req *iscsit_get_cmd_from_response_queue(struct iscsi_conn *); |
| 36 | extern void iscsit_remove_cmd_from_tx_queues(struct iscsi_cmd *, struct iscsi_conn *); |
Roland Dreier | d5627ac | 2012-10-31 09:16:46 -0700 | [diff] [blame] | 37 | extern bool iscsit_conn_all_queues_empty(struct iscsi_conn *); |
Nicholas Bellinger | e48354c | 2011-07-23 06:43:04 +0000 | [diff] [blame] | 38 | extern void iscsit_free_queue_reqs_for_conn(struct iscsi_conn *); |
| 39 | extern void iscsit_release_cmd(struct iscsi_cmd *); |
Nicholas Bellinger | 131e6ab | 2014-03-22 14:55:56 -0700 | [diff] [blame] | 40 | extern void __iscsit_free_cmd(struct iscsi_cmd *, bool, bool); |
Nicholas Bellinger | aafc9d1 | 2013-05-31 00:49:41 -0700 | [diff] [blame] | 41 | extern void iscsit_free_cmd(struct iscsi_cmd *, bool); |
Nicholas Bellinger | e48354c | 2011-07-23 06:43:04 +0000 | [diff] [blame] | 42 | extern int iscsit_check_session_usage_count(struct iscsi_session *); |
| 43 | extern void iscsit_dec_session_usage_count(struct iscsi_session *); |
| 44 | extern void iscsit_inc_session_usage_count(struct iscsi_session *); |
Nicholas Bellinger | e48354c | 2011-07-23 06:43:04 +0000 | [diff] [blame] | 45 | extern struct iscsi_conn *iscsit_get_conn_from_cid(struct iscsi_session *, u16); |
| 46 | extern struct iscsi_conn *iscsit_get_conn_from_cid_rcfr(struct iscsi_session *, u16); |
| 47 | extern void iscsit_check_conn_usage_count(struct iscsi_conn *); |
| 48 | extern void iscsit_dec_conn_usage_count(struct iscsi_conn *); |
| 49 | extern void iscsit_inc_conn_usage_count(struct iscsi_conn *); |
| 50 | extern void iscsit_mod_nopin_response_timer(struct iscsi_conn *); |
| 51 | extern void iscsit_start_nopin_response_timer(struct iscsi_conn *); |
| 52 | extern void iscsit_stop_nopin_response_timer(struct iscsi_conn *); |
| 53 | extern void __iscsit_start_nopin_timer(struct iscsi_conn *); |
| 54 | extern void iscsit_start_nopin_timer(struct iscsi_conn *); |
| 55 | extern void iscsit_stop_nopin_timer(struct iscsi_conn *); |
| 56 | extern int iscsit_send_tx_data(struct iscsi_cmd *, struct iscsi_conn *, int); |
| 57 | extern int iscsit_fe_sendpage_sg(struct iscsi_cmd *, struct iscsi_conn *); |
| 58 | extern int iscsit_tx_login_rsp(struct iscsi_conn *, u8, u8); |
| 59 | extern void iscsit_print_session_params(struct iscsi_session *); |
| 60 | extern int iscsit_print_dev_to_proc(char *, char **, off_t, int); |
| 61 | extern int iscsit_print_sessions_to_proc(char *, char **, off_t, int); |
| 62 | extern int iscsit_print_tpg_to_proc(char *, char **, off_t, int); |
| 63 | extern int rx_data(struct iscsi_conn *, struct kvec *, int, int); |
| 64 | extern int tx_data(struct iscsi_conn *, struct kvec *, int, int); |
| 65 | extern void iscsit_collect_login_stats(struct iscsi_conn *, u8, u8); |
| 66 | extern struct iscsi_tiqn *iscsit_snmp_get_tiqn(struct iscsi_conn *); |
| 67 | |
| 68 | #endif /*** ISCSI_TARGET_UTIL_H ***/ |