iPXE
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)
#define IGBVF_TX_DESC_ADV(R, i)
#define IGBVF_TX_CTXTDESC_ADV(R, i)
#define er32(reg)
#define ew32(reg, val)
#define e1e_flush()

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)
int igbvf_setup_tx_resources (struct igbvf_adapter *adapter)
 igbvf_setup_tx_resources - allocate Tx resources (Descriptors)
void igbvf_free_rx_resources (struct igbvf_adapter *adapter)
 igbvf_free_rx_resources - Free Rx Resources @adapter: board private structure
void igbvf_free_tx_resources (struct igbvf_adapter *adapter)
 igbvf_free_tx_resources - Free Tx Resources per Queue @adapter: board private structure
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.

Referenced by igbvf_configure_rx().

◆ IGBVF_RX_HTHRESH

#define IGBVF_RX_HTHRESH   8

Definition at line 69 of file igbvf.h.

Referenced by igbvf_configure_rx().

◆ IGBVF_RX_WTHRESH

#define IGBVF_RX_WTHRESH   1

Definition at line 70 of file igbvf.h.

Referenced by igbvf_configure_rx().

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

Referenced by igbvf_refill_rx_ring(), igbvf_setup_rx_resources(), and igbvf_sw_init().

◆ 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

◆ NUM_RX_DESC

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

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

◆ IGBVF_RX_DESC_ADV

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

Definition at line 321 of file igbvf.h.

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

◆ IGBVF_TX_DESC_ADV

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

Definition at line 323 of file igbvf.h.

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

◆ IGBVF_TX_CTXTDESC_ADV

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

Definition at line 325 of file igbvf.h.

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

◆ er32

#define er32 ( reg)
Value:
#define E1000_READ_REG(a, reg)
Definition igbvf_osdep.h:76
static unsigned int unsigned int reg
Definition myson.h:162
Definition hw.c:16

Definition at line 373 of file igbvf.h.

Referenced by igbvf_close(), igbvf_config_collision_dist(), igbvf_configure_rx(), igbvf_configure_tx(), igbvf_get_hw_control(), and igbvf_process_rx_packets().

◆ ew32

#define ew32 ( reg,
val )

◆ e1e_flush

#define e1e_flush ( )
Value:
er32(STATUS)
#define er32(reg)
Definition igbvf.h:373

Definition at line 375 of file igbvf.h.

Referenced by igbvf_config_collision_dist(), igbvf_configure_tx(), and igbvf_transmit().

Enumeration Type Documentation

◆ igbvf_boards

Enumerator
board_vf 

Definition at line 91 of file igbvf.h.

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

◆ igbvf_state_t

Enumerator
__IGBVF_TESTING 
__IGBVF_RESETTING 
__IGBVF_DOWN 

Definition at line 328 of file igbvf.h.

328 {
332};
@ __IGBVF_DOWN
Definition igbvf.h:331
@ __IGBVF_TESTING
Definition igbvf.h:329
@ __IGBVF_RESETTING
Definition igbvf.h:330

◆ 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};
@ latency_invalid
Definition igbvf.h:338
@ bulk_latency
Definition igbvf.h:337
@ low_latency
Definition igbvf.h:336
@ lowest_latency
Definition igbvf.h:335

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_ONLY )

◆ igbvf_check_options()

void igbvf_check_options ( struct igbvf_adapter * adapter)
extern

◆ igbvf_set_ethtool_ops()

void igbvf_set_ethtool_ops ( struct net_device * netdev)
extern

References netdev.

◆ igbvf_up()

int igbvf_up ( struct igbvf_adapter * adapter)
extern

◆ igbvf_down()

void igbvf_down ( struct igbvf_adapter * adapter)
extern

◆ igbvf_reinit_locked()

void igbvf_reinit_locked ( struct igbvf_adapter * adapter)
extern

◆ igbvf_reset()

void igbvf_reset ( struct igbvf_adapter * adapter)
extern

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:13
static int is_valid_ether_addr(const void *addr)
Check if Ethernet address is valid.
Definition ethernet.h:78
static struct net_device * netdev
Definition gdbudp.c:53
#define DBG(...)
Print a debugging message.
Definition compiler.h:498
#define ETH_ALEN
Definition if_ether.h:9
void * memcpy(void *dest, const void *src, size_t len) __nonnull
struct e1000_mac_info mac
Definition igbvf_vf.h:317
struct net_device * netdev
Definition igbvf.h:268
struct e1000_hw hw
Definition igbvf.h:273
A network device.
Definition netdevice.h:353

References e1000_mac_info::addr, DBG, ETH_ALEN, igbvf_adapter::hw, is_valid_ether_addr(), e1000_hw::mac, mac, memcpy(), igbvf_adapter::netdev, and 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)
extern

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}
#define ENOMEM
Not enough space.
Definition errno.h:535
#define MAXIMUM_ETHERNET_VLAN_SIZE
Definition igbvf.h:77
#define NUM_RX_DESC
Definition igbvf.h:281
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
Definition io.h:184
void * memset(void *dest, int character, size_t len) __nonnull
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
Definition iobuf.c:131
void * malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
Definition malloc.c:707
union e1000_adv_rx_desc * rx_base
Definition igbvf.h:287
uint32_t rx_ring_size
Definition igbvf.h:290
struct io_buffer * rx_iobuf[NUM_RX_DESC]
Definition igbvf.h:284
A persistent I/O buffer.
Definition iobuf.h:38
void * data
Start of data.
Definition iobuf.h:53
struct e1000_adv_rx_desc::@302144110352222217365215063167103107375312305323 read
struct e1000_adv_rx_desc::@324104077243240211364137173065054016027147265141::@071135136066236263262155133326122220255171234376 upper
struct e1000_adv_rx_desc::@324104077243240211364137173065054016027147265141 wb

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::status_error, 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)
extern

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

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)
extern

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:153
void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
Definition malloc.c:723

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)
extern

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}

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)
extern

◆ igbvf_set_interrupt_capability()

void igbvf_set_interrupt_capability ( struct igbvf_adapter * adapter)
extern

◆ igbvf_reset_interrupt_capability()

void igbvf_reset_interrupt_capability ( struct igbvf_adapter * adapter)
extern

References copybreak.

◆ __er32()

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}
#define readl
Definition w89c840.c:157

References readl, reg, and u32.

◆ __ew32()

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}
#define writel
Definition w89c840.c:160

References reg, u32, val, and writel.

Variable Documentation

◆ igbvf_driver_name

char igbvf_driver_name[]
extern

◆ igbvf_driver_version

const char igbvf_driver_version[]
extern

◆ copybreak

unsigned int copybreak
extern