Whamcloud - gitweb
Severity : major
[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  * Copyright (C) 2005 Cluster File Systems, Inc. All rights reserved.
5  *   Author: PJ Kirner <pjkirner@clusterfs.com>
6  *
7  *   This file is part of the Lustre file system, http://www.lustre.org
8  *   Lustre is a trademark of Cluster File Systems, Inc.
9  *
10  *   This file is confidential source code owned by Cluster File Systems.
11  *   No viewing, modification, compilation, redistribution, or any other
12  *   form of use is permitted except through a signed license agreement.
13  *
14  *   If you have not signed such an agreement, then you have no rights to
15  *   this file.  Please destroy it immediately and contact CFS.
16  *
17  */
18  
19 /* Minimum buffer size that any peer will post to receive ptllnd messages */
20 #define PTLLND_MIN_BUFFER_SIZE  256
21
22 /************************************************************************
23  * Tunable defaults that {u,k}lnds/ptllnd should have in common.
24  */
25
26 #define PTLLND_PORTAL           9          /* The same portal PTLPRC used when talking to cray portals */
27 #define PTLLND_PID              9          /* The Portals PID */
28 #define PTLLND_PEERCREDITS      8          /* concurrent sends to 1 peer */
29
30 /* Default buffer size for kernel ptllnds (guaranteed eager) */
31 #define PTLLND_MAX_KLND_MSG_SIZE 512
32
33 /* Default buffer size for catamount ptllnds (not guaranteed eager) - large
34  * enough to avoid RDMA for anything sent while control is not in liblustre */
35 #define PTLLND_MAX_ULND_MSG_SIZE 512
36
37
38 /************************************************************************
39  * Portals LND Wire message format.
40  * These are sent in sender's byte order (i.e. receiver flips).
41  */
42
43 #define PTL_RESERVED_MATCHBITS  0x100   /* below this value is reserved
44                                          * above is for bulk data transfer */
45 #define LNET_MSG_MATCHBITS       0      /* the value for the message channel */
46
47 typedef struct
48 {
49         lnet_hdr_t        kptlim_hdr;             /* portals header */
50         char              kptlim_payload[0];      /* piggy-backed payload */
51 } WIRE_ATTR kptl_immediate_msg_t;
52
53 typedef struct
54 {
55         lnet_hdr_t        kptlrm_hdr;             /* portals header */
56         __u64             kptlrm_matchbits;       /* matchbits */
57 } WIRE_ATTR kptl_rdma_msg_t;
58
59 typedef struct
60 {
61         __u64             kptlhm_matchbits;       /* matchbits */
62         __u32             kptlhm_max_msg_size;    /* max message size */
63 } WIRE_ATTR kptl_hello_msg_t;
64
65 typedef struct
66 {
67         /* First 2 fields fixed FOR ALL TIME */
68         __u32           ptlm_magic;     /* I'm a Portals LND message */
69         __u16           ptlm_version;   /* this is my version number */
70         __u8            ptlm_type;      /* the message type */
71         __u8            ptlm_credits;   /* returned credits */
72         __u32           ptlm_nob;       /* # bytes in whole message */
73         __u32           ptlm_cksum;     /* checksum (0 == no checksum) */
74         __u64           ptlm_srcnid;    /* sender's NID */
75         __u64           ptlm_srcstamp;  /* sender's incarnation */
76         __u64           ptlm_dstnid;    /* destination's NID */
77         __u64           ptlm_dststamp;  /* destination's incarnation */
78         __u32           ptlm_srcpid;    /* sender's PID */
79         __u32           ptlm_dstpid;    /* destination's PID */
80
81          union {
82                 kptl_immediate_msg_t    immediate;
83                 kptl_rdma_msg_t         rdma;
84                 kptl_hello_msg_t        hello;
85         } WIRE_ATTR ptlm_u;
86
87 } kptl_msg_t;
88
89 #define PTLLND_MSG_MAGIC                LNET_PROTO_PTL_MAGIC
90 #define PTLLND_MSG_VERSION              0x04
91
92 #define PTLLND_RDMA_OK                  0x00
93 #define PTLLND_RDMA_FAIL                0x01
94
95 #define PTLLND_MSG_TYPE_INVALID         0x00
96 #define PTLLND_MSG_TYPE_PUT             0x01
97 #define PTLLND_MSG_TYPE_GET             0x02
98 #define PTLLND_MSG_TYPE_IMMEDIATE       0x03    /* No bulk data xfer*/
99 #define PTLLND_MSG_TYPE_NOOP            0x04
100 #define PTLLND_MSG_TYPE_HELLO           0x05
101 #define PTLLND_MSG_TYPE_NAK             0x06
102