Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Variables
net_driver.h File Reference
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/ethtool.h>
#include <linux/if_vlan.h>
#include <linux/timer.h>
#include <linux/mdio.h>
#include <linux/list.h>
#include <linux/pci.h>
#include <linux/device.h>
#include <linux/highmem.h>
#include <linux/workqueue.h>
#include <linux/mutex.h>
#include <linux/vmalloc.h>
#include <linux/i2c.h>
#include "enum.h"
#include "bitfield.h"

Go to the source code of this file.

Data Structures

struct  efx_special_buffer
 
struct  efx_tx_buffer
 
struct  efx_tx_queue
 
struct  efx_rx_buffer
 
struct  efx_rx_page_state
 
struct  efx_rx_queue
 
struct  efx_buffer
 
struct  efx_channel
 
struct  efx_channel_type
 
struct  efx_link_state
 
struct  efx_phy_operations
 
struct  efx_mac_stats
 
union  efx_multicast_hash
 
struct  efx_nic
 
struct  efx_nic_type
 

Macros

#define EFX_DRIVER_VERSION   "3.2"
 
#define EFX_BUG_ON_PARANOID(x)   do {} while (0)
 
#define EFX_WARN_ON_PARANOID(x)   do {} while (0)
 
#define EFX_MAX_CHANNELS   32U
 
#define EFX_MAX_RX_QUEUES   EFX_MAX_CHANNELS
 
#define EFX_EXTRA_CHANNEL_IOV   0
 
#define EFX_EXTRA_CHANNEL_PTP   1
 
#define EFX_MAX_EXTRA_CHANNELS   2U
 
#define EFX_MAX_TX_TC   2
 
#define EFX_MAX_CORE_TX_QUEUES   (EFX_MAX_TX_TC * EFX_MAX_CHANNELS)
 
#define EFX_TXQ_TYPE_OFFLOAD   1 /* flag */
 
#define EFX_TXQ_TYPE_HIGHPRI   2 /* flag */
 
#define EFX_TXQ_TYPES   4
 
#define EFX_MAX_TX_QUEUES   (EFX_TXQ_TYPES * EFX_MAX_CHANNELS)
 
#define EFX_TX_BUF_CONT   1 /* not last descriptor of packet */
 
#define EFX_TX_BUF_SKB   2 /* buffer is last part of skb */
 
#define EFX_TX_BUF_HEAP   4 /* buffer was allocated with kmalloc() */
 
#define EFX_TX_BUF_MAP_SINGLE   8 /* buffer was mapped with dma_map_single() */
 
#define EFX_EMPTY_COUNT_VALID   0x80000000
 
#define EFX_RX_BUF_PAGE   0x0001
 
#define EFX_RX_PKT_CSUMMED   0x0002
 
#define EFX_RX_PKT_DISCARD   0x0004
 
#define STRING_TABLE_LOOKUP(val, member)   ((val) < member ## _max) ? member ## _names[val] : "(invalid)"
 
#define LOOPBACK_MODE(efx)   STRING_TABLE_LOOKUP((efx)->loopback_mode, efx_loopback_mode)
 
#define RESET_TYPE(type)   STRING_TABLE_LOOKUP(type, efx_reset_type)
 
#define EFX_INT_MODE_USE_MSI(x)   (((x)->interrupt_mode) <= EFX_INT_MODE_MSI)
 
#define EFX_PAGE_IP_ALIGN   NET_IP_ALIGN
 
#define EFX_PAGE_SKB_ALIGN   2
 
#define EFX_FC_RX   FLOW_CTRL_RX
 
#define EFX_FC_TX   FLOW_CTRL_TX
 
#define EFX_FC_AUTO   4
 
#define EFX_MCAST_HASH_BITS   8
 
#define EFX_MCAST_HASH_ENTRIES   (1 << EFX_MCAST_HASH_BITS)
 

Enumerations

enum  efx_rx_alloc_method { RX_ALLOC_METHOD_AUTO = 0, RX_ALLOC_METHOD_SKB = 1, RX_ALLOC_METHOD_PAGE = 2 }
 
enum  efx_led_mode { EFX_LED_OFF = 0, EFX_LED_ON = 1, EFX_LED_DEFAULT = 2 }
 
enum  efx_int_mode { EFX_INT_MODE_MSIX = 0, EFX_INT_MODE_MSI = 1, EFX_INT_MODE_LEGACY = 2, EFX_INT_MODE_MAX }
 
