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