7 * Library side headers that define the abstraction layer's
8 * responsibilities and interfaces
11 #include <portals/lib-types.h>
15 * Per interface portal table, access control table
16 * and NAL private data field;
21 * send: Sends a preformatted header and payload data to a
22 * specified remote process. The payload is scattered over 'niov'
23 * fragments described by iov, starting at 'offset' for 'mlen'
25 * NB the NAL may NOT overwrite iov.
26 * PTL_OK on success => NAL has committed to send and will call
27 * lib_finalize on completion
29 ptl_err_t (*cb_send) (nal_cb_t * nal, void *private, lib_msg_t * cookie,
30 ptl_hdr_t * hdr, int type, ptl_nid_t nid, ptl_pid_t pid,
31 unsigned int niov, struct iovec *iov,
32 size_t offset, size_t mlen);
34 /* as send, but with a set of page fragments (NULL if not supported) */
35 ptl_err_t (*cb_send_pages) (nal_cb_t * nal, void *private, lib_msg_t * cookie,
36 ptl_hdr_t * hdr, int type, ptl_nid_t nid, ptl_pid_t pid,
37 unsigned int niov, ptl_kiov_t *iov,
38 size_t offset, size_t mlen);
40 * recv: Receives an incoming message from a remote process. The
41 * payload is to be received into the scattered buffer of 'niov'
42 * fragments described by iov, starting at 'offset' for 'mlen'
43 * bytes. Payload bytes after 'mlen' up to 'rlen' are to be
45 * NB the NAL may NOT overwrite iov.
46 * PTL_OK on success => NAL has committed to receive and will call
47 * lib_finalize on completion
49 ptl_err_t (*cb_recv) (nal_cb_t * nal, void *private, lib_msg_t * cookie,
50 unsigned int niov, struct iovec *iov,
51 size_t offset, size_t mlen, size_t rlen);
53 /* as recv, but with a set of page fragments (NULL if not supported) */
54 ptl_err_t (*cb_recv_pages) (nal_cb_t * nal, void *private, lib_msg_t * cookie,
55 unsigned int niov, ptl_kiov_t *iov,
56 size_t offset, size_t mlen, size_t rlen);
58 * read: Reads a block of data from a specified user address
60 ptl_err_t (*cb_read) (nal_cb_t * nal, void *private, void *dst_addr,
61 user_ptr src_addr, size_t len);
64 * write: Writes a block of data into a specified user address
66 ptl_err_t (*cb_write) (nal_cb_t * nal, void *private, user_ptr dsr_addr,
67 void *src_addr, size_t len);
70 * callback: Calls an event callback
71 * NULL => lib calls eq's callback (if any) directly.
73 void (*cb_callback) (nal_cb_t * nal, void *private, lib_eq_t *eq,
77 * malloc: Acquire a block of memory in a system independent
80 void *(*cb_malloc) (nal_cb_t * nal, size_t len);
82 void (*cb_free) (nal_cb_t * nal, void *buf, size_t len);
85 * (un)map: Tell the NAL about some memory it will access.
86 * *addrkey passed to cb_unmap() is what cb_map() set it to.
87 * type of *iov depends on options.
88 * Set to NULL if not required.
90 ptl_err_t (*cb_map) (nal_cb_t * nal, unsigned int niov, struct iovec *iov,
92 void (*cb_unmap) (nal_cb_t * nal, unsigned int niov, struct iovec *iov,
95 /* as (un)map, but with a set of page fragments */
96 ptl_err_t (*cb_map_pages) (nal_cb_t * nal, unsigned int niov, ptl_kiov_t *iov,
98 void (*cb_unmap_pages) (nal_cb_t * nal, unsigned int niov, ptl_kiov_t *iov,
101 void (*cb_printf) (nal_cb_t * nal, const char *fmt, ...);
103 /* Turn interrupts off (begin of protected area) */
104 void (*cb_cli) (nal_cb_t * nal, unsigned long *flags);
106 /* Turn interrupts on (end of protected area) */
107 void (*cb_sti) (nal_cb_t * nal, unsigned long *flags);
110 * Calculate a network "distance" to given node
112 int (*cb_dist) (nal_cb_t * nal, ptl_nid_t nid, unsigned long *dist);