All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Types | Public Member Functions | List of all members
CTashTable< TmplIndexId, N > Class Template Reference

Hash table that uses atomic locking of OCTEON processor (Tagged Hash Table = TashTable :-) More...

#include <tashtable.h>

Inheritance diagram for CTashTable< TmplIndexId, N >:
Inheritance graph
Collaboration diagram for CTashTable< TmplIndexId, N >:
Collaboration graph

Public Types

enum  EErrorCodes { ErrorOk, ErrorNoMemory, ErrorEntryNotFound, ErrorInvalidTag }
 Definitions of return codes. More...
 

Public Member Functions

EErrorCodes Init (char *pcMemName, uint32_t ui32LogNrOfEntries, uint16_t ui32FPAPool, bool bDoTagCheck, CCoremask *pcCoreMask=NULL)
 Constructor. More...
 
EErrorCodes Close ()
 Close the tash table. More...
 
void * Insert (uint32_t ui32Tag, const TmplIndexId &tmplIndexId, void *pStorage=NULL)
 Insert an entry of type TmplIndexId at index ui32Tag to the tash table. More...
 
void * InsertAtBegin (uint32_t ui32Tag, const TmplIndexId &tmplIndexId, void *pStorage=NULL)
 Insert an entry of type TmplIndexId at index ui32Tag to the tash table. More...
 
EErrorCodes Remove (const TmplIndexId &tmplIndexId, uint32_t ui32Tag, bool bFreeResource=true)
 Remove an entry from the tash table. More...
 
void * Search (const TmplIndexId &tmplIndexId, uint32_t ui32Tag)
 Search for an entry in the tash table. More...
 
int32_t GetAndAddNrOfEntries (int iIncrement)
 Get the number of entries that are stored in this tash table (diagnostic function) More...
 
void * GetFirst (uint32_t ui32Tag)
 Get the first entry at the index. More...
 
void * GetNext (void *pCurrentPointer)
 Get the next entry at the index. More...
 
void SetAuxilary (uint32_t ui32Tag, uint64_t ui64Auxilary)
 Set the Auxiliary field of an index. More...
 
uint64_t GetAuxilary (uint32_t ui32Tag)
 Get the Auxiliary field of an index. More...
 
void * GetIndexIdArea (void *pCurrentPointer)
 Get a pointer to the unique ID area of the member. More...
 
void WriteLock (uint32_t ui32Index)
 
void WriteUnlock (uint32_t ui32Index)
 
void ReadLock (uint32_t ui32Index)
 
void ReadUnlock (uint32_t ui32Index)
 
void ReadWriteLock (uint32_t ui32Index, ELockCommand eCommand)
 
void ReadWriteUnlock (uint32_t ui32Index, ELockCommand eCommand)
 
void WriteLockTable ()
 
void WriteUnlockTable ()
 
void ReadLockTable ()
 
void ReadUnlockTable ()
 
void ReadWriteLockTable (ELockCommand eCommand)
 
void ReadWriteUnlockTable (ELockCommand eCommand)
 
void * Allocate (bool bOnCacheLine)
 
void Free (void *pMemory)
 

Detailed Description

template<typename TmplIndexId, unsigned int N>
class CTashTable< TmplIndexId, N >

Hash table that uses atomic locking of OCTEON processor (Tagged Hash Table = TashTable :-)

This hash table is used when the index for inserting, searching and removing are the least 16 bits of the atomic tag value. In this way no locking mechanism is necessary. An entry is defined by TmplIndexId

Definition at line 34 of file tashtable.h.

Member Enumeration Documentation

template<typename TmplIndexId, unsigned int N>
enum CTashTable::EErrorCodes

Definitions of return codes.

Enumerator
ErrorOk 

All went well.

ErrorNoMemory 

No memory available from the CBootMem class.

ErrorEntryNotFound 

Removing an entry that does not exist.

ErrorInvalidTag 

Removing an entry with an invalid tag.

Definition at line 38 of file tashtable.h.

Member Function Documentation

template<typename TmplIndexId, unsigned int N>
void* CTashTable< TmplIndexId, N >::Allocate ( bool  bOnCacheLine)
inline

Definition at line 534 of file tashtable.h.

template<typename TmplIndexId, unsigned int N>
EErrorCodes CTashTable< TmplIndexId, N >::Close ( void  )
inline

