Pull asus into release branch
[pandora-kernel.git] / drivers / infiniband / ulp / iser / iser_verbs.c
index 72febf1..1fc9674 100644 (file)
@@ -48,7 +48,6 @@
 
 static void iser_cq_tasklet_fn(unsigned long data);
 static void iser_cq_callback(struct ib_cq *cq, void *cq_context);
-static void iser_comp_error_worker(void *data);
 
 static void iser_cq_event_callback(struct ib_event *cause, void *context)
 {
@@ -88,8 +87,9 @@ static int iser_create_device_ib_res(struct iser_device *device)
                     iser_cq_tasklet_fn,
                     (unsigned long)device);
 
-       device->mr = ib_get_dma_mr(device->pd,
-                                  IB_ACCESS_LOCAL_WRITE);
+       device->mr = ib_get_dma_mr(device->pd, IB_ACCESS_LOCAL_WRITE |
+                                  IB_ACCESS_REMOTE_WRITE |
+                                  IB_ACCESS_REMOTE_READ);
        if (IS_ERR(device->mr))
                goto dma_mr_err;
 
@@ -150,7 +150,7 @@ static int iser_create_ib_conn_res(struct iser_conn *ib_conn)
        }
        ib_conn->page_vec->pages = (u64 *) (ib_conn->page_vec + 1);
 
-       params.page_shift        = PAGE_SHIFT;
+       params.page_shift        = SHIFT_4K;
        /* when the first/last SG element are not start/end *
         * page aligned, the map whould be of N+1 pages     */
        params.max_pages_per_fmr = ISCSI_ISER_SG_TABLESIZE + 1;
@@ -479,8 +479,6 @@ int iser_conn_init(struct iser_conn **ibconn)
        init_waitqueue_head(&ib_conn->wait);
        atomic_set(&ib_conn->post_recv_buf_count, 0);
        atomic_set(&ib_conn->post_send_buf_count, 0);
-       INIT_WORK(&ib_conn->comperror_work, iser_comp_error_worker,
-                 ib_conn);
        INIT_LIST_HEAD(&ib_conn->conn_list);
        spin_lock_init(&ib_conn->lock);
 
@@ -570,6 +568,8 @@ void iser_conn_release(struct iser_conn *ib_conn)
        /* on EVENT_ADDR_ERROR there's no device yet for this conn */
        if (device != NULL)
                iser_device_try_release(device);
+       if (ib_conn->iser_conn)
+               ib_conn->iser_conn->ib_conn = NULL;
        kfree(ib_conn);
 }
 
@@ -604,8 +604,9 @@ int iser_reg_page_vec(struct iser_conn     *ib_conn,
 
        mem_reg->lkey  = mem->fmr->lkey;
        mem_reg->rkey  = mem->fmr->rkey;
-       mem_reg->len   = page_vec->length * PAGE_SIZE;
+       mem_reg->len   = page_vec->length * SIZE_4K;
        mem_reg->va    = io_addr;
+       mem_reg->is_fmr = 1;
        mem_reg->mem_h = (void *)mem;
 
        mem_reg->va   += page_vec->offset;
@@ -692,7 +693,7 @@ int iser_post_recv(struct iser_desc *rx_desc)
        struct iser_dto   *recv_dto = &rx_desc->dto;
 
        /* Retrieve conn */
-       ib_conn = recv_dto->conn->ib_conn;
+       ib_conn = recv_dto->ib_conn;
 
        iser_dto_to_iov(recv_dto, iov, 2);
 
@@ -725,7 +726,7 @@ int iser_post_send(struct iser_desc *tx_desc)
        struct iser_conn  *ib_conn;
        struct iser_dto   *dto = &tx_desc->dto;
 
-       ib_conn = dto->conn->ib_conn;
+       ib_conn = dto->ib_conn;
 
        iser_dto_to_iov(dto, iov, MAX_REGD_BUF_VECTOR_LEN);
 
@@ -750,29 +751,10 @@ int iser_post_send(struct iser_desc *tx_desc)
        return ret_val;
 }
 
-static void iser_comp_error_worker(void *data)
-{
-       struct iser_conn *ib_conn = data;
-
-       /* getting here when the state is UP means that the conn is being *
-        * terminated asynchronously from the iSCSI layer's perspective.  */
-       if (iser_conn_state_comp_exch(ib_conn, ISER_CONN_UP,
-                                     ISER_CONN_TERMINATING))
-               iscsi_conn_failure(ib_conn->iser_conn->iscsi_conn,
-                                       ISCSI_ERR_CONN_FAILED);
-
-       /* complete the termination process if disconnect event was delivered *
-        * note there are no more non completed posts to the QP               */
-       if (ib_conn->disc_evt_flag) {
-               ib_conn->state = ISER_CONN_DOWN;
-               wake_up_interruptible(&ib_conn->wait);
-       }
-}
-
 static void iser_handle_comp_error(struct iser_desc *desc)
 {
        struct iser_dto  *dto     = &desc->dto;
-       struct iser_conn *ib_conn = dto->conn->ib_conn;
+       struct iser_conn *ib_conn = dto->ib_conn;
 
        iser_dto_buffs_release(dto);
 
@@ -787,8 +769,22 @@ static void iser_handle_comp_error(struct iser_desc *desc)
        }
 
        if (atomic_read(&ib_conn->post_recv_buf_count) == 0 &&
-           atomic_read(&ib_conn->post_send_buf_count) == 0)
-               schedule_work(&ib_conn->comperror_work);
+           atomic_read(&ib_conn->post_send_buf_count) == 0) {
+               /* getting here when the state is UP means that the conn is *
+                * being terminated asynchronously from the iSCSI layer's   *
+                * perspective.                                             */
+               if (iser_conn_state_comp_exch(ib_conn, ISER_CONN_UP,
+                   ISER_CONN_TERMINATING))
+                       iscsi_conn_failure(ib_conn->iser_conn->iscsi_conn,
+                                          ISCSI_ERR_CONN_FAILED);
+
+               /* complete the termination process if disconnect event was delivered *
+                * note there are no more non completed posts to the QP               */
+               if (ib_conn->disc_evt_flag) {
+                       ib_conn->state = ISER_CONN_DOWN;
+                       wake_up_interruptible(&ib_conn->wait);
+               }
+       }
 }
 
 static void iser_cq_tasklet_fn(unsigned long data)