pub struct IdentifyController { /* private fields */ }Expand description
Decoded Identify Controller (CNS 01h) data structure.
Owns the 4096-byte buffer returned by libnvme; accessors decode individual
fields on demand. Field naming uses the NVMe spec abbreviations where
they are widely known (e.g. vendor_id, not vid).
Implementations§
Source§impl IdentifyController
impl IdentifyController
Sourcepub fn vendor_id(&self) -> u16
pub fn vendor_id(&self) -> u16
PCI vendor ID (VID).
Examples found in repository?
22fn print_controller(ctrl: &libnvme::Controller<'_>) -> Result<(), Box<dyn std::error::Error>> {
23 println!("=== {} ===", ctrl.name()?);
24 let id = ctrl.identify()?;
25 println!(" vendor id : 0x{:04x}", id.vendor_id());
26 println!(" subsystem vendor : 0x{:04x}", id.subsystem_vendor_id());
27 println!(" model : {}", id.model_number()?);
28 println!(" serial : {}", id.serial_number()?);
29 println!(" firmware : {}", id.firmware_revision()?);
30 println!(" nvme spec : {}", id.nvme_version());
31 println!(" controller id : {}", id.controller_id());
32 println!(" controller type : {}", id.controller_type());
33 println!(" num namespaces : {}", id.num_namespaces());
34 println!(
35 " total nvm capacity : {} bytes",
36 id.total_nvm_capacity_bytes()
37 );
38 println!(
39 " warn temp threshold: {} K",
40 id.warning_temp_threshold_kelvin()
41 );
42 println!(
43 " crit temp threshold: {} K",
44 id.critical_temp_threshold_kelvin()
45 );
46 println!();
47 Ok(())
48}Sourcepub fn subsystem_vendor_id(&self) -> u16
pub fn subsystem_vendor_id(&self) -> u16
PCI subsystem vendor ID (SSVID).
Examples found in repository?
22fn print_controller(ctrl: &libnvme::Controller<'_>) -> Result<(), Box<dyn std::error::Error>> {
23 println!("=== {} ===", ctrl.name()?);
24 let id = ctrl.identify()?;
25 println!(" vendor id : 0x{:04x}", id.vendor_id());
26 println!(" subsystem vendor : 0x{:04x}", id.subsystem_vendor_id());
27 println!(" model : {}", id.model_number()?);
28 println!(" serial : {}", id.serial_number()?);
29 println!(" firmware : {}", id.firmware_revision()?);
30 println!(" nvme spec : {}", id.nvme_version());
31 println!(" controller id : {}", id.controller_id());
32 println!(" controller type : {}", id.controller_type());
33 println!(" num namespaces : {}", id.num_namespaces());
34 println!(
35 " total nvm capacity : {} bytes",
36 id.total_nvm_capacity_bytes()
37 );
38 println!(
39 " warn temp threshold: {} K",
40 id.warning_temp_threshold_kelvin()
41 );
42 println!(
43 " crit temp threshold: {} K",
44 id.critical_temp_threshold_kelvin()
45 );
46 println!();
47 Ok(())
48}Sourcepub fn serial_number(&self) -> Result<&str>
pub fn serial_number(&self) -> Result<&str>
20-byte ASCII serial number, trimmed.
Examples found in repository?
22fn print_controller(ctrl: &libnvme::Controller<'_>) -> Result<(), Box<dyn std::error::Error>> {
23 println!("=== {} ===", ctrl.name()?);
24 let id = ctrl.identify()?;
25 println!(" vendor id : 0x{:04x}", id.vendor_id());
26 println!(" subsystem vendor : 0x{:04x}", id.subsystem_vendor_id());
27 println!(" model : {}", id.model_number()?);
28 println!(" serial : {}", id.serial_number()?);
29 println!(" firmware : {}", id.firmware_revision()?);
30 println!(" nvme spec : {}", id.nvme_version());
31 println!(" controller id : {}", id.controller_id());
32 println!(" controller type : {}", id.controller_type());
33 println!(" num namespaces : {}", id.num_namespaces());
34 println!(
35 " total nvm capacity : {} bytes",
36 id.total_nvm_capacity_bytes()
37 );
38 println!(
39 " warn temp threshold: {} K",
40 id.warning_temp_threshold_kelvin()
41 );
42 println!(
43 " crit temp threshold: {} K",
44 id.critical_temp_threshold_kelvin()
45 );
46 println!();
47 Ok(())
48}Sourcepub fn model_number(&self) -> Result<&str>
pub fn model_number(&self) -> Result<&str>
40-byte ASCII model number, trimmed.
Examples found in repository?
22fn print_controller(ctrl: &libnvme::Controller<'_>) -> Result<(), Box<dyn std::error::Error>> {
23 println!("=== {} ===", ctrl.name()?);
24 let id = ctrl.identify()?;
25 println!(" vendor id : 0x{:04x}", id.vendor_id());
26 println!(" subsystem vendor : 0x{:04x}", id.subsystem_vendor_id());
27 println!(" model : {}", id.model_number()?);
28 println!(" serial : {}", id.serial_number()?);
29 println!(" firmware : {}", id.firmware_revision()?);
30 println!(" nvme spec : {}", id.nvme_version());
31 println!(" controller id : {}", id.controller_id());
32 println!(" controller type : {}", id.controller_type());
33 println!(" num namespaces : {}", id.num_namespaces());
34 println!(
35 " total nvm capacity : {} bytes",
36 id.total_nvm_capacity_bytes()
37 );
38 println!(
39 " warn temp threshold: {} K",
40 id.warning_temp_threshold_kelvin()
41 );
42 println!(
43 " crit temp threshold: {} K",
44 id.critical_temp_threshold_kelvin()
45 );
46 println!();
47 Ok(())
48}Sourcepub fn firmware_revision(&self) -> Result<&str>
pub fn firmware_revision(&self) -> Result<&str>
8-byte ASCII firmware revision, trimmed.
Examples found in repository?
22fn print_controller(ctrl: &libnvme::Controller<'_>) -> Result<(), Box<dyn std::error::Error>> {
23 println!("=== {} ===", ctrl.name()?);
24 let id = ctrl.identify()?;
25 println!(" vendor id : 0x{:04x}", id.vendor_id());
26 println!(" subsystem vendor : 0x{:04x}", id.subsystem_vendor_id());
27 println!(" model : {}", id.model_number()?);
28 println!(" serial : {}", id.serial_number()?);
29 println!(" firmware : {}", id.firmware_revision()?);
30 println!(" nvme spec : {}", id.nvme_version());
31 println!(" controller id : {}", id.controller_id());
32 println!(" controller type : {}", id.controller_type());
33 println!(" num namespaces : {}", id.num_namespaces());
34 println!(
35 " total nvm capacity : {} bytes",
36 id.total_nvm_capacity_bytes()
37 );
38 println!(
39 " warn temp threshold: {} K",
40 id.warning_temp_threshold_kelvin()
41 );
42 println!(
43 " crit temp threshold: {} K",
44 id.critical_temp_threshold_kelvin()
45 );
46 println!();
47 Ok(())
48}Sourcepub fn ieee_oui(&self) -> [u8; 3]
pub fn ieee_oui(&self) -> [u8; 3]
IEEE OUI (3-byte company identifier), in little-endian byte order.
Sourcepub fn max_data_transfer_size_exp(&self) -> u8
pub fn max_data_transfer_size_exp(&self) -> u8
Maximum data transfer size, as an exponent of the controller’s minimum
memory-page size. 0 means no limit.
Sourcepub fn controller_id(&self) -> u16
pub fn controller_id(&self) -> u16
16-bit controller identifier.
Examples found in repository?
22fn print_controller(ctrl: &libnvme::Controller<'_>) -> Result<(), Box<dyn std::error::Error>> {
23 println!("=== {} ===", ctrl.name()?);
24 let id = ctrl.identify()?;
25 println!(" vendor id : 0x{:04x}", id.vendor_id());
26 println!(" subsystem vendor : 0x{:04x}", id.subsystem_vendor_id());
27 println!(" model : {}", id.model_number()?);
28 println!(" serial : {}", id.serial_number()?);
29 println!(" firmware : {}", id.firmware_revision()?);
30 println!(" nvme spec : {}", id.nvme_version());
31 println!(" controller id : {}", id.controller_id());
32 println!(" controller type : {}", id.controller_type());
33 println!(" num namespaces : {}", id.num_namespaces());
34 println!(
35 " total nvm capacity : {} bytes",
36 id.total_nvm_capacity_bytes()
37 );
38 println!(
39 " warn temp threshold: {} K",
40 id.warning_temp_threshold_kelvin()
41 );
42 println!(
43 " crit temp threshold: {} K",
44 id.critical_temp_threshold_kelvin()
45 );
46 println!();
47 Ok(())
48}Sourcepub fn nvme_version(&self) -> NvmeVersion
pub fn nvme_version(&self) -> NvmeVersion
NVMe specification version supported by the controller.
Examples found in repository?
22fn print_controller(ctrl: &libnvme::Controller<'_>) -> Result<(), Box<dyn std::error::Error>> {
23 println!("=== {} ===", ctrl.name()?);
24 let id = ctrl.identify()?;
25 println!(" vendor id : 0x{:04x}", id.vendor_id());
26 println!(" subsystem vendor : 0x{:04x}", id.subsystem_vendor_id());
27 println!(" model : {}", id.model_number()?);
28 println!(" serial : {}", id.serial_number()?);
29 println!(" firmware : {}", id.firmware_revision()?);
30 println!(" nvme spec : {}", id.nvme_version());
31 println!(" controller id : {}", id.controller_id());
32 println!(" controller type : {}", id.controller_type());
33 println!(" num namespaces : {}", id.num_namespaces());
34 println!(
35 " total nvm capacity : {} bytes",
36 id.total_nvm_capacity_bytes()
37 );
38 println!(
39 " warn temp threshold: {} K",
40 id.warning_temp_threshold_kelvin()
41 );
42 println!(
43 " crit temp threshold: {} K",
44 id.critical_temp_threshold_kelvin()
45 );
46 println!();
47 Ok(())
48}Sourcepub fn controller_type(&self) -> u8
pub fn controller_type(&self) -> u8
Controller type: 1 = I/O, 2 = Discovery, 3 = Administrative.
Examples found in repository?
22fn print_controller(ctrl: &libnvme::Controller<'_>) -> Result<(), Box<dyn std::error::Error>> {
23 println!("=== {} ===", ctrl.name()?);
24 let id = ctrl.identify()?;
25 println!(" vendor id : 0x{:04x}", id.vendor_id());
26 println!(" subsystem vendor : 0x{:04x}", id.subsystem_vendor_id());
27 println!(" model : {}", id.model_number()?);
28 println!(" serial : {}", id.serial_number()?);
29 println!(" firmware : {}", id.firmware_revision()?);
30 println!(" nvme spec : {}", id.nvme_version());
31 println!(" controller id : {}", id.controller_id());
32 println!(" controller type : {}", id.controller_type());
33 println!(" num namespaces : {}", id.num_namespaces());
34 println!(
35 " total nvm capacity : {} bytes",
36 id.total_nvm_capacity_bytes()
37 );
38 println!(
39 " warn temp threshold: {} K",
40 id.warning_temp_threshold_kelvin()
41 );
42 println!(
43 " crit temp threshold: {} K",
44 id.critical_temp_threshold_kelvin()
45 );
46 println!();
47 Ok(())
48}Sourcepub fn optional_admin_command_support(&self) -> u16
pub fn optional_admin_command_support(&self) -> u16
Optional Admin Command Support bitfield (OACS).
Sourcepub fn abort_command_limit(&self) -> u8
pub fn abort_command_limit(&self) -> u8
Abort command limit (ACL).
Sourcepub fn async_event_request_limit(&self) -> u8
pub fn async_event_request_limit(&self) -> u8
Async event request limit (AERL).
Sourcepub fn firmware_updates(&self) -> u8
pub fn firmware_updates(&self) -> u8
Firmware updates bitfield (FRMW).
Sourcepub fn log_page_attributes(&self) -> u8
pub fn log_page_attributes(&self) -> u8
Log Page Attributes bitfield (LPA).
Sourcepub fn error_log_page_entries(&self) -> u8
pub fn error_log_page_entries(&self) -> u8
Number of supported error log page entries (ELPE).
Sourcepub fn num_power_states(&self) -> u8
pub fn num_power_states(&self) -> u8
Number of power states supported, zero-based (NPSS).
Sourcepub fn warning_temp_threshold_kelvin(&self) -> u16
pub fn warning_temp_threshold_kelvin(&self) -> u16
Warning composite temperature threshold in Kelvin (WCTEMP).
Examples found in repository?
22fn print_controller(ctrl: &libnvme::Controller<'_>) -> Result<(), Box<dyn std::error::Error>> {
23 println!("=== {} ===", ctrl.name()?);
24 let id = ctrl.identify()?;
25 println!(" vendor id : 0x{:04x}", id.vendor_id());
26 println!(" subsystem vendor : 0x{:04x}", id.subsystem_vendor_id());
27 println!(" model : {}", id.model_number()?);
28 println!(" serial : {}", id.serial_number()?);
29 println!(" firmware : {}", id.firmware_revision()?);
30 println!(" nvme spec : {}", id.nvme_version());
31 println!(" controller id : {}", id.controller_id());
32 println!(" controller type : {}", id.controller_type());
33 println!(" num namespaces : {}", id.num_namespaces());
34 println!(
35 " total nvm capacity : {} bytes",
36 id.total_nvm_capacity_bytes()
37 );
38 println!(
39 " warn temp threshold: {} K",
40 id.warning_temp_threshold_kelvin()
41 );
42 println!(
43 " crit temp threshold: {} K",
44 id.critical_temp_threshold_kelvin()
45 );
46 println!();
47 Ok(())
48}Sourcepub fn critical_temp_threshold_kelvin(&self) -> u16
pub fn critical_temp_threshold_kelvin(&self) -> u16
Critical composite temperature threshold in Kelvin (CCTEMP).
Examples found in repository?
22fn print_controller(ctrl: &libnvme::Controller<'_>) -> Result<(), Box<dyn std::error::Error>> {
23 println!("=== {} ===", ctrl.name()?);
24 let id = ctrl.identify()?;
25 println!(" vendor id : 0x{:04x}", id.vendor_id());
26 println!(" subsystem vendor : 0x{:04x}", id.subsystem_vendor_id());
27 println!(" model : {}", id.model_number()?);
28 println!(" serial : {}", id.serial_number()?);
29 println!(" firmware : {}", id.firmware_revision()?);
30 println!(" nvme spec : {}", id.nvme_version());
31 println!(" controller id : {}", id.controller_id());
32 println!(" controller type : {}", id.controller_type());
33 println!(" num namespaces : {}", id.num_namespaces());
34 println!(
35 " total nvm capacity : {} bytes",
36 id.total_nvm_capacity_bytes()
37 );
38 println!(
39 " warn temp threshold: {} K",
40 id.warning_temp_threshold_kelvin()
41 );
42 println!(
43 " crit temp threshold: {} K",
44 id.critical_temp_threshold_kelvin()
45 );
46 println!();
47 Ok(())
48}Sourcepub fn host_memory_buffer_preferred_size(&self) -> u32
pub fn host_memory_buffer_preferred_size(&self) -> u32
Host Memory Buffer preferred size in 4 KiB units (HMPRE).
Sourcepub fn host_memory_buffer_min_size(&self) -> u32
pub fn host_memory_buffer_min_size(&self) -> u32
Host Memory Buffer minimum size in 4 KiB units (HMMIN).
Sourcepub fn total_nvm_capacity_bytes(&self) -> u128
pub fn total_nvm_capacity_bytes(&self) -> u128
Total NVM Capacity in bytes (TNVMCAP), as a 128-bit little-endian integer.
Examples found in repository?
22fn print_controller(ctrl: &libnvme::Controller<'_>) -> Result<(), Box<dyn std::error::Error>> {
23 println!("=== {} ===", ctrl.name()?);
24 let id = ctrl.identify()?;
25 println!(" vendor id : 0x{:04x}", id.vendor_id());
26 println!(" subsystem vendor : 0x{:04x}", id.subsystem_vendor_id());
27 println!(" model : {}", id.model_number()?);
28 println!(" serial : {}", id.serial_number()?);
29 println!(" firmware : {}", id.firmware_revision()?);
30 println!(" nvme spec : {}", id.nvme_version());
31 println!(" controller id : {}", id.controller_id());
32 println!(" controller type : {}", id.controller_type());
33 println!(" num namespaces : {}", id.num_namespaces());
34 println!(
35 " total nvm capacity : {} bytes",
36 id.total_nvm_capacity_bytes()
37 );
38 println!(
39 " warn temp threshold: {} K",
40 id.warning_temp_threshold_kelvin()
41 );
42 println!(
43 " crit temp threshold: {} K",
44 id.critical_temp_threshold_kelvin()
45 );
46 println!();
47 Ok(())
48}Sourcepub fn unallocated_nvm_capacity_bytes(&self) -> u128
pub fn unallocated_nvm_capacity_bytes(&self) -> u128
Unallocated NVM Capacity in bytes (UNVMCAP).
Sourcepub fn submission_queue_entry_size(&self) -> u8
pub fn submission_queue_entry_size(&self) -> u8
Submission Queue Entry Size encoding (SQES).
Bits 0–3: required size; bits 4–7: maximum size. The actual byte size
is 2 ^ value.
Sourcepub fn completion_queue_entry_size(&self) -> u8
pub fn completion_queue_entry_size(&self) -> u8
Completion Queue Entry Size encoding (CQES).
Sourcepub fn max_commands_outstanding(&self) -> u16
pub fn max_commands_outstanding(&self) -> u16
Maximum outstanding commands (MAXCMD). 0 means no limit reported.
Sourcepub fn num_namespaces(&self) -> u32
pub fn num_namespaces(&self) -> u32
Number of namespaces supported (NN).
Examples found in repository?
22fn print_controller(ctrl: &libnvme::Controller<'_>) -> Result<(), Box<dyn std::error::Error>> {
23 println!("=== {} ===", ctrl.name()?);
24 let id = ctrl.identify()?;
25 println!(" vendor id : 0x{:04x}", id.vendor_id());
26 println!(" subsystem vendor : 0x{:04x}", id.subsystem_vendor_id());
27 println!(" model : {}", id.model_number()?);
28 println!(" serial : {}", id.serial_number()?);
29 println!(" firmware : {}", id.firmware_revision()?);
30 println!(" nvme spec : {}", id.nvme_version());
31 println!(" controller id : {}", id.controller_id());
32 println!(" controller type : {}", id.controller_type());
33 println!(" num namespaces : {}", id.num_namespaces());
34 println!(
35 " total nvm capacity : {} bytes",
36 id.total_nvm_capacity_bytes()
37 );
38 println!(
39 " warn temp threshold: {} K",
40 id.warning_temp_threshold_kelvin()
41 );
42 println!(
43 " crit temp threshold: {} K",
44 id.critical_temp_threshold_kelvin()
45 );
46 println!();
47 Ok(())
48}