enum  nic_state { STATE_UNINIT = 0, STATE_READY = 1, STATE_DISABLED = 2 }
 
enum  efx_phy_mode {
  PHY_MODE_NORMAL = 0, PHY_MODE_TX_DISABLED = 1, PHY_MODE_LOW_POWER = 2, PHY_MODE_OFF = 4,
  PHY_MODE_SPECIAL = 8
}
 

Variables

const char *const efx_loopback_mode_names []
 
const unsigned int efx_loopback_mode_max
 
const char *const efx_reset_type_names []
 
const unsigned int efx_reset_type_max
 

: Device name (net device name or bus id before net device registered)

struct efx_nic - an Efx NIC

: The PCI device : Controller type attributes : IRQ number : Are IRQs enabled on NIC (INT_EN_KER register)? : Workqueue for port reconfigures and the HW monitor. Work items do not hold and must not acquire RTNL. : Name of workqueue : Scheduled reset workitem : Memory BAR value as physical address : Memory BAR value : Interrupt mode : Interrupt timer quantum, in nanoseconds : Adaptive IRQ moderation enabled for RX event queues : IRQ moderation time for RX event queues : Log message enable flags : Device state number (STATE_*). Serialised by the rtnl_lock. : Bitmask for pending resets : TX DMA queues : RX DMA queues : Channels : Names for channels and their IRQs : Types of extra (non-traffic) channels that should be allocated for this NIC : Size of receive queues requested by user. : Size of transmit queues requested by user. : TX queue fill level at or above which we stop it. : TX queue fill level at or below which we wake it. : Base qword address in SRAM of TX queue descriptor caches : Base qword address in SRAM of RX queue descriptor caches : Qword address limit of SRAM : First available buffer table id : Number of channels in use : Number of channels used for RX (= number of RX queues) : Number of channels used for TX : RX buffer length : Order (log2) of number of pages for each RX buffer : Toeplitz hash key for RSS : Indirection table for RSS : Number of internal errors seen recently : Time at which error count will be expired : Interrupt status buffer : Number of legacy IRQs seen with queue flags == 0 : IRQ level/index for IRQs not triggered by an event queue : Work item for asynchronous self-test : List of MTDs attached to the NIC : Hardware dependent state : MAC access lock. Protects , , efx_monitor() and efx_reconfigure_port() : Port enabled indicator. Serialises efx_stop_all(), efx_start_all(), efx_monitor() and efx_mac_work() with kernel interfaces. Safe to read under any one of the rtnl_lock, mac_lock, or netif_tx_lock, but all three must be held to modify it. : Port initialized? : Operating system network device. Consider holding the rtnl lock : DMA buffer for statistics : PHY type : PHY interface : PHY private data (including PHY-specific stats) : PHY MDIO interface : PHY MDIO bus ID (only used by Siena) : PHY operating mode. Serialised by . : Autonegotiation advertising flags : Current state of the link : Number of times the link has changed state : Promiscuous flag. Protected by netif_tx_lock. : Multicast hash table : Wanted flow control flags : When non-zero flow control is disabled. Typically used to ensure that network back pressure doesn't delay dma queue flushes. Serialised by the rtnl lock. : Work item for changing MAC promiscuity and multicast hash : Loopback status : Supported loopback mode bitmask : Offline self-test private state : Count of RX and TX queues that haven't been flushed and drained. : Count of number of receive queues that need to be flushed. Decremented when the efx_flush_rx_queue() is called. : Count of number of RX flushes started but not yet completed (either success or failure). Not used when MCDI is used to flush receive queues. : wait queue used by efx_nic_flush_queues() to wait for flush completions. : Array of &struct efx_vf objects. : Number of VFs intended to be enabled. : Number of VFs that have been fully initialised. : log2 number of vnics per VF. : The zeroth buffer table index used to back VF queues. : Common VFDI status page to be dmad to VF address space. : List of local addresses. Protected by local_lock. : List of DMA addressable pages used to broadcast local_addr_list. Protected by local_lock. : Mutex protecting local_addr_list and local_page_list. : Work item to broadcast peer addresses to VMs. : PTP state data : Hardware monitor workitem : BIU (bus interface unit) lock : Last CPU to handle a possible test interrupt. This field is used by efx_test_interrupts() to verify that an interrupt has occurred. : RX no descriptor drop count : MAC statistics. These include all statistics the MACs can provide. Generic code converts these into a standard &struct net_device_stats. : Statistics update lock. Serialises statistics fetches and access to .

This is stored in the private area of the &struct net_device.

