diff mbox series

[11/34] lnet: pass tun to lnet_startup_lndni, instead of full conf

Message ID 153628137168.8267.1167942220741712684.stgit@noble (mailing list archive)
State New, archived
Headers show
Series Beginning of multi-rail support for drivers/staging/lustre | expand

Commit Message

NeilBrown Sept. 7, 2018, 12:49 a.m. UTC
I don't understand parts of this change.
Particularly the removal for
       /* If given some LND tunable parameters, parse those now to
        * override the values in the NI structure. */

isn't clear to me.

This is part of
    8cbb8cd3e771e7f7e0f99cafc19fad32770dc015
       LU-7734 lnet: Multi-Rail local NI split

Signed-off-by: NeilBrown <neilb@suse.com>
---
 drivers/staging/lustre/lnet/lnet/api-ni.c |   41 ++++++++---------------------
 1 file changed, 12 insertions(+), 29 deletions(-)

Comments

Amir Shehata Sept. 11, 2018, 6:31 p.m. UTC | #1
This block logic that was removed from lnet_startup_lndni() is done in the
LND. Each LND has its own defaults. As an example look at
kiblnd_tunables_setup() and ksocknal_startup().
These tunables are LND specific and have different values per LND. So
instead of configuring it in the common LNet function and then it gets
overwritten again the LND. We let the LND take care of initializing to the
default values that they use for that LND, if they haven't already been set
by the user.
Note currently dynamic configuration of these parameters work only for the
o2iblnd. Socklnd and gnilnd appear to not make use of the dynamic ability.
I'll create an LU ticket to add the ability to dynamically set these values
to the socklnd.
The tunables are divided into two parts, a common set of tunables that are
common to all the LND (although each LND could have different default
values), and a specific set of LND tunables which pertain to a specific
LND, again that's only used by the o2iblnd at the moment.

On Thu, 6 Sep 2018 at 18:00, NeilBrown <neilb@suse.com> wrote:

