Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
cxgb4_main.c File Reference
#include <linux/bitmap.h>
#include <linux/crc32.h>
#include <linux/ctype.h>
#include <linux/debugfs.h>
#include <linux/err.h>
#include <linux/etherdevice.h>
#include <linux/firmware.h>
#include <linux/if.h>
#include <linux/if_vlan.h>
#include <linux/init.h>
#include <linux/log2.h>
#include <linux/mdio.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/mutex.h>
#include <linux/netdevice.h>
#include <linux/pci.h>
#include <linux/aer.h>
#include <linux/rtnetlink.h>
#include <linux/sched.h>
#include <linux/seq_file.h>
#include <linux/sockios.h>
#include <linux/vmalloc.h>
#include <linux/workqueue.h>
#include <net/neighbour.h>
#include <net/netevent.h>
#include <asm/uaccess.h>
#include "cxgb4.h"
#include "t4_regs.h"
#include "t4_msg.h"
#include "t4fw_api.h"
#include "l2t.h"

Go to the source code of this file.

Data Structures

struct  queue_port_stats
 

Macros

#define pr_fmt(fmt)   KBUILD_MODNAME ": " fmt
 
#define DRV_VERSION   "1.3.0-ko"
 
#define DRV_DESC   "Chelsio T4 Network Driver"
 
#define MAX_SGE_TIMERVAL   200U
 
#define DFLT_MSG_ENABLE
 
#define CH_DEVICE(devid, data)   { PCI_VDEVICE(CHELSIO, devid), (data) }
 
#define FW_FNAME   "cxgb4/t4fw.bin"
 
#define FW_CFNAME   "cxgb4/t4-config.txt"
 
#define T4_REGMAP_SIZE   (160 * 1024)
 
#define EEPROM_MAGIC   0x38E2F10C
 
#define WOL_SUPPORTED   (WAKE_BCAST | WAKE_MAGIC)
 
#define BCAST_CRC   0xa0ccc1a6
 
#define MAX_ATIDS   8192U
 
#define FW_PARAM_DEV(param)
 
#define FW_PARAM_PFVF(param)
 
#define EXTRA_VECS   2
 
#define TSO_FLAGS   (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN)
 
#define VLAN_FEAT
 

Enumerations

enum  {
  PFRES_NVI = 4, PFRES_NETHCTRL = 128, PFRES_NIQFLINT = 128, PFRES_NEQ = 256,
  PFRES_NIQ = 0, PFRES_TC = 0, PFRES_NEXACTF = 128, PFRES_R_CAPS = FW_CMD_CAP_PF,
  PFRES_WX_CAPS = FW_CMD_CAP_PF
}
 
enum  {
  MAX_TXQ_ENTRIES = 16384, MAX_CTRL_TXQ_ENTRIES = 1024, MAX_RSPQ_ENTRIES = 16384, MAX_RX_BUFFERS = 16384,
  MIN_TXQ_ENTRIES = 32, MIN_CTRL_TXQ_ENTRIES = 32, MIN_RSPQ_ENTRIES = 128, MIN_FL_ENTRIES = 16
}
 
enum  { TP_VLAN_PRI_MAP_DEFAULT = HW_TPL_FR_MT_PR_IV_P_FC, TP_VLAN_PRI_MAP_FIRST = FCOE_SHIFT, TP_VLAN_PRI_MAP_LAST = FRAGMENTATION_SHIFT }
 

