Whamcloud - gitweb
LU-10391 lnet: switch LNetIsPeerLocal() to take 16-byte addr
[fs/lustre-release.git] / lnet / include / lnet / socklnd.h
1 /*
2  * GPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License version 2 for more details (a copy is included
14  * in the LICENSE file that accompanied this code).
15  *
16  * You should have received a copy of the GNU General Public License
17  * version 2 along with this program; If not, see
18  * http://www.gnu.org/licenses/gpl-2.0.html
19  *
20  * GPL HEADER END
21  */
22 /*
23  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
24  * Use is subject to license terms.
25  */
26 /*
27  * This file is part of Lustre, http://www.lustre.org/
28  *
29  * lnet/include/lnet/socklnd.h
30  */
31 #ifndef __LNET_LNET_SOCKLND_H__
32 #define __LNET_LNET_SOCKLND_H__
33
34 #include <uapi/linux/lnet/lnet-types.h>
35 #include <uapi/linux/lnet/socklnd.h>
36
37 struct ksock_hello_msg {
38         __u32                   kshm_magic;     /* LNET_PROTO_MAGIC */
39         __u32                   kshm_version;   /* KSOCK_PROTO_V* */
40         struct lnet_nid         kshm_src_nid;   /* sender's nid */
41         struct lnet_nid         kshm_dst_nid;   /* destination nid */
42         lnet_pid_t              kshm_src_pid;   /* sender's pid */
43         lnet_pid_t              kshm_dst_pid;   /* destination pid */
44         __u64                   kshm_src_incarnation; /* sender's incarnation */
45         __u64                   kshm_dst_incarnation; /* destination's incarnation */
46         __u32                   kshm_ctype;     /* SOCKLND_CONN_* */
47         __u32                   kshm_nips;      /* always sent as zero */
48         __u32                   kshm_ips[0];    /* deprecated */
49 } __packed;
50
51 struct ksock_hello_msg_nid4 {
52         __u32                   kshm_magic;     /* LNET_PROTO_MAGIC */
53         __u32                   kshm_version;   /* KSOCK_PROTO_V* */
54         lnet_nid_t              kshm_src_nid;   /* sender's nid */
55         lnet_nid_t              kshm_dst_nid;   /* destination nid */
56         lnet_pid_t              kshm_src_pid;   /* sender's pid */
57         lnet_pid_t              kshm_dst_pid;   /* destination pid */
58         __u64                   kshm_src_incarnation; /* sender's incarnation */
59         __u64                   kshm_dst_incarnation; /* destination's incarnation */
60         __u32                   kshm_ctype;     /* SOCKLND_CONN_* */
61         __u32                   kshm_nips;      /* sent as zero */
62         __u32                   kshm_ips[0];    /* deprecated */
63 } __packed;
64
65 struct ksock_msg_hdr {
66         __u32                   ksh_type;       /* type of socklnd message */
67         __u32                   ksh_csum;       /* checksum if != 0 */
68         __u64                   ksh_zc_cookies[2]; /* Zero-Copy request/ACK
69                                                     * cookie
70                                                     */
71 } __packed;
72
73 #define KSOCK_MSG_NOOP          0xc0            /* empty */
74 #define KSOCK_MSG_LNET          0xc1            /* lnet msg */
75
76 struct ksock_msg {
77         struct ksock_msg_hdr    ksm_kh;
78         union {
79                 /* case ksm_kh.ksh_type == KSOCK_MSG_NOOP */
80                 /* - nothing */
81                 /* case ksm_kh.ksh_type == KSOCK_MSG_LNET */
82                 struct lnet_hdr_nid4 lnetmsg_nid4;
83                 /* case ksm_kh.ksh_type == KSOCK_MSG_LNET &&
84                  *      kshm_version >= KSOCK_PROTO_V4
85                  */
86                 struct lnet_hdr_nid16 lnetmsg_nid16;
87         } __packed ksm_u;
88 } __packed;
89 #define ksm_type ksm_kh.ksh_type
90 #define ksm_csum ksm_kh.ksh_csum
91 #define ksm_zc_cookies ksm_kh.ksh_zc_cookies
92
93 /* We need to know this number to parse hello msg from ksocklnd in
94  * other LND (usocklnd, for example) */
95 #define KSOCK_PROTO_V2          2
96 #define KSOCK_PROTO_V3          3
97 #define KSOCK_PROTO_V4          4
98
99 #endif