iPXE
Data Structures | Macros | Enumerations | Functions | Variables
igbvf.h File Reference
#include "igbvf_vf.h"

Go to the source code of this file.

Data Structures

struct  igbvf_queue_stats
 
struct  igbvf_buffer
 
struct  igbvf_ring
 
struct  igbvf_adapter
 
struct  igbvf_info
 

Macros

#define _IGBVF_H_
 
#define IGBVF_START_ITR   648 /* ~6000 ints/sec */
 
#define IGBVF_DEFAULT_TXD   256
 
#define IGBVF_MAX_TXD   4096
 
#define IGBVF_MIN_TXD   80
 
#define IGBVF_DEFAULT_RXD   256
 
#define IGBVF_MAX_RXD   4096
 
#define IGBVF_MIN_RXD   80
 
#define IGBVF_MIN_ITR_USECS   10 /* 100000 irq/sec */
 
#define IGBVF_MAX_ITR_USECS   10000 /* 100 irq/sec */
 
#define IGBVF_RX_PTHRESH   16
 
#define IGBVF_RX_HTHRESH   8
 
#define IGBVF_RX_WTHRESH   1
 
#define IGBVF_TX_PTHRESH   8
 
#define IGBVF_TX_HTHRESH   1
 
#define IGBVF_TX_WTHRESH   1
 
#define MAXIMUM_ETHERNET_VLAN_SIZE   1522
 
#define IGBVF_FC_PAUSE_TIME   0x0680 /* 858 usec */
 
#define IGBVF_TX_QUEUE_WAKE   32
 
#define IGBVF_RX_BUFFER_WRITE   16 /* Must be power of 2 */
 
#define AUTO_ALL_MODES   0
 
#define IGBVF_EEPROM_APME   0x0400
 
#define IGBVF_MNG_VLAN_NONE   (-1)
 
#define NUM_TX_DESC   8
 
#define NUM_RX_DESC   8
 
#define IGBVF_FLAG_RX_CSUM_DISABLED   (1 << 0)
 
#define IGBVF_DESC_UNUSED(R)
 
#define IGBVF_RX_DESC_ADV(R, i)   (&(((union e1000_adv_rx_desc *)((R).desc))[i]))
 
#define IGBVF_TX_DESC_ADV(R, i)   (&(((union e1000_adv_tx_desc *)((R).desc))[i]))
 
#define IGBVF_TX_CTXTDESC_ADV(R, i)   (&(((struct e1000_adv_tx_context_desc *)((R).desc))[i]))
 
#define er32(reg)   E1000_READ_REG(hw, E1000_##reg)
 
#define ew32(reg, val)   E1000_WRITE_REG(hw, E1000_##reg, (val))
 
#define e1e_flush()   er32(STATUS)
 

Enumerations

enum  igbvf_boards { board_vf }
 
enum  igbvf_state_t { __IGBVF_TESTING, __IGBVF_RESETTING, __IGBVF_DOWN }
 
enum  latency_range { lowest_latency = 0, low_latency = 1, bulk_latency = 2, latency_invalid = 255 }
 

Functions

 FILE_LICENCE (GPL2_ONLY)
 
void igbvf_check_options (struct igbvf_adapter *adapter)
 
void igbvf_set_ethtool_ops (struct net_device *netdev)
 
int igbvf_up (struct igbvf_adapter *adapter)
 
void igbvf_down (struct igbvf_adapter *adapter)
 
void igbvf_reinit_locked (struct igbvf_adapter *adapter)
 
void igbvf_reset (struct igbvf_adapter *adapter)
 
int igbvf_setup_rx_resources (struct igbvf_adapter *adapter)
 igbvf_setup_rx_resources - allocate Rx resources (Descriptors) More...
 
int igbvf_setup_tx_resources (struct igbvf_adapter *adapter)
 igbvf_setup_tx_resources - allocate Tx resources (Descriptors) More...
 
void igbvf_free_rx_resources (struct igbvf_adapter *adapter)
 igbvf_free_rx_resources - Free Rx Resources @adapter: board private structure More...
 
void igbvf_free_tx_resources (struct igbvf_adapter *adapter)
 igbvf_free_tx_resources - Free Tx Resources per Queue @adapter: board private structure More...
 
void igbvf_update_stats (struct igbvf_adapter *adapter)
 
void igbvf_set_interrupt_capability (struct igbvf_adapter *adapter)
 