Close the tash table.

Returns
Error code of type EErrorCodes

Definition at line 119 of file tashtable.h.

template<typename TmplIndexId, unsigned int N>
void CTashTable< TmplIndexId, N >::Free ( void *  pMemory)
inline

Definition at line 551 of file tashtable.h.

template<typename TmplIndexId, unsigned int N>
int32_t CTashTable< TmplIndexId, N >::GetAndAddNrOfEntries ( int  iIncrement)
inline

Get the number of entries that are stored in this tash table (diagnostic function)

Parameters
[in]Numberof entries to add to the total number of entries
Returns
Number of entries in the tash table

Definition at line 374 of file tashtable.h.

template<typename TmplIndexId, unsigned int N>
uint64_t CTashTable< TmplIndexId, N >::GetAuxilary ( uint32_t  ui32Tag)
inline

Get the Auxiliary field of an index.

The auxiliary field is an uint64_t type value that stores application specific data

Parameters
[in]ui32TagIndex at which the auxiliary value is stored
Returns
Value stored at this index

Definition at line 439 of file tashtable.h.

template<typename TmplIndexId, unsigned int N>
void* CTashTable< TmplIndexId, N >::GetFirst ( uint32_t  ui32Tag)
inline

Get the first entry at the index.

Parameters
[in]ui32TagIndex at which the first entry is searched for
Returns
Pointer to first entry. If nothing is found, NULL is returned

Definition at line 383 of file tashtable.h.

template<typename TmplIndexId, unsigned int N>
void* CTashTable< TmplIndexId, N >::GetIndexIdArea ( void *  pCurrentPointer)
inline

Get a pointer to the unique ID area of the member.

The auxiliary field is an uint64_t type value that stores application specific data

Parameters
[in]ui32TagIndex at which the auxiliary value is stored
Returns
pointer to unique ID storage

Definition at line 450 of file tashtable.h.

template<typename TmplIndexId, unsigned int N>
void* CTashTable< TmplIndexId, N >::GetNext ( void *  pCurrentPointer)
inline

Get the next entry at the index.

Parameters
[in]pCurrentPointerPointer to previous value
Returns
Pointer to next entry. If nothing is found, NULL is returned

Definition at line 406 of file tashtable.h.

template<typename TmplIndexId, unsigned int N>
EErrorCodes CTashTable< TmplIndexId, N >::Init ( char pcMemName,
uint32_t  ui32LogNrOfEntries,
uint16_t  ui32FPAPool,
bool  bDoTagCheck,
CCoremask pcCoreMask = NULL 
)
inline

Constructor.

Initialize the tash table

Parameters
[in]pcMemNameName of the memory to be allocated. Named memory is allocated via the CBootMem class
[in]ui32LogNrOfEntriesLog2 value of size of the tash table. Normally you would need When 65536 entries, so ui32LogNrOfEntries would be 16 (2^16 = 65536)
[in]ui32FPAPoolFPA pool number used by the tash table
[in]ui64RequiredSizeSize of the data object that is stored in the tash table. This must be smaller or equal to the available memory in a pool member
[in]bDoTagCheckCheck for valid atomic tag values when entries are searched for or removed
[in]pcCoreMaskPointer to the coremask that defines the cores on which this table should run (optional)
Returns
Error code of type EErrorCodes

Definition at line 62 of file tashtable.h.

template<typename TmplIndexId, unsigned int N>
void* CTashTable< TmplIndexId, N >::Insert ( uint32_t  ui32Tag,
const TmplIndexId &  tmplIndexId,
void *  pStorage = NULL 
)
inline

Insert an entry of type TmplIndexId at index ui32Tag to the tash table.

Memory for a new entry is allocated and the new entry is stored at the end of the list.

Parameters
[in]ui32TagThe index at which list this entry should be stored
[in]tmplIndexIdNew entry to be stored
[in]pStorageStorage that should be used for this new entry (optional)
Returns
Pointer to memory where new entry was stored

Definition at line 155 of file tashtable.h.

template<typename TmplIndexId, unsigned int N>
void* CTashTable< TmplIndexId, N >::InsertAtBegin ( uint32_t  ui32Tag,
const TmplIndexId &  tmplIndexId,
void *  pStorage = NULL 
)
inline

Insert an entry of type TmplIndexId at index ui32Tag to the tash table.

