X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lnet%2Finclude%2Flnet%2Fsocklnd.h;h=ff1fe2381768d56c38912123eb7bc8ad4840c652;hb=3e37ac8bb7e068a3070f5770570766ad87270186;hp=f876bf6174f34f579df35ba116fdd86e155f94d3;hpb=72057a3af19ee02d9a686bd7e7d074917e381310;p=fs%2Flustre-release.git diff --git a/lnet/include/lnet/socklnd.h b/lnet/include/lnet/socklnd.h index f876bf6..ff1fe23 100644 --- a/lnet/include/lnet/socklnd.h +++ b/lnet/include/lnet/socklnd.h @@ -25,74 +25,75 @@ */ /* * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. * * lnet/include/lnet/socklnd.h - * - * #defines shared between socknal implementation and utilities */ #ifndef __LNET_LNET_SOCKLND_H__ #define __LNET_LNET_SOCKLND_H__ -#include - -#define SOCKLND_CONN_NONE (-1) -#define SOCKLND_CONN_ANY 0 -#define SOCKLND_CONN_CONTROL 1 -#define SOCKLND_CONN_BULK_IN 2 -#define SOCKLND_CONN_BULK_OUT 3 -#define SOCKLND_CONN_NTYPES 4 +#include +#include -#define SOCKLND_CONN_ACK SOCKLND_CONN_BULK_IN +struct ksock_hello_msg { + __u32 kshm_magic; /* LNET_PROTO_MAGIC */ + __u32 kshm_version; /* KSOCK_PROTO_V* */ + struct lnet_nid kshm_src_nid; /* sender's nid */ + struct lnet_nid kshm_dst_nid; /* destination nid */ + lnet_pid_t kshm_src_pid; /* sender's pid */ + lnet_pid_t kshm_dst_pid; /* destination pid */ + __u64 kshm_src_incarnation; /* sender's incarnation */ + __u64 kshm_dst_incarnation; /* destination's incarnation */ + __u32 kshm_ctype; /* SOCKLND_CONN_* */ + __u32 kshm_nips; /* always sent as zero */ + __u32 kshm_ips[0]; /* deprecated */ +} __packed; -typedef struct { - __u32 kshm_magic; /* magic number of socklnd message */ - __u32 kshm_version; /* version of socklnd message */ +struct ksock_hello_msg_nid4 { + __u32 kshm_magic; /* LNET_PROTO_MAGIC */ + __u32 kshm_version; /* KSOCK_PROTO_V* */ lnet_nid_t kshm_src_nid; /* sender's nid */ lnet_nid_t kshm_dst_nid; /* destination nid */ lnet_pid_t kshm_src_pid; /* sender's pid */ lnet_pid_t kshm_dst_pid; /* destination pid */ __u64 kshm_src_incarnation; /* sender's incarnation */ __u64 kshm_dst_incarnation; /* destination's incarnation */ - __u32 kshm_ctype; /* connection type */ - __u32 kshm_nips; /* # IP addrs */ - __u32 kshm_ips[0]; /* IP addrs */ -} WIRE_ATTR ksock_hello_msg_t; + __u32 kshm_ctype; /* SOCKLND_CONN_* */ + __u32 kshm_nips; /* sent as zero */ + __u32 kshm_ips[0]; /* deprecated */ +} __packed; -typedef struct { - lnet_hdr_t ksnm_hdr; /* lnet hdr */ +struct ksock_msg_hdr { + __u32 ksh_type; /* type of socklnd message */ + __u32 ksh_csum; /* checksum if != 0 */ + __u64 ksh_zc_cookies[2]; /* Zero-Copy request/ACK + * cookie + */ +} __packed; - /* - * ksnm_payload is removed because of winnt compiler's limitation: - * zero-sized array can only be placed at the tail of [nested] - * structure definitions. lnet payload will be stored just after - * the body of structure ksock_lnet_msg_t - */ -} WIRE_ATTR ksock_lnet_msg_t; +#define KSOCK_MSG_NOOP 0xc0 /* empty */ +#define KSOCK_MSG_LNET 0xc1 /* lnet msg */ -typedef struct { - __u32 ksm_type; /* type of socklnd message */ - __u32 ksm_csum; /* checksum if != 0 */ - __u64 ksm_zc_cookies[2]; /* Zero-Copy request/ACK cookie */ +struct ksock_msg { + struct ksock_msg_hdr ksm_kh; union { - ksock_lnet_msg_t lnetmsg; /* lnet message, it's empty if it's NOOP */ - } WIRE_ATTR ksm_u; -} WIRE_ATTR ksock_msg_t; - -static inline void -socklnd_init_msg(ksock_msg_t *msg, int type) -{ - msg->ksm_csum = 0; - msg->ksm_type = type; - msg->ksm_zc_cookies[0] = msg->ksm_zc_cookies[1] = 0; -} - -#define KSOCK_MSG_NOOP 0xc0 /* ksm_u empty */ -#define KSOCK_MSG_LNET 0xc1 /* lnet msg */ + /* case ksm_kh.ksh_type == KSOCK_MSG_NOOP */ + /* - nothing */ + /* case ksm_kh.ksh_type == KSOCK_MSG_LNET */ + struct lnet_hdr_nid4 lnetmsg_nid4; + /* case ksm_kh.ksh_type == KSOCK_MSG_LNET && + * kshm_version >= KSOCK_PROTO_V4 + */ + struct lnet_hdr_nid16 lnetmsg_nid16; + } __packed ksm_u; +} __packed; +#define ksm_type ksm_kh.ksh_type +#define ksm_csum ksm_kh.ksh_csum +#define ksm_zc_cookies ksm_kh.ksh_zc_cookies /* We need to know this number to parse hello msg from ksocklnd in * other LND (usocklnd, for example) */ #define KSOCK_PROTO_V2 2 #define KSOCK_PROTO_V3 3 +#define KSOCK_PROTO_V4 4 #endif