Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
cxgb4.h File Reference
#include <linux/bitops.h>
#include <linux/cache.h>
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/netdevice.h>
#include <linux/pci.h>
#include <linux/spinlock.h>
#include <linux/timer.h>
#include <linux/vmalloc.h>
#include <asm/io.h>
#include "cxgb4_uld.h"
#include "t4_hw.h"

Go to the source code of this file.

Data Structures

struct  port_stats
 
struct  lb_port_stats
 
struct  tp_tcp_stats
 
struct  tp_err_stats
 
struct  tp_params
 
struct  vpd_params
 
struct  pci_params
 
struct  adapter_params
 
struct  trace_params
 
struct  link_config
 
struct  port_info
 
struct  sge_fl
 
struct  pkt_gl
 
struct  sge_rspq
 
struct  sge_eth_stats
 
struct  sge_eth_rxq
 
struct  sge_ofld_stats
 
struct  sge_ofld_rxq
 
struct  tx_desc
 
struct  sge_txq
 
struct  sge_eth_txq
 
struct  sge_ofld_txq
 
struct  sge_ctrl_txq
 
struct  sge
 
struct  adapter
 

Macros

#define FW_VERSION_MAJOR   1
 
#define FW_VERSION_MINOR   1
 
#define FW_VERSION_MICRO   0
 
#define CH_WARN(adap, fmt,...)   dev_warn(adap->pdev_dev, fmt, ## __VA_ARGS__)
 
#define FW_LEN16(fw_struct)   FW_CMD_LEN16(sizeof(fw_struct) / 16)
 
#define for_each_ethrxq(sge, i)   for (i = 0; i < (sge)->ethqsets; i++)
 
#define for_each_ofldrxq(sge, i)   for (i = 0; i < (sge)->ofldqsets; i++)
 
#define for_each_rdmarxq(sge, i)   for (i = 0; i < (sge)->rdmaqs; i++)
 
#define for_each_port(adapter, iter)   for (iter = 0; iter < (adapter)->params.nports; ++iter)
 

Typedefs

typedef int(* rspq_handler_t )(struct sge_rspq *q, const __be64 *rsp, const struct pkt_gl *gl)
 

Enumerations

enum  { MAX_NPORTS = 4, SERNUM_LEN = 24, EC_LEN = 16, ID_LEN = 16 }
 
enum  { MEM_EDC0, MEM_EDC1, MEM_MC }
 
enum  {
  MEMWIN0_APERTURE = 2048, MEMWIN0_BASE = 0x1b800, MEMWIN1_APERTURE = 32768, MEMWIN1_BASE = 0x28000,
  MEMWIN2_APERTURE = 65536, MEMWIN2_BASE = 0x30000
}
 
enum  dev_master { MASTER_CANT, MASTER_MAY, MASTER_MUST }
 
enum  dev_state {
  DEV_STATE_UNINIT, DEV_STATE_INIT, DEV_STATE_ERR, STATE_DEEP_SLEEP = 0,
  STATE_SLEEP = 1, STATE_STANDBY = 2, STATE_AWAKE = 3, STATE_RADIO_ON,
  STATE_RADIO_OFF, STATE_RADIO_IRQ_ON, STATE_RADIO_IRQ_OFF, DEV_STATE_NOT_OPER,
  DEV_STATE_SENSE_PGID, DEV_STATE_SENSE_ID, DEV_STATE_OFFLINE, DEV_STATE_VERIFY,
  DEV_STATE_ONLINE, DEV_STATE_W4SENSE, DEV_STATE_DISBAND_PGID, DEV_STATE_BOXED,
  DEV_STATE_TIMEOUT_KILL, DEV_STATE_QUIESCE, DEV_STATE_DISCONNECTED, DEV_STATE_DISCONNECTED_SENSE_ID,
  DEV_STATE_CMFCHANGE, DEV_STATE_CMFUPDATE, DEV_STATE_STEAL_LOCK, NR_DEV_STATES
}
 
enum  { PAUSE_RX = 1 << 0, PAUSE_TX = 1 << 1, PAUSE_AUTONEG = 1 << 2 }
 
enum  { MAX_ETH_QSETS = 32, MAX_OFLD_QSETS = 16, MAX_CTRL_QUEUES = NCHAN, MAX_RDMA_QUEUES = NCHAN }
 
enum  { MAX_EGRQ = 128, MAX_INGQ = 64 }
 
enum  {
  FULL_INIT_DONE = (1 << 0), USING_MSI = (1 << 1), USING_MSIX = (1 << 2), FW_OK = (1 << 4),
  RSS_TNLALLLOOKUP = (1 << 5), USING_SOFT_PARAMS = (1 << 6), MASTER_PF = (1 << 7), FW_OFLD_CONN = (1 << 9)
}
 

Functions

void t4_os_portmod_changed (const struct adapter *adap, int port_id)
 
void t4_os_link_changed (struct adapter *adap, int port_id, int link_stat)
 
voidt4_alloc_mem (size_t size)
 
void t4_free_sge_resources (struct adapter *adap)
 
irq_handler_t t4_intr_handler (struct adapter *adap)
 
netdev_tx_t t4_eth_xmit (struct sk_buff *skb, struct net_device *dev)
 
int t4_ethrx_handler (struct sge_rspq *q, const __be64 *rsp, const struct pkt_gl *gl)
 
int t4_mgmt_tx (struct adapter *adap, struct sk_buff *skb)
 
int t4_ofld_send (struct adapter *adap, struct sk_buff *skb)
 
int t4_sge_alloc_rxq (struct adapter *adap, struct sge_rspq *iq, bool fwevtq, struct net_device *dev, int intr_idx, struct sge_fl *fl, rspq_handler_t hnd)
 
int t4_sge_alloc_eth_txq (struct adapter *adap, struct sge_eth_txq *txq, struct net_device *dev, struct netdev_queue *netdevq, unsigned int iqid)
 
int t4_sge_alloc_ctrl_txq (struct adapter *adap, struct sge_ctrl_txq *txq, struct net_device *dev, unsigned int iqid, unsigned int cmplqid)
 
int t4_sge_alloc_ofld_txq (struct adapter *adap, struct sge_ofld_txq *txq, struct net_device *dev, unsigned int iqid)
 
irqreturn_t t4_sge_intr_msix (int irq, void *cookie)
 
