Whamcloud - gitweb
LU-1347 build: remove the vim/emacs modelines
[fs/lustre-release.git] / lnet / include / lnet / ptllnd_wire.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.sun.com/software/products/lustre/docs/GPLv2.pdf
19  *
20  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21  * CA 95054 USA or visit www.sun.com if you need additional information or
22  * have any questions.
23  *
24  * GPL HEADER END
25  */
26 /*
27  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
28  * Use is subject to license terms.
29  */
30 /*
31  * This file is part of Lustre, http://www.lustre.org/
32  * Lustre is a trademark of Sun Microsystems, Inc.
33  *
34  * lnet/include/lnet/ptllnd_wire.h
35  *
36  * Author: PJ Kirner <pjkirner@clusterfs.com>
37  */
38  
39 /* Minimum buffer size that any peer will post to receive ptllnd messages */
40 #define PTLLND_MIN_BUFFER_SIZE  256
41
42 /************************************************************************
43  * Tunable defaults that {u,k}lnds/ptllnd should have in common.
44  */
45
46 #define PTLLND_PORTAL           9          /* The same portal PTLPRC used when talking to cray portals */
47 #define PTLLND_PID              9          /* The Portals PID */
48 #define PTLLND_PEERCREDITS      8          /* concurrent sends to 1 peer */
49
50 /* Default buffer size for kernel ptllnds (guaranteed eager) */
51 #define PTLLND_MAX_KLND_MSG_SIZE 512
52
53 /* Default buffer size for catamount ptllnds (not guaranteed eager) - large
54  * enough to avoid RDMA for anything sent while control is not in liblustre */
55 #define PTLLND_MAX_ULND_MSG_SIZE 512
56
57
58 /************************************************************************
59  * Portals LND Wire message format.
60  * These are sent in sender's byte order (i.e. receiver flips).
61  */
62
63 #define PTL_RESERVED_MATCHBITS  0x100   /* below this value is reserved
64                                          * above is for bulk data transfer */
65 #define LNET_MSG_MATCHBITS       0      /* the value for the message channel */
66
67 typedef struct
68 {
69         lnet_hdr_t        kptlim_hdr;             /* portals header */
70         char              kptlim_payload[0];      /* piggy-backed payload */
71 } WIRE_ATTR kptl_immediate_msg_t;
72
73 typedef struct
74 {
75         lnet_hdr_t        kptlrm_hdr;             /* portals header */
76         __u64             kptlrm_matchbits;       /* matchbits */
77 } WIRE_ATTR kptl_rdma_msg_t;
78
79 typedef struct
80 {
81         __u64             kptlhm_matchbits;       /* matchbits */
82         __u32             kptlhm_max_msg_size;    /* max message size */
83 } WIRE_ATTR kptl_hello_msg_t;
84
85 typedef struct
86 {
87         /* First 2 fields fixed FOR ALL TIME */
88         __u32           ptlm_magic;     /* I'm a Portals LND message */
89         __u16           ptlm_version;   /* this is my version number */
90         __u8            ptlm_type;      /* the message type */
91         __u8            ptlm_credits;   /* returned credits */
92         __u32           ptlm_nob;       /* # bytes in whole message */
93         __u32           ptlm_cksum;     /* checksum (0 == no checksum) */
94         __u64           ptlm_srcnid;    /* sender's NID */
95         __u64           ptlm_srcstamp;  /* sender's incarnation */
96         __u64           ptlm_dstnid;    /* destination's NID */
97         __u64           ptlm_dststamp;  /* destination's incarnation */
98         __u32           ptlm_srcpid;    /* sender's PID */
99         __u32           ptlm_dstpid;    /* destination's PID */
100
101          union {
102                 kptl_immediate_msg_t    immediate;
103                 kptl_rdma_msg_t         rdma;
104                 kptl_hello_msg_t        hello;
105         } WIRE_ATTR ptlm_u;
106
107 } kptl_msg_t;
108
109 /* kptl_msg_t::ptlm_credits is only a __u8 */
110 #define PTLLND_MSG_MAX_CREDITS ((typeof(((kptl_msg_t*) 0)->ptlm_credits)) -1)
111
112 #define PTLLND_MSG_MAGIC                LNET_PROTO_PTL_MAGIC
113 #define PTLLND_MSG_VERSION              0x04
114
115 #define PTLLND_RDMA_OK                  0x00
116 #define PTLLND_RDMA_FAIL                0x01
117
118 #define PTLLND_MSG_TYPE_INVALID         0x00
119 #define PTLLND_MSG_TYPE_PUT             0x01
120 #define PTLLND_MSG_TYPE_GET             0x02
121 #define PTLLND_MSG_TYPE_IMMEDIATE       0x03    /* No bulk data xfer*/
122 #define PTLLND_MSG_TYPE_NOOP            0x04
123 #define PTLLND_MSG_TYPE_HELLO           0x05
124 #define PTLLND_MSG_TYPE_NAK             0x06