VOM fixes for 9090 - ships in the night commits 76/9176/1
authorNeale Ranns <neale.ranns@cisco.com>
Wed, 1 Nov 2017 10:29:13 +0000 (03:29 -0700)
committerNeale Ranns <neale.ranns@cisco.com>
Wed, 1 Nov 2017 10:29:13 +0000 (03:29 -0700)
Change-Id: I4b03a4f86a7e0e47874715398ca9f8ff0f5386ee
Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
src/vpp-api/vom/bridge_domain_entry.cpp
src/vpp-api/vom/bridge_domain_entry_cmds.cpp
src/vpp-api/vom/types.cpp
src/vpp-api/vom/types.hpp

index 4041e31..7a1245b 100644 (file)
@@ -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);
   }
 }
index ad0786f..990af06 100644 (file)
@@ -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());
index c362a60..128d757 100644 (file)
@@ -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<uint8_t*>(&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
 {
index fd3b24b..ca488fe 100644 (file)
@@ -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<uint8_t> bytes);
   /**
@@ -254,11 +253,6 @@ struct mac_address_t
    */
   std::string to_string() const;
 
-  /**
-   * U64 conversion
-   */
-  uint64_t to_u64() const;
-
   /**
    * Underlying bytes array
    */