int t4_sge_init (struct adapter *adap)
 
void t4_sge_start (struct adapter *adap)
 
void t4_sge_stop (struct adapter *adap)
 
void t4_set_reg_field (struct adapter *adap, unsigned int addr, u32 mask, u32 val)
 
int t4_wr_mbox_meat (struct adapter *adap, int mbox, const void *cmd, int size, void *rpl, bool sleep_ok)
 
void t4_write_indirect (struct adapter *adap, unsigned int addr_reg, unsigned int data_reg, const u32 *vals, unsigned int nregs, unsigned int start_idx)
 
void t4_intr_enable (struct adapter *adapter)
 
void t4_intr_disable (struct adapter *adapter)
 
int t4_slow_intr_handler (struct adapter *adapter)
 
int t4_wait_dev_ready (struct adapter *adap)
 
int t4_link_start (struct adapter *adap, unsigned int mbox, unsigned int port, struct link_config *lc)
 
int t4_restart_aneg (struct adapter *adap, unsigned int mbox, unsigned int port)
 
int t4_memory_write (struct adapter *adap, int mtype, u32 addr, u32 len, __be32 *buf)
 
int t4_seeprom_wp (struct adapter *adapter, bool enable)
 
int get_vpd_params (struct adapter *adapter, struct vpd_params *p)
 
int t4_load_fw (struct adapter *adapter, const u8 *fw_data, unsigned int size)
 
unsigned int t4_flash_cfg_addr (struct adapter *adapter)
 
int t4_load_cfg (struct adapter *adapter, const u8 *cfg_data, unsigned int size)
 
int t4_check_fw_version (struct adapter *adapter)
 
int t4_prep_adapter (struct adapter *adapter)
 
int t4_port_init (struct adapter *adap, int mbox, int pf, int vf)
 
void t4_fatal_err (struct adapter *adapter)
 
int t4_config_rss_range (struct adapter *adapter, int mbox, unsigned int viid, int start, int n, const u16 *rspq, unsigned int nrspq)
 
int t4_config_glbl_rss (struct adapter *adapter, int mbox, unsigned int mode, unsigned int flags)
 
int t4_mc_read (struct adapter *adap, u32 addr, __be32 *data, u64 *parity)
 
int t4_edc_read (struct adapter *adap, int idx, u32 addr, __be32 *data, u64 *parity)
 
void t4_get_port_stats (struct adapter *adap, int idx, struct port_stats *p)
 
void t4_read_mtu_tbl (struct adapter *adap, u16 *mtus, u8 *mtu_log)
 
void t4_tp_wr_bits_indirect (struct adapter *adap, unsigned int addr, unsigned int mask, unsigned int val)
 
void t4_tp_get_tcp_stats (struct adapter *adap, struct tp_tcp_stats *v4, struct tp_tcp_stats *v6)
 
void t4_load_mtus (struct adapter *adap, const unsigned short *mtus, const unsigned short *alpha, const unsigned short *beta)
 
void t4_wol_magic_enable (struct adapter *adap, unsigned int port, const u8 *addr)
 
int t4_wol_pat_enable (struct adapter *adap, unsigned int port, unsigned int map, u64 mask0, u64 mask1, unsigned int crc, bool enable)
 
int t4_fw_hello (struct adapter *adap, unsigned int mbox, unsigned int evt_mbox, enum dev_master master, enum dev_state *state)
 
int t4_fw_bye (struct adapter *adap, unsigned int mbox)
 
int t4_early_init (struct adapter *adap, unsigned int mbox)
 
int t4_fw_reset (struct adapter *adap, unsigned int mbox, int reset)
 
int t4_fw_halt (struct adapter *adap, unsigned int mbox, int force)
 
int t4_fw_restart (struct adapter *adap, unsigned int mbox, int reset)
 
int t4_fw_upgrade (struct adapter *adap, unsigned int mbox, const u8 *fw_data, unsigned int size, int force)
 
int t4_fw_config_file (struct adapter *adap, unsigned int mbox, unsigned int mtype, unsigned int maddr, u32 *finiver, u32 *finicsum, u32 *cfcsum)
 
int t4_fixup_host_params (struct adapter *adap, unsigned int page_size, unsigned int cache_line_size)
 
int t4_fw_initialize (struct adapter *adap, unsigned int mbox)
 
int t4_query_params (struct adapter *adap, unsigned int mbox, unsigned int pf, unsigned int vf, unsigned int nparams, const u32 *params, u32 *val)
 
int t4_set_params (struct adapter *adap, unsigned int mbox, unsigned int pf, unsigned int vf, unsigned int nparams, const u32 *params, const u32 *val)
 
int t4_cfg_pfvf (struct adapter *adap, unsigned int mbox, unsigned int pf, unsigned int vf, unsigned int txq, unsigned int txq_eth_ctrl, unsigned int rxqi, unsigned int rxq, unsigned int tc, unsigned int vi, unsigned int cmask, unsigned int pmask, unsigned int nexact, unsigned int rcaps, unsigned int wxcaps)
 
int t4_alloc_vi (struct adapter *adap, unsigned int mbox, unsigned int port, unsigned int pf, unsigned int vf, unsigned int nmac, u8 *mac, unsigned int *rss_size)
 
int t4_set_rxmode (struct adapter *adap, unsigned int mbox, unsigned int viid, int mtu, int promisc, int all_multi, int bcast, int vlanex, bool sleep_ok)
 
int t4_alloc_mac_filt (struct adapter *adap, unsigned int mbox, unsigned int viid, bool free, unsigned int naddr, const u8 **addr, u16 *idx, u64 *hash, bool sleep_ok)
 
int t4_change_mac (struct adapter *adap, unsigned int mbox, unsigned int viid, int idx, const u8 *addr, bool persist, bool add_smt)
 
int t4_set_addr_hash (struct adapter *adap, unsigned int mbox, unsigned int viid, bool ucast, u64 vec, bool sleep_ok)
 
int t4_enable_vi (struct adapter *adap, unsigned int mbox, unsigned int viid, bool rx_en, bool tx_en)
 
int t4_identify_port (struct adapter *adap, unsigned int mbox, unsigned int viid, unsigned int nblinks)
 
