Skip to content

Commit 06113a3

Browse files
Merge branch 'master' into dualtor-neigh-miss
2 parents 579c31e + fd0c585 commit 06113a3

32 files changed

Lines changed: 1223 additions & 216 deletions

.azure-pipelines/test-docker-sonic-vs-template.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,32 @@ jobs:
7171
if [ '${{ parameters.archive_gcov }}' == True ]; then
7272
all_tests=$(ls test_*.py)
7373
all_tests="${all_tests} p4rt"
74+
test_set=()
75+
# Run 20 tests as a set.
7476
for test in ${all_tests}; do
75-
test_name=$(echo "${test}" | cut -d "." -f 1)
76-
sudo py.test -v --force-flaky --junitxml="${test_name}_tr.xml" --keeptb --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber) ${test}
77+
test_set+=("${test}")
78+
if [ ${#test_set[@]} -ge 20 ]; then
79+
test_name=$(echo "${test_set[0]}" | cut -d "." -f 1)
80+
echo "${test_set[*]}" | xargs sudo py.test -v --force-flaky --junitxml="${test_name}_tr.xml" --keeptb --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber)
81+
container_count=$(docker ps -q -a | wc -l)
82+
if [ ${container_count} -gt 0 ]; then
83+
./gcov_support.sh set_environment $(Build.ArtifactStagingDirectory)
84+
docker stop $(docker ps -q -a)
85+
docker rm $(docker ps -q -a)
86+
fi
87+
test_set=()
88+
fi
89+
done
90+
if [ ${#test_set[@]} -gt 0 ]; then
91+
test_name=$(echo "${test_set[0]}" | cut -d "." -f 1)
92+
echo "${test_set[*]}" | xargs sudo py.test -v --force-flaky --junitxml="${test_name}_tr.xml" --keeptb --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber)
7793
container_count=$(docker ps -q -a | wc -l)
7894
if [ ${container_count} -gt 0 ]; then
7995
./gcov_support.sh set_environment $(Build.ArtifactStagingDirectory)
8096
docker stop $(docker ps -q -a)
8197
docker rm $(docker ps -q -a)
8298
fi
83-
done
99+
fi
84100
else
85101
sudo py.test -v --force-flaky --junitxml=tests_tr.xml --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber)
86102
fi

cfgmgr/teammgr.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ void TeamMgr::doLagTask(Consumer &consumer)
252252
{
253253
int min_links = 0;
254254
bool fallback = false;
255+
bool fast_rate = false;
255256
string admin_status = DEFAULT_ADMIN_STATUS_STR;
256257
string mtu = DEFAULT_MTU_STR;
257258
string learn_mode;
@@ -293,12 +294,18 @@ void TeamMgr::doLagTask(Consumer &consumer)
293294
{
294295
tpid = fvValue(i);
295296
SWSS_LOG_INFO("Get TPID %s", tpid.c_str());
296-
}
297+
}
298+
else if (fvField(i) == "fast_rate")
299+
{
300+
fast_rate = fvValue(i) == "true";
301+
SWSS_LOG_INFO("Get fast_rate `%s`",
302+
fast_rate ? "true" : "false");
303+
}
297304
}
298305

