__u32 kshm_ctype; /* connection type */
__u32 kshm_nips; /* # IP addrs */
__u32 kshm_ips[0]; /* IP addrs */
-} WIRE_ATTR;
+} __packed;
struct ksock_lnet_msg {
struct lnet_hdr ksnm_hdr; /* lnet hdr */
* structure definitions. lnet payload will be stored just after
* the body of structure struct ksock_lnet_msg
*/
-} WIRE_ATTR;
+} __packed;
struct ksock_msg {
__u32 ksm_type; /* type of socklnd message */
__u64 ksm_zc_cookies[2]; /* Zero-Copy request/ACK cookie */
union {
struct ksock_lnet_msg lnetmsg; /* lnet message, it's empty if it's NOOP */
- } WIRE_ATTR ksm_u;
-} WIRE_ATTR;
+ } __packed ksm_u;
+} __packed;
#define KSOCK_MSG_NOOP 0xc0 /* ksm_u empty */
#define KSOCK_MSG_LNET 0xc1 /* lnet msg */
lnetctl.h \
lnet-dlc.h \
lnetst.h \
+ lnet-idl.h \
lnet-types.h \
nidstr.h \
socklnd.h
lnetctl.h \
lnet-dlc.h \
lnetst.h \
+ lnet-idl.h \
lnet-types.h \
nidstr.h \
socklnd.h
--- /dev/null
+/*
+ * GPL HEADER START
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License version 2 for more details (a copy is included
+ * in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; If not, see
+ * http://www.gnu.org/licenses/gpl-2.0.html
+ *
+ * GPL HEADER END
+ */
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Use is subject to license terms.
+ *
+ * Copyright (c) 2012, 2017, Intel Corporation.
+ */
+/*
+ * This file is part of Lustre, http://www.lustre.org/
+ * Lustre is a trademark of Sun Microsystems, Inc.
+ */
+
+#ifndef __UAPI_LNET_IDL_H__
+#define __UAPI_LNET_IDL_H__
+
+#include <linux/types.h>
+
+/************************************************************************
+ * Core LNet wire message format.
+ * These are sent in sender's byte order (i.e. receiver flips).
+ */
+
+/**
+ * Address of an end-point in an LNet network.
+ *
+ * A node can have multiple end-points and hence multiple addresses.
+ * An LNet network can be a simple network (e.g. tcp0) or a network of
+ * LNet networks connected by LNet routers. Therefore an end-point address
+ * has two parts: network ID, and address within a network.
+ *
+ * \see LNET_NIDNET, LNET_NIDADDR, and LNET_MKNID.
+ */
+typedef __u64 lnet_nid_t;
+
+/**
+ * ID of a process in a node. Shortened as PID to distinguish from
+ * lnet_process_id, the global process ID.
+ */
+typedef __u32 lnet_pid_t;
+
+/* Packed version of struct lnet_process_id to transfer via network */
+struct lnet_process_id_packed {
+ lnet_nid_t nid;
+ lnet_pid_t pid; /* node id / process id */
+} __attribute__((packed));
+
+/* The wire handle's interface cookie only matches one network interface in
+ * one epoch (i.e. new cookie when the interface restarts or the node
+ * reboots). The object cookie only matches one object on that interface
+ * during that object's lifetime (i.e. no cookie re-use).
+ */
+struct lnet_handle_wire {
+ __u64 wh_interface_cookie;
+ __u64 wh_object_cookie;
+} __attribute__((packed));
+
+enum lnet_msg_type {
+ LNET_MSG_ACK = 0,
+ LNET_MSG_PUT,
+ LNET_MSG_GET,
+ LNET_MSG_REPLY,
+ LNET_MSG_HELLO,
+};
+
+/* The variant fields of the portals message header are aligned on an 8
+ * byte boundary in the message header. Note that all types used in these
+ * wire structs MUST be fixed size and the smaller types are placed at the
+ * end.
+ */
+struct lnet_ack {
+ struct lnet_handle_wire dst_wmd;
+ __u64 match_bits;
+ __u32 mlength;
+} __attribute__((packed));
+
+struct lnet_put {
+ struct lnet_handle_wire ack_wmd;
+ __u64 match_bits;
+ __u64 hdr_data;
+ __u32 ptl_index;
+ __u32 offset;
+} __attribute__((packed));
+
+struct lnet_get {
+ struct lnet_handle_wire return_wmd;
+ __u64 match_bits;
+ __u32 ptl_index;
+ __u32 src_offset;
+ __u32 sink_length;
+} __attribute__((packed));
+
+struct lnet_reply {
+ struct lnet_handle_wire dst_wmd;
+} __attribute__((packed));
+
+struct lnet_hello {
+ __u64 incarnation;
+ __u32 type;
+} __attribute__((packed));
+
+struct lnet_hdr {
+ lnet_nid_t dest_nid;
+ lnet_nid_t src_nid;
+ lnet_pid_t dest_pid;
+ lnet_pid_t src_pid;
+ __u32 type; /* enum lnet_msg_type */
+ __u32 payload_length; /* payload data to follow */
+ /*<------__u64 aligned------->*/
+ union {
+ struct lnet_ack ack;
+ struct lnet_put put;
+ struct lnet_get get;
+ struct lnet_reply reply;
+ struct lnet_hello hello;
+ } msg;
+} __attribute__((packed));
+
+/* A HELLO message contains a magic number and protocol version
+ * code in the header's dest_nid, the peer's NID in the src_nid, and
+ * LNET_MSG_HELLO in the type field. All other common fields are zero
+ * (including payload_size; i.e. no payload).
+ * This is for use by byte-stream LNDs (e.g. TCP/IP) to check the peer is
+ * running the same protocol and to find out its NID. These LNDs should
+ * exchange HELLO messages when a connection is first established. Individual
+ * LNDs can put whatever else they fancy in lnet_hdr::msg.
+ */
+struct lnet_magicversion {
+ __u32 magic; /* LNET_PROTO_TCP_MAGIC */
+ __u16 version_major; /* increment on incompatible change */
+ __u16 version_minor; /* increment on compatible change */
+} __attribute__((packed));
+
+/* PROTO MAGIC for LNDs */
+#define LNET_PROTO_IB_MAGIC 0x0be91b91
+#define LNET_PROTO_GNI_MAGIC 0xb00fbabe /* ask Kim */
+#define LNET_PROTO_TCP_MAGIC 0xeebc0ded
+#define LNET_PROTO_ACCEPTOR_MAGIC 0xacce7100
+#define LNET_PROTO_PING_MAGIC 0x70696E67 /* 'ping' */
+
+/* Placeholder for a future "unified" protocol across all LNDs */
+/* Current LNDs that receive a request with this magic will respond
+ * with a "stub" reply using their current protocol */
+#define LNET_PROTO_MAGIC 0x45726963 /* ! */
+
+#define LNET_PROTO_TCP_VERSION_MAJOR 1
+#define LNET_PROTO_TCP_VERSION_MINOR 0
+
+/* Acceptor connection request */
+struct lnet_acceptor_connreq {
+ __u32 acr_magic; /* PTL_ACCEPTOR_PROTO_MAGIC */
+ __u32 acr_version; /* protocol version */
+ __u64 acr_nid; /* target NID */
+} __attribute__((packed));
+
+#define LNET_PROTO_ACCEPTOR_VERSION 1
+
+struct lnet_counters_common {
+ __u32 lcc_msgs_alloc;
+ __u32 lcc_msgs_max;
+ __u32 lcc_errors;
+ __u32 lcc_send_count;
+ __u32 lcc_recv_count;
+ __u32 lcc_route_count;
+ __u32 lcc_drop_count;
+ __u64 lcc_send_length;
+ __u64 lcc_recv_length;
+ __u64 lcc_route_length;
+ __u64 lcc_drop_length;
+} __attribute__((packed));
+
+
+#define LNET_NI_STATUS_UP 0x15aac0de
+#define LNET_NI_STATUS_DOWN 0xdeadface
+#define LNET_NI_STATUS_INVALID 0x00000000
+
+struct lnet_ni_status {
+ lnet_nid_t ns_nid;
+ __u32 ns_status;
+ __u32 ns_unused;
+} __attribute__((packed));
+
+/*
+ * NB: value of these features equal to LNET_PROTO_PING_VERSION_x
+ * of old LNet, so there shouldn't be any compatibility issue
+ */
+#define LNET_PING_FEAT_INVAL (0) /* no feature */
+#define LNET_PING_FEAT_BASE (1 << 0) /* just a ping */
+#define LNET_PING_FEAT_NI_STATUS (1 << 1) /* return NI status */
+#define LNET_PING_FEAT_RTE_DISABLED (1 << 2) /* Routing enabled */
+#define LNET_PING_FEAT_MULTI_RAIL (1 << 3) /* Multi-Rail aware */
+#define LNET_PING_FEAT_DISCOVERY (1 << 4) /* Supports Discovery */
+
+/*
+ * All ping feature bits fit to hit the wire.
+ * In lnet_assert_wire_constants() this is compared against its open-coded
+ * value, and in lnet_ping_target_update() it is used to verify that no
+ * unknown bits have been set.
+ * New feature bits can be added, just be aware that this does change the
+ * over-the-wire protocol.
+ */
+#define LNET_PING_FEAT_BITS (LNET_PING_FEAT_BASE | \
+ LNET_PING_FEAT_NI_STATUS | \
+ LNET_PING_FEAT_RTE_DISABLED | \
+ LNET_PING_FEAT_MULTI_RAIL | \
+ LNET_PING_FEAT_DISCOVERY)
+
+struct lnet_ping_info {
+ __u32 pi_magic;
+ __u32 pi_features;
+ lnet_pid_t pi_pid;
+ __u32 pi_nnis;
+ struct lnet_ni_status pi_ni[0];
+} __attribute__((packed));
+
+#define LNET_PING_INFO_SIZE(NNIDS) \
+ offsetof(struct lnet_ping_info, pi_ni[NNIDS])
+#define LNET_PING_INFO_LONI(PINFO) ((PINFO)->pi_ni[0].ns_nid)
+#define LNET_PING_INFO_SEQNO(PINFO) ((PINFO)->pi_ni[0].ns_status)
+
+#endif
/** \addtogroup lnet
* @{ */
-#include <linux/types.h>
+#include <linux/lnet/lnet-idl.h>
+
/** \addtogroup lnet_addr
* @{ */
*/
#define LNET_RESERVED_PORTAL 0
-/**
- * Address of an end-point in an LNet network.
- *
- * A node can have multiple end-points and hence multiple addresses.
- * An LNet network can be a simple network (e.g. tcp0) or a network of
- * LNet networks connected by LNet routers. Therefore an end-point address
- * has two parts: network ID, and address within a network.
- *
- * \see LNET_NIDNET, LNET_NIDADDR, and LNET_MKNID.
- */
-typedef __u64 lnet_nid_t;
-
-/**
- * ID of a process in a node. Shortened as PID to distinguish from
- * lnet_process_id, the global process ID.
- */
-typedef __u32 lnet_pid_t;
-
/** wildcard NID that matches any end-point address */
#define LNET_NID_ANY ((lnet_nid_t) -1)
/** wildcard PID that matches any lnet_pid_t */
#define LNET_NET_ANY LNET_NIDNET(LNET_NID_ANY)
-#define WIRE_ATTR __attribute__((packed))
-
-/* Packed version of struct lnet_process_id to transfer via network */
-struct lnet_process_id_packed {
- lnet_nid_t nid;
- lnet_pid_t pid; /* node id / process id */
-} WIRE_ATTR;
-
-/* The wire handle's interface cookie only matches one network interface in
- * one epoch (i.e. new cookie when the interface restarts or the node
- * reboots). The object cookie only matches one object on that interface
- * during that object's lifetime (i.e. no cookie re-use). */
-struct lnet_handle_wire {
- __u64 wh_interface_cookie;
- __u64 wh_object_cookie;
-} WIRE_ATTR;
-
-enum lnet_msg_type {
- LNET_MSG_ACK = 0,
- LNET_MSG_PUT,
- LNET_MSG_GET,
- LNET_MSG_REPLY,
- LNET_MSG_HELLO,
-};
-
-/* The variant fields of the portals message header are aligned on an 8
- * byte boundary in the message header. Note that all types used in these
- * wire structs MUST be fixed size and the smaller types are placed at the
- * end. */
-struct lnet_ack {
- struct lnet_handle_wire dst_wmd;
- __u64 match_bits;
- __u32 mlength;
-} WIRE_ATTR;
-
-struct lnet_put {
- struct lnet_handle_wire ack_wmd;
- __u64 match_bits;
- __u64 hdr_data;
- __u32 ptl_index;
- __u32 offset;
-} WIRE_ATTR;
-
-struct lnet_get {
- struct lnet_handle_wire return_wmd;
- __u64 match_bits;
- __u32 ptl_index;
- __u32 src_offset;
- __u32 sink_length;
-} WIRE_ATTR;
-
-struct lnet_reply {
- struct lnet_handle_wire dst_wmd;
-} WIRE_ATTR;
-
-struct lnet_hello {
- __u64 incarnation;
- __u32 type;
-} WIRE_ATTR;
-
-struct lnet_hdr {
- lnet_nid_t dest_nid;
- lnet_nid_t src_nid;
- lnet_pid_t dest_pid;
- lnet_pid_t src_pid;
- __u32 type; /* enum lnet_msg_type */
- __u32 payload_length; /* payload data to follow */
- /*<------__u64 aligned------->*/
- union {
- struct lnet_ack ack;
- struct lnet_put put;
- struct lnet_get get;
- struct lnet_reply reply;
- struct lnet_hello hello;
- } msg;
-} WIRE_ATTR;
-
-/* A HELLO message contains a magic number and protocol version
- * code in the header's dest_nid, the peer's NID in the src_nid, and
- * LNET_MSG_HELLO in the type field. All other common fields are zero
- * (including payload_size; i.e. no payload).
- * This is for use by byte-stream LNDs (e.g. TCP/IP) to check the peer is
- * running the same protocol and to find out its NID. These LNDs should
- * exchange HELLO messages when a connection is first established. Individual
- * LNDs can put whatever else they fancy in lnet_hdr::msg.
- */
-struct lnet_magicversion {
- __u32 magic; /* LNET_PROTO_TCP_MAGIC */
- __u16 version_major; /* increment on incompatible change */
- __u16 version_minor; /* increment on compatible change */
-} WIRE_ATTR;
-
-/* PROTO MAGIC for LNDs */
-#define LNET_PROTO_IB_MAGIC 0x0be91b91
-#define LNET_PROTO_GNI_MAGIC 0xb00fbabe /* ask Kim */
-#define LNET_PROTO_TCP_MAGIC 0xeebc0ded
-#define LNET_PROTO_ACCEPTOR_MAGIC 0xacce7100
-#define LNET_PROTO_PING_MAGIC 0x70696E67 /* 'ping' */
-
-/* Placeholder for a future "unified" protocol across all LNDs */
-/* Current LNDs that receive a request with this magic will respond
- * with a "stub" reply using their current protocol */
-#define LNET_PROTO_MAGIC 0x45726963 /* ! */
-
-#define LNET_PROTO_TCP_VERSION_MAJOR 1
-#define LNET_PROTO_TCP_VERSION_MINOR 0
-
-/* Acceptor connection request */
-struct lnet_acceptor_connreq {
- __u32 acr_magic; /* PTL_ACCEPTOR_PROTO_MAGIC */
- __u32 acr_version; /* protocol version */
- __u64 acr_nid; /* target NID */
-} WIRE_ATTR;
-
-#define LNET_PROTO_ACCEPTOR_VERSION 1
-
-struct lnet_counters_common {
- __u32 lcc_msgs_alloc;
- __u32 lcc_msgs_max;
- __u32 lcc_errors;
- __u32 lcc_send_count;
- __u32 lcc_recv_count;
- __u32 lcc_route_count;
- __u32 lcc_drop_count;
- __u64 lcc_send_length;
- __u64 lcc_recv_length;
- __u64 lcc_route_length;
- __u64 lcc_drop_length;
-} WIRE_ATTR;
-
struct lnet_counters_health {
__u32 lch_rst_alloc;
__u32 lch_resend_count;
struct lnet_counters_health lct_health;
};
-#define LNET_NI_STATUS_UP 0x15aac0de
-#define LNET_NI_STATUS_DOWN 0xdeadface
-#define LNET_NI_STATUS_INVALID 0x00000000
-
-struct lnet_ni_status {
- lnet_nid_t ns_nid;
- __u32 ns_status;
- __u32 ns_unused;
-} WIRE_ATTR;
-
-/*
- * NB: value of these features equal to LNET_PROTO_PING_VERSION_x
- * of old LNet, so there shouldn't be any compatibility issue
- */
-#define LNET_PING_FEAT_INVAL (0) /* no feature */
-#define LNET_PING_FEAT_BASE (1 << 0) /* just a ping */
-#define LNET_PING_FEAT_NI_STATUS (1 << 1) /* return NI status */
-#define LNET_PING_FEAT_RTE_DISABLED (1 << 2) /* Routing enabled */
-#define LNET_PING_FEAT_MULTI_RAIL (1 << 3) /* Multi-Rail aware */
-#define LNET_PING_FEAT_DISCOVERY (1 << 4) /* Supports Discovery */
-
-/*
- * All ping feature bits fit to hit the wire.
- * In lnet_assert_wire_constants() this is compared against its open-coded
- * value, and in lnet_ping_target_update() it is used to verify that no
- * unknown bits have been set.
- * New feature bits can be added, just be aware that this does change the
- * over-the-wire protocol.
- */
-#define LNET_PING_FEAT_BITS (LNET_PING_FEAT_BASE | \
- LNET_PING_FEAT_NI_STATUS | \
- LNET_PING_FEAT_RTE_DISABLED | \
- LNET_PING_FEAT_MULTI_RAIL | \
- LNET_PING_FEAT_DISCOVERY)
-
-struct lnet_ping_info {
- __u32 pi_magic;
- __u32 pi_features;
- lnet_pid_t pi_pid;
- __u32 pi_nnis;
- struct lnet_ni_status pi_ni[0];
-} WIRE_ATTR;
-
-#define LNET_PING_INFO_SIZE(NNIDS) \
- offsetof(struct lnet_ping_info, pi_ni[NNIDS])
-#define LNET_PING_INFO_LONI(PINFO) ((PINFO)->pi_ni[0].ns_nid)
-#define LNET_PING_INFO_SEQNO(PINFO) ((PINFO)->pi_ni[0].ns_status)
-
/*
* This is a hard-coded limit on the number of interfaces supported by
* the interface bonding implemented by the ksocknal LND. It must be
int png_flags; /* reserved flags */
};
+/* Both struct srpc_counters and struct sfw_counters are sent over the wire */
struct srpc_counters {
__u32 errors;
__u32 rpcs_sent;
__u32 rpcs_expired;
__u64 bulk_get;
__u64 bulk_put;
-} WIRE_ATTR;
+} __attribute__((packed));
struct sfw_counters {
/** milliseconds since current session started */
__u32 zombie_sessions;
__u32 brw_errors;
__u32 ping_errors;
-} WIRE_ATTR;
+} __attribute__((packed));
#endif
v2:
* - added checksum to FMA
* moved seq before paylod
- * WIRE_ATTR added for alignment
+ * __packed added for alignment
v3:
* added gnm_payload_len for FMA payload size
v4:
__u32 gnpr_host_id; /* ph. host ID of the NIC */
__u32 gnpr_cqid; /* cqid I want peer to use when sending events to me */
gni_smsg_attr_t gnpr_smsg_attr; /* my short msg. attributes */
-} WIRE_ATTR kgn_gniparams_t;
+} __packed kgn_gniparams_t;
typedef struct kgn_nak_data {
__s32 gnnd_errno; /* errno reason for NAK */
-} WIRE_ATTR kgn_nak_data_t;
+} __packed kgn_nak_data_t;
/* the first bits of the connreq struct CANNOT CHANGE FORM EVER
* without breaking the ability for us to properly NAK someone */
kgn_gniparams_t gncr_gnparams; /* sender's endpoint info */
kgn_nak_data_t gncr_nakdata; /* data (rc, etc) for NAK */
};
-} WIRE_ATTR kgn_connreq_t;
+} __packed kgn_connreq_t;
typedef struct {
gni_mem_handle_t gnrd_key;
__u64 gnrd_addr;
__u32 gnrd_nob;
-} WIRE_ATTR kgn_rdma_desc_t;
+} __packed kgn_rdma_desc_t;
typedef struct {
struct lnet_hdr gnim_hdr; /* LNet header */
/* LNet payload is in FMA "Message Data" */
-} WIRE_ATTR kgn_immediate_msg_t;
+} __packed kgn_immediate_msg_t;
typedef struct {
struct lnet_hdr gnprm_hdr; /* LNet header */
__u64 gnprm_cookie; /* opaque completion cookie */
-} WIRE_ATTR kgn_putreq_msg_t;
+} __packed kgn_putreq_msg_t;
typedef struct {
__u64 gnpam_src_cookie; /* reflected completion cookie */
__u64 gnpam_dst_cookie; /* opaque completion cookie */
__u16 gnpam_payload_cksum; /* checksum for get msg */
kgn_rdma_desc_t gnpam_desc; /* sender's sink buffer */
-} WIRE_ATTR kgn_putack_msg_t;
+} __packed kgn_putack_msg_t;
typedef struct {
struct lnet_hdr gngm_hdr; /* LNet header */
__u64 gngm_cookie; /* opaque completion cookie */
__u16 gngm_payload_cksum; /* checksum for put msg */
kgn_rdma_desc_t gngm_desc; /* sender's sink buffer */
-} WIRE_ATTR kgn_get_msg_t;
+} __packed kgn_get_msg_t;
typedef struct {
int gncm_retval; /* error on NAK, size on REQ */
__u64 gncm_cookie; /* reflected completion cookie */
-} WIRE_ATTR kgn_completion_msg_t;
+} __packed kgn_completion_msg_t;
typedef struct { /* NB must fit in FMA "Prefix" */
__u32 gnm_magic; /* I'm an gni message */
kgn_get_msg_t get;
kgn_completion_msg_t completion;
} gnm_u;
-} WIRE_ATTR kgn_msg_t;
+} __packed kgn_msg_t;
/************************************************************************
* runtime tunable data
endif
MOSTLYCLEANFILES = @MOSTLYCLEANFILES@
-EXTRA_DIST = $(ko2iblnd-objs:%.o=%.c) o2iblnd.h
+EXTRA_DIST = $(ko2iblnd-objs:%.o=%.c) o2iblnd-idl.h o2iblnd.h
--- /dev/null
+/*
+ * GPL HEADER START
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License version 2 for more details (a copy is included
+ * in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; If not, see
+ * http://www.gnu.org/licenses/gpl-2.0.html
+ *
+ * GPL HEADER END
+ */
+/*
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Use is subject to license terms.
+ *
+ * Copyright (c) 2011, 2017, Intel Corporation.
+ */
+/*
+ * This file is part of Lustre, http://www.lustre.org/
+ * Lustre is a trademark of Sun Microsystems, Inc.
+ *
+ * lnet/klnds/o2iblnd/o2iblnd-idl.h
+ *
+ * Author: Eric Barton <eric@bartonsoftware.com>
+ */
+#ifndef __LNET_O2IBLND_IDL_H__
+#define __LNET_O2IBLND_IDL_H__
+
+#include <uapi/linux/lnet/lnet-idl.h>
+
+/************************************************************************
+ * IB Wire message format.
+ * These are sent in sender's byte order (i.e. receiver flips).
+ */
+
+struct kib_connparams {
+ u16 ibcp_queue_depth;
+ u16 ibcp_max_frags;
+ u32 ibcp_max_msg_size;
+} __packed;
+
+struct kib_immediate_msg {
+ struct lnet_hdr ibim_hdr; /* portals header */
+ char ibim_payload[0];/* piggy-backed payload */
+} __packed;
+
+struct kib_rdma_frag {
+ u32 rf_nob; /* # bytes this frag */
+ u64 rf_addr; /* CAVEAT EMPTOR: misaligned!! */
+} __packed;
+
+struct kib_rdma_desc {
+ u32 rd_key; /* local/remote key */
+ u32 rd_nfrags; /* # fragments */
+ struct kib_rdma_frag rd_frags[0]; /* buffer frags */
+} __packed;
+
+struct kib_putreq_msg {
+ struct lnet_hdr ibprm_hdr; /* portals header */
+ u64 ibprm_cookie; /* opaque completion cookie */
+} __packed;
+
+struct kib_putack_msg {
+ u64 ibpam_src_cookie;/* reflected completion cookie */
+ u64 ibpam_dst_cookie;/* opaque completion cookie */
+ struct kib_rdma_desc ibpam_rd; /* sender's sink buffer */
+} __packed;
+
+struct kib_get_msg {
+ struct lnet_hdr ibgm_hdr; /* portals header */
+ u64 ibgm_cookie; /* opaque completion cookie */
+ struct kib_rdma_desc ibgm_rd; /* rdma descriptor */
+} __packed;
+
+struct kib_completion_msg {
+ u64 ibcm_cookie; /* opaque completion cookie */
+ s32 ibcm_status; /* < 0 failure: >= 0 length */
+} __packed;
+
+struct kib_msg {
+ /* First 2 fields fixed FOR ALL TIME */
+ u32 ibm_magic; /* I'm an ibnal message */
+ u16 ibm_version; /* this is my version number */
+
+ u8 ibm_type; /* msg type */
+ u8 ibm_credits; /* returned credits */
+ u32 ibm_nob; /* # bytes in whole message */
+ u32 ibm_cksum; /* checksum (0 == no checksum) */
+ u64 ibm_srcnid; /* sender's NID */
+ u64 ibm_srcstamp; /* sender's incarnation */
+ u64 ibm_dstnid; /* destination's NID */
+ u64 ibm_dststamp; /* destination's incarnation */
+
+ union {
+ struct kib_connparams connparams;
+ struct kib_immediate_msg immediate;
+ struct kib_putreq_msg putreq;
+ struct kib_putack_msg putack;
+ struct kib_get_msg get;
+ struct kib_completion_msg completion;
+ } __packed ibm_u;
+} __packed;
+
+#define IBLND_MSG_MAGIC LNET_PROTO_IB_MAGIC /* unique magic */
+
+#define IBLND_MSG_VERSION_1 0x11
+#define IBLND_MSG_VERSION_2 0x12
+#define IBLND_MSG_VERSION IBLND_MSG_VERSION_2
+
+#define IBLND_MSG_CONNREQ 0xc0 /* connection request */
+#define IBLND_MSG_CONNACK 0xc1 /* connection acknowledge */
+#define IBLND_MSG_NOOP 0xd0 /* nothing (just credits) */
+#define IBLND_MSG_IMMEDIATE 0xd1 /* immediate */
+#define IBLND_MSG_PUT_REQ 0xd2 /* putreq (src->sink) */
+#define IBLND_MSG_PUT_NAK 0xd3 /* completion (sink->src) */
+#define IBLND_MSG_PUT_ACK 0xd4 /* putack (sink->src) */
+#define IBLND_MSG_PUT_DONE 0xd5 /* completion (src->sink) */
+#define IBLND_MSG_GET_REQ 0xd6 /* getreq (sink->src) */
+#define IBLND_MSG_GET_DONE 0xd7 /* completion (src->sink: all OK) */
+
+struct kib_rej {
+ u32 ibr_magic; /* sender's magic */
+ u16 ibr_version; /* sender's version */
+ u8 ibr_why; /* reject reason */
+ u8 ibr_padding; /* padding */
+ u64 ibr_incarnation;/* incarnation of peer_ni */
+ struct kib_connparams ibr_cp; /* connection parameters */
+} __packed;
+
+/* connection rejection reasons */
+#define IBLND_REJECT_CONN_RACE 1 /* You lost connection race */
+#define IBLND_REJECT_NO_RESOURCES 2 /* Out of memory/conns etc */
+#define IBLND_REJECT_FATAL 3 /* Anything else */
+
+#define IBLND_REJECT_CONN_UNCOMPAT 4 /* incompatible version peer_ni */
+#define IBLND_REJECT_CONN_STALE 5 /* stale peer_ni */
+
+/* peer_ni's rdma frags doesn't match mine */
+#define IBLND_REJECT_RDMA_FRAGS 6
+/* peer_ni's msg queue size doesn't match mine */
+#define IBLND_REJECT_MSG_QUEUE_SIZE 7
+#define IBLND_REJECT_INVALID_SRV_ID 8
+
+/***********************************************************************/
+
+#endif /* __LNET_O2IBLND_IDL_H__ */
.lnd_recv = kiblnd_recv,
};
+static void ko2inlnd_assert_wire_constants(void)
+{
+ BUILD_BUG_ON(IBLND_MSG_MAGIC != 0x0be91b91);
+ BUILD_BUG_ON(IBLND_MSG_VERSION_1 != 0x11);
+ BUILD_BUG_ON(IBLND_MSG_VERSION_2 != 0x12);
+ BUILD_BUG_ON(IBLND_MSG_VERSION != IBLND_MSG_VERSION_2);
+
+ BUILD_BUG_ON(IBLND_MSG_CONNREQ != 0xc0);
+ BUILD_BUG_ON(IBLND_MSG_CONNACK != 0xc1);
+ BUILD_BUG_ON(IBLND_MSG_NOOP != 0xd0);
+ BUILD_BUG_ON(IBLND_MSG_IMMEDIATE != 0xd1);
+ BUILD_BUG_ON(IBLND_MSG_PUT_REQ != 0xd2);
+ BUILD_BUG_ON(IBLND_MSG_PUT_NAK != 0xd3);
+ BUILD_BUG_ON(IBLND_MSG_PUT_ACK != 0xd4);
+ BUILD_BUG_ON(IBLND_MSG_PUT_DONE != 0xd5);
+ BUILD_BUG_ON(IBLND_MSG_GET_REQ != 0xd6);
+ BUILD_BUG_ON(IBLND_MSG_GET_DONE != 0xd7);
+
+ BUILD_BUG_ON(IBLND_REJECT_CONN_RACE != 1);
+ BUILD_BUG_ON(IBLND_REJECT_NO_RESOURCES != 2);
+ BUILD_BUG_ON(IBLND_REJECT_FATAL != 3);
+ BUILD_BUG_ON(IBLND_REJECT_CONN_UNCOMPAT != 4);
+ BUILD_BUG_ON(IBLND_REJECT_CONN_STALE != 5);
+ BUILD_BUG_ON(IBLND_REJECT_RDMA_FRAGS != 6);
+ BUILD_BUG_ON(IBLND_REJECT_MSG_QUEUE_SIZE != 7);
+ BUILD_BUG_ON(IBLND_REJECT_INVALID_SRV_ID != 8);
+
+ BUILD_BUG_ON((int)sizeof(struct kib_connparams) != 8);
+ BUILD_BUG_ON((int)offsetof(struct kib_connparams, ibcp_queue_depth) != 0);
+ BUILD_BUG_ON((int)sizeof(((struct kib_connparams *)0)->ibcp_queue_depth) != 2);
+ BUILD_BUG_ON((int)offsetof(struct kib_connparams, ibcp_max_frags) != 2);
+ BUILD_BUG_ON((int)sizeof(((struct kib_connparams *)0)->ibcp_max_frags) != 2);
+ BUILD_BUG_ON((int)offsetof(struct kib_connparams, ibcp_max_msg_size) != 4);
+ BUILD_BUG_ON((int)sizeof(((struct kib_connparams *)0)->ibcp_max_msg_size) != 4);
+
+ BUILD_BUG_ON((int)sizeof(struct kib_immediate_msg) != 72);
+ BUILD_BUG_ON((int)offsetof(struct kib_immediate_msg, ibim_hdr) != 0);
+ BUILD_BUG_ON((int)sizeof(((struct kib_immediate_msg *)0)->ibim_hdr) != 72);
+ BUILD_BUG_ON((int)offsetof(struct kib_immediate_msg, ibim_payload) != 72);
+ BUILD_BUG_ON((int)sizeof(((struct kib_immediate_msg *)0)->ibim_payload) != 0);
+
+ BUILD_BUG_ON((int)sizeof(struct kib_rdma_frag) != 12);
+ BUILD_BUG_ON((int)offsetof(struct kib_rdma_frag, rf_nob) != 0);
+ BUILD_BUG_ON((int)sizeof(((struct kib_rdma_frag *)0)->rf_nob) != 4);
+ BUILD_BUG_ON((int)offsetof(struct kib_rdma_frag, rf_addr) != 4);
+ BUILD_BUG_ON((int)sizeof(((struct kib_rdma_frag *)0)->rf_addr) != 8);
+
+ BUILD_BUG_ON((int)sizeof(struct kib_rdma_desc) != 8);
+ BUILD_BUG_ON((int)offsetof(struct kib_rdma_desc, rd_key) != 0);
+ BUILD_BUG_ON((int)sizeof(((struct kib_rdma_desc *)0)->rd_key) != 4);
+ BUILD_BUG_ON((int)offsetof(struct kib_rdma_desc, rd_nfrags) != 4);
+ BUILD_BUG_ON((int)sizeof(((struct kib_rdma_desc *)0)->rd_nfrags) != 4);
+ BUILD_BUG_ON((int)offsetof(struct kib_rdma_desc, rd_frags) != 8);
+ BUILD_BUG_ON((int)sizeof(((struct kib_rdma_desc *)0)->rd_frags) != 0);
+
+ BUILD_BUG_ON((int)sizeof(struct kib_putreq_msg) != 80);
+ BUILD_BUG_ON((int)offsetof(struct kib_putreq_msg, ibprm_hdr) != 0);
+ BUILD_BUG_ON((int)sizeof(((struct kib_putreq_msg *)0)->ibprm_hdr) != 72);
+ BUILD_BUG_ON((int)offsetof(struct kib_putreq_msg, ibprm_cookie) != 72);
+ BUILD_BUG_ON((int)sizeof(((struct kib_putreq_msg *)0)->ibprm_cookie) != 8);
+
+ BUILD_BUG_ON((int)sizeof(struct kib_putack_msg) != 24);
+ BUILD_BUG_ON((int)offsetof(struct kib_putack_msg, ibpam_src_cookie) != 0);
+ BUILD_BUG_ON((int)sizeof(((struct kib_putack_msg *)0)->ibpam_src_cookie) != 8);
+ BUILD_BUG_ON((int)offsetof(struct kib_putack_msg, ibpam_dst_cookie) != 8);
+ BUILD_BUG_ON((int)sizeof(((struct kib_putack_msg *)0)->ibpam_dst_cookie) != 8);
+ BUILD_BUG_ON((int)offsetof(struct kib_putack_msg, ibpam_rd) != 16);
+ BUILD_BUG_ON((int)sizeof(((struct kib_putack_msg *)0)->ibpam_rd) != 8);
+
+ BUILD_BUG_ON((int)sizeof(struct kib_get_msg) != 88);
+ BUILD_BUG_ON((int)offsetof(struct kib_get_msg, ibgm_hdr) != 0);
+ BUILD_BUG_ON((int)sizeof(((struct kib_get_msg *)0)->ibgm_hdr) != 72);
+ BUILD_BUG_ON((int)offsetof(struct kib_get_msg, ibgm_cookie) != 72);
+ BUILD_BUG_ON((int)sizeof(((struct kib_get_msg *)0)->ibgm_cookie) != 8);
+ BUILD_BUG_ON((int)offsetof(struct kib_get_msg, ibgm_rd) != 80);
+ BUILD_BUG_ON((int)sizeof(((struct kib_get_msg *)0)->ibgm_rd) != 8);
+
+ BUILD_BUG_ON((int)sizeof(struct kib_completion_msg) != 12);
+ BUILD_BUG_ON((int)offsetof(struct kib_completion_msg, ibcm_cookie) != 0);
+ BUILD_BUG_ON((int)sizeof(((struct kib_completion_msg *)0)->ibcm_cookie) != 8);
+ BUILD_BUG_ON((int)offsetof(struct kib_completion_msg, ibcm_status) != 8);
+ BUILD_BUG_ON((int)sizeof(((struct kib_completion_msg *)0)->ibcm_status) != 4);
+
+ /* Checks for struct kib_msg */
+ //BUILD_BUG_ON((int)sizeof(struct kib_msg) != 12);
+ BUILD_BUG_ON((int)offsetof(struct kib_msg, ibm_magic) != 0);
+ BUILD_BUG_ON((int)sizeof(((struct kib_msg *)0)->ibm_magic) != 4);
+ BUILD_BUG_ON((int)offsetof(struct kib_msg, ibm_version) != 4);
+ BUILD_BUG_ON((int)sizeof(((struct kib_msg *)0)->ibm_version) != 2);
+ BUILD_BUG_ON((int)offsetof(struct kib_msg, ibm_type) != 6);
+ BUILD_BUG_ON((int)sizeof(((struct kib_msg *)0)->ibm_type) != 1);
+ BUILD_BUG_ON((int)offsetof(struct kib_msg, ibm_credits) != 7);
+ BUILD_BUG_ON((int)sizeof(((struct kib_msg *)0)->ibm_credits) != 1);
+ BUILD_BUG_ON((int)offsetof(struct kib_msg, ibm_nob) != 8);
+ BUILD_BUG_ON((int)sizeof(((struct kib_msg *)0)->ibm_nob) != 4);
+ BUILD_BUG_ON((int)offsetof(struct kib_msg, ibm_cksum) != 12);
+ BUILD_BUG_ON((int)sizeof(((struct kib_msg *)0)->ibm_cksum) != 4);
+ BUILD_BUG_ON((int)offsetof(struct kib_msg, ibm_srcnid) != 16);
+ BUILD_BUG_ON((int)sizeof(((struct kib_msg *)0)->ibm_srcnid) != 8);
+ BUILD_BUG_ON((int)offsetof(struct kib_msg, ibm_srcstamp) != 24);
+ BUILD_BUG_ON((int)sizeof(((struct kib_msg *)0)->ibm_srcstamp) != 8);
+ BUILD_BUG_ON((int)offsetof(struct kib_msg, ibm_dstnid) != 32);
+ BUILD_BUG_ON((int)sizeof(((struct kib_msg *)0)->ibm_dstnid) != 8);
+ BUILD_BUG_ON((int)offsetof(struct kib_msg, ibm_dststamp) != 40);
+ BUILD_BUG_ON((int)sizeof(((struct kib_msg *)0)->ibm_dststamp) != 8);
+
+ /* Connparams */
+ BUILD_BUG_ON((int)offsetof(struct kib_msg, ibm_u.connparams.ibcp_queue_depth) != 48);
+ BUILD_BUG_ON((int)sizeof(((struct kib_msg *)0)->ibm_u.connparams.ibcp_queue_depth) != 2);
+ BUILD_BUG_ON((int)offsetof(struct kib_msg, ibm_u.connparams.ibcp_max_frags) != 50);
+ BUILD_BUG_ON((int)sizeof(((struct kib_msg *)0)->ibm_u.connparams.ibcp_max_frags) != 2);
+ BUILD_BUG_ON((int)offsetof(struct kib_msg, ibm_u.connparams.ibcp_max_msg_size) != 52);
+ BUILD_BUG_ON((int)sizeof(((struct kib_msg *)0)->ibm_u.connparams.ibcp_max_msg_size) != 4);
+
+ /* Immediate message */
+ BUILD_BUG_ON((int)offsetof(struct kib_msg, ibm_u.immediate.ibim_hdr) != 48);
+ BUILD_BUG_ON((int)sizeof(((struct kib_msg *)0)->ibm_u.immediate.ibim_hdr) != 72);
+ BUILD_BUG_ON((int)offsetof(struct kib_msg, ibm_u.immediate.ibim_payload) != 120);
+ BUILD_BUG_ON((int)sizeof(((struct kib_msg *)0)->ibm_u.immediate.ibim_payload) != 0);
+
+ /* PUT req message */
+ BUILD_BUG_ON((int)offsetof(struct kib_msg, ibm_u.putreq.ibprm_hdr) != 48);
+ BUILD_BUG_ON((int)sizeof(((struct kib_msg *)0)->ibm_u.putreq.ibprm_hdr) != 72);
+ BUILD_BUG_ON((int)offsetof(struct kib_msg, ibm_u.putreq.ibprm_cookie) != 120);
+ BUILD_BUG_ON((int)sizeof(((struct kib_msg *)0)->ibm_u.putreq.ibprm_cookie) != 8);
+
+ /* Put ACK */
+ BUILD_BUG_ON((int)offsetof(struct kib_msg, ibm_u.putack.ibpam_src_cookie) != 48);
+ BUILD_BUG_ON((int)sizeof(((struct kib_msg *)0)->ibm_u.putack.ibpam_src_cookie) != 8);
+ BUILD_BUG_ON((int)offsetof(struct kib_msg, ibm_u.putack.ibpam_dst_cookie) != 56);
+ BUILD_BUG_ON((int)sizeof(((struct kib_msg *)0)->ibm_u.putack.ibpam_dst_cookie) != 8);
+ BUILD_BUG_ON((int)offsetof(struct kib_msg, ibm_u.putack.ibpam_rd) != 64);
+ BUILD_BUG_ON((int)sizeof(((struct kib_msg *)0)->ibm_u.putack.ibpam_rd) != 8);
+
+ /* GET message */
+ BUILD_BUG_ON((int)offsetof(struct kib_msg, ibm_u.get.ibgm_hdr) != 48);
+ BUILD_BUG_ON((int)sizeof(((struct kib_msg *)0)->ibm_u.get.ibgm_hdr) != 72);
+ BUILD_BUG_ON((int)offsetof(struct kib_msg, ibm_u.get.ibgm_cookie) != 120);
+ BUILD_BUG_ON((int)sizeof(((struct kib_msg *)0)->ibm_u.get.ibgm_cookie) != 8);
+ BUILD_BUG_ON((int)offsetof(struct kib_msg, ibm_u.get.ibgm_rd) != 128);
+ BUILD_BUG_ON((int)sizeof(((struct kib_msg *)0)->ibm_u.get.ibgm_rd) != 8);
+
+ /* Completion message */
+ BUILD_BUG_ON((int)offsetof(struct kib_msg, ibm_u.completion.ibcm_cookie) != 48);
+ BUILD_BUG_ON((int)sizeof(((struct kib_msg *)0)->ibm_u.completion.ibcm_cookie) != 8);
+ BUILD_BUG_ON((int)offsetof(struct kib_msg, ibm_u.completion.ibcm_status) != 56);
+ BUILD_BUG_ON((int)sizeof(((struct kib_msg *)0)->ibm_u.completion.ibcm_status) != 4);
+
+ /* Sanity checks */
+ BUILD_BUG_ON(sizeof(struct kib_msg) > IBLND_MSG_SIZE);
+ BUILD_BUG_ON(offsetof(struct kib_msg,
+ ibm_u.get.ibgm_rd.rd_frags[IBLND_MAX_RDMA_FRAGS]) >
+ IBLND_MSG_SIZE);
+ BUILD_BUG_ON(offsetof(struct kib_msg,
+ ibm_u.putack.ibpam_rd.rd_frags[IBLND_MAX_RDMA_FRAGS]) >
+ IBLND_MSG_SIZE);
+}
+
static void __exit ko2iblnd_exit(void)
{
lnet_unregister_lnd(&the_o2iblnd);
{
int rc;
- BUILD_BUG_ON(sizeof(struct kib_msg) > IBLND_MSG_SIZE);
- BUILD_BUG_ON(offsetof(struct kib_msg,
- ibm_u.get.ibgm_rd.rd_frags[IBLND_MAX_RDMA_FRAGS]) >
- IBLND_MSG_SIZE);
- BUILD_BUG_ON(offsetof(struct kib_msg,
- ibm_u.putack.ibpam_rd.rd_frags[IBLND_MAX_RDMA_FRAGS]) >
- IBLND_MSG_SIZE);
+ ko2inlnd_assert_wire_constants();
rc = kiblnd_tunables_init();
if (rc != 0)
#include <libcfs/libcfs.h>
#include <lnet/lib-lnet.h>
+#include "o2iblnd-idl.h"
#define IBLND_PEER_HASH_SIZE 101 /* # peer_ni lists */
#define IBLND_INIT_DATA 1
#define IBLND_INIT_ALL 2
-/************************************************************************
- * IB Wire message format.
- * These are sent in sender's byte order (i.e. receiver flips).
- */
-
-struct kib_connparams {
- __u16 ibcp_queue_depth;
- __u16 ibcp_max_frags;
- __u32 ibcp_max_msg_size;
-} WIRE_ATTR;
-
-struct kib_immediate_msg {
- struct lnet_hdr ibim_hdr; /* portals header */
- char ibim_payload[0];/* piggy-backed payload */
-} WIRE_ATTR;
-
-struct kib_rdma_frag {
- __u32 rf_nob; /* # bytes this frag */
- __u64 rf_addr; /* CAVEAT EMPTOR: misaligned!! */
-} WIRE_ATTR;
-
-struct kib_rdma_desc {
- __u32 rd_key; /* local/remote key */
- __u32 rd_nfrags; /* # fragments */
- struct kib_rdma_frag rd_frags[0]; /* buffer frags */
-} WIRE_ATTR;
-
-struct kib_putreq_msg {
- struct lnet_hdr ibprm_hdr; /* portals header */
- __u64 ibprm_cookie; /* opaque completion cookie */
-} WIRE_ATTR;
-
-struct kib_putack_msg {
- __u64 ibpam_src_cookie; /* reflected completion cookie */
- __u64 ibpam_dst_cookie; /* opaque completion cookie */
- struct kib_rdma_desc ibpam_rd; /* sender's sink buffer */
-} WIRE_ATTR;
-
-struct kib_get_msg {
- struct lnet_hdr ibgm_hdr; /* portals header */
- __u64 ibgm_cookie; /* opaque completion cookie */
- struct kib_rdma_desc ibgm_rd; /* rdma descriptor */
-} WIRE_ATTR;
-
-struct kib_completion_msg {
- __u64 ibcm_cookie; /* opaque completion cookie */
- __s32 ibcm_status; /* < 0 failure: >= 0 length */
-} WIRE_ATTR;
-
-struct kib_msg {
- /* First 2 fields fixed FOR ALL TIME */
- __u32 ibm_magic; /* I'm an ibnal message */
- __u16 ibm_version; /* this is my version number */
-
- __u8 ibm_type; /* msg type */
- __u8 ibm_credits; /* returned credits */
- __u32 ibm_nob; /* # bytes in whole message */
- __u32 ibm_cksum; /* checksum (0 == no checksum) */
- __u64 ibm_srcnid; /* sender's NID */
- __u64 ibm_srcstamp; /* sender's incarnation */
- __u64 ibm_dstnid; /* destination's NID */
- __u64 ibm_dststamp; /* destination's incarnation */
-
- union {
- struct kib_connparams connparams;
- struct kib_immediate_msg immediate;
- struct kib_putreq_msg putreq;
- struct kib_putack_msg putack;
- struct kib_get_msg get;
- struct kib_completion_msg completion;
- } WIRE_ATTR ibm_u;
-} WIRE_ATTR;
-
-#define IBLND_MSG_MAGIC LNET_PROTO_IB_MAGIC /* unique magic */
-
-#define IBLND_MSG_VERSION_1 0x11
-#define IBLND_MSG_VERSION_2 0x12
-#define IBLND_MSG_VERSION IBLND_MSG_VERSION_2
-
-#define IBLND_MSG_CONNREQ 0xc0 /* connection request */
-#define IBLND_MSG_CONNACK 0xc1 /* connection acknowledge */
-#define IBLND_MSG_NOOP 0xd0 /* nothing (just credits) */
-#define IBLND_MSG_IMMEDIATE 0xd1 /* immediate */
-#define IBLND_MSG_PUT_REQ 0xd2 /* putreq (src->sink) */
-#define IBLND_MSG_PUT_NAK 0xd3 /* completion (sink->src) */
-#define IBLND_MSG_PUT_ACK 0xd4 /* putack (sink->src) */
-#define IBLND_MSG_PUT_DONE 0xd5 /* completion (src->sink) */
-#define IBLND_MSG_GET_REQ 0xd6 /* getreq (sink->src) */
-#define IBLND_MSG_GET_DONE 0xd7 /* completion (src->sink: all OK) */
-
-struct kib_rej {
- __u32 ibr_magic; /* sender's magic */
- __u16 ibr_version; /* sender's version */
- __u8 ibr_why; /* reject reason */
- __u8 ibr_padding; /* padding */
- __u64 ibr_incarnation; /* incarnation of peer_ni */
- struct kib_connparams ibr_cp; /* connection parameters */
-} WIRE_ATTR;
-
-/* connection rejection reasons */
-#define IBLND_REJECT_CONN_RACE 1 /* You lost connection race */
-#define IBLND_REJECT_NO_RESOURCES 2 /* Out of memory/conns etc */
-#define IBLND_REJECT_FATAL 3 /* Anything else */
-
-#define IBLND_REJECT_CONN_UNCOMPAT 4 /* incompatible version peer_ni */
-#define IBLND_REJECT_CONN_STALE 5 /* stale peer_ni */
-
-/* peer_ni's rdma frags doesn't match mine */
-#define IBLND_REJECT_RDMA_FRAGS 6
-/* peer_ni's msg queue size doesn't match mine */
-#define IBLND_REJECT_MSG_QUEUE_SIZE 7
-#define IBLND_REJECT_INVALID_SRV_ID 8
-
-/***********************************************************************/
-
struct kib_rx { /* receive message */
/* queue for attention */
struct list_head rx_list;
/* Wire protocol assertions generated by 'wirecheck'
* running on Linux robert.bartonsoftware.com 2.6.8-1.521
* #1 Mon Aug 16 09:01:18 EDT 2004 i686 athlon i386 GNU/Linux
- * with gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7) */
+ * with gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7)
+ */
/* Constants... */
BUILD_BUG_ON(LNET_PROTO_TCP_MAGIC != 0xeebc0ded);
BUILD_BUG_ON(LNET_MSG_REPLY != 3);
BUILD_BUG_ON(LNET_MSG_HELLO != 4);
+ BUILD_BUG_ON((int)sizeof(lnet_nid_t) != 8);
+ BUILD_BUG_ON((int)sizeof(lnet_pid_t) != 4);
+
+ /* Checks for struct lnet_process_id_packed */
+ BUILD_BUG_ON((int)sizeof(struct lnet_process_id_packed) != 12);
+ BUILD_BUG_ON((int)offsetof(struct lnet_process_id_packed, nid) != 0);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_process_id_packed *)0)->nid) != 8);
+ BUILD_BUG_ON((int)offsetof(struct lnet_process_id_packed, pid) != 8);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_process_id_packed *)0)->pid) != 4);
+
/* Checks for struct lnet_handle_wire */
BUILD_BUG_ON((int)sizeof(struct lnet_handle_wire) != 16);
BUILD_BUG_ON((int)offsetof(struct lnet_handle_wire,
BUILD_BUG_ON((int)sizeof(((struct lnet_ping_info *)0)->pi_nnis) != 4);
BUILD_BUG_ON((int)offsetof(struct lnet_ping_info, pi_ni) != 16);
BUILD_BUG_ON((int)sizeof(((struct lnet_ping_info *)0)->pi_ni) != 0);
+
+ /* Acceptor connection request */
+ BUILD_BUG_ON(LNET_PROTO_ACCEPTOR_VERSION != 1);
+
+ /* Checks for struct lnet_acceptor_connreq */
+ BUILD_BUG_ON((int)sizeof(struct lnet_acceptor_connreq) != 16);
+ BUILD_BUG_ON((int)offsetof(struct lnet_acceptor_connreq, acr_magic) != 0);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_acceptor_connreq *)0)->acr_magic) != 4);
+ BUILD_BUG_ON((int)offsetof(struct lnet_acceptor_connreq, acr_version) != 4);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_acceptor_connreq *)0)->acr_version) != 4);
+ BUILD_BUG_ON((int)offsetof(struct lnet_acceptor_connreq, acr_nid) != 8);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_acceptor_connreq *)0)->acr_nid) != 8);
+
+ /* Checks for struct lnet_counters_common */
+ BUILD_BUG_ON((int)sizeof(struct lnet_counters_common) != 60);
+ BUILD_BUG_ON((int)offsetof(struct lnet_counters_common, lcc_msgs_alloc) != 0);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_counters_common *)0)->lcc_msgs_alloc) != 4);
+ BUILD_BUG_ON((int)offsetof(struct lnet_counters_common, lcc_msgs_max) != 4);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_counters_common *)0)->lcc_msgs_max) != 4);
+ BUILD_BUG_ON((int)offsetof(struct lnet_counters_common, lcc_errors) != 8);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_counters_common *)0)->lcc_errors) != 4);
+ BUILD_BUG_ON((int)offsetof(struct lnet_counters_common, lcc_send_count) != 12);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_counters_common *)0)->lcc_send_count) != 4);
+ BUILD_BUG_ON((int)offsetof(struct lnet_counters_common, lcc_recv_count) != 16);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_counters_common *)0)->lcc_recv_count) != 4);
+ BUILD_BUG_ON((int)offsetof(struct lnet_counters_common, lcc_route_count) != 20);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_counters_common *)0)->lcc_route_count) != 4);
+ BUILD_BUG_ON((int)offsetof(struct lnet_counters_common, lcc_drop_count) != 24);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_counters_common *)0)->lcc_drop_count) != 4);
+ BUILD_BUG_ON((int)offsetof(struct lnet_counters_common, lcc_send_length) != 28);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_counters_common *)0)->lcc_send_length) != 8);
+ BUILD_BUG_ON((int)offsetof(struct lnet_counters_common, lcc_recv_length) != 36);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_counters_common *)0)->lcc_recv_length) != 8);
+ BUILD_BUG_ON((int)offsetof(struct lnet_counters_common, lcc_route_length) != 44);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_counters_common *)0)->lcc_route_length) != 8);
+ BUILD_BUG_ON((int)offsetof(struct lnet_counters_common, lcc_drop_length) != 52);
+ BUILD_BUG_ON((int)sizeof(((struct lnet_counters_common *)0)->lcc_drop_length) != 8);
}
static const struct lnet_lnd *lnet_find_lnd_by_type(__u32 type)
struct srpc_generic_reqst {
__u64 rpyid; /* reply buffer matchbits */
__u64 bulkid; /* bulk buffer matchbits */
-} WIRE_ATTR;
+} __packed;
struct srpc_generic_reply {
__u32 status;
struct lst_sid sid;
-} WIRE_ATTR;
+} __packed;
/* FRAMEWORK RPCs */
struct srpc_mksn_reqst {
struct lst_sid mksn_sid; /* session id */
__u32 mksn_force; /* use brute force */
char mksn_name[LST_NAME_SIZE];
-} WIRE_ATTR; /* make session request */
+} __packed; /* make session request */
struct srpc_mksn_reply {
__u32 mksn_status; /* session status */
struct lst_sid mksn_sid; /* session id */
__u32 mksn_timeout; /* session timeout */
char mksn_name[LST_NAME_SIZE];
-} WIRE_ATTR; /* make session reply */
+} __packed; /* make session reply */
struct srpc_rmsn_reqst {
__u64 rmsn_rpyid; /* reply buffer matchbits */
struct lst_sid rmsn_sid; /* session id */
-} WIRE_ATTR; /* remove session request */
+} __packed; /* remove session request */
struct srpc_rmsn_reply {
__u32 rmsn_status;
struct lst_sid rmsn_sid; /* session id */
-} WIRE_ATTR; /* remove session reply */
+} __packed; /* remove session reply */
struct srpc_join_reqst {
__u64 join_rpyid; /* reply buffer matchbits */
struct lst_sid join_sid; /* session id to join */
char join_group[LST_NAME_SIZE]; /* group name */
-} WIRE_ATTR;
+} __packed;
struct srpc_join_reply {
__u32 join_status; /* returned status */
struct lst_sid join_sid; /* session id */
__u32 join_timeout; /* # seconds' inactivity to expire */
char join_session[LST_NAME_SIZE]; /* session name */
-} WIRE_ATTR;
+} __packed;
struct srpc_debug_reqst {
__u64 dbg_rpyid; /* reply buffer matchbits */
struct lst_sid dbg_sid; /* session id */
__u32 dbg_flags; /* bitmap of debug */
-} WIRE_ATTR;
+} __packed;
struct srpc_debug_reply {
__u32 dbg_status; /* returned code */
__u32 dbg_timeout; /* session timeout */
__u32 dbg_nbatch; /* # of batches in the node */
char dbg_name[LST_NAME_SIZE]; /* session name */
-} WIRE_ATTR;
+} __packed;
#define SRPC_BATCH_OPC_RUN 1
#define SRPC_BATCH_OPC_STOP 2
__u32 bar_opc; /* create/start/stop batch */
__u32 bar_testidx; /* index of test */
__u32 bar_arg; /* parameters */
-} WIRE_ATTR;
+} __packed;
struct srpc_batch_reply {
__u32 bar_status; /* status of request */
struct lst_sid bar_sid; /* session id */
__u32 bar_active; /* # of active tests in batch/test */
__u32 bar_time; /* remained time */
-} WIRE_ATTR;
+} __packed;
struct srpc_stat_reqst {
__u64 str_rpyid; /* reply buffer matchbits */
struct lst_sid str_sid; /* session id */
__u32 str_type; /* type of stat */
-} WIRE_ATTR;
+} __packed;
struct srpc_stat_reply {
__u32 str_status;
struct sfw_counters str_fw;
struct srpc_counters str_rpc;
struct lnet_counters_common str_lnet;
-} WIRE_ATTR;
+} __packed;
struct test_bulk_req {
__u32 blk_opc; /* bulk operation code */
__u32 blk_npg; /* # of pages */
__u32 blk_flags; /* reserved flags */
-} WIRE_ATTR;
+} __packed;
struct test_bulk_req_v1 {
/** bulk operation code */
__u32 blk_len;
/** bulk offset */
__u32 blk_offset;
-} WIRE_ATTR;
+} __packed;
struct test_ping_req {
__u32 png_size; /* size of ping message */
__u32 png_flags; /* reserved flags */
-} WIRE_ATTR;
+} __packed;
struct srpc_test_reqst {
__u64 tsr_rpyid; /* reply buffer matchbits */
struct test_bulk_req bulk_v0;
struct test_bulk_req_v1 bulk_v1;
} tsr_u;
-} WIRE_ATTR;
+} __packed;
struct srpc_test_reply {
__u32 tsr_status; /* returned code */
struct lst_sid tsr_sid;
-} WIRE_ATTR;
+} __packed;
/* TEST RPCs */
struct srpc_ping_reqst {
__u32 pnr_seq;
__u64 pnr_time_sec;
__u64 pnr_time_nsec;
-} WIRE_ATTR;
+} __packed;
struct srpc_ping_reply {
__u32 pnr_status;
__u32 pnr_magic;
__u32 pnr_seq;
-} WIRE_ATTR;
+} __packed;
struct srpc_brw_reqst {
__u64 brw_rpyid; /* reply buffer matchbits */
__u32 brw_rw; /* read or write */
__u32 brw_len; /* bulk data len */
__u32 brw_flags; /* bulk data patterns */
-} WIRE_ATTR; /* bulk r/w request */
+} __packed; /* bulk r/w request */
struct srpc_brw_reply {
__u32 brw_status;
-} WIRE_ATTR; /* bulk r/w reply */
+} __packed; /* bulk r/w reply */
#define SRPC_MSG_MAGIC 0xeeb0f00d
#define SRPC_MSG_VERSION 1
struct srpc_brw_reqst brw_reqst;
struct srpc_brw_reply brw_reply;
} msg_body;
-} WIRE_ATTR;
+} __packed;
static inline void
srpc_unpack_msg_hdr(struct srpc_msg *msg)