From f29e85f9fa888e5544b19db78a752c03337ca14d Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Wed, 1 Nov 2017 03:29:13 -0700 Subject: VOM fixes for 9090 - ships in the night commits Change-Id: I4b03a4f86a7e0e47874715398ca9f8ff0f5386ee Signed-off-by: Neale Ranns --- src/vpp-api/vom/bridge_domain_entry.cpp | 16 ++++++++-------- src/vpp-api/vom/bridge_domain_entry_cmds.cpp | 4 ++-- src/vpp-api/vom/types.cpp | 27 --------------------------- src/vpp-api/vom/types.hpp | 6 ------ 4 files changed, 10 insertions(+), 43 deletions(-) (limited to 'src/vpp-api') diff --git a/src/vpp-api/vom/bridge_domain_entry.cpp b/src/vpp-api/vom/bridge_domain_entry.cpp index 4041e315352..7a1245b0f4d 100644 --- a/src/vpp-api/vom/bridge_domain_entry.cpp +++ b/src/vpp-api/vom/bridge_domain_entry.cpp @@ -39,8 +39,8 @@ bridge_domain_entry::bridge_domain_entry(const mac_address_t& mac, , m_tx_itf(tx_itf.singular()) { /* - * the route goes in the default table - */ + * the entry goes in the default bridge-domain + */ bridge_domain bd(bridge_domain::DEFAULT_TABLE); m_bd = bd.singular(); @@ -92,8 +92,8 @@ void bridge_domain_entry::update(const bridge_domain_entry& r) { /* - * create the table if it is not yet created - */ + * create the table if it is not yet created + */ if (rc_t::OK != m_hw.rc()) { HW::enqueue(new create_cmd(m_hw, m_mac, m_bd->id(), m_tx_itf->handle())); } @@ -151,10 +151,10 @@ bridge_domain_entry::event_handler::handle_populate(const client_db::key_t& key) << mac.to_string() << itf->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 - */ + * 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, bd_e); } } diff --git a/src/vpp-api/vom/bridge_domain_entry_cmds.cpp b/src/vpp-api/vom/bridge_domain_entry_cmds.cpp index ad0786faa01..990af069a90 100644 --- a/src/vpp-api/vom/bridge_domain_entry_cmds.cpp +++ b/src/vpp-api/vom/bridge_domain_entry_cmds.cpp @@ -42,7 +42,7 @@ bridge_domain_entry::create_cmd::issue(connection& con) auto& payload = req.get_request().get_payload(); payload.bd_id = m_bd; payload.is_add = 1; - payload.mac = m_mac.to_u64(); + m_mac.to_bytes(payload.mac, 6); payload.sw_if_index = m_tx_itf.value(); VAPI_CALL(req.execute()); @@ -85,7 +85,7 @@ bridge_domain_entry::delete_cmd::issue(connection& con) auto& payload = req.get_request().get_payload(); payload.bd_id = m_bd; payload.is_add = 1; - payload.mac = m_mac.to_u64(); + m_mac.to_bytes(payload.mac, 6); payload.sw_if_index = ~0; VAPI_CALL(req.execute()); diff --git a/src/vpp-api/vom/types.cpp b/src/vpp-api/vom/types.cpp index c362a608275..128d757e539 100644 --- a/src/vpp-api/vom/types.cpp +++ b/src/vpp-api/vom/types.cpp @@ -101,16 +101,6 @@ operator<<(std::ostream& os, const handle_t& h) return (os); } -mac_address_t::mac_address_t(uint64_t address) -{ - uint8_t mac[6]; - - std::memcpy(mac, &address, 6); - for (int i = 0; i < 6; i++) { - bytes[i] = mac[5 - i]; - } -} - mac_address_t::mac_address_t(uint8_t b[6]) { std::copy(b, b + 6, std::begin(bytes)); @@ -133,23 +123,6 @@ mac_address_t::to_bytes(uint8_t* array, uint8_t len) const } } -uint64_t -mac_address_t::to_u64() const -{ - uint64_t mac6 = 0; - uint8_t* b = reinterpret_cast(&mac6); - - // whack hack. the vapi will byte swap. - b[2] = bytes[5]; - b[3] = bytes[4]; - b[4] = bytes[3]; - b[5] = bytes[2]; - b[6] = bytes[1]; - b[7] = bytes[0]; - - return (mac6); -} - std::string mac_address_t::to_string() const { diff --git a/src/vpp-api/vom/types.hpp b/src/vpp-api/vom/types.hpp index fd3b24b64ca..ca488fe4029 100644 --- a/src/vpp-api/vom/types.hpp +++ b/src/vpp-api/vom/types.hpp @@ -221,7 +221,6 @@ std::ostream& operator<<(std::ostream& os, const handle_t& h); */ struct mac_address_t { - mac_address_t(uint64_t address); mac_address_t(uint8_t bytes[6]); mac_address_t(std::initializer_list bytes); /** @@ -254,11 +253,6 @@ struct mac_address_t */ std::string to_string() const; - /** - * U64 conversion - */ - uint64_t to_u64() const; - /** * Underlying bytes array */ -- cgit 1.2.3-korg