Re: [PATCH v1 10/10] IB/iser: Support the remote invalidation exception

2015-12-01 Thread Sagi Grimberg



On 30/11/2015 23:36, Or Gerlitz wrote:

On Tue, Nov 24, 2015 at 6:23 PM, Sagi Grimberg  wrote:


From: Jenny Derzhavetz 

Declare that we support remote invalidation in case we are:
1. using Fastreg method
2. always registering memory.


decide if you want or don't want to use periods @ the end of these
cases, but be consistent... I vote not to use periods


I'll fix.





Detect the invalidated rkey from the work completion info so we
won't invalidate it locally. The spec madates that we must not rely
on the taget remote invalidate our rkey so we must check it upon
a receive (scsi response) completion.



s/madates/mandates/ and run spell check over the change-logs of the
whole series please before posting v2


OK.

Thanks Or
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v1 10/10] IB/iser: Support the remote invalidation exception

2015-11-30 Thread Or Gerlitz
On Tue, Nov 24, 2015 at 6:23 PM, Sagi Grimberg  wrote:
>
> From: Jenny Derzhavetz 
>
> Declare that we support remote invalidation in case we are:
> 1. using Fastreg method
> 2. always registering memory.

decide if you want or don't want to use periods @ the end of these
cases, but be consistent... I vote not to use periods

>
> Detect the invalidated rkey from the work completion info so we
> won't invalidate it locally. The spec madates that we must not rely
> on the taget remote invalidate our rkey so we must check it upon
> a receive (scsi response) completion.
>

s/madates/mandates/ and run spell check over the change-logs of the
whole series please before posting v2



>
> Signed-off-by: Jenny Derzhavetz 
> Signed-off-by: Sagi Grimberg 
> ---
>  drivers/infiniband/ulp/iser/iscsi_iser.h |  5 ++-
>  drivers/infiniband/ulp/iser/iser_initiator.c | 59 
> +++-
>  drivers/infiniband/ulp/iser/iser_memory.c|  4 +-
>  drivers/infiniband/ulp/iser/iser_verbs.c | 21 +++---
>  4 files changed, 80 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h 
> b/drivers/infiniband/ulp/iser/iscsi_iser.h
> index c79fdba6f969..e399d9a49df2 100644
> --- a/drivers/infiniband/ulp/iser/iscsi_iser.h
> +++ b/drivers/infiniband/ulp/iser/iscsi_iser.h
> @@ -358,6 +358,7 @@ struct iser_reg_ops {
>   * cpus and device max completion vectors
>   * @comps: Dinamically allocated array of completion handlers
>   * @reg_ops:   Registration ops
> + * @remote_inv_sup: Remote invalidate is supported on this device
>   */
>  struct iser_device {
> struct ib_device *ib_device;
> @@ -370,6 +371,7 @@ struct iser_device {
> int  comps_used;
> struct iser_comp *comps;
> struct iser_reg_ops  *reg_ops;
> +   bool remote_inv_sup;
>  };
>
>  #define ISER_CHECK_GUARD   0xc0
> @@ -519,6 +521,7 @@ struct iser_conn {
> u32  num_rx_descs;
> unsigned short   scsi_sg_tablesize;
> unsigned int scsi_max_sectors;
> +   bool snd_w_inv;
>  };
>
>  /**
> @@ -602,7 +605,7 @@ int iser_conn_terminate(struct iser_conn *iser_conn);
>  void iser_release_work(struct work_struct *work);
>
>  void iser_rcv_completion(struct iser_rx_desc *desc,
> -unsigned long dto_xfer_len,
> +struct ib_wc *wc,
>  struct ib_conn *ib_conn);
>
>  void iser_snd_completion(struct iser_tx_desc *desc,
> diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c 
> b/drivers/infiniband/ulp/iser/iser_initiator.c
> index 6a968e350c14..cd12f89b3365 100644
> --- a/drivers/infiniband/ulp/iser/iser_initiator.c
> +++ b/drivers/infiniband/ulp/iser/iser_initiator.c
> @@ -563,11 +563,61 @@ send_control_error:
> return err;
>  }
>
> +static inline void
> +iser_inv_desc(struct iser_fr_desc *desc, u32 rkey)
> +{
> +   if (likely(rkey == desc->rsc.mr->rkey))
> +   desc->rsc.mr_valid = 0;
> +   else if (likely(rkey == desc->pi_ctx->sig_mr->rkey))
> +   desc->pi_ctx->sig_mr_valid = 0;
> +}
> +
> +static int
> +iser_check_remote_inv(struct iser_conn *iser_conn,
> + struct ib_wc *wc,
> + struct iscsi_hdr *hdr)
> +{
> +   if (wc->wc_flags & IB_WC_WITH_INVALIDATE) {
> +   struct iscsi_task *task;
> +   u32 rkey = wc->ex.invalidate_rkey;
> +
> +   iser_dbg("conn %p: remote invalidation for rkey %#x\n",
> +iser_conn, rkey);
> +
> +   if (unlikely(!iser_conn->snd_w_inv)) {
> +   iser_err("conn %p: unexepected remote invalidation, "
> +"terminating connection\n", iser_conn);
> +   return -EPROTO;
> +   }
> +
> +   task = iscsi_itt_to_ctask(iser_conn->iscsi_conn, hdr->itt);
> +   if (likely(task)) {
> +   struct iscsi_iser_task *iser_task = task->dd_data;
> +   struct iser_fr_desc *desc;
> +
> +   if (iser_task->dir[ISER_DIR_IN]) {
> +   desc = iser_task->rdma_reg[ISER_DIR_IN].mem_h;
> +   iser_inv_desc(desc, rkey);
> +   }
> +
> +   if (iser_task->dir[ISER_DIR_OUT]) {
> +   desc = 
> iser_task->rdma_reg[ISER_DIR_OUT].mem_h;
> +   iser_inv_desc(desc, rkey);
> +   }
> +   } else {
> +   iser_err("failed to get task for itt=%d\n", hdr->itt);
> +   return -EINVAL;
> +   }
> +   }
> +
> +   return 

Re: [PATCH v1 10/10] IB/iser: Support the remote invalidation exception

2015-11-30 Thread Haggai Eran
On 24/11/2015 18:23, Sagi Grimberg wrote:
> From: Jenny Derzhavetz 
> 
> Declare that we support remote invalidation in case we are:
> 1. using Fastreg method
> 2. always registering memory.
> 
> Detect the invalidated rkey from the work completion info so we
> won't invalidate it locally. The spec madates that we must not rely
> on the taget remote invalidate our rkey so we must check it upon
typo: s/taget/target/

> a receive (scsi response) completion.

Haggai
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html