aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorDoug Ledford <dledford@redhat.com>2012-03-01 12:55:21 -0500
committerRoland Dreier <roland@purestorage.com>2012-03-05 03:23:27 -0500
commitd474186f19d7ac1c7fbb293fdcfa46103e45e2ca (patch)
treeba5eb32ddc42e99dd3600cd7a972cb31ecdf1e61 /drivers/infiniband
parent6b21d18ed50c7d145220b0724ea7f2613abf0f95 (diff)
IB/iser: Free IB connection resources in the proper place
We allocate the login dma buffers in iser_verbs.c as part of alloc_ib_conn_resources(), however we are freeing them in iser_initiator.c as part of iser_free_rx_descriptors(). This is needlessly confusing. We have an alloc_rx_descriptors() and it doesn't alloc something that the free_rx_descriptors() frees, and we have an alloc_ib_conn_resources() that allocs something not freed by free_ib_conn_resources(). Clean that up. Signed-off-by: Doug Ledford <dledford@redhat.com> [ Fix build error in iser_free_ib_conn_res(). - Or ] Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/ulp/iser/iser_initiator.c12
-rw-r--r--drivers/infiniband/ulp/iser/iser_verbs.c12
2 files changed, 12 insertions, 12 deletions
diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c
index a607542fc796..622e9857c869 100644
--- a/drivers/infiniband/ulp/iser/iser_initiator.c
+++ b/drivers/infiniband/ulp/iser/iser_initiator.c
@@ -220,18 +220,6 @@ void iser_free_rx_descriptors(struct iser_conn *ib_conn)
220 struct iser_rx_desc *rx_desc; 220 struct iser_rx_desc *rx_desc;
221 struct iser_device *device = ib_conn->device; 221 struct iser_device *device = ib_conn->device;
222 222
223 if (ib_conn->login_buf) {
224 if (ib_conn->login_req_dma)
225 ib_dma_unmap_single(device->ib_device,
226 ib_conn->login_req_dma,
227 ISCSI_DEF_MAX_RECV_SEG_LEN, DMA_TO_DEVICE);
228 if (ib_conn->login_resp_dma)
229 ib_dma_unmap_single(device->ib_device,
230 ib_conn->login_resp_dma,
231 ISER_RX_LOGIN_SIZE, DMA_FROM_DEVICE);
232 kfree(ib_conn->login_buf);
233 }
234
235 if (!ib_conn->rx_descs) 223 if (!ib_conn->rx_descs)
236 return; 224 return;
237 225
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
index e28877c4ce15..14224ba44fd8 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -274,6 +274,18 @@ static int iser_free_ib_conn_res(struct iser_conn *ib_conn, int can_destroy_id)
274 ib_conn->cma_id = NULL; 274 ib_conn->cma_id = NULL;
275 kfree(ib_conn->page_vec); 275 kfree(ib_conn->page_vec);
276 276
277 if (ib_conn->login_buf) {
278 if (ib_conn->login_req_dma)
279 ib_dma_unmap_single(ib_conn->device->ib_device,
280 ib_conn->login_req_dma,
281 ISCSI_DEF_MAX_RECV_SEG_LEN, DMA_TO_DEVICE);
282 if (ib_conn->login_resp_dma)
283 ib_dma_unmap_single(ib_conn->device->ib_device,
284 ib_conn->login_resp_dma,
285 ISER_RX_LOGIN_SIZE, DMA_FROM_DEVICE);
286 kfree(ib_conn->login_buf);
287 }
288
277 return 0; 289 return 0;
278} 290}
279 291