NDN-DPDK
High-Speed Named Data Networking Forwarder
Loading...
Searching...
No Matches
pcct.h
Go to the documentation of this file.
1#ifndef NDNDPDK_PCCT_PCCT_H
2#define NDNDPDK_PCCT_PCCT_H
3
5
6#include "cs-struct.h"
7#include "pcc-entry.h"
8#include "pit-struct.h"
9
11typedef struct Pcct {
12 struct rte_mempool* mp;
14 struct rte_hash* tokenHt;
15 uint64_t lastToken;
16
19
20 uint32_t nKeyHtBuckets;
22
23static __rte_always_inline Pcct*
24Pcct_FromPit(const Pit* pit) {
25 return container_of(pit, Pcct, pit);
26}
27
28static __rte_always_inline Pcct*
29Pcct_FromCs(const Cs* cs) {
30 return container_of(cs, Pcct, cs);
31}
32
39__attribute__((nonnull)) bool
40Pcct_Init(Pcct* pcct, const char* id, uint32_t maxEntries, int numaSocket);
41
46__attribute__((nonnull)) void
47Pcct_Clear(Pcct* pcct);
48
54__attribute__((nonnull)) PccEntry*
55Pcct_Insert(Pcct* pcct, const PccSearch* search, bool* isNew);
56
61__attribute__((nonnull)) void
62Pcct_Erase(Pcct* pcct, PccEntry* entry);
63
68__attribute__((nonnull)) uint64_t
69Pcct_AddToken(Pcct* pcct, PccEntry* entry);
70
72__attribute__((nonnull)) void
73Pcct_RemoveToken(Pcct* pcct, PccEntry* entry);
74
79__attribute__((nonnull)) PccEntry*
80Pcct_FindByToken(const Pcct* pcct, uint64_t token);
81
82// Burst size of PCCT erasing.
83#define PCCT_ERASE_BURST 32
84
91
100__attribute__((nonnull)) static inline PcctEraseBatch
101PcctEraseBatch_New(Pcct* pcct) {
102 return (PcctEraseBatch){.pcct = pcct};
103}
104
105__attribute__((nonnull)) void
107
109__attribute__((nonnull)) static inline void
110PcctEraseBatch_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
119PcctEraseBatch_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
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
PccEntry * Pcct_FindByToken(const Pcct *pcct, uint64_t token)
Find an entry by token.
Definition pcct.c:178
#define PCCT_ERASE_BURST
Definition pcct.h:83
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