#ifndef _LIB_TYPES_H_
#define _LIB_TYPES_H_
+#include "build_check.h"
+
#include <portals/types.h>
#ifdef __KERNEL__
# include <linux/uio.h>
} lib_counters_t;
/* temporary expedient: limit number of entries in discontiguous MDs */
-# define PTL_MTU (512<<10)
-# define PTL_MD_MAX_IOV 128
-# define PTL_MD_MAX_PAGES min_t(int, PTL_MD_MAX_IOV, PTL_MTU / PAGE_SIZE)
+#define PTL_MTU (512<<10)
+#define PTL_MD_MAX_IOV 128
struct lib_msg_t {
struct list_head msg_list;
ptl_size_t max_size;
int threshold;
int pending;
- ptl_unlink_t unlink;
unsigned int options;
unsigned int md_flags;
void *user_ptr;
} md_iov;
};
-#define PTL_MD_FLAG_UNLINK (1 << 0)
+#define PTL_MD_FLAG_ZOMBIE (1 << 0)
+#define PTL_MD_FLAG_AUTO_UNLINK (1 << 1)
+
+static inline int lib_md_exhausted (lib_md_t *md)
+{
+ return (md->threshold == 0 ||
+ ((md->options & PTL_MD_MAX_SIZE) != 0 &&
+ md->offset + md->max_size > md->length));
+}
#ifdef PTL_USE_LIB_FREELIST
typedef struct