void igbvf_reset_interrupt_capability (struct igbvf_adapter *adapter)
 
static u32 __er32 (struct e1000_hw *hw, unsigned long reg)
 
static void __ew32 (struct e1000_hw *hw, unsigned long reg, u32 val)
 

Variables

char igbvf_driver_name []
 
const char igbvf_driver_version []
 
unsigned int copybreak
 

Macro Definition Documentation

◆ _IGBVF_H_

#define _IGBVF_H_

Definition at line 34 of file igbvf.h.

◆ IGBVF_START_ITR

#define IGBVF_START_ITR   648 /* ~6000 ints/sec */

Definition at line 43 of file igbvf.h.

◆ IGBVF_DEFAULT_TXD

#define IGBVF_DEFAULT_TXD   256

Definition at line 46 of file igbvf.h.

◆ IGBVF_MAX_TXD

#define IGBVF_MAX_TXD   4096

Definition at line 47 of file igbvf.h.

◆ IGBVF_MIN_TXD

#define IGBVF_MIN_TXD   80

Definition at line 48 of file igbvf.h.

◆ IGBVF_DEFAULT_RXD

#define IGBVF_DEFAULT_RXD   256

Definition at line 50 of file igbvf.h.

◆ IGBVF_MAX_RXD

#define IGBVF_MAX_RXD   4096

Definition at line 51 of file igbvf.h.

◆ IGBVF_MIN_RXD

#define IGBVF_MIN_RXD   80

Definition at line 52 of file igbvf.h.

◆ IGBVF_MIN_ITR_USECS

#define IGBVF_MIN_ITR_USECS   10 /* 100000 irq/sec */

Definition at line 54 of file igbvf.h.

◆ IGBVF_MAX_ITR_USECS

#define IGBVF_MAX_ITR_USECS   10000 /* 100 irq/sec */

Definition at line 55 of file igbvf.h.

◆ IGBVF_RX_PTHRESH

#define IGBVF_RX_PTHRESH   16

Definition at line 68 of file igbvf.h.

◆ IGBVF_RX_HTHRESH

#define IGBVF_RX_HTHRESH   8

Definition at line 69 of file igbvf.h.

◆ IGBVF_RX_WTHRESH

#define IGBVF_RX_WTHRESH   1

Definition at line 70 of file igbvf.h.

◆ IGBVF_TX_PTHRESH

#define IGBVF_TX_PTHRESH   8

Definition at line 72 of file igbvf.h.

◆ IGBVF_TX_HTHRESH

#define IGBVF_TX_HTHRESH   1

Definition at line 73 of file igbvf.h.

◆ IGBVF_TX_WTHRESH

#define IGBVF_TX_WTHRESH   1

Definition at line 74 of file igbvf.h.

◆ MAXIMUM_ETHERNET_VLAN_SIZE

#define MAXIMUM_ETHERNET_VLAN_SIZE   1522

Definition at line 77 of file igbvf.h.

◆ IGBVF_FC_PAUSE_TIME

#define IGBVF_FC_PAUSE_TIME   0x0680 /* 858 usec */

Definition at line 79 of file igbvf.h.

◆ IGBVF_TX_QUEUE_WAKE

#define IGBVF_TX_QUEUE_WAKE   32

Definition at line 82 of file igbvf.h.

◆ IGBVF_RX_BUFFER_WRITE

#define IGBVF_RX_BUFFER_WRITE   16 /* Must be power of 2 */

Definition at line 84 of file igbvf.h.

◆ AUTO_ALL_MODES

#define AUTO_ALL_MODES   0

Definition at line 86 of file igbvf.h.

◆ IGBVF_EEPROM_APME

#define IGBVF_EEPROM_APME   0x0400

Definition at line 87 of file igbvf.h.

◆ IGBVF_MNG_VLAN_NONE

#define IGBVF_MNG_VLAN_NONE   (-1)

Definition at line 89 of file igbvf.h.

◆ NUM_TX_DESC

#define NUM_TX_DESC   8

Definition at line 280 of file igbvf.h.

◆ NUM_RX_DESC

#define NUM_RX_DESC   8

Definition at line 281 of file igbvf.h.

◆ IGBVF_FLAG_RX_CSUM_DISABLED

#define IGBVF_FLAG_RX_CSUM_DISABLED   (1 << 0)

Definition at line 315 of file igbvf.h.

◆ IGBVF_DESC_UNUSED