int t4_mdio_rd (struct adapter *adap, unsigned int mbox, unsigned int phy_addr, unsigned int mmd, unsigned int reg, u16 *valp)
 
int t4_mdio_wr (struct adapter *adap, unsigned int mbox, unsigned int phy_addr, unsigned int mmd, unsigned int reg, u16 val)
 
int t4_iq_free (struct adapter *adap, unsigned int mbox, unsigned int pf, unsigned int vf, unsigned int iqtype, unsigned int iqid, unsigned int fl0id, unsigned int fl1id)
 
int t4_eth_eq_free (struct adapter *adap, unsigned int mbox, unsigned int pf, unsigned int vf, unsigned int eqid)
 
int t4_ctrl_eq_free (struct adapter *adap, unsigned int mbox, unsigned int pf, unsigned int vf, unsigned int eqid)
 
int t4_ofld_eq_free (struct adapter *adap, unsigned int mbox, unsigned int pf, unsigned int vf, unsigned int eqid)
 
int t4_handle_fw_rpl (struct adapter *adap, const __be64 *rpl)
 
void t4_db_full (struct adapter *adapter)
 
void t4_db_dropped (struct adapter *adapter)
 
int t4_mem_win_read_len (struct adapter *adap, u32 addr, __be32 *data, int len)
 
int t4_fwaddrspace_write (struct adapter *adap, unsigned int mbox, u32 addr, u32 val)
 

Variables

struct sge_eth_rxq ____cacheline_aligned_in_smp
 
int dbfifo_int_thresh
 

Macro Definition Documentation

#define CH_WARN (   adap,
  fmt,
  ... 
)    dev_warn(adap->pdev_dev, fmt, ## __VA_ARGS__)

Definition at line 55 of file cxgb4.h.

#define for_each_ethrxq (   sge,
  i 
)    for (i = 0; i < (sge)->ethqsets; i++)

Definition at line 497 of file cxgb4.h.

#define for_each_ofldrxq (   sge,
  i 
)    for (i = 0; i < (sge)->ofldqsets; i++)

Definition at line 498 of file cxgb4.h.

#define for_each_port (   adapter,
  iter 
)    for (iter = 0; iter < (adapter)->params.nports; ++iter)

Definition at line 644 of file cxgb4.h.

#define for_each_rdmarxq (   sge,
  i 
)    for (i = 0; i < (sge)->rdmaqs; i++)

Definition at line 499 of file cxgb4.h.

#define FW_LEN16 (   fw_struct)    FW_CMD_LEN16(sizeof(fw_struct) / 16)

Definition at line 281 of file cxgb4.h.

#define FW_VERSION_MAJOR   1

Definition at line 51 of file cxgb4.h.

#define FW_VERSION_MICRO   0

Definition at line 53 of file cxgb4.h.

#define FW_VERSION_MINOR   1

Definition at line 52 of file cxgb4.h.

Typedef Documentation

typedef int(* rspq_handler_t)(struct sge_rspq *q, const __be64 *rsp, const struct pkt_gl *gl)

Definition at line 356 of file cxgb4.h.

Enumeration Type Documentation

anonymous enum
Enumerator:
MAX_NPORTS 
SERNUM_LEN 
EC_LEN 
ID_LEN 

Definition at line 57 of file cxgb4.h.

anonymous enum
Enumerator:
MEM_EDC0 
MEM_EDC1 
MEM_MC 

Definition at line 64 of file cxgb4.h.

anonymous enum
Enumerator:
MEMWIN0_APERTURE 
MEMWIN0_BASE 
MEMWIN1_APERTURE 
MEMWIN1_BASE 
MEMWIN2_APERTURE 
MEMWIN2_BASE 

Definition at line 70 of file cxgb4.h.

anonymous enum
Enumerator:
PAUSE_RX 
PAUSE_TX 
PAUSE_AUTONEG 

Definition at line 91 of file cxgb4.h.

anonymous enum
Enumerator:
MAX_ETH_QSETS 
MAX_OFLD_QSETS 
MAX_CTRL_QUEUES 
MAX_RDMA_QUEUES 

Definition at line 283 of file cxgb4.h.

anonymous enum
Enumerator:
MAX_EGRQ 
MAX_INGQ 

Definition at line 290 of file cxgb4.h.

anonymous enum
Enumerator:
FULL_INIT_DONE 
USING_MSI 
USING_MSIX 
FW_OK 
RSS_TNLALLLOOKUP 
USING_SOFT_PARAMS 
MASTER_PF 
FW_OFLD_CONN 

Definition at line 319 of file cxgb4.h.

enum dev_master
Enumerator:
MASTER_CANT 
MASTER_MAY 
MASTER_MUST 

Definition at line 79 of file cxgb4.h.

enum dev_state
Enumerator:
DEV_STATE_UNINIT 
DEV_STATE_INIT 
DEV_STATE_ERR 
STATE_DEEP_SLEEP 
STATE_SLEEP 
STATE_STANDBY 
STATE_AWAKE 
STATE_RADIO_ON 
STATE_RADIO_OFF 
STATE_RADIO_IRQ_ON 
STATE_RADIO_IRQ_OFF 
DEV_STATE_NOT_OPER 
DEV_STATE_SENSE_PGID 
DEV_STATE_SENSE_ID 
DEV_STATE_OFFLINE 
DEV_STATE_VERIFY 
DEV_STATE_ONLINE 
DEV_STATE_W4SENSE 
DEV_STATE_DISBAND_PGID 
DEV_STATE_BOXED 
DEV_STATE_TIMEOUT_KILL 
DEV_STATE_QUIESCE 
DEV_STATE_DISCONNECTED 
DEV_STATE_DISCONNECTED_SENSE_ID 
DEV_STATE_CMFCHANGE 
DEV_STATE_CMFUPDATE 
DEV_STATE_STEAL_LOCK 
NR_DEV_STATES 

Definition at line 85 of file cxgb4.h.

Function Documentation

int get_vpd_params ( struct adapter adapter,
struct vpd_params p 
)

get_vpd_params - read VPD parameters from VPD EEPROM : adapter to read : where to store the parameters

Reads card parameters stored in VPD EEPROM.

Definition at line 524 of file t4_hw.c.

int t4_alloc_mac_filt ( struct adapter adap,
unsigned int  mbox,
unsigned int  viid,
bool  free,
unsigned int  naddr,
const u8 **  addr,
u16 idx,
u64 hash,
bool  sleep_ok 
)

