, 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();
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()));
}
<< 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);
}
}
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());
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());
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));
}
}
-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
{
*/
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);
/**
*/
std::string to_string() const;
- /**
- * U64 conversion
- */
- uint64_t to_u64() const;
-
/**
* Underlying bytes array
*/