Documentation ¶
Index ¶
- Constants
- Variables
- type Blk
- type BlkReq
- type IRQInjector
- type Net
- func (v Net) GetDeviceHeader() pci.DeviceHeader
- func (v Net) GetIORange() (start, end uint64)
- func (v Net) IOInHandler(port uint64, bytes []byte) error
- func (v *Net) IOOutHandler(port uint64, bytes []byte) error
- func (v *Net) Rx() error
- func (v *Net) RxThreadEntry()
- func (v *Net) Tx() error
- func (v *Net) TxThreadEntry()
- type VirtQueue
Constants ¶
View Source
const ( BlkIOPortStart = 0x6300 BlkIOPortSize = 0x100 SectorSize = 512 )
View Source
const ( NetIOPortStart = 0x6200 NetIOPortSize = 0x100 )
View Source
const ( // The number of free descriptors in virt queue must exceed // MAX_SKB_FRAGS (16). Otherwise, packet transmission from // the guest to the host will be stopped. // // refs https://github.com/torvalds/linux/blob/5859a2b/drivers/net/virtio_net.c#L1754 QueueSize = 32 )
Variables ¶
View Source
var ( ErrInvalidSel = errors.New("queue sel is invalid") ErrIONotPermit = errors.New("IO is not permitted for virtio device") ErrNoTxPacket = errors.New("no packet for tx") ErrNoRxPacket = errors.New("no packet for rx") ErrVQNotInit = errors.New("vq not initialized") ErrNoRxBuf = errors.New("no buffer found for rx") )
Functions ¶
This section is empty.
Types ¶
type Blk ¶ added in v0.0.7
type Blk struct { Hdr blkHdr VirtQueue [1]*VirtQueue Mem []byte LastAvailIdx [1]uint16 IRQInjector IRQInjector // contains filtered or unexported fields }
func (Blk) GetDeviceHeader ¶ added in v0.0.7
func (v Blk) GetDeviceHeader() pci.DeviceHeader
func (Blk) GetIORange ¶ added in v0.0.7
func (*Blk) IOOutHandler ¶ added in v0.0.7
func (*Blk) IOThreadEntry ¶ added in v0.0.7
func (v *Blk) IOThreadEntry()
type IRQInjector ¶ added in v0.0.6
type Net ¶
type Net struct { Hdr netHdr VirtQueue [2]*VirtQueue Mem []byte LastAvailIdx [2]uint16 IRQInjector IRQInjector // contains filtered or unexported fields }
func NewNet ¶
func NewNet(irq uint8, irqInjector IRQInjector, tap io.ReadWriter, mem []byte) *Net
func (Net) GetDeviceHeader ¶
func (v Net) GetDeviceHeader() pci.DeviceHeader
func (Net) GetIORange ¶
func (*Net) RxThreadEntry ¶
func (v *Net) RxThreadEntry()
func (*Net) TxThreadEntry ¶
func (v *Net) TxThreadEntry()
type VirtQueue ¶
type VirtQueue struct { DescTable [QueueSize]struct { Addr uint64 Len uint32 Flags uint16 Next uint16 } AvailRing struct { Flags uint16 Idx uint16 Ring [QueueSize]uint16 UsedEvent uint16 } UsedRing struct { Flags uint16 Idx uint16 Ring [QueueSize]struct { Idx uint32 Len uint32 } // contains filtered or unexported fields } // contains filtered or unexported fields }
refs: https://wiki.osdev.org/Virtio#Virtual_Queue_Descriptor
Click to show internal directories.
Click to hide internal directories.