299306
if (m_lagList.find(alias) == m_lagList.end())
300307
{
301-
if (addLag(alias, min_links, fallback) == task_need_retry)
308+
if (addLag(alias, min_links, fallback, fast_rate) == task_need_retry)
302309
{
303310
it++;
304311
continue;
@@ -553,7 +560,7 @@ bool TeamMgr::setLagLearnMode(const string &alias, const string &learn_mode)
553560
return true;
554561
}
555562

556-
task_process_status TeamMgr::addLag(const string &alias, int min_links, bool fallback)
563+
task_process_status TeamMgr::addLag(const string &alias, int min_links, bool fallback, bool fast_rate)
557564
{
558565
SWSS_LOG_ENTER();
559566

@@ -610,6 +617,11 @@ task_process_status TeamMgr::addLag(const string &alias, int min_links, bool fal
610617
conf << ",\"fallback\":true";
611618
}
612619

620+
if (fast_rate)
621+
{
622+
conf << ",\"fast_rate\":true";
623+
}
624+
613625
conf << "}}'";
614626

615627
SWSS_LOG_INFO("Port channel %s teamd configuration: %s",
@@ -652,7 +664,7 @@ bool TeamMgr::removeLag(const string &alias)
652664
}
653665

654666
// Port-channel names are in the pattern of "PortChannel####"
655-
//
667+
//
656668
// The LACP key could be generated in 3 ways based on the value in config DB:
657669
// 1. "auto" - LACP key is extracted from the port-channel name and is set to be the number at the end of the port-channel name
658670
// We are adding 1 at the beginning to avoid LACP key collisions between similar LACP keys e.g. PortChannel10 and PortChannel010.

cfgmgr/teammgr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class TeamMgr : public Orch
4141
void doLagMemberTask(Consumer &consumer);
4242
void doPortUpdateTask(Consumer &consumer);
4343

44-
task_process_status addLag(const std::string &alias, int min_links, bool fall_back);
44+
task_process_status addLag(const std::string &alias, int min_links, bool fall_back, bool fast_rate);
4545
bool removeLag(const std::string &alias);
4646
task_process_status addLagMember(const std::string &lag, const std::string &member);
4747
bool removeLagMember(const std::string &lag, const std::string &member);

orchagent/fdborch.cpp

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ void FdbOrch::handleSyncdFlushNotif(const sai_object_id_t& bv_id,
219219
for (auto itr = m_entries.begin(); itr != m_entries.end();)
220220
{
221221
auto curr = itr++;
222-
if (curr->second.type != "static" && (curr->first.mac == mac || mac == flush_mac))
222+
if (curr->second.type != "static" && (curr->first.mac == mac || mac == flush_mac) && curr->second.is_flush_pending)
223223
{
224224
clearFdbEntry(curr->first);
225225
}
@@ -233,7 +233,7 @@ void FdbOrch::handleSyncdFlushNotif(const sai_object_id_t& bv_id,
233233
auto curr = itr++;
234234
if (curr->second.bridge_port_id == bridge_port_id)
235235
{
236-
if (curr->second.type != "static" && (curr->first.mac == mac || mac == flush_mac))
236+
if (curr->second.type != "static" && (curr->first.mac == mac || mac == flush_mac) && curr->second.is_flush_pending)
237237
{
238238
clearFdbEntry(curr->first);
239239
}
@@ -248,7 +248,7 @@ void FdbOrch::handleSyncdFlushNotif(const sai_object_id_t& bv_id,
248248
auto curr = itr++;
249249
if (curr->first.bv_id == bv_id)
250250
{
251-
if (curr->second.type != "static" && (curr->first.mac == mac || mac == flush_mac))
251+
if (curr->second.type != "static" && (curr->first.mac == mac || mac == flush_mac) && curr->second.is_flush_pending)
252252
{
253253
clearFdbEntry(curr->first);
254254
}
@@ -263,7 +263,7 @@ void FdbOrch::handleSyncdFlushNotif(const sai_object_id_t& bv_id,
263263
auto curr = itr++;
264264
if (curr->first.bv_id == bv_id && curr->second.bridge_port_id == bridge_port_id)
265265
{
266-
if (curr->second.type != "static" && (curr->first.mac == mac || mac == flush_mac))
266+
if (curr->second.type != "static" && (curr->first.mac == mac || mac == flush_mac) && curr->second.is_flush_pending)
267267
{
268268
clearFdbEntry(curr->first);
269269
}
@@ -819,6 +819,7 @@ void FdbOrch::doTask(Consumer& consumer)
819819
fdbData.remote_ip = remote_ip;
820820
fdbData.esi = esi;
821821
fdbData.vni = vni;
822+
fdbData.is_flush_pending = false;
822823
if (addFdbEntry(entry, port, fdbData))
823824
{
824825
if (origin == FDB_ORIGIN_MCLAG_ADVERTIZED)
@@ -907,6 +908,14 @@ void FdbOrch::doTask(NotificationConsumer& consumer)
907908
SWSS_LOG_ERROR("Flush fdb failed, return code %x", status);
908909
}
909910

911+
if (status == SAI_STATUS_SUCCESS) {
912+
for (map<FdbEntry, FdbData>::iterator it = m_entries.begin();
913+
it != m_entries.end(); it++)
914+
{
915+
it->second.is_flush_pending = true;
916+
}
917+
}
918+
910919
return;
911920
}
912921
else if (op == "PORT")
@@ -1071,6 +1080,20 @@ void FdbOrch::flushFDBEntries(sai_object_id_t bridge_port_oid,
10711080
{
10721081
SWSS_LOG_ERROR("Flushing FDB failed. rv:%d", rv);
10731082
}
1083+
1084+
if (SAI_STATUS_SUCCESS == rv) {
1085+
for (map<FdbEntry, FdbData>::iterator it = m_entries.begin();
1086+
it != m_entries.end(); it++)
1087+
{
1088+
if ((bridge_port_oid != SAI_NULL_OBJECT_ID &&
1089+
it->second.bridge_port_id == bridge_port_oid) ||
1090+
(vlan_oid != SAI_NULL_OBJECT_ID &&
1091+
it->first.bv_id == vlan_oid))
1092+
{
1093+
it->second.is_flush_pending = true;
1094+
}
1095+
}
1096+
}
10741097
}
10751098

10761099
void FdbOrch::notifyObserversFDBFlush(Port &port, sai_object_id_t& bvid)

orchagent/fdborch.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ struct FdbData
5757
{"static", FDB_ORIGIN_PROVISIONED} => statically provisioned
5858
{"static", FDB_ORIGIN_ADVERTIZED} => sticky synced from remote device
5959
*/
60+
bool is_flush_pending;
6061

6162
/* Remote FDB related info */
6263
string remote_ip;

orchagent/muxorch.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -963,6 +963,10 @@ bool MuxOrch::isNeighborActive(const IpAddress& nbr, const MacAddress& mac, stri
963963

964964
if (ptr)
965965
{
966+
if (ptr->getSkipNeighborsSet().find(nbr) != ptr->getSkipNeighborsSet().end())
967+
{
968+
return true;
969+
}
966970
return ptr->isActive();
967971
}
968972

orchagent/muxorch.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ class MuxCable
9797
{
9898
return nbr_handler_->getNextHopId(nh);
9999
}
100+
std::set<IpAddress> getSkipNeighborsSet()
101+
{
102+
return skip_neighbors_;
103+
}
100104

101105
private:
102106
bool stateActive();

orchagent/orchdaemon.cpp

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -597,13 +597,26 @@ bool OrchDaemon::init()
597597
SAI_QUEUE_ATTR_PAUSE_STATUS,
598598
};
599599

600-
m_orchList.push_back(new PfcWdSwOrch<PfcWdAclHandler, PfcWdLossyHandler>(
601-
m_configDb,
602-
pfc_wd_tables,
603-
portStatIds,
604-
queueStatIds,
605-
queueAttrIds,
606-
PFC_WD_POLL_MSECS));
600+
if(gSwitchOrch->checkPfcDlrInitEnable())
601+
{
602+
m_orchList.push_back(new PfcWdSwOrch<PfcWdDlrHandler, PfcWdLossyHandler>(
603+
m_configDb,
604+
pfc_wd_tables,
605+
portStatIds,
606+
queueStatIds,
607+
queueAttrIds,
608+
PFC_WD_POLL_MSECS));
609+
}
610+
else
611+
{
612+
m_orchList.push_back(new PfcWdSwOrch<PfcWdAclHandler, PfcWdLossyHandler>(
613+
m_configDb,
614+
pfc_wd_tables,
615+
portStatIds,
616+
queueStatIds,
617+
queueAttrIds,
618+
PFC_WD_POLL_MSECS));
619+
}
607620
} else if (platform == CISCO_8000_PLATFORM_SUBSTRING)
608621
{
609622
static const vector<sai_port_stat_t> portStatIds;

orchagent/p4orch/tests/fake_portorch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ bool PortsOrch::getPortPvid(Port &port, sai_uint32_t &pvid)
518518
return true;
519519
}
520520

521-
bool PortsOrch::setPortFec(Port &port, sai_port_fec_mode_t mode)
521+
bool PortsOrch::setPortFec(Port &port, std::string &mode)
522522
{
523523
return true;
524524
}

orchagent/pfcactionhandler.cpp

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,49 @@ PfcWdSaiDlrInitHandler::~PfcWdSaiDlrInitHandler(void)
262262
}
263263
}
264264

265+
PfcWdDlrHandler::PfcWdDlrHandler(sai_object_id_t port, sai_object_id_t queue,
266+
uint8_t queueId, shared_ptr<Table> countersTable):
267+
PfcWdLossyHandler(port, queue, queueId, countersTable)
268+
{
269+
SWSS_LOG_ENTER();
270+
271+
sai_attribute_t attr;
272+
attr.id = SAI_QUEUE_ATTR_PFC_DLR_INIT;
273+
attr.value.booldata = true;
274+
275+
// Set DLR init to true to start PFC deadlock recovery
276+
sai_status_t status = sai_queue_api->set_queue_attribute(queue, &attr);
277+
if (status != SAI_STATUS_SUCCESS)
278+
{
279+
SWSS_LOG_ERROR("Failed to set PFC DLR INIT on port 0x%" PRIx64 " queue 0x%" PRIx64
280+
" queueId %d : %d",
281+
port, queue, queueId, status);
282+
return;
283+
}
284+
}
285+
286+
PfcWdDlrHandler::~PfcWdDlrHandler(void)
287+
{
288+
SWSS_LOG_ENTER();
289+
290+
sai_object_id_t port = getPort();
291+
sai_object_id_t queue = getQueue();
292+
uint8_t queueId = getQueueId();
293+
294+
sai_attribute_t attr;
295+
attr.id = SAI_QUEUE_ATTR_PFC_DLR_INIT;
296+
attr.value.booldata = false;
297+
298+
// Set DLR init to false to stop PFC deadlock recovery
299+
sai_status_t status = sai_queue_api->set_queue_attribute(getQueue(), &attr);
300+
if (status != SAI_STATUS_SUCCESS)
301+
{
302+
SWSS_LOG_ERROR("Failed to clear PFC DLR INIT on port 0x%" PRIx64 " queue 0x%" PRIx64
303+
" queueId %d : %d", port, queue, queueId, status);
304+
return;
305+
}
306+
}
307+
265308
PfcWdAclHandler::PfcWdAclHandler(sai_object_id_t port, sai_object_id_t queue,
266309
uint8_t queueId, shared_ptr<Table> countersTable):
267310
PfcWdLossyHandler(port, queue, queueId, countersTable)

0 commit comments

Comments
 (0)