diff options
Diffstat (limited to 'drivers/infiniband/ulp/iser/iscsi_iser.c')
-rw-r--r-- | drivers/infiniband/ulp/iser/iscsi_iser.c | 47 |
1 files changed, 32 insertions, 15 deletions
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index 5f7a6fca0a4d..71237f8f78f7 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c | |||
@@ -128,6 +128,28 @@ static int iscsi_iser_pdu_alloc(struct iscsi_task *task, uint8_t opcode) | |||
128 | return 0; | 128 | return 0; |
129 | } | 129 | } |
130 | 130 | ||
131 | int iser_initialize_task_headers(struct iscsi_task *task, | ||
132 | struct iser_tx_desc *tx_desc) | ||
133 | { | ||
134 | struct iscsi_iser_conn *iser_conn = task->conn->dd_data; | ||
135 | struct iser_device *device = iser_conn->ib_conn->device; | ||
136 | struct iscsi_iser_task *iser_task = task->dd_data; | ||
137 | u64 dma_addr; | ||
138 | |||
139 | dma_addr = ib_dma_map_single(device->ib_device, (void *)tx_desc, | ||
140 | ISER_HEADERS_LEN, DMA_TO_DEVICE); | ||
141 | if (ib_dma_mapping_error(device->ib_device, dma_addr)) | ||
142 | return -ENOMEM; | ||
143 | |||
144 | tx_desc->dma_addr = dma_addr; | ||
145 | tx_desc->tx_sg[0].addr = tx_desc->dma_addr; | ||
146 | tx_desc->tx_sg[0].length = ISER_HEADERS_LEN; | ||
147 | tx_desc->tx_sg[0].lkey = device->mr->lkey; | ||
148 | |||
149 | iser_task->headers_initialized = 1; | ||
150 | iser_task->iser_conn = iser_conn; | ||
151 | return 0; | ||
152 | } | ||
131 | /** | 153 | /** |
132 | * iscsi_iser_task_init - Initialize task | 154 | * iscsi_iser_task_init - Initialize task |
133 | * @task: iscsi task | 155 | * @task: iscsi task |
@@ -137,17 +159,17 @@ static int iscsi_iser_pdu_alloc(struct iscsi_task *task, uint8_t opcode) | |||
137 | static int | 159 | static int |
138 | iscsi_iser_task_init(struct iscsi_task *task) | 160 | iscsi_iser_task_init(struct iscsi_task *task) |
139 | { | 161 | { |
140 | struct iscsi_iser_conn *iser_conn = task->conn->dd_data; | ||
141 | struct iscsi_iser_task *iser_task = task->dd_data; | 162 | struct iscsi_iser_task *iser_task = task->dd_data; |
142 | 163 | ||
164 | if (!iser_task->headers_initialized) | ||
165 | if (iser_initialize_task_headers(task, &iser_task->desc)) | ||
166 | return -ENOMEM; | ||
167 | |||
143 | /* mgmt task */ | 168 | /* mgmt task */ |
144 | if (!task->sc) { | 169 | if (!task->sc) |
145 | iser_task->desc.data = task->data; | ||
146 | return 0; | 170 | return 0; |
147 | } | ||
148 | 171 | ||
149 | iser_task->command_sent = 0; | 172 | iser_task->command_sent = 0; |
150 | iser_task->iser_conn = iser_conn; | ||
151 | iser_task_rdma_init(iser_task); | 173 | iser_task_rdma_init(iser_task); |
152 | return 0; | 174 | return 0; |
153 | } | 175 | } |
@@ -168,7 +190,7 @@ iscsi_iser_mtask_xmit(struct iscsi_conn *conn, struct iscsi_task *task) | |||
168 | { | 190 | { |
169 | int error = 0; | 191 | int error = 0; |
170 | 192 | ||
171 | iser_dbg("task deq [cid %d itt 0x%x]\n", conn->id, task->itt); | 193 | iser_dbg("mtask xmit [cid %d itt 0x%x]\n", conn->id, task->itt); |
172 | 194 | ||
173 | error = iser_send_control(conn, task); | 195 | error = iser_send_control(conn, task); |
174 | 196 | ||
@@ -178,9 +200,6 @@ iscsi_iser_mtask_xmit(struct iscsi_conn *conn, struct iscsi_task *task) | |||
178 | * - if yes, the task is recycled at iscsi_complete_pdu | 200 | * - if yes, the task is recycled at iscsi_complete_pdu |
179 | * - if no, the task is recycled at iser_snd_completion | 201 | * - if no, the task is recycled at iser_snd_completion |
180 | */ | 202 | */ |
181 | if (error && error != -ENOBUFS) | ||
182 | iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED); | ||
183 | |||
184 | return error; | 203 | return error; |
185 | } | 204 | } |
186 | 205 | ||
@@ -232,7 +251,7 @@ iscsi_iser_task_xmit(struct iscsi_task *task) | |||
232 | task->imm_count, task->unsol_r2t.data_length); | 251 | task->imm_count, task->unsol_r2t.data_length); |
233 | } | 252 | } |
234 | 253 | ||
235 | iser_dbg("task deq [cid %d itt 0x%x]\n", | 254 | iser_dbg("ctask xmit [cid %d itt 0x%x]\n", |
236 | conn->id, task->itt); | 255 | conn->id, task->itt); |
237 | 256 | ||
238 | /* Send the cmd PDU */ | 257 | /* Send the cmd PDU */ |
@@ -248,8 +267,6 @@ iscsi_iser_task_xmit(struct iscsi_task *task) | |||
248 | error = iscsi_iser_task_xmit_unsol_data(conn, task); | 267 | error = iscsi_iser_task_xmit_unsol_data(conn, task); |
249 | 268 | ||
250 | iscsi_iser_task_xmit_exit: | 269 | iscsi_iser_task_xmit_exit: |
251 | if (error && error != -ENOBUFS) | ||
252 | iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED); | ||
253 | return error; | 270 | return error; |
254 | } | 271 | } |
255 | 272 | ||
@@ -283,7 +300,7 @@ iscsi_iser_conn_create(struct iscsi_cls_session *cls_session, uint32_t conn_idx) | |||
283 | * due to issues with the login code re iser sematics | 300 | * due to issues with the login code re iser sematics |
284 | * this not set in iscsi_conn_setup - FIXME | 301 | * this not set in iscsi_conn_setup - FIXME |
285 | */ | 302 | */ |
286 | conn->max_recv_dlength = 128; | 303 | conn->max_recv_dlength = ISER_RECV_DATA_SEG_LEN; |
287 | 304 | ||
288 | iser_conn = conn->dd_data; | 305 | iser_conn = conn->dd_data; |
289 | conn->dd_data = iser_conn; | 306 | conn->dd_data = iser_conn; |
@@ -401,7 +418,7 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep, | |||
401 | struct Scsi_Host *shost; | 418 | struct Scsi_Host *shost; |
402 | struct iser_conn *ib_conn; | 419 | struct iser_conn *ib_conn; |
403 | 420 | ||
404 | shost = iscsi_host_alloc(&iscsi_iser_sht, 0, 1); | 421 | shost = iscsi_host_alloc(&iscsi_iser_sht, 0, 0); |
405 | if (!shost) | 422 | if (!shost) |
406 | return NULL; | 423 | return NULL; |
407 | shost->transportt = iscsi_iser_scsi_transport; | 424 | shost->transportt = iscsi_iser_scsi_transport; |
@@ -675,7 +692,7 @@ static int __init iser_init(void) | |||
675 | memset(&ig, 0, sizeof(struct iser_global)); | 692 | memset(&ig, 0, sizeof(struct iser_global)); |
676 | 693 | ||
677 | ig.desc_cache = kmem_cache_create("iser_descriptors", | 694 | ig.desc_cache = kmem_cache_create("iser_descriptors", |
678 | sizeof (struct iser_desc), | 695 | sizeof(struct iser_tx_desc), |
679 | 0, SLAB_HWCACHE_ALIGN, | 696 | 0, SLAB_HWCACHE_ALIGN, |
680 | NULL); | 697 | NULL); |
681 | if (ig.desc_cache == NULL) | 698 | if (ig.desc_cache == NULL) |