Skip to content

Commit 668f2f8

Browse files
authored
Merge branch 'main' into arashpartow/update_exprtk_0.0.3
2 parents 176b871 + 95c756d commit 668f2f8

Some content is hidden

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

56 files changed

+1786
-4937
lines changed

.buckconfig.d/external_cells/facebook/buck2-shims-meta/external_cell.buckconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ gh_facebook_buck2_shims_meta = git
66

77
[external_cell_gh_facebook_buck2_shims_meta]
88
git_origin = https://github.com/facebook/buck2-shims-meta.git
9-
commit_hash = 461a1b10af7eb8af2f6d0eb0129009d60048e6de
9+
commit_hash = b79235f6447a07f78644ab08261e3acfe4e12604
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 43a8ca1e89fc3ab45abf9eff78b6c0ec4510ebdb
1+
Subproject commit d15028627fdd473945f04124f118e17142471f81
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 6c55aa9762cffed619c25abf07d273b39985e979
1+
Subproject commit 300f4d5e79e763ef74243da9a1f3b9f649d5addd
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 46688946ef13435ad9e873a5ba5684677783945b
1+
Subproject commit d54405ad3588791be7146a19fe4e914af0807c28

cmake/Agent.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ target_link_libraries(switchid_scope_resolver
457457
fboss_error
458458
hwswitch_matcher
459459
state
460+
switchinfo_utils
460461
)
461462

