NDN-DPDK
High-Speed Named Data Networking Forwarder
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Macros | Functions
pcct.c File Reference
#include "pcct.h"
#include "cs.h"
#include "pit.h"
#include "../core/logger.h"
#include "../dpdk/hashtable.h"
#include "../vendor/uthash.h"

Macros

#define uthash_malloc(sz)   rte_malloc("PCCT.uthash", (sz), 0)
 
#define uthash_free(ptr, sz)   rte_free((ptr))
 
#define HASH_FUNCTION   HASH_FUNCTION_DONOTUSE
 
#define HASH_KEYCMP(a, b, n)   (!PccKey_MatchSearch((const PccKey*)(a), (const PccSearch*)(b)))
 
#define uthash_fatal(msg)   rte_panic("uthash_fatal %s", msg)
 
#define HASH_INITIAL_NUM_BUCKETS   (pcct->nKeyHtBuckets)
 
#define HASH_INITIAL_NUM_BUCKETS_LOG2   (rte_log2_u32(HASH_INITIAL_NUM_BUCKETS))
 
#define HASH_BKT_CAPACITY_THRESH   UINT_MAX
 
#define HASH_EXPAND_BUCKETS(hh, tbl, oomed)   Pcct_KeyHt_Expand_(tbl)
 

Functions

 N_LOG_INIT (Pcct)
 
bool Pcct_Init (Pcct *pcct, const char *id, uint32_t maxEntries, int numaSocket)
 Initialize keyHt and tokenHt. More...
 
void Pcct_Clear (Pcct *pcct)
 Clear keyHt and tokenHt, and free cached Data. More...
 
PccEntryPcct_Insert (Pcct *pcct, const PccSearch *search, bool *isNew)
 Insert or find an entry. More...
 
void Pcct_Erase (Pcct *pcct, PccEntry *entry)
 Erase an entry. More...
 
uint64_t Pcct_AddToken (Pcct *pcct, PccEntry *entry)
 Assign a token to an entry. More...
 
void Pcct_RemoveToken (Pcct *pcct, PccEntry *entry)
 Clear the token on an entry. More...
 
PccEntryPcct_FindByToken (const Pcct *pcct, uint64_t token)
 Find an entry by token. More...
 
void PcctEraseBatch_EraseBurst_ (PcctEraseBatch *peb)
 

Macro Definition Documentation

◆ HASH_BKT_CAPACITY_THRESH

#define HASH_BKT_CAPACITY_THRESH   UINT_MAX

◆ HASH_EXPAND_BUCKETS

#define HASH_EXPAND_BUCKETS (   hh,
  tbl,
  oomed 
)    Pcct_KeyHt_Expand_(tbl)

◆ HASH_FUNCTION

#define HASH_FUNCTION   HASH_FUNCTION_DONOTUSE

◆ HASH_INITIAL_NUM_BUCKETS

#define HASH_INITIAL_NUM_BUCKETS   (pcct->nKeyHtBuckets)

◆ HASH_INITIAL_NUM_BUCKETS_LOG2

#define HASH_INITIAL_NUM_BUCKETS_LOG2   (rte_log2_u32(HASH_INITIAL_NUM_BUCKETS))

◆ HASH_KEYCMP

#define HASH_KEYCMP (   a,
  b,
 
)    (!PccKey_MatchSearch((const PccKey*)(a), (const PccSearch*)(b)))

◆ uthash_fatal

#define uthash_fatal (   msg)    rte_panic("uthash_fatal %s", msg)

◆ uthash_free

#define uthash_free (   ptr,
  sz 
)    rte_free((ptr))

◆ uthash_malloc

#define uthash_malloc (   sz)    rte_malloc("PCCT.uthash", (sz), 0)

Function Documentation

◆ N_LOG_INIT()

N_LOG_INIT ( Pcct  )

◆ Pcct_AddToken()

uint64_t Pcct_AddToken ( Pcct pcct,
PccEntry entry 
)

Assign a token to an entry.

Returns
New or existing token.

◆ Pcct_Clear()

void Pcct_Clear ( Pcct pcct)

Clear keyHt and tokenHt, and free cached Data.

Postcondition
Pcct mempool can be deallocated.

◆ Pcct_Erase()

void Pcct_Erase ( Pcct pcct,
PccEntry entry 
)

Erase an entry.

See also
PcctEraseBatch

◆ Pcct_FindByToken()

PccEntry* Pcct_FindByToken ( const Pcct pcct,
uint64_t  token 
)

Find an entry by token.

Parameters
tokenthe token, only lower 48 bits are significant.

◆ Pcct_Init()

bool Pcct_Init ( Pcct pcct,
const char *  id,
uint32_t  maxEntries,
int  numaSocket 
)

Initialize keyHt and tokenHt.

Parameters
idmemzone identifier, must be unique.
maxEntriesPCCT capacity; hashtable capacity will be calculated accordingly.
Returns
whether success. Error code is in rte_errno .

◆ Pcct_Insert()

PccEntry* Pcct_Insert ( Pcct pcct,
const PccSearch search,
bool *  isNew 
)

Insert or find an entry.

Parameters
[out]isNewwhether the entry is new
Return values
NULLallocation error.

◆ Pcct_RemoveToken()

void Pcct_RemoveToken ( Pcct pcct,
PccEntry entry 
)

Clear the token on an entry.

◆ PcctEraseBatch_EraseBurst_()

void PcctEraseBatch_EraseBurst_ ( PcctEraseBatch peb)