-
Notifications
You must be signed in to change notification settings - Fork 29
/
ptl.h
222 lines (186 loc) · 7.17 KB
/
ptl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
/*
This file is provided under a dual BSD/GPLv2 license. When using or
redistributing this file, you may do so under either license.
GPL LICENSE SUMMARY
Copyright(c) 2015 Intel Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of version 2 of the GNU General Public License as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
Contact Information:
Intel Corporation, www.intel.com
BSD LICENSE
Copyright(c) 2015 Intel Corporation.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of Intel Corporation nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* Copyright (c) 2003-2014 Intel Corporation. All rights reserved. */
/* Interface implemented by Packet Transport layers such as
* ips and active messages.
*
* This interface can be volatile, it is never seen by PSM clients, and it will
* probably change as the AM ptl is developed.
*/
#ifndef PSM_PTL_H
#define PSM_PTL_H
#include <inttypes.h>
#include <psm2.h>
#include <psm2_mq.h>
#include <psm2_am.h>
/* We currently have 3 PTLs, 0 is reserved. */
#define PTL_DEVID_IPS 1
#define PTL_DEVID_AMSH 2
#define PTL_DEVID_SELF 3
/* We can currently initialize up to 3 PTLs */
#define PTL_MAX_INIT 3
/* struct ptl is an incomplete type, and it serves as a generic or opaque
container. It should remain an incomplete type in the entire psm
source base. concrete ptl types need to have a suffix such as ptl_self,
ptl_ips. */
struct ptl;
typedef struct ptl ptl_t;
struct ptl_ctl;
typedef struct ptl_ctl ptl_ctl_t;
struct ptl_mq_req;
typedef struct ptl_mq_req ptl_mq_req_t;
struct ips_proto;
typedef struct ips_proto ips_proto_t;
/* To be filled in statically by all PTLs */
struct ptl_ctl_init {
size_t(*sizeof_ptl) (void);
psm2_error_t(*init) (const psm2_ep_t ep, ptl_t *ptl, ptl_ctl_t *ctl);
psm2_error_t(*fini) (ptl_t *ptl, int force, uint64_t timeout_ns);
psm2_error_t
(*setopt) (const void *component_obj, int optname,
const void *optval, uint64_t optlen);
psm2_error_t
(*getopt) (const void *component_obj, int optname,
void *optval, uint64_t *optlen);
};
struct ptl_ctl_rcvthread {
uint32_t(*is_enabled) (const ptl_t *ptl);
void(*transfer_ownership) (ptl_t *from_ptl, ptl_t *to_ptl);
};
typedef
struct ptl_arg {
union {
struct {
uint16_t u16w3;
uint16_t u16w2;
uint16_t u16w1;
uint16_t u16w0;
};
struct {
uint32_t u32w1;
uint32_t u32w0;
};
uint64_t u64w0;
uint64_t u64;
void *uptr;
};
} ptl_arg_t;
#include "ptl_self/ptl_fwd.h"
#include "ptl_ips/ptl_fwd.h"
#include "ptl_am/ptl_fwd.h"
/* To be filled in as part of ptl_init */
struct ptl_ctl {
ptl_t *ptl; /* pointer to ptl */
psm2_ep_t ep; /* pointer to ep */
/* EP-specific stuff */
psm2_error_t(*ep_poll) (ptl_t *ptl, int replyonly);
/* PTL-level connect
*
* This PTL-level is slightly different from the top-level PSM connect.
*
* pre 1: Caller has masked off epids in epid array that are already
* connected at the PSM level.
*
* post 0: PTL has allocate all epaddrs and whatever internal ptladdr
* that ptl needs.
* post 1: PTL marks error[i] as UNREACHABLE if PTL can't get to epid[i]
* post 2: PTL marks error[i] as UNKNOWN for all epid[i] that couldn't
* be connected before a timeout occurred.
* post 3: PTL returns OK if all epids are either OK or UNREACHABLE
* post 4: PTL defines content or epaddr[i] only if epaddr[i] is OK.
*/
psm2_error_t(*ep_connect) (ptl_t *ptl,
int num_ep,
const psm2_epid_t input_array_of_epid[],
const int array_of_epid_mask[],
psm2_error_t output_array_of_errors[],
psm2_epaddr_t output_array_of_epddr[],
uint64_t timeout_ns);
psm2_error_t (*ep_disconnect)(ptl_t *ptl,
int force,
int num_ep,
psm2_epaddr_t input_array_of_epaddr[],
const int array_of_epaddr_mask[],
psm2_error_t output_array_of_errors[],
uint64_t timeout_ns);
/* MQ stuff */
psm2_error_t(*mq_send) (psm2_mq_t mq, psm2_epaddr_t dest,
uint32_t flags, psm2_mq_tag_t *stag,
const void *buf, uint32_t len);
psm2_error_t(*mq_isend) (psm2_mq_t mq, psm2_epaddr_t dest,
uint32_t flags_user, uint32_t flags_internal,
psm2_mq_tag_t *stag, const void *buf,
uint32_t len, void *ctxt, psm2_mq_req_t *req);
int (*epaddr_stats_num) (void);
int (*epaddr_stats_init) (char *desc[], uint16_t *flags);
int (*epaddr_stats_get) (psm2_epaddr_t epaddr, uint64_t *stats);
/* AM stuff */
psm2_error_t(*am_get_parameters) (psm2_ep_t ep,
struct psm2_am_parameters *
parameters);
psm2_error_t(*am_short_request) (psm2_epaddr_t epaddr,
psm2_handler_t handler,
psm2_amarg_t *args, int nargs,
void *src, size_t len, int flags,
psm2_am_completion_fn_t completion_fn,
void *completion_ctxt);
psm2_error_t(*am_short_reply) (psm2_am_token_t token,
psm2_handler_t handler,
psm2_amarg_t *args, int nargs, void *src,
size_t len, int flags,
psm2_am_completion_fn_t completion_fn,
void *completion_ctxt);
/* Long messages currently unsupported */
#if 0
psm2_error_t(*am_long_request) (psm2_epaddr_t epaddr,
psm2_handler_t handler,
psm2_amarg_t *args, int nargs,
void *src, size_t len, void *dest,
int flags);
psm2_error_t(*am_long_reply) (psm2_am_token_t token,
psm2_handler_t handler, psm2_amarg_t *args,
int nargs, void *src, size_t len,
void *dest, int flags);
#endif
psm2_error_t (*msg_size_thresh_query) (enum psm2_info_query_thresh_et,
uint32_t *out, psm2_mq_t mq, psm2_epaddr_t);
};
#endif