1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/list.h>
6 #include <linux/kfifo.h>
10 INVALIDATE_CMD_RESP_EL
= 0,
11 VALID_CMD_RESP_EL
= 0x80,
12 VALID_INIT_MSG
= 0xC0,
13 VALID_TRANS_EVENT
= 0xFF
30 enum srp_trans_event
{
33 PARTNER_DEREGISTER
= 2,
35 PREPARE_FOR_SUSPEND
= 9,
36 RESUME_FROM_SUSP
= 0xA
40 CRQ_ENTRY_OVERWRITTEN
= 0x20,
41 HEADER_DESCRIPTOR
= 0xF1,
46 enum srp_mad_version
{
57 enum srp_task_attributes
{
65 SRP_TASK_MANAGEMENT_FUNCTION_COMPLETE
= 0,
66 SRP_REQUEST_FIELDS_INVALID
= 2,
67 SRP_TASK_MANAGEMENT_FUNCTION_NOT_SUPPORTED
= 4,
68 SRP_TASK_MANAGEMENT_FUNCTION_FAILED
= 5
87 struct list_head cmd_queue
;
90 struct srp_queue iu_queue
;
92 struct srp_buf
**rx_ring
;
98 struct srp_target
*target
;
100 struct list_head ilist
;
101 dma_addr_t remote_token
;
104 struct srp_buf
*sbuf
;
108 struct ibmvscsis_cmd
;
110 typedef int (srp_rdma_t
)(struct ibmvscsis_cmd
*, struct scatterlist
*, int,
111 struct srp_direct_buf
*, int,
112 enum dma_data_direction
, unsigned int);
113 int srp_target_alloc(struct srp_target
*, struct device
*, size_t, size_t);
114 void srp_target_free(struct srp_target
*);
115 struct iu_entry
*srp_iu_get(struct srp_target
*);
116 void srp_iu_put(struct iu_entry
*);
117 int srp_transfer_data(struct ibmvscsis_cmd
*, struct srp_cmd
*,
118 srp_rdma_t
, int, int);
119 u64
srp_data_length(struct srp_cmd
*cmd
, enum dma_data_direction dir
);
120 int srp_get_desc_table(struct srp_cmd
*srp_cmd
, enum dma_data_direction
*dir
,
122 static inline int srp_cmd_direction(struct srp_cmd
*cmd
)
124 return (cmd
->buf_fmt
>> 4) ? DMA_TO_DEVICE
: DMA_FROM_DEVICE
;