iPXE
Data Structures | Macros | Enumerations | Functions | Variables
netvsc.h File Reference

Hyper-V network virtual service client. More...

Go to the source code of this file.

Data Structures

struct  netvsc_header
 NetVSC message header. More...
 
struct  netvsc_init_message
 NetVSC initialisation message. More...
 
struct  netvsc_init_completion
 NetVSC initialisation completion. More...
 
struct  netvsc_ndis_version_message
 NetVSC NDIS version message. More...
 
struct  netvsc_establish_buffer_message
 NetVSC establish data buffer message. More...
 
struct  netvsc_rx_buffer_section
 NetVSC receive data buffer section. More...
 
struct  netvsc_rx_establish_buffer_completion
 NetVSC establish receive data buffer completion. More...
 
struct  netvsc_tx_establish_buffer_completion
 NetVSC establish transmit data buffer completion. More...
 
struct  netvsc_revoke_buffer_message
 NetVSC revoke data buffer message. More...
 
struct  netvsc_rndis_message
 NetVSC RNDIS message. More...
 
struct  netvsc_ring
 A NetVSC descriptor ring. More...
 
struct  netvsc_buffer
 A NetVSC data buffer. More...
 
struct  netvsc_device
 A NetVSC device. More...
 

Macros

#define NETVSC_MTU   512
 Maximum supported NetVSC message length. More...
 
#define NETVSC_MAX_WAIT_MS   1000
 Maximum time to wait for a transaction to complete. More...
 
#define NETVSC_TX_NUM_DESC   32
 Number of transmit ring entries. More...
 
#define NETVSC_RX_BUF_PAGESET   0xbead
 RX data buffer page set ID. More...
 
#define NETVSC_RX_BUF_LEN   ( 16 * PAGE_SIZE )
 RX data buffer length. More...
 
#define NETVSC_BASE_XID   0x18ae0000UL
 Base transaction ID. More...
 
#define NETVSC_INIT_MSG   1
 NetVSC initialisation message. More...
 
#define NETVSC_VERSION_1   2 /* sic */
 Oldest known NetVSC protocol version. More...
 
#define NETVSC_INIT_CMPLT   2
 NetVSC initialisation completion. More...
 
#define NETVSC_NDIS_VERSION_MSG   100
 NetVSC NDIS version message. More...
 
#define NETVSC_NDIS_MAJOR   6
 NetVSC NDIS major version. More...
 
#define NETVSC_NDIS_MINOR   1
 NetVSC NDIS minor version. More...
 
#define NETVSC_RX_ESTABLISH_MSG   101
 NetVSC establish receive data buffer message. More...
 
#define NETVSC_RX_ESTABLISH_CMPLT   102
 NetVSC establish receive data buffer completion. More...
 
#define NETVSC_RX_REVOKE_MSG   103
 NetVSC revoke receive data buffer message. More...
 
#define NETVSC_TX_ESTABLISH_MSG   104
 NetVSC establish transmit data buffer message. More...
 
#define NETVSC_TX_ESTABLISH_CMPLT   105
 NetVSC establish transmit data buffer completion. More...
 
#define NETVSC_TX_REVOKE_MSG   106
 NetVSC revoke transmit data buffer message. More...
 
#define NETVSC_RNDIS_MSG   107
 NetVSC RNDIS message. More...
 
#define NETVSC_RNDIS_DATA   0
 RNDIS data channel (for RNDIS_PACKET_MSG only) More...
 
#define NETVSC_RNDIS_CONTROL   1
 RNDIS control channel (for all other RNDIS messages) More...
 
#define NETVSC_RNDIS_NO_BUFFER   0xffffffffUL
 "No buffer used" index More...
 

Enumerations

enum  netvsc_xrid {
  NETVSC_TX_BASE_XRID = 0, NETVSC_INIT_XRID = ( NETVSC_TX_BASE_XRID + NETVSC_TX_NUM_DESC ), NETVSC_NDIS_VERSION_XRID, NETVSC_RX_ESTABLISH_XRID,
  NETVSC_RX_REVOKE_XRID
}
 Relative transaction IDs. More...
 
enum  netvsc_status {
  NETVSC_NONE = 0, NETVSC_OK = 1, NETVSC_FAIL = 2, NETVSC_TOO_NEW = 3,
  NETVSC_TOO_OLD = 4, NETVSC_BAD_PACKET = 5, NETVSC_BUSY = 6, NETVSC_UNSUPPORTED = 7
}
 NetVSC status codes. More...
 

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
struct netvsc_header __attribute__ ((packed))
 
