Skip to content

Commit e5a70f5

Browse files
authored
Merge pull request #1378 from mhamdan12/mstflint_4_33_0_GB
3 bug fixes:
2 parents 59d61ed + 97dc557 commit e5a70f5

File tree

5 files changed

+43
-37
lines changed

5 files changed

+43
-37
lines changed

mlxlink/modules/mlxlink_amBER_collector.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2606,7 +2606,7 @@ vector<AmberField> MlxlinkAmBerCollector::getExtModuleStatus()
26062606
{
26072607
if (!_isPortPCIE)
26082608
{
2609-
sendLocalPrmReg(ACCESS_REG_PEMI, GET, "local_port=%d", _localPort);
2609+
sendPrmReg(ACCESS_REG_PEMI, GET, "local_port=%d,page_select=%d", _localPort, PEMI_GROUP_SEL_SNR_SAMPLES);
26102610

26112611
u_int32_t groupCapMask = getLocalFieldValue("group_cap_mask");
26122612

mlxlink/modules/mlxlink_commander.cpp

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,10 +1677,10 @@ void MlxlinkCommander::prepareDDMSection(bool valid, bool isModuleExtSupported)
16771677
float voltageHighTH = getFieldValue("voltage_high_th") / 10.0;
16781678
float voltageLowTH = getFieldValue("voltage_low_th") / 10.0;
16791679

1680-
rxPowerHighTH = getPower(getFieldValue("rx_power_high_th"));
1681-
rxPowerLowTH = getPower(getFieldValue("rx_power_low_th"));
1682-
txPowerHighTH = getPower(getFieldValue("tx_power_high_th"));
1683-
txPowerLowTH = getPower(getFieldValue("tx_power_low_th"));
1680+
rxPowerHighTH = getPower(getFieldValue("rx_power_high_th"), isModuleExtSupported);
1681+
rxPowerLowTH = getPower(getFieldValue("rx_power_low_th"), isModuleExtSupported);
1682+
txPowerHighTH = getPower(getFieldValue("tx_power_high_th"), isModuleExtSupported);
1683+
txPowerLowTH = getPower(getFieldValue("tx_power_low_th"), isModuleExtSupported);
16841684
if (isModuleExtSupported)
16851685
{
16861686
rxPowerHighTH = convertFloatPrec(rxPowerHighTH);
@@ -1706,8 +1706,8 @@ void MlxlinkCommander::prepareDDMSection(bool valid, bool isModuleExtSupported)
17061706
for (u_int32_t lane = 0; lane < _numOfLanes; lane++)
17071707
{
17081708
string laneStr = to_string(_moduleLanesMapping[lane]);
1709-
rxPowerLane.push_back(getPower(getFieldValue("rx_power_lane" + laneStr)));
1710-
txPowerLane.push_back(getPower(getFieldValue("tx_power_lane" + laneStr)));
1709+
rxPowerLane.push_back(getPower(getFieldValue("rx_power_lane" + laneStr), isModuleExtSupported));
1710+
txPowerLane.push_back(getPower(getFieldValue("tx_power_lane" + laneStr), isModuleExtSupported));
17111711
biasCurrentLane.push_back(getFieldValue("tx_bias_lane" + laneStr) * txMultiplier / 500.0);
17121712
}
17131713

@@ -1727,37 +1727,27 @@ void MlxlinkCommander::prepareDDMSection(bool valid, bool isModuleExtSupported)
17271727
setPrintVal(_moduleInfoCmd, "Tx Power Current [dBm]", txPowerStr, ANSI_COLOR_RESET, true, valid);
17281728
}
17291729

1730-
string MlxlinkCommander::getValuesOfActiveLanes(const string& row, bool isSnr)
1730+
string MlxlinkCommander::getValuesOfActiveLanes(const string& row, bool moduleLanes)
17311731
{
17321732
string newValue = row;
17331733

17341734
auto valuesPerLane = MlxlinkRecord::split(newValue, ",");
1735-
1735+
vector<string> validValues;
17361736
if (valuesPerLane.size() > 1)
17371737
{
1738-
if (isSnr)
1738+
for (u_int32_t i = 0; i < _numOfLanes; i++)
17391739
{
1740-
// Remove all "0" (invalid lanes) values
1741-
valuesPerLane.erase(std::remove_if(valuesPerLane.begin(), valuesPerLane.end(),
1742-
[](const string& value) { return value == "0"; }),
1743-
valuesPerLane.end());
1744-
1745-
// If all lanes are invalid, set all lanes to 0
1746-
if (valuesPerLane.empty())
1740+
if (moduleLanes)
17471741
{
1748-
for (u_int32_t i = 0; i < _numOfLanes; i++)
1749-
{
1750-
valuesPerLane.push_back(to_string(0));
1751-
}
1742+
validValues.push_back(valuesPerLane[_moduleLanesMapping[i]]);
1743+
}
1744+
else
1745+
{
1746+
validValues.push_back(valuesPerLane[i]);
17521747
}
1753-
}
1754-
else
1755-
{
1756-
// Remove all lanes that are not in the valuesPerLane vector
1757-
valuesPerLane.erase(valuesPerLane.begin() + _numOfLanes, valuesPerLane.end());
17581748
}
17591749

1760-
newValue = getStringFromVector(valuesPerLane);
1750+
newValue = getStringFromVector(validValues);
17611751
}
17621752

17631753
return newValue;
@@ -1852,7 +1842,7 @@ void MlxlinkCommander::prepareBerModuleInfo(bool valid, const vector<AmberField>
18521842
}
18531843
if (it->perLane)
18541844
{
1855-
fieldValue = getValuesOfActiveLanes(fieldValue);
1845+
fieldValue = getValuesOfActiveLanes(fieldValue, true);
18561846
}
18571847

18581848
if ((it->uiName == "Cable Rx Emphasis") && _cmisCable)
@@ -1868,12 +1858,12 @@ bool MlxlinkCommander::checkIfModuleExtSupported()
18681858
{
18691859
bool isModuleExtSupported = false;
18701860

1871-
sendPrmReg(ACCESS_REG_PDDR, GET, "page_select=%d , module_info_ext=1", PDDR_MODULE_INFO_PAGE);
1872-
float rxPowerHighTH_fst = getFieldValue("rx_power_high_th");
1873-
18741861
sendPrmReg(ACCESS_REG_PDDR, GET, "page_select=%d , module_info_ext=0", PDDR_MODULE_INFO_PAGE);
18751862
float rxPowerHighTH_sec = getFieldValue("rx_power_high_th");
18761863

1864+
sendPrmReg(ACCESS_REG_PDDR, GET, "page_select=%d , module_info_ext=1", PDDR_MODULE_INFO_PAGE);
1865+
float rxPowerHighTH_fst = getFieldValue("rx_power_high_th");
1866+
18771867
if (rxPowerHighTH_sec != rxPowerHighTH_fst)
18781868
{
18791869
isModuleExtSupported = true;

mlxlink/modules/mlxlink_commander.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ class MlxlinkCommander : public MlxlinkRegParser
438438
void handleLabelPorts(std::vector<string> labelPortsStr, bool skipException = false);
439439
vector<string> localToPortsPerGroup(vector<u_int32_t> localPorts);
440440
u_int32_t getPortGroup(u_int32_t localPort);
441-
string getValuesOfActiveLanes(const string& row, bool isSnr = false);
441+
string getValuesOfActiveLanes(const string& row, bool moduleLanes = false);
442442
bool checkIfModuleExtSupported();
443443

444444
// Mlxlink query functions

mlxlink/modules/mlxlink_utils.cpp

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,13 +1107,29 @@ string getTemp(u_int32_t temp, int celsParam)
11071107
return to_string(temp / celsParam);
11081108
}
11091109

1110-
float getPower(u_int16_t power)
1110+
float getPower(u_int16_t power, bool isModuleExtSupported)
11111111
{
1112-
if (power & 0x8000)
1112+
// FW reports dbm values as integers, we read values in uw and convert manually to dbm to have more accuracy
1113+
// this function is used to convert the power values from UW to dBm
1114+
double result = -40;
1115+
1116+
if (isModuleExtSupported)
11131117
{
1114-
return -((~power & 0xFFFF) + 1);
1118+
if (power != 0)
1119+
{
1120+
result = 10 * log10(float(power) / 1000.0);
1121+
}
1122+
1123+
return result;
1124+
}
1125+
else
1126+
{
1127+
if (power & 0x8000)
1128+
{
1129+
return -((~power & 0xFFFF) + 1);
1130+
}
1131+
return power;
11151132
}
1116-
return power;
11171133
}
11181134

11191135
int getHeight(u_int16_t height)

mlxlink/modules/mlxlink_utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ bool isQsfpCable(u_int32_t identifier);
121121
string getCmisCableType(u_int32_t cableType, u_int32_t cableLength);
122122
string getCableType(u_int32_t cableType);
123123
string getTemp(u_int32_t temp, int celsParam = 256);
124-
float getPower(u_int16_t power);
124+
float getPower(u_int16_t power, bool isModuleExtSupported = false);
125125
int getHeight(u_int16_t height);
126126
int getPhase(u_int8_t phase);
127127
int getVersion(u_int8_t version);

0 commit comments

Comments
 (0)