The core of libTFO, start here.
More...
#include <tfo.hh>
List of all members.
Public Types |
typedef O | owner_type |
typedef M | match_type |
typedef A | action_type |
typedef U | user_type |
typedef void(* | fib_modify_func )(O owner, FibEntry< M, A, U > *e) |
typedef void(* | walk_const_callback_func )(O owner, const FibEntry< M, A, U > *e, void *user_data) |
typedef void(* | walk_callback_func )(O owner, FibEntry< M, A, U > *e, void *user_data) |
Public Member Functions |
| TFO (O owner, const uint32_t fib_capacity, const fib_modify_func fib_modify, const uint32_t size_b2, const uint32_t size_b3) |
| ~TFO (void) |
int | update_entry (const M &m, const A &a, const enum FibEntryUpdateType type) |
FibEntry< M, A, U > * | get_entry (const M &m) |
int | update_hits (const M &m, const uint64_t &hits, const enum FibEntryHitsUpdateType type=FIB_ENTRY_HITS_ADD) |
void | bin_complete (void) |
void | walk_entries (walk_const_callback_func f, void *user_data=NULL) |
void | walk_entries (walk_callback_func f, void *user_data=NULL) |
Detailed Description
template<typename O, typename M, typename A, typename U, typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
class TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn >
The core of libTFO, start here.
- Template Parameters:
-
O | Type of the owner, use void* if not needed. |
M | Type of flow match, e.g., destination IP prefix. |
A | Type of flow action, e.g., output interface. |
U | Type of additional information attached to FIB entries. |
MHashFcn | Hash function for const M*, defaults to hash<const M*>. |
MEqualFcn | Equality function for const M*, defaults to equal_to<const M*>. |
AEqualFcn | Equality function for const A, defaults to equal_to<const A>. |
Member Typedef Documentation
template<typename O , typename M , typename A , typename U , typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
typedef A TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn >::action_type |
template<typename O , typename M , typename A , typename U , typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
template<typename O , typename M , typename A , typename U , typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
typedef M TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn >::match_type |
template<typename O , typename M , typename A , typename U , typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
typedef O TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn >::owner_type |
template<typename O , typename M , typename A , typename U , typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
typedef U TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn >::user_type |
template<typename O , typename M , typename A , typename U , typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
typedef void(* TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn >::walk_callback_func)(O owner, FibEntry< M, A, U > *e, void *user_data) |
template<typename O , typename M , typename A , typename U , typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
typedef void(* TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn >::walk_const_callback_func)(O owner, const FibEntry< M, A, U > *e, void *user_data) |
Constructor & Destructor Documentation
template<typename O , typename M , typename A , typename U , typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn >::TFO |
( |
O |
owner, |
|
|
const uint32_t |
fib_capacity, |
|
|
const fib_modify_func |
fib_modify, |
|
|
const uint32_t |
size_b2, |
|
|
const uint32_t |
size_b3 |
|
) |
| [inline] |
Creates a new instance of TFO.
- Parameters:
-
[in] | owner | Reference to the owner of this TFO instance. |
[in] | fib_capacity | Number of entries available on the fast-path FIB. |
[in] | fib_modify | Callback function that is called on all FIB changes. |
[in] | size_b2 | Number of b1 time bins that make a b2 time bin. |
[in] | size_b3 | Number of b1 time bins that make a b3 time bin. |
template<typename O , typename M , typename A , typename U , typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn >::~TFO |
( |
void |
| ) |
[inline] |
Member Function Documentation
template<typename O , typename M , typename A , typename U , typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
void TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn >::bin_complete |
( |
void |
| ) |
[inline] |
The controller is supposed to call bin_complete() whenever a shortest time bin (b1) has elapsed. FibEntry takes care of updating the hit counters of all time scales (b1, b2, b3). Finally, the FIB entry selection strategy is applied. The callback function fib_modify() is called to notify the controller about any changes.
template<typename O , typename M , typename A , typename U , typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
FibEntry<M, A, U>* TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn >::get_entry |
( |
const M & |
m | ) |
[inline] |
Finds and returns the FIB entry which corresponds to a given match.
- Parameters:
-
- Returns:
- Returns NULL if there is no matching FIB entry.
template<typename O , typename M , typename A , typename U , typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
int TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn >::update_entry |
( |
const M & |
m, |
|
|
const A & |
a, |
|
|
const enum FibEntryUpdateType |
type |
|
) |
| [inline] |
The controller calls update_entry() on all changes to the FIB. If TFO decides to propagate corresponding changes to either slow path or fast path, TFO calls the fib_modify() callback function.
- Parameters:
-
[in] | m | Match. |
[in] | a | Action. |
[in] | type | Type of update. |
- Returns:
- Returns non-zero on error.
template<typename O , typename M , typename A , typename U , typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
int TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn >::update_hits |
( |
const M & |
m, |
|
|
const uint64_t & |
hits, |
|
|
const enum FibEntryHitsUpdateType |
type = FIB_ENTRY_HITS_ADD |
|
) |
| [inline] |
The controller calls update_hits() whenever new FIB entry statistics are available.
- Parameters:
-
[in] | m | Match. |
[in] | hits | Number of hits. |
[in] | type | Type of update. |
- Returns:
- Returns non-zero on error.
template<typename O , typename M , typename A , typename U , typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
Allows the controller to perform a read-only walk through all FIB entries.
- Parameters:
-
[in] | f | Callback function to be invoked for each FibEntry. |
[in] | user_data | Optional argument that gets passed on to f. |
template<typename O , typename M , typename A , typename U , typename MHashFcn = hash<const M*>, typename MEqualFcn = equal_to<const M*>, typename AEqualFcn = equal_to<const A>>
void TFO< O, M, A, U, MHashFcn, MEqualFcn, AEqualFcn >::walk_entries |
( |
walk_callback_func |
f, |
|
|
void * |
user_data = NULL |
|
) |
| [inline] |
Allows the controller to perform a walk through all FIB entries.
- Parameters:
-
[in] | f | Callback function to be invoked for each FibEntry. |
[in] | user_data | Optional argument that gets passed on to f. |
The documentation for this class was generated from the following file: