These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / staging / lustre / include / linux / lnet / socklnd.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.gnu.org/licenses/gpl-2.0.html
19  *
20  * GPL HEADER END
21  */
22 /*
23  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
24  * Use is subject to license terms.
25  *
26  * Copyright (c) 2012 - 2015, Intel Corporation.
27  */
28 /*
29  * This file is part of Lustre, http://www.lustre.org/
30  * Lustre is a trademark of Seagate, Inc.
31  *
32  * lnet/include/lnet/socklnd.h
33  */
34 #ifndef __LNET_LNET_SOCKLND_H__
35 #define __LNET_LNET_SOCKLND_H__
36
37 #include "types.h"
38
39 #define SOCKLND_CONN_NONE     (-1)
40 #define SOCKLND_CONN_ANY        0
41 #define SOCKLND_CONN_CONTROL    1
42 #define SOCKLND_CONN_BULK_IN    2
43 #define SOCKLND_CONN_BULK_OUT   3
44 #define SOCKLND_CONN_NTYPES     4
45
46 #define SOCKLND_CONN_ACK        SOCKLND_CONN_BULK_IN
47
48 typedef struct {
49         __u32           kshm_magic;     /* magic number of socklnd message */
50         __u32           kshm_version;   /* version of socklnd message */
51         lnet_nid_t      kshm_src_nid;   /* sender's nid */
52         lnet_nid_t      kshm_dst_nid;   /* destination nid */
53         lnet_pid_t      kshm_src_pid;   /* sender's pid */
54         lnet_pid_t      kshm_dst_pid;   /* destination pid */
55         __u64           kshm_src_incarnation; /* sender's incarnation */
56         __u64           kshm_dst_incarnation; /* destination's incarnation */
57         __u32           kshm_ctype;     /* connection type */
58         __u32           kshm_nips;      /* # IP addrs */
59         __u32           kshm_ips[0];    /* IP addrs */
60 } WIRE_ATTR ksock_hello_msg_t;
61
62 typedef struct {
63         lnet_hdr_t      ksnm_hdr;       /* lnet hdr */
64
65         /*
66          * ksnm_payload is removed because of winnt compiler's limitation:
67          * zero-sized array can only be placed at the tail of [nested]
68          * structure definitions. lnet payload will be stored just after
69          * the body of structure ksock_lnet_msg_t
70          */
71 } WIRE_ATTR ksock_lnet_msg_t;
72
73 typedef struct {
74         __u32   ksm_type;               /* type of socklnd message */
75         __u32   ksm_csum;               /* checksum if != 0 */
76         __u64   ksm_zc_cookies[2];      /* Zero-Copy request/ACK cookie */
77         union {
78                 ksock_lnet_msg_t lnetmsg;/* lnet message, it's empty if
79                                           * it's NOOP */
80         } WIRE_ATTR ksm_u;
81 } WIRE_ATTR ksock_msg_t;
82
83 static inline void
84 socklnd_init_msg(ksock_msg_t *msg, int type)
85 {
86         msg->ksm_csum = 0;
87         msg->ksm_type = type;
88         msg->ksm_zc_cookies[0] = msg->ksm_zc_cookies[1]  = 0;
89 }
90
91 #define KSOCK_MSG_NOOP  0xC0    /* ksm_u empty */
92 #define KSOCK_MSG_LNET  0xC1    /* lnet msg */
93
94 /* We need to know this number to parse hello msg from ksocklnd in
95  * other LND (usocklnd, for example) */
96 #define KSOCK_PROTO_V2  2
97 #define KSOCK_PROTO_V3  3
98
99 #endif