nvmf/rpc: represent pci_address consistently
The get_nvmf_subsystems RPC reported the PCI address of direct-mode NVMe devices as individual integers, but the construct_nvmf_subsystem call requires pci_address in a string format (%x:%x:%x.%x). Change get_nvmf_subsystems to format the PCI address in the same way that construct_nvmf_subsystem takes as a parameter for consistency. Change-Id: I6e55e9a9e73dd425fd560d609b86a2f839c53c61 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
de16fcca32
commit
b94e0dfdb2
@ -98,22 +98,17 @@ dump_nvmf_subsystem(struct spdk_json_write_ctx *w, struct spdk_nvmf_subsystem *s
|
||||
|
||||
if (subsystem->subtype == SPDK_NVMF_SUBTYPE_NVME) {
|
||||
if (subsystem->mode == NVMF_SUBSYSTEM_MODE_DIRECT) {
|
||||
char pci_str[20];
|
||||
struct spdk_pci_device *dev = subsystem->dev.direct.pci_dev;
|
||||
uint16_t found_domain = spdk_pci_device_get_domain(dev);
|
||||
uint8_t found_bus = spdk_pci_device_get_bus(dev);
|
||||
uint8_t found_dev = spdk_pci_device_get_dev(dev);
|
||||
uint8_t found_func = spdk_pci_device_get_func(dev);
|
||||
|
||||
snprintf(pci_str, sizeof(pci_str), "%04x:%02x:%02x.%x",
|
||||
spdk_pci_device_get_domain(dev),
|
||||
spdk_pci_device_get_bus(dev),
|
||||
spdk_pci_device_get_dev(dev),
|
||||
spdk_pci_device_get_func(dev));
|
||||
|
||||
spdk_json_write_name(w, "pci_address");
|
||||
spdk_json_write_object_begin(w);
|
||||
spdk_json_write_name(w, "domain");
|
||||
spdk_json_write_int32(w, found_domain);
|
||||
spdk_json_write_name(w, "bus");
|
||||
spdk_json_write_int32(w, found_bus);
|
||||
spdk_json_write_name(w, "device");
|
||||
spdk_json_write_int32(w, found_dev);
|
||||
spdk_json_write_name(w, "function");
|
||||
spdk_json_write_int32(w, found_func);
|
||||
spdk_json_write_object_end(w);
|
||||
spdk_json_write_string(w, pci_str);
|
||||
} else {
|
||||
int i;
|
||||
spdk_json_write_name(w, "serial_number");
|
||||
|
Loading…
Reference in New Issue
Block a user