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

Doug Oucharek doucharek at cray.com
Tue Sep 11 20:30:58 PDT 2018


With the suggested commit message from Amir:

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

Doug

On 9/6/18, 5:53 PM, "NeilBrown" <neilb at 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 at 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) {
    
    
    



More information about the lustre-devel mailing list