此處主要記錄OpenvSwitch 功能實現的調用過程:bash
註冊用戶態接收包時回調函數: construct | | open_dpif_backer / \ (dpif-netdev) / \(dpif-net-link) / \ udpif_create udpif_set_threads | | dpif_register_upcall_cb udpif_start_threads | | dpif_netdev_register_upcall_cb ovs_thread_create | udpif_upcall_handler (* 接收到內核態的請求) | recv_upcalls / \ (2) / \ (1) / \ upcall_receive dpif_recv | | flow_extract dpif_netlink_recv | process_upcall | upcall_xlate | xlate_actions
處理controller發送的packetout數據包: ofconn_run | handle_openflow | handle_packet_out / \ (2) / \(1) / \ ofproto_packet_out_finish ofproto_packet_out_start | | packet_execute packet_xlate | | dpif_execute xlate_actions | | dpif_operate rule_dpif_lookup_from_table (dpif-netdev) / \(dpif-netlink) | / \ rule_dpif_lookup_in_table dpif_netdev_operate dpif_netlink_operate / \ | | (2) / \(1) dpif_netdev_execute dpif_netlink_encode_execute / \ | | do_xlate_actions classifier_lookup dp_netdev_execute_actions nl_msg_put_genlmsghdr | | | xlate_output_action find_match_wc odp_execute_actions | | compose_output_action dp_execute_cb | | nl_msg_put_odp_port netdev_send
內核態Datapath處理packet流程: netdev_frame_hook | netdev_port_receive | ovs_vport_receive | ovs_dp_process_packet / \ (Normal Match)/ \ (Non-normal Match) / \ ovs_execute_actions ovs_dp_upcall | queue_userspace_packet | genlmsg_unicast
用戶態Datapath處理packet流程: pmd_thread_main dpif_netdev_run \ / \ / dp_netdev_process_rxq_port | dp_netdev_input | fast_path_processing | handle_packet_upcall / \ (2) / \(1) / \ dp_netdev_execute_actions dp_netdev_upcall | | odp_execute_actions upcall_cb(調用註冊的回調函數) | dp_execute_cb | netdev_send