nvme

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusCodeMask         = 0x7FF
	CommandRetryDelayMask  = 0x1800
	CommandRetryDelayShift = 11
	MoreMask               = 0x2000
	DoNotRetryMask         = 0x4000
)

Constants applying to the StatusCode

View Source
const (
	SecuritySendReceiveCapabilities OptionalControllerCapabilities = (1 << 0)
	FormatNVMCommandSupport                                        = (1 << 1)
	FirmwareCommitImageDownload                                    = (1 << 2)
	NamespaceManagementCapability                                  = (1 << 3)
	DeviceSelfTestCommand                                          = (1 << 4)
	DirectivesSupport                                              = (1 << 5)
	NVMeMISendReceiveSupport                                       = (1 << 6)
	VirtualiztionManagementSupport                                 = (1 << 7)
	DoorbellBufferConfigCommand                                    = (1 << 8)
	GetLBAStatusCapability                                         = (1 << 9)
)
View Source
const (
	NoneFeature                  Feature = 0x00
	ArbitrationFeature                   = 0x01
	PowerManagmentFeature                = 0x02
	LBARangeFeature                      = 0x03
	TemperatureThresholdFeature          = 0x04
	ErrorRecoveryFeature                 = 0x05
	VolatileWriteCacheFeature            = 0x06
	NumQueuesFeature                     = 0x07
	IRQCoalesceFeature                   = 0x08
	IRQConfigFeature                     = 0x09
	WriteAtomicFeature                   = 0x0a
	AsyncEventFeature                    = 0x0b
	AutoPSTFeature                       = 0x0c
	HostMemoryBufferFeature              = 0x0d
	TimestampFeature                     = 0x0e
	KATOFeature                          = 0x0f
	HCTMFeature                          = 0x10
	NoPSCFeature                         = 0x11
	RRLFeature                           = 0x12
	PLMConfigFeature                     = 0x13
	PLMWindowFeature                     = 0x14
	LBAStatusInfoFeature                 = 0x15
	HostBehaviorFeature                  = 0x16
	SanitizeFeature                      = 0x17
	EnduranceFeature                     = 0x18
	IOCSProfileFeature                   = 0x19
	SWProgressFeature                    = 0x80
	HostIDFeature                        = 0x81
	ReservationMaskFeature               = 0x82
	ReservationPersistentFeature         = 0x83
	WriteProtectFeature                  = 0x84
	MiControllerMetadata                 = 0x7E
	MiNamespaceMetadata                  = 0x7F
)
View Source
const (
	OsCtrlNameElementType           HostMetadataElementType = 0x01
	OsDriverNameElementType                                 = 0x02
	OsDriverVersionElementType                              = 0x03
	PreBootCtrlNameElementType                              = 0x04
	PreBootDriverNameElementType                            = 0x05
	PreBootDriverVersionElementType                         = 0x06

	OsNamespaceNameElementType      HostMetadataElementType = 0x01
	PreBootNamespaceNameElementType                         = 0x02
)

Metadata constants

View Source
const (
	LogCdw10LogPageIdentiferMask         = 0xFF
	LogCdw10LogPageIdentiferShift        = 0
	LogCdw10LogSpecificFieldMask         = 0x0f
	LogCdw10LogSpecificFieldShift        = 8
	LogCdw10RetainAsynchronousEventMask  = 0x1
	LogCdw10RetainAsynchronousEventShift = 15
	LogCdw10NumberOfDwordsLowerMask      = 0xFFFF
	LogCdw10NumberOfDwordsLowerShift     = 16

	LogCdw11NumberOfDwordsUpperMask    = 0xFFFF
	LogCdw11NumberOfDwordsUpperShift   = 0
	LogCdw11LogSpecificIdentifierMask  = 0xFF
	LogCdw11LogSpecificIdentifierShift = 16

	LogCdw14UuidMask  = 0x7F
	LogCdw14UuidShift = 0
)
View Source
const (
	IdentifyDataSize uint32 = 4096
)

Variables

View Source
var (
	VirtualManagementResourceTypeName = map[VirtualManagementResourceType]string{
		VQResourceType: "VQ",
		VIResourceType: "VI",
	}
)

Functions

func DeviceList

func DeviceList(r string) ([]string, error)

