diff mbox series

[13/15] lnet: socklnd: default conns_per_peer to 0

Message ID 1636384063-13838-14-git-send-email-jsimmons@infradead.org (mailing list archive)
State New, archived
Headers show
Series lustre: update to OpenSFS tree Nov 8, 2021 | expand

Commit Message

James Simmons Nov. 8, 2021, 3:07 p.m. UTC
From: Serguei Smirnov <ssmirnov@whamcloud.com>

Setting conns_per_peer to 0 triggers socklnd to choose the
(heuristically) optimal setting for the interface given its speed.
Make 0 the default for socklnd conns_per_peer.

Fixes: 6374d25cfe ("lnet: socklnd: set conns_per_peer based on link speed")
WC-bug-id: https://jira.whamcloud.com/browse/LU-15136
Lustre-commit: 30a028e2ee2b3eead ("U-15136 socklnd: default conns_per_peer to 0")
Signed-off-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/45319
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Tested-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 include/linux/lnet/lib-lnet.h              |  2 +-
 net/lnet/klnds/socklnd/socklnd_modparams.c | 10 ++++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/include/linux/lnet/lib-lnet.h b/include/linux/lnet/lib-lnet.h
index 890f61a..104c98d 100644
--- a/include/linux/lnet/lib-lnet.h
+++ b/include/linux/lnet/lib-lnet.h
@@ -87,7 +87,7 @@ 
 #define DEFAULT_CREDITS	256
 
 /* default number of connections per peer */
-#define DEFAULT_CONNS_PER_PEER	1
+#define DEFAULT_CONNS_PER_PEER	0
 
 int choose_ipv4_src(u32 *ret, int interface, u32 dst_ipaddr, struct net *ns);
 
diff --git a/net/lnet/klnds/socklnd/socklnd_modparams.c b/net/lnet/klnds/socklnd/socklnd_modparams.c
index 72f9df2..c00ea49 100644
--- a/net/lnet/klnds/socklnd/socklnd_modparams.c
+++ b/net/lnet/klnds/socklnd/socklnd_modparams.c
@@ -163,6 +163,10 @@  static int ksocklnd_ni_get_eth_intf_speed(struct lnet_ni *ni)
 	int intf_idx = -1;
 	int ret = -1;
 
+	/* check if ni has interface assigned */
+	if (!ni->ni_net_ns || !ni->ni_interface)
+		return 0;
+
 	rtnl_lock();
 	for_each_netdev(ni->ni_net_ns, dev) {
 		int flags = dev_get_flags(dev);
@@ -215,10 +219,12 @@  static int ksocklnd_speed2cpp(int speed)
 
 static int ksocklnd_lookup_conns_per_peer(struct lnet_ni *ni)
 {
-	int cpp = DEFAULT_CONNS_PER_PEER;
+	int cpp = 1;
 	int speed = ksocklnd_ni_get_eth_intf_speed(ni);
 
-	CDEBUG(D_NET, "intf %s speed %d\n", ni->ni_interface, speed);
+	if (ni->ni_interface)
+		CDEBUG(D_NET, "intf %s speed %d\n", ni->ni_interface, speed);
+
 	if (speed > 0)
 		cpp = ksocklnd_speed2cpp(speed);