Functions

 MODULE_DESCRIPTION (DRV_DESC)
 
 MODULE_AUTHOR ("Chelsio Communications")
 
 MODULE_LICENSE ("Dual BSD/GPL")
 
 MODULE_VERSION (DRV_VERSION)
 
 MODULE_DEVICE_TABLE (pci, cxgb4_pci_tbl)
 
 MODULE_FIRMWARE (FW_FNAME)
 
 module_param (force_init, uint, 0644)
 
 MODULE_PARM_DESC (force_init,"Forcibly become Master PF and initialize adapter")
 
 module_param (force_old_init, uint, 0644)
 
 MODULE_PARM_DESC (force_old_init,"Force old initialization sequence")
 
 module_param (dflt_msg_enable, int, 0644)
 
 MODULE_PARM_DESC (dflt_msg_enable,"Chelsio T4 default message enable bitmap")
 
 module_param (msi, int, 0644)
 
 MODULE_PARM_DESC (msi,"whether to use INTx (0), MSI (1) or MSI-X (2)")
 
 module_param_array (intr_holdoff, uint, NULL, 0644)
 
 MODULE_PARM_DESC (intr_holdoff,"values for queue interrupt hold-off timers ""0..4 in microseconds")
 
 module_param_array (intr_cnt, uint, NULL, 0644)
 
 MODULE_PARM_DESC (intr_cnt,"thresholds 1..3 for queue interrupt packet counters")
 
void t4_os_link_changed (struct adapter *adapter, int port_id, int link_stat)
 
void t4_os_portmod_changed (const struct adapter *adap, int port_id)
 
 module_param (dbfifo_int_thresh, int, 0644)
 
 MODULE_PARM_DESC (dbfifo_int_thresh,"doorbell fifo interrupt threshold")
 
 module_param (dbfifo_drain_delay, int, 0644)
 
 MODULE_PARM_DESC (dbfifo_drain_delay,"usecs to sleep while draining the dbfifo")
 
voidt4_alloc_mem (size_t size)
 
int cxgb4_alloc_atid (struct tid_info *t, void *data)
 
 EXPORT_SYMBOL (cxgb4_alloc_atid)
 
void cxgb4_free_atid (struct tid_info *t, unsigned int atid)
 
 EXPORT_SYMBOL (cxgb4_free_atid)
 
int cxgb4_alloc_stid (struct tid_info *t, int family, void *data)
 
 EXPORT_SYMBOL (cxgb4_alloc_stid)
 
void cxgb4_free_stid (struct tid_info *t, unsigned int stid, int family)
 
 EXPORT_SYMBOL (cxgb4_free_stid)
 
void cxgb4_remove_tid (struct tid_info *t, unsigned int chan, unsigned int tid)
 
 EXPORT_SYMBOL (cxgb4_remove_tid)
 
int cxgb4_create_server (const struct net_device *dev, unsigned int stid, __be32 sip, __be16 sport, unsigned int queue)
 
 EXPORT_SYMBOL (cxgb4_create_server)
 
unsigned int cxgb4_best_mtu (const unsigned short *mtus, unsigned short mtu, unsigned int *idx)
 
 EXPORT_SYMBOL (cxgb4_best_mtu)
 
unsigned int cxgb4_port_chan (const struct net_device *dev)
 
 EXPORT_SYMBOL (cxgb4_port_chan)
 
unsigned int cxgb4_dbfifo_count (const struct net_device *dev, int lpfifo)
 
 EXPORT_SYMBOL (cxgb4_dbfifo_count)
 
unsigned int cxgb4_port_viid (const struct net_device *dev)
 
 EXPORT_SYMBOL (cxgb4_port_viid)
 
unsigned int cxgb4_port_idx (const struct net_device *dev)
 
 EXPORT_SYMBOL (cxgb4_port_idx)
 
void cxgb4_get_tcp_stats (struct pci_dev *pdev, struct tp_tcp_stats *v4, struct tp_tcp_stats *v6)
 
 EXPORT_SYMBOL (cxgb4_get_tcp_stats)
 
void cxgb4_iscsi_init (struct net_device *dev, unsigned int tag_mask, const unsigned int *pgsz_order)
 
 EXPORT_SYMBOL (cxgb4_iscsi_init)
 
int cxgb4_flush_eq_cache (struct net_device *dev)
 
 EXPORT_SYMBOL (cxgb4_flush_eq_cache)
 