t4_alloc_mac_filt - allocates exact-match filters for MAC addresses : the adapter : mailbox to use for the FW command : the VI id : if true any existing filters for this VI id are first removed : the number of MAC addresses to allocate filters for (up to 7) : the MAC address(es) : where to store the index of each allocated filter : pointer to hash address filter bitmap : call is allowed to sleep

Allocates an exact-match filter for each of the supplied addresses and sets it to the corresponding address. If is not NULL it should have at least entries, each of which will be set to the index of the filter allocated for the corresponding MAC address. If a filter could not be allocated for an address its index is set to 0xffff. If is not NULL addresses that fail to allocate an exact filter are hashed and update the hash filter bitmap pointed at by .

Returns a negative error number or the number of filters allocated.

Definition at line 3132 of file t4_hw.c.

void* t4_alloc_mem ( size_t  size)

Definition at line 966 of file cxgb4_main.c.

int t4_alloc_vi ( struct adapter adap,
unsigned int  mbox,
unsigned int  port,
unsigned int  pf,
unsigned int  vf,
unsigned int  nmac,
u8 mac,
unsigned int rss_size 
)

t4_alloc_vi - allocate a virtual interface : the adapter : mailbox to use for the FW command : physical port associated with the VI : the PF owning the VI : the VF owning the VI : number of MAC addresses needed (1 to 5) : the MAC addresses of the VI : size of RSS table slice associated with this VI

Allocates a virtual interface for the given physical port. If is not NULL it contains the MAC addresses of the VI as assigned by FW. should be large enough to hold Ethernet addresses, they are stored consecutively so the space needed is * 6 bytes. Returns a negative error number or the non-negative VI id.

Definition at line 3029 of file t4_hw.c.

int t4_cfg_pfvf ( struct adapter adap,
unsigned int  mbox,
unsigned int  pf,
unsigned int  vf,
unsigned int  txq,
unsigned int  txq_eth_ctrl,
unsigned int  rxqi,
unsigned int  rxq,
unsigned int  tc,
unsigned int  vi,
unsigned int  cmask,
unsigned int  pmask,
unsigned int  nexact,
unsigned int  rcaps,
unsigned int  wxcaps 
)

t4_cfg_pfvf - configure PF/VF resource limits : the adapter : mailbox to use for the FW command : the PF being configured : the VF being configured : the max number of egress queues : the max number of egress Ethernet or control queues : the max number of interrupt-capable ingress queues : the max number of interruptless ingress queues : the PCI traffic class : the max number of virtual interfaces : the channel access rights mask for the PF/VF : the port access rights mask for the PF/VF : the maximum number of exact MPS filters : read capabilities : write/execute capabilities

Configures resource limits and capabilities for a physical or virtual function.

Definition at line 2986 of file t4_hw.c.

int t4_change_mac ( struct adapter adap,
unsigned int  mbox,
unsigned int  viid,
int  idx,
const u8 addr,
bool  persist,
bool  add_smt 
)

t4_change_mac - modifies the exact-match filter for a MAC address : the adapter : mailbox to use for the FW command : the VI id : index of existing filter for old value of MAC address, or -1 : the new MAC address value : whether a new MAC allocation should be persistent : if true also add the address to the HW SMT

Modifies an exact-match filter and sets it to the new MAC address. Note that in general it is not possible to modify the value of a given filter so the generic way to modify an address filter is to free the one being used by the old address value and allocate a new filter for the new address value. can be -1 if the address is a new addition.

Returns a negative error number or the index of the filter with the new MAC value.

Definition at line 3192 of file t4_hw.c.

int t4_check_fw_version ( struct adapter adapter)

t4_check_fw_version - check if the FW is compatible with this driver : the adapter

Checks if an adapter's FW is compatible with the driver. Returns 0 if there's exact match, a negative error if the version could not be read or there's a major version mismatch, and a positive value if the expected major version is found but there's a minor version mismatch.

Definition at line 849 of file t4_hw.c.

int t4_config_glbl_rss ( struct adapter adapter,
int  mbox,
unsigned int  mode,
unsigned int  flags 
)

t4_config_glbl_rss - configure the global RSS mode : the adapter : mbox to use for the FW command : global RSS mode : mode-specific flags

Sets the global RSS mode.

Definition at line 1900 of file t4_hw.c.

int t4_config_rss_range ( struct adapter adapter,
int  mbox,
unsigned int  viid,
int  start,
int  n,
const u16 rspq,
unsigned int  nrspq 
)

t4_config_rss_range - configure a portion of the RSS mapping table : the adapter : mbox to use for the FW command : virtual interface whose RSS subtable is to be written : start entry in the table to write
: how many table entries to write : values for the response queue lookup table : number of values in

Programs the selected part of the VI's RSS mapping table with the provided values. If <
the supplied values are used repeatedly until the full table range is populated.

The caller must ensure the values in are in the range allowed for .

Definition at line 1842 of file t4_hw.c.

int t4_ctrl_eq_free ( struct adapter adap,
unsigned int  mbox,
unsigned int  pf,
unsigned int  vf,
unsigned int  eqid 
)

t4_ctrl_eq_free - free a control egress queue : the adapter : mailbox to use for the FW command : the PF owning the queue : the VF owning the queue : egress queue id

Frees a control egress queue.

Definition at line 3357 of file t4_hw.c.

void t4_db_dropped ( struct adapter adapter)

Definition at line 2744 of file cxgb4_main.c.

void t4_db_full ( struct adapter adapter)

Definition at line 2737 of file cxgb4_main.c.

int t4_early_init ( struct adapter adap,
unsigned int  mbox 
)

t4_init_cmd - ask FW to initialize the device : the adapter : mailbox to use for the FW command

Issues a command to FW to partially initialize the device. This performs initialization that generally doesn't depend on user input.

Definition at line 2535 of file t4_hw.c.

int t4_edc_read ( struct adapter adap,
int  idx,
u32  addr,
__be32 data,
u64 ecc 
)

t4_edc_read - read from EDC through backdoor accesses : the adapter : which EDC to access : address of first byte requested : 64 bytes of data containing the requested address : where to store the corresponding 64-bit ECC word

