| .. | .. |
|---|
| 59 | 59 | ISERT_MAX_TX_MISC_PDUS + \ |
|---|
| 60 | 60 | ISERT_MAX_RX_MISC_PDUS) |
|---|
| 61 | 61 | |
|---|
| 62 | | -#define ISER_RX_PAD_SIZE (ISCSI_DEF_MAX_RECV_SEG_LEN + 4096 - \ |
|---|
| 63 | | - (ISER_RX_PAYLOAD_SIZE + sizeof(u64) + sizeof(struct ib_sge) + \ |
|---|
| 64 | | - sizeof(struct ib_cqe) + sizeof(bool))) |
|---|
| 62 | +/* |
|---|
| 63 | + * RX size is default of 8k plus headers, but data needs to align to |
|---|
| 64 | + * 512 boundary, so use 1024 to have the extra space for alignment. |
|---|
| 65 | + */ |
|---|
| 66 | +#define ISER_RX_SIZE (ISCSI_DEF_MAX_RECV_SEG_LEN + 1024) |
|---|
| 65 | 67 | |
|---|
| 66 | | -#define ISCSI_ISER_SG_TABLESIZE 256 |
|---|
| 68 | +/* Minimum I/O size is 512KB */ |
|---|
| 69 | +#define ISCSI_ISER_MIN_SG_TABLESIZE 128 |
|---|
| 70 | + |
|---|
| 71 | +/* Maximum support is 16MB I/O size */ |
|---|
| 72 | +#define ISCSI_ISER_MAX_SG_TABLESIZE 4096 |
|---|
| 67 | 73 | |
|---|
| 68 | 74 | enum isert_desc_type { |
|---|
| 69 | 75 | ISCSI_TX_CONTROL, |
|---|
| .. | .. |
|---|
| 80 | 86 | }; |
|---|
| 81 | 87 | |
|---|
| 82 | 88 | struct iser_rx_desc { |
|---|
| 83 | | - struct iser_ctrl iser_header; |
|---|
| 84 | | - struct iscsi_hdr iscsi_header; |
|---|
| 85 | | - char data[ISCSI_DEF_MAX_RECV_SEG_LEN]; |
|---|
| 89 | + char buf[ISER_RX_SIZE]; |
|---|
| 86 | 90 | u64 dma_addr; |
|---|
| 87 | 91 | struct ib_sge rx_sg; |
|---|
| 88 | 92 | struct ib_cqe rx_cqe; |
|---|
| 89 | 93 | bool in_use; |
|---|
| 90 | | - char pad[ISER_RX_PAD_SIZE]; |
|---|
| 91 | | -} __packed; |
|---|
| 94 | +}; |
|---|
| 92 | 95 | |
|---|
| 93 | 96 | static inline struct iser_rx_desc *cqe_to_rx_desc(struct ib_cqe *cqe) |
|---|
| 94 | 97 | { |
|---|
| 95 | 98 | return container_of(cqe, struct iser_rx_desc, rx_cqe); |
|---|
| 99 | +} |
|---|
| 100 | + |
|---|
| 101 | +static void *isert_get_iser_hdr(struct iser_rx_desc *desc) |
|---|
| 102 | +{ |
|---|
| 103 | + return PTR_ALIGN(desc->buf + ISER_HEADERS_LEN, 512) - ISER_HEADERS_LEN; |
|---|
| 104 | +} |
|---|
| 105 | + |
|---|
| 106 | +static size_t isert_get_hdr_offset(struct iser_rx_desc *desc) |
|---|
| 107 | +{ |
|---|
| 108 | + return isert_get_iser_hdr(desc) - (void *)desc->buf; |
|---|
| 109 | +} |
|---|
| 110 | + |
|---|
| 111 | +static void *isert_get_iscsi_hdr(struct iser_rx_desc *desc) |
|---|
| 112 | +{ |
|---|
| 113 | + return isert_get_iser_hdr(desc) + sizeof(struct iser_ctrl); |
|---|
| 114 | +} |
|---|
| 115 | + |
|---|
| 116 | +static void *isert_get_data(struct iser_rx_desc *desc) |
|---|
| 117 | +{ |
|---|
| 118 | + void *data = isert_get_iser_hdr(desc) + ISER_HEADERS_LEN; |
|---|
| 119 | + |
|---|
| 120 | + WARN_ON((uintptr_t)data & 511); |
|---|
| 121 | + return data; |
|---|
| 96 | 122 | } |
|---|
| 97 | 123 | |
|---|
| 98 | 124 | struct iser_tx_desc { |
|---|
| .. | .. |
|---|
| 141 | 167 | u32 responder_resources; |
|---|
| 142 | 168 | u32 initiator_depth; |
|---|
| 143 | 169 | bool pi_support; |
|---|
| 144 | | - struct iser_rx_desc *login_req_buf; |
|---|
| 170 | + struct iser_rx_desc *login_desc; |
|---|
| 145 | 171 | char *login_rsp_buf; |
|---|
| 146 | | - u64 login_req_dma; |
|---|
| 147 | 172 | int login_req_len; |
|---|
| 148 | 173 | u64 login_rsp_dma; |
|---|
| 149 | 174 | struct iser_rx_desc *rx_descs; |
|---|
| .. | .. |
|---|
| 155 | 180 | struct iser_tx_desc login_tx_desc; |
|---|
| 156 | 181 | struct rdma_cm_id *cm_id; |
|---|
| 157 | 182 | struct ib_qp *qp; |
|---|
| 183 | + struct ib_cq *cq; |
|---|
| 184 | + u32 cq_size; |
|---|
| 158 | 185 | struct isert_device *device; |
|---|
| 159 | 186 | struct mutex mutex; |
|---|
| 160 | 187 | struct kref kref; |
|---|
| .. | .. |
|---|
| 163 | 190 | bool snd_w_inv; |
|---|
| 164 | 191 | wait_queue_head_t rem_wait; |
|---|
| 165 | 192 | bool dev_removed; |
|---|
| 166 | | -}; |
|---|
| 167 | | - |
|---|
| 168 | | -#define ISERT_MAX_CQ 64 |
|---|
| 169 | | - |
|---|
| 170 | | -/** |
|---|
| 171 | | - * struct isert_comp - iSER completion context |
|---|
| 172 | | - * |
|---|
| 173 | | - * @device: pointer to device handle |
|---|
| 174 | | - * @cq: completion queue |
|---|
| 175 | | - * @active_qps: Number of active QPs attached |
|---|
| 176 | | - * to completion context |
|---|
| 177 | | - */ |
|---|
| 178 | | -struct isert_comp { |
|---|
| 179 | | - struct isert_device *device; |
|---|
| 180 | | - struct ib_cq *cq; |
|---|
| 181 | | - int active_qps; |
|---|
| 182 | 193 | }; |
|---|
| 183 | 194 | |
|---|
| 184 | 195 | struct isert_device { |
|---|