int cxgb4_sync_txq_pidx (struct net_device *dev, u16 qid, u16 pidx, u16 size)
 
 EXPORT_SYMBOL (cxgb4_sync_txq_pidx)
 
void t4_db_full (struct adapter *adap)
 
void t4_db_dropped (struct adapter *adap)
 
int cxgb4_register_uld (enum cxgb4_uld type, const struct cxgb4_uld_info *p)
 
 EXPORT_SYMBOL (cxgb4_register_uld)
 
int cxgb4_unregister_uld (enum cxgb4_uld type)
 
 EXPORT_SYMBOL (cxgb4_unregister_uld)
 
void t4_fatal_err (struct adapter *adap)
 
 module_init (cxgb4_init_module)
 
 module_exit (cxgb4_cleanup_module)
 

Variables

int dbfifo_int_thresh = 10
 

Macro Definition Documentation

#define BCAST_CRC   0xa0ccc1a6

Definition at line 1930 of file cxgb4_main.c.

#define CH_DEVICE (   devid,
  data 
)    { PCI_VDEVICE(CHELSIO, devid), (data) }

Definition at line 182 of file cxgb4_main.c.

#define DFLT_MSG_ENABLE
Value:

Definition at line 178 of file cxgb4_main.c.

#define DRV_DESC   "Chelsio T4 Network Driver"

Definition at line 72 of file cxgb4_main.c.

#define DRV_VERSION   "1.3.0-ko"

Definition at line 71 of file cxgb4_main.c.

#define EEPROM_MAGIC   0x38E2F10C

Definition at line 1832 of file cxgb4_main.c.

#define EXTRA_VECS   2

Definition at line 4285 of file cxgb4_main.c.

#define FW_CFNAME   "cxgb4/t4-config.txt"

Definition at line 212 of file cxgb4_main.c.

#define FW_FNAME   "cxgb4/t4fw.bin"

Definition at line 211 of file cxgb4_main.c.

#define FW_PARAM_DEV (   param)
Value:
FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_##param))
#define FW_PARAM_PFVF (   param)
Value:
FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_PFVF_##param)| \
FW_PARAMS_PARAM_Y(0) | \
FW_PARAMS_PARAM_Z(0)
#define MAX_ATIDS   8192U

Definition at line 3255 of file cxgb4_main.c.

#define MAX_SGE_TIMERVAL   200U

Definition at line 79 of file cxgb4_main.c.

#define pr_fmt (   fmt)    KBUILD_MODNAME ": " fmt

Definition at line 35 of file cxgb4_main.c.

#define T4_REGMAP_SIZE   (160 * 1024)

Definition at line 1091 of file cxgb4_main.c.

#define TSO_FLAGS   (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN)

Definition at line 4418 of file cxgb4_main.c.

#define VLAN_FEAT
Value:
NETIF_F_IPV6_CSUM | NETIF_F_HIGHDMA)

Definition at line 4419 of file cxgb4_main.c.

#define WOL_SUPPORTED   (WAKE_BCAST | WAKE_MAGIC)

Definition at line 1929 of file cxgb4_main.c.

Enumeration Type Documentation

anonymous enum
Enumerator:
PFRES_NVI 
PFRES_NETHCTRL 
PFRES_NIQFLINT 
PFRES_NEQ 
PFRES_NIQ 
PFRES_TC 
PFRES_NEXACTF 
PFRES_R_CAPS 
PFRES_WX_CAPS 

Definition at line 81 of file cxgb4_main.c.

anonymous enum
Enumerator:
MAX_TXQ_ENTRIES 
MAX_CTRL_TXQ_ENTRIES 
MAX_RSPQ_ENTRIES 
MAX_RX_BUFFERS 
MIN_TXQ_ENTRIES 
MIN_CTRL_TXQ_ENTRIES 
MIN_RSPQ_ENTRIES 
MIN_FL_ENTRIES 

Definition at line 167 of file cxgb4_main.c.

