@@ -199,6 +199,7 @@ void FdbOrch::update(sai_fdb_event_t type,
199
199
}
200
200
201
201
update.add = true ;
202
+ update.entry .port_name = update.port .m_alias ;
202
203
update.type = " dynamic" ;
203
204
204
205
storeFdbEntryState (update);
@@ -226,11 +227,11 @@ void FdbOrch::update(sai_fdb_event_t type,
226
227
227
228
if (existing_entry->second .bridge_port_id != bridge_port_id)
228
229
{
229
- SWSS_LOG_NOTICE (" FdbOrch AGE notification: Stale aging event received for mac-bv_id %s-0x%lx with bp=0x%lx existing bp=0x%lx" , update.entry .mac .to_string ().c_str (), entry->bv_id , bridge_port_id, existing_entry->second .bridge_port_id );
230
+ SWSS_LOG_INFO (" FdbOrch AGE notification: Stale aging event received for mac-bv_id %s-0x%lx with bp=0x%lx existing bp=0x%lx" , update.entry .mac .to_string ().c_str (), entry->bv_id , bridge_port_id, existing_entry->second .bridge_port_id );
230
231
// We need to get the port for bridge-port in existing fdb
231
232
if (!m_portsOrch->getPortByBridgePortId (existing_entry->second .bridge_port_id , update.port ))
232
233
{
233
- SWSS_LOG_NOTICE (" FdbOrch AGE notification: Failed to get port by bridge port ID 0x%lx" , existing_entry->second .bridge_port_id );
234
+ SWSS_LOG_INFO (" FdbOrch AGE notification: Failed to get port by bridge port ID 0x%lx" , existing_entry->second .bridge_port_id );
234
235
}
235
236
// dont return, let it delete just to bring SONiC and SAI in sync
236
237
// return;
@@ -832,11 +833,24 @@ void FdbOrch::updateVlanMember(const VlanMemberUpdate& update)
832
833
string port_name = update.member .m_alias ;
833
834
auto fdb_list = std::move (saved_fdb_entries[port_name]);
834
835
saved_fdb_entries[port_name].clear ();
835
- for ( const auto & fdb: fdb_list)
836
+ if (! fdb_list. empty () )
836
837
{
837
- // try to insert an FDB entry. If the FDB entry is not ready to be inserted yet,
838
- // it would be added back to the saved_fdb_entries structure by addFDBEntry()
839
- (void )addFdbEntry (fdb.entry , port_name, fdb.fdbData );
838
+ for (const auto & fdb: fdb_list)
839
+ {
840
+ // try to insert an FDB entry. If the FDB entry is not ready to be inserted yet,
841
+ // it would be added back to the saved_fdb_entries structure by addFDBEntry()
842
+ if (fdb.vlanId == update.vlan .m_vlan_info .vlan_id )
843
+ {
844
+ FdbEntry entry;
845
+ entry.mac = fdb.mac ;
846
+ entry.bv_id = update.vlan .m_vlan_info .vlan_oid ;
847
+ (void )addFdbEntry (entry, port_name, fdb.fdbData );
848
+ }
849
+ else
850
+ {
851
+ saved_fdb_entries[port_name].push_back (fdb);
852
+ }
853
+ }
840
854
}
841
855
}
842
856
@@ -847,7 +861,7 @@ bool FdbOrch::addFdbEntry(const FdbEntry& entry, const string& port_name,
847
861
Port port;
848
862
849
863
SWSS_LOG_ENTER ();
850
- SWSS_LOG_NOTICE (" mac=%s bv_id=0x%lx port_name=%s type=%s origin=%d" ,
864
+ SWSS_LOG_INFO (" mac=%s bv_id=0x%lx port_name=%s type=%s origin=%d" ,
851
865
entry.mac .to_string ().c_str (), entry.bv_id , port_name.c_str (),
852
866
fdbData.type .c_str (), fdbData.origin );
853
867
@@ -886,7 +900,7 @@ bool FdbOrch::addFdbEntry(const FdbEntry& entry, const string& port_name,
886
900
FdbOrigin oldOrigin = FDB_ORIGIN_INVALID ;
887
901
bool macUpdate = false ;
888
902
auto it = m_entries.find (entry);
889
- if (it != m_entries.end ())
903
+ if (it != m_entries.end ())
890
904
{
891
905
/* get existing port and type */
892
906
oldType = it->second .type ;
@@ -898,18 +912,18 @@ bool FdbOrch::addFdbEntry(const FdbEntry& entry, const string& port_name,
898
912
return false ;
899
913
}
900
914
901
- if ((oldOrigin == fdbData.origin ) && (oldType == fdbData.type ) && (port.m_bridge_port_id == it->second .bridge_port_id ))
915
+ if ((oldOrigin == fdbData.origin ) && (oldType == fdbData.type ) && (port.m_bridge_port_id == it->second .bridge_port_id ))
902
916
{
903
917
/* Duplicate Mac */
904
- SWSS_LOG_NOTICE (" FdbOrch: mac=%s %s port=%s type=%s origin=%d is duplicate" , entry.mac .to_string ().c_str (),
918
+ SWSS_LOG_INFO (" FdbOrch: mac=%s %s port=%s type=%s origin=%d is duplicate" , entry.mac .to_string ().c_str (),
905
919
vlan.m_alias .c_str (), port_name.c_str (),
906
920
fdbData.type .c_str (), fdbData.origin );
907
921
return true ;
908
922
}
909
- else if (fdbData.origin != oldOrigin)
923
+ else if (fdbData.origin != oldOrigin)
910
924
{
911
925
/* Mac origin has changed */
912
- if ((oldType == " static" ) && (oldOrigin == FDB_ORIGIN_PROVISIONED))
926
+ if ((oldType == " static" ) && (oldOrigin == FDB_ORIGIN_PROVISIONED))
913
927
{
914
928
/* old mac was static and provisioned, it can not be changed by Remote Mac */
915
929
SWSS_LOG_NOTICE (" Already existing static MAC:%s in Vlan:%d. "
@@ -920,20 +934,20 @@ bool FdbOrch::addFdbEntry(const FdbEntry& entry, const string& port_name,
920
934
921
935
return true ;
922
936
}
923
- else if ((oldType == " static" ) && (oldOrigin ==
937
+ else if ((oldType == " static" ) && (oldOrigin ==
924
938
FDB_ORIGIN_VXLAN_ADVERTIZED) && (fdbData.type == " dynamic" ))
925
939
{
926
940
/* old mac was static and received from remote, it can not be changed by dynamic locally provisioned Mac */
927
- SWSS_LOG_NOTICE (" Already existing static MAC:%s in Vlan:%d "
941
+ SWSS_LOG_INFO (" Already existing static MAC:%s in Vlan:%d "
928
942
" from Peer:%s. Now same is provisioned as dynamic; "
929
943
" Provisioned dynamic mac is ignored" ,
930
944
entry.mac .to_string ().c_str (), vlan.m_vlan_info .vlan_id ,
931
945
it->second .remote_ip .c_str ());
932
946
return true ;
933
947
}
934
- else if (oldOrigin == FDB_ORIGIN_VXLAN_ADVERTIZED)
948
+ else if (oldOrigin == FDB_ORIGIN_VXLAN_ADVERTIZED)
935
949
{
936
- if ((oldType == " static" ) && (fdbData.type == " static" ))
950
+ if ((oldType == " static" ) && (fdbData.type == " static" ))
937
951
{
938
952
SWSS_LOG_WARN (" You have just overwritten existing static MAC:%s "
939
953
" in Vlan:%d from Peer:%s, "
@@ -982,11 +996,11 @@ bool FdbOrch::addFdbEntry(const FdbEntry& entry, const string& port_name,
982
996
attr.value .oid = port.m_bridge_port_id ;
983
997
attrs.push_back (attr);
984
998
985
- if (fdbData.origin == FDB_ORIGIN_VXLAN_ADVERTIZED)
999
+ if (fdbData.origin == FDB_ORIGIN_VXLAN_ADVERTIZED)
986
1000
{
987
1001
IpAddress remote = IpAddress (fdbData.remote_ip );
988
1002
sai_ip_address_t ipaddr;
989
- if (remote.isV4 ())
1003
+ if (remote.isV4 ())
990
1004
{
991
1005
ipaddr.addr_family = SAI_IP_ADDR_FAMILY_IPV4;
992
1006
ipaddr.addr .ip4 = remote.getV4Addr ();
@@ -1000,7 +1014,7 @@ bool FdbOrch::addFdbEntry(const FdbEntry& entry, const string& port_name,
1000
1014
attr.value .ipaddr = ipaddr;
1001
1015
attrs.push_back (attr);
1002
1016
}
1003
- else if (macUpdate
1017
+ else if (macUpdate
1004
1018
&& (oldOrigin == FDB_ORIGIN_VXLAN_ADVERTIZED)
1005
1019
&& (fdbData.origin != oldOrigin))
1006
1020
{
@@ -1015,9 +1029,9 @@ bool FdbOrch::addFdbEntry(const FdbEntry& entry, const string& port_name,
1015
1029
attrs.push_back (attr);
1016
1030
}
1017
1031
1018
- if (macUpdate && (oldOrigin == FDB_ORIGIN_VXLAN_ADVERTIZED))
1032
+ if (macUpdate && (oldOrigin == FDB_ORIGIN_VXLAN_ADVERTIZED))
1019
1033
{
1020
- if ((fdbData.origin != oldOrigin)
1034
+ if ((fdbData.origin != oldOrigin)
1021
1035
|| ((oldType == " dynamic" ) && (oldType != fdbData.type )))
1022
1036
{
1023
1037
attr.id = SAI_FDB_ENTRY_ATTR_ALLOW_MAC_MOVE;
@@ -1027,13 +1041,13 @@ bool FdbOrch::addFdbEntry(const FdbEntry& entry, const string& port_name,
1027
1041
}
1028
1042
1029
1043
1030
- if (macUpdate)
1044
+ if (macUpdate)
1031
1045
{
1032
- SWSS_LOG_NOTICE (" MAC-Update FDB %s in %s on from-%s:to-%s from-%s:to-%s origin-%d-to-%d" ,
1046
+ SWSS_LOG_INFO (" MAC-Update FDB %s in %s on from-%s:to-%s from-%s:to-%s origin-%d-to-%d" ,
1033
1047
entry.mac .to_string ().c_str (), vlan.m_alias .c_str (), oldPort.m_alias .c_str (),
1034
1048
port_name.c_str (), oldType.c_str (), fdbData.type .c_str (),
1035
1049
oldOrigin, fdbData.origin );
1036
- for (auto itr : attrs)
1050
+ for (auto itr : attrs)
1037
1051
{
1038
1052
status = sai_fdb_api->set_fdb_entry_attribute (&fdb_entry, &itr);
1039
1053
if (status != SAI_STATUS_SUCCESS)
@@ -1046,7 +1060,7 @@ bool FdbOrch::addFdbEntry(const FdbEntry& entry, const string& port_name,
1046
1060
}
1047
1061
else
1048
1062
{
1049
- SWSS_LOG_NOTICE (" MAC-Create %s FDB %s in %s on %s" , fdbData.type .c_str (), entry.mac .to_string ().c_str (), vlan.m_alias .c_str (), port_name.c_str ());
1063
+ SWSS_LOG_INFO (" MAC-Create %s FDB %s in %s on %s" , fdbData.type .c_str (), entry.mac .to_string ().c_str (), vlan.m_alias .c_str (), port_name.c_str ());
1050
1064
1051
1065
status = sai_fdb_api->create_fdb_entry (&fdb_entry, (uint32_t )attrs.size (), attrs.data ());
1052
1066
if (status != SAI_STATUS_SUCCESS)
@@ -1086,7 +1100,7 @@ bool FdbOrch::addFdbEntry(const FdbEntry& entry, const string& port_name,
1086
1100
m_fdbStateTable.del (key);
1087
1101
}
1088
1102
1089
- if (!macUpdate)
1103
+ if (!macUpdate)
1090
1104
{
1091
1105
gCrmOrch ->incCrmResUsedCounter (CrmResourceType::CRM_FDB_ENTRY);
1092
1106
}
@@ -1109,7 +1123,7 @@ bool FdbOrch::removeFdbEntry(const FdbEntry& entry, FdbOrigin origin)
1109
1123
1110
1124
SWSS_LOG_ENTER ();
1111
1125
1112
- SWSS_LOG_NOTICE (" FdbOrch RemoveFDBEntry: mac=%s bv_id=0x%lx origin %d" , entry.mac .to_string ().c_str (), entry.bv_id , origin);
1126
+ SWSS_LOG_INFO (" FdbOrch RemoveFDBEntry: mac=%s bv_id=0x%lx origin %d" , entry.mac .to_string ().c_str (), entry.bv_id , origin);
1113
1127
1114
1128
if (!m_portsOrch->getPort (entry.bv_id , vlan))
1115
1129
{
@@ -1118,7 +1132,7 @@ bool FdbOrch::removeFdbEntry(const FdbEntry& entry, FdbOrigin origin)
1118
1132
}
1119
1133
1120
1134
auto it= m_entries.find (entry);
1121
- if (it == m_entries.end ())
1135
+ if (it == m_entries.end ())
1122
1136
{
1123
1137
SWSS_LOG_INFO (" FdbOrch RemoveFDBEntry: FDB entry isn't found. mac=%s bv_id=0x%lx" , entry.mac .to_string ().c_str (), entry.bv_id );
1124
1138
@@ -1134,7 +1148,7 @@ bool FdbOrch::removeFdbEntry(const FdbEntry& entry, FdbOrigin origin)
1134
1148
return false ;
1135
1149
}
1136
1150
1137
- if (fdbData.origin != origin)
1151
+ if (fdbData.origin != origin)
1138
1152
{
1139
1153
/* When mac is moved from remote to local
1140
1154
* BGP will delete the mac from vxlan_fdb_table
@@ -1207,14 +1221,14 @@ void FdbOrch::deleteFdbEntryFromSavedFDB(const MacAddress &mac,
1207
1221
1208
1222
for (auto & itr: saved_fdb_entries)
1209
1223
{
1210
- if (portName.empty () || (portName == itr.first ))
1224
+ if (portName.empty () || (portName == itr.first ))
1211
1225
{
1212
1226
auto iter = saved_fdb_entries[itr.first ].begin ();
1213
1227
while (iter != saved_fdb_entries[itr.first ].end ())
1214
1228
{
1215
1229
if (*iter == entry)
1216
1230
{
1217
- if (iter->fdbData .origin == origin)
1231
+ if (iter->fdbData .origin == origin)
1218
1232
{
1219
1233
SWSS_LOG_NOTICE (" FDB entry found in saved fdb. deleting..."
1220
1234
" mac=%s vlan_id=0x%x origin:%d port:%s" ,
@@ -1237,7 +1251,7 @@ void FdbOrch::deleteFdbEntryFromSavedFDB(const MacAddress &mac,
1237
1251
iter++;
1238
1252
}
1239
1253
}
1240
- if (found)
1254
+ if (found)
1241
1255
break ;
1242
1256
}
1243
1257
}
@@ -1247,7 +1261,7 @@ void FdbOrch::notifyTunnelOrch(Port& port)
1247
1261
{
1248
1262
VxlanTunnelOrch* tunnel_orch = gDirectory .get <VxlanTunnelOrch*>();
1249
1263
1250
- if (port.m_type != Port::TUNNEL)
1264
+ if (port.m_type != Port::TUNNEL)
1251
1265
return ;
1252
1266
1253
1267
tunnel_orch->deleteTunnelPort (port);
0 commit comments