#define IGBVF_DESC_UNUSED (   R)
Value:
((((R)->next_to_clean > (R)->next_to_use) ? 0 : (R)->count) + \
(R)->next_to_clean - (R)->next_to_use - 1)

Definition at line 317 of file igbvf.h.

◆ IGBVF_RX_DESC_ADV

#define IGBVF_RX_DESC_ADV (   R,
 
)    (&(((union e1000_adv_rx_desc *)((R).desc))[i]))

Definition at line 321 of file igbvf.h.

◆ IGBVF_TX_DESC_ADV

#define IGBVF_TX_DESC_ADV (   R,
 
)    (&(((union e1000_adv_tx_desc *)((R).desc))[i]))

Definition at line 323 of file igbvf.h.

◆ IGBVF_TX_CTXTDESC_ADV

#define IGBVF_TX_CTXTDESC_ADV (   R,
 
)    (&(((struct e1000_adv_tx_context_desc *)((R).desc))[i]))

Definition at line 325 of file igbvf.h.

◆ er32

#define er32 (   reg)    E1000_READ_REG(hw, E1000_##reg)

Definition at line 373 of file igbvf.h.

◆ ew32

#define ew32 (   reg,
  val 
)    E1000_WRITE_REG(hw, E1000_##reg, (val))

Definition at line 374 of file igbvf.h.

◆ e1e_flush

#define e1e_flush ( )    er32(STATUS)

Definition at line 375 of file igbvf.h.

Enumeration Type Documentation

◆ igbvf_boards

Enumerator
board_vf 

Definition at line 91 of file igbvf.h.

91  {
92  board_vf,
93 };
Definition: igbvf.h:92

◆ igbvf_state_t

Enumerator
__IGBVF_TESTING 
__IGBVF_RESETTING 
__IGBVF_DOWN 

Definition at line 328 of file igbvf.h.

◆ latency_range

Enumerator
lowest_latency 
low_latency 
bulk_latency 
latency_invalid 

Definition at line 334 of file igbvf.h.

334  {
335  lowest_latency = 0,
336  low_latency = 1,
337  bulk_latency = 2,
338  latency_invalid = 255
339 };

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_ONLY  )

◆ igbvf_check_options()

void igbvf_check_options ( struct igbvf_adapter adapter)

◆ igbvf_set_ethtool_ops()

void igbvf_set_ethtool_ops ( struct net_device netdev)

◆ igbvf_up()

int igbvf_up ( struct igbvf_adapter adapter)

◆ igbvf_down()

void igbvf_down ( struct igbvf_adapter adapter)

◆ igbvf_reinit_locked()

void igbvf_reinit_locked ( struct igbvf_adapter adapter)

◆ igbvf_reset()

void igbvf_reset ( struct igbvf_adapter adapter)

Definition at line 426 of file igbvf_main.c.

427 {
428  struct e1000_mac_info *mac = &adapter->hw.mac;
429  struct net_device *netdev = adapter->netdev;
430  struct e1000_hw *hw = &adapter->hw;
431 
432  /* Allow time for pending master requests to run */
433  if ( mac->ops.reset_hw(hw) )
434  DBG ("PF still resetting\n");
435 
436  mac->ops.init_hw ( hw );
437 
438  if ( is_valid_ether_addr(adapter->hw.mac.addr) ) {
439  memcpy ( netdev->hw_addr, adapter->hw.mac.addr, ETH_ALEN );
440  }
441 }
uint8_t mac[ETH_ALEN]
MAC address.
Definition: ena.h:24
Definition: hw.c:16
void * memcpy(void *dest, const void *src, size_t len) __nonnull
struct e1000_mac_info mac
Definition: igbvf_vf.h:317
static struct net_device * netdev
Definition: gdbudp.c:52
struct net_device * netdev
Definition: igbvf.h:268
struct e1000_hw hw
Definition: igbvf.h:273
A network device.
Definition: netdevice.h:352
#define ETH_ALEN
Definition: if_ether.h:8
static int is_valid_ether_addr(const void *addr)
Check if Ethernet address is valid.
Definition: ethernet.h:77
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
uint8_t hw_addr[MAX_HW_ADDR_LEN]
Hardware address.
Definition: netdevice.h:381

References e1000_mac_info::addr, DBG, ETH_ALEN, igbvf_adapter::hw, net_device::hw_addr, is_valid_ether_addr(), mac, e1000_hw::mac, memcpy(), netdev, and igbvf_adapter::netdev.