DeviceList returns the devices that match the provided regexp in Model Number, Serial Number, or Node Qualifying Name (NQN). Returned paths are of the form /dev/nvme[0-9]+.

Types

type AdminCmd

type AdminCmd = PassthruCmd

AdminCmd aliases the PassthruCmd

func (*AdminCmd) String

func (cmd *AdminCmd) String() string

type AdminCommandOpCode

type AdminCommandOpCode uint8

AdminCommandOpCode sizes the opcodes listed below

const (
	GetLogPage                AdminCommandOpCode = 0x02
	IdentifyOpCode            AdminCommandOpCode = 0x06
	SetFeatures               AdminCommandOpCode = 0x09
	GetFeatures               AdminCommandOpCode = 0x0A
	NamespaceManagementOpCode AdminCommandOpCode = 0x0D
	NamespaceAttachOpCode     AdminCommandOpCode = 0x15
	VirtualMgmtOpCode         AdminCommandOpCode = 0x1c
	NvmeMiSend                AdminCommandOpCode = 0x1D
	NvmeMiRecv                AdminCommandOpCode = 0x1E
	FormatNvmOpCode           AdminCommandOpCode = 0x80
)

Admin Command Op Codes. These are from the NVMe Specification

func (AdminCommandOpCode) String

func (code AdminCommandOpCode) String() string

type CommandError

type CommandError struct {
	StatusCode        StatusCode
	CommandRetryDelay uint8
	More              bool
	DoNotRetry        bool
}

CommandError captures an error and details about handling

func (*CommandError) Error

func (e *CommandError) Error() string

type CtrlCaps

type CtrlCaps struct {
	ControllerId                           uint16 // CNTLID
	PortId                                 uint16 // PORTID
	ControllerResourceType                 uint8  // CRT
	Reserved5                              [27]uint8
	VQResourcesFlexibleTotal               uint32 // VQFRT
	VQResourcesFlexibleAssigned            uint32 // VQRFA
	VQResourcesFlexibleAllocatedToPrimary  uint16 // VQRFAP
	VQResourcesPrivateTotal                uint16 // VQPRT
	VQResourcesFlexibleSecondaryMaximum    uint16 // VQFRSM
	VQFlexibleResourcePreferredGranularity uint16 // VQGRAN
	Reserved48                             [16]uint8
	VIResourcesFlexibleTotal               uint32 // VIFRT
	VIResourcesFlexibleAssigned            uint32 // VIRFA
	VIResourcesFlexibleAllocatedToPrimary  uint16 // VIRFAP
	VIResourcesPrivateTotal                uint16 // VIPRT
	VIResourcesFlexibleSecondaryMaximum    uint16 // VIFRSM
	VIFlexibleResourcePreferredGranularity uint16 // VIGRAN
	Reserved90                             [4016]uint8
}

type CtrlList

type CtrlList struct {
	Num         uint16 `countOf:"Identifiers"`
	Identifiers [2047]uint16
}

type Device

type Device struct {
	Path string
	// contains filtered or unexported fields
}

Device describes the NVMe Device and its attributes

func Connect

func Connect(dev *switchtec.Device, pdfid uint16) (*Device, error)

Connect connects a PDFID to an existing switchtec device

func Open

func Open(devPath string) (*Device, error)

Open establishes a connection with the switchtec switch to which subsequent commands are issued.

func (*Device) AttachNamespace

func (dev *Device) AttachNamespace(namespaceID uint32, controllers []uint16) error

func (*Device) Close

func (dev *Device) Close()

Close closes connection with the switchtec switch

func (*Device) CreateNamespace

func (dev *Device) CreateNamespace(size uint64, capacity uint64, format uint8, dps uint8, sharing uint8, anagrpid uint32, nvmsetid uint16, timeout uint32) (uint32, error)

CreateNamespace creates a new namespace with the specified parameters

func (*Device) DeleteNamespace

func (dev *Device) DeleteNamespace(namespaceID uint32) error

DeleteNamespace deletes the specified namespace

func (*Device) DetachNamespace

func (dev *Device) DetachNamespace(namespaceID uint32, controllers []uint16) error

func (*Device) FormatNamespace

func (dev *Device) FormatNamespace(namespaceID uint32) error

FormatNamespace issues a suitable format command to the namespace. The existing format is queried and reused, and if crypto erase is supported we chose that.

