Whamcloud - gitweb
add some real userspace definitions for CDEBUG et al
[fs/lustre-release.git] / lnet / include / lnet / nal.h
1 #ifndef _NAL_H_
2 #define _NAL_H_
3
4 #include "build_check.h"
5
6 /*
7  * p30/nal.h
8  *
9  * The API side NAL declarations
10  */
11
12 #include <portals/types.h>
13
14 typedef struct nal_t nal_t;
15
16 struct nal_t {
17         /* common interface state */
18         int              nal_refct;
19         ptl_handle_ni_t  nal_handle;
20
21         /* NAL-private data */
22         void            *nal_data;
23
24         /* NAL API implementation 
25          * NB only nal_ni_init needs to be set when the NAL registers itself */
26         int (*nal_ni_init) (nal_t *nal, ptl_pid_t requested_pid,
27                             ptl_ni_limits_t *req, ptl_ni_limits_t *actual);
28         
29         void (*nal_ni_fini) (nal_t *nal);
30
31         int (*nal_get_id) (nal_t *nal, ptl_process_id_t *id);
32         int (*nal_ni_status) (nal_t *nal, ptl_sr_index_t register, ptl_sr_value_t *status);
33         int (*nal_ni_dist) (nal_t *nal, ptl_process_id_t *id, unsigned long *distance);
34         int (*nal_fail_nid) (nal_t *nal, ptl_nid_t nid, unsigned int threshold);
35         int (*nal_loopback) (nal_t *nal, int set, int *enabled);
36
37         int (*nal_me_attach) (nal_t *nal, ptl_pt_index_t portal,
38                               ptl_process_id_t match_id, 
39                               ptl_match_bits_t match_bits, ptl_match_bits_t ignore_bits,
40                               ptl_unlink_t unlink, ptl_ins_pos_t pos, 
41                               ptl_handle_me_t *handle);
42         int (*nal_me_insert) (nal_t *nal, ptl_handle_me_t *me,
43                               ptl_process_id_t match_id, 
44                               ptl_match_bits_t match_bits, ptl_match_bits_t ignore_bits,
45                               ptl_unlink_t unlink, ptl_ins_pos_t pos, 
46                               ptl_handle_me_t *handle);
47         int (*nal_me_unlink) (nal_t *nal, ptl_handle_me_t *me);
48         
49         int (*nal_md_attach) (nal_t *nal, ptl_handle_me_t *me,
50                               ptl_md_t *md, ptl_unlink_t unlink, 
51                               ptl_handle_md_t *handle);
52         int (*nal_md_bind) (nal_t *nal, 
53                             ptl_md_t *md, ptl_unlink_t unlink, 
54                             ptl_handle_md_t *handle);
55         int (*nal_md_unlink) (nal_t *nal, ptl_handle_md_t *md);
56         int (*nal_md_update) (nal_t *nal, ptl_handle_md_t *md,
57                               ptl_md_t *old_md, ptl_md_t *new_md,
58                               ptl_handle_eq_t *testq);
59
60         int (*nal_eq_alloc) (nal_t *nal, ptl_size_t count,
61                              ptl_eq_handler_t handler,
62                              ptl_handle_eq_t *handle);
63         int (*nal_eq_free) (nal_t *nal, ptl_handle_eq_t *eq);
64         int (*nal_eq_poll) (nal_t *nal, 
65                             ptl_handle_eq_t *eqs, int neqs, int timeout,
66                             ptl_event_t *event, int *which);
67
68         int (*nal_ace_entry) (nal_t *nal, ptl_ac_index_t index,
69                               ptl_process_id_t match_id, ptl_pt_index_t portal);
70         
71         int (*nal_put) (nal_t *nal, ptl_handle_md_t *md, ptl_ack_req_t ack,
72                         ptl_process_id_t *target, ptl_pt_index_t portal,
73                         ptl_ac_index_t ac, ptl_match_bits_t match,
74                         ptl_size_t offset, ptl_hdr_data_t hdr_data);
75         int (*nal_get) (nal_t *nal, ptl_handle_md_t *md,
76                         ptl_process_id_t *target, ptl_pt_index_t portal,
77                         ptl_ac_index_t ac, ptl_match_bits_t match,
78                         ptl_size_t offset);
79 };
80
81 extern nal_t *ptl_hndl2nal(ptl_handle_any_t *any);
82
83 #ifdef __KERNEL__
84 extern int ptl_register_nal(ptl_interface_t interface, nal_t *nal);
85 extern void ptl_unregister_nal(ptl_interface_t interface);
86 #endif
87
88 #endif