diff mbox series

[21/50] lnet: socklnd: move lnet_hdr unpack into ->pro_unpack

Message ID 1647783064-20688-22-git-send-email-jsimmons@infradead.org (mailing list archive)
State New, archived
Headers show
Series lustre: update to OpenSFS tree as of March 20, 2022 | expand

Commit Message

James Simmons March 20, 2022, 1:30 p.m. UTC
From: Mr NeilBrown <neilb@suse.de>

Converting the lnet_hdr from network-format to host-format
is currently done in ksocknal_process_recv().
Move it to ->pro_unpack() so that a different protocol
can send it in a different format.

WC-bug-id: https://jira.whamcloud.com/browse/LU-10391
Lustre-commit: 15365f3de34ed7d25 ("LU-10391 socklnd: move lnet_hdr unpack into ->pro_unpack")
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Reviewed-on: https://review.whamcloud.com/43609
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 net/lnet/klnds/socklnd/socklnd.h       | 2 +-
 net/lnet/klnds/socklnd/socklnd_cb.c    | 4 +---
 net/lnet/klnds/socklnd/socklnd_proto.c | 7 ++++---
 3 files changed, 6 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/net/lnet/klnds/socklnd/socklnd.h b/net/lnet/klnds/socklnd/socklnd.h
index 5d0be68..bd38ee2 100644
--- a/net/lnet/klnds/socklnd/socklnd.h
+++ b/net/lnet/klnds/socklnd/socklnd.h
@@ -473,7 +473,7 @@  struct ksock_proto {
 	void	(*pro_pack)(struct ksock_tx *);
 
 	/* message unpack */
-	void	(*pro_unpack)(struct ksock_msg *);
+	void	(*pro_unpack)(struct ksock_msg *msg, struct lnet_hdr *hdr);
 
 	/* queue tx on the connection */
 	struct ksock_tx *(*pro_queue_tx_msg)(struct ksock_conn *, struct ksock_tx *);
diff --git a/net/lnet/klnds/socklnd/socklnd_cb.c b/net/lnet/klnds/socklnd/socklnd_cb.c
index 925494b..822de50 100644
--- a/net/lnet/klnds/socklnd/socklnd_cb.c
+++ b/net/lnet/klnds/socklnd/socklnd_cb.c
@@ -1174,9 +1174,7 @@  struct ksock_conn_cb *
 
 	case SOCKNAL_RX_LNET_HEADER:
 		/* unpack message header */
-		conn->ksnc_proto->pro_unpack(&conn->ksnc_msg);
-
-		lnet_hdr_from_nid4(&hdr, &conn->ksnc_msg.ksm_u.lnetmsg_nid4);
+		conn->ksnc_proto->pro_unpack(&conn->ksnc_msg, &hdr);
 
 		if (conn->ksnc_peer->ksnp_id.pid & LNET_PID_USERFLAG) {
 			/* Userspace peer_ni */
diff --git a/net/lnet/klnds/socklnd/socklnd_proto.c b/net/lnet/klnds/socklnd/socklnd_proto.c
index 20a582b..14b1394 100644
--- a/net/lnet/klnds/socklnd/socklnd_proto.c
+++ b/net/lnet/klnds/socklnd/socklnd_proto.c
@@ -760,18 +760,19 @@ 
 }
 
 static void
-ksocknal_unpack_msg_v1(struct ksock_msg *msg)
+ksocknal_unpack_msg_v1(struct ksock_msg *msg, struct lnet_hdr *hdr)
 {
 	msg->ksm_csum = 0;
 	msg->ksm_type = KSOCK_MSG_LNET;
 	msg->ksm_zc_cookies[0] = 0;
 	msg->ksm_zc_cookies[1] = 0;
+	lnet_hdr_from_nid4(hdr, &msg->ksm_u.lnetmsg_nid4);
 }
 
 static void
-ksocknal_unpack_msg_v2(struct ksock_msg *msg)
+ksocknal_unpack_msg_v2(struct ksock_msg *msg, struct lnet_hdr *hdr)
 {
-	return;  /* Do nothing */
+	lnet_hdr_from_nid4(hdr, &msg->ksm_u.lnetmsg_nid4);
 }
 
 const struct ksock_proto ksocknal_protocol_v1x = {