func (*Device) GetFeature

func (dev *Device) GetFeature(nsid uint32, fid Feature, sel int, cdw11 uint32, len uint32, buf []byte) error

func (*Device) GetSmartLog

func (dev *Device) GetSmartLog() (*SmartLog, error)

func (*Device) Identify

func (dev *Device) Identify(namespaceId uint32, cns IdentifyControllerOrNamespaceType, data []byte) error

Identify -

func (*Device) IdentifyController

func (dev *Device) IdentifyController() (*IdCtrl, error)

IdentifyController -

func (*Device) IdentifyNamespace

func (dev *Device) IdentifyNamespace(namespaceId uint32, present bool) (*IdNs, error)

IdentifyNamespace -

func (*Device) IdentifyNamespaceControllerList

func (dev *Device) IdentifyNamespaceControllerList(namespaceId uint32) (*CtrlList, error)

IdentifyNamespaceControllerList - Identifies the list of controllers attached to the provided namespace

func (*Device) IdentifyNamespaceList

func (dev *Device) IdentifyNamespaceList(namespaceId uint32, all bool) ([1024]NamespaceIdentifier, error)

IdentifyNamespaceList -

func (*Device) IdentifyPrimaryControllerCapabilities

func (dev *Device) IdentifyPrimaryControllerCapabilities(controllerId uint16) (*CtrlCaps, error)

func (*Device) IdentifyRaw

func (dev *Device) IdentifyRaw(namespaceId uint32, cdw10 uint32, cdw11 uint32, data []byte) error

IdentifyRaw -

func (*Device) ListSecondary

func (dev *Device) ListSecondary(startingCtrlId uint32, namespaceId uint32) (*SecondaryControllerList, error)

ListSecondary retries the secondary controller list associated with the primary controller of the given device. This differs from the C implementation in that num-entries is not an option. The maximum number of entries is always returned. It is up to the caller to trim down the response.

func (*Device) SetFeature

func (dev *Device) SetFeature(nsid uint32, fid Feature, cdw12 uint32, save bool, len uint32, buf []byte) error

func (*Device) String

func (dev *Device) String() string

func (*Device) VirtualMgmt

func (dev *Device) VirtualMgmt(ctrlId uint16, action VirtualManagementAction, resourceType VirtualManagementResourceType, numResources uint32) error

type Feature

type Feature uint8

type FormatNs

type FormatNs struct {
	Format                 uint8    `bitfield:"4"` // Bits 3:0  Indicate one of the 16 supported LBA Formats
	MetadataSetting        uint8    `bitfield:"1"` // Bits 4    Indicates metadata transfer setting. If the Metadata size is 0, the bit is N/A
	ProtectionInfo         uint8    `bitfield:"3"` // Bits 7:5  Indicates end-to-end protection information type
	ProtectionInfoLocation uint8    `bitfield:"1"` // Bits 8    Indicates protection information location in the metadata
	SecureEraseSetting     uint8    `bitfield:"3"` // Bits 11-9 Indicates secure erase setting, 0 - none, 1 - user data erase, 2 - crypto-erase
	Fill                   uint8    `bitfield:"4"` // Filler to pad to byte
	Unused                 [2]uint8 // Pad to uint32
}

Format Options Data Structure All the parameters listed are the long-form name structex annotations where applicable.

type FormattedLBASize

type FormattedLBASize struct {
	Format   uint8 `bitfield:"4"` // Bits 3:0: Indicates one of the 16 supported LBA Formats
	Metadata uint8 `bitfield:"1"` // Bit 4: If 1, indicates metadata is transfer at the end of the data LBA
	Reserved uint8 `bitfield:"3"` // Bits 7:5 are reserved

} // FLBAS

type HostMetadataElementType

type HostMetadataElementType uint8

HostMetadataElementType constains the constants below

type IdCtrl

type IdCtrl id_ctrl

func (*IdCtrl) GetCapability

func (id *IdCtrl) GetCapability(cap OptionalControllerCapabilities) bool

GetCapability -

type IdNs

