/* * @name hal_driver_init * @brief Initializes driver. Before using the HAL_DRIVER routines, higher layers must allow driver to initialize itself * @ingroup driver_management */ hal_result_t hal_driver_init(hal_extension_ops_t* extensions, const char* _extra_params){ ROFL_INFO("["DRIVER_NAME"] calling hal_driver_init()\n"); //If using ROFL-PIPELINE, the physical switch must be inited //if(physical_switch_init() != ROFL_SUCCESS) // return HAL_FAILURE; //Likely here you are going to discover platform ports; //If using ROFL_pipeline you would then add them (physical_switch_add_port() //Initialize some form of background task manager //And initialize or setup any other state your platform needs... ROFL_INFO("["DRIVER_NAME"] This driver is an empty example. xDPd will not be able to bootstrap any configuration (LSIs) since it is not a functional driver, so it will throw a deliverately uncaught exception\n"); strncpy(extra_params, _extra_params, DRIVER_EXTRA_PARAMS_MAX_LEN); //We don't support any HAL extension memset(extensions, 0, sizeof(hal_extension_ops_t)); return HAL_SUCCESS; }
/** * @name fwd_module_of1x_process_packet_out * @brief Instructs driver to process a PACKET_OUT event * @ingroup of1x_fwd_module_async_event_processing * * @param dpid Datapath ID of the switch to process PACKET_OUT * @param buffer_id Buffer ID * @param in_port Port IN * @param action_group Action group to apply * @param buffer Pointer to the buffer * @param buffer_size Buffer size */ afa_result_t fwd_module_of1x_process_packet_out(uint64_t dpid, uint32_t buffer_id, uint32_t in_port, of1x_action_group_t* action_group, uint8_t* buffer, uint32_t buffer_size) { ROFL_INFO("["FWD_MOD_NAME"] calling %s()\n",__FUNCTION__); return AFA_SUCCESS; }
/* * @name hal_driver_destroy * @brief Destroy driver state. Allows platform state to be properly released. * @ingroup driver_management */ hal_result_t hal_driver_destroy(){ //In this function you allow the platform //to be properly cleaning its own state //If using the pipeline you should call //physical_switch_destroy(); ROFL_INFO("["DRIVER_NAME"] calling hal_driver_destroy()\n"); return HAL_SUCCESS; }
/* * @name hal_driver_detach_port_from_switch_at_port_num * @brief Detaches port_num of the logical switch identified with dpid * @ingroup port_management * * @param dpid Datapath ID of the switch to detach the ports * @param of_port_num Number of the port (OF number) */ hal_result_t hal_driver_detach_port_from_switch_at_port_num(uint64_t dpid, const unsigned int of_port_num){ ROFL_INFO("["DRIVER_NAME"] calling detach_port_from_switch_at_port_num()\n"); return HAL_SUCCESS; }
/** * @name hal_driver_connect_switches * @brief Attemps to connect two logical switches via a virtual port. Driver may or may not support this functionality. * @ingroup management * * @param dpid_lsi1 Datapath ID of the LSI1 * @param dpid_lsi2 Datapath ID of the LSI2 */ hal_result_t hal_driver_connect_switches(uint64_t dpid_lsi1, unsigned int* port_num1, switch_port_snapshot_t** port1, uint64_t dpid_lsi2, unsigned int* port_num2, switch_port_snapshot_t** port2){ ROFL_INFO("["DRIVER_NAME"] calling connect_switches()\n"); return HAL_SUCCESS; }
/* * @name hal_driver_detach_port_from_switch * @brief Detaches a port from the switch * @ingroup port_management * * @param dpid Datapath ID of the switch to detach the ports * @param name Port name (system's name) */ hal_result_t hal_driver_detach_port_from_switch(uint64_t dpid, const char* name){ ROFL_INFO("["DRIVER_NAME"] calling detach_port_from_switch()\n"); return HAL_SUCCESS; }
/* * @name hal_driver_destroy_switch_by_dpid * @brief Instructs the driver to destroy the switch with the specified dpid * @ingroup logical_switch_management */ hal_result_t hal_driver_destroy_switch_by_dpid(const uint64_t dpid){ ROFL_INFO("["DRIVER_NAME"] calling destroy_switch_by_dpid()\n"); return HAL_SUCCESS; }
/* * @name hal_driver_attach_physical_port_to_switch * @brief Attemps to attach a system's port to switch, at of_port_num if defined, otherwise in the first empty OF port number. * @ingroup management * * @param dpid Datapath ID of the switch to attach the ports to * @param name Port name (system's name) * @param of_port_num If *of_port_num is non-zero, try to attach to of_port_num of the logical switch, otherwise try to attach to the first available port and return the result in of_port_num */ hal_result_t hal_driver_attach_port_to_switch(uint64_t dpid, const char* name, unsigned int* of_port_num){ ROFL_INFO("["DRIVER_NAME"] calling attach_port_to_switch()\n"); return HAL_SUCCESS; }
/** * @name fwd_module_of1x_set_port_drop_received_config * @brief Instructs driver to modify port config state * @ingroup of1x_fwd_module_async_event_processing * * @param dpid Datapath ID of the switch * @param port_num Port number * @param drop_received Drop packets received */ afa_result_t fwd_module_of1x_set_port_drop_received_config(uint64_t dpid, unsigned int port_num, bool drop_received){ ROFL_INFO("["FWD_MOD_NAME"] calling %s()\n",__FUNCTION__); return AFA_SUCCESS; }
/* * @name hal_driver_create_switch * @brief Instruct driver to create an OF logical switch * @ingroup logical_switch_management * @retval Pointer to of_switch_t instance */ hal_result_t hal_driver_create_switch(char* name, uint64_t dpid, of_version_t of_version, unsigned int num_of_tables, int* ma_list){ ROFL_INFO("["DRIVER_NAME"] calling create switch. Name: %s, number of tables: %d\n",name, num_of_tables); return HAL_SUCCESS; }
/* * @name hal_driver_bring_port_down_by_num * @brief Brings down a port from an OF logical switch (and the underlying physical interface). This also triggers the PORTMOD message. * @ingroup port_management * * @param dpid DatapathID * @param port_num OF port number */ hal_result_t hal_driver_bring_port_down_by_num(uint64_t dpid, unsigned int port_num){ ROFL_INFO("["DRIVER_NAME"] calling bring_port_down_by_num()\n"); return HAL_SUCCESS; }
afa_result_t fwd_module_of1x_process_flow_mod_add(uint64_t dpid, uint8_t table_id, of1x_flow_entry_t* flow_entry, uint32_t buffer_id, bool check_overlap, bool reset_counts){ ROFL_INFO("["FWD_MOD_NAME"] calling %s()\n",__FUNCTION__); return AFA_SUCCESS; }
/** * @name fwd_module_of1x_group_mod_del * @brief Instructs driver to delete the GROUP with identification ID * @ingroup of1x_fwd_module_async_event_processing * * @param dpid Datapath ID of the switch to install the GROUP */ rofl_of1x_gm_result_t fwd_module_of1x_group_mod_delete(uint64_t dpid, uint32_t id){ ROFL_INFO("["FWD_MOD_NAME"] calling %s()\n",__FUNCTION__); return ROFL_OF1X_GM_OK; }
/** * @name fwd_module_of1x_get_group_stats * @brief Instructs driver to fetch the GROUP statistics * @ingroup of1x_fwd_module_async_event_processing * * @param dpid Datapath ID of the switch where the GROUP is */ of1x_stats_group_msg_t * fwd_module_of1x_get_group_stats(uint64_t dpid, uint32_t id){ ROFL_INFO("["FWD_MOD_NAME"] calling %s()\n",__FUNCTION__); return NULL; }
/** * @name fwd_module_of1x_group_mod_modify * @brief Instructs driver to modify the GROUP with identification ID * @ingroup of1x_fwd_module_async_event_processing * * @param dpid Datapath ID of the switch to install the GROUP */ rofl_of1x_gm_result_t fwd_module_of1x_group_mod_modify(uint64_t dpid, of1x_group_type_t type, uint32_t id, of1x_bucket_list_t *buckets){ ROFL_INFO("["FWD_MOD_NAME"] calling %s()\n",__FUNCTION__); return ROFL_OF1X_GM_OK; }
/** * @name fwd_module_of1x_get_flow_aggregate_stats * @brief Recovers the aggregated flow stats given a set of matches * @ingroup of1x_fwd_module_async_event_processing * * @param dpid Datapath ID of the switch to install the FLOW_MOD * @param table_id Table id to get the flows of * @param cookie Cookie to be applied * @param cookie_mask Mask for the cookie * @param out_port Out port that entry must include * @param out_group Out group that entry must include * @param matches Matches */ of1x_stats_flow_aggregate_msg_t* fwd_module_of1x_get_flow_aggregate_stats(uint64_t dpid, uint8_t table_id, uint32_t cookie, uint32_t cookie_mask, uint32_t out_port, uint32_t out_group, of1x_match_group_t* matches){ ROFL_INFO("["FWD_MOD_NAME"] calling %s()\n",__FUNCTION__); return NULL; }
/** * @name fwd_module_of1x_process_flow_mod_delete * @brief Instructs driver to process a FLOW_MOD event * @ingroup of1x_fwd_module_async_event_processing * * @param dpid Datapath ID of the switch to install the FLOW_MOD * @param table_id Table id to install the flowmod * @param flow_entry Flow entry to be installed * @param out_port Out port that entry must include * @param out_group Out group that entry must include * @param strictness Strictness (STRICT NON-STRICT) */ afa_result_t fwd_module_of1x_process_flow_mod_delete(uint64_t dpid, uint8_t table_id, of1x_flow_entry_t* flow_entry, uint32_t out_port, uint32_t out_group, of1x_flow_removal_strictness_t strictness){ ROFL_INFO("["FWD_MOD_NAME"] calling %s()\n",__FUNCTION__); return AFA_SUCCESS; }
/* * @name hal_driver_bring_port_down * @brief Shutdowns (brings down) a system port. If the port is attached to an OF logical switch, this also de-schedules port and triggers PORTMOD message. * @ingroup port_management * * @param name Port system name */ hal_result_t hal_driver_bring_port_down(const char* name){ ROFL_INFO("["DRIVER_NAME"] calling bring_port_down()\n"); return HAL_SUCCESS; }
/** * @name fwd_module_of1x_set_pipeline_config * @brief Instructs driver to process a PACKET_OUT event * @ingroup of1x_fwd_module_async_event_processing * * @param dpid Datapath ID of the switch * @param flags Capabilities bitmap (OF12_CAP_FLOW_STATS, OF12_CAP_TABLE_STATS, ...) * @param miss_send_len OF MISS_SEND_LEN */ afa_result_t fwd_module_of1x_set_pipeline_config(uint64_t dpid, unsigned int flags, uint16_t miss_send_len){ ROFL_INFO("["FWD_MOD_NAME"] calling %s()\n",__FUNCTION__); return AFA_SUCCESS; }
/** * @name fwd_module_of1x_set_port_generate_packet_in_config * @brief Instructs driver to modify port config state * @ingroup of1x_fwd_module_async_event_processing * * @param dpid Datapath ID of the switch * @param port_num Port number * @param generate_packet_in Generate packet in events for this port */ afa_result_t fwd_module_of1x_set_port_generate_packet_in_config(uint64_t dpid, unsigned int port_num, bool generate_packet_in){ ROFL_INFO("["FWD_MOD_NAME"] calling %s()\n",__FUNCTION__); return AFA_SUCCESS; }
/** * @name fwd_module_of1x_process_flow_mod_modify * @brief Instructs driver to process a FLOW_MOD modify event * @ingroup of1x_fwd_module_async_event_processing * * @param dpid Datapath ID of the switch to install the FLOW_MOD * @param table_id Table id from which to modify the flowmod * @param flow_entry Flow entry * @param buffer_id Buffer ID * @param strictness Strictness (STRICT NON-STRICT) * @param check_counts Check RESET_COUNTS flag */ afa_result_t fwd_module_of1x_process_flow_mod_modify(uint64_t dpid, uint8_t table_id, of1x_flow_entry_t* flow_entry, uint32_t buffer_id, of1x_flow_removal_strictness_t strictness, bool reset_counts){ ROFL_INFO("["FWD_MOD_NAME"] calling %s()\n",__FUNCTION__); return AFA_SUCCESS; }
/** * @name fwd_module_of1x_set_port_advertise_config * @brief Instructs driver to modify port advertise flags * @ingroup of1x_fwd_module_async_event_processing * * @param dpid Datapath ID of the switch * @param port_num Port number * @param advertise Bitmap advertised */ afa_result_t fwd_module_of1x_set_port_advertise_config(uint64_t dpid, unsigned int port_num, uint32_t advertise){ ROFL_INFO("["FWD_MOD_NAME"] calling %s()\n",__FUNCTION__); return AFA_SUCCESS; }
/** * @name fwd_module_of1x_set_table_config * @brief Instructs driver to set table configuration(default action) * @ingroup of1x_fwd_module_async_event_processing * * @param dpid Datapath ID of the switch * @param table_id Table ID or 0xFF for all * @param miss_send_len Table miss config */ afa_result_t fwd_module_of1x_set_table_config(uint64_t dpid, unsigned int table_id, of1x_flow_table_miss_config_t config){ ROFL_INFO("["FWD_MOD_NAME"] calling %s()\n",__FUNCTION__); return AFA_SUCCESS; }