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.sun.com/software/products/lustre/docs/GPLv2.pdf 19 * 20 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 21 * CA 95054 USA or visit www.sun.com if you need additional information or 22 * have any questions. 23 * 24 * GPL HEADER END 25 */ 26/* 27 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 28 * Use is subject to license terms. 29 */ 30/* 31 * This file is part of Lustre, http://www.lustre.org/ 32 * Lustre is a trademark of Sun Microsystems, Inc. 33 * 34 * lnet/include/lnet/socklnd.h 35 * 36 * #defines shared between socknal implementation and utilities 37 */ 38#ifndef __LNET_LNET_SOCKLND_H__ 39#define __LNET_LNET_SOCKLND_H__ 40 41#include "types.h" 42#include "lib-types.h" 43 44#define SOCKLND_CONN_NONE (-1) 45#define SOCKLND_CONN_ANY 0 46#define SOCKLND_CONN_CONTROL 1 47#define SOCKLND_CONN_BULK_IN 2 48#define SOCKLND_CONN_BULK_OUT 3 49#define SOCKLND_CONN_NTYPES 4 50 51#define SOCKLND_CONN_ACK SOCKLND_CONN_BULK_IN 52 53typedef struct { 54 __u32 kshm_magic; /* magic number of socklnd message */ 55 __u32 kshm_version; /* version of socklnd message */ 56 lnet_nid_t kshm_src_nid; /* sender's nid */ 57 lnet_nid_t kshm_dst_nid; /* destination nid */ 58 lnet_pid_t kshm_src_pid; /* sender's pid */ 59 lnet_pid_t kshm_dst_pid; /* destination pid */ 60 __u64 kshm_src_incarnation; /* sender's incarnation */ 61 __u64 kshm_dst_incarnation; /* destination's incarnation */ 62 __u32 kshm_ctype; /* connection type */ 63 __u32 kshm_nips; /* # IP addrs */ 64 __u32 kshm_ips[0]; /* IP addrs */ 65} WIRE_ATTR ksock_hello_msg_t; 66 67typedef struct { 68 lnet_hdr_t ksnm_hdr; /* lnet hdr */ 69 70 /* 71 * ksnm_payload is removed because of winnt compiler's limitation: 72 * zero-sized array can only be placed at the tail of [nested] 73 * structure definitions. lnet payload will be stored just after 74 * the body of structure ksock_lnet_msg_t 75 */ 76} WIRE_ATTR ksock_lnet_msg_t; 77 78typedef struct { 79 __u32 ksm_type; /* type of socklnd message */ 80 __u32 ksm_csum; /* checksum if != 0 */ 81 __u64 ksm_zc_cookies[2]; /* Zero-Copy request/ACK cookie */ 82 union { 83 ksock_lnet_msg_t lnetmsg; /* lnet message, it's empty if it's NOOP */ 84 } WIRE_ATTR ksm_u; 85} WIRE_ATTR ksock_msg_t; 86 87static inline void 88socklnd_init_msg(ksock_msg_t *msg, int type) 89{ 90 msg->ksm_csum = 0; 91 msg->ksm_type = type; 92 msg->ksm_zc_cookies[0] = msg->ksm_zc_cookies[1] = 0; 93} 94 95#define KSOCK_MSG_NOOP 0xc0 /* ksm_u empty */ 96#define KSOCK_MSG_LNET 0xc1 /* lnet msg */ 97 98/* We need to know this number to parse hello msg from ksocklnd in 99 * other LND (usocklnd, for example) */ 100#define KSOCK_PROTO_V2 2 101#define KSOCK_PROTO_V3 3 102 103#endif 104