NDN-DPDK
High-Speed Named Data Networking Forwarder
Loading...
Searching...
No Matches
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)
#define uthash_free(ptr, sz)
#define HASH_FUNCTION   HASH_FUNCTION_DONOTUSE
#define HASH_KEYCMP(a, b, n)
#define uthash_fatal(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)

Functions

 N_LOG_INIT (Pcct)
bool Pcct_Init (Pcct *pcct, const char *id, uint32_t maxEntries, int numaSocket)
 Initialize keyHt and tokenHt.
void Pcct_Clear (Pcct *pcct)
 Clear keyHt and tokenHt, and free cached Data.
PccEntryPcct_Insert (Pcct *pcct, const PccSearch *search, bool *isNew)
 Insert or find an entry.
void Pcct_Erase (Pcct *pcct, PccEntry *entry)
 Erase an entry.
uint64_t Pcct_AddToken (Pcct *pcct, PccEntry *entry)
 Assign a token to an entry.
void Pcct_RemoveToken (Pcct *pcct, PccEntry *entry)
 Clear the token on an entry.
PccEntryPcct_FindByToken (const Pcct *pcct, uint64_t token)
 Find an entry by token.
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 )
Value:
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,
n )
Value:
(!PccKey_MatchSearch((const PccKey*)(a), (const PccSearch*)(b)))
Hash key stored in PccEntry .
Definition pcc-key.h:50
Hash key for searching among PccEntry .
Definition pcc-key.h:20

◆ uthash_fatal

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

◆ uthash_free

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

◆ uthash_malloc

#define uthash_malloc ( sz)
Value:
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)