Documentation ¶
Index ¶
- Constants
- func AdjustTraddr(traddr string) (string, error)
- func NewScatterListReader(sgl *ScatterList) *scatterListReader
- func NewScatterListWriter(sgl *ScatterList) *scatterListWriter
- func OpcodeName(opcode uint8) string
- type AbstractRequest
- type AdminConnectRequest
- type AsyncEventRequest
- type CommonCommand
- type CommonRequest
- type Completion
- type CompletionResult
- type ConnectCommand
- type ConnectData
- type Controller
- type DataPtr
- type DiscRspPageHdr
- type DiscoverySubsystem
- type FeaturesRequest
- type GetLogPageCommand
- type IDCtrl
- type IDPowerState
- type IdentifyCommand
- type KeepAliveRequest
- type NvmeGetDiscoveryLogPageRequest
- type NvmeIdentifyDiscoveryRequest
- type NvmefDiscRspPageEntry
- type NvmefPropertyGetRequest
- type NvmefPropertySetRequest
- type NvmetAsyncEvent
- type ParserError
- type Port
- type PropertyGetCommand
- type PropertySetCommand
- type Request
- type ScatterList
- type SubsystemType
- type TCPDataPDU
- type TCPHeaderType
- type TCPIcReqPduType
- type TCPIcrespPdu
- type TCPRequest
Constants ¶
View Source
const ( // DiscoverySubsysName name of discovery subsystem DiscoverySubsysName string = "nqn.2014-08.org.nvmexpress.discovery" NVME_NO_LOG_LSP = 0x0 )
View Source
const REQ_FAILFAST_DRIVER = 0x40
Variables ¶
This section is empty.
Functions ¶
func AdjustTraddr ¶
func NewScatterListReader ¶
func NewScatterListReader(sgl *ScatterList) *scatterListReader
func NewScatterListWriter ¶
func NewScatterListWriter(sgl *ScatterList) *scatterListWriter
func OpcodeName ¶
Types ¶
type AbstractRequest ¶
type AbstractRequest struct { Req Request Resp *Completion CmdID uint16 DataLength uint32 // contains filtered or unexported fields }
func (*AbstractRequest) CommandID ¶
func (request *AbstractRequest) CommandID() uint16
func (*AbstractRequest) Completion ¶
func (request *AbstractRequest) Completion() *Completion
func (*AbstractRequest) GetData ¶
func (request *AbstractRequest) GetData() *ScatterList
func (*AbstractRequest) SetCompletion ¶
func (request *AbstractRequest) SetCompletion(cqe *Completion)
func (*AbstractRequest) SetData ¶
func (request *AbstractRequest) SetData(sgl *ScatterList)
type AdminConnectRequest ¶
type AdminConnectRequest struct { AbstractRequest Cmd ConnectCommand }
func NewAdminConnectRequest ¶
func NewAdminConnectRequest(cmdID uint16, kato time.Duration, connectData *ConnectData) *AdminConnectRequest
func (*AdminConnectRequest) PackCmd ¶
func (request *AdminConnectRequest) PackCmd(buffer *bufio.Writer) error
func (*AdminConnectRequest) String ¶
func (request *AdminConnectRequest) String() string
type AsyncEventRequest ¶
type AsyncEventRequest struct { AbstractRequest // contains filtered or unexported fields }
func NewAsyncEventRequest ¶
func NewAsyncEventRequest(cmdID uint16) *AsyncEventRequest
func (*AsyncEventRequest) PackCmd ¶
func (request *AsyncEventRequest) PackCmd(buffer *bufio.Writer) error
func (*AsyncEventRequest) String ¶
func (request *AsyncEventRequest) String() string
type CommonCommand ¶
type CommonCommand struct { Opcode uint8 `struc:"uint8"` Flags uint8 `struc:"uint8"` CommandID uint16 `struc:"uint16,little"` NSId uint32 `struc:"uint32,little"` Cdw2 [2]uint32 `struc:"[2]uint32,little"` Metadata uint64 `struc:"uint64,little"` Dptr DataPtr // CDW10 command specific Dword 10. Cdw10 uint32 `struc:"uint32,little"` // CDW11 command specific Dword 11. Cdw11 uint32 `struc:"uint32,little"` // CDW12 command specific Dword 12. Cdw12 uint32 `struc:"uint32,little"` // CDW13 command specific Dword 13. Cdw13 uint32 `struc:"uint32,little"` // CDW14 command specific Dword 14. Cdw14 uint32 `struc:"uint32,little"` // CDW15 command specific Dword 15. Cdw15 uint32 `struc:"uint32,little"` }
https://nvmexpress.org/wp-content/uploads/NVM-Express-1_4-2019.06.10-Ratified.pdf Figure 105: Command Format – Admin and NVM Command Set
func (*CommonCommand) String ¶
func (cmd *CommonCommand) String() string
type CommonRequest ¶
type CommonRequest struct { AbstractRequest // contains filtered or unexported fields }
func (*CommonRequest) String ¶
func (request *CommonRequest) String() string
type Completion ¶
type Completion struct { Result CompletionResult SqHead uint16 `struc:"uint16,little"` SqID uint16 `struc:"uint16,little"` CommandID uint16 `struc:"uint16,little"` Status uint16 `struc:"uint16,little"` }
func NewCompletion ¶
func NewCompletion(commandID uint16, sqID uint16, status uint16) *Completion
type CompletionResult ¶
type CompletionResult struct {
Result [8]uint8 `struc:"[8]uint8"`
}
type ConnectCommand ¶
type ConnectCommand struct { Opcode uint8 `struc:"uint8"` Resv1 uint8 `struc:"uint8"` CommandID uint16 `struc:"uint16,little"` FcType uint8 `struc:"uint8"` Rsvd2 [19]uint8 `struc:"[19]uint8"` Dptr DataPtr RecFmt uint16 `struc:"uint16,little"` QID uint16 `struc:"uint16,little"` SqSize uint16 `struc:"uint16,little"` CatTr uint8 `struc:"uint8"` Resv3 uint8 `struc:"uint8"` Kato uint32 `struc:"uint32,little"` Resv4 [12]uint8 `struc:"[12]uint8"` }
type ConnectData ¶
type Controller ¶
type DiscRspPageHdr ¶
type DiscoverySubsystem ¶
type DiscoverySubsystem interface { RegisterController(controller Controller) DeregisterController(controller Controller) FillDiscoveryLogPage(offset uint64, maxEntries uint32, hostNqn string) ([]*NvmefDiscRspPageEntry, uint32, uint64) }
DiscoverySubsystem ...
type FeaturesRequest ¶
type FeaturesRequest struct { AbstractRequest // contains filtered or unexported fields }
func NewSetFeatureAsyncEventRequest ¶
func NewSetFeatureAsyncEventRequest(cmdID uint16) *FeaturesRequest
func NewSetFeatureKatoRequest ¶
func NewSetFeatureKatoRequest(cmdID uint16, kato time.Duration) *FeaturesRequest
func (*FeaturesRequest) PackCmd ¶
func (request *FeaturesRequest) PackCmd(buffer *bufio.Writer) error
func (*FeaturesRequest) String ¶
func (request *FeaturesRequest) String() string
type GetLogPageCommand ¶
type GetLogPageCommand struct { Opcode uint8 `struc:"uint8"` Flags uint8 `struc:"uint8"` CommandID uint16 `struc:"uint16,little"` NSId uint32 `struc:"uint32,little"` Rsvd2 [2]uint64 `struc:"[2]uint64"` Dptr DataPtr Lid uint8 `struc:"uint8"` Lsp uint8 `struc:"uint8"` NumDl uint16 `struc:"uint16,little"` NumDu uint16 `struc:"uint16,little"` Rsvd11 uint16 `struc:"uint16,little"` Lpol uint32 `struc:"uint32,little"` Lpou uint32 `struc:"uint32,little"` Rsvf14 [2]uint32 `struc:"[2]uint32"` }
func (*GetLogPageCommand) GetLogPageLen ¶
func (cmd *GetLogPageCommand) GetLogPageLen() uint32
func (*GetLogPageCommand) GetLogPageOffset ¶
func (cmd *GetLogPageCommand) GetLogPageOffset() uint64
func (*GetLogPageCommand) String ¶
func (cmd *GetLogPageCommand) String() string
type IDCtrl ¶
type IDCtrl struct { VID uint16 `struc:"uint16,little"` SSVID uint16 `struc:"uint16,little"` Sn [20]uint8 `struc:"[20]uint8"` Mn [40]uint8 `struc:"[40]uint8"` Fr string `struc:"[8]uint8"` Rab uint8 `struc:"uint8"` Ieee [3]uint8 `struc:"[3]uint8"` Cmic uint8 `struc:"uint8"` Mdts uint8 `struc:"uint8"` CntlID uint16 `struc:"uint16,little"` Ver uint32 `struc:"uint32,little"` Rtd3r uint32 `struc:"uint32,little"` Rtd3e uint32 `struc:"uint32,little"` Oaes uint32 `struc:"uint32,little"` CtrAtt uint32 `struc:"uint32,little"` Rsvd100 [156]uint8 `struc:"[156]uint8"` Oacs uint16 `struc:"uint16,little"` ACL uint8 `struc:"uint8"` Arel uint8 `struc:"uint8"` Frmw uint8 `struc:"uint8"` Lpa uint8 `struc:"uint8"` Elpe uint8 `struc:"uint8"` Npss uint8 `struc:"uint8"` Avscc uint8 `struc:"uint8"` Apsta uint8 `struc:"uint8"` Wctemp uint16 `struc:"uint16,little"` Cctemp uint16 `struc:"uint16,little"` Mtfa uint16 `struc:"uint16,little"` Hmpre uint32 `struc:"uint32,little"` Hmmin uint32 `struc:"uint32,little"` Tnvmcap [16]uint8 `struc:"[16]uint8"` Unvmcap [16]uint8 `struc:"[16]uint8"` Rpmbs uint32 `struc:"uint32,little"` Edstt uint16 `struc:"uint16,little"` Dsto uint8 `struc:"uint8"` FwUg uint8 `struc:"uint8"` Kas uint16 `struc:"uint16,little"` Hctma uint16 `struc:"uint16,little"` MntMt uint16 `struc:"uint16,little"` MxtMt uint16 `struc:"uint16,little"` Sancap uint32 `struc:"uint32,little"` Hmminds uint32 `struc:"uint32,little"` Hmmaxd uint16 `struc:"uint16,little"` Rsvd338 [4]uint8 `struc:"[4]uint8"` Anatt uint8 `struc:"uint8"` AnaCap uint8 `struc:"uint8"` AnaGrpMax uint32 `struc:"uint32,little"` AnaGrpID uint32 `struc:"uint32,little"` Rsvd352 [160]uint8 `struc:"[160]uint8"` Sqes uint8 `struc:"uint8"` Cqes uint8 `struc:"uint8"` Maxcmd uint16 `struc:"uint16,little"` Nn uint32 `struc:"uint32,little"` Oncs uint16 `struc:"uint16,little"` Fuses uint16 `struc:"uint16,little"` Fna uint8 `struc:"uint8"` Vwc uint8 `struc:"uint8"` Awun uint16 `struc:"uint16,little"` AwUpf uint16 `struc:"uint16,little"` Nvscc uint8 `struc:"uint8"` Nwpc uint8 `struc:"uint8"` Acwu uint16 `struc:"uint16,little"` Rsvd534 [2]uint8 `struc:"[2]uint8"` Sgls uint32 `struc:"uint32,little"` Mnan uint32 `struc:"uint32,little"` Rsvd544 [224]uint8 `struc:"[224]uint8"` SubNqn [256]byte `struc:"[256]uint8"` Rsvd1024 [768]uint8 `struc:"[768]uint8"` Ioccsz uint32 `struc:"uint32,little"` Iorcsz uint32 `struc:"uint32,little"` IodOff uint16 `struc:"uint16,little"` CtrlAttr uint8 `struc:"uint8"` Msdbd uint8 `struc:"uint8"` Rsvd1804 [244]uint8 `struc:"[244]uint8"` // HACK :: i don't know how to serialize an array of 32 IDPowerState so we read it as array of bytes //Psd [32]IDPowerState Psd [1024]uint8 `struc:"[1024]uint8"` VS [1024]uint8 `struc:"[1024]uint8"` }
type IDPowerState ¶
type IDPowerState struct { MaxPower uint16 `struc:"uint16,little"` Rsvd2 uint8 `struc:"uint8"` Flags uint8 `struc:"uint8"` EntryLat uint32 `struc:"uint32,little"` ExitLat uint32 `struc:"uint32,little"` ReadTput uint8 `struc:"uint8"` ReadLat uint8 `struc:"uint8"` WriteTput uint8 `struc:"uint8"` WriteLat uint8 `struc:"uint8"` IddlePower uint16 `struc:"uint16,little"` IddleScale uint8 `struc:"uint8"` Rsvd19 uint8 `struc:"uint8"` AcrivePower uint16 `struc:"uint16,little"` ActiveWorkScale uint8 `struc:"uint8"` Rsvd23 [9]uint8 `struc:"[9]uint8"` }
type IdentifyCommand ¶
type IdentifyCommand struct { Opcode uint8 `struc:"uint8"` Flags uint8 `struc:"uint8"` CommandID uint16 `struc:"uint16,little"` NSId uint32 `struc:"uint32,little"` Rsvd2 [2]uint64 `struc:"[2]uint64"` Dptr DataPtr Cns uint8 `struc:"uint8"` Rsvd3 uint8 `struc:"uint8"` CtrlID uint16 `struc:"uint16,little"` Rsvd11 [5]uint16 `struc:"[5]uint32"` }
func (*IdentifyCommand) String ¶
func (cmd *IdentifyCommand) String() string
type KeepAliveRequest ¶
type KeepAliveRequest struct { AbstractRequest Cmd CommonCommand }
func NewKeepAliveRequest ¶
func NewKeepAliveRequest(cmdID uint16) *KeepAliveRequest
func (*KeepAliveRequest) PackCmd ¶
func (request *KeepAliveRequest) PackCmd(buffer *bufio.Writer) error
func (*KeepAliveRequest) String ¶
func (request *KeepAliveRequest) String() string
type NvmeGetDiscoveryLogPageRequest ¶
type NvmeGetDiscoveryLogPageRequest struct { AbstractRequest Cmd GetLogPageCommand // contains filtered or unexported fields }
func NewNvmeGetDiscoveryLogPageRequest ¶
func NewNvmeGetDiscoveryLogPageRequest(cmdid uint16, size uint32, offset uint64, nsid uint32) *NvmeGetDiscoveryLogPageRequest
func (*NvmeGetDiscoveryLogPageRequest) CommandID ¶
func (request *NvmeGetDiscoveryLogPageRequest) CommandID() uint16
func (*NvmeGetDiscoveryLogPageRequest) PackCmd ¶
func (request *NvmeGetDiscoveryLogPageRequest) PackCmd(buffer *bufio.Writer) error
func (*NvmeGetDiscoveryLogPageRequest) String ¶
func (request *NvmeGetDiscoveryLogPageRequest) String() string
type NvmeIdentifyDiscoveryRequest ¶
type NvmeIdentifyDiscoveryRequest struct { AbstractRequest Cmd IdentifyCommand }
func NewIdentifyRequest ¶
func NewIdentifyRequest(cmdid uint16) *NvmeIdentifyDiscoveryRequest
func (*NvmeIdentifyDiscoveryRequest) CommandID ¶
func (request *NvmeIdentifyDiscoveryRequest) CommandID() uint16
func (*NvmeIdentifyDiscoveryRequest) PackCmd ¶
func (request *NvmeIdentifyDiscoveryRequest) PackCmd(buffer *bufio.Writer) error
func (*NvmeIdentifyDiscoveryRequest) String ¶
func (request *NvmeIdentifyDiscoveryRequest) String() string
type NvmefDiscRspPageEntry ¶
type NvmefDiscRspPageEntry struct { TrType uint8 `struc:"uint8"` AdrFam uint8 `struc:"uint8"` SubType SubsystemType `struc:"uint8"` Treq uint8 `struc:"uint8"` PortID uint16 `struc:"uint16,little"` CntlID uint16 `struc:"uint16,little"` Asqsz uint16 `struc:"uint16,little"` Resv8 [22]uint8 `struc:"[22]uint8"` TrsvcID [C.NVMF_TRSVCID_SIZE]uint8 `struc:"[32]uint8"` Resv64 [192]uint8 `struc:"[192]uint8"` Subnqn string `struc:"[256]uint8"` Traddr string `struc:"[256]uint8"` Tsas [256]uint8 `struc:"[256]uint8"` }
func NewDiscoveryRspPageEntry ¶
func NewDiscoveryRspPageEntry(port *Port, subsysNqn string, subType SubsystemType) *NvmefDiscRspPageEntry
type NvmefPropertyGetRequest ¶
type NvmefPropertyGetRequest struct { AbstractRequest Cmd PropertyGetCommand }
func NewPropertyGetRequest ¶
func NewPropertyGetRequest(cmdID uint16, propOff uint32) *NvmefPropertyGetRequest
func (*NvmefPropertyGetRequest) PackCmd ¶
func (request *NvmefPropertyGetRequest) PackCmd(buffer *bufio.Writer) error
func (*NvmefPropertyGetRequest) String ¶
func (request *NvmefPropertyGetRequest) String() string
type NvmefPropertySetRequest ¶
type NvmefPropertySetRequest struct { AbstractRequest Cmd PropertySetCommand }
Rsvd2[34] 90 == 0x5a att 1 Rsvd3 [0,0,0] [3]uint8
func NewPropertySetRequest ¶
func NewPropertySetRequest(cmdID uint16, off uint32, val uint64) *NvmefPropertySetRequest
func (*NvmefPropertySetRequest) PackCmd ¶
func (request *NvmefPropertySetRequest) PackCmd(buffer *bufio.Writer) error
func (*NvmefPropertySetRequest) String ¶
func (request *NvmefPropertySetRequest) String() string
type NvmetAsyncEvent ¶
type NvmetAsyncEvent struct {
// contains filtered or unexported fields
}
type ParserError ¶
type ParserError struct {
// contains filtered or unexported fields
}
func (*ParserError) Error ¶
func (e *ParserError) Error() string
func (*ParserError) Unwrap ¶
func (e *ParserError) Unwrap() error
type Port ¶
type Port struct { TrAddr string TrsvcID string TrType uint8 AdrFam uint8 Treq uint8 ID uint16 Tsas [C.NVMF_TSAS_SIZE]byte }
Port describes nvme port
type PropertyGetCommand ¶
type PropertyGetCommand struct { Opcode uint8 `struc:"uint8"` Resv1 uint8 `struc:"uint8"` CommandID uint16 `struc:"uint16,little"` FcType uint8 `struc:"uint8"` Rsvd2 [35]uint8 `struc:"[35]uint8"` Attrib uint8 `struc:"uint8"` Rsvd3 [3]uint8 `struc:"[3]uint8"` Offset uint32 `struc:"uint32,little"` Rsvd4 [16]uint8 `struc:"[16]uint8"` }
type PropertySetCommand ¶
type PropertySetCommand struct { Opcode uint8 `struc:"uint8"` Resv1 uint8 `struc:"uint8"` CommandID uint16 `struc:"uint16,little"` FcType uint8 `struc:"uint8"` Rsvd2 [35]uint8 `struc:"[35]uint8"` Attrib uint8 `struc:"uint8"` Rsvd3 [3]uint8 `struc:"[3]uint8"` Offset uint32 `struc:"uint32,little"` Value uint64 `struc:"uint64,little"` Rsvd4 [8]uint8 `struc:"[8]uint8"` }
type Request ¶
type Request interface { Completion() *Completion SetCompletion(cqe *Completion) CommandID() uint16 SetData(sgl *ScatterList) GetData() *ScatterList PackCmd(buffer *bufio.Writer) error String() string // contains filtered or unexported methods }
type ScatterList ¶
type ScatterList struct {
// contains filtered or unexported fields
}
func NewScatterList ¶
func NewScatterList(datalen, bufferLen int) *ScatterList
func (*ScatterList) Len ¶
func (sgl *ScatterList) Len() int
Len is the amount of data we can write before filling the sgl
func (*ScatterList) Size ¶
func (sgl *ScatterList) Size() int
func (*ScatterList) String ¶
func (sgl *ScatterList) String() string
type SubsystemType ¶
type SubsystemType uint8
SubsystemType (SUBTYPE): Specifies the type of the NVM subsystem that is indicated in this entry.
const ( // NVME_NQN_NVME - The entry describes a referral to another Discovery Service composed of // Discovery controllers for additional records. NVME_NQN_NVME SubsystemType = C.NVME_NQN_NVME // NVME_NQN_DISC - The entry describes an NVM subsystem that is not associated with // Discovery controllers and whose controllers may have attached // namespaces. NVME_NQN_DISC SubsystemType = C.NVME_NQN_DISC )
type TCPDataPDU ¶
type TCPHeaderType ¶
type TCPIcReqPduType ¶
type TCPIcrespPdu ¶
type TCPRequest ¶
type TCPRequest interface { SetNvmeRequest(nvmeRequest Request) NvmeRequest() Request HasInlineData() bool HasDataIn() bool NeedDataIn() bool SetPDULength(length uint32) GetPDULength() uint32 }
func NewTCPRequest ¶
func NewTCPRequest() TCPRequest
Source Files ¶
Click to show internal directories.
Click to hide internal directories.