type IdNs struct {
	Size        uint64 // NSZE
	Capacity    uint64 // NCAP
	Utilization uint64 // NUSE
	Features    struct {
		Thinp    uint8 `bitfield:"1"` // Bit 0: Thin provisioning supported for this namespace
		Nsabp    uint8 `bitfield:"1"` // Bit 1: NAWUN, NAWUPF, NACWU are defined for this namespace (TODO: Wtf is this?)
		Dae      uint8 `bitfield:"1"` // Bit 2: Deallocated or Unwritten Logical Block error support for this namespace
		Uidreuse uint8 `bitfield:"1"` // Bit 3: NGUID field for this namespace, if non-zero, is never reused by the controller.
		OptPerf  uint8 `bitfield:"1"` // Bit 4: If 1, indicates NPWG, NPWA, NPDG, NPDA, NOWS are defined for this namespace and should be used for host I/O optimization.
		Reserved uint8 `bitfield:"3"` // Bits 7:5 are reserved
	} // NSFEAT
	NumberOfLBAFormats   uint8            // NLBAF
	FormattedLBASize     FormattedLBASize // FLABS
	MetadataCapabilities struct {
		ExtendedSupport uint8 `bitfield:"1"` // Bit 0: If 1, indicates support metadata transfer as part of extended data LBA
		PointerSupport  uint8 `bitfield:"1"` // Bit 1: If 1, indicates support for metadata transfer in a separate buffer specified by Metadata Pointer in SQE
		Reserved        uint8 `bitfield:"6"` // Bits 7:2 are reserved
	} // MC
	EndToEndDataProtectionCaps         uint8                 // DPC
	EndToEndDataProtectionTypeSettings uint8                 // DPS
	MultiPathIOSharingCapabilities     NamespaceCapabilities // NMIC
	ReservationCapabilities            struct {
		PersistThroughPowerLoss        uint8 `bitfield:"1"` // Bit 0: If 1 indicates namespace supports the Persist Through Power Loss capability
		WriteExclusiveReservation      uint8 `bitfield:"1"` // Bit 1: If 1 indicates namespace supports the Write Exclusive reservation type
		ExclusiveAccessReservation     uint8 `bitfield:"1"` // Bit 2: If 1 indicates namespace supports Exclusive Access reservation type
		WriteExclusiveRegistrantsOnly  uint8 `bitfield:"1"` // Bit 3:
		ExclusiveAccessRegistrantsOnly uint8 `bitfield:"1"` // Bit 4:
		WriteExclusiveAllRegistrants   uint8 `bitfield:"1"` // Bit 5:
		ExclusiveAllRegistrants        uint8 `bitfield:"1"` // Bit 6:
		IgnoreExistingKey              uint8 `bitfield:"1"` // Bit 7: If 1 indicates that the Ingore Existing Key is used as defined in 1.3 or later specification. If 0, 1.2.1 or earlier definition
	} // RESCAP
	FormatProgressIndicator struct {
		PercentageRemaining   uint8 `bitfield:"7"` // Bits 6:0 indicates percentage of the Format NVM command that remains completed. If bit 7 is set to '1' then a value of 0 indicates the namespace is formatted with FLBAs and DPS fields and no format is in progress
		FormatProgressSupport uint8 `bitfield:"1"` // Bit 7 if 1 indicates the namespace supports the Format Progress Indicator field
	} // FPI
	DeallocateLogiclBlockFeatures  uint8     // DLFEAT
	AtomicWriteUnitNormal          uint16    // NAWUN
	AtomicWriteUnitPowerFail       uint16    // NAWUPF
	AtomicCompareAndWriteUnit      uint16    // NACWU
	AtomicBoundarySizeNormal       uint16    // NABSN
	AtomicBoundaryOffset           uint16    // NABO
	AtomicBoundarySizePowerFail    uint16    // NABSPF
	OptimalIOBoundary              uint16    // NOIOB
	NVMCapacity                    [16]uint8 // NVMCAP Total size of the NVM allocated to this namespace, in bytes.
	PreferredWriteGranularity      uint16    // NPWG
	PreferredWriteAlignment        uint16    // NPWA
	PreferredDeallocateGranularity uint16    // NPDG
	PreferredDeallocateAlignment   uint16    // NPDA
	OptimalWriteSize               uint16    // NOWS The size in logical block for optimal write performance for this namespace. Should be a multiple of NPWG. Refer to 8.25 for details
	Reserved74                     [18]uint8
	AnaGroupIdentifier             uint32 // ANAGRPID indicates the ANA Group Identifier for thsi ANA group (refer to section 8.20.2) of which the namespace is a member.
	Reserved96                     [3]uint8
	Attributes                     struct {
		WriteProtected uint8 `bitfield:"1"` // Bit 0: indicates namespace is currently write protected due to any error condition
		Reserved       uint8 `bitfield:"7"` // Bits 7:1 are reserved
	} // NSATTR
	NvmSetIdentifier             uint16                            // NVMSETID
	EnduranceGroupIdentifier     uint16                            // ENDGID
	GloballyUniqueIdentifier     NamespaceGloballyUniqueIdentifier // NGUID
	IeeeExtendedUniqueIdentifier [8]uint8                          // EUI64
	LBAFormats                   [16]struct {
		MetadataSize        uint16 // MS
		LBADataSize         uint8  // LBADS Indicates the LBA data size supported in terms of a power-of-two value. If the value is 0, the the LBA format is not supported
		RelativePerformance uint8  // RP indicates the relative performance of this LBA format relative to other LBA formats
	}
	Reserved192    [192]uint8
	VendorSpecific [3712]uint8
}

