Whamcloud - gitweb
Landing b_hd_newconfig on HEAD
[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  * Copyright (C) 2004 Cluster File Systems, Inc.
5  *   Author: Eric Barton <eric@bartonsoftware.com>
6  * Copyright (C) 2006 Myricom, Inc.
7  *   Author: Scott Atchley <atchley at myri.com>
8  *
9  *   This file is part of Lustre, http://www.lustre.org.
10  *
11  *   Lustre is free software; you can redistribute it and/or
12  *   modify it under the terms of version 2 of the GNU General Public
13  *   License as published by the Free Software Foundation.
14  *
15  *   Lustre is distributed in the hope that it will be useful,
16  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  *   GNU General Public License for more details.
19  *
20  *   You should have received a copy of the GNU General Public License
21  *   along with Lustre; if not, write to the Free Software
22  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23  */
24
25 /*
26  * MXLND wire format - sent in sender's byte order
27  */
28
29 typedef struct kmx_connreq_msg
30 {
31         u32             mxcrm_queue_depth;              /* per peer max messages in flight */
32         u32             mxcrm_eager_size;               /* size of preposted eager messages */
33 } WIRE_ATTR kmx_connreq_msg_t;
34
35 typedef struct kmx_eager_msg
36 {
37         lnet_hdr_t      mxem_hdr;                       /* lnet header */
38         char            mxem_payload[0];                /* piggy-backed payload */
39 } WIRE_ATTR kmx_eager_msg_t;
40
41 typedef struct kmx_putreq_msg
42 {
43         lnet_hdr_t      mxprm_hdr;                      /* lnet header */
44         u64             mxprm_cookie;                   /* opaque completion cookie */
45 } WIRE_ATTR kmx_putreq_msg_t;
46
47 typedef struct kmx_putack_msg
48 {
49         u64             mxpam_src_cookie;               /* reflected completion cookie */
50         u64             mxpam_dst_cookie;               /* opaque completion cookie */
51 } WIRE_ATTR kmx_putack_msg_t;
52
53 typedef struct kmx_getreq_msg
54 {
55         lnet_hdr_t      mxgrm_hdr;                      /* lnet header */
56         u64             mxgrm_cookie;                   /* opaque completion cookie */
57 } WIRE_ATTR kmx_getreq_msg_t;
58
59 typedef struct kmx_msg
60 {
61         /* First two fields fixed for all time */
62         u32             mxm_magic;                      /* MXLND message */
63         u16             mxm_version;                    /* version number */
64
65         u8              mxm_type;                       /* message type */
66         u8              mxm_credits;                    /* returned credits */
67         u32             mxm_nob;                        /* # of bytes in whole message */
68         u32             mxm_cksum;                      /* checksum (0 == no checksum) */
69         u64             mxm_srcnid;                     /* sender's NID */
70         u64             mxm_srcstamp;                   /* sender's incarnation */
71         u64             mxm_dstnid;                     /* destination's NID */
72         u64             mxm_dststamp;                   /* destination's incarnation */
73         u64             mxm_seq;                        /* sequence number */
74
75         union {
76                 kmx_connreq_msg_t       conn_req;
77                 kmx_eager_msg_t         eager;
78                 kmx_putreq_msg_t        put_req;
79                 kmx_putack_msg_t        put_ack;
80                 kmx_getreq_msg_t        get_req;
81         } WIRE_ATTR mxm_u;
82 } WIRE_ATTR kmx_msg_t;
83
84 #define MXLND_MSG_MAGIC         0x4d583130              /* unique magic 'MX10' */
85 #define MXLND_MSG_VERSION       0x01
86
87 #define MXLND_MSG_CONN_REQ      0xc                     /* connection request */
88 #define MXLND_MSG_CONN_ACK      0xa                     /* connection request response */
89 #define MXLND_MSG_EAGER         0xe                     /* eager message */
90 #define MXLND_MSG_NOOP          0x1                     /* no msg, return credits */
91 #define MXLND_MSG_PUT_REQ       0x2                     /* put request src->sink */
92 #define MXLND_MSG_PUT_ACK       0x3                     /* put ack     src<-sink */
93 #define MXLND_MSG_PUT_DATA      0x4                     /* put payload src->sink */
94 #define MXLND_MSG_GET_REQ       0x5                     /* get request sink->src */
95 #define MXLND_MSG_GET_DATA      0x6                     /* get payload sink<-src */