Read 64 bytes of data from EDC starting at a 64-byte-aligned address that covers the requested address . If is not NULL it is assigned the 64-bit ECC word for the read data.

Definition at line 329 of file t4_hw.c.

int t4_enable_vi ( struct adapter adap,
unsigned int  mbox,
unsigned int  viid,
bool  rx_en,
bool  tx_en 
)

t4_enable_vi - enable/disable a virtual interface : the adapter : mailbox to use for the FW command : the VI id : 1=enable Rx, 0=disable Rx : 1=enable Tx, 0=disable Tx

Enables/disables a virtual interface.

Definition at line 3257 of file t4_hw.c.

int t4_eth_eq_free ( struct adapter adap,
unsigned int  mbox,
unsigned int  pf,
unsigned int  vf,
unsigned int  eqid 
)

t4_eth_eq_free - free an Ethernet egress queue : the adapter : mailbox to use for the FW command : the PF owning the queue : the VF owning the queue : egress queue id

Frees an Ethernet egress queue.

Definition at line 3333 of file t4_hw.c.

netdev_tx_t t4_eth_xmit ( struct sk_buff skb,
struct net_device dev 
)

t4_eth_xmit - add a packet to an Ethernet Tx queue : the packet : the egress net device

Add a packet to an SGE Ethernet Tx queue. Runs with softirqs disabled.

Definition at line 938 of file sge.c.

int t4_ethrx_handler ( struct sge_rspq q,
const __be64 rsp,
const struct pkt_gl si 
)

t4_ethrx_handler - process an ingress ethernet packet : the response queue that received the packet : the response queue descriptor holding the RX_PKT message : the gather list of packet fragments

Process an ingress ethernet packet and deliver it to the stack.

Definition at line 1620 of file sge.c.

void t4_fatal_err ( struct adapter adapter)

Definition at line 3155 of file cxgb4_main.c.

int t4_fixup_host_params ( struct adapter adap,
unsigned int  page_size,
unsigned int  cache_line_size 
)

t4_fixup_host_params - fix up host-dependent parameters : the adapter : the host's Base Page Size : the host's Cache Line Size

Various registers in T4 contain values which are dependent on the host's Base Page and Cache Line Sizes. This function will fix all of those registers with the appropriate values as passed in ...

Definition at line 2814 of file t4_hw.c.

unsigned int t4_flash_cfg_addr ( struct adapter adapter)

t4_flash_cfg_addr - return the address of the flash configuration file : the adapter

Return the address within the flash where the Firmware Configuration File is stored.

Definition at line 919 of file t4_hw.c.

void t4_free_sge_resources ( struct adapter adap)

t4_free_sge_resources - free SGE resources : the adapter

Frees resources used by the SGE queue sets.

Definition at line 2362 of file sge.c.

int t4_fw_bye ( struct adapter adap,
unsigned int  mbox 
)

t4_fw_bye - end communication with FW : the adapter : mailbox to use for the FW command

Issues a command to terminate communication with FW.

Definition at line 2518 of file t4_hw.c.

int t4_fw_config_file ( struct adapter adap,
unsigned int  mbox,
unsigned int  mtype,
unsigned int  maddr,
u32 finiver,
u32 finicsum,
u32 cfcsum 
)

t4_fw_config_file - setup an adapter via a Configuration File : the adapter : mailbox to use for the FW command : the memory type where the Configuration File is located : the memory address where the Configuration File is located : return value for CF [fini] version : return value for CF [fini] checksum : return value for CF computed checksum

Issue a command to get the firmware to process the Configuration File located at the specified mtype/maddress. If the Configuration File is processed successfully and return value pointers are provided, the Configuration File "[fini] section version and checksum values will be returned along with the computed checksum. It's up to the caller to decide how it wants to respond to the checksums not matching but it recommended that a prominant warning be emitted in order to help people rapidly identify changed or corrupted Configuration Files.

Also note that it's possible to modify things like "niccaps", "toecaps",etc. between processing the Configuration File and telling the firmware to use the new configuration. Callers which want to do this will need to "hand-roll" their own CAPS_CONFIGS commands for Configuration Files if they want to do this.

Definition at line 2759 of file t4_hw.c.

int t4_fw_halt ( struct adapter adap,
unsigned int  mbox,
int  force 
)

t4_fw_halt - issue a reset/halt to FW and put uP into RESET : the adapter : mailbox to use for the FW RESET command (if desired) : force uP into RESET even if FW RESET command fails

Issues a RESET command to firmware (if desired) with a HALT indication and then puts the microprocessor into RESET state. The RESET command will only be issued if a legitimate mailbox is provided (mbox <= FW_PCIE_FW_MASTER_MASK).

This is generally used in order for the host to safely manipulate the adapter without fear of conflicting with whatever the firmware might be doing. The only way out of this state is to RESTART the firmware ...

Definition at line 2578 of file t4_hw.c.

int t4_fw_hello ( struct adapter adap,
unsigned int  mbox,
unsigned int  evt_mbox,
enum dev_master  master,
enum dev_state state 
)
t4_fw_hello - establish communication with FW
@adap: the adapter
@mbox: mailbox to use for the FW command
@evt_mbox: mailbox to receive async FW events
@master: specifies the caller's willingness to be the device master

: returns the current device state (if non-NULL)

Issues a command to establish communication with FW. Returns either an error (negative integer) or the mailbox of the Master PF.

Definition at line 2396 of file t4_hw.c.

int t4_fw_initialize ( struct adapter adap,
unsigned int  mbox 
)

t4_fw_initialize - ask FW to initialize the device : the adapter : mailbox to use for the FW command

Issues a command to FW to partially initialize the device. This performs initialization that generally doesn't depend on user input.

Definition at line 2881 of file t4_hw.c.

int t4_fw_reset ( struct adapter adap,
unsigned int  mbox,
int  reset 
)

t4_fw_reset - issue a reset to FW : the adapter : mailbox to use for the FW command : specifies the type of reset to perform

Issues a reset command of the specified type to FW.

Definition at line 2552 of file t4_hw.c.

int t4_fw_restart ( struct adapter adap,
unsigned int  mbox,
int  reset 
)

t4_fw_restart - restart the firmware by taking the uP out of RESET : the adapter : if we want to do a RESET to restart things