> I don't understand parts of this change.
> Particularly the removal for
>        /* If given some LND tunable parameters, parse those now to
>         * override the values in the NI structure. */
>
> isn't clear to me.
>
> This is part of
>     8cbb8cd3e771e7f7e0f99cafc19fad32770dc015
>        LU-7734 lnet: Multi-Rail local NI split
>
> Signed-off-by: NeilBrown <neilb@suse.com>
> ---
>  drivers/staging/lustre/lnet/lnet/api-ni.c |   41
> ++++++++---------------------
>  1 file changed, 12 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c
> b/drivers/staging/lustre/lnet/lnet/api-ni.c
> index 6e0b8310574d..53ecfd700db3 100644
> --- a/drivers/staging/lustre/lnet/lnet/api-ni.c
> +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c
> @@ -1240,10 +1240,8 @@ lnet_shutdown_lndni(struct lnet_ni *ni)
>  }
>
>  static int
> -lnet_startup_lndni(struct lnet_ni *ni, struct lnet_ioctl_config_data
> *conf)
> +lnet_startup_lndni(struct lnet_ni *ni, struct lnet_lnd_tunables *tun)
>  {
> -       struct lnet_ioctl_config_lnd_tunables *lnd_tunables = NULL;
> -       struct lnet_lnd_tunables *tun = NULL;
>         int rc = -EINVAL;
>         int lnd_type;
>         struct lnet_lnd *lnd;
> @@ -1296,36 +1294,12 @@ lnet_startup_lndni(struct lnet_ni *ni, struct
> lnet_ioctl_config_data *conf)
>
>         ni->ni_net->net_lnd = lnd;
>
> -       if (conf && conf->cfg_hdr.ioc_len > sizeof(*conf)) {
> -               lnd_tunables = (struct lnet_ioctl_config_lnd_tunables
> *)conf->cfg_bulk;
> -               tun = &lnd_tunables->lt_tun;
> -       }
> -
>         if (tun) {
>                 memcpy(&ni->ni_lnd_tunables, tun,
>                        sizeof(*tun));
>                 ni->ni_lnd_tunables_set = true;
>         }
>
> -       /*
> -        * If given some LND tunable parameters, parse those now to
> -        * override the values in the NI structure.
> -        */
> -       if (conf) {
> -               if (conf->cfg_config_u.cfg_net.net_peer_rtr_credits >= 0)
> -                       ni->ni_net->net_tunables.lct_peer_rtr_credits =
> -
>  conf->cfg_config_u.cfg_net.net_peer_rtr_credits;
> -               if (conf->cfg_config_u.cfg_net.net_peer_timeout >= 0)
> -                       ni->ni_net->net_tunables.lct_peer_timeout =
> -
>  conf->cfg_config_u.cfg_net.net_peer_timeout;
> -               if (conf->cfg_config_u.cfg_net.net_peer_tx_credits != -1)
> -                       ni->ni_net->net_tunables.lct_peer_tx_credits =
> -
>  conf->cfg_config_u.cfg_net.net_peer_tx_credits;
> -               if (conf->cfg_config_u.cfg_net.net_max_tx_credits >= 0)
> -                       ni->ni_net->net_tunables.lct_max_tx_credits =
> -
>  conf->cfg_config_u.cfg_net.net_max_tx_credits;
> -       }
> -
>         rc = lnd->lnd_startup(ni);
>
>         mutex_unlock(&the_lnet.ln_lnd_mutex);
> @@ -1861,9 +1835,13 @@ lnet_dyn_add_ni(lnet_pid_t requested_pid, struct
> lnet_ioctl_config_data *conf)
>         struct list_head net_head;
>         struct lnet_remotenet *rnet;
>         int rc;
> +       struct lnet_ioctl_config_lnd_tunables *lnd_tunables = NULL;
>
>         INIT_LIST_HEAD(&net_head);
>
> +       if (conf && conf->cfg_hdr.ioc_len > sizeof(*conf))
> +               lnd_tunables = (struct lnet_ioctl_config_lnd_tunables
> *)conf->cfg_bulk;
> +
>         /* Create a net/ni structures for the network string */
>         rc = lnet_parse_networks(&net_head, nets);
>         if (rc <= 0)
> @@ -1898,9 +1876,14 @@ lnet_dyn_add_ni(lnet_pid_t requested_pid, struct
> lnet_ioctl_config_data *conf)
>                 goto failed0;
>
>         list_del_init(&net->net_list);
> +       if (lnd_tunables)
> +               memcpy(&net->net_tunables,
> +                      &lnd_tunables->lt_cmn,
> sizeof(lnd_tunables->lt_cmn));
> +
>         ni = list_first_entry(&net->net_ni_list, struct lnet_ni,
> ni_netlist);
> -       rc = lnet_startup_lndni(ni, conf);
> -       if (rc)
> +       rc = lnet_startup_lndni(ni, (lnd_tunables ?
> +                                    &lnd_tunables->lt_tun : NULL));
> +       if (rc < 0)
>                 goto failed1;
>
>         if (ni->ni_net->net_lnd->lnd_accept) {
>
>
> _______________________________________________
> lustre-devel mailing list
> lustre-devel@lists.lustre.org
> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
>
<div dir="ltr"><div dir="ltr">This block logic that was removed from lnet_startup_lndni() is done in the LND. Each LND has its own defaults. As an example look at kiblnd_tunables_setup() and ksocknal_startup().</div><div>These tunables are LND specific and have different values per LND. So instead of configuring it in the common LNet function and then it gets overwritten again the LND. We let the LND take care of initializing to the default values that they use for that LND, if they haven&#39;t already been set by the user.</div><div>Note currently dynamic configuration of these parameters work only for the o2iblnd. Socklnd and gnilnd appear to not make use of the dynamic ability. I&#39;ll create an LU ticket to add the ability to dynamically set these values to the socklnd.</div><div>The tunables are divided into two parts, a common set of tunables that are common to all the LND (although each LND could have different default values), and a specific set of LND tunables which pertain to a specific LND, again that&#39;s only used by the o2iblnd at the moment.<br></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, 6 Sep 2018 at 18:00, NeilBrown &lt;<a href="mailto:neilb@suse.com">neilb@suse.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I don&#39;t understand parts of this change.<br>
Particularly the removal for<br>
       /* If given some LND tunable parameters, parse those now to<br>
        * override the values in the NI structure. */<br>
<br>
isn&#39;t clear to me.<br>
<br>
This is part of<br>
    8cbb8cd3e771e7f7e0f99cafc19fad32770dc015<br>
       LU-7734 lnet: Multi-Rail local NI split<br>
<br>
Signed-off-by: NeilBrown &lt;<a href="mailto:neilb@suse.com" target="_blank">neilb@suse.com</a>&gt;<br>
---<br>
 drivers/staging/lustre/lnet/lnet/api-ni.c |   41 ++++++++---------------------<br>
 1 file changed, 12 insertions(+), 29 deletions(-)<br>
<br>
diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c<br>
index 6e0b8310574d..53ecfd700db3 100644<br>
--- a/drivers/staging/lustre/lnet/lnet/api-ni.c<br>
+++ b/drivers/staging/lustre/lnet/lnet/api-ni.c<br>
@@ -1240,10 +1240,8 @@ lnet_shutdown_lndni(struct lnet_ni *ni)<br>
 }<br>
<br>
 static int<br>
-lnet_startup_lndni(struct lnet_ni *ni, struct lnet_ioctl_config_data *conf)<br>
+lnet_startup_lndni(struct lnet_ni *ni, struct lnet_lnd_tunables *tun)<br>
 {<br>
-       struct lnet_ioctl_config_lnd_tunables *lnd_tunables = NULL;<br>
-       struct lnet_lnd_tunables *tun = NULL;<br>
        int rc = -EINVAL;<br>
        int lnd_type;<br>
        struct lnet_lnd *lnd;<br>
@@ -1296,36 +1294,12 @@ lnet_startup_lndni(struct lnet_ni *ni, struct lnet_ioctl_config_data *conf)<br>
<br>
        ni-&gt;ni_net-&gt;net_lnd = lnd;<br>
<br>
-       if (conf &amp;&amp; conf-&gt;cfg_hdr.ioc_len &gt; sizeof(*conf)) {<br>
-               lnd_tunables = (struct lnet_ioctl_config_lnd_tunables *)conf-&gt;cfg_bulk;<br>
-               tun = &amp;lnd_tunables-&gt;lt_tun;<br>
-       }<br>
-<br>
        if (tun) {<br>
                memcpy(&amp;ni-&gt;ni_lnd_tunables, tun,<br>
                       sizeof(*tun));<br>
                ni-&gt;ni_lnd_tunables_set = true;<br>
        }<br>
<br>
-       /*<br>
-        * If given some LND tunable parameters, parse those now to<br>
-        * override the values in the NI structure.<br>
-        */<br>
-       if (conf) {<br>
-               if (conf-&gt;cfg_config_u.cfg_net.net_peer_rtr_credits &gt;= 0)<br>
-                       ni-&gt;ni_net-&gt;net_tunables.lct_peer_rtr_credits =<br>
-                               conf-&gt;cfg_config_u.cfg_net.net_peer_rtr_credits;<br>
-               if (conf-&gt;cfg_config_u.cfg_net.net_peer_timeout &gt;= 0)<br>
-                       ni-&gt;ni_net-&gt;net_tunables.lct_peer_timeout =<br>
-                               conf-&gt;cfg_config_u.cfg_net.net_peer_timeout;<br>
-               if (conf-&gt;cfg_config_u.cfg_net.net_peer_tx_credits != -1)<br>
-                       ni-&gt;ni_net-&gt;net_tunables.lct_peer_tx_credits =<br>
-                               conf-&gt;cfg_config_u.cfg_net.net_peer_tx_credits;<br>
-               if (conf-&gt;cfg_config_u.cfg_net.net_max_tx_credits &gt;= 0)<br>
-                       ni-&gt;ni_net-&gt;net_tunables.lct_max_tx_credits =<br>
-                               conf-&gt;cfg_config_u.cfg_net.net_max_tx_credits;<br>
-       }<br>
-<br>
        rc = lnd-&gt;lnd_startup(ni);<br>
<br>
        mutex_unlock(&amp;the_lnet.ln_lnd_mutex);<br>
@@ -1861,9 +1835,13 @@ lnet_dyn_add_ni(lnet_pid_t requested_pid, struct lnet_ioctl_config_data *conf)<br>
        struct list_head net_head;<br>
        struct lnet_remotenet *rnet;<br>
        int rc;<br>
+       struct lnet_ioctl_config_lnd_tunables *lnd_tunables = NULL;<br>
<br>
        INIT_LIST_HEAD(&amp;net_head);<br>
<br>
+       if (conf &amp;&amp; conf-&gt;cfg_hdr.ioc_len &gt; sizeof(*conf))<br>
+               lnd_tunables = (struct lnet_ioctl_config_lnd_tunables *)conf-&gt;cfg_bulk;<br>
+<br>
        /* Create a net/ni structures for the network string */<br>
        rc = lnet_parse_networks(&amp;net_head, nets);<br>
        if (rc &lt;= 0)<br>
@@ -1898,9 +1876,14 @@ lnet_dyn_add_ni(lnet_pid_t requested_pid, struct lnet_ioctl_config_data *conf)<br>
                goto failed0;<br>
<br>
        list_del_init(&amp;net-&gt;net_list);<br>
+       if (lnd_tunables)<br>
+               memcpy(&amp;net-&gt;net_tunables,<br>
+                      &amp;lnd_tunables-&gt;lt_cmn, sizeof(lnd_tunables-&gt;lt_cmn));<br>
+<br>
        ni = list_first_entry(&amp;net-&gt;net_ni_list, struct lnet_ni, ni_netlist);<br>
-       rc = lnet_startup_lndni(ni, conf);<br>
-       if (rc)<br>
+       rc = lnet_startup_lndni(ni, (lnd_tunables ?<br>
+                                    &amp;lnd_tunables-&gt;lt_tun : NULL));<br>
+       if (rc &lt; 0)<br>
                goto failed1;<br>
<br>
        if (ni-&gt;ni_net-&gt;net_lnd-&gt;lnd_accept) {<br>
<br>
<br>
_______________________________________________<br>
lustre-devel mailing list<br>
<a href="mailto:lustre-devel@lists.lustre.org" target="_blank">lustre-devel@lists.lustre.org</a><br>
<a href="http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org" rel="noreferrer" target="_blank">http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org</a><br>
</blockquote></div>
Doug Oucharek Sept. 12, 2018, 3:30 a.m. UTC | #2
With the suggested commit message from Amir:

Reviewed-by: Doug Oucharek <dougso@me.com>

Doug

On 9/6/18, 5:53 PM, "NeilBrown" <neilb@suse.com> wrote:

    I don't understand parts of this change.
    Particularly the removal for
           /* If given some LND tunable parameters, parse those now to
            * override the values in the NI structure. */
    
    isn't clear to me.
    
    This is part of
        8cbb8cd3e771e7f7e0f99cafc19fad32770dc015
           LU-7734 lnet: Multi-Rail local NI split
    
    Signed-off-by: NeilBrown <neilb@suse.com>
    ---
     drivers/staging/lustre/lnet/lnet/api-ni.c |   41 ++++++++---------------------
     1 file changed, 12 insertions(+), 29 deletions(-)
    
    diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c
    index 6e0b8310574d..53ecfd700db3 100644
    --- a/drivers/staging/lustre/lnet/lnet/api-ni.c
    +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c
    @@ -1240,10 +1240,8 @@ lnet_shutdown_lndni(struct lnet_ni *ni)
     }
     
     static int
    -lnet_startup_lndni(struct lnet_ni *ni, struct lnet_ioctl_config_data *conf)
    +lnet_startup_lndni(struct lnet_ni *ni, struct lnet_lnd_tunables *tun)
     {
    -	struct lnet_ioctl_config_lnd_tunables *lnd_tunables = NULL;
    -	struct lnet_lnd_tunables *tun = NULL;
     	int rc = -EINVAL;
     	int lnd_type;
     	struct lnet_lnd *lnd;
    @@ -1296,36 +1294,12 @@ lnet_startup_lndni(struct lnet_ni *ni, struct lnet_ioctl_config_data *conf)
     
     	ni->ni_net->net_lnd = lnd;
     
    -	if (conf && conf->cfg_hdr.ioc_len > sizeof(*conf)) {
    -		lnd_tunables = (struct lnet_ioctl_config_lnd_tunables *)conf->cfg_bulk;
    -		tun = &lnd_tunables->lt_tun;
    -	}
    -
     	if (tun) {
     		memcpy(&ni->ni_lnd_tunables, tun,
     		       sizeof(*tun));
     		ni->ni_lnd_tunables_set = true;
     	}
     
    -	/*
    -	 * If given some LND tunable parameters, parse those now to
    -	 * override the values in the NI structure.
    -	 */
    -	if (conf) {
    -		if (conf->cfg_config_u.cfg_net.net_peer_rtr_credits >= 0)
    -			ni->ni_net->net_tunables.lct_peer_rtr_credits =
    -				conf->cfg_config_u.cfg_net.net_peer_rtr_credits;
    -		if (conf->cfg_config_u.cfg_net.net_peer_timeout >= 0)
    -			ni->ni_net->net_tunables.lct_peer_timeout =
    -				conf->cfg_config_u.cfg_net.net_peer_timeout;
    -		if (conf->cfg_config_u.cfg_net.net_peer_tx_credits != -1)
    -			ni->ni_net->net_tunables.lct_peer_tx_credits =
    -				conf->cfg_config_u.cfg_net.net_peer_tx_credits;
    -		if (conf->cfg_config_u.cfg_net.net_max_tx_credits >= 0)
    -			ni->ni_net->net_tunables.lct_max_tx_credits =
    -				conf->cfg_config_u.cfg_net.net_max_tx_credits;
    -	}
    -
     	rc = lnd->lnd_startup(ni);
     
     	mutex_unlock(&the_lnet.ln_lnd_mutex);
    @@ -1861,9 +1835,13 @@ lnet_dyn_add_ni(lnet_pid_t requested_pid, struct lnet_ioctl_config_data *conf)
     	struct list_head net_head;
     	struct lnet_remotenet *rnet;
     	int rc;
    +	struct lnet_ioctl_config_lnd_tunables *lnd_tunables = NULL;
     
     	INIT_LIST_HEAD(&net_head);
     
    +	if (conf && conf->cfg_hdr.ioc_len > sizeof(*conf))
    +		lnd_tunables = (struct lnet_ioctl_config_lnd_tunables *)conf->cfg_bulk;
    +
     	/* Create a net/ni structures for the network string */
     	rc = lnet_parse_networks(&net_head, nets);
     	if (rc <= 0)
    @@ -1898,9 +1876,14 @@ lnet_dyn_add_ni(lnet_pid_t requested_pid, struct lnet_ioctl_config_data *conf)
     		goto failed0;
     
     	list_del_init(&net->net_list);
    +	if (lnd_tunables)
    +		memcpy(&net->net_tunables,
    +		       &lnd_tunables->lt_cmn, sizeof(lnd_tunables->lt_cmn));
    +
     	ni = list_first_entry(&net->net_ni_list, struct lnet_ni, ni_netlist);
    -	rc = lnet_startup_lndni(ni, conf);
    -	if (rc)
    +	rc = lnet_startup_lndni(ni, (lnd_tunables ?
    +				     &lnd_tunables->lt_tun : NULL));
    +	if (rc < 0)
     		goto failed1;
     
     	if (ni->ni_net->net_lnd->lnd_accept) {
NeilBrown Sept. 12, 2018, 4:03 a.m. UTC | #3
On Tue, Sep 11 2018, Amir Shehata wrote:

> This block logic that was removed from lnet_startup_lndni() is done in the
> LND. Each LND has its own defaults. As an example look at
> kiblnd_tunables_setup() and ksocknal_startup().
> These tunables are LND specific and have different values per LND. So
> instead of configuring it in the common LNet function and then it gets
> overwritten again the LND. We let the LND take care of initializing to the
> default values that they use for that LND, if they haven't already been set
> by the user.
> Note currently dynamic configuration of these parameters work only for the
> o2iblnd. Socklnd and gnilnd appear to not make use of the dynamic ability.
> I'll create an LU ticket to add the ability to dynamically set these values
> to the socklnd.
> The tunables are divided into two parts, a common set of tunables that are
> common to all the LND (although each LND could have different default
> values), and a specific set of LND tunables which pertain to a specific
> LND, again that's only used by the o2iblnd at the moment.

Thanks a lot.  That helps.

NeilBrown

>
> On Thu, 6 Sep 2018 at 18:00, NeilBrown <neilb@suse.com> wrote:
>
>> I don't understand parts of this change.
>> Particularly the removal for
>>        /* If given some LND tunable parameters, parse those now to
>>         * override the values in the NI structure. */
>>
>> isn't clear to me.
>>
>> This is part of
>>     8cbb8cd3e771e7f7e0f99cafc19fad32770dc015
>>        LU-7734 lnet: Multi-Rail local NI split
>>
>> Signed-off-by: NeilBrown <neilb@suse.com>
>> ---
>>  drivers/staging/lustre/lnet/lnet/api-ni.c |   41
>> ++++++++---------------------
>>  1 file changed, 12 insertions(+), 29 deletions(-)
>>
>> diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c
>> b/drivers/staging/lustre/lnet/lnet/api-ni.c
>> index 6e0b8310574d..53ecfd700db3 100644
>> --- a/drivers/staging/lustre/lnet/lnet/api-ni.c
>> +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c
>> @@ -1240,10 +1240,8 @@ lnet_shutdown_lndni(struct lnet_ni *ni)
>>  }
>>
>>  static int
>> -lnet_startup_lndni(struct lnet_ni *ni, struct lnet_ioctl_config_data
>> *conf)
>> +lnet_startup_lndni(struct lnet_ni *ni, struct lnet_lnd_tunables *tun)
>>  {
>> -       struct lnet_ioctl_config_lnd_tunables *lnd_tunables = NULL;
>> -       struct lnet_lnd_tunables *tun = NULL;
>>         int rc = -EINVAL;
>>         int lnd_type;
>>         struct lnet_lnd *lnd;
>> @@ -1296,36 +1294,12 @@ lnet_startup_lndni(struct lnet_ni *ni, struct
>> lnet_ioctl_config_data *conf)
>>
>>         ni->ni_net->net_lnd = lnd;
>>
>> -       if (conf && conf->cfg_hdr.ioc_len > sizeof(*conf)) {
>> -               lnd_tunables = (struct lnet_ioctl_config_lnd_tunables
>> *)conf->cfg_bulk;
>> -               tun = &lnd_tunables->lt_tun;
>> -       }
>> -
>>         if (tun) {
>>                 memcpy(&ni->ni_lnd_tunables, tun,
>>                        sizeof(*tun));
>>                 ni->ni_lnd_tunables_set = true;
>>         }
>>
>> -       /*
>> -        * If given some LND tunable parameters, parse those now to
>> -        * override the values in the NI structure.
>> -        */
>> -       if (conf) {
>> -               if (conf->cfg_config_u.cfg_net.net_peer_rtr_credits >= 0)
>> -                       ni->ni_net->net_tunables.lct_peer_rtr_credits =
>> -
>>  conf->cfg_config_u.cfg_net.net_peer_rtr_credits;
>> -               if (conf->cfg_config_u.cfg_net.net_peer_timeout >= 0)
>> -                       ni->ni_net->net_tunables.lct_peer_timeout =
>> -
>>  conf->cfg_config_u.cfg_net.net_peer_timeout;
>> -               if (conf->cfg_config_u.cfg_net.net_peer_tx_credits != -1)
>> -                       ni->ni_net->net_tunables.lct_peer_tx_credits =
>> -
>>  conf->cfg_config_u.cfg_net.net_peer_tx_credits;
>> -               if (conf->cfg_config_u.cfg_net.net_max_tx_credits >= 0)
>> -                       ni->ni_net->net_tunables.lct_max_tx_credits =
>> -
>>  conf->cfg_config_u.cfg_net.net_max_tx_credits;
>> -       }
>> -
>>         rc = lnd->lnd_startup(ni);
>>
>>         mutex_unlock(&the_lnet.ln_lnd_mutex);
>> @@ -1861,9 +1835,13 @@ lnet_dyn_add_ni(lnet_pid_t requested_pid, struct
>> lnet_ioctl_config_data *conf)
>>         struct list_head net_head;
>>         struct lnet_remotenet *rnet;
>>         int rc;
>> +       struct lnet_ioctl_config_lnd_tunables *lnd_tunables = NULL;
>>
>>         INIT_LIST_HEAD(&net_head);
>>
>> +       if (conf && conf->cfg_hdr.ioc_len > sizeof(*conf))
>> +               lnd_tunables = (struct lnet_ioctl_config_lnd_tunables
>> *)conf->cfg_bulk;
>> +
>>         /* Create a net/ni structures for the network string */
>>         rc = lnet_parse_networks(&net_head, nets);
>>         if (rc <= 0)
>> @@ -1898,9 +1876,14 @@ lnet_dyn_add_ni(lnet_pid_t requested_pid, struct
>> lnet_ioctl_config_data *conf)
>>                 goto failed0;
>>
>>         list_del_init(&net->net_list);
>> +       if (lnd_tunables)
>> +               memcpy(&net->net_tunables,
>> +                      &lnd_tunables->lt_cmn,
>> sizeof(lnd_tunables->lt_cmn));
>> +
>>         ni = list_first_entry(&net->net_ni_list, struct lnet_ni,
>> ni_netlist);
>> -       rc = lnet_startup_lndni(ni, conf);
>> -       if (rc)
>> +       rc = lnet_startup_lndni(ni, (lnd_tunables ?
>> +                                    &lnd_tunables->lt_tun : NULL));
>> +       if (rc < 0)
>>                 goto failed1;
>>
>>         if (ni->ni_net->net_lnd->lnd_accept) {
>>
>>
>> _______________________________________________
>> lustre-devel mailing list
>> lustre-devel@lists.lustre.org
>> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
>>
diff mbox series

Patch

diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c
index 6e0b8310574d..53ecfd700db3 100644
--- a/drivers/staging/lustre/lnet/lnet/api-ni.c
+++ b/drivers/staging/lustre/lnet/lnet/api-ni.c
@@ -1240,10 +1240,8 @@  lnet_shutdown_lndni(struct lnet_ni *ni)
 }
 
 static int
-lnet_startup_lndni(struct lnet_ni *ni, struct lnet_ioctl_config_data *conf)
+lnet_startup_lndni(struct lnet_ni *ni, struct lnet_lnd_tunables *tun)
 {
-	struct lnet_ioctl_config_lnd_tunables *lnd_tunables = NULL;
-	struct lnet_lnd_tunables *tun = NULL;
 	int rc = -EINVAL;
 	int lnd_type;
 	struct lnet_lnd *lnd;
@@ -1296,36 +1294,12 @@  lnet_startup_lndni(struct lnet_ni *ni, struct lnet_ioctl_config_data *conf)
 
 	ni->ni_net->net_lnd = lnd;
 
-	if (conf && conf->cfg_hdr.ioc_len > sizeof(*conf)) {
-		lnd_tunables = (struct lnet_ioctl_config_lnd_tunables *)conf->cfg_bulk;
-		tun = &lnd_tunables->lt_tun;
-	}
-
 	if (tun) {
 		memcpy(&ni->ni_lnd_tunables, tun,
 		       sizeof(*tun));
 		ni->ni_lnd_tunables_set = true;
 	}
 
-	/*
-	 * If given some LND tunable parameters, parse those now to
-	 * override the values in the NI structure.
-	 */
-	if (conf) {
-		if (conf->cfg_config_u.cfg_net.net_peer_rtr_credits >= 0)
-			ni->ni_net->net_tunables.lct_peer_rtr_credits =
-				conf->cfg_config_u.cfg_net.net_peer_rtr_credits;
-		if (conf->cfg_config_u.cfg_net.net_peer_timeout >= 0)
-			ni->ni_net->net_tunables.lct_peer_timeout =
-				conf->cfg_config_u.cfg_net.net_peer_timeout;
-		if (conf->cfg_config_u.cfg_net.net_peer_tx_credits != -1)
-			ni->ni_net->net_tunables.lct_peer_tx_credits =
-				conf->cfg_config_u.cfg_net.net_peer_tx_credits;
-		if (conf->cfg_config_u.cfg_net.net_max_tx_credits >= 0)
-			ni->ni_net->net_tunables.lct_max_tx_credits =
-				conf->cfg_config_u.cfg_net.net_max_tx_credits;
-	}
-
 	rc = lnd->lnd_startup(ni);
 
 	mutex_unlock(&the_lnet.ln_lnd_mutex);
@@ -1861,9 +1835,13 @@  lnet_dyn_add_ni(lnet_pid_t requested_pid, struct lnet_ioctl_config_data *conf)
 	struct list_head net_head;
 	struct lnet_remotenet *rnet;
 	int rc;
+	struct lnet_ioctl_config_lnd_tunables *lnd_tunables = NULL;
 
 	INIT_LIST_HEAD(&net_head);
 
+	if (conf && conf->cfg_hdr.ioc_len > sizeof(*conf))
+		lnd_tunables = (struct lnet_ioctl_config_lnd_tunables *)conf->cfg_bulk;
+
 	/* Create a net/ni structures for the network string */
 	rc = lnet_parse_networks(&net_head, nets);
 	if (rc <= 0)
@@ -1898,9 +1876,14 @@  lnet_dyn_add_ni(lnet_pid_t requested_pid, struct lnet_ioctl_config_data *conf)
 		goto failed0;
 
 	list_del_init(&net->net_list);
+	if (lnd_tunables)
+		memcpy(&net->net_tunables,
+		       &lnd_tunables->lt_cmn, sizeof(lnd_tunables->lt_cmn));
+
 	ni = list_first_entry(&net->net_ni_list, struct lnet_ni, ni_netlist);
-	rc = lnet_startup_lndni(ni, conf);
-	if (rc)
+	rc = lnet_startup_lndni(ni, (lnd_tunables ?
+				     &lnd_tunables->lt_tun : NULL));
+	if (rc < 0)
 		goto failed1;
 
 	if (ni->ni_net->net_lnd->lnd_accept) {