Skip to content

Commit

Permalink
Revert "Mclag enhacements support code changes. (#1331)"
Browse files Browse the repository at this point in the history
This reverts commit 7aca82d.
  • Loading branch information
neethajohn authored Aug 4, 2021
1 parent 7aca82d commit def23bf
Show file tree
Hide file tree
Showing 19 changed files with 53 additions and 2,450 deletions.
162 changes: 1 addition & 161 deletions fdbsyncd/fdbsync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ FdbSync::FdbSync(RedisPipeline *pipelineAppDB, DBConnector *stateDb, DBConnector
m_fdbTable(pipelineAppDB, APP_VXLAN_FDB_TABLE_NAME),
m_imetTable(pipelineAppDB, APP_VXLAN_REMOTE_VNI_TABLE_NAME),
m_fdbStateTable(stateDb, STATE_FDB_TABLE_NAME),
m_mclagRemoteFdbStateTable(stateDb, STATE_MCLAG_REMOTE_FDB_TABLE_NAME),
m_cfgEvpnNvoTable(config_db, CFG_VXLAN_EVPN_NVO_TABLE_NAME)
{
m_AppRestartAssist = new AppRestartAssist(pipelineAppDB, "fdbsyncd", "swss", DEFAULT_FDBSYNC_WARMSTART_TIMER);
Expand All @@ -44,6 +43,7 @@ FdbSync::~FdbSync()
}
}


// Check if interface entries are restored in kernel
bool FdbSync::isIntfRestoreDone()
{
Expand Down Expand Up @@ -180,69 +180,6 @@ void FdbSync::processStateFdb()
}
}

void FdbSync::processStateMclagRemoteFdb()
{
struct m_fdb_info info;
std::deque<KeyOpFieldsValuesTuple> entries;

m_mclagRemoteFdbStateTable.pops(entries);

int count =0 ;
for (auto entry: entries)
{
count++;
std::string key = kfvKey(entry);
std::string op = kfvOp(entry);

std::size_t delimiter = key.find_first_of(":");
auto vlan_name = key.substr(0, delimiter);
auto mac_address = key.substr(delimiter+1);

info.vid = vlan_name;
info.mac = mac_address;

if(op == "SET")
{
info.op_type = FDB_OPER_ADD ;
}
else
{
info.op_type = FDB_OPER_DEL ;
}

SWSS_LOG_INFO("FDBSYNCD STATE FDB updates key=%s, operation=%s\n", key.c_str(), op.c_str());

for (auto i : kfvFieldsValues(entry))
{
SWSS_LOG_INFO(" FDBSYNCD STATE FDB updates : "
"FvFiels %s, FvValues: %s \n", fvField(i).c_str(), fvValue(i).c_str());

if(fvField(i) == "port")
{
info.port_name = fvValue(i);
}

if(fvField(i) == "type")
{
if(fvValue(i) == "dynamic")
{
info.type = FDB_TYPE_DYNAMIC;
}
else if (fvValue(i) == "static")
{
info.type = FDB_TYPE_STATIC;
}
}
}

if (op != "SET" && macCheckSrcDB(&info) == false)
{
continue;
}
updateMclagRemoteMac(&info);
}
}

void FdbSync::macUpdateCache(struct m_fdb_info *info)
{
string key = info->vid + ":" + info->mac;
Expand All @@ -252,15 +189,6 @@ void FdbSync::macUpdateCache(struct m_fdb_info *info)
return;
}

void FdbSync::macUpdateMclagRemoteCache(struct m_fdb_info *info)
{
string key = info->vid + ":" + info->mac;
m_mclag_remote_fdb_mac[key].port_name = info->port_name;
m_mclag_remote_fdb_mac[key].type = info->type;

return;
}

bool FdbSync::macCheckSrcDB(struct m_fdb_info *info)
{
string key = info->vid + ":" + info->mac;
Expand Down Expand Up @@ -403,84 +331,6 @@ void FdbSync::addLocalMac(string key, string op)
return;
}

void FdbSync::updateMclagRemoteMac (struct m_fdb_info *info)
{
char *op;
char *type;
string port_name = "";
string key = info->vid + ":" + info->mac;
short fdb_type; /*dynamic or static*/

if (info->op_type == FDB_OPER_ADD)
{
macUpdateMclagRemoteCache(info);
op = "replace";
port_name = info->port_name;
fdb_type = info->type;
}
else
{
op = "del";
port_name = m_mclag_remote_fdb_mac[key].port_name;
fdb_type = m_mclag_remote_fdb_mac[key].type;
m_mclag_remote_fdb_mac.erase(key);
}

if (fdb_type == FDB_TYPE_DYNAMIC)
{
type = "dynamic";
}
else
{
type = "static";
}

const std::string cmds = std::string("")
+ " bridge fdb " + op + " " + info->mac + " dev "
+ port_name + " master " + type + " vlan " + info->vid.substr(4);

std::string res;
int ret = swss::exec(cmds, res);

SWSS_LOG_INFO("cmd:%s, res=%s, ret=%d", cmds.c_str(), res.c_str(), ret);

return;
}