Restart firmware previously halted by t4_fw_halt(). On successful return the previous PF Master remains as the new PF Master and there is no need to issue a new HELLO command, etc.

We do this in two ways:

  1. If we're dealing with newer firmware we'll simply want to take the chip's microprocessor out of RESET. This will cause the firmware to start up from its start vector. And then we'll loop until the firmware indicates it's started again (PCIE_FW.HALT reset to 0) or we timeout.
  1. If we're dealing with older firmware then we'll need to RESET the chip since older firmware won't recognize the PCIE_FW.HALT flag and automatically RESET itself on startup.

Definition at line 2643 of file t4_hw.c.

int t4_fw_upgrade ( struct adapter adap,
unsigned int  mbox,
const u8 fw_data,
unsigned int  size,
int  force 
)

t4_fw_upgrade - perform all of the steps necessary to upgrade FW : the adapter : mailbox to use for the FW RESET command (if desired) : the firmware image to write : image size : force upgrade even if firmware doesn't cooperate

Perform all of the steps necessary for upgrading an adapter's firmware image. Normally this requires the cooperation of the existing firmware in order to halt all existing activities but if an invalid mailbox token is passed in we skip that step (though we'll still put the adapter microprocessor into RESET in that case).

On successful return the new firmware will have been loaded and the adapter will have been fully RESET losing all previous setup state. On unsuccessful return the adapter may be completely hosed ... positive errno indicates that the adapter is ~probably~ intact, a negative errno indicates that things are looking bad ...

Definition at line 2706 of file t4_hw.c.

int t4_fwaddrspace_write ( struct adapter adap,
unsigned int  mbox,
u32  addr,
u32  val 
)

Definition at line 2277 of file t4_hw.c.

void t4_get_port_stats ( struct adapter adap,
int  idx,
struct port_stats p 
)

t4_get_port_stats - collect port statistics : the adapter : the port index : the stats structure to fill

Collect statistics related to the given port from HW.

Definition at line 2118 of file t4_hw.c.

int t4_handle_fw_rpl ( struct adapter adap,
const __be64 rpl 
)

t4_handle_fw_rpl - process a FW reply message : the adapter : start of the FW message

Processes a FW message, such as link state change messages.

Definition at line 3402 of file t4_hw.c.

int t4_identify_port ( struct adapter adap,
unsigned int  mbox,
unsigned int  viid,
unsigned int  nblinks 
)

t4_identify_port - identify a VI's port by blinking its LED : the adapter : mailbox to use for the FW command : the VI id : how many times to blink LED at 2.5 Hz

Identifies a VI's port by blinking its LED.

Definition at line 3279 of file t4_hw.c.

void t4_intr_disable ( struct adapter adapter)

t4_intr_disable - disable interrupts : the adapter whose interrupts should be disabled

Disable interrupts. We only disable the top-level interrupt concentrators. The caller must be a PCI function managing global interrupts.

Definition at line 1800 of file t4_hw.c.

void t4_intr_enable ( struct adapter adapter)

t4_intr_enable - enable interrupts : the adapter whose interrupts should be enabled

Enable PF-specific interrupts for the calling function and the top-level interrupt concentrator for global interrupts. Interrupts are already enabled at each module, here we just enable the roots of the interrupt hierarchies.

Note: this function should be called only when the driver manages non PF-specific interrupts from the various HW modules. Only one PCI function at a time should be doing this.

Definition at line 1775 of file t4_hw.c.

irq_handler_t t4_intr_handler ( struct adapter adap)

t4_intr_handler - select the top-level interrupt handler : the adapter

Selects the top-level interrupt handler based on the type of interrupts (MSI-X, MSI, or INTx).

Definition at line 1943 of file sge.c.

int t4_iq_free ( struct adapter adap,
unsigned int  mbox,
unsigned int  pf,
unsigned int  vf,
unsigned int  iqtype,
unsigned int  iqid,
unsigned int  fl0id,
unsigned int  fl1id 
)

t4_iq_free - free an ingress queue and its FLs : the adapter : mailbox to use for the FW command : the PF owning the queues : the VF owning the queues : the ingress queue type : ingress queue id : FL0 queue id or 0xffff if no attached FL0 : FL1 queue id or 0xffff if no attached FL1

Frees an ingress queue and its associated FLs, if any.

Definition at line 3305 of file t4_hw.c.

int t4_link_start ( struct adapter adap,
unsigned int  mbox,
unsigned int  port,
struct link_config lc 
)

t4_link_start - apply link configuration to MAC/PHY : the PHY to setup : the MAC to setup : the requested link configuration

Set up a port's MAC and PHY according to a desired link configuration.

  • If the PHY can auto-negotiate first decide what to advertise, then enable/disable auto-negotiation as desired, and reset.
  • If the PHY does not auto-negotiate just reset it.
  • If auto-negotiation is off set the MAC to the proper speed/duplex/FC, otherwise do it later based on the outcome of auto-negotiation.

Definition at line 1083 of file t4_hw.c.

int t4_load_cfg ( struct adapter adap,
const u8 cfg_data,
unsigned int  size 
)

t4_load_cfg - download config file : the adapter : the cfg text file to write : text file size

Write the supplied config text file to the card's serial flash.

Definition at line 935 of file t4_hw.c.

int t4_load_fw ( struct adapter adap,
const u8 fw_data,
unsigned int  size 
)

t4_load_fw - download firmware : the adapter : the firmware image to write : image size

Write the supplied firmware image to the card's serial flash.

Definition at line 991 of file t4_hw.c.

void t4_load_mtus ( struct adapter adap,
const unsigned short mtus,
const unsigned short alpha,
const unsigned short beta 
)

t4_load_mtus - write the MTU and congestion control HW tables : the adapter : the values for the MTU table : the values for the congestion control alpha parameter : the values for the congestion control beta parameter

Write the HW MTU table with the supplied MTUs and the high-speed congestion control table with the supplied alpha, beta, and MTUs. We write the two tables together because the additive increments depend on the MTUs.

Definition at line 2058 of file t4_hw.c.

int t4_mc_read ( struct adapter adap,
u32  addr,
__be32 data,
u64 ecc 
)

t4_mc_read - read from MC through backdoor accesses : the adapter : address of first byte requested : 64 bytes of data containing the requested address : where to store the corresponding 64-bit ECC word