462463
add_library(hwagent

fboss/agent/ApplyThriftConfig.cpp

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ using folly::StringPiece;
101101
using std::make_shared;
102102
using std::shared_ptr;
103103

104+
using namespace facebook::fboss;
104105
namespace {
105106

106107
const uint8_t kV6LinkLocalAddrMask{64};
@@ -148,6 +149,55 @@ std::shared_ptr<MultiMap> toMultiSwitchMap(
148149
return multiMap;
149150
}
150151

152+
bool haveParallelLinksToInterfaceNodes(
153+
const cfg::SwitchConfig* cfg,
154+
const std::vector<SwitchID>& localFabricSwitchIds,
155+
const std::unordered_map<std::string, std::vector<uint32_t>>&
156+
switchNameToSwitchIds,
157+
SwitchIdScopeResolver& scopeResolver,
158+
const PlatformMapping* platformMapping) {
159+
for (const auto& fabricSwitchId : localFabricSwitchIds) {
160+
// Determine parallel links on VD level - there are two VDs per R3 ASIC
161+
std::unordered_map<int, std::unordered_set<std::string>> vd2VoqNeighbors;
162+
for (const auto& port : *cfg->ports()) {
163+
// Only process ports belonging to one switchId
164+
if (scopeResolver.scope(port).has(SwitchID(fabricSwitchId)) &&
165+
port.expectedNeighborReachability()->size() > 0) {
166+
auto neighborRemoteSwitchId =
167+
getRemoteSwitchID(cfg, port, switchNameToSwitchIds);
168+
const auto& neighborDsfNodeIter =
169+
cfg->dsfNodes()->find(neighborRemoteSwitchId);
170+
CHECK(neighborDsfNodeIter != cfg->dsfNodes()->end());
171+
if (*neighborDsfNodeIter->second.type() ==
172+
cfg::DsfNodeType::INTERFACE_NODE) {
173+
CHECK(port.name().has_value());
174+
auto localVirtualDeviceId =
175+
platformMapping->getVirtualDeviceID(*port.name());
176+
if (!localVirtualDeviceId.has_value()) {
177+
throw FbossError(
178+
"Unable to find virtual device id for port: ",
179+
*port.logicalID(),
180+
" virtual device");
181+
}
182+
183+
if (vd2VoqNeighbors.find(localVirtualDeviceId.value()) ==
184+
vd2VoqNeighbors.end()) {
185+
vd2VoqNeighbors.insert(
186+
{localVirtualDeviceId.value(),
187+
std::unordered_set<std::string>()});
188+
}
189+
auto& voqNeighbors = vd2VoqNeighbors[localVirtualDeviceId.value()];
190+
const auto& [neighborName, _] = getExpectedNeighborAndPortName(port);
191+
if (voqNeighbors.find(neighborName) != voqNeighbors.end()) {
192+
return true;
193+
}
194+
voqNeighbors.insert(neighborName);
195+
}
196+
}
197+
}
198+
}
199+
return false;
200+
};
151201
} // anonymous namespace
152202

153203
namespace facebook::fboss {
@@ -4532,6 +4582,28 @@ shared_ptr<SwitchSettings> ThriftConfigApplier::updateSwitchSettings(
45324582
switchSettingsChange = true;
45334583
}
45344584

4585+
std::optional<uint16_t> newLinkFlowControlCreditThreshold;
4586+
if (cfg_->switchSettings()->linkFlowControlCreditThreshold()) {
4587+
newLinkFlowControlCreditThreshold =
4588+
*cfg_->switchSettings()->linkFlowControlCreditThreshold();
4589+
}
4590+
if (newLinkFlowControlCreditThreshold !=
4591+
origSwitchSettings->getLinkFlowControlCreditThreshold()) {
4592+
newSwitchSettings->setLinkFlowControlCreditThreshold(
4593+
newLinkFlowControlCreditThreshold);
4594+
switchSettingsChange = true;
4595+
}
4596+
4597+
std::optional<uint32_t> newVoqDramBoundThreshold;
4598+
if (cfg_->switchSettings()->voqDramBoundThreshold()) {
4599+
newVoqDramBoundThreshold = *cfg_->switchSettings()->voqDramBoundThreshold();
4600+
}
4601+
if (newVoqDramBoundThreshold !=
4602+
origSwitchSettings->getVoqDramBoundThreshold()) {
4603+
newSwitchSettings->setVoqDramBoundThreshold(newVoqDramBoundThreshold);
4604+
switchSettingsChange = true;
4605+
}
4606+
45354607
if (origSwitchSettings->getSwitchDrainState() !=
45364608
*cfg_->switchSettings()->switchDrainState()) {
45374609
auto numVoqSwtitches =

fboss/agent/BUCK

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,22 @@ cpp_library(
616616
],
617617
)
618618

619+
cpp_library(
620+
name = "fsdb_adapted_sub_manager",
621+
srcs = [
622+
"FsdbAdaptedSubManager.cpp",
623+
],
624+
headers = [
625+
"FsdbAdaptedSubManager.h",
626+
],
627+
exported_deps = [
628+
"//fboss/agent/state:state",
629+
"//fboss/fsdb/client:fsdb_sub_manager",
630+
"//fboss/fsdb/if:fsdb_model",
631+
"//fboss/thrift_cow/storage:cow_storage",
632+
],
633+
)
634+
619635
cpp_library(
620636
name = "core",
621637
srcs = [
@@ -633,7 +649,6 @@ cpp_library(
633649
"EncapIndexAllocator.cpp",
634650
"FabricConnectivityManager.cpp",
635651
"FibHelpers.cpp",
636-
"FsdbAdaptedSubManager.cpp",
637652
"FsdbSyncer.cpp",
638653
"HwAsicTable.cpp",
639654
"HwSwitchConnectionStatusTable.cpp",
@@ -721,6 +736,7 @@ cpp_library(
721736
":fboss-error",
722737
":fboss-event-base",
723738
":fboss-types",
739+
":fsdb_adapted_sub_manager",
724740
":hw_switch_handler",
725741
":hwswitchcallback",
726742
":l2learn_event_observer",
@@ -1181,6 +1197,7 @@ cpp_library(
11811197
":fboss-error",
11821198
":fboss-types",
11831199
":hwswitch_matcher",
1200+
":switchinfo_utils",
11841201
"//fboss/agent/state:state",
11851202
],
11861203
exported_external_deps = [

fboss/agent/DsfUpdateValidator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include "fboss/agent/DsfUpdateValidator.h"
44
#include "fboss/agent/DsfStateUpdaterUtil.h"
5-
#include "fboss/agent/Utils.h"
5+
#include "fboss/agent/SwitchInfoUtils.h"
66
#include "fboss/agent/state/DeltaFunctions.h"
77
#include "fboss/agent/state/InterfaceMap.h"
88
#include "fboss/agent/state/StateDelta.h"

fboss/agent/SwitchIdScopeResolver.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include "fboss/agent/SwitchIdScopeResolver.h"
44
#include "fboss/agent/FbossError.h"
5+
#include "fboss/agent/SwitchInfoUtils.h"
56
#include "fboss/agent/state/AclTableGroup.h"
67
#include "fboss/agent/state/AggregatePort.h"
78
#include "fboss/agent/state/ForwardingInformationBaseMap.h"
@@ -137,17 +138,11 @@ HwSwitchMatcher SwitchIdScopeResolver::scope(
137138
}
138139

139140
HwSwitchMatcher SwitchIdScopeResolver::scope(SystemPortID sysPortId) const {
140-
auto sysPortInt = static_cast<int64_t>(sysPortId);
141141
for (const auto& [id, info] : switchIdToSwitchInfo_) {
142-
if (!info.systemPortRange().has_value()) {
143-
continue;
144-
}
145-
if (sysPortInt >= *info.systemPortRange()->minimum() &&
146-
sysPortInt <= *info.systemPortRange()->maximum()) {
142+
if (withinRange(*info.systemPortRanges(), sysPortId)) {
147143
return HwSwitchMatcher(std::unordered_set<SwitchID>({SwitchID(id)}));
148144
}
149145
}
150-
151146
// This is a non local sys port. So it maps to all local voq switchIds
152147
return voqSwitchMatcher();
153148
}

fboss/agent/SwitchInfoUtils.cpp

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,20 @@
1717
#include "fboss/agent/hw/switch_asics/HwAsic.h"
1818

1919
namespace facebook::fboss {
20+
namespace {
21+
22+
bool withinRange(const cfg::SystemPortRanges& ranges, int64_t id) {
23+
bool inRange{false};
24+
for (const auto& sysPortRange : *ranges.systemPortRanges()) {
25+
if (id >= *sysPortRange.minimum() && id <= *sysPortRange.maximum()) {
26+
inRange = true;
27+
break;
28+
}
29+
}
30+
return inRange;
31+
}
32+
} // namespace
33+
2034
const std::map<int64_t, cfg::SwitchInfo> getSwitchInfoFromConfigImpl(
2135
const cfg::SwitchConfig* config) {
2236
std::map<int64_t, cfg::SwitchInfo> switchInfoMap;
@@ -32,16 +46,6 @@ const std::map<int64_t, cfg::SwitchInfo> getSwitchInfoFromConfigImpl(
3246
switchInfo.portIdRange()->maximum() =
3347
cfg::switch_config_constants::DEFAULT_PORT_ID_RANGE_MAX();
3448
}
35-
if (switchInfo.switchType() == cfg::SwitchType::VOQ &&
36-
!switchInfo.systemPortRange()) {
37-
auto dsfItr =
38-
config->dsfNodes()->find(static_cast<int64_t>(entry.first));
39-
if (dsfItr != config->dsfNodes()->end()) {
40-
auto localNode = dsfItr->second;
41-
CHECK(localNode.systemPortRange().has_value());
42-
switchInfo.systemPortRange() = *localNode.systemPortRange();
43-
}
44-
}
4549
switchInfoMap.emplace(entry.first, switchInfo);
4650
}
4751
}
@@ -106,4 +110,13 @@ const std::optional<cfg::SdkVersion> getSdkVersionFromConfig(
106110
auto& swConfig = config->thrift.sw().value();
107111
return getSdkVersionFromConfigImpl(&swConfig);
108112
}
113+
114+
bool withinRange(const cfg::SystemPortRanges& ranges, InterfaceID intfId) {
115+
return withinRange(ranges, static_cast<int64_t>(intfId));
116+
}
117+
118+
bool withinRange(const cfg::SystemPortRanges& ranges, SystemPortID sysPortId) {
119+
return withinRange(ranges, static_cast<int64_t>(sysPortId));
120+
}
121+
109122
} // namespace facebook::fboss

0 commit comments

Comments
 (0)