Identify Namespace Data Structure Figure 247 from NVM-Express 1_4a-2020.03.09-Ratified specification

All the parameters listed are the long-form name with the 'Namespace' prefix dropped, if it exists. structex annotations where applicable.

type IdentifyControllerOrNamespaceType

type IdentifyControllerOrNamespaceType int // CNS

IdentifyControllerOrNamespaceType constrains the type for the constants below.

const (
	Namespace_CNS                     IdentifyControllerOrNamespaceType = 0x00
	Controller_CNS                    IdentifyControllerOrNamespaceType = 0x01
	NamespaceList_CNS                 IdentifyControllerOrNamespaceType = 0x02
	NamespaceDescriptorList_CNS       IdentifyControllerOrNamespaceType = 0x03
	NVMSetList_CNS                    IdentifyControllerOrNamespaceType = 0x04
	NamespacePresentList_CNS          IdentifyControllerOrNamespaceType = 0x10
	NamespacePresent_CNS              IdentifyControllerOrNamespaceType = 0x11
	ControllerNamespaceList_CNS       IdentifyControllerOrNamespaceType = 0x12
	ControllerList_CNS                IdentifyControllerOrNamespaceType = 0x13
	PrimaryControllerCapabilities_CNS IdentifyControllerOrNamespaceType = 0x14
	SecondaryControllerList_CNS       IdentifyControllerOrNamespaceType = 0x15
	NamespaceGranularityList_CNS      IdentifyControllerOrNamespaceType = 0x16
	UUIDList_CNS                      IdentifyControllerOrNamespaceType = 0x17
)

CNS constants

type MIHostMetadata

type MIHostMetadata struct {
	NumDescriptors uint8
	Reserved1      uint8
	DescriptorData []byte
}

type MIHostMetadataElementDescriptor

type MIHostMetadataElementDescriptor struct {
	Type uint8
	Rev  uint8
	Len  uint16
	Val  []byte
}

type MiMeatadataFeatureBuilder

type MiMeatadataFeatureBuilder struct {
	// contains filtered or unexported fields
}

func NewMiFeatureBuilder

func NewMiFeatureBuilder() *MiMeatadataFeatureBuilder

func (*MiMeatadataFeatureBuilder) AddElement

func (builder *MiMeatadataFeatureBuilder) AddElement(typ uint8, rev uint8, data []byte) *MiMeatadataFeatureBuilder

func (*MiMeatadataFeatureBuilder) Bytes

func (builder *MiMeatadataFeatureBuilder) Bytes() []byte

type NamespaceCapabilities

type NamespaceCapabilities struct {
	Sharing  uint8 `bitfield:"1"` // Bit 0: If 1, namespace may be attached to two ro more controllers in the NVM subsystem concurrently
	Reserved uint8 `bitfield:"7"` // Bits 7:1 are reserved

} // NMIC

type NamespaceGloballyUniqueIdentifier

type NamespaceGloballyUniqueIdentifier [16]byte

NamespaceGloballyUniqueIdentifier uniquely identifies the namespace

func (*NamespaceGloballyUniqueIdentifier) Parse

