Vasu Dev wrote:
> This will give flexibility to callers to set timeout value for abort.
> The caller may have its own recovery mechanism, in that case this will
> allow caller to set no timeout for abort, in turn no -FC_EX_TIMEOUT error
> to caller in that case if no response to abort.
> 
> The fc_fcp_error() doesn't need this timeout error and neither
> current fc_exch.c code posts timeout error to fc_fcp_error() using
> additional checks in fc_exch_timeout(). The fc_exch_timeout() will be
> fixed in next patch.
> 
> Changed timeout value for abort recovery to 2 times of R_A_TOV as per
> FCP-4 sec 12.3.2.

Sorry for the late reply. I did not work for once :)

This looks ok to me. Thanks.


> 
> Signed-off-by: Vasu Dev <[EMAIL PROTECTED]>
> ---
> 
>  drivers/scsi/libfc/fc_exch.c |   12 ++++--------
>  drivers/scsi/libfc/fc_fcp.c  |    2 +-
>  include/scsi/libfc/libfc.h   |   16 +++++++++++-----
>  3 files changed, 16 insertions(+), 14 deletions(-)
> 
> 
> diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
> index b7f44c2..270cbac 100644
> --- a/drivers/scsi/libfc/fc_exch.c
> +++ b/drivers/scsi/libfc/fc_exch.c
> @@ -332,12 +332,7 @@ static void fc_exch_timer_set(struct fc_exch *ep, 
> unsigned int timer_msec)
>       spin_unlock_bh(&ep->ex_lock);
>  }
>  
> -/*
> - * Abort the exchange for a sequence due to timeout or an upper-level abort.
> - * Called without the exchange manager em_lock held.
> - * Returns non-zero if a sequence could not be allocated.
> - */
> -int fc_seq_exch_abort(const struct fc_seq *req_sp)
> +int fc_seq_exch_abort(const struct fc_seq *req_sp, unsigned int timer_msec)
>  {
>       struct fc_seq *sp;
>       struct fc_exch *ep;
> @@ -364,7 +359,8 @@ int fc_seq_exch_abort(const struct fc_seq *req_sp)
>  
>       sp->f_ctl |= FC_FC_SEQ_INIT;
>       ep->esb_stat |= ESB_ST_SEQ_INIT | ESB_ST_ABNORMAL;
> -     fc_exch_timer_set_locked(ep, ep->r_a_tov);
> +     if (timer_msec)
> +             fc_exch_timer_set_locked(ep, timer_msec);
>       spin_unlock_bh(&ep->ex_lock);
>  
>       /*
> @@ -422,7 +418,7 @@ static void fc_exch_timeout(unsigned long ep_arg)
>               spin_unlock_bh(&ep->ex_lock);
>               if (resp)
>                       resp(sp, ERR_PTR(-FC_EX_TIMEOUT), arg);
> -             fc_seq_exch_abort(sp);
> +             fc_seq_exch_abort(sp, 2 * ep->r_a_tov);
>               goto done;
>       }
>  unlock:
> diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
> index e974ce1..9402eba 100644
> --- a/drivers/scsi/libfc/fc_fcp.c
> +++ b/drivers/scsi/libfc/fc_fcp.c
> @@ -279,7 +279,7 @@ static int fc_fcp_send_abort(struct fc_fcp_pkt *fsp)
>               return -EINVAL;
>  
>       fsp->state |= FC_SRB_ABORT_PENDING;
> -     return fsp->lp->tt.seq_exch_abort(fsp->seq_ptr);
> +     return fsp->lp->tt.seq_exch_abort(fsp->seq_ptr, 0);
>  }
>  
>  /*
> diff --git a/include/scsi/libfc/libfc.h b/include/scsi/libfc/libfc.h
> index de68c44..104e2a6 100644
> --- a/include/scsi/libfc/libfc.h
> +++ b/include/scsi/libfc/libfc.h
> @@ -253,9 +253,14 @@ struct libfc_function_template {
>  
>       /*
>        * Abort an exchange and sequence. Generally called because of a
> -      * timeout or an abort from the upper layer.
> +      * exchange timeout or an abort from the upper layer.
> +      *
> +      * A timer_msec can be specified for abort timeout, if non-zero
> +      * timer_msec value is specified then exchange resp handler
> +      * will be called with timeout error if no response to abort.
>        */
> -     int (*seq_exch_abort)(const struct fc_seq *req_sp);
> +     int (*seq_exch_abort)(const struct fc_seq *req_sp,
> +                           unsigned int timer_msec);
>  
>       /*
>        * Indicate that an exchange/sequence tuple is complete and the memory
> @@ -683,11 +688,12 @@ int fc_seq_send(struct fc_lport *lp, struct fc_seq *sp,
>  void fc_seq_els_rsp_send(struct fc_seq *sp, enum fc_els_cmd els_cmd,
>                        struct fc_seq_els_data *els_data);
>  
> -
>  /*
> - * Abort the exchange used by the given sequence.
> + * This function is for seq_exch_abort function pointer in
> + * struct libfc_function_template, see comment block on
> + * seq_exch_abort for description of this function.
>   */
> -int fc_seq_exch_abort(const struct fc_seq *req_sp);
> +int fc_seq_exch_abort(const struct fc_seq *req_sp, unsigned int timer_msec);
>  
>  /*
>   * Indicate that an exchange/sequence tuple is complete and the memory
> 
> _______________________________________________
> devel mailing list
> [email protected]
> http://www.open-fcoe.org/mailman/listinfo/devel

_______________________________________________
devel mailing list
[email protected]
http://www.open-fcoe.org/mailman/listinfo/devel

Reply via email to