Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Nicholas Bellinger | e48354c | 2011-07-23 06:43:04 +0000 | [diff] [blame] | 2 | #ifndef ISCSI_SEQ_AND_PDU_LIST_H |
| 3 | #define ISCSI_SEQ_AND_PDU_LIST_H |
| 4 | |
Bart Van Assche | 8dcf07b | 2016-11-14 15:47:14 -0800 | [diff] [blame] | 5 | #include <linux/types.h> |
| 6 | #include <linux/cache.h> |
| 7 | |
Nicholas Bellinger | e48354c | 2011-07-23 06:43:04 +0000 | [diff] [blame] | 8 | /* struct iscsi_pdu->status */ |
| 9 | #define DATAOUT_PDU_SENT 1 |
| 10 | |
| 11 | /* struct iscsi_seq->type */ |
| 12 | #define SEQTYPE_IMMEDIATE 1 |
| 13 | #define SEQTYPE_UNSOLICITED 2 |
| 14 | #define SEQTYPE_NORMAL 3 |
| 15 | |
| 16 | /* struct iscsi_seq->status */ |
| 17 | #define DATAOUT_SEQUENCE_GOT_R2T 1 |
| 18 | #define DATAOUT_SEQUENCE_WITHIN_COMMAND_RECOVERY 2 |
| 19 | #define DATAOUT_SEQUENCE_COMPLETE 3 |
| 20 | |
| 21 | /* iscsi_determine_counts_for_list() type */ |
| 22 | #define PDULIST_NORMAL 1 |
| 23 | #define PDULIST_IMMEDIATE 2 |
| 24 | #define PDULIST_UNSOLICITED 3 |
| 25 | #define PDULIST_IMMEDIATE_AND_UNSOLICITED 4 |
| 26 | |
| 27 | /* struct iscsi_pdu->type */ |
| 28 | #define PDUTYPE_IMMEDIATE 1 |
| 29 | #define PDUTYPE_UNSOLICITED 2 |
| 30 | #define PDUTYPE_NORMAL 3 |
| 31 | |
| 32 | /* struct iscsi_pdu->status */ |
| 33 | #define ISCSI_PDU_NOT_RECEIVED 0 |
| 34 | #define ISCSI_PDU_RECEIVED_OK 1 |
| 35 | #define ISCSI_PDU_CRC_FAILED 2 |
| 36 | #define ISCSI_PDU_TIMED_OUT 3 |
| 37 | |
| 38 | /* struct iscsi_build_list->randomize */ |
| 39 | #define RANDOM_DATAIN_PDU_OFFSETS 0x01 |
| 40 | #define RANDOM_DATAIN_SEQ_OFFSETS 0x02 |
| 41 | #define RANDOM_DATAOUT_PDU_OFFSETS 0x04 |
| 42 | #define RANDOM_R2T_OFFSETS 0x08 |
| 43 | |
| 44 | /* struct iscsi_build_list->data_direction */ |
| 45 | #define ISCSI_PDU_READ 0x01 |
| 46 | #define ISCSI_PDU_WRITE 0x02 |
| 47 | |
| 48 | struct iscsi_build_list { |
| 49 | int data_direction; |
| 50 | int randomize; |
| 51 | int type; |
| 52 | int immediate_data_length; |
| 53 | }; |
| 54 | |
| 55 | struct iscsi_pdu { |
| 56 | int status; |
| 57 | int type; |
| 58 | u8 flags; |
| 59 | u32 data_sn; |
| 60 | u32 length; |
| 61 | u32 offset; |
| 62 | u32 pdu_send_order; |
| 63 | u32 seq_no; |
| 64 | } ____cacheline_aligned; |
| 65 | |
| 66 | struct iscsi_seq { |
| 67 | int sent; |
| 68 | int status; |
| 69 | int type; |
| 70 | u32 data_sn; |
| 71 | u32 first_datasn; |
| 72 | u32 last_datasn; |
| 73 | u32 next_burst_len; |
| 74 | u32 pdu_start; |
| 75 | u32 pdu_count; |
| 76 | u32 offset; |
| 77 | u32 orig_offset; |
| 78 | u32 pdu_send_order; |
| 79 | u32 r2t_sn; |
| 80 | u32 seq_send_order; |
| 81 | u32 seq_no; |
| 82 | u32 xfer_len; |
| 83 | } ____cacheline_aligned; |
| 84 | |
Max Gurtovoy | 66cd9d4 | 2022-04-28 12:29:37 +0300 | [diff] [blame] | 85 | struct iscsit_cmd; |
Bart Van Assche | 8dcf07b | 2016-11-14 15:47:14 -0800 | [diff] [blame] | 86 | |
Max Gurtovoy | 66cd9d4 | 2022-04-28 12:29:37 +0300 | [diff] [blame] | 87 | extern int iscsit_build_pdu_and_seq_lists(struct iscsit_cmd *, u32); |
| 88 | extern struct iscsi_pdu *iscsit_get_pdu_holder(struct iscsit_cmd *, u32, u32); |
| 89 | extern struct iscsi_pdu *iscsit_get_pdu_holder_for_seq(struct iscsit_cmd *, struct iscsi_seq *); |
| 90 | extern struct iscsi_seq *iscsit_get_seq_holder(struct iscsit_cmd *, u32, u32); |
Nicholas Bellinger | e48354c | 2011-07-23 06:43:04 +0000 | [diff] [blame] | 91 | |
| 92 | #endif /* ISCSI_SEQ_AND_PDU_LIST_H */ |