Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci
[pandora-kernel.git] / drivers / infiniband / ulp / iser / iser_initiator.c
index f299de6..a607542 100644 (file)
@@ -221,8 +221,14 @@ void iser_free_rx_descriptors(struct iser_conn *ib_conn)
        struct iser_device *device = ib_conn->device;
 
        if (ib_conn->login_buf) {
-               ib_dma_unmap_single(device->ib_device, ib_conn->login_dma,
-                       ISER_RX_LOGIN_SIZE, DMA_FROM_DEVICE);
+               if (ib_conn->login_req_dma)
+                       ib_dma_unmap_single(device->ib_device,
+                               ib_conn->login_req_dma,
+                               ISCSI_DEF_MAX_RECV_SEG_LEN, DMA_TO_DEVICE);
+               if (ib_conn->login_resp_dma)
+                       ib_dma_unmap_single(device->ib_device,
+                               ib_conn->login_resp_dma,
+                               ISER_RX_LOGIN_SIZE, DMA_FROM_DEVICE);
                kfree(ib_conn->login_buf);
        }
 
@@ -394,6 +400,7 @@ int iser_send_control(struct iscsi_conn *conn,
        unsigned long data_seg_len;
        int err = 0;
        struct iser_device *device;
+       struct iser_conn *ib_conn = iser_conn->ib_conn;
 
        /* build the tx desc regd header and add it to the tx desc dto */
        mdesc->type = ISCSI_TX_CONTROL;
@@ -409,9 +416,19 @@ int iser_send_control(struct iscsi_conn *conn,
                        iser_err("data present on non login task!!!\n");
                        goto send_control_error;
                }
-               memcpy(iser_conn->ib_conn->login_buf, task->data,
+
+               ib_dma_sync_single_for_cpu(device->ib_device,
+                       ib_conn->login_req_dma, task->data_count,
+                       DMA_TO_DEVICE);
+
+               memcpy(iser_conn->ib_conn->login_req_buf, task->data,
                                                        task->data_count);
-               tx_dsg->addr    = iser_conn->ib_conn->login_dma;
+
+               ib_dma_sync_single_for_device(device->ib_device,
+                       ib_conn->login_req_dma, task->data_count,
+                       DMA_TO_DEVICE);
+
+               tx_dsg->addr    = iser_conn->ib_conn->login_req_dma;
                tx_dsg->length  = task->data_count;
                tx_dsg->lkey    = device->mr->lkey;
                mdesc->num_sge = 2;
@@ -445,8 +462,8 @@ void iser_rcv_completion(struct iser_rx_desc *rx_desc,
        int rx_buflen, outstanding, count, err;
 
        /* differentiate between login to all other PDUs */
-       if ((char *)rx_desc == ib_conn->login_buf) {
-               rx_dma = ib_conn->login_dma;
+       if ((char *)rx_desc == ib_conn->login_resp_buf) {
+               rx_dma = ib_conn->login_resp_dma;
                rx_buflen = ISER_RX_LOGIN_SIZE;
        } else {
                rx_dma = rx_desc->dma_addr;
@@ -473,7 +490,7 @@ void iser_rcv_completion(struct iser_rx_desc *rx_desc,
         * for the posted rx bufs refcount to become zero handles everything   */
        conn->ib_conn->post_recv_buf_count--;
 
-       if (rx_dma == ib_conn->login_dma)
+       if (rx_dma == ib_conn->login_resp_dma)
                return;
 
        outstanding = ib_conn->post_recv_buf_count;