Skip to content

Commit

Permalink
[vs] Respect fdb learning mode on VS (#667)
Browse files Browse the repository at this point in the history
  • Loading branch information
kcudnik authored Oct 7, 2020
1 parent e294f96 commit 924cb46
Showing 1 changed file with 33 additions and 5 deletions.
38 changes: 33 additions & 5 deletions vslib/src/SwitchStateBaseFdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,13 +547,41 @@ void SwitchStateBase::process_packet_for_fdb_event(
return;
}

SWSS_LOG_INFO("inserting to fdb_info set: %s, vlan id: %d",
sai_serialize_fdb_entry(fi.getFdbEntry()).c_str(),
fi.getVlanId());
sai_attribute_t attr;

attr.id = SAI_BRIDGE_PORT_ATTR_FDB_LEARNING_MODE;

sai_status_t status = get(SAI_OBJECT_TYPE_BRIDGE_PORT, fi.getBridgePortId(), 1, &attr);

if (status == SAI_STATUS_SUCCESS)
{
if (attr.value.s32 == SAI_BRIDGE_PORT_FDB_LEARNING_MODE_HW)
{
SWSS_LOG_INFO("inserting to fdb_info set: %s, vlan id: %d",
sai_serialize_fdb_entry(fi.getFdbEntry()).c_str(),
fi.getVlanId());

m_fdb_info_set.insert(fi);
m_fdb_info_set.insert(fi);

processFdbInfo(fi, SAI_FDB_EVENT_LEARNED);
processFdbInfo(fi, SAI_FDB_EVENT_LEARNED);
}
else if (attr.value.s32 == SAI_BRIDGE_PORT_FDB_LEARNING_MODE_DISABLE)
{
// do not learn, actually linux kernel will learn that MAC
}
else
{
SWSS_LOG_WARN("not supported SAI_BRIDGE_PORT_ATTR_FDB_LEARNING_MODE: %d, for %s",
attr.value.s32,
sai_serialize_fdb_entry(fi.getFdbEntry()).c_str());
}
}
else
{
SWSS_LOG_ERROR("failed to get SAI_BRIDGE_PORT_ATTR_FDB_LEARNING_MODE for %s: %s",
sai_serialize_object_id(fi.getBridgePortId()).c_str(),
sai_serialize_status(status).c_str());
}
}

void SwitchStateBase::send_fdb_event_notification(
Expand Down

0 comments on commit 924cb46

Please sign in to comment.