Read 64 bytes of data from MC starting at a 64-byte-aligned address that covers the requested address . If is not NULL it is assigned the 64-bit ECC word for the read data.

Definition at line 292 of file t4_hw.c.

int t4_mdio_rd ( struct adapter adap,
unsigned int  mbox,
unsigned int  phy_addr,
unsigned int  mmd,
unsigned int  reg,
u16 valp 
)

t4_mdio_rd - read a PHY register through MDIO : the adapter : mailbox to use for the FW command : the PHY address : the PHY MMD to access (0 for clause 22 PHYs) : the register to read : where to store the value

Issues a FW command through the given mailbox to read a PHY register.

Definition at line 2337 of file t4_hw.c.

int t4_mdio_wr ( struct adapter adap,
unsigned int  mbox,
unsigned int  phy_addr,
unsigned int  mmd,
unsigned int  reg,
u16  val 
)

t4_mdio_wr - write a PHY register through MDIO : the adapter : mailbox to use for the FW command : the PHY address : the PHY MMD to access (0 for clause 22 PHYs) : the register to write : value to write

Issues a FW command through the given mailbox to write a PHY register.

Definition at line 2368 of file t4_hw.c.

int t4_mem_win_read_len ( struct adapter adap,
u32  addr,
__be32 data,
int  len 
)

t4_mem_win_read_len - read memory through PCIE memory window : the adapter : address of first byte requested aligned on 32b. : len bytes to hold the data read : amount of data to read from window. Must be <= MEMWIN0_APERATURE after adjusting for 16B alignment requirements of the the memory window.

Read len bytes of data from MC starting at .

Definition at line 2304 of file t4_hw.c.

int t4_memory_write ( struct adapter adap,
int  mtype,
u32  addr,
u32  len,
__be32 buf 
)

Definition at line 493 of file t4_hw.c.

int t4_mgmt_tx ( struct adapter adap,
struct sk_buff skb 
)

t4_mgmt_tx - send a management message : the adapter : the packet containing the management message

Send a management message through control queue 0.

Definition at line 1224 of file sge.c.

int t4_ofld_eq_free ( struct adapter adap,
unsigned int  mbox,
unsigned int  pf,
unsigned int  vf,
unsigned int  eqid 
)

t4_ofld_eq_free - free an offload egress queue : the adapter : mailbox to use for the FW command : the PF owning the queue : the VF owning the queue : egress queue id

Frees a control egress queue.

Definition at line 3381 of file t4_hw.c.

int t4_ofld_send ( struct adapter adap,
struct sk_buff skb 
)

t4_ofld_send - send an offload packet : the adapter : the packet

Sends an offload packet. We use the packet queue_mapping to select the appropriate Tx queue as follows: bit 0 indicates whether the packet should be sent as regular or control, bits 1-15 select the queue.

Definition at line 1450 of file sge.c.

void t4_os_link_changed ( struct adapter adap,
int  port_id,
int  link_stat 
)

Definition at line 362 of file cxgb4_main.c.

void t4_os_portmod_changed ( const struct adapter adap,
int  port_id 
)

Definition at line 377 of file cxgb4_main.c.

int t4_port_init ( struct adapter adap,
int  mbox,
int  pf,
int  vf 
)

Definition at line 3552 of file t4_hw.c.

int t4_prep_adapter ( struct adapter adapter)

t4_prep_adapter - prepare SW and HW for operation : the adapter : if true perform a HW reset

Initialize adapter SW state for the various HW modules, set initial values for some adapter tunables, take PHYs out of reset, and initialize the MDIO interface.

Definition at line 3524 of file t4_hw.c.

int t4_query_params ( struct adapter adap,
unsigned int  mbox,
unsigned int  pf,
unsigned int  vf,
unsigned int  nparams,
const u32 params,
u32 val 
)

t4_query_params - query FW or device parameters : the adapter : mailbox to use for the FW command : the PF : the VF : the number of parameters : the parameter names : the parameter values

Reads the value of FW or device parameters. Up to 7 parameters can be queried at once.

Definition at line 2903 of file t4_hw.c.

void t4_read_mtu_tbl ( struct adapter adap,
u16 mtus,
u8 mtu_log 
)

t4_read_mtu_tbl - returns the values in the HW path MTU table : the adapter : where to store the MTU values : where to store the MTU base-2 log (may be NULL)

Reads the HW path MTU table.

Definition at line 1967 of file t4_hw.c.

int t4_restart_aneg ( struct adapter adap,
unsigned int  mbox,
unsigned int  port 
)

t4_restart_aneg - restart autonegotiation : the adapter : mbox to use for the FW command : the port id

Restarts autonegotiation for the selected port.

Definition at line 1121 of file t4_hw.c.

int t4_seeprom_wp ( struct adapter adapter,
bool  enable 
)

t4_seeprom_wp - enable/disable EEPROM write protection : the adapter : whether to enable or disable write protection

Enables or disables write protection on the serial EEPROM.

Definition at line 510 of file t4_hw.c.

int t4_set_addr_hash ( struct adapter adap,
unsigned int  mbox,
unsigned int  viid,
bool  ucast,
u64  vec,
bool  sleep_ok 
)

t4_set_addr_hash - program the MAC inexact-match hash filter : the adapter : mailbox to use for the FW command : the VI id : whether the hash filter should also match unicast addresses : the value to be written to the hash filter : call is allowed to sleep

Sets the 64-bit inexact-match hash filter for a virtual interface.

Definition at line 3232 of file t4_hw.c.

int t4_set_params ( struct adapter adap,
unsigned int  mbox,
unsigned int  pf,
unsigned int  vf,
unsigned int  nparams,
const u32 params,
const u32 val 
)

t4_set_params - sets FW or device parameters : the adapter : mailbox to use for the FW command : the PF : the VF : the number of parameters : the parameter names : the parameter values

Sets the value of FW or device parameters. Up to 7 parameters can be specified at once.

Definition at line 2942 of file t4_hw.c.

void t4_set_reg_field ( struct adapter adapter,
unsigned int  addr,
u32  mask,
u32  val 
)

t4_set_reg_field - set a register field to a value : the adapter to program : the register address : specifies the portion of the register to modify : the new value for the register field

Sets a register field specified by the supplied mask to the given value.

Definition at line 91 of file t4_hw.c.