static __attribute__ ((always_inline)) void netvsc_init_ring(struct netvsc_ring *ring
 Initialise descriptor ring. More...
 

Variables

uint32_t type
 Type. More...
 
struct netvsc_header header
 Message header. More...
 
uint32_t min
 Minimum supported protocol version. More...
 
uint32_t max = max
 Maximum supported protocol version. More...
 
uint8_t reserved [20]
 Reserved. More...
 
uint32_t version
 Protocol version. More...
 
uint32_t max_mdl_len
 Maximum memory descriptor list length. More...
 
uint32_t status
 Status. More...
 
uint32_t major
 Major version. More...
 
uint32_t minor
 Minor version. More...
 
uint32_t gpadl
 GPADL ID. More...
 
uint16_t pageset
 Page set ID. More...
 
uint32_t start
 Starting offset. More...
 
uint32_t len
 Subsection length. More...
 
uint32_t count
 Number of subsections. More...
 
uint32_t end
 Ending offset. More...
 
struct netvsc_rx_buffer_section section [1]
 Section descriptors. More...
 
uint32_t channel
 RNDIS channel. More...
 
uint32_t buffer
 Buffer index (or NETVSC_RNDIS_NO_BUFFER) More...
 
struct netvsc_ring __attribute__
 
static unsigned int struct io_buffer ** iobufs = iobufs
 
static unsigned int struct io_buffer uint8_tids
 
static uint16_t struct vmbus_xfer_pages_operationsop = op
 
static uint16_t struct vmbus_xfer_pages_operations uint8_t establish_type = establish_type
 
static uint16_t struct vmbus_xfer_pages_operations uint8_t uint8_t establish_xrid = establish_xrid
 
static uint16_t struct vmbus_xfer_pages_operations uint8_t uint8_t uint8_t revoke_type = revoke_type
 
static uint16_t struct vmbus_xfer_pages_operations uint8_t uint8_t uint8_t uint8_t revoke_xrid = revoke_xrid
 

Detailed Description

Hyper-V network virtual service client.

Definition in file netvsc.h.

Macro Definition Documentation

◆ NETVSC_MTU

#define NETVSC_MTU   512

Maximum supported NetVSC message length.

Definition at line 13 of file netvsc.h.

◆ NETVSC_MAX_WAIT_MS

#define NETVSC_MAX_WAIT_MS   1000

Maximum time to wait for a transaction to complete.

This is a policy decision.

Definition at line 19 of file netvsc.h.

◆ NETVSC_TX_NUM_DESC

#define NETVSC_TX_NUM_DESC   32

Number of transmit ring entries.

Must be a power of two. This is a policy decision. This value must be sufficiently small to guarantee that we never run out of space in the VMBus outbound ring buffer.

Definition at line 27 of file netvsc.h.

◆ NETVSC_RX_BUF_PAGESET

#define NETVSC_RX_BUF_PAGESET   0xbead

RX data buffer page set ID.

This is a policy decision.

Definition at line 33 of file netvsc.h.

◆ NETVSC_RX_BUF_LEN

#define NETVSC_RX_BUF_LEN   ( 16 * PAGE_SIZE )

RX data buffer length.

This is a policy decision.

Definition at line 39 of file netvsc.h.

◆ NETVSC_BASE_XID

#define NETVSC_BASE_XID   0x18ae0000UL

Base transaction ID.

This is a policy decision.

Definition at line 45 of file netvsc.h.

◆ NETVSC_INIT_MSG

#define NETVSC_INIT_MSG   1

NetVSC initialisation message.

Definition at line 80 of file netvsc.h.

◆ NETVSC_VERSION_1

#define NETVSC_VERSION_1   2 /* sic */

Oldest known NetVSC protocol version.

Definition at line 95 of file netvsc.h.

◆ NETVSC_INIT_CMPLT

#define NETVSC_INIT_CMPLT   2

NetVSC initialisation completion.

Definition at line 98 of file netvsc.h.

◆ NETVSC_NDIS_VERSION_MSG

#define NETVSC_NDIS_VERSION_MSG   100

NetVSC NDIS version message.

Definition at line 115 of file netvsc.h.

◆ NETVSC_NDIS_MAJOR

#define NETVSC_NDIS_MAJOR   6

NetVSC NDIS major version.

Definition at line 130 of file netvsc.h.

◆ NETVSC_NDIS_MINOR

#define NETVSC_NDIS_MINOR   1

NetVSC NDIS minor version.

Definition at line 133 of file netvsc.h.

◆ NETVSC_RX_ESTABLISH_MSG

#define NETVSC_RX_ESTABLISH_MSG   101

NetVSC establish receive data buffer message.

Definition at line 136 of file netvsc.h.

◆ NETVSC_RX_ESTABLISH_CMPLT

#define NETVSC_RX_ESTABLISH_CMPLT   102

NetVSC establish receive data buffer completion.

Definition at line 139 of file netvsc.h.

◆ NETVSC_RX_REVOKE_MSG

#define NETVSC_RX_REVOKE_MSG   103

NetVSC revoke receive data buffer message.

Definition at line 142 of file netvsc.h.

◆ NETVSC_TX_ESTABLISH_MSG

#define NETVSC_TX_ESTABLISH_MSG   104

NetVSC establish transmit data buffer message.

Definition at line 145 of file netvsc.h.

◆ NETVSC_TX_ESTABLISH_CMPLT

#define NETVSC_TX_ESTABLISH_CMPLT   105

NetVSC establish transmit data buffer completion.

Definition at line 148 of file netvsc.h.

◆ NETVSC_TX_REVOKE_MSG

#define NETVSC_TX_REVOKE_MSG   106

NetVSC revoke transmit data buffer message.

Definition at line 151 of file netvsc.h.

◆ NETVSC_RNDIS_MSG

#define NETVSC_RNDIS_MSG   107

NetVSC RNDIS message.

Definition at line 210 of file netvsc.h.

◆ NETVSC_RNDIS_DATA

#define NETVSC_RNDIS_DATA   0

RNDIS data channel (for RNDIS_PACKET_MSG only)

Definition at line 227 of file netvsc.h.

◆ NETVSC_RNDIS_CONTROL

#define NETVSC_RNDIS_CONTROL   1

RNDIS control channel (for all other RNDIS messages)

Definition at line 230 of file netvsc.h.

◆ NETVSC_RNDIS_NO_BUFFER

#define NETVSC_RNDIS_NO_BUFFER   0xffffffffUL

"No buffer used" index

Definition at line 233 of file netvsc.h.

Enumeration Type Documentation

◆ netvsc_xrid

Relative transaction IDs.

Enumerator
NETVSC_TX_BASE_XRID 

Transmit descriptors (one per transmit buffer ID)

NETVSC_INIT_XRID 

Initialisation.

NETVSC_NDIS_VERSION_XRID 

NDIS version.

NETVSC_RX_ESTABLISH_XRID 

Establish receive buffer.

NETVSC_RX_REVOKE_XRID 

Revoke receive buffer.

Definition at line 48 of file netvsc.h.

48  {
49  /** Transmit descriptors (one per transmit buffer ID) */
51  /** Initialisation */
53  /** NDIS version */
55  /** Establish receive buffer */
57  /** Revoke receive buffer */
59 };
NDIS version.
Definition: netvsc.h:54
Establish receive buffer.
Definition: netvsc.h:56
Revoke receive buffer.
Definition: netvsc.h:58
#define NETVSC_TX_NUM_DESC
Number of transmit ring entries.
Definition: netvsc.h:27
Initialisation.
Definition: netvsc.h:52
Transmit descriptors (one per transmit buffer ID)
Definition: netvsc.h:50

◆ netvsc_status

NetVSC status codes.

Enumerator
NETVSC_NONE 
NETVSC_OK 
NETVSC_FAIL 
NETVSC_TOO_NEW 
NETVSC_TOO_OLD 
NETVSC_BAD_PACKET 
NETVSC_BUSY 
NETVSC_UNSUPPORTED 

Definition at line 62 of file netvsc.h.

62  {
63  NETVSC_NONE = 0,
64  NETVSC_OK = 1,
65  NETVSC_FAIL = 2,
66  NETVSC_TOO_NEW = 3,
67  NETVSC_TOO_OLD = 4,
69  NETVSC_BUSY = 6,
71 };

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ __attribute__() [1/2]

struct netvsc_header __attribute__ ( (packed)  )

◆ __attribute__() [2/2]

static __attribute__ ( (always_inline)  )
inlinestatic

Initialise descriptor ring.

Check if NetVSC device is obsolete.

Initialise data buffer.

Check whether or not descriptor ring is empty.

Check whether or not descriptor ring is full.

Parameters
ringDescriptor ring
countMaximum number of used descriptors
iobufsI/O buffers
idsBuffer IDs
ringDescriptor ring
is_fullRing is full
ringDescriptor ring
is_emptyRing is empty
bufferData buffer
pagesetPage set ID
opPage set operations
establish_typeEstablish data buffer message type
establish_xridEstablish data buffer relative transaction ID
revoke_typeRevoke data buffer message type
revoke_typeRevoke data buffer relative transaction ID
lenRequired length
netvscNetVSC device
is_obsoleteNetVSC device is obsolete

Check if NetVSC device is obsolete (i.e. was opened before the most recent Hyper-V reset).

Definition at line 272 of file netvsc.h.

273  {
274  unsigned int fill_level;
275 
276  fill_level = ( ring->id_prod - ring->id_cons );
277  assert ( fill_level <= ring->count );
278  return ( fill_level >= ring->count );
279 }
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
uint32_t count
Number of subsections.
Definition: netvsc.h:16

References assert(), count, netvsc_ring::count, netvsc_ring::id_cons, and netvsc_ring::id_prod.

Variable Documentation

◆ type

uint32_t type

Type.

Definition at line 12 of file netvsc.h.

◆ header

struct netvsc_header header

Message header.

Definition at line 12 of file netvsc.h.

◆ min

uint32_t min

Minimum supported protocol version.

Definition at line 14 of file netvsc.h.

◆ max

timer max = max

Maximum supported protocol version.

Definition at line 16 of file netvsc.h.

◆ reserved

uint8_t reserved[16]

Reserved.

Definition at line 18 of file netvsc.h.

◆ version

uint32_t version

Protocol version.

Definition at line 14 of file netvsc.h.

◆ max_mdl_len

uint32_t max_mdl_len

Maximum memory descriptor list length.

Definition at line 16 of file netvsc.h.

◆ status

uint32_t status

Status.

Definition at line 18 of file netvsc.h.

◆ major

uint16_t major

Major version.

Major version number.

Definition at line 14 of file netvsc.h.

Referenced by aoe_open(), aoe_parse_uri(), aoedev_open(), ar9300_comp_hdr_unpack(), and ar9300_eeprom_restore_internal().

◆ minor

uint16_t minor

Minor version.

Minor version number.

Definition at line 16 of file netvsc.h.

Referenced by aoe_open(), aoe_parse_uri(), aoedev_open(), ar9300_comp_hdr_unpack(), ar9300_eeprom_restore_internal(), and falcon_probe_nic_variant().

◆ gpadl

uint32_t gpadl

◆ pageset

static uint16_t pageset

Page set ID.

Definition at line 16 of file netvsc.h.

Referenced by vmbus_xfer_pages().

◆ len

buffer len
Initial value:
{
buffer->pages.pageset = cpu_to_le16 ( pageset )
uint16_t pageset
Page set ID.
Definition: netvsc.h:16
uint32_t buffer
Buffer index (or NETVSC_RNDIS_NO_BUFFER)
Definition: netvsc.h:16
#define cpu_to_le16(value)
Definition: byteswap.h:106

Subsection length.

Buffer length.

Section length.

Definition at line 14 of file netvsc.h.

◆ count

unsigned int count

Number of subsections.

Number of sections (must be 1)

Definition at line 16 of file netvsc.h.

Referenced by __attribute__().

◆ end

uint32_t end

◆ section

struct netvsc_rx_buffer_section section[1]

Section descriptors.

Definition at line 18 of file netvsc.h.

◆ channel

uint8_t channel

◆ __attribute__

◆ iobufs

ring iobufs = iobufs

Definition at line 259 of file netvsc.h.

◆ ids

ring ids
Initial value:
{
ring->count = count
uint32_t count
Number of subsections.
Definition: netvsc.h:16

Definition at line 259 of file netvsc.h.

◆ op

buffer pages op = op

◆ establish_type

buffer establish_type = establish_type

Definition at line 327 of file netvsc.h.

◆ establish_xrid

buffer establish_xrid = establish_xrid

Definition at line 327 of file netvsc.h.

◆ revoke_type

buffer revoke_type = revoke_type

Definition at line 327 of file netvsc.h.

◆ revoke_xrid

buffer revoke_xrid = revoke_xrid

Definition at line 327 of file netvsc.h.