anonymous enum
Enumerator:
TP_VLAN_PRI_MAP_DEFAULT 
TP_VLAN_PRI_MAP_FIRST 
TP_VLAN_PRI_MAP_LAST 

Definition at line 320 of file cxgb4_main.c.

Function Documentation

int cxgb4_alloc_atid ( struct tid_info t,
void data 
)

Definition at line 2190 of file cxgb4_main.c.

int cxgb4_alloc_stid ( struct tid_info t,
int  family,
void data 
)

Definition at line 2226 of file cxgb4_main.c.

unsigned int cxgb4_best_mtu ( const unsigned short mtus,
unsigned short  mtu,
unsigned int idx 
)

cxgb4_best_mtu - find the entry in the MTU table closest to an MTU : the HW MTU table : the target MTU : index of selected entry in the MTU table

Returns the index and the value in the HW MTU table that is closest to but does not exceed , unless is smaller than any value in the table, in which case that smallest available value is selected.

Definition at line 2444 of file cxgb4_main.c.

int cxgb4_create_server ( const struct net_device dev,
unsigned int  stid,
__be32  sip,
__be16  sport,
unsigned int  queue 
)

cxgb4_create_server - create an IP server : the device : the server TID : local IP address to bind server to : the server's TCP port : queue to direct messages from this server to

Create an IP server for the given port and address. Returns <0 on error and one of the NET_XMIT_* values on success.

Definition at line 2406 of file cxgb4_main.c.

unsigned int cxgb4_dbfifo_count ( const struct net_device dev,
int  lpfifo 
)

Definition at line 2469 of file cxgb4_main.c.

int cxgb4_flush_eq_cache ( struct net_device dev)

Definition at line 2526 of file cxgb4_main.c.

void cxgb4_free_atid ( struct tid_info t,
unsigned int  atid 
)

Definition at line 2211 of file cxgb4_main.c.

void cxgb4_free_stid ( struct tid_info t,
unsigned int  stid,
int  family 
)

Definition at line 2255 of file cxgb4_main.c.

void cxgb4_get_tcp_stats ( struct pci_dev pdev,
struct tp_tcp_stats v4,
struct tp_tcp_stats v6 
)

Definition at line 2503 of file cxgb4_main.c.

void cxgb4_iscsi_init ( struct net_device dev,
unsigned int  tag_mask,
const unsigned int pgsz_order 
)

Definition at line 2514 of file cxgb4_main.c.

unsigned int cxgb4_port_chan ( const struct net_device dev)

cxgb4_port_chan - get the HW channel of a port : the net device for the port

Return the HW Tx channel of the given port.

Definition at line 2463 of file cxgb4_main.c.

unsigned int cxgb4_port_idx ( const struct net_device dev)

cxgb4_port_idx - get the index of a port : the net device for the port

Return the index of the given port.

Definition at line 2497 of file cxgb4_main.c.

unsigned int cxgb4_port_viid ( const struct net_device dev)

cxgb4_port_viid - get the VI id of a port : the net device for the port

Return the VI id of the given port.

Definition at line 2485 of file cxgb4_main.c.

int cxgb4_register_uld ( enum cxgb4_uld  type,
const struct cxgb4_uld_info p 
)

cxgb4_register_uld - register an upper-layer driver : the ULD type : the ULD methods

Registers an upper-layer driver with this driver and notifies the ULD about any presently available devices that support its type. Returns %-EBUSY if a ULD of the same type is already registered.

Definition at line 2854 of file cxgb4_main.c.

void cxgb4_remove_tid ( struct tid_info t,
unsigned int  chan,
unsigned int  tid 
)

Definition at line 2340 of file cxgb4_main.c.

int cxgb4_sync_txq_pidx ( struct net_device dev,
u16  qid,
u16  pidx,
u16  size 
)

Definition at line 2551 of file cxgb4_main.c.

int cxgb4_unregister_uld ( enum cxgb4_uld  type)

cxgb4_unregister_uld - unregister an upper-layer driver : the ULD type

Unregisters an existing upper-layer driver.

