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

Xen netfront driver. More...

#include <ipxe/xen.h>
#include <xen/io/netif.h>

Go to the source code of this file.

Data Structures

struct  netfront_ring
 A netfront descriptor ring. More...
 
struct  netfront_nic
 A netfront NIC. More...
 

Macros

#define NETFRONT_NUM_TX_DESC   16
 Number of transmit ring entries. More...
 
#define NETFRONT_NUM_RX_DESC   32
 Number of receive ring entries. More...
 
#define NETFRONT_RX_FILL   18
 Receive ring fill level. More...
 
#define tx_sring   tx.sring.tx
 Transmit shared ring field. More...
 
#define rx_sring   rx.sring.rx
 Receive shared ring field. More...
 

Enumerations

enum  netfront_ref_index {
  NETFRONT_REF_TX_RING = 0, NETFRONT_REF_TX_BASE, NETFRONT_REF_RX_RING = ( NETFRONT_REF_TX_BASE + NETFRONT_NUM_TX_DESC ), NETFRONT_REF_RX_BASE,
  NETFRONT_REF_COUNT = ( NETFRONT_REF_RX_BASE + NETFRONT_NUM_RX_DESC )
}
 Grant reference indices. More...
 

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
static __attribute__ ((always_inline)) void netfront_init_ring(struct netfront_ring *ring
 Initialise descriptor ring. More...
 

Variables

static const char * ref_key
 
static const char grant_ref_t ref = ref
 
static const char grant_ref_t unsigned int count = count
 
static const char grant_ref_t unsigned int struct io_buffer ** iobufs = iobufs
 
static const char grant_ref_t unsigned int struct io_buffer grant_ref_trefs = refs
 
static const char grant_ref_t unsigned int struct io_buffer grant_ref_t uint8_tids
 

Detailed Description

Xen netfront driver.

Definition in file netfront.h.

Macro Definition Documentation

◆ NETFRONT_NUM_TX_DESC

#define NETFRONT_NUM_TX_DESC   16

Number of transmit ring entries.

Definition at line 16 of file netfront.h.

◆ NETFRONT_NUM_RX_DESC

#define NETFRONT_NUM_RX_DESC   32

Number of receive ring entries.

Definition at line 19 of file netfront.h.

◆ NETFRONT_RX_FILL

#define NETFRONT_RX_FILL   18

Receive ring fill level.

The xen-netback driver from kernels 3.18 to 4.2 inclusive have a bug (CA-163395) which prevents packet reception if fewer than 18 receive descriptors are available. This was fixed in upstream kernel commit d5d4852 ("xen-netback: require fewer guest Rx slots when not using GSO").

We provide 18 receive descriptors to avoid unpleasant silent failures on these kernel versions.

Definition at line 32 of file netfront.h.

◆ tx_sring

#define tx_sring   tx.sring.tx

Transmit shared ring field.

Definition at line 173 of file netfront.h.

◆ rx_sring

#define rx_sring   rx.sring.rx

Receive shared ring field.

Definition at line 176 of file netfront.h.

Enumeration Type Documentation

◆ netfront_ref_index

Grant reference indices.

Enumerator
NETFRONT_REF_TX_RING 

Transmit ring grant reference index.

NETFRONT_REF_TX_BASE 

Transmit descriptor grant reference base index.

NETFRONT_REF_RX_RING 

Receive ring grant reference index.

NETFRONT_REF_RX_BASE 

Receive descriptor grant reference base index.

NETFRONT_REF_COUNT 

Total number of grant references required.

Definition at line 35 of file netfront.h.

35  {
36  /** Transmit ring grant reference index */
38  /** Transmit descriptor grant reference base index */
40  /** Receive ring grant reference index */
42  /** Receive descriptor grant reference base index */
44  /** Total number of grant references required */
46 };
Total number of grant references required.
Definition: netfront.h:45
#define NETFRONT_NUM_TX_DESC
Number of transmit ring entries.
Definition: netfront.h:16
#define NETFRONT_NUM_RX_DESC
Number of receive ring entries.
Definition: netfront.h:19
Receive ring grant reference index.
Definition: netfront.h:41
Receive descriptor grant reference base index.
Definition: netfront.h:43
Transmit descriptor grant reference base index.
Definition: netfront.h:39
Transmit ring grant reference index.
Definition: netfront.h:37

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ __attribute__()

static __attribute__ ( (always_inline)  )
inlinestatic

Initialise descriptor ring.

Check whether or not descriptor ring is empty.

Check whether or not descriptor ring is full.

Calculate descriptor ring fill level.

Parameters
ringDescriptor ring
ref_keyShared ring grant reference key
refShared ring grant reference
countMaxium number of used descriptors
iobufsI/O buffers
refsI/O buffer grant references
idsBuffer IDs
ringDescriptor ring
fillFill level
ringDescriptor ring
is_fullRing is full
ringDescriptor ring
is_emptyRing is empty

Definition at line 110 of file netfront.h.

111  {
112  unsigned int fill_level;
113 
114  fill_level = ( ring->id_prod - ring->id_cons );
115  assert ( fill_level <= ring->count );
116  return fill_level;
117 }
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
static const char grant_ref_t unsigned int count
Definition: netfront.h:91

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

Variable Documentation

◆ ref_key

const char* ref_key

Definition at line 91 of file netfront.h.

◆ ref

static grant_ref_t ref = ref

Definition at line 91 of file netfront.h.

Referenced by netfront_push(), xengrant_alloc(), and xengrant_free().

◆ count

ring count = count

Definition at line 91 of file netfront.h.

Referenced by __attribute__().

◆ iobufs

ring iobufs = iobufs

Definition at line 93 of file netfront.h.

◆ refs

ring refs = refs

Definition at line 93 of file netfront.h.

Referenced by xengrant_alloc(), and xengrant_free().

◆ ids

ring ids
Initial value:
{
ring->ref_key = ref_key
static const char * ref_key
Definition: netfront.h:91

Definition at line 94 of file netfront.h.

Referenced by xcm_list().