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

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.

Variables

uint32_t type
 Type.
struct netvsc_header header
 Message header.
uint32_t min
 Minimum supported protocol version.
uint32_t max = max
 Maximum supported protocol version.
uint8_t reserved [20]
 Reserved.
uint32_t version
 Protocol version.
uint32_t max_mdl_len
 Maximum memory descriptor list length.
uint32_t status
 Status.
uint32_t major
 Major version.
uint32_t minor
 Minor version.
uint32_t gpadl
 GPADL ID.
uint16_t pageset
 Page set ID.
uint32_t start
 Starting offset.
uint32_t len
 Subsection length.
uint32_t count
 Number of subsections.
uint32_t end
 Ending offset.
struct netvsc_rx_buffer_section section [1]
 Section descriptors.
uint32_t channel
 RNDIS channel.
uint32_t buffer
 Buffer index (or NETVSC_RNDIS_NO_BUFFER)
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.

Referenced by netvsc_open().

◆ 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.

Referenced by netvsc_control().

◆ 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.

Referenced by netvsc_probe(), and netvsc_recv_completion().

◆ 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.

Referenced by netvsc_probe().

◆ 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.

Referenced by netvsc_probe().

◆ NETVSC_BASE_XID

#define NETVSC_BASE_XID   0x18ae0000UL

Base transaction ID.

This is a policy decision.

Definition at line 45 of file netvsc.h.

Referenced by netvsc_cancel_transmit(), netvsc_control(), netvsc_recv_completion(), and netvsc_transmit().

◆ NETVSC_INIT_MSG

#define NETVSC_INIT_MSG   1

NetVSC initialisation message.

Definition at line 80 of file netvsc.h.

Referenced by netvsc_initialise().

◆ NETVSC_VERSION_1

#define NETVSC_VERSION_1   2 /* sic */

Oldest known NetVSC protocol version.

Definition at line 95 of file netvsc.h.

Referenced by netvsc_initialise().

◆ NETVSC_INIT_CMPLT

#define NETVSC_INIT_CMPLT   2

NetVSC initialisation completion.

Definition at line 98 of file netvsc.h.

Referenced by netvsc_initialised().

◆ NETVSC_NDIS_VERSION_MSG

#define NETVSC_NDIS_VERSION_MSG   100

NetVSC NDIS version message.

Definition at line 115 of file netvsc.h.

Referenced by netvsc_ndis_version().

◆ NETVSC_NDIS_MAJOR

#define NETVSC_NDIS_MAJOR   6

NetVSC NDIS major version.

Definition at line 130 of file netvsc.h.

Referenced by netvsc_ndis_version().

◆ NETVSC_NDIS_MINOR

#define NETVSC_NDIS_MINOR   1

NetVSC NDIS minor version.

Definition at line 133 of file netvsc.h.

Referenced by netvsc_ndis_version().

◆ NETVSC_RX_ESTABLISH_MSG

#define NETVSC_RX_ESTABLISH_MSG   101

NetVSC establish receive data buffer message.

Definition at line 136 of file netvsc.h.

Referenced by netvsc_probe().

◆ NETVSC_RX_ESTABLISH_CMPLT

#define NETVSC_RX_ESTABLISH_CMPLT   102

NetVSC establish receive data buffer completion.

Definition at line 139 of file netvsc.h.

Referenced by netvsc_rx_established_buffer().

◆ NETVSC_RX_REVOKE_MSG

#define NETVSC_RX_REVOKE_MSG   103

NetVSC revoke receive data buffer message.

Definition at line 142 of file netvsc.h.

Referenced by netvsc_probe().

◆ 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.

Referenced by netvsc_recv_data(), and netvsc_transmit().

◆ NETVSC_RNDIS_DATA

#define NETVSC_RNDIS_DATA   0

RNDIS data channel (for RNDIS_PACKET_MSG only)

Definition at line 227 of file netvsc.h.

Referenced by netvsc_transmit().

◆ NETVSC_RNDIS_CONTROL

#define NETVSC_RNDIS_CONTROL   1

RNDIS control channel (for all other RNDIS messages)

Definition at line 230 of file netvsc.h.