Parse - ensure the uuid is parseable

func (NamespaceGloballyUniqueIdentifier) String

type NamespaceIdentifier

type NamespaceIdentifier uint32
const (
	// COMMON_NAMESPACE_IDENTIFIER identifies the capabilities and settings that are common to all namespaces
	// in the Identify Namespace data structure
	COMMON_NAMESPACE_IDENTIFIER NamespaceIdentifier = 0xFFFFFFFF
)

type OptionalControllerCapabilities

type OptionalControllerCapabilities uint16

type PassthruCmd

type PassthruCmd struct {
	Opcode      uint8  // Byte 0
	Flags       uint8  // Byte 1
	Reserved1   uint16 // Bytes 2-3
	NSID        uint32 // Bytes 4-7
	Cdw2        uint32 // Bytes 8-11
	Cdw3        uint32 // Bytes 12-15
	Metadata    uint64 // Bytes 16-23
	Addr        uint64 // Bytes 24-31
	MetadataLen uint32 // Bytes 32-35
	DataLen     uint32 // Bytes 36-39
	Cdw10       uint32 // Bytes 40-43
	Cdw11       uint32 // Bytes 44-47
	Cdw12       uint32 // Bytes 48-51
	Cdw13       uint32 // Bytes 52-55
	Cdw14       uint32 // Bytes 56-60
	Cdw15       uint32 // Bytes 60-63
	TimeoutMs   uint32 // Bytes 64-67
	Result      uint32 // Bytes 68-71
}

PassthruCmd is used for NVMe Passthrough from user space to the NVMe Device Driver This is a copy of the C definition in 'include/linux/nvme_ioctl.h' struct nvme_passthru_cmd{}

type SanitizeCapabilities

type SanitizeCapabilities struct {
	CryptoErase               uint8  `bitfield:"1"` // Bits 0     controller supports Crypto Erase sanitize operation (1), 0 - no support
	BlockErase                uint8  `bitfield:"1"` // Bits 1     controller supports Block Erase sanitize operation (1), 0 - no support
	Overwrite                 uint8  `bitfield:"1"` // Bits 2     controller supports Overwrite sanitize operation (1), 0 - no support
	Unused0                   uint8  `bitfield:"5"` // Bits 7:3   unused
	Unused1                   uint16 // Bits 23:8  unused
	Unused2                   uint8  `bitfield:"5"` // Bits 28:24 unused
	NoDeallocateAfterSanitize uint8  `bitfield:"1"` // Bits 29    No-deallocate After Sanitize bit in Sanitize inhibitied command support (1), 0 - no support
	NoDeallocateMask          uint8  `bitfield:"2"` // Bits 31:30 No-deallocate After Sanitize mask to extract value.
}

SanitizeCapabilities data structure structex annotations where applicable.

type SecondaryControllerEntry

type SecondaryControllerEntry struct {
	SecondaryControllerID       uint16
	PrimaryControllerID         uint16
	SecondaryControllerState    uint8
	Reserved5                   [3]uint8
	VirtualFunctionNumber       uint16
	VQFlexibleResourcesAssigned uint16
	VIFlexibleResourcesAssigned uint16
	Reserved14                  [18]uint8
}

type SecondaryControllerList

type SecondaryControllerList struct {
	Count    uint8 `countOf:"Entries"`
	Reserved [31]uint8
	Entries  [127]SecondaryControllerEntry
}

type SmartLog

