All of lore.kernel.org
 help / color / mirror / Atom feed
From: Doug Oucharek <doucharek@cray.com>
To: lustre-devel@lists.lustre.org
Subject: [lustre-devel] [PATCH 34/34] lnet: introduce use_tcp_bonding mod param
Date: Wed, 12 Sep 2018 04:54:49 +0000	[thread overview]
Message-ID: <4DA7E7FA-7658-40E5-986D-313DF02B21DC@cray.com> (raw)
In-Reply-To: <153628137259.8267.2306617574801795911.stgit@noble>

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

Doug

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

    This is part of
        8cbb8cd3e771e7f7e0f99cafc19fad32770dc015
           LU-7734 lnet: Multi-Rail local NI split
    
    Signed-off-by: NeilBrown <neilb@suse.com>
    ---
     .../staging/lustre/include/linux/lnet/lib-lnet.h   |    3 +
     drivers/staging/lustre/lnet/lnet/api-ni.c          |   22 ++++++++-
     drivers/staging/lustre/lnet/lnet/config.c          |   50 ++++++++++++++++----
     3 files changed, 61 insertions(+), 14 deletions(-)
    
    diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
    index ef551b571935..5ee770cd7a5f 100644
    --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
    +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
    @@ -629,7 +629,8 @@ void lnet_swap_pinginfo(struct lnet_ping_info *info);
     
     int lnet_parse_ip2nets(char **networksp, char *ip2nets);
     int lnet_parse_routes(char *route_str, int *im_a_router);
    -int lnet_parse_networks(struct list_head *nilist, char *networks);
    +int lnet_parse_networks(struct list_head *nilist, char *networks,
    +			bool use_tcp_bonding);
     bool lnet_net_unique(__u32 net_id, struct list_head *nilist,
     		     struct lnet_net **net);
     bool lnet_ni_unique_net(struct list_head *nilist, char *iface);
    diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c
    index ff5149da2d79..8ff386992c99 100644
    --- a/drivers/staging/lustre/lnet/lnet/api-ni.c
    +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c
    @@ -59,6 +59,11 @@ static int rnet_htable_size = LNET_REMOTE_NETS_HASH_DEFAULT;
     module_param(rnet_htable_size, int, 0444);
     MODULE_PARM_DESC(rnet_htable_size, "size of remote network hash table");
     
    +static int use_tcp_bonding = false;
    +module_param(use_tcp_bonding, int, 0444);
    +MODULE_PARM_DESC(use_tcp_bonding,
    +		 "Set to 1 to use socklnd bonding. 0 to use Multi-Rail");
    +
     static int lnet_ping(struct lnet_process_id id, signed long timeout,
     		     struct lnet_process_id __user *ids, int n_ids);
     
    @@ -1446,6 +1451,18 @@ lnet_startup_lndnet(struct lnet_net *net, struct lnet_lnd_tunables *tun)
     	 * to avoid a memory leak.
     	 */
     
    +	/*
    +	 * When a network uses TCP bonding then all its interfaces
    +	 * must be specified when the network is first defined: the
    +	 * TCP bonding code doesn't allow for interfaces to be added
    +	 * or removed.
    +	 */
    +	if (net_l != net && net_l != NULL && use_tcp_bonding &&
    +	    LNET_NETTYP(net_l->net_id) == SOCKLND) {
    +		rc = -EINVAL;
    +		goto failed0;
    +	}
    +
     	while (!list_empty(&net->net_ni_added)) {
     		ni = list_entry(net->net_ni_added.next, struct lnet_ni,
     				ni_netlist);
    @@ -1702,7 +1719,8 @@ LNetNIInit(lnet_pid_t requested_pid)
     	 * routes if it has been loaded
     	 */
     	if (!the_lnet.ln_nis_from_mod_params) {
    -		rc = lnet_parse_networks(&net_head, lnet_get_networks());
    +		rc = lnet_parse_networks(&net_head, lnet_get_networks(),
    +					 use_tcp_bonding);
     		if (rc < 0)
     			goto err_empty_list;
     	}
    @@ -2000,7 +2018,7 @@ lnet_dyn_add_ni(lnet_pid_t requested_pid, struct lnet_ioctl_config_data *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);
    +	rc = lnet_parse_networks(&net_head, nets, use_tcp_bonding);
     	if (rc <= 0)
     		return !rc ? -EINVAL : rc;
     
    diff --git a/drivers/staging/lustre/lnet/lnet/config.c b/drivers/staging/lustre/lnet/lnet/config.c
    index 0571fa6a7249..abfc5d8dc219 100644
    --- a/drivers/staging/lustre/lnet/lnet/config.c
    +++ b/drivers/staging/lustre/lnet/lnet/config.c
    @@ -117,6 +117,21 @@ lnet_ni_unique_net(struct list_head *nilist, char *iface)
     	return true;
     }
     
    +/* check that the NI is unique to the interfaces with in the same NI.
    + * This is only a consideration if use_tcp_bonding is set */
    +static bool
    +lnet_ni_unique_ni(char *iface_list[LNET_MAX_INTERFACES], char *iface)
    +{
    +	int i;
    +	for (i = 0; i < LNET_MAX_INTERFACES; i++) {
    +		if (iface_list[i] != NULL &&
    +		    strncmp(iface_list[i], iface, strlen(iface)) == 0)
    +			return false;
    +	}
    +
    +	return true;
    +}
    +
     static bool
     in_array(__u32 *array, __u32 size, __u32 value)
     {
    @@ -374,6 +389,9 @@ lnet_ni_add_interface(struct lnet_ni *ni, char *iface)
     	if (ni == NULL)
     		return -ENOMEM;
     
    +	if (!lnet_ni_unique_ni(ni->ni_interfaces, iface))
    +		return -EINVAL;
    +
     	/* Allocate a separate piece of memory and copy
     	 * into it the string, so we don't have
     	 * a depencency on the tokens string.  This way we
    @@ -495,7 +513,8 @@ lnet_ni_alloc(struct lnet_net *net, struct cfs_expr_list *el, char *iface)
      * nilist.
      */
     int
    -lnet_parse_networks(struct list_head *netlist, char *networks)
    +lnet_parse_networks(struct list_head *netlist, char *networks,
    +		    bool use_tcp_bonding)
     {
     	struct cfs_expr_list *net_el = NULL;
     	struct cfs_expr_list *ni_el = NULL;
    @@ -634,7 +653,8 @@ lnet_parse_networks(struct list_head *netlist, char *networks)
     		if (IS_ERR_OR_NULL(net))
     			goto failed;
     
    -		if (!nistr) {
    +		if (!nistr ||
    +		    (use_tcp_bonding && LNET_NETTYP(net_id) == SOCKLND)) {
     			/*
     			 * No interface list was specified, allocate a
     			 * ni using the defaults.
    @@ -643,11 +663,13 @@ lnet_parse_networks(struct list_head *netlist, char *networks)
     			if (IS_ERR_OR_NULL(ni))
     				goto failed;
     
    -			if (net_el) {
    -				cfs_expr_list_free(net_el);
    -				net_el = NULL;
    +			if (!nistr) {
    +				if (net_el) {
    +					cfs_expr_list_free(net_el);
    +					net_el = NULL;
    +				}
    +				continue;
     			}
    -			continue;
     		}
     
     		do {
    @@ -704,17 +726,23 @@ lnet_parse_networks(struct list_head *netlist, char *networks)
     			}
     
     			/*
    -			 * At this point the name
    -			 is properly terminated.
    +			 * At this point the name is properly terminated.
     			 */
     			if (!*name) {
     				str = name;
     				goto failed_syntax;
     			}
     
    -			ni = lnet_ni_alloc(net, ni_el, name);
    -			if (IS_ERR_OR_NULL(ni))
    -				goto failed;
    +			if (use_tcp_bonding &&
    +			    LNET_NETTYP(net->net_id) == SOCKLND) {
    +				rc = lnet_ni_add_interface(ni, name);
    +				if (rc != 0)
    +					goto failed;
    +			} else {
    +				ni = lnet_ni_alloc(net, ni_el, name);
    +				if (IS_ERR_OR_NULL(ni))
    +					goto failed;
    +			}
     
     			if (ni_el) {
     				if (ni_el != net_el) {
    
    
    

  reply	other threads:[~2018-09-12  4:54 UTC|newest]

Thread overview: 98+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-07  0:49 [lustre-devel] [PATCH 00/34] Beginning of multi-rail support for drivers/staging/lustre NeilBrown
2018-09-07  0:49 ` [lustre-devel] [PATCH 11/34] lnet: pass tun to lnet_startup_lndni, instead of full conf NeilBrown
2018-09-11 18:31   ` Amir Shehata
2018-09-12  4:03     ` NeilBrown
2018-09-12  3:30   ` Doug Oucharek
2018-09-07  0:49 ` [lustre-devel] [PATCH 12/34] lnet: split lnet_startup_lndni NeilBrown
2018-09-12  3:39   ` Doug Oucharek
2018-09-07  0:49 ` [lustre-devel] [PATCH 16/34] lnet: lnet_shutdown_lndnets - remove some cleanup code NeilBrown
2018-09-07  0:49 ` [lustre-devel] [PATCH 18/34] lnet: add ni_state NeilBrown
2018-09-12  3:59   ` Doug Oucharek
2018-09-12  4:25     ` NeilBrown
2018-09-07  0:49 ` [lustre-devel] [PATCH 14/34] lnet: rename lnet_find_net_locked to lnet_find_rnet_locked NeilBrown
2018-09-12  3:40   ` Doug Oucharek
2018-09-07  0:49 ` [lustre-devel] [PATCH 09/34] lnet: add list of cpts to lnet_net NeilBrown
2018-09-10 23:28   ` Doug Oucharek
2018-09-12  2:16     ` NeilBrown
2018-09-11  1:02   ` James Simmons
2018-09-07  0:49 ` [lustre-devel] [PATCH 06/34] lnet: store separate xmit/recv net-interface in each message NeilBrown
2018-09-10 23:24   ` Doug Oucharek
2018-09-10 23:29   ` James Simmons
2018-09-10 23:36   ` James Simmons
2018-09-07  0:49 ` [lustre-devel] [PATCH 03/34] lnet: struct lnet_ni: move ni_lnd to lnet_net NeilBrown
2018-09-10 23:04   ` Doug Oucharek
2018-09-10 23:19     ` James Simmons
2018-09-10 23:19       ` Doug Oucharek
2018-09-10 23:19     ` James Simmons
2018-09-10 23:24   ` James Simmons
2018-09-10 23:25   ` James Simmons
2018-09-07  0:49 ` [lustre-devel] [PATCH 15/34] lnet: extend zombie handling to nets and nis NeilBrown
2018-09-12  3:53   ` Doug Oucharek
2018-09-12  4:10     ` NeilBrown
2018-09-07  0:49 ` [lustre-devel] [PATCH 02/34] lnet: Create struct lnet_net NeilBrown
2018-09-10 22:56   ` Doug Oucharek
2018-09-10 23:23   ` James Simmons
2018-09-07  0:49 ` [lustre-devel] [PATCH 04/34] lnet: embed lnd_tunables in lnet_ni NeilBrown
2018-09-10 23:08   ` Doug Oucharek
2018-09-07  0:49 ` [lustre-devel] [PATCH 05/34] lnet: begin separating "networks" from "network interfaces" NeilBrown
2018-09-10 23:18   ` Doug Oucharek
2018-09-12  2:48     ` NeilBrown
2018-09-10 23:27   ` James Simmons
2018-09-07  0:49 ` [lustre-devel] [PATCH 13/34] lnet: reverse order of lnet_startup_lnd{net, ni} NeilBrown
2018-09-12  3:39   ` Doug Oucharek
2018-09-07  0:49 ` [lustre-devel] [PATCH 10/34] lnet: add ni arg to lnet_cpt_of_nid() NeilBrown
2018-09-10 23:32   ` Doug Oucharek
2018-09-11  1:03   ` James Simmons
2018-09-07  0:49 ` [lustre-devel] [PATCH 01/34] struct lnet_ni - reformat comments NeilBrown
2018-09-10 22:49   ` Doug Oucharek
2018-09-10 23:17   ` James Simmons
2018-09-12  2:44     ` NeilBrown
2018-09-07  0:49 ` [lustre-devel] [PATCH 07/34] lnet: change lnet_peer to reference the net, rather than ni NeilBrown
2018-09-10 23:17   ` James Simmons
2018-09-12  2:56     ` NeilBrown
2018-09-07  0:49 ` [lustre-devel] [PATCH 08/34] lnet: add cpt to lnet_match_info NeilBrown
2018-09-10 23:25   ` Doug Oucharek
2018-09-11  1:01   ` James Simmons
2018-09-11  1:01   ` [lustre-devel] BRe: " James Simmons
2018-09-07  0:49 ` [lustre-devel] [PATCH 17/34] lnet: move lnet_shutdown_lndnets down to after first use NeilBrown
2018-09-12  3:55   ` Doug Oucharek
2018-09-07  0:49 ` [lustre-devel] [PATCH 20/34] lnet: discard ni_cpt_list NeilBrown
2018-09-12  4:07   ` Doug Oucharek
2018-09-12  5:48     ` NeilBrown
2018-09-13 19:33       ` Amir Shehata
2018-09-24  6:03         ` NeilBrown
2018-09-12 16:29   ` Amir Shehata
2018-09-07  0:49 ` [lustre-devel] [PATCH 34/34] lnet: introduce use_tcp_bonding mod param NeilBrown
2018-09-12  4:54   ` Doug Oucharek [this message]
2018-09-07  0:49 ` [lustre-devel] [PATCH 28/34] lnet: add checks to ensure network interface names are unique NeilBrown
2018-09-12  4:39   ` Doug Oucharek
2018-09-07  0:49 ` [lustre-devel] [PATCH 27/34] lnet: make it possible to add a new interface to a network NeilBrown
2018-09-12  4:38   ` Doug Oucharek
2018-09-07  0:49 ` [lustre-devel] [PATCH 30/34] lnet: fix typo NeilBrown
2018-09-12  4:47   ` Doug Oucharek
2018-09-07  0:49 ` [lustre-devel] [PATCH 33/34] Completely re-write lnet_parse_networks() NeilBrown
2018-09-12  4:54   ` Doug Oucharek
2018-09-07  0:49 ` [lustre-devel] [PATCH 32/34] lnet: lnet_dyn_del_ni: fix ping_info count NeilBrown
2018-09-12  4:49   ` Doug Oucharek
2018-09-07  0:49 ` [lustre-devel] [PATCH 22/34] lnet: don't take reference in lnet_XX2ni_locked() NeilBrown
2018-09-12  4:18   ` Doug Oucharek
2018-09-07  0:49 ` [lustre-devel] [PATCH 29/34] lnet: track tunables in lnet_startup_lndnet() NeilBrown
2018-09-12  4:47   ` Doug Oucharek
2018-09-07  0:49 ` [lustre-devel] [PATCH 23/34] lnet: don't need lock to test ln_shutdown NeilBrown
2018-09-12  4:27   ` Doug Oucharek
2018-09-12  5:54     ` NeilBrown
2018-09-07  0:49 ` [lustre-devel] [PATCH 26/34] lnet: only valid lnd_type when net_id is unique NeilBrown
2018-09-12  4:34   ` Doug Oucharek
2018-09-07  0:49 ` [lustre-devel] [PATCH 31/34] lnet: lnet_dyn_add_ni: fix ping_info count NeilBrown
2018-09-12  4:48   ` Doug Oucharek
2018-09-07  0:49 ` [lustre-devel] [PATCH 19/34] lnet: simplify lnet_islocalnet() NeilBrown
2018-09-12  4:02   ` Doug Oucharek
2018-09-07  0:49 ` [lustre-devel] [PATCH 25/34] lnet: swap 'then' and 'else' branches in lnet_startup_lndnet NeilBrown
2018-09-12  4:32   ` Doug Oucharek
2018-09-07  0:49 ` [lustre-devel] [PATCH 24/34] lnet: don't take lock over lnet_net_unique() NeilBrown
2018-09-12  4:29   ` Doug Oucharek
2018-09-07  0:49 ` [lustre-devel] [PATCH 21/34] lnet: add net_ni_added NeilBrown
2018-09-12  4:15   ` Doug Oucharek
2018-09-10 23:10 ` [lustre-devel] [PATCH 00/34] Beginning of multi-rail support for drivers/staging/lustre James Simmons
2018-09-24  6:58   ` NeilBrown
2018-09-29 22:35     ` James Simmons

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DA7E7FA-7658-40E5-986D-313DF02B21DC@cray.com \
    --to=doucharek@cray.com \
    --cc=lustre-devel@lists.lustre.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.