IB/iser: set intuitive values for mr_valid
authorJenny Derzhavetz <jennyf@mellanox.com>
Wed, 9 Dec 2015 12:12:02 +0000 (14:12 +0200)
committerDoug Ledford <dledford@redhat.com>
Thu, 24 Dec 2015 05:17:34 +0000 (00:17 -0500)
This parameter is described as "is mr valid indicator".
In other words, it indicates whether memory registration
is valid or not. So intuitive values would be:
mr_valid=True, when memory registration is valid and
mr_valid=False otherwise.

Signed-off-by: Jenny Derzhavetz <jennyf@mellanox.com>
Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/ulp/iser/iser_memory.c
drivers/infiniband/ulp/iser/iser_verbs.c

index 088610e6647732c690b747507ce2b555659ef494..0a798498b303d3b5e8eaa99c07f70933a175b5f9 100644 (file)
@@ -399,7 +399,7 @@ iser_reg_sig_mr(struct iscsi_iser_task *iser_task,
 
        iser_set_prot_checks(iser_task->sc, &sig_attrs->check_mask);
 
-       if (!pi_ctx->sig_mr_valid)
+       if (pi_ctx->sig_mr_valid)
                iser_inv_rkey(iser_tx_next_wr(tx_desc), pi_ctx->sig_mr, cqe);
 
        wr = sig_handover_wr(iser_tx_next_wr(tx_desc));
@@ -417,7 +417,7 @@ iser_reg_sig_mr(struct iscsi_iser_task *iser_task,
        wr->access_flags = IB_ACCESS_LOCAL_WRITE |
                           IB_ACCESS_REMOTE_READ |
                           IB_ACCESS_REMOTE_WRITE;
-       pi_ctx->sig_mr_valid = 0;
+       pi_ctx->sig_mr_valid = 1;
 
        sig_reg->sge.lkey = pi_ctx->sig_mr->lkey;
        sig_reg->rkey = pi_ctx->sig_mr->rkey;
@@ -442,7 +442,7 @@ static int iser_fast_reg_mr(struct iscsi_iser_task *iser_task,
        struct ib_reg_wr *wr;
        int n;
 
-       if (!rsc->mr_valid)
+       if (rsc->mr_valid)
                iser_inv_rkey(iser_tx_next_wr(tx_desc), mr, cqe);
 
        n = ib_map_mr_sg(mr, mem->sg, mem->size, SIZE_4K);
@@ -463,7 +463,7 @@ static int iser_fast_reg_mr(struct iscsi_iser_task *iser_task,
                     IB_ACCESS_REMOTE_WRITE |
                     IB_ACCESS_REMOTE_READ;
 
-       rsc->mr_valid = 0;
+       rsc->mr_valid = 1;
 
        reg->sge.lkey = mr->lkey;
        reg->rkey = mr->rkey;
index 5fe40abae3d04e7c065a840b8c2913539dfe48f6..a27e5547dab46c196e9d8e2a3f74447e1759392b 100644 (file)
@@ -265,7 +265,7 @@ iser_alloc_reg_res(struct ib_device *ib_device,
                iser_err("Failed to allocate ib_fast_reg_mr err=%d\n", ret);
                return ret;
        }
-       res->mr_valid = 1;
+       res->mr_valid = 0;
 
        return 0;
 }
@@ -302,7 +302,7 @@ iser_alloc_pi_ctx(struct ib_device *ib_device,
                ret = PTR_ERR(pi_ctx->sig_mr);
                goto sig_mr_failure;
        }
-       pi_ctx->sig_mr_valid = 1;
+       pi_ctx->sig_mr_valid = 0;
        desc->pi_ctx->sig_protected = 0;
 
        return 0;