6 #include "../../../platform/lock.h"
7 #include "../../../platform/likely.h"
8 #include "../../../platform/memory.h"
9 #include "../../../platform/atomic_operations.h"
10 #include "../of1x_async_events_hooks.h"
11 #include "matching_algorithms/matching_algorithms.h"
12 #include "../of1x_switch.h"
14 #include "../../../util/logging.h"
21 rofl_result_t __of1x_init_pipeline(
struct of1x_switch* sw,
const unsigned int num_of_tables,
enum of1x_matching_algorithm_available* list){
30 if( ! (num_of_tables <= OF1X_MAX_FLOWTABLES && num_of_tables > 0) )
36 pipeline->num_of_tables = num_of_tables;
37 pipeline->num_of_buffers = 0;
43 if(!pipeline->tables){
47 for(i=0;i<num_of_tables;i++){
49 if( (list[i] >= of1x_matching_algorithm_count) ||
50 (__of1x_init_table(pipeline, &pipeline->tables[i],i, list[i]) != ROFL_SUCCESS)
52 ROFL_PIPELINE_ERR(
"Creation of table #%d has failed in logical switch %s. This might be due to an invalid Matching Algorithm or that the system has run out of memory. Aborting Logical Switch creation\n",i,sw->name);
55 __of1x_destroy_table(&pipeline->tables[i]);
69 pipeline->capabilities = OF1X_CAP_FLOW_STATS |
70 OF1X_CAP_TABLE_STATS |
72 OF1X_CAP_GROUP_STATS |
80 pipeline->miss_send_len = OF1X_DEFAULT_MISS_SEND_LEN;
95 for(i=0; i<pipeline->num_of_tables; i++){
97 __of1x_destroy_table(&pipeline->tables[i]);
107 rofl_result_t __of1x_purge_pipeline_entries(
of1x_pipeline_t* pipeline){
110 rofl_result_t result = ROFL_SUCCESS;
118 if( unlikely(flow_entry==NULL) )
120 if( unlikely(group_entry==NULL) ){
126 for(i=OF1X_FIRST_FLOW_TABLE_INDEX; i < pipeline->num_of_tables ; i++){
130 result = ROFL_FAILURE;
136 if(result == ROFL_SUCCESS){
138 result = ROFL_FAILURE;
149 rofl_result_t __of1x_set_pipeline_tables_defaults(
of1x_pipeline_t* pipeline, of_version_t version){
154 for(i=OF1X_FIRST_FLOW_TABLE_INDEX; i < pipeline->num_of_tables ; i++){
157 __of10_set_table_defaults(&pipeline->tables[i]);
160 __of12_set_table_defaults(&pipeline->tables[i]);
161 __of12_set_group_table_defaults(pipeline->groups);
164 __of13_set_table_defaults(&pipeline->tables[i]);
165 __of13_set_group_table_defaults(pipeline->groups);
198 memcpy(sn->tables, pipeline->tables,
sizeof(
of1x_flow_table_t)*pipeline->num_of_tables);
201 for(i=0;i<pipeline->num_of_tables;i++){
207 __of1x_stats_table_consolidate(&t->stats, &c);
213 t->stats.s.counters = c;
217 #if OF1X_TIMER_STATIC_ALLOCATION_SLOTS
224 sn->num_of_tables = pipeline->num_of_tables;
225 sn->num_of_buffers = pipeline->num_of_buffers;
226 sn->capabilities = pipeline->capabilities;
227 sn->miss_send_len = pipeline->miss_send_len;
240 sn->groups->head = sn->groups->tail = sn->groups->rwlock = NULL;
of1x_flow_entry_t * of1x_init_flow_entry(bool notify_removal)
Create an empty flow entry.
OpenFlow v1.0, 1.2 and 1.3.2 pipeline abstraction.
OpenFlow v1.0, 1.2 and 1.3.2 flow table abstraction.
OpenFlow-enabled v1.0, 1.2 and 1.3.2 switch abstraction.
OpenFlow v1.0, 1.2 and 1.3.2 flow entry structure.
rofl_result_t of1x_remove_flow_entry_table(of1x_pipeline_t *const pipeline, const unsigned int table_id, of1x_flow_entry_t *entry, const enum of1x_flow_removal_strictness strict, uint32_t out_port, uint32_t out_group)
Removes a flow_entry from the table.
OpenFlow v1.X instructions.
OpenFlow v1.0, 1.2 and 1.3.2 flow table abstraction.
of1x_group_table_t * of1x_init_group_table(struct of1x_pipeline *pipeline)
Initializes the group table.
void of1x_destroy_group_table(of1x_group_table_t *gt)
Destroys the group table.
OpenFlow v1.0, 1.2 and 1.3.2 timers subsystem.
rofl_of1x_gm_result_t of1x_group_delete(of1x_pipeline_t *pipeline, of1x_group_table_t *gt, uint32_t id)
Deletes a group of the table.
matching_auxiliary_t * matching_aux[2]
Place-holder to allow matching algorithms keep its own state.
rofl_result_t of1x_destroy_flow_entry(of1x_flow_entry_t *entry)
Destroy the flow entry, including stats, instructions and actions.
OpenFlow v1.0, 1.2 and 1.3.2 pipeline abstraction data structure.
OpenFlow v1.0, 1.2 and 1.3.2 group table subsystem.