Level 0 Sysman FabricPort updates.
Add fabric port routines to zello_sysman. Add subdevice support to FabricPort routines. Update source paths for additional FabricPort development. Signed-off-by: William Jordan <bill.jordan@intel.com>
This commit is contained in:
parent
5f77fb9196
commit
4732a4e692
|
@ -34,14 +34,7 @@ void fabricPortGetTimestamp(uint64_t ×tamp) {
|
|||
}
|
||||
|
||||
ze_result_t FabricPortImp::fabricPortGetProperties(zes_fabric_port_properties_t *pProperties) {
|
||||
pOsFabricPort->getModel(pProperties->model);
|
||||
pProperties->onSubdevice = onSubdevice;
|
||||
pProperties->subdeviceId = subdeviceId;
|
||||
pOsFabricPort->getPortId(pProperties->portId);
|
||||
pOsFabricPort->getMaxRxSpeed(pProperties->maxRxSpeed);
|
||||
pOsFabricPort->getMaxTxSpeed(pProperties->maxTxSpeed);
|
||||
|
||||
return ZE_RESULT_SUCCESS;
|
||||
return pOsFabricPort->getProperties(pProperties);
|
||||
}
|
||||
|
||||
ze_result_t FabricPortImp::fabricPortGetLinkType(zes_fabric_link_type_t *pLinkType) {
|
||||
|
@ -66,8 +59,6 @@ ze_result_t FabricPortImp::fabricPortGetThroughput(zes_fabric_port_throughput_t
|
|||
}
|
||||
|
||||
void FabricPortImp::init() {
|
||||
onSubdevice = false;
|
||||
subdeviceId = 0L;
|
||||
}
|
||||
|
||||
FabricPortImp::FabricPortImp(FabricDevice *pFabricDevice, uint32_t portNum) {
|
||||
|
|
|
@ -43,10 +43,6 @@ class FabricPortImp : public FabricPort, NEO::NonCopyableOrMovableClass {
|
|||
protected:
|
||||
void init();
|
||||
OsFabricPort *pOsFabricPort = nullptr;
|
||||
|
||||
private:
|
||||
bool onSubdevice = false;
|
||||
uint32_t subdeviceId = 0U;
|
||||
};
|
||||
|
||||
} // namespace L0
|
||||
|
|
|
@ -6,10 +6,12 @@
|
|||
|
||||
set(L0_SRCS_TOOLS_SYSMAN_FABRICPORT_LINUX
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_fabric_port_imp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_fabric_port_imp.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/os_fabric_port_imp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/os_fabric_port_imp.h
|
||||
)
|
||||
|
||||
add_subdirectories()
|
||||
|
||||
if(UNIX)
|
||||
target_sources(${L0_STATIC_LIB_NAME}
|
||||
PRIVATE
|
||||
|
|
|
@ -56,20 +56,14 @@ ze_result_t LinuxFabricPortImp::getThroughput(zes_fabric_port_throughput_t *pThr
|
|||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
void LinuxFabricPortImp::getModel(char *model) {
|
||||
::snprintf(model, ZES_MAX_FABRIC_PORT_MODEL_SIZE, "%s", this->model.c_str());
|
||||
}
|
||||
|
||||
void LinuxFabricPortImp::getPortId(zes_fabric_port_id_t &portId) {
|
||||
portId = this->portId;
|
||||
}
|
||||
|
||||
void LinuxFabricPortImp::getMaxRxSpeed(zes_fabric_port_speed_t &maxRxSpeed) {
|
||||
maxRxSpeed = this->maxRxSpeed;
|
||||
}
|
||||
|
||||
void LinuxFabricPortImp::getMaxTxSpeed(zes_fabric_port_speed_t &maxTxSpeed) {
|
||||
maxTxSpeed = this->maxTxSpeed;
|
||||
ze_result_t LinuxFabricPortImp::getProperties(zes_fabric_port_properties_t *pProperties) {
|
||||
::snprintf(pProperties->model, ZES_MAX_FABRIC_PORT_MODEL_SIZE, "%s", this->model.c_str());
|
||||
pProperties->onSubdevice = false;
|
||||
pProperties->subdeviceId = 0U;
|
||||
pProperties->portId = this->portId;
|
||||
pProperties->maxRxSpeed = this->maxRxSpeed;
|
||||
pProperties->maxTxSpeed = this->maxTxSpeed;
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
LinuxFabricPortImp::LinuxFabricPortImp(OsFabricDevice *pOsFabricDevice, uint32_t portNum) {
|
||||
|
|
|
@ -28,15 +28,12 @@ class LinuxFabricDeviceImp : public OsFabricDevice, NEO::NonCopyableOrMovableCla
|
|||
|
||||
class LinuxFabricPortImp : public OsFabricPort, NEO::NonCopyableOrMovableClass {
|
||||
public:
|
||||
ze_result_t getProperties(zes_fabric_port_properties_t *pProperties) override;
|
||||
ze_result_t getLinkType(zes_fabric_link_type_t *pLinkType) override;
|
||||
ze_result_t getConfig(zes_fabric_port_config_t *pConfig) override;
|
||||
ze_result_t setConfig(const zes_fabric_port_config_t *pConfig) override;
|
||||
ze_result_t getState(zes_fabric_port_state_t *pState) override;
|
||||
ze_result_t getThroughput(zes_fabric_port_throughput_t *pThroughput) override;
|
||||
void getModel(char *model) override;
|
||||
void getPortId(zes_fabric_port_id_t &portId) override;
|
||||
void getMaxRxSpeed(zes_fabric_port_speed_t &maxRxSpeed) override;
|
||||
void getMaxTxSpeed(zes_fabric_port_speed_t &maxTxSpeed) override;
|
||||
|
||||
LinuxFabricPortImp() = delete;
|
||||
LinuxFabricPortImp(OsFabricDevice *pOsFabricDevice, uint32_t portNum);
|
||||
|
|
|
@ -23,15 +23,12 @@ class OsFabricDevice {
|
|||
|
||||
class OsFabricPort {
|
||||
public:
|
||||
virtual ze_result_t getProperties(zes_fabric_port_properties_t *pProperties) = 0;
|
||||
virtual ze_result_t getLinkType(zes_fabric_link_type_t *pLinkType) = 0;
|
||||
virtual ze_result_t getConfig(zes_fabric_port_config_t *pConfig) = 0;
|
||||
virtual ze_result_t setConfig(const zes_fabric_port_config_t *pConfig) = 0;
|
||||
virtual ze_result_t getState(zes_fabric_port_state_t *pState) = 0;
|
||||
virtual ze_result_t getThroughput(zes_fabric_port_throughput_t *pThroughput) = 0;
|
||||
virtual void getModel(char *model) = 0;
|
||||
virtual void getPortId(zes_fabric_port_id_t &portId) = 0;
|
||||
virtual void getMaxRxSpeed(zes_fabric_port_speed_t &maxRxSpeed) = 0;
|
||||
virtual void getMaxTxSpeed(zes_fabric_port_speed_t &maxTxSpeed) = 0;
|
||||
|
||||
static OsFabricPort *create(OsFabricDevice *pOsFabricDevice, uint32_t portNum);
|
||||
|
||||
|
|
|
@ -41,20 +41,14 @@ ze_result_t WddmFabricPortImp::getThroughput(zes_fabric_port_throughput_t *pThro
|
|||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
|
||||
void WddmFabricPortImp::getModel(char *model) {
|
||||
::memset(model, '\0', ZES_MAX_FABRIC_PORT_MODEL_SIZE);
|
||||
}
|
||||
|
||||
void WddmFabricPortImp::getPortId(zes_fabric_port_id_t &portId) {
|
||||
::memset(&portId, '\0', sizeof(portId));
|
||||
}
|
||||
|
||||
void WddmFabricPortImp::getMaxRxSpeed(zes_fabric_port_speed_t &maxRxSpeed) {
|
||||
::memset(&maxRxSpeed, '\0', sizeof(maxRxSpeed));
|
||||
}
|
||||
|
||||
void WddmFabricPortImp::getMaxTxSpeed(zes_fabric_port_speed_t &maxTxSpeed) {
|
||||
::memset(&maxTxSpeed, '\0', sizeof(maxTxSpeed));
|
||||
ze_result_t WddmFabricPortImp::getProperties(zes_fabric_port_properties_t *pProperties) {
|
||||
::memset(pProperties->model, '\0', ZES_MAX_FABRIC_PORT_MODEL_SIZE);
|
||||
pProperties->onSubdevice = false;
|
||||
pProperties->subdeviceId = 0U;
|
||||
::memset(&pProperties->portId, '\0', sizeof(pProperties->portId));
|
||||
::memset(&pProperties->maxRxSpeed, '\0', sizeof(pProperties->maxRxSpeed));
|
||||
::memset(&pProperties->maxTxSpeed, '\0', sizeof(pProperties->maxTxSpeed));
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
|
||||
WddmFabricPortImp::WddmFabricPortImp(OsFabricDevice *pOsFabricDevice, uint32_t portNum) {
|
||||
|
|
|
@ -29,15 +29,12 @@ class WddmFabricDeviceImp : public OsFabricDevice, NEO::NonCopyableOrMovableClas
|
|||
|
||||
class WddmFabricPortImp : public OsFabricPort, NEO::NonCopyableOrMovableClass {
|
||||
public:
|
||||
ze_result_t getProperties(zes_fabric_port_properties_t *pProperties) override;
|
||||
ze_result_t getLinkType(zes_fabric_link_type_t *pLinkType) override;
|
||||
ze_result_t getConfig(zes_fabric_port_config_t *pConfig) override;
|
||||
ze_result_t setConfig(const zes_fabric_port_config_t *pConfig) override;
|
||||
ze_result_t getState(zes_fabric_port_state_t *pState) override;
|
||||
ze_result_t getThroughput(zes_fabric_port_throughput_t *pThroughput) override;
|
||||
void getModel(char *model) override;
|
||||
void getPortId(zes_fabric_port_id_t &portId) override;
|
||||
void getMaxRxSpeed(zes_fabric_port_speed_t &maxRxSpeed) override;
|
||||
void getMaxTxSpeed(zes_fabric_port_speed_t &maxTxSpeed) override;
|
||||
|
||||
WddmFabricPortImp() = delete;
|
||||
WddmFabricPortImp(OsFabricDevice *pOsFabricDevice, uint32_t portNum);
|
||||
|
|
|
@ -611,6 +611,116 @@ void testSysmanListenEvents(ze_driver_handle_t driver, std::vector<ze_device_han
|
|||
}
|
||||
}
|
||||
|
||||
std::string getFabricPortStatus(zes_fabric_port_status_t status) {
|
||||
static const std::map<zes_fabric_port_status_t, std::string> fabricPortStatus{
|
||||
{ZES_FABRIC_PORT_STATUS_UNKNOWN, "ZES_FABRIC_PORT_STATUS_UNKNOWN"},
|
||||
{ZES_FABRIC_PORT_STATUS_HEALTHY, "ZES_FABRIC_PORT_STATUS_HEALTHY"},
|
||||
{ZES_FABRIC_PORT_STATUS_DEGRADED, "ZES_FABRIC_PORT_STATUS_DEGRADED"},
|
||||
{ZES_FABRIC_PORT_STATUS_FAILED, "ZES_FABRIC_PORT_STATUS_FAILED"},
|
||||
{ZES_FABRIC_PORT_STATUS_DISABLED, "ZES_FABRIC_PORT_STATUS_DISABLED"}};
|
||||
auto i = fabricPortStatus.find(status);
|
||||
if (i == fabricPortStatus.end())
|
||||
return "UNEXPECTED STATUS";
|
||||
else
|
||||
return fabricPortStatus.at(status);
|
||||
}
|
||||
|
||||
std::string getFabricPortQualityIssues(zes_fabric_port_qual_issue_flags_t qualityIssues) {
|
||||
std::string returnValue;
|
||||
returnValue.clear();
|
||||
if (qualityIssues & ZES_FABRIC_PORT_QUAL_ISSUE_FLAG_LINK_ERRORS) {
|
||||
returnValue.append("ZES_FABRIC_PORT_QUAL_ISSUE_FLAG_LINK_ERRORS ");
|
||||
}
|
||||
if (qualityIssues & ZES_FABRIC_PORT_QUAL_ISSUE_FLAG_SPEED) {
|
||||
returnValue.append("ZES_FABRIC_PORT_QUAL_ISSUE_FLAG_SPEED");
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
std::string getFabricPortFailureReasons(zes_fabric_port_failure_flags_t failureReasons) {
|
||||
std::string returnValue;
|
||||
returnValue.clear();
|
||||
if (failureReasons & ZES_FABRIC_PORT_FAILURE_FLAG_FAILED) {
|
||||
returnValue.append("ZES_FABRIC_PORT_FAILURE_FLAG_FAILED ");
|
||||
}
|
||||
if (failureReasons & ZES_FABRIC_PORT_FAILURE_FLAG_TRAINING_TIMEOUT) {
|
||||
returnValue.append("ZES_FABRIC_PORT_FAILURE_FLAG_TRAINING_TIMEOUT ");
|
||||
}
|
||||
if (failureReasons & ZES_FABRIC_PORT_FAILURE_FLAG_FLAPPING) {
|
||||
returnValue.append("ZES_FABRIC_PORT_FAILURE_FLAG_FLAPPING ");
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
void testSysmanFabricPort(ze_device_handle_t &device) {
|
||||
std::cout << std::endl
|
||||
<< " ---- FabricPort tests ---- " << std::endl;
|
||||
uint32_t count = 0;
|
||||
VALIDATECALL(zesDeviceEnumFabricPorts(device, &count, nullptr));
|
||||
if (count == 0) {
|
||||
std::cout << "Could not retrieve FabricPorts" << std::endl;
|
||||
return;
|
||||
}
|
||||
std::vector<zes_fabric_port_handle_t> handles(count, nullptr);
|
||||
VALIDATECALL(zesDeviceEnumFabricPorts(device, &count, handles.data()));
|
||||
|
||||
for (auto handle : handles) {
|
||||
zes_fabric_port_properties_t fabricPortProperties = {};
|
||||
zes_fabric_link_type_t fabricPortLinkType = {};
|
||||
zes_fabric_port_config_t fabricPortConfig = {};
|
||||
zes_fabric_port_state_t fabricPortState = {};
|
||||
zes_fabric_port_throughput_t fabricPortThroughput = {};
|
||||
|
||||
VALIDATECALL(zesFabricPortGetProperties(handle, &fabricPortProperties));
|
||||
if (verbose) {
|
||||
std::cout << "Model = " << fabricPortProperties.model << std::endl;
|
||||
std::cout << "On Subdevice = " << fabricPortProperties.onSubdevice << std::endl;
|
||||
std::cout << "Subdevice Id = " << fabricPortProperties.subdeviceId << std::endl;
|
||||
std::cout << "Port ID = [" << fabricPortProperties.portId.fabricId
|
||||
<< ":" << fabricPortProperties.portId.attachId
|
||||
<< ":" << fabricPortProperties.portId.portNumber << "]" << std::endl;
|
||||
std::cout << "Max Rx Speed = " << fabricPortProperties.maxRxSpeed.bitRate
|
||||
<< " pbs, " << fabricPortProperties.maxRxSpeed.width << " lanes" << std::endl;
|
||||
std::cout << "Max Tx Speed = " << fabricPortProperties.maxTxSpeed.bitRate
|
||||
<< " pbs, " << fabricPortProperties.maxTxSpeed.width << " lanes" << std::endl;
|
||||
}
|
||||
|
||||
VALIDATECALL(zesFabricPortGetLinkType(handle, &fabricPortLinkType));
|
||||
if (verbose) {
|
||||
std::cout << "Link Type = " << fabricPortLinkType.desc << std::endl;
|
||||
}
|
||||
|
||||
VALIDATECALL(zesFabricPortGetConfig(handle, &fabricPortConfig));
|
||||
if (verbose) {
|
||||
std::cout << "Enabled = " << fabricPortConfig.enabled << std::endl;
|
||||
std::cout << "Beaconing = " << fabricPortConfig.beaconing << std::endl;
|
||||
}
|
||||
|
||||
VALIDATECALL(zesFabricPortGetState(handle, &fabricPortState));
|
||||
if (verbose) {
|
||||
std::cout << "Status = " << getFabricPortStatus(fabricPortState.status) << std::endl;
|
||||
std::cout << "Quality Issues = " << getFabricPortQualityIssues(fabricPortState.qualityIssues)
|
||||
<< std::hex << fabricPortState.qualityIssues << std::endl;
|
||||
std::cout << "Failure Reasons = " << getFabricPortFailureReasons(fabricPortState.failureReasons)
|
||||
<< std::hex << fabricPortState.failureReasons << std::endl;
|
||||
std::cout << "Remote Port ID = [" << fabricPortState.remotePortId.fabricId
|
||||
<< ":" << fabricPortState.remotePortId.attachId
|
||||
<< ":" << fabricPortState.remotePortId.portNumber << "]" << std::endl;
|
||||
std::cout << "Rx Speed = " << fabricPortState.rxSpeed.bitRate
|
||||
<< " pbs, " << fabricPortState.rxSpeed.width << " lanes" << std::endl;
|
||||
std::cout << "Tx Speed = " << fabricPortState.txSpeed.bitRate
|
||||
<< " pbs, " << fabricPortState.txSpeed.width << " lanes" << std::endl;
|
||||
}
|
||||
|
||||
VALIDATECALL(zesFabricPortGetThroughput(handle, &fabricPortThroughput));
|
||||
if (verbose) {
|
||||
std::cout << "Timestamp = " << fabricPortThroughput.timestamp << std::endl;
|
||||
std::cout << "RX Counter = " << fabricPortThroughput.rxCounter << std::endl;
|
||||
std::cout << "TX Counter = " << fabricPortThroughput.txCounter << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void testSysmanGlobalOperations(ze_device_handle_t &device) {
|
||||
std::cout << std::endl
|
||||
<< " ---- Global Operations tests ---- " << std::endl;
|
||||
|
@ -668,10 +778,11 @@ int main(int argc, char *argv[]) {
|
|||
{"memory", no_argument, nullptr, 'm'},
|
||||
{"event", no_argument, nullptr, 'E'},
|
||||
{"reset", required_argument, nullptr, 'r'},
|
||||
{"fabricport", no_argument, nullptr, 'F'},
|
||||
{0, 0, 0, 0},
|
||||
};
|
||||
bool force = false;
|
||||
while ((opt = getopt_long(argc, argv, "hpfsectogmrE:", long_opts, nullptr)) != -1) {
|
||||
while ((opt = getopt_long(argc, argv, "hpfsectogmrFE:", long_opts, nullptr)) != -1) {
|
||||
switch (opt) {
|
||||
case 'h':
|
||||
usage();
|
||||
|
@ -743,6 +854,11 @@ int main(int argc, char *argv[]) {
|
|||
testSysmanListenEvents(driver, devices,
|
||||
ZES_EVENT_TYPE_FLAG_DEVICE_RESET_REQUIRED | ZES_EVENT_TYPE_FLAG_DEVICE_DETACH | ZES_EVENT_TYPE_FLAG_DEVICE_ATTACH);
|
||||
break;
|
||||
case 'F':
|
||||
std::for_each(devices.begin(), devices.end(), [&](auto device) {
|
||||
testSysmanFabricPort(device);
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
usage();
|
||||
|
|
|
@ -8,7 +8,7 @@ if(UNIX)
|
|||
target_sources(${TARGET_NAME}
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_zes_fabric_port.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_fabric_device.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/test_zes_fabric_port.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/mock_fabric_device.h
|
||||
)
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue