1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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.
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).
18 * You should have received a copy of the GNU General Public License
19 * version 2 along with this program; If not, see
20 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
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
29 * Copyright 2008 Sun Microsystems, Inc. All rights reserved
30 * Use is subject to license terms.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
36 * lnet/include/lnet/socklnd.h
38 * #defines shared between socknal implementation and utilities
40 #ifndef __LNET_LNET_SOCKLND_H__
41 #define __LNET_LNET_SOCKLND_H__
43 #include <lnet/types.h>
44 #include <lnet/lib-types.h>
46 #define SOCKLND_CONN_NONE (-1)
47 #define SOCKLND_CONN_ANY 0
48 #define SOCKLND_CONN_CONTROL 1
49 #define SOCKLND_CONN_BULK_IN 2
50 #define SOCKLND_CONN_BULK_OUT 3
51 #define SOCKLND_CONN_NTYPES 4
53 #define SOCKLND_CONN_ACK SOCKLND_CONN_BULK_IN
55 #include <libcfs/libcfs_pack.h>
57 __u32 kshm_magic; /* magic number of socklnd message */
58 __u32 kshm_version; /* version of socklnd message */
59 lnet_nid_t kshm_src_nid; /* sender's nid */
60 lnet_nid_t kshm_dst_nid; /* destination nid */
61 lnet_pid_t kshm_src_pid; /* sender's pid */
62 lnet_pid_t kshm_dst_pid; /* destination pid */
63 __u64 kshm_src_incarnation; /* sender's incarnation */
64 __u64 kshm_dst_incarnation; /* destination's incarnation */
65 __u32 kshm_ctype; /* connection type */
66 __u32 kshm_nips; /* # IP addrs */
67 __u32 kshm_ips[0]; /* IP addrs */
68 } WIRE_ATTR ksock_hello_msg_t;
71 lnet_hdr_t ksnm_hdr; /* lnet hdr */
74 * ksnm_payload is removed because of winnt compiler's limitation:
75 * zero-sized array can only be placed at the tail of [nested]
76 * structure definitions. lnet payload will be stored just after
77 * the body of structure ksock_lnet_msg_t
79 } WIRE_ATTR ksock_lnet_msg_t;
82 __u32 ksm_type; /* type of socklnd message */
83 __u32 ksm_csum; /* checksum if != 0 */
84 __u64 ksm_zc_cookies[2]; /* Zero-Copy request/ACK cookie */
86 ksock_lnet_msg_t lnetmsg; /* lnet message, it's empty if it's NOOP */
88 } WIRE_ATTR ksock_msg_t;
91 socklnd_init_msg(ksock_msg_t *msg, int type)
95 msg->ksm_zc_cookies[0] = msg->ksm_zc_cookies[1] = 0;
98 #include <libcfs/libcfs_unpack.h>
100 #define KSOCK_MSG_NOOP 0xc0 /* ksm_u empty */
101 #define KSOCK_MSG_LNET 0xc1 /* lnet msg */
103 /* We need to know this number to parse hello msg from ksocklnd in
104 * other LND (usocklnd, for example) */
105 #define KSOCK_PROTO_V2 2
106 #define KSOCK_PROTO_V3 3