Referenced by netvsc_transmit().

◆ NETVSC_RNDIS_NO_BUFFER

#define NETVSC_RNDIS_NO_BUFFER   0xffffffffUL

"No buffer used" index

Definition at line 233 of file netvsc.h.

Referenced by netvsc_transmit().

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};
@ NETVSC_RX_ESTABLISH_XRID
Establish receive buffer.
Definition netvsc.h:56
@ NETVSC_RX_REVOKE_XRID
Revoke receive buffer.
Definition netvsc.h:58
@ NETVSC_NDIS_VERSION_XRID
NDIS version.
Definition netvsc.h:54
@ NETVSC_INIT_XRID
Initialisation.
Definition netvsc.h:52
@ NETVSC_TX_BASE_XRID
Transmit descriptors (one per transmit buffer ID)
Definition netvsc.h:50
#define NETVSC_TX_NUM_DESC
Number of transmit ring entries.
Definition netvsc.h:27

◆ 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,
69 NETVSC_BUSY = 6,
71};
@ NETVSC_BAD_PACKET
Definition netvsc.h:68
@ NETVSC_TOO_OLD
Definition netvsc.h:67
@ NETVSC_OK
Definition netvsc.h:64
@ NETVSC_TOO_NEW
Definition netvsc.h:66
@ NETVSC_BUSY
Definition netvsc.h:69
@ NETVSC_FAIL
Definition netvsc.h:65
@ NETVSC_UNSUPPORTED
Definition netvsc.h:70
@ NETVSC_NONE
Definition netvsc.h:63

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ __attribute__()

__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}
#define assert(condition)
Assert a condition at run-time.
Definition assert.h:50
static unsigned int count
Number of entries.
Definition dwmac.h:220

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 1 of file netvsc.h.

◆ header

struct netvsc_header header

Message header.

Definition at line 1 of file netvsc.h.

◆ min

uint32_t min

Minimum supported protocol version.

Definition at line 3 of file netvsc.h.

◆ max

timer max = max

Maximum supported protocol version.

Definition at line 5 of file netvsc.h.

◆ reserved

uint8_t reserved[16]

Reserved.

Definition at line 7 of file netvsc.h.

◆ version

uint32_t version

Protocol version.

Definition at line 3 of file netvsc.h.

◆ max_mdl_len

uint32_t max_mdl_len

Maximum memory descriptor list length.

Definition at line 5 of file netvsc.h.

◆ status

uint32_t status

Status.

Definition at line 7 of file netvsc.h.

◆ major

uint8_t major

Major version.

Major version number.

Definition at line 3 of file netvsc.h.

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

◆ minor

uint8_t minor

Minor version.

Minor version number.

Definition at line 5 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

◆ pageset

uint16_t pageset

Page set ID.

Definition at line 5 of file netvsc.h.

Referenced by vmbus_xfer_pages().

◆ len

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

Subsection length.

Buffer length.

Section length.

Definition at line 3 of file netvsc.h.

◆ count

unsigned int count

Number of subsections.

Number of sections (must be 1)

Definition at line 5 of file netvsc.h.

◆ end

uint32_t end

Ending offset.

Definition at line 7 of file netvsc.h.