Referenced by igbvf_close(), igbvf_open(), igbvf_probe(), and igbvf_remove().

◆ igbvf_setup_rx_resources()

int igbvf_setup_rx_resources ( struct igbvf_adapter adapter)

igbvf_setup_rx_resources - allocate Rx resources (Descriptors)

Parameters
adaptere1000 private structure

Definition at line 564 of file igbvf_main.c.

565 {
566  int i;
567  union e1000_adv_rx_desc *rx_curr_desc;
568  struct io_buffer *iob;
569 
570  DBG ( "igbvf_setup_rx_resources\n" );
571 
572  /* Allocate receive descriptor ring memory.
573  It must not cross a 64K boundary because of hardware errata
574  */
575 
576  adapter->rx_base =
577  malloc_phys ( adapter->rx_ring_size, adapter->rx_ring_size );
578 
579  if ( ! adapter->rx_base ) {
580  return -ENOMEM;
581  }
582  memset ( adapter->rx_base, 0, adapter->rx_ring_size );
583 
584  for ( i = 0; i < NUM_RX_DESC; i++ ) {
585  rx_curr_desc = adapter->rx_base + i;
587  adapter->rx_iobuf[i] = iob;
588  rx_curr_desc->wb.upper.status_error = 0;
589  if ( ! iob ) {
590  DBG ( "alloc_iob failed\n" );
591  return -ENOMEM;
592  } else {
593  rx_curr_desc->read.pkt_addr = virt_to_bus ( iob->data );
594  rx_curr_desc->read.hdr_addr = 0;
595  }
596  }
597 
598  return 0;
599 }
static void *__malloc malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
Definition: malloc.h:62
#define MAXIMUM_ETHERNET_VLAN_SIZE
Definition: igbvf.h:77
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
Definition: iobuf.c:129
struct e1000_adv_rx_desc::@53 read
#define NUM_RX_DESC
Definition: igbvf.h:281
struct e1000_adv_rx_desc::@54 wb
#define ENOMEM
Not enough space.
Definition: errno.h:534
uint32_t rx_ring_size
Definition: igbvf.h:290
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
Definition: io.h:183
struct e1000_adv_rx_desc::@54::@56 upper
void * data
Start of data.
Definition: iobuf.h:48
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
union e1000_adv_rx_desc * rx_base
Definition: igbvf.h:287
struct io_buffer * rx_iobuf[NUM_RX_DESC]
Definition: igbvf.h:284
void * memset(void *dest, int character, size_t len) __nonnull
A persistent I/O buffer.
Definition: iobuf.h:33

References alloc_iob(), io_buffer::data, DBG, ENOMEM, e1000_adv_rx_desc::hdr_addr, malloc_phys(), MAXIMUM_ETHERNET_VLAN_SIZE, memset(), NUM_RX_DESC, e1000_adv_rx_desc::pkt_addr, e1000_adv_rx_desc::read, igbvf_adapter::rx_base, igbvf_adapter::rx_iobuf, igbvf_adapter::rx_ring_size, e1000_adv_rx_desc::upper, virt_to_bus(), and e1000_adv_rx_desc::wb.

Referenced by igbvf_open().

◆ igbvf_setup_tx_resources()

int igbvf_setup_tx_resources ( struct igbvf_adapter adapter)

igbvf_setup_tx_resources - allocate Tx resources (Descriptors)

Parameters
adaptere1000 private structure
Return values
rcReturns 0 on success, negative on failure

Definition at line 43 of file igbvf_main.c.

44 {
45  DBG ( "igbvf_setup_tx_resources\n" );
46 
47  /* Allocate transmit descriptor ring memory.
48  It must not cross a 64K boundary because of hardware errata #23
49  so we use malloc_phys() requesting a 128 byte block that is
50  128 byte aligned. This should guarantee that the memory
51  allocated will not cross a 64K boundary, because 128 is an
52  even multiple of 65536 ( 65536 / 128 == 512 ), so all possible
53  allocations of 128 bytes on a 128 byte boundary will not
54  cross 64K bytes.
55  */
56 
57  adapter->tx_base =
58  malloc_phys ( adapter->tx_ring_size, adapter->tx_ring_size );
59 
60  if ( ! adapter->tx_base ) {
61  return -ENOMEM;
62  }
63 
64  memset ( adapter->tx_base, 0, adapter->tx_ring_size );
65 
66  DBG ( "adapter->tx_base = %#08lx\n", virt_to_bus ( adapter->tx_base ) );
67 
68  return 0;
69 }
union e1000_adv_tx_desc * tx_base
Definition: igbvf.h:286
uint32_t tx_ring_size
Definition: igbvf.h:289
static void *__malloc malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
Definition: malloc.h:62
#define ENOMEM
Not enough space.
Definition: errno.h:534
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
Definition: io.h:183
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
void * memset(void *dest, int character, size_t len) __nonnull