Definition at line 2880 of file cxgb4_main.c.

EXPORT_SYMBOL ( cxgb4_alloc_atid  )
EXPORT_SYMBOL ( cxgb4_free_atid  )
EXPORT_SYMBOL ( cxgb4_alloc_stid  )
EXPORT_SYMBOL ( cxgb4_free_stid  )
EXPORT_SYMBOL ( cxgb4_remove_tid  )
EXPORT_SYMBOL ( cxgb4_create_server  )
EXPORT_SYMBOL ( cxgb4_best_mtu  )
EXPORT_SYMBOL ( cxgb4_port_chan  )
EXPORT_SYMBOL ( cxgb4_dbfifo_count  )
EXPORT_SYMBOL ( cxgb4_port_viid  )
EXPORT_SYMBOL ( cxgb4_port_idx  )
EXPORT_SYMBOL ( cxgb4_get_tcp_stats  )
EXPORT_SYMBOL ( cxgb4_iscsi_init  )
EXPORT_SYMBOL ( cxgb4_flush_eq_cache  )
EXPORT_SYMBOL ( cxgb4_sync_txq_pidx  )
EXPORT_SYMBOL ( cxgb4_register_uld  )
EXPORT_SYMBOL ( cxgb4_unregister_uld  )
MODULE_AUTHOR ( "Chelsio Communications"  )
MODULE_DESCRIPTION ( DRV_DESC  )
MODULE_DEVICE_TABLE ( pci  ,
cxgb4_pci_tbl   
)
module_exit ( cxgb4_cleanup_module  )
MODULE_FIRMWARE ( FW_FNAME  )
module_init ( cxgb4_init_module  )
MODULE_LICENSE ( "Dual BSD/GPL"  )
module_param ( force_init  ,
uint  ,
0644   
)
module_param ( force_old_init  ,
uint  ,
0644   
)
module_param ( dflt_msg_enable  ,
int  ,
0644   
)
module_param ( msi  ,
int  ,
0644   
)
module_param ( dbfifo_int_thresh  ,
int  ,
0644   
)
module_param ( dbfifo_drain_delay  ,
int  ,
0644   
)
module_param_array ( intr_holdoff  ,
uint  ,
NULL  ,
0644   
)
module_param_array ( intr_cnt  ,
uint  ,
NULL  ,
0644   
)
MODULE_PARM_DESC ( force_init  ,
"Forcibly become Master PF and initialize adapter  
)
MODULE_PARM_DESC ( force_old_init  ,
"Force old initialization sequence  
)
MODULE_PARM_DESC ( dflt_msg_enable  ,
"Chelsio T4 default message enable bitmap  
)
MODULE_PARM_DESC ( msi  ,
"whether to use INTx   0,
MSI(1) or MSI-X(2)"   
)
MODULE_PARM_DESC ( intr_holdoff  ,
"values for queue interrupt hold-off timers ""0..4 in microseconds  
)
MODULE_PARM_DESC ( intr_cnt  ,
"thresholds 1..3 for queue interrupt packet counters"   
)
MODULE_PARM_DESC ( dbfifo_int_thresh  ,
"doorbell fifo interrupt threshold  
)
MODULE_PARM_DESC ( dbfifo_drain_delay  ,
"usecs to sleep while draining the dbfifo"   
)
MODULE_VERSION ( DRV_VERSION  )
void* t4_alloc_mem ( size_t  size)

Definition at line 966 of file cxgb4_main.c.

void t4_db_dropped ( struct adapter adap)

Definition at line 2744 of file cxgb4_main.c.

void t4_db_full ( struct adapter adap)

Definition at line 2737 of file cxgb4_main.c.

void t4_fatal_err ( struct adapter adap)

Definition at line 3155 of file cxgb4_main.c.

void t4_os_link_changed ( struct adapter adapter,
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.

Variable Documentation

int dbfifo_int_thresh = 10

Definition at line 442 of file cxgb4_main.c.