NDN-DPDK
High-Speed Named Data Networking Forwarder
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
cs-arc.h
Go to the documentation of this file.
1 #ifndef NDNDPDK_PCCT_CS_ARC_H
2 #define NDNDPDK_PCCT_CS_ARC_H
3 
6 #include "cs-list.h"
7 
8 #define CsArc_MoveDir(src, dst) (((uint16_t)(src) << 16) | ((uint16_t)(dst) << 0))
9 
10 #define CsArc_MoveDirC(src, dst) CsArc_MoveDir(CslDirect##src, CslDirect##dst)
11 
12 extern const ptrdiff_t CsArc_ListOffsets_[];
13 
18 __attribute__((nonnull, returns_nonnull)) static __rte_always_inline CsList*
19 CsArc_GetList(CsArc* arc, CsListID l) {
20  return RTE_PTR_ADD(arc, CsArc_ListOffsets_[l]);
21 }
22 
28 __attribute__((nonnull)) void
29 CsArc_Init(CsArc* arc, uint32_t c, uint32_t capB2);
30 
32 __attribute__((nonnull)) static __rte_always_inline uint32_t
33 CsArc_GetCapacity(const CsArc* arc) {
34  return CsArc_c(arc);
35 }
36 
38 static __rte_always_inline uint32_t
39 CsArc_CountEntries(const CsArc* arc) {
40  return arc->T1.count + arc->T2.count;
41 }
42 
48 __attribute__((nonnull)) void
49 CsArc_Add(CsArc* arc, CsEntry* entry);
50 
52 __attribute__((nonnull)) void
53 CsArc_Remove(CsArc* arc, CsEntry* entry);
54 
55 #endif // NDNDPDK_PCCT_CS_ARC_H
void CsArc_Remove(CsArc *arc, CsEntry *entry)
Remove an entry.
Definition: cs-arc.c:178
void CsArc_Add(CsArc *arc, CsEntry *entry)
Add or refresh an entry.
Definition: cs-arc.c:146
const ptrdiff_t CsArc_ListOffsets_[]
Definition: cs-arc.c:7
void CsArc_Init(CsArc *arc, uint32_t c, uint32_t capB2)
Initialize ARC.
Definition: cs-arc.c:60
CsListID
Definition: cs-enum.h:18
#define CsArc_c(arc)
Access c as uint32.
Definition: cs-struct.h:44
Lists for Adaptive Replacement Cache (ARC).
Definition: cs-struct.h:30
CsList T1
stored entries that appeared once
Definition: cs-struct.h:33
CsList T2
stored entries that appeared more than once
Definition: cs-struct.h:35
A CS entry.
Definition: cs-entry.h:22
A doubly linked list within CS.
Definition: cs-struct.h:18
uint32_t count
number of entries
Definition: cs-struct.h:21