Skip to content

Commit 0144b27

Browse files
Prasoon Patelmeta-codesync[bot]
authored andcommitted
Define getPortPrbsPolynomials in bcm and sai handler
Summary: This diff defines the `getPortPrbsPolynomials` function in both `bcm` and `sai` handlers to retrieve the PRBS polynomials for a given port. Reviewed By: zechengh09 Differential Revision: D85903569 Privacy Context Container: L1297311 fbshipit-source-id: f66949986729a64fc907c4a810598eabe7c11e09
1 parent 6cff49e commit 0144b27

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

fboss/agent/HwSwitchThriftClientTable.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,13 @@ HwSwitchThriftClientTable::getPortPrbsPolynomials(
212212
const SwitchID& switchId,
213213
const PortID& portId) {
214214
std::vector<prbs::PrbsPolynomial> prbsPolynomials;
215+
auto client = getClient(switchId);
216+
try {
217+
client->sync_getPortPrbsPolynomials(prbsPolynomials, portId);
218+
} catch (const std::exception& ex) {
219+
XLOG(ERR) << "Failed to get port prbs polynomials for switch : " << switchId
220+
<< " error: " << ex.what();
221+
}
215222
return prbsPolynomials;
216223
}
217224
prbs::InterfacePrbsState HwSwitchThriftClientTable::getPortPrbsState(

fboss/agent/hw/sai/switch/SaiHandler.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,5 +445,12 @@ void SaiHandler::clearPortAsicPrbsStats(int32_t portId) {
445445
hw_->ensureConfigured(__func__);
446446
hw_->clearPortAsicPrbsStats(PortID(portId));
447447
}
448+
void SaiHandler::getPortPrbsPolynomials(
449+
std::vector<prbs::PrbsPolynomial>& prbsPolynomials,
450+
int32_t portId) {
451+
auto log = LOG_THRIFT_CALL(DBG1);
452+
hw_->ensureConfigured(__func__);
453+
prbsPolynomials = hw_->getPortPrbsPolynomials(PortID(portId));
454+
}
448455

449456
} // namespace facebook::fboss

fboss/agent/hw/sai/switch/SaiHandler.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ class SaiHandler : public apache::thrift::ServiceHandler<SaiCtrl> {
120120
std::vector<phy::PrbsLaneStats>& prbsStats,
121121
int32_t portId) override;
122122
void clearPortAsicPrbsStats(int32_t portId) override;
123+
void getPortPrbsPolynomials(
124+
std::vector<prbs::PrbsPolynomial>& prbsPolynomials,
125+
int32_t portId) override;
123126

124127
private:
125128
SaiSwitch* hw_;

0 commit comments

Comments
 (0)