Referenced by aes_setkey(), aoe_parse_uri(), apply_syslogs_settings(), arbel_map_vpm(), asn1_shrink(), bzimage_parse_cmdline(), cpio_parse_cmdline(), DEFINE_XEN_GUEST_HANDLE(), dns_encode(), eepro_transmit(), efi_aoe_path(), efi_block_exec(), efi_fcp_path(), efi_file_path_claim(), efi_ib_srp_path(), efi_ifr_end_op(), efi_ifr_package(), efi_image_path(), efi_iscsi_path(), efi_locate_device(), efi_netdev_path(), efi_path_len(), efi_path_terminate(), efi_paths(), efi_uri_path(), efi_usb_path(), efipci_ioremap(), elf_segment(), expand_settings(), fbcon_handle_sgr(), fdt_end(), fdt_parse(), FILE_LICENCE(), format_decimal(), format_hex(), hermon_map_vpm(), hide_region(), ib_srp_parse_integer(), ieee80211_ie_bound(), ieee80211_next_ie(), inet6_aton(), initrd_reshuffle(), initrd_squash_high(), initrd_swap_any(), int15_sync(), ipair_key(), ipair_rx_pair(), ipair_rx_pubkey(), ipair_rx_session(), ipair_tag(), ipv6_check_options(), iscsi_handle_maxburstlength_value(), pci_find_next(), peerblk_deliver(), peerblk_retrieval_rx(), peerdist_discovery_reply_values(), peerdist_info_block(), pem_asn1(), prep_segment(), relocate(), rsa_decrypt(), sec80211_detect_ie(), sec80211_find_rsn(), sis190_rx_fill(), skge_ramset(), sky2_ramset(), slam_parse_multicast_address(), strsep(), tcp_rx_opts(), tftp_process_blksize(), tftp_process_tsize(), tftp_rx_oack(), tkip_michael(), uhci_async_schedule(), uhci_enqueue(), uhci_periodic_schedule(), uheap_find(), usb_is_within_config(), usbio_open(), usbio_path(), and vsnprintf().

◆ section

struct netvsc_rx_buffer_section section[1]

Section descriptors.

Definition at line 7 of file netvsc.h.

Referenced by __attribute__().

◆ channel

◆ iobufs

ring iobufs = iobufs

Definition at line 259 of file netvsc.h.

◆ ids

ring ids
Initial value:
{
ring->count = count

Definition at line 259 of file netvsc.h.

◆ op

buffer pages op = op

Definition at line 327 of file netvsc.h.

Referenced by acpi_describe(), alloc_usb_bus(), ata_command(), bigint_ladder_raw(), bigint_multiply_one(), block_capacity(), block_read(), block_read_capacity(), block_write(), bofm_init(), cipher_cost(), dhcpv6_fetch(), dma_init(), dma_op_alloc(), dma_op_map(), dma_op_set_mask(), dma_op_umalloc(), edd_describe(), efi_describe(), efi_ifr_false_op(), efi_ifr_op(), efi_ifr_true_op(), efi_pxe_fake(), efipci_dma_map(), efipci_dma_set_mask(), FILE_LICENCE(), gpios_init(), ib_create_conn(), ib_create_cq(), ib_create_madx(), ib_create_path(), ib_create_qp(), ib_create_service_madx(), identify_device(), init_widget(), int13con_rw(), intelxl_context(), intelxl_context_dump(), intelxl_context_line(), intf_close(), intf_get_dest_op_no_passthru_untyped(), intf_poke(), job_progress(), mdio_init(), ndp_prefix_fetch(), netdev_fetch(), netdev_init(), netdev_store(), nii_get_station_address(), nii_initialise_flags(), nii_io(), nii_issue(), nii_issue_cpb(), nii_issue_cpb_db(), nii_issue_db(), nii_map(), nii_poll(), nii_set_rx_filters(), nii_set_station_address(), nii_transmit(), peerdisc_init(), peerdisc_stat(), PROVIDE_DMAAPI(), PROVIDE_DMAAPI(), PROVIDE_DMAAPI(), PROVIDE_DMAAPI(), PROVIDE_DMAAPI(), PROVIDE_DMAAPI(), PROVIDE_DMAAPI(), PROVIDE_DMAAPI_INLINE(), resolv_done(), rndis_init(), scsi_command(), scsi_response(), settings_init(), sky2_rx_add(), vmbus_open(), weierstrass_add_raw(), weierstrass_exec(), weierstrass_verify_raw(), xfer_alloc_iob(), xfer_buffer(), xfer_deliver(), xfer_vredirect(), xfer_window(), and xsigo_discover().

◆ establish_type

buffer establish_type = establish_type

Definition at line 328 of file netvsc.h.

◆ establish_xrid

buffer establish_xrid = establish_xrid

Definition at line 328 of file netvsc.h.

◆ revoke_type

buffer revoke_type = revoke_type

Definition at line 329 of file netvsc.h.

◆ revoke_xrid

buffer revoke_xrid = revoke_xrid

Definition at line 329 of file netvsc.h.