Skip to content

Commit 4bdd600

Browse files
authored
Merge branch 'facebook:main' into meru_configs
2 parents fc5abdd + a935744 commit 4bdd600

File tree

129 files changed

+1592
-1110
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+1592
-1110
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 96afd687d4d32b2251fe7ebe98a005d87fc44c40
1+
Subproject commit 4d6086c0bfc4ffc4750857a815db98117efacdc2
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 55c17e62970b66fe770defb77a0489e04d7d99a8
1+
Subproject commit efbd79410d98a2a7e98d320dcc306b8be5ceec9e
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 5aad7b326cf90d1b969de356e0a386ef6ab9fff1
1+
Subproject commit 53faba2ed3d4a7896c968f127efaae11543d10ac
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit c14c12402c5f3c325707bf26292b5e8f177a7a00
1+
Subproject commit 00169caf56fa956a5c8cf809341ae20094be941e
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 3a30c30ae6d01a7bfdffee9bf922721bb0f62e7c
1+
Subproject commit e0c841127a526324a46d19404e498cfd00cf5a05

cmake/AgentHwBenchmarks.cmake

+12
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,19 @@ add_library(hw_system_scale_memory_benchmark
447447
)
448448

449449
target_link_libraries(hw_system_scale_memory_benchmark
450+
fsdb_model
450451
system_scale_test_utils
451452
mono_agent_ensemble
452453
Folly::follybenchmark
453454
)
455+
456+
add_library(hw_clear_interface_counters_phy_benchmark
457+
fboss/agent/hw/benchmarks/HwClearInterfacePhyCountersBenchmark.cpp
458+
)
459+
460+
target_link_libraries(hw_clear_interface_counters_phy_benchmark
461+
config_factory
462+
mono_agent_ensemble
463+
mono_agent_benchmarks
464+
Folly::follybenchmark
465+
)

cmake/AgentHwSaiHwTest.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ add_library(agent_hw_test_thrift_handler
169169
fboss/agent/hw/sai/hw_test/HwTestTamUtilsThriftHandler.cpp
170170
fboss/agent/hw/sai/hw_test/HwTestCommonUtilsThriftHandler.cpp
171171
fboss/agent/hw/sai/hw_test/HwTestFlowletUtilsThriftHandler.cpp
172+
fboss/agent/hw/sai/hw_test/HwTestPtpTcUtilsThriftHandler.cpp
172173
)
173174

