Whamcloud - gitweb
Mass conversion of all copyright messages to Oracle.
[fs/lustre-release.git] / lnet / include / lnet / ptllnd_wire.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * GPL HEADER START
5  *
6  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 only,
10  * as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License version 2 for more details (a copy is included
16  * in the LICENSE file that accompanied this code).
17  *
18  * You should have received a copy of the GNU General Public License
19  * version 2 along with this program; If not, see
20  * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
21  *
22  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23  * CA 95054 USA or visit www.sun.com if you need additional information or
24  * have any questions.
25  *
26  * GPL HEADER END
27  */
28 /*
29  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
30  * Use is subject to license terms.
31  */
32 /*
33  * This file is part of Lustre, http://www.lustre.org/
34  * Lustre is a trademark of Sun Microsystems, Inc.
35  *
36  * lnet/include/lnet/ptllnd_wire.h
37  *
38  * Author: PJ Kirner <pjkirner@clusterfs.com>
39  */
40  
41 /* Minimum buffer size that any peer will post to receive ptllnd messages */
42 #define PTLLND_MIN_BUFFER_SIZE  256
43
44 /************************************************************************
45  * Tunable defaults that {u,k}lnds/ptllnd should have in common.
46  */
47
48 #define PTLLND_PORTAL           9          /* The same portal PTLPRC used when talking to cray portals */
49 #define PTLLND_PID              9          /* The Portals PID */
50 #define PTLLND_PEERCREDITS      8          /* concurrent sends to 1 peer */
51
52 /* Default buffer size for kernel ptllnds (guaranteed eager) */
53 #define PTLLND_MAX_KLND_MSG_SIZE 512
54
55 /* Default buffer size for catamount ptllnds (not guaranteed eager) - large
56  * enough to avoid RDMA for anything sent while control is not in liblustre */
57 #define PTLLND_MAX_ULND_MSG_SIZE 512
58
59
60 /************************************************************************
61  * Portals LND Wire message format.
62  * These are sent in sender's byte order (i.e. receiver flips).
63  */
64
65 #define PTL_RESERVED_MATCHBITS  0x100   /* below this value is reserved
66                                          * above is for bulk data transfer */
67 #define LNET_MSG_MATCHBITS       0      /* the value for the message channel */
68
69 typedef struct
70 {
71         lnet_hdr_t        kptlim_hdr;             /* portals header */
72         char              kptlim_payload[0];      /* piggy-backed payload */
73 } WIRE_ATTR kptl_immediate_msg_t;
74
75 typedef struct
76 {
77         lnet_hdr_t        kptlrm_hdr;             /* portals header */
78         __u64             kptlrm_matchbits;       /* matchbits */
79 } WIRE_ATTR kptl_rdma_msg_t;
80
81 typedef struct
82 {
83         __u64             kptlhm_matchbits;       /* matchbits */
84         __u32             kptlhm_max_msg_size;    /* max message size */
85 } WIRE_ATTR kptl_hello_msg_t;
86
87 typedef struct
88 {
89         /* First 2 fields fixed FOR ALL TIME */
90         __u32           ptlm_magic;     /* I'm a Portals LND message */
91         __u16           ptlm_version;   /* this is my version number */
92         __u8            ptlm_type;      /* the message type */
93         __u8            ptlm_credits;   /* returned credits */
94         __u32           ptlm_nob;       /* # bytes in whole message */
95         __u32           ptlm_cksum;     /* checksum (0 == no checksum) */
96         __u64           ptlm_srcnid;    /* sender's NID */
97         __u64           ptlm_srcstamp;  /* sender's incarnation */
98         __u64           ptlm_dstnid;    /* destination's NID */
99         __u64           ptlm_dststamp;  /* destination's incarnation */
100         __u32           ptlm_srcpid;    /* sender's PID */
101         __u32           ptlm_dstpid;    /* destination's PID */
102
103          union {
104                 kptl_immediate_msg_t    immediate;
105                 kptl_rdma_msg_t         rdma;
106                 kptl_hello_msg_t        hello;
107         } WIRE_ATTR ptlm_u;
108
109 } kptl_msg_t;
110
111 /* kptl_msg_t::ptlm_credits is only a __u8 */
112 #define PTLLND_MSG_MAX_CREDITS ((typeof(((kptl_msg_t*) 0)->ptlm_credits)) -1)
113
114 #define PTLLND_MSG_MAGIC                LNET_PROTO_PTL_MAGIC
115 #define PTLLND_MSG_VERSION              0x04
116
117 #define PTLLND_RDMA_OK                  0x00
118 #define PTLLND_RDMA_FAIL                0x01
119
120 #define PTLLND_MSG_TYPE_INVALID         0x00
121 #define PTLLND_MSG_TYPE_PUT             0x01
122 #define PTLLND_MSG_TYPE_GET             0x02
123 #define PTLLND_MSG_TYPE_IMMEDIATE       0x03    /* No bulk data xfer*/
124 #define PTLLND_MSG_TYPE_NOOP            0x04
125 #define PTLLND_MSG_TYPE_HELLO           0x05
126 #define PTLLND_MSG_TYPE_NAK             0x06