Skip to content

Commit 4e8819c

Browse files
authored
Merge pull request #204 from Mustafadall/mlxlink_porting
Fixing port speed configuration for new devices
2 parents 874977e + 0910e83 commit 4e8819c

File tree

2 files changed

+29
-14
lines changed

2 files changed

+29
-14
lines changed

mlxlink/modules/mlxlink_commander.cpp

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2599,8 +2599,9 @@ void MlxlinkCommander::sendPtys()
25992599
u_int32_t ptysExtMask = 0x0;
26002600
string proto = (_protoActive == IB) ? "ib" : "eth";
26012601
for (u_int32_t i = 0; i < _ptysSpeeds.size(); i++) {
2602-
if (dm_dev_is_200g_speed_supported_hca(_devID) ||
2603-
dm_dev_is_200g_speed_supported_switch(_devID)) {
2602+
if (_protoActive == ETH &&
2603+
(dm_dev_is_200g_speed_supported_hca(_devID) ||
2604+
dm_dev_is_200g_speed_supported_switch(_devID))) {
26042605
ptysExtMask |= ptysSpeedToExtMask(_ptysSpeeds[i]);
26052606
} else {
26062607
ptysMask |= ptysSpeedToMask(_ptysSpeeds[i], protoCap);
@@ -2630,8 +2631,10 @@ void MlxlinkCommander::sendPtys()
26302631

26312632
u_int32_t MlxlinkCommander::ptysSpeedToExtMask(const string & speed)
26322633
{
2634+
2635+
checkSupportedSpeed(speed, _protoCapability, true);
26332636
if(_protoActive == IB)
2634-
return 0;
2637+
return ptysSpeedToMask(speed, _protoActive);
26352638
return ptysSpeedToExtMaskETH(speed);
26362639
}
26372640

@@ -2642,22 +2645,34 @@ u_int32_t MlxlinkCommander::ptysSpeedToMask(const string & speed, u_int32_t prot
26422645
ptysSpeedToMaskIB(speed) : ptysSpeedToMaskETH(speed);
26432646
}
26442647

2645-
void MlxlinkCommander::checkSupportedSpeed(const string & speed, u_int32_t protoCap)
2648+
void MlxlinkCommander::checkSupportedSpeed(const string & speed, u_int32_t protoCap, bool extSpeed)
26462649
{
2647-
u_int32_t mask =
2648-
(_protoActive == IB) ?
2649-
ptysSpeedToMaskIB(speed) : ptysSpeedToMaskETH(speed);
2650-
u_int32_t diffProto =
2651-
(_protoActive == IB) ?
2652-
ptysSpeedToMaskETH(speed) : ptysSpeedToMaskIB(speed);
2650+
u_int32_t mask = 0;
2651+
u_int32_t diffProto = 0;
2652+
string errStr = "";
2653+
if (!extSpeed) {
2654+
mask =
2655+
(_protoActive == IB) ?
2656+
ptysSpeedToMaskIB(speed) : ptysSpeedToMaskETH(speed);
2657+
diffProto =
2658+
(_protoActive == IB) ?
2659+
ptysSpeedToMaskETH(speed) : ptysSpeedToMaskIB(speed);
2660+
} else {
2661+
mask =
2662+
(_protoActive == IB) ?
2663+
ptysSpeedToMaskIB(speed) : ptysSpeedToExtMaskETH(speed);
2664+
diffProto =
2665+
(_protoActive == IB) ?
2666+
ptysSpeedToExtMaskETH(speed) : ptysSpeedToMaskIB(speed);
2667+
}
26532668
if (diffProto) {
2654-
string errStr = "Supported Speeds Are: ";
2655-
errStr += SupportedSpeeds2Str(_protoActive, protoCap);
2669+
errStr = "Supported Speeds Are: ";
2670+
errStr += SupportedSpeeds2Str(_protoActive, protoCap, extSpeed);
26562671
throw MlxRegException(speed + " is not supported by Protocol!\n" + errStr);
26572672
}
26582673
if (!(mask & protoCap)) {
26592674
string errStr = "Supported Speeds Are: ";
2660-
errStr += SupportedSpeeds2Str(_protoActive, protoCap);
2675+
errStr += SupportedSpeeds2Str(_protoActive, protoCap, extSpeed);
26612676
throw MlxRegException(speed + " is not supported by Device!\n" + errStr);
26622677
}
26632678
}

mlxlink/modules/mlxlink_commander.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ class MlxlinkCommander :public RegAccessParser{
474474
void sendPptt();
475475
u_int32_t ptysSpeedToMask(const string & speed, u_int32_t cap);
476476
u_int32_t ptysSpeedToExtMask(const string & speed);
477-
void checkSupportedSpeed(const string & speed, u_int32_t cap);
477+
void checkSupportedSpeed(const string & speed, u_int32_t cap, bool extSpeed = false);
478478
void checkPplmCap();
479479
void updateSltp28_40nmFields();
480480
void updateSltp16nmFields();

0 commit comments

Comments
 (0)