1 /*
2  * QLogic iSCSI Offload Driver
3  * Copyright (c) 2016 Cavium Inc.
4  *
5  * This software is available under the terms of the GNU General Public License
6  * (GPL) Version 2, available from the file COPYING in the main directory of
7  * this source tree.
8  */
9 
10 #ifndef _QEDI_FW_ISCSI_H_
11 #define _QEDI_FW_ISCSI_H_
12 
13 #include "qedi_fw_scsi.h"
14 
15 struct iscsi_task_params {
16 	struct iscsi_task_context *context;
17 	struct iscsi_wqe	  *sqe;
18 	u32			  tx_io_size;
19 	u32			  rx_io_size;
20 	u16			  conn_icid;
21 	u16			  itid;
22 	u8			  cq_rss_number;
23 };
24 
25 struct iscsi_conn_params {
26 	u32	first_burst_length;
27 	u32	max_send_pdu_length;
28 	u32	max_burst_length;
29 	bool	initial_r2t;
30 	bool	immediate_data;
31 };
32 
33 /* @brief init_initiator_read_iscsi_task - initializes iSCSI Initiator Read
34  * task context.
35  *
36  * @param task_params	  - Pointer to task parameters struct
37  * @param conn_params	  - Connection Parameters
38  * @param cmd_params	  - command specific parameters
39  * @param cmd_pdu_header  - PDU Header Parameters
40  * @param sgl_task_params - Pointer to SGL task params
41  * @param dif_task_params - Pointer to DIF parameters struct
42  */
43 int init_initiator_rw_iscsi_task(struct iscsi_task_params *task_params,
44 				 struct iscsi_conn_params *conn_params,
45 				 struct scsi_initiator_cmd_params *cmd_params,
46 				 struct iscsi_cmd_hdr *cmd_pdu_header,
47 				 struct scsi_sgl_task_params *tx_sgl_params,
48 				 struct scsi_sgl_task_params *rx_sgl_params,
49 				 struct scsi_dif_task_params *dif_task_params);
50 
51 /* @brief init_initiator_login_request_task - initializes iSCSI Initiator Login
52  * Request task context.
53  *
54  * @param task_params		  - Pointer to task parameters struct
55  * @param login_req_pdu_header    - PDU Header Parameters
56  * @param tx_sgl_task_params	  - Pointer to SGL task params
57  * @param rx_sgl_task_params	  - Pointer to SGL task params
58  */
59 int init_initiator_login_request_task(struct iscsi_task_params *task_params,
60 				      struct iscsi_login_req_hdr *login_header,
61 				      struct scsi_sgl_task_params *tx_params,
62 				      struct scsi_sgl_task_params *rx_params);
63 
64 /* @brief init_initiator_nop_out_task - initializes iSCSI Initiator NOP Out
65  * task context.
66  *
67  * @param task_params		- Pointer to task parameters struct
68  * @param nop_out_pdu_header    - PDU Header Parameters
69  * @param tx_sgl_task_params	- Pointer to SGL task params
70  * @param rx_sgl_task_params	- Pointer to SGL task params
71  */
72 int init_initiator_nop_out_task(struct iscsi_task_params *task_params,
73 				struct iscsi_nop_out_hdr *nop_out_pdu_header,
74 				struct scsi_sgl_task_params *tx_sgl_params,
75 				struct scsi_sgl_task_params *rx_sgl_params);
76 
77 /* @brief init_initiator_logout_request_task - initializes iSCSI Initiator
78  * Logout Request task context.
79  *
80  * @param task_params		- Pointer to task parameters struct
81  * @param logout_pdu_header  - PDU Header Parameters
82  * @param tx_sgl_task_params	- Pointer to SGL task params
83  * @param rx_sgl_task_params	- Pointer to SGL task params
84  */
85 int init_initiator_logout_request_task(struct iscsi_task_params *task_params,
86 				       struct iscsi_logout_req_hdr *logout_hdr,
87 				       struct scsi_sgl_task_params *tx_params,
88 				       struct scsi_sgl_task_params *rx_params);
89 
90 /* @brief init_initiator_tmf_request_task - initializes iSCSI Initiator TMF
91  * task context.
92  *
93  * @param task_params	- Pointer to task parameters struct
94  * @param tmf_pdu_header - PDU Header Parameters
95  */
96 int init_initiator_tmf_request_task(struct iscsi_task_params *task_params,
97 				    struct iscsi_tmf_request_hdr *tmf_header);
98 
99 /* @brief init_initiator_text_request_task - initializes iSCSI Initiator Text
100  * Request task context.
101  *
102  * @param task_params		     - Pointer to task parameters struct
103  * @param text_request_pdu_header    - PDU Header Parameters
104  * @param tx_sgl_task_params	     - Pointer to Tx SGL task params
105  * @param rx_sgl_task_params	     - Pointer to Rx SGL task params
106  */
107 int init_initiator_text_request_task(struct iscsi_task_params *task_params,
108 				     struct iscsi_text_request_hdr *text_header,
109 				     struct scsi_sgl_task_params *tx_params,
110 				     struct scsi_sgl_task_params *rx_params);
111 
112 /* @brief init_cleanup_task - initializes Clean task (SQE)
113  *
114  * @param task_params - Pointer to task parameters struct
115  */
116 int init_cleanup_task(struct iscsi_task_params *task_params);
117 #endif
118