From 9ef1c0adbf9399c55deeede3cf629dd4e8c20304 Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Fri, 3 Nov 2017 04:39:05 -0700 Subject: VOM reshuffle split the VOM into two halves; a top/front-end and a bottom/backend. Only the backend includes the auto-generated VAPI. This serves two purposes: 1 - improves ompile times for VOM, since the VAPI is included only in the backend. 2 - does not expose VAPI to users of VOM Change-Id: I17b93aeaef10c0eba8612016d9034aca5628d9f7 Signed-off-by: Neale Ranns Signed-off-by: Mohsin Kazmi --- src/vpp-api/vom/acl_list.cpp | 86 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 82 insertions(+), 4 deletions(-) (limited to 'src/vpp-api/vom/acl_list.cpp') diff --git a/src/vpp-api/vom/acl_list.cpp b/src/vpp-api/vom/acl_list.cpp index 129be8faefe..0c92c02ad22 100644 --- a/src/vpp-api/vom/acl_list.cpp +++ b/src/vpp-api/vom/acl_list.cpp @@ -14,6 +14,7 @@ */ #include "vom/acl_list.hpp" +#include "vom/acl_list_cmds.hpp" #include "vom/logger.hpp" namespace VOM { @@ -28,7 +29,7 @@ l2_list::event_handler::handle_populate(const client_db::key_t& key) /* * dump VPP Bridge domains */ - std::shared_ptr cmd(new l2_list::dump_cmd()); + std::shared_ptr cmd(new list_cmds::l2_dump_cmd()); HW::enqueue(cmd); HW::write(); @@ -69,7 +70,7 @@ l3_list::event_handler::handle_populate(const client_db::key_t& key) /* * dump VPP Bridge domains */ - std::shared_ptr cmd(new l3_list::dump_cmd()); + std::shared_ptr cmd(new list_cmds::l3_dump_cmd()); HW::enqueue(cmd); HW::write(); @@ -101,8 +102,85 @@ l3_list::event_handler::handle_populate(const client_db::key_t& key) OM::commit(key, acl); } } -}; -}; + +template <> +void +l3_list::update(const l3_list& obj) +{ + /* + * always update the instance with the latest rule set + */ + if (!m_hdl || obj.m_rules != m_rules) { + HW::enqueue(new list_cmds::l3_update_cmd(m_hdl, m_key, m_rules)); + } + /* + * We don't, can't, read the priority from VPP, + * so the is equals check above does not include the priorty. + * but we save it now. + */ + m_rules = obj.m_rules; +} +template <> +void +l2_list::update(const l2_list& obj) +{ + /* + * always update the instance with the latest rule set + */ + if (!m_hdl || obj.m_rules != m_rules) { + HW::enqueue(new list_cmds::l2_update_cmd(m_hdl, m_key, m_rules)); + } + /* + * We don't, can't, read the priority from VPP, + * so the is equals check above does not include the priorty. + * but we save it now. + */ + m_rules = obj.m_rules; +} +/** + * Sweep/reap the object if still stale + */ +template <> +void +l3_list::sweep(void) +{ + if (m_hdl) { + HW::enqueue(new list_cmds::l3_delete_cmd(m_hdl)); + } + HW::write(); +} +template <> +void +l2_list::sweep(void) +{ + if (m_hdl) { + HW::enqueue(new list_cmds::l2_delete_cmd(m_hdl)); + } + HW::write(); +} + +/** + * Replay the objects state to HW + */ +template <> +void +l3_list::replay(void) +{ + if (m_hdl) { + HW::enqueue(new list_cmds::l3_update_cmd(m_hdl, m_key, m_rules)); + } +} +template <> +void +l2_list::replay(void) +{ + if (m_hdl) { + HW::enqueue(new list_cmds::l2_update_cmd(m_hdl, m_key, m_rules)); + } +} + +}; // namespace ACL +}; // namespace VOM /* * fd.io coding-style-patch-verification: ON -- cgit 1.2.3-korg