void FdbSync::updateMclagRemoteMacPort(int ifindex, int vlan, std::string mac)
{
string key = "Vlan" + to_string(vlan) + ":" + mac;
int type = 0;
string port_name = "";

SWSS_LOG_INFO("Updating Intf %d, Vlan:%d MAC:%s Key %s", ifindex, vlan, mac.c_str(), key.c_str());

if (m_mclag_remote_fdb_mac.find(key) != m_mclag_remote_fdb_mac.end())
{
type = m_mclag_remote_fdb_mac[key].type;
port_name = m_mclag_remote_fdb_mac[key].port_name;
SWSS_LOG_INFO(" port %s, type %d\n", port_name.c_str(), type);

if (type == FDB_TYPE_STATIC)
{
const std::string cmds = std::string("")
+ " bridge fdb replace" + " " + mac + " dev "
+ port_name + " master static vlan " + to_string(vlan);

std::string res;
int ret = swss::exec(cmds, res);
if (ret != 0)
{
SWSS_LOG_NOTICE("Failed cmd:%s, res=%s, ret=%d", cmds.c_str(), res.c_str(), ret);
return;
}

SWSS_LOG_NOTICE("Update cmd:%s, res=%s, ret=%d", cmds.c_str(), res.c_str(), ret);
}
}
return;
}

/*
* This is a special case handling where mac is learned in the ASIC.
* Then MAC is learned in the Kernel, Since this mac is learned in the Kernel
Expand Down Expand Up @@ -723,16 +573,6 @@ void FdbSync::onMsgNbr(int nlmsg_type, struct nl_object *obj)

if (isVxlanIntf == false)
{
if (nlmsg_type == RTM_NEWNEIGH)
{
int vid = rtnl_neigh_get_vlan(neigh);
int state = rtnl_neigh_get_state(neigh);
if (state & NUD_PERMANENT)
{
updateMclagRemoteMacPort(ifindex, vid, macStr);
}
}

if (nlmsg_type != RTM_DELNEIGH)
{
return;
Expand Down
18 changes: 1 addition & 17 deletions fdbsyncd/fdbsync.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,13 @@ class FdbSync : public NetMsg
return &m_fdbStateTable;
}

SubscriberStateTable *getMclagRemoteFdbStateTable()
{
return &m_mclagRemoteFdbStateTable;
}

SubscriberStateTable *getCfgEvpnNvoTable()
{
return &m_cfgEvpnNvoTable;
}

void processStateFdb();

void processStateMclagRemoteFdb();

void processCfgEvpnNvo();

bool m_reconcileDone = false;
Expand All @@ -88,7 +81,6 @@ class FdbSync : public NetMsg
ProducerStateTable m_fdbTable;
ProducerStateTable m_imetTable;
SubscriberStateTable m_fdbStateTable;
SubscriberStateTable m_mclagRemoteFdbStateTable;
AppRestartAssist *m_AppRestartAssist;
SubscriberStateTable m_cfgEvpnNvoTable;

Expand All @@ -97,9 +89,7 @@ class FdbSync : public NetMsg
std::string port_name;
short type;/*dynamic or static*/
};
std::unordered_map<std::string, m_local_fdb_info> m_fdb_mac;

std::unordered_map<std::string, m_local_fdb_info> m_mclag_remote_fdb_mac;
std::unordered_map<std::string, m_local_fdb_info> m_fdb_mac;

void macDelVxlanEntry(std::string auxkey, struct m_fdb_info *info);

Expand All @@ -113,12 +103,6 @@ class FdbSync : public NetMsg

void macRefreshStateDB(int vlan, std::string kmac);

void updateMclagRemoteMac(struct m_fdb_info *info);

void updateMclagRemoteMacPort(int ifindex, int vlan, std::string mac);

void macUpdateMclagRemoteCache(struct m_fdb_info *info);

bool checkImetExist(std::string key, uint32_t vni);

bool checkDelImet(std::string key, uint32_t vni);
Expand Down
5 changes: 0 additions & 5 deletions fdbsyncd/fdbsyncd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ int main(int argc, char **argv)
netlink.dumpRequest(RTM_GETNEIGH);

s.addSelectable(sync.getFdbStateTable());
s.addSelectable(sync.getMclagRemoteFdbStateTable());
s.addSelectable(sync.getCfgEvpnNvoTable());
while (true)
{
Expand All @@ -96,10 +95,6 @@ int main(int argc, char **argv)
{
sync.processStateFdb();
}
else if (temps == (Selectable *)sync.getMclagRemoteFdbStateTable())
{
sync.processStateMclagRemoteFdb();
}
else if (temps == (Selectable *)sync.getCfgEvpnNvoTable())
{
sync.processCfgEvpnNvo();
Expand Down
2 changes: 0 additions & 2 deletions orchagent/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ orchagent_SOURCES = \
chassisorch.cpp \
debugcounterorch.cpp \
natorch.cpp \
mlagorch.cpp \
isolationgrouporch.cpp \
muxorch.cpp \
macsecorch.cpp \
lagid.cpp
Expand Down
Loading

0 comments on commit def23bf

Please sign in to comment.