Skip to content

Commit

Permalink
mstconfig: Add support for PCI domain up to 32-bits
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Goldman <[email protected]>
  • Loading branch information
acgoldma committed Mar 29, 2024
1 parent ff014c1 commit f514d99
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions include/mtcr_ul/mtcr_com_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ typedef enum
typedef struct vf_info_t
{
char dev_name[512];
u_int16_t domain;
u_int32_t domain;
u_int8_t bus;
u_int8_t dev;
u_int8_t func;
Expand All @@ -353,7 +353,7 @@ typedef struct dev_info_t
{
struct
{
u_int16_t domain;
u_int32_t domain;
u_int8_t bus;
u_int8_t dev;
u_int8_t func;
Expand Down
6 changes: 3 additions & 3 deletions mlxconfig/mlxcfg_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,9 @@ mlxCfgStatus MlxCfg::queryDevsCfg()
mdevices_info_destroy(dev, numOfDev);
return err(true, NO_DEV_ERR);
}
// printf("-D- num of dev: %d , 1st dev : %s\n", numOfDev, buf);
// printf("-D- num of dev: %d , 1st dev : %s\n", numOfDev, dev->dev_name);
dev_info* devPtr = dev;
char pcibuf[32] = {0};
char pcibuf[64] = {0};

for (int i = 0; i < numOfDev; i++)
{
Expand All @@ -268,7 +268,7 @@ mlxCfgStatus MlxCfg::queryDevsCfg()
#else
const char* device_name_ptrn = "%04x:%02x:%02x.%x";
#endif
snprintf(pcibuf, 32, device_name_ptrn, devPtr->pci.domain, devPtr->pci.bus, devPtr->pci.dev,
snprintf(pcibuf, 64, device_name_ptrn, devPtr->pci.domain, devPtr->pci.bus, devPtr->pci.dev,
devPtr->pci.func);
if (queryDevCfg(devPtr->pci.conf_dev, pcibuf, i + 1))
{
Expand Down
6 changes: 3 additions & 3 deletions mtcr_ul/mtcr_ul_com.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,11 @@ static int _extract_dbdf_from_full_name(const char* name,
unsigned * dev,
unsigned * func)
{
if (sscanf(name, "/sys/bus/pci/devices/%4x:%2x:%2x.%d/resource0", domain, bus, dev, func) == 4) {
if (sscanf(name, "/sys/bus/pci/devices/%x:%2x:%2x.%d/resource0", domain, bus, dev, func) == 4) {
return 0;
} else if (sscanf(name, "/sys/bus/pci/devices/%4x:%2x:%2x.%d/config", domain, bus, dev, func) == 4) {
} else if (sscanf(name, "/sys/bus/pci/devices/%x:%2x:%2x.%d/config", domain, bus, dev, func) == 4) {
return 0;
} else if (sscanf(name, "/proc/bus/pci/%4x:%2x/%2x.%d", domain, bus, dev, func) == 4) {
} else if (sscanf(name, "/proc/bus/pci/%x:%2x/%2x.%d", domain, bus, dev, func) == 4) {
return 0;
} else if (sscanf(name, "/proc/bus/pci/%2x/%2x.%d", bus, dev, func) == 3) {
*domain = 0;
Expand Down

0 comments on commit f514d99

Please sign in to comment.