#define efx_for_each_channel(_channel, _efx)
 
#define efx_for_each_channel_rev(_channel, _efx)
 
#define efx_for_each_channel_tx_queue(_tx_queue, _channel)
 
#define efx_for_each_possible_channel_tx_queue(_tx_queue, _channel)
 
#define efx_for_each_channel_rx_queue(_rx_queue, _channel)
 
#define EFX_MAX_FRAME_LEN(mtu)   ((((mtu) + ETH_HLEN + VLAN_HLEN + 4/* FCS */ + 7) & ~7) + 16)
 

Macro Definition Documentation

#define EFX_BUG_ON_PARANOID (   x)    do {} while (0)

Definition at line 46 of file net_driver.h.

#define EFX_DRIVER_VERSION   "3.2"

Definition at line 40 of file net_driver.h.

#define EFX_EMPTY_COUNT_VALID   0x80000000

Definition at line 202 of file net_driver.h.

#define EFX_EXTRA_CHANNEL_IOV   0

Definition at line 58 of file net_driver.h.

#define EFX_EXTRA_CHANNEL_PTP   1

Definition at line 59 of file net_driver.h.

#define EFX_FC_AUTO   4

Definition at line 476 of file net_driver.h.

#define EFX_FC_RX   FLOW_CTRL_RX

Definition at line 474 of file net_driver.h.

#define EFX_FC_TX   FLOW_CTRL_TX

Definition at line 475 of file net_driver.h.

#define efx_for_each_channel (   _channel,
  _efx 
)
Value:
for (_channel = (_efx)->channel[0]; \
_channel; \
_channel = (_channel->channel + 1 < (_efx)->n_channels) ? \
(_efx)->channel[_channel->channel + 1] : NULL)

Definition at line 1003 of file net_driver.h.

#define efx_for_each_channel_rev (   _channel,
  _efx 
)
Value:
for (_channel = (_efx)->channel[(_efx)->n_channels - 1]; \
_channel; \
_channel = _channel->channel ? \
(_efx)->channel[_channel->channel - 1] : NULL)

Definition at line 1010 of file net_driver.h.

#define efx_for_each_channel_rx_queue (   _rx_queue,
  _channel 
)
Value:
if (!efx_channel_has_rx_queue(_channel)) \
; \
for (_rx_queue = &(_channel)->rx_queue; \
_rx_queue; \
_rx_queue = NULL)

Definition at line 1076 of file net_driver.h.

#define efx_for_each_channel_tx_queue (   _tx_queue,
  _channel 
)
Value:
if (!efx_channel_has_tx_queues(_channel)) \
; \
for (_tx_queue = (_channel)->tx_queue; \
_tx_queue < (_channel)->tx_queue + EFX_TXQ_TYPES && \
efx_tx_queue_used(_tx_queue); \
_tx_queue++)

Definition at line 1045 of file net_driver.h.

#define efx_for_each_possible_channel_tx_queue (   _tx_queue,
  _channel 
)
Value:
if (!efx_channel_has_tx_queues(_channel)) \
; \
for (_tx_queue = (_channel)->tx_queue; \
_tx_queue < (_channel)->tx_queue + EFX_TXQ_TYPES; \
_tx_queue++)

Definition at line 1055 of file net_driver.h.

#define EFX_INT_MODE_USE_MSI (   x)    (((x)->interrupt_mode) <= EFX_INT_MODE_MSI)

Definition at line 440 of file net_driver.h.

#define EFX_MAX_CHANNELS   32U

Definition at line 56 of file net_driver.h.

#define EFX_MAX_CORE_TX_QUEUES   (EFX_MAX_TX_TC * EFX_MAX_CHANNELS)

Definition at line 66 of file net_driver.h.

#define EFX_MAX_EXTRA_CHANNELS   2U

Definition at line 60 of file net_driver.h.

#define EFX_MAX_FRAME_LEN (   mtu)    ((((mtu) + ETH_HLEN + VLAN_HLEN + 4/* FCS */ + 7) & ~7) + 16)

EFX_MAX_FRAME_LEN - calculate maximum frame length

This calculates the maximum frame length that will be used for a given MTU. The frame length will be equal to the MTU plus a constant amount of header space and padding. This is the quantity that the net driver will program into the MAC as the maximum frame length.

The 10G MAC requires 8-byte alignment on the frame length, so we round up to the nearest 8.