int t4_set_rxmode ( struct adapter adap,
unsigned int  mbox,
unsigned int  viid,
int  mtu,
int  promisc,
int  all_multi,
int  bcast,
int  vlanex,
bool  sleep_ok 
)

t4_set_rxmode - set Rx properties of a virtual interface : the adapter : mailbox to use for the FW command : the VI id : the new MTU or -1 : 1 to enable promiscuous mode, 0 to disable it, -1 no change : 1 to enable all-multi mode, 0 to disable it, -1 no change : 1 to enable broadcast Rx, 0 to disable it, -1 no change : 1 to enable HW VLAN extraction, 0 to disable it, -1 no change : if true we may sleep while awaiting command completion

Sets Rx properties of a virtual interface.

Definition at line 3080 of file t4_hw.c.

int t4_sge_alloc_ctrl_txq ( struct adapter adap,
struct sge_ctrl_txq txq,
struct net_device dev,
unsigned int  iqid,
unsigned int  cmplqid 
)

Definition at line 2209 of file sge.c.

int t4_sge_alloc_eth_txq ( struct adapter adap,
struct sge_eth_txq txq,
struct net_device dev,
struct netdev_queue netdevq,
unsigned int  iqid 
)

Definition at line 2155 of file sge.c.

int t4_sge_alloc_ofld_txq ( struct adapter adap,
struct sge_ofld_txq txq,
struct net_device dev,
unsigned int  iqid 
)

Definition at line 2262 of file sge.c.

int t4_sge_alloc_rxq ( struct adapter adap,
struct sge_rspq iq,
bool  fwevtq,
struct net_device dev,
int  intr_idx,
struct sge_fl fl,
rspq_handler_t  hnd 
)

Definition at line 2041 of file sge.c.

int t4_sge_init ( struct adapter adap)

Definition at line 2634 of file sge.c.

irqreturn_t t4_sge_intr_msix ( int  irq,
void cookie 
)

Definition at line 1867 of file sge.c.

void t4_sge_start ( struct adapter adap)

Definition at line 2430 of file sge.c.

void t4_sge_stop ( struct adapter adap)

t4_sge_stop - disable SGE operation : the adapter

Stop tasklets and timers associated with the DMA engine. Note that this is effective only if measures have been taken to disable any HW events that may restart them.

Definition at line 2445 of file sge.c.

int t4_slow_intr_handler ( struct adapter adapter)

t4_slow_intr_handler - control path interrupt handler : the adapter

T4 interrupt handler for non-data global interrupt events, e.g., errors. The designation 'slow' is because it involves register reads, while data interrupts typically don't involve any MMIOs.

Definition at line 1705 of file t4_hw.c.

void t4_tp_get_tcp_stats ( struct adapter adap,
struct tp_tcp_stats v4,
struct tp_tcp_stats v6 
)

t4_tp_get_tcp_stats - read TP's TCP MIB counters : the adapter : holds the TCP/IP counter values : holds the TCP/IPv6 counter values

Returns the values of TP's TCP/IP and TCP/IPv6 MIB counters. Either or may be NULL to skip the corresponding stats.

Definition at line 1929 of file t4_hw.c.

void t4_tp_wr_bits_indirect ( struct adapter adap,
unsigned int  addr,
unsigned int  mask,
unsigned int  val 
)

t4_tp_wr_bits_indirect - set/clear bits in an indirect TP register : the adapter : the indirect TP register address : specifies the field within the register to modify : new value for the field

Sets a field of an indirect TP register to the given value.

Definition at line 1991 of file t4_hw.c.

int t4_wait_dev_ready ( struct adapter adap)

Definition at line 3480 of file t4_hw.c.

void t4_wol_magic_enable ( struct adapter adap,
unsigned int  port,
const u8 addr 
)

t4_wol_magic_enable - enable/disable magic packet WoL : the adapter : the physical port index : MAC address expected in magic packets, NULL to disable

Enables/disables magic packet wake-on-LAN for the selected port.

Definition at line 2199 of file t4_hw.c.

int t4_wol_pat_enable ( struct adapter adap,
unsigned int  port,
unsigned int  map,
u64  mask0,
u64  mask1,
unsigned int  crc,
bool  enable 
)

t4_wol_pat_enable - enable/disable pattern-based WoL : the adapter : the physical port index : bitmap of which HW pattern filters to set : byte mask for bytes 0-63 of a packet : byte mask for bytes 64-127 of a packet : Ethernet CRC for selected bytes : enable/disable switch

Sets the pattern filters indicated in to mask out the bytes specified in / in received packets and compare the CRC of the resulting packet against . If is true pattern-based WoL is enabled, otherwise disabled.

Definition at line 2228 of file t4_hw.c.

int t4_wr_mbox_meat ( struct adapter adap,
int  mbox,
const void cmd,
int  size,
void rpl,
bool  sleep_ok 
)

t4_wr_mbox_meat - send a command to FW through the given mailbox : the adapter : index of the mailbox to use : the command to write : command length in bytes : where to optionally store the reply : if true we may sleep while awaiting command completion

Sends the given command to FW through the selected mailbox and waits for the FW to execute the command. If is not NULL it is used to store the FW's reply to the command. The command and its optional reply are of the same length. FW can take up to FW_CMD_MAX_TIMEOUT ms to respond. determines whether we may sleep while awaiting the response. If sleeping is allowed we use progressive backoff otherwise we spin.

The return value is 0 on success or a negative errno on failure. A failure can happen either because we are not able to execute the command or FW executes it but signals an error. In the latter case the return value is the error code indicated by FW (negated).

Definition at line 205 of file t4_hw.c.

void t4_write_indirect ( struct adapter adap,
unsigned int  addr_reg,
unsigned int  data_reg,
const u32 vals,
unsigned int  nregs,
unsigned int  start_idx 
)

t4_write_indirect - write indirectly addressed registers : the adapter : register holding the indirect addresses : register holding the value for the indirect registers : values to write : how many indirect registers to write : address of first indirect register to write

Writes a sequential block of registers that are accessed indirectly through an address/data register pair.

Definition at line 135 of file t4_hw.c.

Variable Documentation

struct sge_ctrl_txq ____cacheline_aligned_in_smp
int dbfifo_int_thresh

Definition at line 442 of file cxgb4_main.c.