Whamcloud - gitweb
LU-10391 socklnd: move lnet_hdr unpack into ->pro_unpack 09/43609/10
authorMr NeilBrown <neilb@suse.de>
Mon, 6 Jul 2020 05:07:24 +0000 (15:07 +1000)
committerOleg Drokin <green@whamcloud.com>
Wed, 26 Jan 2022 05:13:15 +0000 (05:13 +0000)
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.

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: Icc22f4b52c1391d382c28bad157795f5477f4d7c
Reviewed-on: https://review.whamcloud.com/43609
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/klnds/socklnd/socklnd.h
lnet/klnds/socklnd/socklnd_cb.c
lnet/klnds/socklnd/socklnd_proto.c

index ec0cafe..48427a3 100644 (file)
@@ -435,7 +435,7 @@ struct ksock_proto {
        int         (*pro_send_hello)(struct ksock_conn *, struct ksock_hello_msg *);     /* handshake function */
        int         (*pro_recv_hello)(struct ksock_conn *, struct ksock_hello_msg *, int);/* handshake function */
        void        (*pro_pack)(struct ksock_tx *);                                  /* message pack */
-       void        (*pro_unpack)(struct ksock_msg *);                          /* message unpack */
+       void        (*pro_unpack)(struct ksock_msg *, struct lnet_hdr *);       /* message unpack */
        struct ksock_tx *(*pro_queue_tx_msg)(struct ksock_conn *, struct ksock_tx *);          /* queue tx on the connection */
        int         (*pro_queue_tx_zcack)(struct ksock_conn *, struct ksock_tx *, __u64); /* queue ZC ack on the connection */
        int         (*pro_handle_zcreq)(struct ksock_conn *, __u64, int);            /* handle ZC request */
index 05567ae..e3d5e73 100644 (file)
@@ -1264,9 +1264,7 @@ ksocknal_process_receive(struct ksock_conn *conn,
 
        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) != 0) {
                        /* Userspace peer_ni */
index 5ee5f9f..055b9f9 100644 (file)
@@ -756,17 +756,18 @@ ksocknal_pack_msg_v2(struct ksock_tx *tx)
 }
 
 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]  = 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 =