Re-clocking by the XGXS on RX can reduce an IPG to 32 bits (half an XGMII cycle). If the frame length reaches the maximum value in the same cycle, the XMAC can miss the IPG altogether. We work around this by adding a further 16 bytes.

Definition at line 1122 of file net_driver.h.

#define EFX_MAX_RX_QUEUES   EFX_MAX_CHANNELS

Definition at line 57 of file net_driver.h.

#define EFX_MAX_TX_QUEUES   (EFX_TXQ_TYPES * EFX_MAX_CHANNELS)

Definition at line 70 of file net_driver.h.

#define EFX_MAX_TX_TC   2

Definition at line 65 of file net_driver.h.

#define EFX_MCAST_HASH_BITS   8

Definition at line 632 of file net_driver.h.

#define EFX_MCAST_HASH_ENTRIES   (1 << EFX_MCAST_HASH_BITS)

Definition at line 635 of file net_driver.h.

#define EFX_PAGE_IP_ALIGN   NET_IP_ALIGN

Definition at line 458 of file net_driver.h.

#define EFX_PAGE_SKB_ALIGN   2

Definition at line 468 of file net_driver.h.

#define EFX_RX_BUF_PAGE   0x0001

Definition at line 224 of file net_driver.h.

#define EFX_RX_PKT_CSUMMED   0x0002

Definition at line 225 of file net_driver.h.

#define EFX_RX_PKT_DISCARD   0x0004

Definition at line 226 of file net_driver.h.

#define EFX_TX_BUF_CONT   1 /* not last descriptor of packet */

Definition at line 119 of file net_driver.h.

#define EFX_TX_BUF_HEAP   4 /* buffer was allocated with kmalloc() */

Definition at line 121 of file net_driver.h.

#define EFX_TX_BUF_MAP_SINGLE   8 /* buffer was mapped with dma_map_single() */

Definition at line 122 of file net_driver.h.

#define EFX_TX_BUF_SKB   2 /* buffer is last part of skb */

Definition at line 120 of file net_driver.h.

#define EFX_TXQ_TYPE_HIGHPRI   2 /* flag */

Definition at line 68 of file net_driver.h.

#define EFX_TXQ_TYPE_OFFLOAD   1 /* flag */

Definition at line 67 of file net_driver.h.

#define EFX_TXQ_TYPES   4

Definition at line 69 of file net_driver.h.

#define EFX_WARN_ON_PARANOID (   x)    do {} while (0)

Definition at line 47 of file net_driver.h.

#define LOOPBACK_MODE (   efx)    STRING_TABLE_LOOKUP((efx)->loopback_mode, efx_loopback_mode)

Definition at line 425 of file net_driver.h.

#define RESET_TYPE (   type)    STRING_TABLE_LOOKUP(type, efx_reset_type)

Definition at line 430 of file net_driver.h.

#define STRING_TABLE_LOOKUP (   val,
  member 
)    ((val) < member ## _max) ? member ## _names[val] : "(invalid)"

Definition at line 420 of file net_driver.h.

Enumeration Type Documentation

Enumerator:
EFX_INT_MODE_MSIX 
EFX_INT_MODE_MSI 
EFX_INT_MODE_LEGACY 
EFX_INT_MODE_MAX 

Definition at line 433 of file net_driver.h.

Enumerator:
EFX_LED_OFF 
EFX_LED_ON 
EFX_LED_DEFAULT 

Definition at line 414 of file net_driver.h.

enum efx_phy_mode - PHY operating mode flags : on and should pass traffic : on with TX disabled : set to low power through MDIO : switched off through external control : on but will not pass traffic

Enumerator:
PHY_MODE_NORMAL 
PHY_MODE_TX_DISABLED 
PHY_MODE_LOW_POWER 
PHY_MODE_OFF 
PHY_MODE_SPECIAL 

Definition at line 547 of file net_driver.h.

Enumerator:
RX_ALLOC_METHOD_AUTO 
RX_ALLOC_METHOD_SKB 
RX_ALLOC_METHOD_PAGE 

Definition at line 308 of file net_driver.h.

enum nic_state
Enumerator:
STATE_UNINIT 
STATE_READY 
STATE_DISABLED 

Definition at line 442 of file net_driver.h.

Variable Documentation

const unsigned int efx_loopback_mode_max

Definition at line 41 of file efx.c.

const char* const efx_loopback_mode_names[]

Definition at line 42 of file efx.c.

const unsigned int efx_reset_type_max

Definition at line 72 of file efx.c.

const char* const efx_reset_type_names[]

Definition at line 73 of file efx.c.