Whamcloud - gitweb
LU-10391 socklnd: factor out key calculation for ksnd_peers 03/42103/13
authorMr NeilBrown <neilb@suse.de>
Mon, 9 Mar 2020 03:13:05 +0000 (14:13 +1100)
committerOleg Drokin <green@whamcloud.com>
Tue, 31 Aug 2021 05:19:47 +0000 (05:19 +0000)
commit96a0c378c2e0a0c8f7e21404252e66944e163100
tree51900ace5830ded70f068f636663918111c86d38
parentf38529cd3a1722119e48abe0931c3e232d3cc1f7
LU-10391 socklnd: factor out key calculation for ksnd_peers

The hash_table library requires a "long" to be used as a key.  We
currently provide the nid, which at 64bits is a suitable long on 64bit
hosts, but isn't really correct on 32bit hosts.

When we change to an extend nid (which is 160bits) it will be even
less appropriate.

So create a separate function to compute a 'long' key, and implement
by simply xoring 'long'-sized parts of the nid together.  On a 64bit
machine, this is currently optimized away for lnet_nid_t, but that
will change when we convert to struct lnet_nid.

This new function is placed in lnet-types.h as it will be more
generally useful later.

The hash_table library calls hash_long() on the key, so we don't need
to do anything more interesting than xoring.

Test-Parameters: trivial
Test-Parameters: serverversion=2.12 serverdistro=el7.9 testlist=runtests
Test-Parameters: clientversion=2.12 testlist=runtests
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I22c59a87c9872bb59a2f47c2a8c57b287ed53ed3
Reviewed-on: https://review.whamcloud.com/42103
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/include/uapi/linux/lnet/lnet-types.h
lnet/klnds/socklnd/socklnd.c