photon  1.1
photon_buffer_internal.h
Go to the documentation of this file.
1 // =============================================================================
2 // Photon RDMA Library (libphoton)
3 //
4 // Copyright (c) 2016, Trustees of Indiana University,
5 // All rights reserved.
6 //
7 // This software may be modified and distributed under the terms of the BSD
8 // license. See the COPYING file for details.
9 //
10 // This software was created at the Indiana University Center for Research in
11 // Extreme Scale Technologies (CREST).
12 // =============================================================================
13 
14 #ifndef PHOTON_BUFFER_INTERNAL_H
15 #define PHOTON_BUFFER_INTERNAL_H
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 #include <stdint.h>
22 #include "config.h"
23 #include "photon.h"
24 
25 #define BUFFER_IFACES_MAX 16
26 
27 #define BUFFER_FLAG_NIL 0x0000
28 #define BUFFER_FLAG_NOTIFY (1<<1)
29 
30 struct photon_acct_t {
31  volatile uint64_t rcur;
32  uint32_t rloc;
33  uint32_t event_prefix;
34 };
35 
36 typedef struct photon_buffer_internal_t {
37  struct photon_buffer_t buf;
38  // keep a reference to the registered mem handle
39  void *priv_ptr;
40  int priv_size;
42 
44  int (*buffer_create)(photon_buffer_internal *bint, int flags);
45  void (*buffer_free)(photon_buffer_internal *bint);
46  int (*buffer_register)(photon_buffer_internal *bint, int flags);
47  int (*buffer_unregister)(photon_buffer_internal *bint);
48 };
49 
50 typedef struct photon_buffer_handle_t {
51  struct photon_buffer_internal_t bint;
52  uint16_t is_registered;
53  uint16_t ref_count;
54  uint32_t iface_count;
57 
58 typedef struct photon_buffer_internal_t * photonBI;
59 typedef struct photon_buffer_interface_t * photonBufferInterface;
60 typedef struct photon_buffer_handle_t * photonBufferHandle;
61 
62 // internal buffer API
63 int photon_buffer_init(photonBufferInterface bi);
64 photonBufferHandle photon_buffer_create(void *addr, uint64_t size, int flags);
65 void photon_buffer_free(photonBufferHandle buf);
66 int photon_buffer_register(photonBufferHandle buf, int flags);
67 int photon_buffer_unregister(photonBufferHandle buf);
68 
69 #ifdef __cplusplus
70 }
71 #endif
72 
73 #endif
volatile uint64_t rcur
Convenience pointer type for the buffer structure.
Definition: photon.h:105
photonBufferHandle photon_buffer_create(void *addr, uint64_t size, int flags)
struct photon_buffer_handle_t * photonBufferHandle
struct photon_buffer_interface_t ** ifaces
int photon_buffer_register(photonBufferHandle buf, int flags)
int photon_buffer_init(photonBufferInterface bi)
Constants and macros for interacting with the library. Only this header is needed to use the Photon A...
int photon_buffer_unregister(photonBufferHandle buf)
void photon_buffer_free(photonBufferHandle buf)
struct photon_buffer_internal_t * photonBI