#ifndef __UAPI_LNET_TYPES_H__
#define __UAPI_LNET_TYPES_H__
+#include <linux/types.h>
#include <linux/string.h>
#include <asm/byteorder.h>
+#ifndef __KERNEL__
+#include <stdbool.h>
+#endif
/** \addtogroup lnet
* @{ */
return (nid >> 32) & 0xffffffff;
}
-static inline lnet_nid_t LNET_MKNID(__u32 net, __u32 addr)
-{
- return (((__u64)net) << 32) | addr;
-}
-
static inline __u32 LNET_NETNUM(__u32 net)
{
return net & 0xffff;
return (type << 16) | num;
}
+static inline lnet_nid_t LNET_MKNID(__u32 net, __u32 addr)
+{
+ return (((__u64)net) << 32) | addr;
+}
+
/** The lolnd NID (i.e. myself) */
#define LNET_NID_LO_0 LNET_MKNID(LNET_MKNET(LOLND, 0), 0)
#define LNET_NET_ANY LNET_NIDNET(LNET_NID_ANY)
-static inline int nid_is_nid4(const struct lnet_nid *nid)
+static inline bool nid_is_nid4(const struct lnet_nid *nid)
{
return NID_ADDR_BYTES(nid) == 4;
}
+/* check for address set */
+static inline bool nid_addr_is_set(const struct lnet_nid *nid)
+{
+ int i;
+
+ for (i = 0; i < NID_ADDR_BYTES(nid); i++)
+ if (nid->nid_addr[i])
+ return true;
+
+ return false;
+}
+
/* LOLND may not be defined yet, so we cannot use an inline */
#define nid_is_lo0(__nid) \
((__nid)->nid_type == LOLND && \
static inline __u32 LNET_NID_NET(const struct lnet_nid *nid)
{
- return LNET_MKNET(nid->nid_type, __be16_to_cpu(nid->nid_num));
+ if (LNET_NID_IS_ANY(nid))
+ return LNET_NET_ANY;
+ else
+ return LNET_MKNET(nid->nid_type, __be16_to_cpu(nid->nid_num));
}
static inline void lnet_nid4_to_nid(lnet_nid_t nid4, struct lnet_nid *nid)
{
if (nid4 == LNET_NID_ANY) {
- /* equal to setting to LNET_ANY_NID */
- memset(nid, 0xff, sizeof(*nid));
+ *nid = LNET_ANY_NID;
return;
}
/** \addtogroup lnet_md
* @{ */
+struct lnet_hdr_nid16 {
+ char _bytes[sizeof(struct lnet_hdr)];
+} __attribute__((packed));
+
/**
* Event queue handler function type.
*
#define LNET_MD_NO_TRACK_RESPONSE (1 << 11)
/** See struct lnet_md::options. */
#define LNET_MD_GNILND (1 << 12)
+/** Special page mapping handling */
+#define LNET_MD_GPU_ADDR (1 << 13)
/** Infinite threshold on MD operations. See struct lnet_md::threshold */
#define LNET_MD_THRESH_INF (-1)