NDN-DPDK
High-Speed Named Data Networking Forwarder
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
pcct.h
Go to the documentation of this file.
1 #ifndef NDNDPDK_PCCT_PCCT_H
2 #define NDNDPDK_PCCT_PCCT_H
3 
6 #include "cs-struct.h"
7 #include "pcc-entry.h"
8 #include "pit-struct.h"
9 
11 typedef struct Pcct {
12  struct rte_mempool* mp;
14  struct rte_hash* tokenHt;
15  uint64_t lastToken;
16 
18  Cs cs;
19 
20  uint32_t nKeyHtBuckets;
21 } Pcct;
22 
23 static __rte_always_inline Pcct*
24 Pcct_FromPit(const Pit* pit) {
25  return container_of(pit, Pcct, pit);
26 }
27 
28 static __rte_always_inline Pcct*
29 Pcct_FromCs(const Cs* cs) {
30  return container_of(cs, Pcct, cs);
31 }
32 
39 __attribute__((nonnull)) bool
40 Pcct_Init(Pcct* pcct, const char* id, uint32_t maxEntries, int numaSocket);
41 
46 __attribute__((nonnull)) void
47 Pcct_Clear(Pcct* pcct);
48 
54 __attribute__((nonnull)) PccEntry*
55 Pcct_Insert(Pcct* pcct, const PccSearch* search, bool* isNew);
56 
61 __attribute__((nonnull)) void
62 Pcct_Erase(Pcct* pcct, PccEntry* entry);
63 
68 __attribute__((nonnull)) uint64_t
69 Pcct_AddToken(Pcct* pcct, PccEntry* entry);
70 
72 __attribute__((nonnull)) void
73 Pcct_RemoveToken(Pcct* pcct, PccEntry* entry);
74 
79 __attribute__((nonnull)) PccEntry*
80 Pcct_FindByToken(const Pcct* pcct, uint64_t token);
81 
82 // Burst size of PCCT erasing.
83 #define PCCT_ERASE_BURST 32
84 
86 typedef struct PcctEraseBatch {
88  int nEntries;
91 
100 __attribute__((nonnull)) static inline PcctEraseBatch
101 PcctEraseBatch_New(Pcct* pcct) {
102  return (PcctEraseBatch){.pcct = pcct};
103 }
104 
105 __attribute__((nonnull)) void
107 
109 __attribute__((nonnull)) static inline void
110 PcctEraseBatch_Append(PcctEraseBatch* peb, PccEntry* entry) {
111  peb->objs[peb->nEntries] = entry;
112  if (unlikely(++peb->nEntries == PCCT_ERASE_BURST)) {
114  }
115 }
116 
118 __attribute__((nonnull)) static inline void
119 PcctEraseBatch_Finish(PcctEraseBatch* peb) {
120  if (likely(peb->nEntries > 0)) {
122  }
123  peb->pcct = NULL;
124 }
125 
126 #endif // NDNDPDK_PCCT_PCCT_H
@ PccKeyMaxExts
Definition: pcc-key.h:16
void Pcct_RemoveToken(Pcct *pcct, PccEntry *entry)
Clear the token on an entry.
Definition: pcct.c:163
struct PcctEraseBatch PcctEraseBatch
Context for erasing several PCC entries.
PccEntry * Pcct_Insert(Pcct *pcct, const PccSearch *search, bool *isNew)
Insert or find an entry.
Definition: pcct.c:88
bool Pcct_Init(Pcct *pcct, const char *id, uint32_t maxEntries, int numaSocket)
Initialize keyHt and tokenHt.
Definition: pcct.c:36
void Pcct_Erase(Pcct *pcct, PccEntry *entry)
Erase an entry.
Definition: pcct.c:122
struct Pcct Pcct
The PIT-CS Composite Table (PCCT).
#define PCCT_ERASE_BURST
Definition: pcct.h:83
PccEntry * Pcct_FindByToken(const Pcct *pcct, uint64_t token)
Find an entry by token.
Definition: pcct.c:178
void Pcct_Clear(Pcct *pcct)
Clear keyHt and tokenHt, and free cached Data.
Definition: pcct.c:54
uint64_t Pcct_AddToken(Pcct *pcct, PccEntry *entry)
Assign a token to an entry.
Definition: pcct.c:129
void PcctEraseBatch_EraseBurst_(PcctEraseBatch *peb)
Definition: pcct.c:191
The Content Store (CS).
Definition: cs-struct.h:63
PIT-CS composite entry.
Definition: pcc-entry.h:56
Hash key for searching among PccEntry .
Definition: pcc-key.h:20
Context for erasing several PCC entries.
Definition: pcct.h:86
int nEntries
Definition: pcct.h:88
void * objs[PCCT_ERASE_BURST *(2+PccKeyMaxExts)]
Definition: pcct.h:89
Pcct * pcct
Definition: pcct.h:87
The PIT-CS Composite Table (PCCT).
Definition: pcct.h:11
PccEntry * keyHt
key hashtable
Definition: pcct.h:13
struct rte_mempool * mp
entry mempool
Definition: pcct.h:12
Pit pit
Definition: pcct.h:17
struct rte_hash * tokenHt
token hashtable
Definition: pcct.h:14
Cs cs
Definition: pcct.h:18
uint64_t lastToken
last assigned token
Definition: pcct.h:15
uint32_t nKeyHtBuckets
Definition: pcct.h:20
The Pending Interest Table (PIT).
Definition: pit-struct.h:20