* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2012, 2015, Intel Corporation.
+ * Copyright (c) 2012, 2017, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
return (type << 16) | num;
}
+/** The lolnd NID (i.e. myself) */
+#define LNET_NID_LO_0 LNET_MKNID(LNET_MKNET(LOLND, 0), 0)
+
#define WIRE_ATTR __attribute__((packed))
/* Packed version of struct lnet_process_id to transfer via network */
-typedef struct lnet_process_id_packed {
+struct lnet_process_id_packed {
lnet_nid_t nid;
lnet_pid_t pid; /* node id / process id */
-} WIRE_ATTR lnet_process_id_packed;
+} 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). */
-typedef struct lnet_handle_wire {
+struct lnet_handle_wire {
__u64 wh_interface_cookie;
__u64 wh_object_cookie;
-} WIRE_ATTR lnet_handle_wire_t;
+} WIRE_ATTR;
-typedef enum lnet_msg_type {
+enum lnet_msg_type {
LNET_MSG_ACK = 0,
LNET_MSG_PUT,
LNET_MSG_GET,
LNET_MSG_REPLY,
LNET_MSG_HELLO,
-} lnet_msg_type_t;
+};
/* 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
__u32 type;
} WIRE_ATTR;
-typedef struct lnet_hdr {
+struct lnet_hdr {
lnet_nid_t dest_nid;
lnet_nid_t src_nid;
lnet_pid_t dest_pid;
struct lnet_reply reply;
struct lnet_hello hello;
} msg;
-} WIRE_ATTR lnet_hdr_t;
+} 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
* exchange HELLO messages when a connection is first established. Individual
* LNDs can put whatever else they fancy in lnet_hdr::msg.
*/
-typedef struct lnet_magicversion {
+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 lnet_magic_version_t;
+} WIRE_ATTR;
/* PROTO MAGIC for LNDs */
#define LNET_PROTO_IB_MAGIC 0x0be91b91
#define LNET_PROTO_TCP_VERSION_MINOR 0
/* Acceptor connection request */
-typedef struct lnet_acceptor_connreq {
+struct lnet_acceptor_connreq {
__u32 acr_magic; /* PTL_ACCEPTOR_PROTO_MAGIC */
__u32 acr_version; /* protocol version */
__u64 acr_nid; /* target NID */
-} WIRE_ATTR lnet_acceptor_connreq_t;
+} WIRE_ATTR;
#define LNET_PROTO_ACCEPTOR_VERSION 1
-typedef struct lnet_counters {
- __u32 msgs_alloc;
- __u32 msgs_max;
- __u32 errors;
- __u32 send_count;
- __u32 recv_count;
- __u32 route_count;
- __u32 drop_count;
- __u64 send_length;
- __u64 recv_length;
- __u64 route_length;
- __u64 drop_length;
-} WIRE_ATTR lnet_counters_t;
+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;
+ __u32 lch_response_timeout_count;
+ __u32 lch_local_interrupt_count;
+ __u32 lch_local_dropped_count;
+ __u32 lch_local_aborted_count;
+ __u32 lch_local_no_route_count;
+ __u32 lch_local_timeout_count;
+ __u32 lch_local_error_count;
+ __u32 lch_remote_dropped_count;
+ __u32 lch_remote_error_count;
+ __u32 lch_remote_timeout_count;
+ __u32 lch_network_timeout_count;
+};
+
+struct lnet_counters {
+ struct lnet_counters_common lct_common;
+ 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
* defined here because it is used in LNet data structures that are
* common to all LNDs.
*/
-#define LNET_NUM_INTERFACES 16
+#define LNET_INTERFACES_NUM 16
+
+/* The minimum number of interfaces per node supported by LNet. */
+#define LNET_INTERFACES_MIN 16
+/* The default - arbitrary - value of the lnet_max_interfaces tunable. */
+#define LNET_INTERFACES_MAX_DEFAULT 200
/**
* Objects maintained by the LNet are accessed through handles. Handle types
*/
#define LNET_WIRE_HANDLE_COOKIE_NONE (-1)
-typedef struct lnet_handle_eq {
+struct lnet_handle_eq {
__u64 cookie;
-} lnet_handle_eq_t;
+};
/**
* Invalidate eq handle \a h.
return (LNET_WIRE_HANDLE_COOKIE_NONE == h.cookie);
}
-typedef struct lnet_handle_md {
+struct lnet_handle_md {
__u64 cookie;
-} lnet_handle_md_t;
+};
/**
* Invalidate md handle \a h.
return (LNET_WIRE_HANDLE_COOKIE_NONE == h.cookie);
}
-typedef struct lnet_handle_me {
+struct lnet_handle_me {
__u64 cookie;
-} lnet_handle_me_t;
+};
/**
* Global process ID.
*/
-typedef struct lnet_process_id {
+struct lnet_process_id {
/** node id */
lnet_nid_t nid;
/** process id */
lnet_pid_t pid;
-} lnet_process_id_t;
+};
/** @} lnet_addr */
/** \addtogroup lnet_me
* Specifies whether the match entry or memory descriptor should be unlinked
* automatically (LNET_UNLINK) or not (LNET_RETAIN).
*/
-typedef enum lnet_unlink {
+enum lnet_unlink {
LNET_RETAIN = 0,
LNET_UNLINK
-} lnet_unlink_t;
+};
/**
* Values of the type enum lnet_ins_pos are used to control where a new match
* LNET_INS_AFTER is used to insert the new entry after the current entry
* or after the last item in the list.
*/
-typedef enum lnet_ins_pos {
+enum lnet_ins_pos {
/** insert ME before current position or head of the list */
LNET_INS_BEFORE,
/** insert ME after current position or tail of the list */
LNET_INS_AFTER,
/** attach ME at tail of local CPU partition ME list */
LNET_INS_LOCAL
-} lnet_ins_pos;
+};
/** @} lnet_me */
* Defines the visible parts of a memory descriptor. Values of this type
* are used to initialize memory descriptors.
*/
-typedef struct lnet_md {
+struct lnet_md {
/**
* Specify the memory region associated with the memory descriptor.
* If the options field has:
* if the LNET_MD_BULK_HANDLE option is set.
*/
struct lnet_handle_md bulk_handle;
-} lnet_md_t;
+};
/* Max Transfer Unit (minimum supported everywhere).
* CAVEAT EMPTOR, with multinet (i.e. routers forwarding between networks)
#define LNET_MTU_BITS 20
#define LNET_MTU (1 << LNET_MTU_BITS)
-/** limit on the number of fragments in discontiguous MDs */
-#define LNET_MAX_IOV 256
-
/**
* Options for the MD structure. See struct lnet_md::options.
*/
/**
* Six types of events can be logged in an event queue.
*/
-typedef enum lnet_event_kind {
+enum lnet_event_kind {
/** An incoming GET operation has completed on the MD. */
LNET_EVENT_GET = 1,
/**
* \see LNetMDUnlink
*/
LNET_EVENT_UNLINK,
-} lnet_event_kind_t;
+};
#define LNET_SEQ_GT(a, b) (((signed long)((a) - (b))) > 0)
/**
* Information about an event on a MD.
*/
-typedef struct lnet_event {
+struct lnet_event {
/** The identifier (nid, pid) of the target. */
struct lnet_process_id target;
/** The identifier (nid, pid) of the initiator. */
*/
__u64 hdr_data;
/**
+ * The message type, to ensure a handler for LNET_EVENT_SEND can
+ * distinguish between LNET_MSG_GET and LNET_MSG_PUT.
+ */
+ __u32 msg_type;
+ /**
* Indicates the completion status of the operation. It's 0 for
* successful operations, otherwise it's an error code.
*/
* to each event.
*/
volatile unsigned long sequence;
-} lnet_event_t;
+};
/**
* Event queue handler function type.
* \see struct lnet_md::options for the discussion on LNET_MD_ACK_DISABLE
* by which acknowledgments can be disabled for a MD.
*/
-typedef enum lnet_ack_req {
+enum lnet_ack_req {
/** Request an acknowledgment */
LNET_ACK_REQ,
/** Request that no acknowledgment should be generated. */
LNET_NOACK_REQ
-} lnet_ack_req_t;
+};
/** @} lnet_data */
/** @} lnet */