📄 lib-types.h
字号:
/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- * vim:expandtab:shiftwidth=8:tabstop=8: * * p30/lib-types.h * * Types used by the library side routines that do not need to be * exposed to the user application */#ifndef __LNET_LIB_TYPES_H__#define __LNET_LIB_TYPES_H__#if defined(__linux__)#include <lnet/linux/lib-types.h>#elif defined(__APPLE__)#include <lnet/darwin/lib-types.h>#elif defined(__WINNT__)#include <lnet/winnt/lib-types.h>#else#error Unsupported Operating System#endif#include <libcfs/libcfs.h>#include <libcfs/list.h>#include <lnet/types.h>#define WIRE_ATTR __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). */typedef struct { __u64 wh_interface_cookie; __u64 wh_object_cookie;} WIRE_ATTR lnet_handle_wire_t;/* byte-flip insensitive! */#define LNET_WIRE_HANDLE_NONE \((const lnet_handle_wire_t) {.wh_interface_cookie = -1, .wh_object_cookie = -1})typedef enum { 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 * wire structs MUST be fixed size and the smaller types are placed at the * end. */typedef struct lnet_ack { lnet_handle_wire_t dst_wmd; __u64 match_bits; __u32 mlength;} WIRE_ATTR lnet_ack_t;typedef struct lnet_put { lnet_handle_wire_t ack_wmd; __u64 match_bits; __u64 hdr_data; __u32 ptl_index; __u32 offset;} WIRE_ATTR lnet_put_t;typedef struct lnet_get { lnet_handle_wire_t return_wmd; __u64 match_bits; __u32 ptl_index; __u32 src_offset; __u32 sink_length;} WIRE_ATTR lnet_get_t;typedef struct lnet_reply { lnet_handle_wire_t dst_wmd;} WIRE_ATTR lnet_reply_t;typedef struct lnet_hello { __u64 incarnation; __u32 type;} WIRE_ATTR lnet_hello_t;typedef struct { lnet_nid_t dest_nid; lnet_nid_t src_nid; lnet_pid_t dest_pid; lnet_pid_t src_pid; __u32 type; /* lnet_msg_type_t */ __u32 payload_length; /* payload data to follow */ /*<------__u64 aligned------->*/ union { lnet_ack_t ack; lnet_put_t put; lnet_get_t get; lnet_reply_t reply; lnet_hello_t hello; } msg;} WIRE_ATTR lnet_hdr_t;/* 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_t::msg. */typedef struct { __u32 magic; /* LNET_PROTO_TCP_MAGIC */ __u16 version_major; /* increment on incompatible change */ __u16 version_minor; /* increment on compatible change */} WIRE_ATTR lnet_magicversion_t;/* PROTO MAGIC for LNDs */#define LNET_PROTO_IB_MAGIC 0x0be91b91#define LNET_PROTO_OPENIB_MAGIC LNET_PROTO_IB_MAGIC#define LNET_PROTO_IIB_MAGIC LNET_PROTO_IB_MAGIC#define LNET_PROTO_VIB_MAGIC LNET_PROTO_IB_MAGIC#define LNET_PROTO_RA_MAGIC 0x0be91b92#define LNET_PROTO_QSW_MAGIC 0x0be91b93#define LNET_PROTO_TCP_MAGIC 0xeebc0ded#define LNET_PROTO_PTL_MAGIC 0x50746C4E /* 'PtlN' unique magic */#define LNET_PROTO_GM_MAGIC 0x6d797269 /* 'myri'! */#define LNET_PROTO_MX_MAGIC 0x4d583130 /* 'MX10'! */#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 */typedef struct { __u32 acr_magic; /* PTL_ACCEPTOR_PROTO_MAGIC */ __u32 acr_version; /* protocol version */ __u64 acr_nid; /* target NID */} WIRE_ATTR lnet_acceptor_connreq_t;#define LNET_PROTO_ACCEPTOR_VERSION 1/* forward refs */struct lnet_libmd;typedef struct lnet_msg { struct list_head msg_activelist; struct list_head msg_list; /* Q for credits/MD */ lnet_process_id_t msg_target; __u32 msg_type; unsigned int msg_target_is_router:1; /* sending to a router */ unsigned int msg_routing:1; /* being forwarded */ unsigned int msg_ack:1; /* ack on finalize (PUT) */ unsigned int msg_sending:1; /* outgoing message */ unsigned int msg_receiving:1; /* being received */ unsigned int msg_delayed:1; /* had to Q for buffer or tx credit */ unsigned int msg_txcredit:1; /* taken an NI send credit */ unsigned int msg_peertxcredit:1; /* taken a peer send credit */ unsigned int msg_rtrcredit:1; /* taken a globel router credit */ unsigned int msg_peerrtrcredit:1; /* taken a peer router credit */ unsigned int msg_onactivelist:1; /* on the activelist */ struct lnet_peer *msg_txpeer; /* peer I'm sending to */ struct lnet_peer *msg_rxpeer; /* peer I received from */ void *msg_private; struct lnet_libmd *msg_md; unsigned int msg_len; unsigned int msg_wanted; unsigned int msg_offset; unsigned int msg_niov; struct iovec *msg_iov; lnet_kiov_t *msg_kiov; lnet_event_t msg_ev; lnet_hdr_t msg_hdr;} lnet_msg_t;typedef struct lnet_libhandle { struct list_head lh_hash_chain; __u64 lh_cookie;} lnet_libhandle_t;#define lh_entry(ptr, type, member) \ ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))typedef struct lnet_eq { struct list_head eq_list; lnet_libhandle_t eq_lh; lnet_seq_t eq_enq_seq; lnet_seq_t eq_deq_seq; unsigned int eq_size; lnet_event_t *eq_events; int eq_refcount; lnet_eq_handler_t eq_callback;} lnet_eq_t;typedef struct lnet_me { struct list_head me_list; lnet_libhandle_t me_lh; lnet_process_id_t me_match_id; unsigned int me_portal; __u64 me_match_bits; __u64 me_ignore_bits; lnet_unlink_t me_unlink; struct lnet_libmd *me_md;} lnet_me_t;typedef struct lnet_libmd { struct list_head md_list; lnet_libhandle_t md_lh; lnet_me_t *md_me; char *md_start; unsigned int md_offset; unsigned int md_length; unsigned int md_max_size; int md_threshold; int md_refcount; unsigned int md_options; unsigned int md_flags; void *md_user_ptr; lnet_eq_t *md_eq; void *md_addrkey; unsigned int md_niov; /* # frags */ union { struct iovec iov[LNET_MAX_IOV]; lnet_kiov_t kiov[LNET_MAX_IOV]; } md_iov;} lnet_libmd_t;#define LNET_MD_FLAG_ZOMBIE (1 << 0)#define LNET_MD_FLAG_AUTO_UNLINK (1 << 1)#ifdef LNET_USE_LIB_FREELISTtypedef struct{ void *fl_objs; /* single contiguous array of objects */ int fl_nobjs; /* the number of them */ int fl_objsize; /* the size (including overhead) of each of them */ struct list_head fl_list; /* where they are enqueued */} lnet_freelist_t;typedef struct{ struct list_head fo_list; /* enqueue on fl_list */ void *fo_contents; /* aligned contents */} lnet_freeobj_t;#endiftypedef struct { /* info about peers we are trying to fail */ struct list_head tp_list; /* ln_test_peers */ lnet_nid_t tp_nid; /* matching nid */ unsigned int tp_threshold; /* # failures to simulate */} lnet_test_peer_t;#define LNET_COOKIE_TYPE_MD 1#define LNET_COOKIE_TYPE_ME 2#define LNET_COOKIE_TYPE_EQ 3#define LNET_COOKIE_TYPES 4/* LNET_COOKIE_TYPES must be a power of 2, so the cookie type can be * extracted by masking with (LNET_COOKIE_TYPES - 1) */struct lnet_ni; /* forward ref */typedef struct lnet_lnd{ /* fields managed by portals */ struct list_head lnd_list; /* stash in the LND table */ int lnd_refcount; /* # active instances */ /* fields initialised by the LND */ unsigned int lnd_type;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -