/usr/include/infiniband/complib/cl_event_wheel.h is in libopensm-dev 3.3.20-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 | /*
* Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
* Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
* Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* OpenIB.org BSD license below:
*
* 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.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
/*
* Abstract:
* Declaration of event wheel abstraction.
*/
#ifndef _CL_EVENT_WHEEL_H_
#define _CL_EVENT_WHEEL_H_
#include <complib/cl_atomic.h>
#include <complib/cl_qlist.h>
#include <complib/cl_qmap.h>
#include <complib/cl_timer.h>
#include <complib/cl_spinlock.h>
#ifdef __cplusplus
# define BEGIN_C_DECLS extern "C" {
# define END_C_DECLS }
#else /* !__cplusplus */
# define BEGIN_C_DECLS
# define END_C_DECLS
#endif /* __cplusplus */
BEGIN_C_DECLS
/****h* Component Library/Event_Wheel
* NAME
* Event_Wheel
*
* DESCRIPTION
* The Event_Wheel provides a facility for registering delayed events
* and getting called once they timeout.
*
* The Event_Wheel functions operate on a cl_event_wheel_t structure
* which should be treated as opaque and should be manipulated
* only through the provided functions.
*
* SEE ALSO
* Structures:
* cl_event_wheel_t
*
* Initialization/Destruction:
* cl_event_wheel_construct, cl_event_wheel_init, cl_event_wheel_destroy
*
* Manipulation:
* cl_event_wheel_reg, cl_event_wheel_unreg
*
*********/
/****f* Component Library: Event_Wheel/cl_pfn_event_aged_cb_t
* NAME
* cl_pfn_event_aged_cb_t
*
* DESCRIPTION
* This typedef defines the prototype for client functions invoked
* by the Event_Wheel. The Event_Wheel calls the corresponding
* client function when the specific item has aged.
*
* SYNOPSIS
*/
typedef uint64_t
(*cl_pfn_event_aged_cb_t) (IN uint64_t key,
IN uint32_t num_regs, IN void *context);
/*
* PARAMETERS
* key
* [in] The key used for registering the item in the call to
* cl_event_wheel_reg.
*
* num_regs
* [in] The number of times this event was registered (pushed in time).
*
* context
* [in] Client specific context specified in a call to
* cl_event_wheel_reg
*
* RETURN VALUE
* This function returns the abosolute time the event should fire in [usec].
* If lower then current time means the event should be unregistered
* immediatly.
*
* NOTES
* This typedef provides a function prototype reference for
* the function provided by Event_Wheel clients as a parameter
* to the cl_event_wheel_reg function.
*
* SEE ALSO
* Event_Wheel, cl_event_wheel_reg
*********/
/****s* Component Library: Event_Wheel/cl_event_wheel_t
* NAME
* cl_event_wheel_t
*
* DESCRIPTION
* Event_Wheel structure.
*
* The Event_Wheel is thread safe.
*
* The cl_event_wheel_t structure should be treated as opaque and should
* be manipulated only through the provided functions.
*
* SYNOPSIS
*/
typedef struct _cl_event_wheel {
cl_spinlock_t lock;
cl_spinlock_t *p_external_lock;
cl_qmap_t events_map;
boolean_t closing;
cl_qlist_t events_wheel;
cl_timer_t timer;
} cl_event_wheel_t;
/*
* FIELDS
* lock
* Spinlock to guard internal structures.
*
* p_external_lock
* Reference to external spinlock to guard internal structures
* if the event wheel is part of a larger object protected by its own lock
*
* events_map
* A Map holding all registered event items by their key.
*
* closing
* A flag indicating the event wheel is closing. This means that
* callbacks that are called when closing == TRUE should just be ignored.
*
* events_wheel
* A list of the events sorted by expiration time.
*
* timer
* The timer scheduling event time propagation.
*
* SEE ALSO
* Event_Wheel
*********/
/****s* Component Library: Event_Wheel/cl_event_wheel_reg_info_t
* NAME
* cl_event_wheel_reg_info_t
*
* DESCRIPTION
* Defines the event_wheel registration object structure.
*
* The cl_event_wheel_reg_info_t structure is for internal use by the
* Event_Wheel only.
*
* SYNOPSIS
*/
typedef struct _cl_event_wheel_reg_info {
cl_map_item_t map_item;
cl_list_item_t list_item;
uint64_t key;
cl_pfn_event_aged_cb_t pfn_aged_callback;
uint64_t aging_time;
uint32_t num_regs;
void *context;
cl_event_wheel_t *p_event_wheel;
} cl_event_wheel_reg_info_t;
/*
* FIELDS
* map_item
* The map item of this event
*
* list_item
* The sorted by aging time list item
*
* key
* The key by which one can find the event
*
* pfn_aged_callback
* The clients Event-Aged callback
*
* aging_time
* The delta time [msec] for which the event should age.
*
* num_regs
* The number of times the same event (key) was registered
*
* context
* Client's context for event-aged callback.
*
* p_event_wheel
* Pointer to this event wheel object
*
* SEE ALSO
*********/
/****f* Component Library: Event_Wheel/cl_event_wheel_construct
* NAME
* cl_event_wheel_construct
*
* DESCRIPTION
* This function constructs a Event_Wheel object.
*
* SYNOPSIS
*/
void cl_event_wheel_construct(IN cl_event_wheel_t * const p_event_wheel);
/*
* PARAMETERS
* p_event_wheel
* [in] Pointer to a Event_Wheel.
*
* RETURN VALUE
* This function does not return a value.
*
* NOTES
* Allows calling cl_event_wheel_init and cl_event_wheel_destroy.
*
* SEE ALSO
* Event_Wheel, cl_event_wheel_init, cl_event_wheel_destroy
*********/
/****f* Component Library: Event_Wheel/cl_event_wheel_init
* NAME
* cl_event_wheel_init
*
* DESCRIPTION
* This function initializes a Event_Wheel object.
*
* SYNOPSIS
*/
cl_status_t
cl_event_wheel_init(IN cl_event_wheel_t * const p_event_wheel);
/*
* PARAMETERS
* p_event_wheel
* [in] Pointer to a Event_Wheel.
*
* RETURN VALUE
* CL_SUCCESS if the operation is successful.
*
* SEE ALSO
* Event_Wheel, cl_event_wheel_destoy, cl_event_wheel_reg, cl_event_wheel_unreg
*
*********/
/****f* Component Library: Event_Wheel/cl_event_wheel_init
* NAME
* cl_event_wheel_init
*
* DESCRIPTION
* This function initializes a Event_Wheel object.
*
* SYNOPSIS
*/
cl_status_t
cl_event_wheel_init_ex(IN cl_event_wheel_t * const p_event_wheel,
IN cl_spinlock_t * p_external_lock);
/*
* PARAMETERS
* p_event_wheel
* [in] Pointer to a Event_Wheel.
*
* p_external_lock
* [in] Reference to external spinlock to guard internal structures
* if the event wheel is part of a larger object protected by its own lock
*
* RETURN VALUE
* CL_SUCCESS if the operation is successful.
*
* SEE ALSO
* Event_Wheel, cl_event_wheel_destoy, cl_event_wheel_reg, cl_event_wheel_unreg
*
*********/
/****f* Component Library: Event_Wheel/cl_event_wheel_destroy
* NAME
* cl_event_wheel_destroy
*
* DESCRIPTION
* This function destroys a Event_Wheel object.
*
* SYNOPSIS
*/
void cl_event_wheel_destroy(IN cl_event_wheel_t * const p_event_wheel);
/*
* PARAMETERS
* p_event_wheel
* [in] Pointer to a Event_Wheel.
*
* RETURN VALUE
* This function does not return a value.
*
* NOTES
* This function does not returns until all client callback functions
* been successfully finished.
*
* SEE ALSO
* Event_Wheel, cl_event_wheel_construct, cl_event_wheel_init
*********/
/****f* Component Library: Event_Wheel/cl_event_wheel_dump
* NAME
* cl_event_wheel_dump
*
* DESCRIPTION
* This function dumps the details of an Event_Whell object.
*
* SYNOPSIS
*/
void cl_event_wheel_dump(IN cl_event_wheel_t * const p_event_wheel);
/*
* PARAMETERS
* p_event_wheel
* [in] Pointer to a Event_Wheel.
*
* RETURN VALUE
* This function does not return a value.
*
* NOTES
* Note that this function should be called inside a lock of the event wheel!
* It doesn't aquire the lock by itself.
*
* SEE ALSO
* Event_Wheel, cl_event_wheel_construct, cl_event_wheel_init
*********/
/****f* Component Library: Event_Wheel/cl_event_wheel_reg
* NAME
* cl_event_wheel_reg
*
* DESCRIPTION
* This function registers a client with a Event_Wheel object.
*
* SYNOPSIS
*/
cl_status_t
cl_event_wheel_reg(IN cl_event_wheel_t * const p_event_wheel,
IN const uint64_t key,
IN const uint64_t aging_time_usec,
IN cl_pfn_event_aged_cb_t pfn_callback,
IN void *const context);
/*
* PARAMETERS
* p_event_wheel
* [in] Pointer to a Event_Wheel.
*
* key
* [in] The specifc Key by which events are registered.
*
* aging_time_usec
* [in] The absolute time this event should age in usec
*
* pfn_callback
* [in] Event Aging callback. The Event_Wheel calls this
* function after the time the event has registed for has come.
*
* context
* [in] Client context value passed to the cl_pfn_event_aged_cb_t
* function.
*
* RETURN VALUE
* On success a Event_Wheel CL_SUCCESS or CL_ERROR otherwise.
*
* SEE ALSO
* Event_Wheel, cl_event_wheel_unreg
*********/
/****f* Component Library: Event_Wheel/cl_event_wheel_unreg
* NAME
* cl_event_wheel_unreg
*
* DESCRIPTION
* This function unregisters a client event from a Event_Wheel.
*
* SYNOPSIS
*/
void
cl_event_wheel_unreg(IN cl_event_wheel_t * const p_event_wheel,
IN uint64_t key);
/*
* PARAMETERS
* p_event_wheel
* [in] Pointer to a Event_Wheel.
*
* key
* [in] The key used for registering the event
*
* RETURN VALUE
* This function does not return a value.
*
* NOTES
* After the event has aged it is automatically removed from
* the event wheel. So it should only be invoked when the need arises
* to remove existing events before they age.
*
* SEE ALSO
* Event_Wheel, cl_event_wheel_reg
*********/
/****f* Component Library: Event_Wheel/cl_event_wheel_num_regs
* NAME
* cl_event_wheel_num_regs
*
* DESCRIPTION
* This function returns the number of times an event was registered.
*
* SYNOPSIS
*/
uint32_t
cl_event_wheel_num_regs(IN cl_event_wheel_t * const p_event_wheel,
IN uint64_t key);
/*
* PARAMETERS
* p_event_wheel
* [in] Pointer to a Event_Wheel.
*
* key
* [in] The key used for registering the event
*
* RETURN VALUE
* The number of times the event was registered.
* 0 if never registered or eventually aged.
*
* SEE ALSO
* Event_Wheel, cl_event_wheel_reg, cl_event_wheel_unreg
*********/
END_C_DECLS
#endif /* !defined(_CL_EVENT_WHEEL_H_) */
|