Whamcloud - gitweb
bf86569a72b6505d80fe433d6108bbb241d548df
[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
36         int (*nal_me_attach) (nal_t *nal, ptl_pt_index_t portal,
37                               ptl_process_id_t match_id, 
38                               ptl_match_bits_t match_bits, ptl_match_bits_t ignore_bits,
39                               ptl_unlink_t unlink, ptl_ins_pos_t pos, 
40                               ptl_handle_me_t *handle);
41         int (*nal_me_insert) (nal_t *nal, ptl_handle_me_t *me,
42                               ptl_process_id_t match_id, 
43                               ptl_match_bits_t match_bits, ptl_match_bits_t ignore_bits,
44                               ptl_unlink_t unlink, ptl_ins_pos_t pos, 
45                               ptl_handle_me_t *handle);
46         int (*nal_me_unlink) (nal_t *nal, ptl_handle_me_t *me);
47         
48         int (*nal_md_attach) (nal_t *nal, ptl_handle_me_t *me,
49                               ptl_md_t *md, ptl_unlink_t unlink, 
50                               ptl_handle_md_t *handle);
51         int (*nal_md_bind) (nal_t *nal, 
52                             ptl_md_t *md, ptl_unlink_t unlink, 
53                             ptl_handle_md_t *handle);
54         int (*nal_md_unlink) (nal_t *nal, ptl_handle_md_t *md);
55         int (*nal_md_update) (nal_t *nal, ptl_handle_md_t *md,
56                               ptl_md_t *old_md, ptl_md_t *new_md,
57                               ptl_handle_eq_t *testq);
58
59         int (*nal_eq_alloc) (nal_t *nal, ptl_size_t count,
60                              ptl_eq_handler_t handler,
61                              ptl_handle_eq_t *handle);
62         int (*nal_eq_free) (nal_t *nal, ptl_handle_eq_t *eq);
63         int (*nal_eq_poll) (nal_t *nal, 
64                             ptl_handle_eq_t *eqs, int neqs, int timeout,
65                             ptl_event_t *event, int *which);
66
67         int (*nal_ace_entry) (nal_t *nal, ptl_ac_index_t index,
68                               ptl_process_id_t match_id, ptl_pt_index_t portal);
69         
70         int (*nal_put) (nal_t *nal, ptl_handle_md_t *md, ptl_ack_req_t ack,
71                         ptl_process_id_t *target, ptl_pt_index_t portal,
72                         ptl_ac_index_t ac, ptl_match_bits_t match,
73                         ptl_size_t offset, ptl_hdr_data_t hdr_data);
74         int (*nal_get) (nal_t *nal, ptl_handle_md_t *md,
75                         ptl_process_id_t *target, ptl_pt_index_t portal,
76                         ptl_ac_index_t ac, ptl_match_bits_t match,
77                         ptl_size_t offset);
78 };
79
80 extern nal_t *ptl_hndl2nal(ptl_handle_any_t *any);
81
82 #ifdef __KERNEL__
83 extern int ptl_register_nal(ptl_interface_t interface, nal_t *nal);
84 extern void ptl_unregister_nal(ptl_interface_t interface);
85 #endif
86
87 #endif