Whamcloud - gitweb
a90abd9424fddc57a9b5a9aac04b7f4f1ea36926
[fs/lustre-release.git] / lnet / klnds / mxlnd / mxlnd_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 [sun.com URL with a
20  * copy of GPLv2].
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  2008 Sun Microsystems, Inc. All rights reserved
30  * Use is subject to license terms.
31  *
32  * Copyright (C) 2006 Myricom, Inc.
33  */
34 /*
35  * This file is part of Lustre, http://www.lustre.org/
36  * Lustre is a trademark of Sun Microsystems, Inc.
37  *
38  * lnet/klnds/mxlnd/mxlnd.h
39  *
40  * Author: Eric Barton <eric@bartonsoftware.com>
41  * Author: Scott Atchley <atchley at myri.com>
42  */
43
44 /*
45  * MXLND wire format - sent in sender's byte order
46  */
47
48 typedef struct kmx_connreq_msg
49 {
50         u32             mxcrm_queue_depth;              /* per peer max messages in flight */
51         u32             mxcrm_eager_size;               /* size of preposted eager messages */
52 } WIRE_ATTR kmx_connreq_msg_t;
53
54 typedef struct kmx_eager_msg
55 {
56         lnet_hdr_t      mxem_hdr;                       /* lnet header */
57         char            mxem_payload[0];                /* piggy-backed payload */
58 } WIRE_ATTR kmx_eager_msg_t;
59
60 typedef struct kmx_putreq_msg
61 {
62         lnet_hdr_t      mxprm_hdr;                      /* lnet header */
63         u64             mxprm_cookie;                   /* opaque completion cookie */
64 } WIRE_ATTR kmx_putreq_msg_t;
65
66 typedef struct kmx_putack_msg
67 {
68         u64             mxpam_src_cookie;               /* reflected completion cookie */
69         u64             mxpam_dst_cookie;               /* opaque completion cookie */
70 } WIRE_ATTR kmx_putack_msg_t;
71
72 typedef struct kmx_getreq_msg
73 {
74         lnet_hdr_t      mxgrm_hdr;                      /* lnet header */
75         u64             mxgrm_cookie;                   /* opaque completion cookie */
76 } WIRE_ATTR kmx_getreq_msg_t;
77
78 typedef struct kmx_msg
79 {
80         /* First two fields fixed for all time */
81         u32             mxm_magic;                      /* MXLND message */
82         u16             mxm_version;                    /* version number */
83
84         u8              mxm_type;                       /* message type */
85         u8              mxm_credits;                    /* returned credits */
86         u32             mxm_nob;                        /* # of bytes in whole message */
87         u32             mxm_cksum;                      /* checksum (0 == no checksum) */
88         u64             mxm_srcnid;                     /* sender's NID */
89         u64             mxm_srcstamp;                   /* sender's incarnation */
90         u64             mxm_dstnid;                     /* destination's NID */
91         u64             mxm_dststamp;                   /* destination's incarnation */
92         u64             mxm_seq;                        /* sequence number */
93
94         union {
95                 kmx_connreq_msg_t       conn_req;
96                 kmx_eager_msg_t         eager;
97                 kmx_putreq_msg_t        put_req;
98                 kmx_putack_msg_t        put_ack;
99                 kmx_getreq_msg_t        get_req;
100         } WIRE_ATTR mxm_u;
101 } WIRE_ATTR kmx_msg_t;
102
103 #define MXLND_MSG_MAGIC         0x4d583130              /* unique magic 'MX10' */
104 #define MXLND_MSG_VERSION       0x01
105
106 #define MXLND_MSG_CONN_REQ      0xc                     /* connection request */
107 #define MXLND_MSG_CONN_ACK      0xa                     /* connection request response */
108 #define MXLND_MSG_EAGER         0xe                     /* eager message */
109 #define MXLND_MSG_NOOP          0x1                     /* no msg, return credits */
110 #define MXLND_MSG_PUT_REQ       0x2                     /* put request src->sink */
111 #define MXLND_MSG_PUT_ACK       0x3                     /* put ack     src<-sink */
112 #define MXLND_MSG_PUT_DATA      0x4                     /* put payload src->sink */
113 #define MXLND_MSG_GET_REQ       0x5                     /* get request sink->src */
114 #define MXLND_MSG_GET_DATA      0x6                     /* get payload sink<-src */