[lustre-devel] [PATCH 07/50] lnet: socklnd: don't deref lnet_hdr in LNDs

James Simmons jsimmons at infradead.org
Sun Mar 20 06:30:21 PDT 2022

From: Mr NeilBrown <neilb at suse.de>

The lnd_hdr structure needs to be extended to support larger
addresses.  To assist this we need to minimize the number of places
that its content are accessed.

Currently the internals of lnet_hdr are larely untouched inside the
various LNDs, but there are some exceptions in socklnd.
These exceptions are not necessary - the same data is available from
elsewhere in the lnet_msg.

So change those accesses to use the lnet_msg info instead.

WC-bug-id: https://jira.whamcloud.com/browse/LU-10391
Lustre-commit: 321fe9fa12d244bb7 ("LU-10391 socklnd: don't deref lnet_hdr in LNDs")
Signed-off-by: Mr NeilBrown <neilb at suse.de>
Reviewed-on: https://review.whamcloud.com/43602
Reviewed-by: Andreas Dilger <adilger at whamcloud.com>
Reviewed-by: Serguei Smirnov <ssmirnov at whamcloud.com>
Reviewed-by: James Simmons <jsimmons at infradead.org>
Reviewed-by: Oleg Drokin <green at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
 net/lnet/klnds/socklnd/socklnd_cb.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/net/lnet/klnds/socklnd/socklnd_cb.c b/net/lnet/klnds/socklnd/socklnd_cb.c
index feab2a07..dede642 100644
--- a/net/lnet/klnds/socklnd/socklnd_cb.c
+++ b/net/lnet/klnds/socklnd/socklnd_cb.c
@@ -356,10 +356,10 @@ struct ksock_tx *
 		if (error && tx->tx_lnetmsg) {
 			CNETERR("Deleting packet type %d len %d %s->%s\n",
-				le32_to_cpu(tx->tx_lnetmsg->msg_hdr.type),
-				le32_to_cpu(tx->tx_lnetmsg->msg_hdr.payload_length),
-				libcfs_nid2str(le64_to_cpu(tx->tx_lnetmsg->msg_hdr.src_nid)),
-				libcfs_nid2str(le64_to_cpu(tx->tx_lnetmsg->msg_hdr.dest_nid)));
+				tx->tx_lnetmsg->msg_type,
+				tx->tx_lnetmsg->msg_len,
+				libcfs_nidstr(&tx->tx_lnetmsg->msg_initiator),
+				libcfs_nidstr(&tx->tx_lnetmsg->msg_target.nid));
 		} else if (error) {
 			CNETERR("Deleting noop packet\n");
@@ -697,8 +697,8 @@ struct ksock_conn *
 	LASSERT(tx->tx_resid == tx->tx_nob);
 	CDEBUG(D_NET, "Packet %p type %d, nob %d niov %d nkiov %d\n",
-	       tx, (tx->tx_lnetmsg) ? tx->tx_lnetmsg->msg_hdr.type :
-					      KSOCK_MSG_NOOP,
+	       tx, tx->tx_lnetmsg ? tx->tx_lnetmsg->msg_hdr.type :
+				    KSOCK_MSG_NOOP,
 	       tx->tx_nob, tx->tx_niov, tx->tx_nkiov);
 	bufnob = conn->ksnc_sock->sk->sk_wmem_queued;

More information about the lustre-devel mailing list