Memory for a new entry is allocated and the new entry is stored at the beginning of the list.

Parameters
[in]ui32TagThe index at which list this entry should be stored
[in]tmplIndexIdNew entry to be stored
[in]pStorageStorage that should be used for this new entry (optional)
Returns
Pointer to memory where new entry was stored

Definition at line 208 of file tashtable.h.

template<typename TmplIndexId, unsigned int N>
void CTashTable< TmplIndexId, N >::ReadLock ( uint32_t  ui32Index)
inline

Definition at line 468 of file tashtable.h.

template<typename TmplIndexId, unsigned int N>
void CTashTable< TmplIndexId, N >::ReadLockTable ( )
inline

Definition at line 508 of file tashtable.h.

template<typename TmplIndexId, unsigned int N>
void CTashTable< TmplIndexId, N >::ReadUnlock ( uint32_t  ui32Index)
inline

Definition at line 474 of file tashtable.h.

template<typename TmplIndexId, unsigned int N>
void CTashTable< TmplIndexId, N >::ReadUnlockTable ( )
inline

Definition at line 513 of file tashtable.h.

template<typename TmplIndexId, unsigned int N>
void CTashTable< TmplIndexId, N >::ReadWriteLock ( uint32_t  ui32Index,
ELockCommand  eCommand 
)
inline

Definition at line 480 of file tashtable.h.

template<typename TmplIndexId, unsigned int N>
void CTashTable< TmplIndexId, N >::ReadWriteLockTable ( ELockCommand  eCommand)
inline

Definition at line 518 of file tashtable.h.

template<typename TmplIndexId, unsigned int N>
void CTashTable< TmplIndexId, N >::ReadWriteUnlock ( uint32_t  ui32Index,
ELockCommand  eCommand 
)
inline

Definition at line 489 of file tashtable.h.

template<typename TmplIndexId, unsigned int N>
void CTashTable< TmplIndexId, N >::ReadWriteUnlockTable ( ELockCommand  eCommand)
inline

Definition at line 526 of file tashtable.h.

template<typename TmplIndexId, unsigned int N>
EErrorCodes CTashTable< TmplIndexId, N >::Remove ( const TmplIndexId &  tmplIndexId,
uint32_t  ui32Tag,
bool  bFreeResource = true 
)
inline

Remove an entry from the tash table.

Parameters
[in]tmplIndexIdThe entry to be removed
[in]ui32TagThe index at which list this entry should be removed
[in]bFreeResourceIf set to false,the entry will be removed from the tash table but will not be deleted.
Returns
Error code of type EErrorCodes

Definition at line 259 of file tashtable.h.

template<typename TmplIndexId, unsigned int N>
void* CTashTable< TmplIndexId, N >::Search ( const TmplIndexId &  tmplIndexId,
uint32_t  ui32Tag 
)
inline

Search for an entry in the tash table.

Parameters
[in]tmplIndexIdThe entry to be searched for
[in]ui32TagThe index at which list this entry should be searched
Returns
Pointer to the found entry. If not found, NULL is returned

Definition at line 344 of file tashtable.h.

template<typename TmplIndexId, unsigned int N>
void CTashTable< TmplIndexId, N >::SetAuxilary ( uint32_t  ui32Tag,
uint64_t  ui64Auxilary 
)
inline

Set the Auxiliary field of an index.

The auxiliary field is an uint64_t type value that stores application specific data

Parameters
[in]ui32TagIndex at which the auxiliary value is stored
[in]ui64AuxilaryValue to be stored

Definition at line 427 of file tashtable.h.

template<typename TmplIndexId, unsigned int N>
void CTashTable< TmplIndexId, N >::WriteLock ( uint32_t  ui32Index)
inline

Definition at line 456 of file tashtable.h.

template<typename TmplIndexId, unsigned int N>
void CTashTable< TmplIndexId, N >::WriteLockTable ( )
inline

Definition at line 498 of file tashtable.h.

template<typename TmplIndexId, unsigned int N>
void CTashTable< TmplIndexId, N >::WriteUnlock ( uint32_t  ui32Index)
inline

Definition at line 462 of file tashtable.h.

template<typename TmplIndexId, unsigned int N>
void CTashTable< TmplIndexId, N >::WriteUnlockTable ( )
inline

Definition at line 503 of file tashtable.h.


The documentation for this class was generated from the following file: