Add the rt linux 4.1.3-rt3 as base
[kvmfornfv.git] / kernel / drivers / staging / lustre / include / linux / 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  * Portals LND Wire message format.
59  * These are sent in sender's byte order (i.e. receiver flips).
60  */
61
62 #define PTL_RESERVED_MATCHBITS  0x100   /* below this value is reserved
63                                          * above is for bulk data transfer */
64 #define LNET_MSG_MATCHBITS       0      /* the value for the message channel */
65
66 typedef struct {
67         lnet_hdr_t      kptlim_hdr;          /* portals header */
68         char          kptlim_payload[0];      /* piggy-backed payload */
69 } WIRE_ATTR kptl_immediate_msg_t;
70
71 typedef struct {
72         lnet_hdr_t      kptlrm_hdr;          /* portals header */
73         __u64        kptlrm_matchbits;       /* matchbits */
74 } WIRE_ATTR kptl_rdma_msg_t;
75
76 typedef struct {
77         __u64        kptlhm_matchbits;       /* matchbits */
78         __u32        kptlhm_max_msg_size;    /* max message size */
79 } WIRE_ATTR kptl_hello_msg_t;
80
81 typedef struct {
82         /* First 2 fields fixed FOR ALL TIME */
83         __u32      ptlm_magic;     /* I'm a Portals LND message */
84         __u16      ptlm_version;   /* this is my version number */
85         __u8        ptlm_type;      /* the message type */
86         __u8        ptlm_credits;   /* returned credits */
87         __u32      ptlm_nob;       /* # bytes in whole message */
88         __u32      ptlm_cksum;     /* checksum (0 == no checksum) */
89         __u64      ptlm_srcnid;    /* sender's NID */
90         __u64      ptlm_srcstamp;  /* sender's incarnation */
91         __u64      ptlm_dstnid;    /* destination's NID */
92         __u64      ptlm_dststamp;  /* destination's incarnation */
93         __u32      ptlm_srcpid;    /* sender's PID */
94         __u32      ptlm_dstpid;    /* destination's PID */
95
96          union {
97                 kptl_immediate_msg_t    immediate;
98                 kptl_rdma_msg_t  rdma;
99                 kptl_hello_msg_t        hello;
100         } WIRE_ATTR ptlm_u;
101
102 } kptl_msg_t;
103
104 /* kptl_msg_t::ptlm_credits is only a __u8 */
105 #define PTLLND_MSG_MAX_CREDITS ((typeof(((kptl_msg_t *)0)->ptlm_credits)) - 1)
106
107 #define PTLLND_MSG_MAGIC                LNET_PROTO_PTL_MAGIC
108 #define PTLLND_MSG_VERSION            0x04
109
110 #define PTLLND_RDMA_OK            0x00
111 #define PTLLND_RDMA_FAIL                0x01
112
113 #define PTLLND_MSG_TYPE_INVALID  0x00
114 #define PTLLND_MSG_TYPE_PUT          0x01
115 #define PTLLND_MSG_TYPE_GET          0x02
116 #define PTLLND_MSG_TYPE_IMMEDIATE       0x03    /* No bulk data xfer*/
117 #define PTLLND_MSG_TYPE_NOOP        0x04
118 #define PTLLND_MSG_TYPE_HELLO      0x05
119 #define PTLLND_MSG_TYPE_NAK          0x06