vmd.h File Reference

VMD driver public interface. More...

Macros

#define MAX_VMD_TARGET   24
 

Enumerations

enum  spdk_vmd_led_state {
  SPDK_VMD_LED_STATE_OFF, SPDK_VMD_LED_STATE_IDENTIFY, SPDK_VMD_LED_STATE_FAULT, SPDK_VMD_LED_STATE_REBUILD,
  SPDK_VMD_LED_STATE_UNKNOWN
}
 State of the LEDs.
 

Functions

int spdk_vmd_init (void)
 Enumerate VMD devices and hook them into the spdk pci subsystem. More...
 
void spdk_vmd_fini (void)
 Release any resources allocated by the VMD library via spdk_vmd_init().
 
int spdk_vmd_pci_device_list (struct spdk_pci_addr vmd_addr, struct spdk_pci_device *nvme_list)
 Returns a list of nvme devices found on the given vmd pci BDF. More...
 
int spdk_vmd_set_led_state (struct spdk_pci_device *pci_device, enum spdk_vmd_led_state state)
 Sets the state of the LED on specified PCI device. More...
 
int spdk_vmd_get_led_state (struct spdk_pci_device *pci_device, enum spdk_vmd_led_state *state)
 Retrieves the state of the LED on specified PCI device. More...
 
int spdk_vmd_hotplug_monitor (void)
 Checks for hotplug/hotremove events of the devices behind the VMD. More...
 

Detailed Description

VMD driver public interface.

Function Documentation

◆ spdk_vmd_get_led_state()

int spdk_vmd_get_led_state ( struct spdk_pci_device pci_device,
enum spdk_vmd_led_state state 
)

Retrieves the state of the LED on specified PCI device.

The device needs to be behind VMD.

Parameters
pci_devicePCI device
statecurrent LED state
Returns
0 on success, negative errno otherwise

◆ spdk_vmd_hotplug_monitor()

int spdk_vmd_hotplug_monitor ( void  )

Checks for hotplug/hotremove events of the devices behind the VMD.

Needs to be called periodically to detect them.

Returns
number of hotplug events detected or negative errno in case of errors

◆ spdk_vmd_init()

int spdk_vmd_init ( void  )

Enumerate VMD devices and hook them into the spdk pci subsystem.

Returns
0 on success, -1 on failure

◆ spdk_vmd_pci_device_list()

int spdk_vmd_pci_device_list ( struct spdk_pci_addr  vmd_addr,
struct spdk_pci_device nvme_list 
)

Returns a list of nvme devices found on the given vmd pci BDF.

Parameters
vmd_addrpci BDF of the vmd device to return end device list
nvme_listbuffer of exactly MAX_VMD_TARGET to return spdk_pci_device array.
Returns
Returns count of nvme device attached to input VMD.

◆ spdk_vmd_set_led_state()

int spdk_vmd_set_led_state ( struct spdk_pci_device pci_device,
enum spdk_vmd_led_state  state 
)

Sets the state of the LED on specified PCI device.

The device needs to be behind VMD.

Parameters
pci_devicePCI device
stateLED state to set
Returns
0 on success, negative errno otherwise