5 #ifndef __OF1X_PIPELINE_PP_H__
6 #define __OF1X_PIPELINE_PP_H__
9 #include "../../../util/pp_guard.h"
10 #include "../of1x_switch.h"
12 #include "of1x_flow_table_pp.h"
25 #include "../../../platform/lock.h"
26 #include "../../../platform/likely.h"
27 #include "../../../platform/memory.h"
28 #include "../../../platform/packet.h"
29 #include "../../../platform/atomic_operations.h"
30 #include "../of1x_async_events_hooks.h"
32 #include "matching_algorithms/available_ma_pp.h"
34 #include "../../../util/logging.h"
52 static inline void __of1x_process_packet_pipeline(
const unsigned int tid,
const of_switch_t *sw,
datapacket_t *
const pkt){
55 unsigned int i, table_to_go, num_of_outputs;
60 __init_packet_metadata(pkt);
61 __of1x_init_packet_write_actions(&pkt->write_actions.of1x);
66 ROFL_PIPELINE_INFO(
"Packet[%p] entering switch %s [%p] pipeline (1.X)\n",pkt,sw->name, sw);
68 for(i=OF1X_FIRST_FLOW_TABLE_INDEX; i < ((
of1x_switch_t*)sw)->pipeline.num_of_tables ; i++){
72 #ifdef ROFL_PIPELINE_LOCKLESS
74 tid_mark_as_present(tid, &table->tid_presence_mask);
84 if(likely(match != NULL)){
87 pkt->__cookie = match->cookie;
89 ROFL_PIPELINE_INFO(
"Packet[%p] matched at table: %u, entry: %p\n", pkt, i,match);
92 __of1x_stats_table_update_match(tid, &table->stats);
100 if(table_to_go > i && likely(table_to_go < OF1X_MAX_FLOWTABLES)){
102 ROFL_PIPELINE_INFO(
"Packet[%p] Going to table %u->%u\n",pkt, i,table_to_go);
105 #ifdef ROFL_PIPELINE_LOCKLESS
107 tid_mark_as_not_present(tid, &table->tid_presence_mask);
116 __of1x_process_write_actions(tid, (
of1x_switch_t*)sw, i, pkt, __of1x_process_instructions_must_replicate(&match->inst_grp));
119 num_of_outputs = match->inst_grp.num_of_outputs;
121 #ifdef ROFL_PIPELINE_LOCKLESS
123 tid_mark_as_not_present(tid, &table->tid_presence_mask);
131 if(num_of_outputs != 1)
136 #ifdef ROFL_PIPELINE_LOCKLESS
138 tid_mark_as_not_present(tid, &table->tid_presence_mask);
142 __of1x_stats_table_update_no_match(tid, &table->stats);
145 if(table->default_action == OF1X_TABLE_MISS_DROP){
147 ROFL_PIPELINE_INFO(
"Packet[%p] table MISS_DROP %u\n",pkt, i);
151 }
else if(table->default_action == OF1X_TABLE_MISS_CONTROLLER){
153 ROFL_PIPELINE_INFO(
"Packet[%p] table MISS_CONTROLLER. Generating a PACKET_IN event towards the controller\n",pkt);
173 bool has_multiple_outputs=
false;
181 ROFL_PIPELINE_INFO(
"Packet[%p] Processing PKT_OUT, action group: ",pkt);
183 ROFL_PIPELINE_INFO_NO_PREFIX(
"\n");
186 if(apply_actions_group->num_of_output_actions == 0){
188 ROFL_PIPELINE_INFO(
"Packet[%p] WARNING: dropping! No output/group actions.\n",pkt);
193 has_multiple_outputs = (apply_actions_group->num_of_output_actions > 1);
197 __of1x_process_apply_actions(tid, (
of1x_switch_t*)sw, 0, pkt, apply_actions_group, has_multiple_outputs, &reinject_pkt);
201 __of1x_process_packet_pipeline(ROFL_PIPELINE_LOCKED_TID, (
const of_switch_t*)sw, reinject_pkt);
203 if(has_multiple_outputs){
205 ROFL_PIPELINE_DEBUG(
"Packet[%p] Dropping original pkt (previously cloned due to multiple output actions).\n", pkt);
213 #endif //OF1X_PIPELINE_PP
OpenFlow-enabled switch abstraction (version-indepedent part).
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.
static void of1x_process_packet_out_pipeline(const unsigned int tid, const of1x_switch_t *sw, datapacket_t *const pkt, const of1x_action_group_t *apply_actions_group)
Processes a packet-out through the OpenFlow pipeline.
OpenFlow v1.0, 1.2 and 1.3.2 flow entry structure.
OpenFlow v1.X instructions.
Statistics related to packet processing routines.
OpenFlow v1.0, 1.2 and 1.3.2 flow table abstraction.
OpenFlow v1.0, 1.2 and 1.3.2 actions.
Action group (apply-actions) structure.
OpenFlow v1.0, 1.2 and 1.3.2 timers subsystem.
void platform_of1x_packet_in(const of1x_switch_t *sw, uint8_t table_id, datapacket_t *pkt, uint16_t send_len, of_packet_in_reason_t reason)
Packet in event notification.
static unsigned int __of1x_process_instructions(const unsigned int tid, const struct of1x_switch *sw, const unsigned int table_id, datapacket_t *const pkt, const of1x_instruction_group_t *instructions)
void dump_packet_matches(datapacket_t *const pkt, bool raw_nbo)
Dump the values of packet (header values)
OpenFlow v1.X instructions packet processing routines.
OpenFlow v1.0, 1.2 and 1.3.2 group table subsystem.