On 11/11/2014 03:36 PM, Tomoaki Nishimura wrote:
>  
> +#define MAX_UPDATE_PARAMS 7
> +
> +int iscsi_session_update_params(struct iscsi_conn *conn, node_rec_t *rec)
> +{
> +     struct iscsi_session *session = conn->session;
> +     int i, rc;
> +      struct connparam {
> +               int param;
> +               int type;
> +               void *value;
> +               int conn_only;
> +      } conntbl[MAX_UPDATE_PARAMS] = {
> +               {
> +                     .param = ISCSI_PARAM_SESS_RECOVERY_TMO,
> +                     .value = &rec->session.timeo.replacement_timeout,
> +                     .type = ISCSI_INT,
> +                     .conn_only = 0,
> +               }, {
> +                     .param = ISCSI_PARAM_FAST_ABORT,
> +                     .value = &rec->session.iscsi.FastAbort,
> +                     .type = ISCSI_INT,
> +                     .conn_only = 0,
> +               }, {
> +                     .param = ISCSI_PARAM_ABORT_TMO,
> +                     .value = &rec->session.err_timeo.abort_timeout,
> +                     .type = ISCSI_INT,
> +                     .conn_only = 0,
> +               }, {
> +                     .param = ISCSI_PARAM_LU_RESET_TMO,
> +                     .value = &rec->session.err_timeo.lu_reset_timeout,
> +                     .type = ISCSI_INT,
> +                     .conn_only = 0,
> +               }, {
> +                     .param = ISCSI_PARAM_TGT_RESET_TMO,
> +                     .value = &rec->session.err_timeo.tgt_reset_timeout,
> +                     .type = ISCSI_INT,
> +                     .conn_only = 0,
> +               }, {
> +                     .param = ISCSI_PARAM_PING_TMO,
> +                     .value = &rec->conn[conn->id].timeo.noop_out_timeout,
> +                     .type = ISCSI_INT,
> +                     .conn_only = 1,
> +               }, {
> +                     .param = ISCSI_PARAM_RECV_TMO,
> +                     .value = &rec->conn[conn->id].timeo.noop_out_interval,
> +                     .type = ISCSI_INT,
> +                     .conn_only = 1,
> +               },
> +      };
> +
> +     for (i = 0; i < MAX_UPDATE_PARAMS; i++) {
> +             if (conntbl[i].type == ISCSI_INT) {
> +                     if (*((int *)conntbl[i].value) == NO_UPDATE)
> +                             continue;
> +             }
> +
> +             if (!(session->param_mask & (1ULL << conntbl[i].param)))
> +                     continue;
> +
> +             rc = ipc->set_param(session->t->handle, session->id,
> +                                conn->id, conntbl[i].param, conntbl[i].value,
> +                                conntbl[i].type);
> +             if (rc && rc != -ENOSYS) {
> +                     log_error("can't set operational parameter %d for "
> +                               "connection %d:%d, retcode %d (%d)",
> +                               conntbl[i].param, session->id, conn->id,
> +                               rc, errno);
> +                     return -EPERM;
> +             }
> +
> +             if (rc == -ENOSYS) {
> +                     switch (conntbl[i].param) {
> +                     case ISCSI_PARAM_PING_TMO:
> +                             /*
> +                              * older kernels may not support nops
> +                              * in kernel
> +                              */
> +                             conn->userspace_nop = 1;
> +                             break;
> +                     }
> +             }
> +             print_param_value(conntbl[i].param, conntbl[i].value,
> +                               conntbl[i].type);
> +     }
> +
> +     return 0;
> +}
> +

Hey,

Just so you know this is not being ignored, I wanted to update you with
my review status on it. I was imagining something more like how we pass
the kernel/drivers an array of settings. The interface seems cleaner
that way, however I like your approach because the modifications to the
code are very simple. I am working on a patch on top of your patch to
see which is nicer. Will hopefully be done today/tomorrow.

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to