References DBG, ENOMEM, malloc_phys(), memset(), igbvf_adapter::tx_base, igbvf_adapter::tx_ring_size, and virt_to_bus().

Referenced by igbvf_open().

◆ igbvf_free_rx_resources()

void igbvf_free_rx_resources ( struct igbvf_adapter adapter)

igbvf_free_rx_resources - Free Rx Resources @adapter: board private structure

Free all receive software resources

Definition at line 90 of file igbvf_main.c.

91 {
92  int i;
93 
94  DBG ( "igbvf_free_rx_resources\n" );
95 
96  free_phys ( adapter->rx_base, adapter->rx_ring_size );
97 
98  for ( i = 0; i < NUM_RX_DESC; i++ ) {
99  free_iob ( adapter->rx_iobuf[i] );
100  }
101 }
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition: iobuf.c:146
#define NUM_RX_DESC
Definition: igbvf.h:281
uint32_t rx_ring_size
Definition: igbvf.h:290
static void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
Definition: malloc.h:77
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
union e1000_adv_rx_desc * rx_base
Definition: igbvf.h:287
struct io_buffer * rx_iobuf[NUM_RX_DESC]
Definition: igbvf.h:284

References DBG, free_iob(), free_phys(), NUM_RX_DESC, igbvf_adapter::rx_base, igbvf_adapter::rx_iobuf, and igbvf_adapter::rx_ring_size.

Referenced by igbvf_close().

◆ igbvf_free_tx_resources()

void igbvf_free_tx_resources ( struct igbvf_adapter adapter)

igbvf_free_tx_resources - Free Tx Resources per Queue @adapter: board private structure

Free all transmit software resources

Definition at line 77 of file igbvf_main.c.

78 {
79  DBG ( "igbvf_free_tx_resources\n" );
80 
81  free_phys ( adapter->tx_base, adapter->tx_ring_size );
82 }
union e1000_adv_tx_desc * tx_base
Definition: igbvf.h:286
uint32_t tx_ring_size
Definition: igbvf.h:289
static void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
Definition: malloc.h:77
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498

References DBG, free_phys(), igbvf_adapter::tx_base, and igbvf_adapter::tx_ring_size.

Referenced by igbvf_close(), and igbvf_open().

◆ igbvf_update_stats()

void igbvf_update_stats ( struct igbvf_adapter adapter)

◆ igbvf_set_interrupt_capability()

void igbvf_set_interrupt_capability ( struct igbvf_adapter adapter)

◆ igbvf_reset_interrupt_capability()

void igbvf_reset_interrupt_capability ( struct igbvf_adapter adapter)

◆ __er32()

static u32 __er32 ( struct e1000_hw hw,
unsigned long  reg 
)
inlinestatic

Definition at line 364 of file igbvf.h.

365 {
366  return readl(hw->hw_addr + reg);
367 }
static unsigned int unsigned int reg
Definition: myson.h:162
uint32_t readl(volatile uint32_t *io_addr)
Read 32-bit dword from memory-mapped device.
Definition: hw.c:16

References readl(), and reg.

◆ __ew32()

static void __ew32 ( struct e1000_hw hw,
unsigned long  reg,
u32  val 
)
inlinestatic

Definition at line 369 of file igbvf.h.

370 {
371  writel(val, hw->hw_addr + reg);
372 }
static unsigned int unsigned int reg
Definition: myson.h:162
Definition: hw.c:16
void writel(uint32_t data, volatile uint32_t *io_addr)
Write 32-bit dword to memory-mapped device.
void __asmcall int val
Definition: setjmp.h:28

References reg, val, and writel().

Variable Documentation

◆ igbvf_driver_name

char igbvf_driver_name[]

◆ igbvf_driver_version

const char igbvf_driver_version[]

◆ copybreak

unsigned int copybreak