174175
target_link_libraries(agent_hw_test_thrift_handler

cmake/AgentPlatformsCommon.cmake

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ target_link_libraries(platform_mapping_utils
3737
wedge400_platform_mapping
3838
wedge400c_platform_mapping
3939
morgan_platform_mapping
40-
cloud_ripper_platform_mapping
4140
meru400biu_platform_mapping
4241
meru400bfu_platform_mapping
4342
montblanc_platform_mapping

cmake/AgentPlatformsCommonCloudRipper.cmake

-12
This file was deleted.

cmake/AgentPlatformsSai.cmake

-3
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ add_library(sai_platform
2424
fboss/agent/platforms/sai/SaiPlatformPort.cpp
2525
fboss/agent/platforms/sai/SaiPlatformInit.cpp
2626
fboss/agent/platforms/sai/SaiWedge400CPlatform.cpp
27-
fboss/agent/platforms/sai/SaiCloudRipperPlatform.cpp
28-
fboss/agent/platforms/sai/SaiCloudRipperPlatformPort.cpp
2927
fboss/agent/platforms/sai/SaiWedge400CPlatformPort.cpp
3028
fboss/agent/platforms/sai/SaiTajoPlatform.cpp
3129
fboss/agent/platforms/sai/SaiTajoPlatformPort.cpp
@@ -93,7 +91,6 @@ target_link_libraries(sai_platform
9391
morgan_platform_mapping
9492
wedge_led_utils
9593
bcm_yaml_config
96-
cloud_ripper_platform_mapping
9794
meru400biu_platform_mapping
9895
meru400bia_platform_mapping
9996
meru400bfu_platform_mapping

cmake/CliFboss2.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ add_executable(fboss2
354354
fboss/cli/fboss2/commands/clear/interface/CmdClearInterface.h
355355
fboss/cli/fboss2/commands/clear/interface/prbs/CmdClearInterfacePrbs.h
356356
fboss/cli/fboss2/commands/clear/interface/prbs/stats/CmdClearInterfacePrbsStats.h
357+
fboss/cli/fboss2/commands/clear/interface/counters/phy/CmdClearInterfaceCountersPhy.h
357358
fboss/cli/fboss2/CmdGlobalOptions.cpp
358359
fboss/cli/fboss2/CmdHandler.cpp
359360
fboss/cli/fboss2/CmdHandlerImpl.cpp

cmake/PlatformConfigLib.cmake

+7-6
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
# cmake/FooBar.cmake
55

66

7-
file(GLOB_RECURSE required_configs
7+
file(GLOB_RECURSE required_configs
88
${CMAKE_CURRENT_SOURCE_DIR}/fboss/platform/configs/*.json
99
)
1010

11-
set(generated_header
11+
set(generated_header
1212
${CMAKE_CURRENT_BINARY_DIR}/fboss/platform/config_lib/GeneratedConfig.h
1313
)
1414

@@ -23,10 +23,10 @@ add_custom_command(
2323
COMMAND
2424
${CMAKE_COMMAND} -E make_directory ${output_dir}
2525
COMMAND
26-
${CMAKE_CURRENT_BINARY_DIR}/platform_config_lib_config_generator
27-
--json_config_dir
28-
${CMAKE_CURRENT_SOURCE_DIR}/fboss/platform/configs
29-
--install_dir
26+
${CMAKE_CURRENT_BINARY_DIR}/platform_config_lib_config_generator
27+
--json_config_dir
28+
${CMAKE_CURRENT_SOURCE_DIR}/fboss/platform/configs
29+
--install_dir
3030
${output_dir}
3131
DEPENDS
3232
${required_configs}
@@ -35,6 +35,7 @@ add_custom_command(
3535

3636
add_executable(platform_config_lib_config_generator
3737
fboss/platform/config_lib/ConfigGenerator.cpp
38+
fboss/platform/config_lib/ConfigValidator.cpp
3839
)
3940

4041
target_link_libraries(platform_config_lib_config_generator

fboss/agent/HwSwitch.h

+3
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,9 @@ class HwSwitch {
392392

393393
virtual bool getArsExhaustionStatus() = 0;
394394

395+
virtual void clearInterfacePhyCounters(
396+
const std::unique_ptr<std::vector<int32_t>>& ports) = 0;
397+
395398
protected:
396399
void setProgrammedState(const std::shared_ptr<SwitchState>& state);
397400

fboss/agent/RxPacket.h

+1-16
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,8 @@ class RxPacket : public Packet {
4141
AggregatePortID getSrcAggregatePort() const {
4242
return srcAggregatePort_;
4343
}
44-
/*
45-
* Get the VLAN on which this packet was received.
46-
*/
47-
VlanID getSrcVlan() const {
48-
return srcVlan_.value();
49-
}
5044
/*
5145
* Get the VLAN (if any) on which this packet was received.
52-
*
53-
* TODO(skhare)
54-
* Once all the callsites for getSrcVlan() are converted to handle nullopt
55-
* return, remove the old definition of getSrcVlan() and rename this function
56-
* to getSrcVlan().
5746
*/
5847
std::optional<VlanID> getSrcVlanIf() const {
5948
return srcVlan_;
@@ -106,11 +95,7 @@ class RxPacket : public Packet {
10695
PortID srcPort_{0};
10796
bool isFromAggregatePort_{false};
10897
AggregatePortID srcAggregatePort_{0};
109-
// TODO(skhare)
110-
// srcVlan_ was originally not optional, and had default value of 0.
111-
// Several callsites rely on this default value being 0.
112-
// Once all those callsites are fixed, default to std::nullopt.
113-
std::optional<VlanID> srcVlan_{0};
98+
std::optional<VlanID> srcVlan_{};
11499
uint32_t len_{0};
115100
std::optional<uint8_t> cosQueue_;
116101
};

fboss/agent/SwRxPacket.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class SwRxPacket : public RxPacket {
2525
buf_ = std::move(other.buf_);
2626
len_ = other.len_;
2727
setSrcPort(other.getSrcPort());
28-
setSrcVlan(other.getSrcVlan());
28+
setSrcVlan(other.getSrcVlanIf());
2929
if (other.cosQueue()) {
3030
setCosQueue(*other.cosQueue());
3131
}

fboss/agent/TunIntf.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ void TunIntf::stop() {
179179

180180
void TunIntf::start() {
181181
if (fd_ != -1 && !isHandlerRegistered()) {
182+
XLOG(DBG2) << "Starting listening on " << name_ << ": fd " << fd_;
182183
changeHandlerFD(folly::NetworkSocket::fromFd(fd_));
183184
registerHandler(folly::EventHandler::READ | folly::EventHandler::PERSIST);
184185
}

fboss/agent/TunManager.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -647,12 +647,15 @@ void TunManager::probe() {
647647
}
648648

649649
void TunManager::doProbe(std::lock_guard<std::mutex>& /* lock */) {
650+
XLOG(DBG2) << "Starting to probe() for linux interfaces...";
651+
650652
const auto startTs = std::chrono::steady_clock::now();
651653
SCOPE_EXIT {
652654
const auto endTs = std::chrono::steady_clock::now();
653655
auto elapsedMs =
654656
std::chrono::duration_cast<std::chrono::milliseconds>(endTs - startTs);
655-
XLOG(DBG2) << "Probing of linux state took " << elapsedMs.count() << "ms.";
657+
XLOG(DBG2) << "Probing of linux state took " << elapsedMs.count()
658+
<< "ms. success=" << (probeDone_ ? "true" : "false");
656659
};
657660

658661
CHECK(!probeDone_); // Callers must check for probeDone before calling

fboss/agent/hw/HwBasePortFb303Stats.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -308,4 +308,8 @@ void HwBasePortFb303Stats::updateEgressGvoqWatermarkStats(
308308
queueName);
309309
}
310310
}
311+
312+
void HwBasePortFb303Stats::clearStat(folly::StringPiece statKey) {
313+
portCounters_.clearStat(statName(statKey, portName_));
314+
}
311315
} // namespace facebook::fboss

fboss/agent/hw/HwBasePortFb303Stats.h

+4
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ class HwBasePortFb303Stats {
7373
folly::StringPiece statName,
7474
folly::StringPiece portName,
7575
PfcPriority priority);
76+
/*
77+
* clear port stat
78+
*/
79+
void clearStat(folly::StringPiece statKey);
7680

7781
/*
7882
* Priority group stat name

fboss/agent/hw/HwFb303Stats.cpp

+21-4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@
1414

1515
#include <folly/logging/xlog.h>
1616

17+
namespace {
18+
using namespace facebook;
19+
stats::MonotonicCounter getDefaultCounter(folly::StringPiece statKey) {
20+
return stats::MonotonicCounter(statKey.str(), fb303::SUM, fb303::RATE);
21+
}
22+
} // namespace
23+
1724
namespace facebook::fboss {
1825

1926
HwFb303Stats::~HwFb303Stats() {
@@ -58,8 +65,8 @@ void HwFb303Stats::reinitStat(
5865
return;
5966
}
6067
auto stat = getCounterIf(*oldStatName);
61-
stats::MonotonicCounter newStat{
62-
getMonotonicCounterName(statName), fb303::SUM, fb303::RATE};
68+
stats::MonotonicCounter newStat =
69+
getDefaultCounter(getMonotonicCounterName(statName));
6370
stat->swap(newStat);
6471
utility::deleteCounter(newStat.getName());
6572
counters_.insert(
@@ -68,8 +75,7 @@ void HwFb303Stats::reinitStat(
6875
} else {
6976
counters_.emplace(
7077
statName,
71-
HwFb303Counter(stats::MonotonicCounter(
72-
getMonotonicCounterName(statName), fb303::SUM, fb303::RATE)));
78+
HwFb303Counter(getDefaultCounter(getMonotonicCounterName(statName))));
7379
}
7480
}
7581

@@ -106,4 +112,15 @@ uint64_t HwFb303Stats::getCumulativeValueIf(const std::string& statName) const {
106112
return pcitr != counters_.end() ? pcitr->second.cumulativeValue : 0;
107113
}
108114

115+
void HwFb303Stats::clearStat(const std::string& statName) {
116+
auto stat = getCounterIf(statName);
117+
if (!stat) {
118+
return;
119+
}
120+
121+
stats::MonotonicCounter newStat =
122+
getDefaultCounter(getMonotonicCounterName(statName));
123+
stat->swap(newStat);
124+
}
125+
109126
} // namespace facebook::fboss

fboss/agent/hw/HwFb303Stats.h

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class HwFb303Stats {
5050
void removeStat(const std::string& statName);
5151
const std::string getMonotonicCounterName(const std::string& statName) const;
5252
uint64_t getCumulativeValueIf(const std::string& statName) const;
53+
void clearStat(const std::string& statName);
5354

5455
private:
5556
/*

fboss/agent/hw/bcm/BcmPort.cpp

+47-4
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,11 @@ std::string getPriorityGroupStatsKey(folly::StringPiece statKey, int pg) {
258258
return folly::to<std::string>(statKey, ".pg", pg);
259259
}
260260

261+
MonotonicCounter getDefaultCounter(folly::StringPiece statKey) {
262+
return MonotonicCounter(
263+
statKey.str(), facebook::fb303::SUM, facebook::fb303::RATE);
264+
}
265+
261266
} // namespace
262267

263268
namespace facebook::fboss {
@@ -329,11 +334,9 @@ void BcmPort::reinitPortStat(
329334

330335
if (!stat) {
331336
portCounters_.emplace(
332-
statKey.str(),
333-
MonotonicCounter(statName(statKey, portName), fb303::SUM, fb303::RATE));
337+
statKey.str(), getDefaultCounter(statName(statKey, portName)));
334338
} else if (stat->getName() != statName(statKey, portName)) {
335-
MonotonicCounter newStat{
336-
statName(statKey, portName), fb303::SUM, fb303::RATE};
339+
MonotonicCounter newStat = getDefaultCounter(statName(statKey, portName));
337340
stat->swap(newStat);
338341
utility::deleteCounter(newStat.getName());
339342
}
@@ -772,6 +775,46 @@ void BcmPort::updatePortFlowletConfig(const std::shared_ptr<Port>& port) {
772775
}
773776
}
774777

778+
void BcmPort::clearSignalDetectAndLockStatusChangedStats() {
779+
auto lastPmdStats = lastPhyInfo_.stats()->line()->pmd();
780+
for (auto& [laneId, laneStat] : *lastPmdStats->lanes()) {
781+
if (laneStat.signalDetectChangedCount().has_value()) {
782+
laneStat.signalDetectChangedCount() = 0;
783+
}
784+
if (laneStat.cdrLockChangedCount().has_value()) {
785+
laneStat.cdrLockChangedCount() = 0;
786+
}
787+
}
788+
}
789+
790+
void BcmPort::clearInterfacePhyCounters() {
791+
auto lockedPortStatsPtr = portStats_.wlock();
792+
if (!lockedPortStatsPtr->has_value()) {
793+
return;
794+
}
795+
796+
auto now = duration_cast<seconds>(system_clock::now().time_since_epoch());
797+
HwPortStats curPortStats, lastPortStats;
798+
curPortStats = (*lockedPortStatsPtr)->portStats();
799+
800+
*curPortStats.fecCorrectableErrors() = 0;
801+
*curPortStats.fecUncorrectableErrors() = 0;
802+
803+
auto portName = getPortName();
804+
auto resetPortStat = [&](folly::StringPiece statKey,
805+
folly::StringPiece portName) {
806+
auto stat = getPortCounterIf(statKey);
807+
MonotonicCounter newStat = getDefaultCounter(statName(statKey, portName));
808+
stat->swap(newStat);
809+
};
810+
resetPortStat(kFecCorrectable(), portName);
811+
resetPortStat(kFecUncorrectable(), portName);
812+
813+
*lockedPortStatsPtr = BcmPortStats(std::move(curPortStats), now);
814+
815+
clearSignalDetectAndLockStatusChangedStats();
816+
}
817+
775818
void BcmPort::cacheFaultStatus(phy::LinkFaultStatus faultStatus) {
776819
auto faultStatusPtr = cachedFaultStatus.wlock();
777820
*faultStatusPtr = faultStatus;

fboss/agent/hw/bcm/BcmPort.h

+3
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ class BcmPort {
251251
void setPortFlowletConfig(const std::shared_ptr<Port>& port);
252252
void updatePortFlowletConfig(const std::shared_ptr<Port>& port);
253253

254+
void clearSignalDetectAndLockStatusChangedStats();
255+
void clearInterfacePhyCounters();
256+
254257
private:
255258
class BcmPortStats {
256259
// All actions or instantiations of this class need to be done in a

fboss/agent/hw/bcm/BcmSwitch.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -3483,6 +3483,13 @@ prbs::InterfacePrbsState BcmSwitch::getPortPrbsState(PortID portId) {
34833483
return getBcmPortPrbsState(unit_, portTable_->getBcmPortId(portId));
34843484
}
34853485

3486+
void BcmSwitch::clearInterfacePhyCounters(
3487+
const std::unique_ptr<std::vector<int32_t>>& ports) {
3488+
for (auto portId : *ports) {
3489+
getPortTable()->getBcmPort(portId)->clearInterfacePhyCounters();
3490+
}
3491+
}
3492+
34863493
std::vector<phy::PrbsLaneStats> BcmSwitch::getPortAsicPrbsStats(PortID portId) {
34873494
return bcmStatUpdater_->getPortAsicPrbsStats(portId);
34883495
}

fboss/agent/hw/bcm/BcmSwitch.h

+3
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,9 @@ class BcmSwitch : public BcmSwitchIf {
588588
int32_t /* portId */) override;
589589
prbs::InterfacePrbsState getPortPrbsState(PortID portId) override;
590590

591+
void clearInterfacePhyCounters(
592+
const std::unique_ptr<std::vector<int32_t>>& ports) override;
593+
591594
/*
592595
* Friend tests. We want the abilty to test private methods
593596
* without comprimising encapsulation for code generally.

fboss/agent/hw/bcm/benchmarks/BUCK

+1
Original file line numberDiff line numberDiff line change
@@ -280,5 +280,6 @@ bcm_agent_benchmark(
280280
"//fboss/agent/hw/bcm/tests:bcm_qos_utils",
281281
"//fboss/agent/hw/benchmarks:hw_rx_slow_path_rate",
282282
"//fboss/agent/hw/benchmarks:hw_tx_slow_path_rate",
283+
"//fboss/agent/hw/benchmarks:hw_clear_interface_phy_counters",
283284
],
284285
)

0 commit comments

Comments
 (0)