4 #include "build_check.h"
8 * Library side headers that define the abstraction layer's
9 * responsibilities and interfaces
12 #include <portals/lib-types.h>
16 * Per interface portal table, access control table
17 * and NAL private data field;
22 * send: Sends a preformatted header and payload data to a
23 * specified remote process. The payload is scattered over 'niov'
24 * fragments described by iov, starting at 'offset' for 'mlen'
26 * NB the NAL may NOT overwrite iov.
27 * PTL_OK on success => NAL has committed to send and will call
28 * lib_finalize on completion
30 ptl_err_t (*cb_send) (nal_cb_t * nal, void *private, lib_msg_t * cookie,
31 ptl_hdr_t * hdr, int type, ptl_nid_t nid, ptl_pid_t pid,
32 unsigned int niov, struct iovec *iov,
33 size_t offset, size_t mlen);
35 /* as send, but with a set of page fragments (NULL if not supported) */
36 ptl_err_t (*cb_send_pages) (nal_cb_t * nal, void *private, lib_msg_t * cookie,
37 ptl_hdr_t * hdr, int type, ptl_nid_t nid, ptl_pid_t pid,
38 unsigned int niov, ptl_kiov_t *iov,
39 size_t offset, size_t mlen);
41 * recv: Receives an incoming message from a remote process. The
42 * payload is to be received into the scattered buffer of 'niov'
43 * fragments described by iov, starting at 'offset' for 'mlen'
44 * bytes. Payload bytes after 'mlen' up to 'rlen' are to be
46 * NB the NAL may NOT overwrite iov.
47 * PTL_OK on success => NAL has committed to receive and will call
48 * lib_finalize on completion
50 ptl_err_t (*cb_recv) (nal_cb_t * nal, void *private, lib_msg_t * cookie,
51 unsigned int niov, struct iovec *iov,
52 size_t offset, size_t mlen, size_t rlen);
54 /* as recv, but with a set of page fragments (NULL if not supported) */
55 ptl_err_t (*cb_recv_pages) (nal_cb_t * nal, void *private, lib_msg_t * cookie,
56 unsigned int niov, ptl_kiov_t *iov,
57 size_t offset, size_t mlen, size_t rlen);
59 * read: Reads a block of data from a specified user address
61 ptl_err_t (*cb_read) (nal_cb_t * nal, void *private, void *dst_addr,
62 user_ptr src_addr, size_t len);
65 * write: Writes a block of data into a specified user address
67 ptl_err_t (*cb_write) (nal_cb_t * nal, void *private, user_ptr dsr_addr,
68 void *src_addr, size_t len);
71 * callback: Calls an event callback
72 * NULL => lib calls eq's callback (if any) directly.
74 void (*cb_callback) (nal_cb_t * nal, void *private, lib_eq_t *eq,
78 * malloc: Acquire a block of memory in a system independent
81 void *(*cb_malloc) (nal_cb_t * nal, size_t len);
83 void (*cb_free) (nal_cb_t * nal, void *buf, size_t len);
86 * (un)map: Tell the NAL about some memory it will access.
87 * *addrkey passed to cb_unmap() is what cb_map() set it to.
88 * type of *iov depends on options.
89 * Set to NULL if not required.
91 ptl_err_t (*cb_map) (nal_cb_t * nal, unsigned int niov, struct iovec *iov,
93 void (*cb_unmap) (nal_cb_t * nal, unsigned int niov, struct iovec *iov,
96 /* as (un)map, but with a set of page fragments */
97 ptl_err_t (*cb_map_pages) (nal_cb_t * nal, unsigned int niov, ptl_kiov_t *iov,
99 void (*cb_unmap_pages) (nal_cb_t * nal, unsigned int niov, ptl_kiov_t *iov,
102 void (*cb_printf) (nal_cb_t * nal, const char *fmt, ...);
104 /* Turn interrupts off (begin of protected area) */
105 void (*cb_cli) (nal_cb_t * nal, unsigned long *flags);
107 /* Turn interrupts on (end of protected area) */
108 void (*cb_sti) (nal_cb_t * nal, unsigned long *flags);
111 * Calculate a network "distance" to given node
113 int (*cb_dist) (nal_cb_t * nal, ptl_nid_t nid, unsigned long *dist);