type SmartLog struct {
	CriticalWarning struct {
		SpareCapacity                  uint8 `bitfield:"1"` // Bit 0: If set to ‘1’, then the available spare capacity has fallen below the threshold.
		Temperature                    uint8 `bitfield:"1"` // Bit 1: If set to ‘1’, then a temperature is: a) greater than or equal to an over temerature threshold; or b) less than or equal to an under temperature threshold
		Degraded                       uint8 `bitfield:"1"` // Bit 2: If set to ‘1’, then the NVM subsystem reliability has been degraded due to significant media related errors or any internal error that degrades NVM subsystem reliability.
		ReadOnly                       uint8 `bitfield:"1"` // Bit 3: If set to ‘1’, then the media has been placed in read only mode.
		BackupFailed                   uint8 `bitfield:"1"` // Bit 4: If set to ‘1’, then the volatile memory backup device has failed.
		PersistentMemoryRegionReadOnly uint8 `bitfield:"1"` // If set to ‘1’, then the Persistent Memory Region has become read-only or unreliable
		Reserved                       uint8 `bitfield:"2"`
	}
	CompositeTemperature                         uint16 // Contains a value corresponding to a temperature in degrees Kelvin that represents the current composite temperature of the controller and namespace(s) associated with that controller.
	AvailableSpare                               uint8  // Contains a normalized percentage (0% to 100%) of the remaining spare capacity available.
	AvailableSpareThreshold                      uint8  // When the Available Spare falls below the threshold indicated in this field, an asynchronous event completion may occur. The value is indicated as a normalized percentage (0% to 100%). The values 101 to 255 are reserved.
	PercentageUsed                               uint8  // Contains a vendor specific estimate of the percentage of NVM subsystem life used based on the actual usage and the manufacturer’s prediction of NVM life.
	EnduranceGroupCriticalWarningSummary         uint8  // This field indicates critical warnings for the state of Endurance Groups.
	Reserved7                                    [25]uint8
	DataUnitsReadLo                              uint64
	DataUnitsReadHi                              uint64
	DataUnitsWrittenLo                           uint64
	DataUnitsWrittenHi                           uint64
	HostReadsLo                                  uint64
	HistReadsHi                                  uint64
	HostWritesLo                                 uint64
	HostWritesHi                                 uint64
	ControllerBusyTimeLo                         uint64
	ControllerBusyTimeHi                         uint64
	PowerCyclesLo                                uint64
	PowerCyclesHi                                uint64
	PowerOnHoursLo                               uint64
	PowerOnHoursHi                               uint64
	UnsafeShutdownsLo                            uint64
	UnsafeShutdownsHi                            uint64
	MediaErrorsLo                                uint64
	MediaErrorsHi                                uint64
	NumberErrorLogEntriesLo                      uint64
	NumberErrorLogEntriesHi                      uint64
	WarningCompositeTemperatureTime              uint32
	CriticalCompositeTemperatureTime             uint32
	TemperatureSensor                            [8]uint16
	ThermalManagementTemperature1TransitionCount uint32
	ThermalManagementTemperature2TransitionCount uint32
	TotalTimeForThermalManagementTemperature1    uint32
	TotalTimeForThermalManagementTemperature2    uint32
	Reserved232                                  [280]uint8
}

SmartLog health information Get Log Page - SMART / Health Information Log Figure 196 from NVM-Express 1_4a-2020.03.09-Ratified specification

type StatusCode

type StatusCode uint32

StatusCode sizes the status codes listed below

const (
	NamespaceAlreadyAttached StatusCode = 0x118
	NamespaceNotAttached     StatusCode = 0x11a
)

Status codes

func (StatusCode) String

func (sc StatusCode) String() string

type SwitchtecNvmeCommandError

type SwitchtecNvmeCommandError struct {
	// contains filtered or unexported fields
}

func (*SwitchtecNvmeCommandError) Error

func (e *SwitchtecNvmeCommandError) Error() string

func (*SwitchtecNvmeCommandError) Unwrap

func (e *SwitchtecNvmeCommandError) Unwrap() error

type UserIoCmd

type UserIoCmd struct {
	Opcode   uint8
	Flags    uint8
	Control  uint16
	NBlocks  uint16
	Reserved uint16
	Metadata uint64
	Addr     uint64
	StartLBA uint64
	DsMgmt   uint32
	RefTag   uint32
	AppTag   uint16
	AppMask  uint16
}

UserIoCmd represents an NVMe User I/O Request This is a copy of the C definition in '/include/linux/nvme_ioctl.h' struct nvme_user_io{}

type VirtualManagementAction

type VirtualManagementAction uint32
const (
	PrimaryFlexibleAction  VirtualManagementAction = 0x1
	SecondaryOfflineAction VirtualManagementAction = 0x7
	SecondaryAssignAction  VirtualManagementAction = 0x8
	SecondaryOnlineAction  VirtualManagementAction = 0x9
)

type VirtualManagementResourceType

type VirtualManagementResourceType uint32
const (
	VQResourceType VirtualManagementResourceType = 0
	VIResourceType VirtualManagementResourceType = 1
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL