|
Click
|
#include <flowrulecache.hh>
Public Member Functions | |
| FlowRuleCache (portid_t port_id, bool verbose, bool debug_mode, ErrorHandler *errh) | |
| portid_t | get_port_id () |
| String | get_device_address () |
| bool | has_rules () |
| bool | global_rule_id_exists (const uint32_t &rule_id) |
| bool | internal_rule_id_exists (const uint32_t &int_rule_id) |
| uint32_t | global_from_internal_rule_id (const uint32_t &int_rule_id) |
| int32_t | internal_from_global_rule_id (const uint32_t &rule_id) |
| template<typename T > | |
| void | sort_rule_ids_inc (Vector< T > &rule_ids_vec) |
| template<typename T > | |
| void | sort_rule_ids_dec (Vector< T > &rule_ids_vec) |
| Vector< uint32_t > | global_rule_ids (const bool increasing=true) |
| Vector< uint32_t > | internal_rule_ids (const bool increasing=true) |
| Vector< uint32_t > | internal_rule_ids_counters (const bool increasing=true) |
| HashMap< uint32_t, String > * | rules_map_by_core_id (const int &core_id) |
| Vector< String > | rules_list_by_core_id (const int &core_id) |
| Vector< int > | cores_with_rules () |
| String | get_rule_by_global_id (const uint32_t &rule_id) |
| String | get_rule_by_internal_id (const uint32_t &int_rule_id) |
| int32_t | currently_max_internal_rule_id () |
| uint32_t | next_internal_rule_id () |
| void | set_next_internal_rule_id (uint32_t next_id) |
| int | insert_rule_in_flow_cache (const int &core_id, const uint32_t &rule_id, const uint32_t &int_rule_id, const String rule) |
| bool | update_rule_in_flow_cache (const int &core_id, const uint32_t &rule_id, const uint32_t &int_rule_id, String rule) |
| int32_t | delete_rule_by_global_id (const uint32_t &rule_id) |
| String | delete_rules_by_internal_id (const uint32_t *int_rule_ids, const uint32_t &rules_nb) |
| String | delete_rules_by_internal_id (const Vector< String > &rules_vec) |
| int32_t | flush_rules_from_cache () |
| void | set_matched_packets (const uint32_t &int_rule_id, uint64_t value) |
| uint64_t | get_matched_packets (const uint32_t &int_rule_id) |
| void | set_matched_bytes (const uint32_t &int_rule_id, uint64_t value) |
| uint64_t | get_matched_bytes (const uint32_t &int_rule_id) |
| uint32_t | get_rule_counter () |
| void | initialize_rule_counters (uint32_t *int_rule_ids, const uint32_t &rules_nb) |
| void | delete_rule_counters (uint32_t *int_rule_ids, const uint32_t &rules_nb) |
| void | cache_consistency_check (const int32_t &target_number_of_rules) |
| void | correlate_candidate_id_with_cache (int32_t &candidate) |
| void | flush_rule_counters () |
Flow Rule Cache API.
| portid_t FlowRuleCache::get_port_id | ( | ) |
Flow Rule Cache implementation. Return the NIC port ID associated with this flow rule cache.
| String FlowRuleCache::get_device_address | ( | ) |
Return the NIC device's adress suitable to use as a FromDPDKDevice reference.
| bool FlowRuleCache::has_rules | ( | ) |
Checks whether this flow rule cache contains any flow rules or not.
| bool FlowRuleCache::global_rule_id_exists | ( | const uint32_t & | rule_id | ) |
Checks whether a given global flow rule ID is present or not.
@args rule_id: a global flow rule ID to find
| bool FlowRuleCache::internal_rule_id_exists | ( | const uint32_t & | int_rule_id | ) |
Checks whether an internal flow rule ID is present or not.
@args int_rule_id: an internal flow rule ID to find
| uint32_t FlowRuleCache::global_from_internal_rule_id | ( | const uint32_t & | int_rule_id | ) |
Traverses the map of global flow rule IDs to internal NIC IDs, and checks whether an internal flow rule ID is present or not.
@args int_rule_id: an internal flow rule ID to find
| int32_t FlowRuleCache::internal_from_global_rule_id | ( | const uint32_t & | rule_id | ) |
Queries the map of global flow rule IDs to internal NIC IDs, and checks whether a global flow rule ID is present or not.
@args rule_id: a global flow rule ID to find
| void FlowRuleCache::sort_rule_ids_inc | ( | Vector< T > & | rule_ids_vec | ) |
Sorts a list of flow rule IDs by increasing order.
| void FlowRuleCache::sort_rule_ids_dec | ( | Vector< T > & | rule_ids_vec | ) |
Sorts a a list of flow rule IDs by decreasing order.
| Vector< uint32_t > FlowRuleCache::global_rule_ids | ( | const bool | increasing = true | ) |
Returns the list of global flow rules IDs in this flow rule cache.
| Vector< uint32_t > FlowRuleCache::internal_rule_ids | ( | const bool | increasing = true | ) |
Returns the list of internal flow rules IDs in this flow rule cache.
| Vector< uint32_t > FlowRuleCache::internal_rule_ids_counters | ( | const bool | increasing = true | ) |
Returns the list of internal flow rules IDs with counters.
| HashMap< uint32_t, String > * FlowRuleCache::rules_map_by_core_id | ( | const int & | core_id | ) |
Returns a map of flow rule IDs to flow rules.
@args core_id: a CPU core ID
Returns a list of flow rules associated with a CPU core.
@args core_id: a CPU core ID
| Vector< int > FlowRuleCache::cores_with_rules | ( | ) |
Returns the number of CPU cores that have at least one flow rule each.
| String FlowRuleCache::get_rule_by_global_id | ( | const uint32_t & | rule_id | ) |
Returns a flow rule by its global flow rule ID.
| String FlowRuleCache::get_rule_by_internal_id | ( | const uint32_t & | int_rule_id | ) |
Returns a flow rule by its global flow rule ID.
| int32_t FlowRuleCache::currently_max_internal_rule_id | ( | ) |
Returns the currently maximum internal flow rule ID.
| uint32_t FlowRuleCache::next_internal_rule_id | ( | ) |
Returns the next internal flow rule ID to use for insertion.
| void FlowRuleCache::set_next_internal_rule_id | ( | uint32_t | next_id | ) |
Sets the next internal flow rule ID to use for insertion.
| int FlowRuleCache::insert_rule_in_flow_cache | ( | const int & | core_id, |
| const uint32_t & | rule_id, | ||
| const uint32_t & | int_rule_id, | ||
| const String | rule | ||
| ) |
Adds a new flow rule to this flow rule cache.
@args core_id: a CPU core ID associated with the flow rule @args rule_id: a global rule ID associated with the flow rule @args int_rule_id: an internal flow rule ID associated with the flow rule @args rule: the actual flow rule
| bool FlowRuleCache::update_rule_in_flow_cache | ( | const int & | core_id, |
| const uint32_t & | rule_id, | ||
| const uint32_t & | int_rule_id, | ||
| String | rule | ||
| ) |
Updates a flow rule using a two-phase commit. First checks if flow rule exists and if so deletes it. Then, inserts the new flow rule.
@args core_id: a new CPU core ID associated with this flow rule @args rule_id: the global flow rule ID of the flow rule to be updated @args int_rule_id: a new internal flow rule ID to be associated with this flow rule @args rule: the actual flow rule to be updated
| int32_t FlowRuleCache::delete_rule_by_global_id | ( | const uint32_t & | rule_id | ) |
Deletes a flow rule from this flow rule cache using its global ID as an index.
@args rule_id: the global flow rule ID of the flow rule to be deleted
| String FlowRuleCache::delete_rules_by_internal_id | ( | const uint32_t * | int_rule_ids, |
| const uint32_t & | rules_nb | ||
| ) |
Deletes a list of flow ules from this flow rule cache.
@args int_rule_ids: an array of internal flow rule IDs to be deleted @args rules_nb: the number of flow rule IDs to be deleted
Deletes a list of flow rules from this flow rule cache.
@args rules_vec: a vector of flow rule IDs to be deleted
| int32_t FlowRuleCache::flush_rules_from_cache | ( | ) |
Deletes all flow rules from this flow rule cache.
| void FlowRuleCache::set_matched_packets | ( | const uint32_t & | int_rule_id, |
| uint64_t | value | ||
| ) |
Sets a flow rule's packet counter.
@args int_rule_id: an internal flow rule ID @args value: a value to set the counter
| uint64_t FlowRuleCache::get_matched_packets | ( | const uint32_t & | int_rule_id | ) |
Gets the packet counter of a flow rule.
@args int_rule_id: an internal flow rule ID
| void FlowRuleCache::set_matched_bytes | ( | const uint32_t & | int_rule_id, |
| uint64_t | value | ||
| ) |
Sets a flow rule's byte counter.
@args int_rule_id: an internal flow rule ID @args value: a value to set the counter
| uint64_t FlowRuleCache::get_matched_bytes | ( | const uint32_t & | int_rule_id | ) |
Gets the byte counter of a flow rule.
@args int_rule_id: an internal flow rule ID
| void FlowRuleCache::initialize_rule_counters | ( | uint32_t * | int_rule_ids, |
| const uint32_t & | rules_nb | ||
| ) |
Initializes a set of flow rules in the packet and byte counters' memory, increments the flow rule counter and the next flow rule ID accordingly.
@args int_rule_ids: an array of internal flow rule IDs to be initialized @args rules_nb: the number of flow rules to be initialized
| void FlowRuleCache::delete_rule_counters | ( | uint32_t * | int_rule_ids, |
| const uint32_t & | rules_nb | ||
| ) |
Deletes a set of flow rules from the packet and byte counters' memory and decrements the flow rule counter accordingly.
@args int_rule_ids: an array of internal flow rule IDs to be removed @args rules_nb: the number of flow rules to be removed
| void FlowRuleCache::cache_consistency_check | ( | const int32_t & | target_number_of_rules | ) |
Performs a run-time consistency check with respect to the desired occupancy of the flow rule cache.
@args target_number_of_rules: desired flow rule occupancy @args int_vec: list of internal rule IDs to insert @args glb_vec: list of global rule IDs to insert
| void FlowRuleCache::correlate_candidate_id_with_cache | ( | int32_t & | candidate | ) |
Correlates a given candidate max internal rule ID with the flow rule cache and updates it (if needed). For example: Cache: 4 5 6 9 21 24 25 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 47 50 56 60 63 64 65 66 Sorted Cache: 66 65 64 63 60 56 50 47 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 25 24 21 9 6 5 4 Delete: 66 65 64 63 50 47 Candidate max IDs: 66 65 64 63 Normal candidate: 63 (the least of the candidate max IDs) Real candidate: 61 (60 is the new maximum in the cache after the deletion, therefore the next ID is 60+1)
Cache: 4 5 6 9 21 24 25 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 47 50 56 60 63 64 65 66
Sorted Cache: 66 65 64 63 60 56 50 47 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 25 24 21 9 6 5 4 Delete: 66 64 63 62 50 47 Candidate max IDs: 66 Normal candidate: 66 (the least of the candidate max IDs) Real candidate: 61 (60 is the new maximum in the cache after the deletion, therefore the next ID is 60+1)
| void FlowRuleCache::flush_rule_counters | ( | ) |
Resets the flow rule counters of this flow rule cache.