X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=extras%2Fvom%2Fvom%2Finterface.cpp;h=c1894c2fbdf2ec9b426c65303bd526b4ef3b9ce4;hb=7e9affb696fcfd8f22cdce0caf46b1e2f25c5799;hp=4f26ac80313639e1b961a47bc09ad73cff530bcd;hpb=9aca7b5ee915b8035fb5b690b7520ab155fcb36e;p=vpp.git diff --git a/extras/vom/vom/interface.cpp b/extras/vom/vom/interface.cpp index 4f26ac80313..c1894c2fbdf 100644 --- a/extras/vom/vom/interface.cpp +++ b/extras/vom/vom/interface.cpp @@ -38,6 +38,11 @@ std::map> interface::m_hdl_db; interface::event_handler interface::m_evh; +/** + * the event enable command. + */ +std::shared_ptr interface::m_events_cmd; + /** * Construct a new object matching the desried state */ @@ -287,7 +292,7 @@ interface::mk_create_cmd(std::queue& q) q.push(new interface_cmds::af_packet_create_cmd(m_hdl, m_name)); if (!m_tag.empty()) q.push(new interface_cmds::set_tag(m_hdl, m_tag)); - } else if (type_t::TAP == m_type || type_t::TAPV2 == m_type) { + } else if (type_t::TAPV2 == m_type) { if (!m_tag.empty()) q.push(new interface_cmds::set_tag(m_hdl, m_tag)); } else if (type_t::VHOST == m_type) { @@ -485,6 +490,20 @@ interface::dump(std::ostream& os) db_dump(m_db, os); } +void +interface::enable_events(interface::event_listener& el) +{ + m_events_cmd = std::make_shared(el); + HW::enqueue(m_events_cmd); + HW::write(); +} + +void +interface::disable_events() +{ + m_events_cmd.reset(); +} + void interface::event_handler::handle_populate(const client_db::key_t& key) { @@ -522,28 +541,6 @@ interface::event_handler::handle_populate(const client_db::key_t& key) OM::commit(key, *afitf); } - /* - * dump VPP tap interfaces - */ - std::shared_ptr tapcmd = - std::make_shared(); - - HW::enqueue(tapcmd); - HW::write(); - - for (auto& tap_record : *tapcmd) { - std::shared_ptr tapitf = - interface_factory::new_tap_interface(tap_record.get_payload()); - VOM_LOG(log_level_t::DEBUG) << "tap-dump: " << tapitf->to_string(); - - /* - * Write each of the discovered interfaces into the OM, - * but disable the HW Command q whilst we do, so that no - * commands are sent to VPP - */ - OM::commit(key, *tapitf); - } - /* * dump VPP tapv2 interfaces */ @@ -555,7 +552,7 @@ interface::event_handler::handle_populate(const client_db::key_t& key) for (auto& tapv2_record : *tapv2cmd) { std::shared_ptr tapv2itf = - interface_factory::new_tap_v2_interface(tapv2_record.get_payload()); + interface_factory::new_tap_interface(tapv2_record.get_payload()); VOM_LOG(log_level_t::DEBUG) << "tapv2-dump: " << tapv2itf->to_string(); /*