FreeBSD kernel CXGB device code
cxgb_main.c File Reference
#include <sys/cdefs.h>
#include "opt_inet.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/module.h>
#include <sys/pciio.h>
#include <sys/conf.h>
#include <machine/bus.h>
#include <machine/resource.h>
#include <sys/ktr.h>
#include <sys/rman.h>
#include <sys/ioccom.h>
#include <sys/mbuf.h>
#include <sys/linker.h>
#include <sys/firmware.h>
#include <sys/socket.h>
#include <sys/sockio.h>
#include <sys/smp.h>
#include <sys/sysctl.h>
#include <sys/syslog.h>
#include <sys/queue.h>
#include <sys/taskqueue.h>
#include <sys/proc.h>
#include <net/bpf.h>
#include <net/debugnet.h>
#include <net/ethernet.h>
#include <net/if.h>
#include <net/if_var.h>
#include <net/if_arp.h>
#include <net/if_dl.h>
#include <net/if_media.h>
#include <net/if_types.h>
#include <net/if_vlan_var.h>
#include <netinet/in_systm.h>
#include <netinet/in.h>
#include <netinet/if_ether.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pci_private.h>
#include <cxgb_include.h>
Include dependency graph for cxgb_main.c:

Go to the source code of this file.

Data Structures

struct  cxgb_ident
 
struct  filter_info
 

Macros

#define EEPROM_MAGIC   0x38E2F10C
 
#define PORT_MASK   ((1 << MAX_NPORTS) - 1)
 
#define FW_FNAME   "cxgb_t3fw"
 
#define TPEEPROM_NAME   "cxgb_t3%c_tp_eeprom"
 
#define TPSRAM_NAME   "cxgb_t3%c_protocol_sram"
 
#define CXGB_CAP
 
#define CXGB_CAP_ENABLE   CXGB_CAP
 
#define T3_REGMAP_SIZE   (3 * 1024)
 

Enumerations

enum  { FILTER_NO_VLAN_PRI = 7 }
 

Functions

 __FBSDID ("$FreeBSD$")
 
static int cxgb_setup_interrupts (adapter_t *)
 
static void cxgb_teardown_interrupts (adapter_t *)
 
static void cxgb_init (void *)
 
static int cxgb_init_locked (struct port_info *)
 
static int cxgb_uninit_locked (struct port_info *)
 
static int cxgb_uninit_synchronized (struct port_info *)
 
static int cxgb_ioctl (struct ifnet *, unsigned long, caddr_t)
 
static int cxgb_media_change (struct ifnet *)
 
static int cxgb_ifm_type (int)
 
static void cxgb_build_medialist (struct port_info *)
 
static void cxgb_media_status (struct ifnet *, struct ifmediareq *)
 
static uint64_t cxgb_get_counter (struct ifnet *, ift_counter)
 
static int setup_sge_qsets (adapter_t *)
 
static void cxgb_async_intr (void *)
 
static void cxgb_tick_handler (void *, int)
 
static void cxgb_tick (void *)
 
static void link_check_callout (void *)
 
static void check_link_status (void *, int)
 
static void setup_rss (adapter_t *sc)
 
static int alloc_filters (struct adapter *)
 
static int setup_hw_filters (struct adapter *)
 
static int set_filter (struct adapter *, int, const struct filter_info *)
 
static void mk_set_tcb_field (struct cpl_set_tcb_field *, unsigned int, unsigned int, u64, u64)
 
static void set_tcb_field_ulp (struct cpl_set_tcb_field *, unsigned int, unsigned int, u64, u64)
 
static int cxgb_controller_probe (device_t)
 
static int cxgb_controller_attach (device_t)
 
static int cxgb_controller_detach (device_t)
 
static void cxgb_free (struct adapter *)
 
static __inline void reg_block_dump (struct adapter *ap, uint8_t *buf, unsigned int start, unsigned int end)
 
static void cxgb_get_regs (adapter_t *sc, struct ch_ifconf_regs *regs, uint8_t *buf)
 
static int cxgb_get_regs_len (void)
 
static void touch_bars (device_t dev)
 
static void cxgb_update_mac_settings (struct port_info *p)
 
static int cxgbc_mod_event (module_t, int, void *)
 
 DRIVER_MODULE (cxgbc, pci, cxgb_controller_driver, cxgb_controller_devclass, cxgbc_mod_event, 0)
 
 MODULE_PNP_INFO ("U16:vendor;U16:device", pci, cxgbc, cxgb_identifiers, nitems(cxgb_identifiers) - 1)
 
 MODULE_VERSION (cxgbc, 1)
 
 MODULE_DEPEND (cxgbc, firmware, 1, 1, 1)
 
static int cxgb_port_probe (device_t)
 
static int cxgb_port_attach (device_t)
 
static int cxgb_port_detach (device_t)
 
 DRIVER_MODULE (cxgb, cxgbc, cxgb_port_driver, cxgb_port_devclass, 0, 0)
 
 MODULE_VERSION (cxgb, 1)
 
 DEBUGNET_DEFINE (cxgb)
 
static SLIST_HEAD (adapter)
 
static int set_eeprom (struct port_info *pi, const uint8_t *data, int len, int offset)
 
static __inline char t3rev2char (struct adapter *adapter)
 
static struct cxgb_identcxgb_get_ident (device_t dev)
 
static const struct adapter_infocxgb_get_adapter_info (device_t dev)
 
static int upgrade_fw (adapter_t *sc)
 
static int cxgb_makedev (struct port_info *pi)
 
void t3_fatal_err (struct adapter *sc)
 
int t3_os_find_pci_capability (adapter_t *sc, int cap)
 
int t3_os_pci_save_state (struct adapter *sc)
 
int t3_os_pci_restore_state (struct adapter *sc)
 
void t3_os_link_changed (adapter_t *adapter, int port_id, int link_status, int speed, int duplex, int fc, int mac_was_reset)
 
void t3_os_phymod_changed (struct adapter *adap, int port_id)
 
void t3_os_set_hw_addr (adapter_t *adapter, int port_idx, u8 hw_addr[])
 
static int await_mgmt_replies (struct adapter *adap, unsigned long init_cnt, unsigned long n)
 
static int init_tp_parity (struct adapter *adap)
 
static void send_pktsched_cmd (struct adapter *adap, int sched, int qidx, int lo, int hi, int port)
 
static void bind_qsets (adapter_t *sc)
 
static void update_tpeeprom (struct adapter *adap)
 
static int update_tpsram (struct adapter *adap)
 
static int cxgb_up (struct adapter *sc)
 
static void cxgb_down (struct adapter *sc)
 
static int cxgb_set_lro (struct port_info *p, int enabled)
 
void t3_os_link_intr (struct port_info *pi)
 
static void check_t3b2_mac (struct adapter *sc)
 
void cxgb_refresh_stats (struct port_info *pi)
 
static int in_range (int val, int lo, int hi)
 
static int cxgb_extension_open (struct cdev *dev, int flags, int fmp, struct thread *td)
 
static int cxgb_extension_close (struct cdev *dev, int flags, int fmt, struct thread *td)
 
static int cxgb_extension_ioctl (struct cdev *dev, unsigned long cmd, caddr_t data, int fflag, struct thread *td)
 
void t3_iterate (void(*func)(struct adapter *, void *), void *arg)
 

Variables

struct cxgb_ident cxgb_identifiers []
 
static device_method_t cxgb_controller_methods []
 
static driver_t cxgb_controller_driver
 
static devclass_t cxgb_controller_devclass
 
static device_method_t cxgb_port_methods []
 
static driver_t cxgb_port_driver
 
static d_ioctl_t cxgb_extension_ioctl
 
static d_open_t cxgb_extension_open
 
static d_close_t cxgb_extension_close
 
static struct cdevsw cxgb_cdevsw
 
static devclass_t cxgb_port_devclass
 
static struct mtx t3_list_lock
 

Macro Definition Documentation

◆ CXGB_CAP

#define CXGB_CAP
Value:
(IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | \
IFCAP_VLAN_HWCSUM | IFCAP_TSO | IFCAP_JUMBO_MTU | IFCAP_LRO | \
IFCAP_VLAN_HWTSO | IFCAP_LINKSTATE | IFCAP_HWCSUM_IPV6)

Definition at line 999 of file cxgb_main.c.

◆ CXGB_CAP_ENABLE

#define CXGB_CAP_ENABLE   CXGB_CAP

Definition at line 1002 of file cxgb_main.c.

◆ EEPROM_MAGIC

#define EEPROM_MAGIC   0x38E2F10C

Definition at line 306 of file cxgb_main.c.

◆ FW_FNAME

#define FW_FNAME   "cxgb_t3fw"

Definition at line 385 of file cxgb_main.c.

◆ PORT_MASK

#define PORT_MASK   ((1 << MAX_NPORTS) - 1)

Definition at line 308 of file cxgb_main.c.

◆ T3_REGMAP_SIZE

#define T3_REGMAP_SIZE   (3 * 1024)

Definition at line 3206 of file cxgb_main.c.

◆ TPEEPROM_NAME

#define TPEEPROM_NAME   "cxgb_t3%c_tp_eeprom"

Definition at line 386 of file cxgb_main.c.

◆ TPSRAM_NAME

#define TPSRAM_NAME   "cxgb_t3%c_protocol_sram"

Definition at line 387 of file cxgb_main.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
FILTER_NO_VLAN_PRI 

Definition at line 304 of file cxgb_main.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ alloc_filters()

static int alloc_filters ( struct adapter sc)
static

◆ await_mgmt_replies()

static int await_mgmt_replies ( struct adapter adap,
unsigned long  init_cnt,
unsigned long  n 
)
static

Definition at line 1329 of file cxgb_main.c.

References sge_rspq::offload_pkts, sge::qs, sge_qset::rspq, adapter::sge, and t3_os_sleep.

Referenced by init_tp_parity().

Here is the caller graph for this function:

◆ bind_qsets()

static void bind_qsets ( adapter_t sc)
static

Definition at line 1475 of file cxgb_main.c.

References adap2pinfo(), port_info::first_qset, port_info::nqsets, send_pktsched_cmd(), and port_info::tx_chan.

Referenced by cxgb_up().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_link_status()

static void check_link_status ( void *  arg,
int  pending 
)
static

◆ check_t3b2_mac()

◆ cxgb_async_intr()

static void cxgb_async_intr ( void *  data)
static

Definition at line 2277 of file cxgb_main.c.

References A_PL_INT_ENABLE0, adapter::slow_intr_task, t3_read_reg(), t3_write_reg(), and adapter::tq.

Referenced by cxgb_controller_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cxgb_build_medialist()

static void cxgb_build_medialist ( struct port_info p)
static

◆ cxgb_controller_attach()

static int cxgb_controller_attach ( device_t  dev)
static

Definition at line 445 of file cxgb_main.c.

References port_info::adapter, ADAPTER_LOCK_INIT, ADAPTER_LOCK_NAME_LEN, adapter::bh, adapter::bt, adapter_info::caps, cxgb_async_intr(), cxgb_free(), cxgb_get_adapter_info(), adapter::cxgb_intr, cxgb_setup_interrupts(), cxgb_tick(), adapter::cxgb_tick_ch, cxgb_tick_handler(), adapter_info::desc, adapter::dev, vpd_params::ec, adapter::elmer_lock, adapter::elmerlockbuf, port_info::first_qset, adapter::flags, FW_UPTODATE, adapter::fw_version, FW_VERSION_MAJOR, FW_VERSION_MICRO, FW_VERSION_MINOR, G_FW_VERSION_MAJOR, G_FW_VERSION_MICRO, G_FW_VERSION_MINOR, is_offload(), adapter::link_width, adapter::lockbuf, MAX_NPORTS, adapter::mdio_lock, adapter::mdiolockbuf, adapter::mmio_len, adapter::msi_count, adapter::msix_regs_res, adapter::msix_regs_rid, MTX_INIT, adapter_params::nports, adapter_info::nports0, port_info::nqsets, adapter::params, adapter::port, port_info::port_id, vpd_params::port_type, adapter::port_types, adapter::portdev, sge::reg_lock, adapter::reglockbuf, adapter::regs_res, adapter::regs_rid, adapter::rxpkt_map, adapter::sge, SGE_QSETS, vpd_params::sn, SUPPORTED_10000baseT_Full, t3_add_attach_sysctls(), t3_check_fw_version(), t3_check_tpsram_version(), t3_get_fw_version(), t3_intr_clear(), t3_intr_msi(), t3_led_ready(), t3_list_lock, t3_prep_adapter(), t3_sge_init_adapter(), t3b_intr(), t3rev2char(), adapter::tick_task, touch_bars(), TP_VERSION_MAJOR, TP_VERSION_MICRO, TP_VERSION_MINOR, TPS_UPTODATE, adapter::tq, port_info::tx_chan, port_info::txpkt_intf, adapter::udbs_res, adapter::udbs_rid, USING_MSI, USING_MSIX, and adapter_params::vpd.

Here is the call graph for this function:

◆ cxgb_controller_detach()

static int cxgb_controller_detach ( device_t  dev)
static

Definition at line 699 of file cxgb_main.c.

References cxgb_free(), and adapter::dev.

Here is the call graph for this function:

◆ cxgb_controller_probe()

static int cxgb_controller_probe ( device_t  dev)
static

Definition at line 364 of file cxgb_main.c.

References cxgb_get_adapter_info(), adapter_info::desc, adapter_info::nports0, and adapter_info::nports1.

Here is the call graph for this function:

◆ cxgb_down()

static void cxgb_down ( struct adapter sc)
static

Definition at line 1667 of file cxgb_main.c.

References t3_intr_disable(), and t3_sge_stop().

Referenced by cxgb_uninit_synchronized().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cxgb_extension_close()

static int cxgb_extension_close ( struct cdev *  dev,
int  flags,
int  fmt,
struct thread *  td 
)
static

Definition at line 2535 of file cxgb_main.c.

◆ cxgb_extension_ioctl()

static int cxgb_extension_ioctl ( struct cdev *  dev,
unsigned long  cmd,
caddr_t  data,
int  fflag,
struct thread *  td 
)
static

Definition at line 2541 of file cxgb_main.c.

References A_TP_TX_MOD_QUEUE_REQ_MAP, port_info::adapter, ADAPTER_LOCK, ADAPTER_UNLOCK, ch_reg::addr, ch_mem_range::addr, ch_tcam_word::addr, ch_pktsched_params::binding, ch_mem_range::buf, ch_tcam_word::buf, ch_up_la::bufsize, ch_up_ioqs::bufsize, tp_params::chan_rx_size, tp_params::chan_tx_size, ch_hw_sched::channel, CHELSIO_CLEAR_STATS, CHELSIO_DEL_FILTER, CHELSIO_GET_EEPROM, CHELSIO_GET_FILTER, CHELSIO_GET_MEM, CHELSIO_GET_MIIREG, CHELSIO_GET_PM, CHELSIO_GET_QSET_NUM, CHELSIO_GET_QSET_PARAMS, CHELSIO_GET_SGE_CONTEXT, CHELSIO_GET_SGE_DESC, CHELSIO_GET_UP_IOQS, CHELSIO_GET_UP_LA, CHELSIO_GETMTUTAB, CHELSIO_GETREG, CHELSIO_IFCONF_GETREGS, CHELSIO_LOAD_BOOT, CHELSIO_LOAD_FW, CHELSIO_READ_TCAM_WORD, CHELSIO_SET_FILTER, CHELSIO_SET_HW_SCHED, CHELSIO_SET_MIIREG, CHELSIO_SET_PKTSCHED, CHELSIO_SET_PM, CHELSIO_SET_TRACE_FILTER, CHELSIO_SETMTUTAB, CHELSIO_SETREG, ch_hw_sched::class_ipg, adapter::cm, ch_cntxt::cntxt_id, ch_cntxt::cntxt_type, CNTXT_TYPE_CQ, CNTXT_TYPE_EGRESS, CNTXT_TYPE_FL, CNTXT_TYPE_RSP, qset_params::coalesce_usecs, ch_trace::config_rx, ch_trace::config_tx, qset_params::cong_thres, ch_qset_params::cong_thres, core_ticks_per_usec(), cxgb_debug, cxgb_get_regs(), cxgb_get_regs_len(), dack_ticks_to_usec(), ch_desc::data, ch_cntxt::data, ch_ifconf_regs::data, ch_eeprom::data, ch_up_la::data, ch_up_ioqs::data, ch_filter_tuple::dip, filter_info::dip, ch_filter_tuple::dport, filter_info::dport, EEPROM_MAGIC, EEPROMSIZE, ch_filter::filter_id, FILTER_NO_VLAN_PRI, adapter::filters, port_info::first_qset, qset_params::fl_size, ch_qset_params::fl_size, adapter::flags, ch_hw_sched::flow_ipg, FULL_INIT_DONE, FW_UPTODATE, adapter::fw_version, G_FW_VERSION_MAJOR, G_FW_VERSION_MICRO, G_FW_VERSION_MINOR, ch_desc::idx, ch_pktsched_params::idx, ch_up_la::idx, in_range(), ch_qset_params::intr_lat, ch_trace::invert_match, ch_up_ioqs::ioq_rx_enable, ch_up_ioqs::ioq_rx_status, ch_up_ioqs::ioq_tx_enable, ch_up_ioqs::ioq_tx_status, IOQS_BUFSIZE, adapter::irq_res, is_10G(), is_offload(), qset_params::jumbo_size, ch_hw_sched::kbps, LA_BUFSIZE, ch_mem_range::len, ch_ifconf_regs::len, ch_eeprom::len, filter_info::locked, qset_params::lro, ch_qset_params::lro, port_info::mac, ch_filter::mac_addr_idx, ch_filter::mac_hit, filter_info::mac_hit, filter_info::mac_idx, filter_info::mac_vld, ch_eeprom::magic, ch_filter::mask, ch_pktsched_params::max, adapter_params::mc5, adapter::mc5, MDIO_DEV_PCS, MDIO_DEV_VEND2, cphy::mdio_read, cphy::mdio_write, MEM_CM, ch_mem_range::mem_id, MEM_PMRX, MEM_PMTX, ch_pktsched_params::min, adapter::mmio_len, ch_hw_sched::mode, adapter::msix_irq_res, adapter_params::mtus, ch_mtus::mtus, tp_params::nchan, mc5_params::nfilters, NMTUS, ch_mtus::nmtus, nqsets, port_info::nqsets, NTX_SCHED, offload_running(), ch_eeprom::offset, adapter::open_device_map, adapter::params, ch_filter::pass, filter_info::pass, phy, port_info::phy, ch_mii_data::phy_id, filter_info::pkt_type, ch_pm::pm_total, adapter::pmrx, adapter::pmtx, tp_params::pmtx_size, qset_params::polling, ch_qset_params::polling, PORT_LOCK, PORT_UNLOCK, ch_filter::proto, ch_qset_params::qnum, sge::qs, sge_params::qset, ch_filter::qset, filter_info::qset, ch_qset_params::qset_idx, ch_desc::queue_num, sge::reg_lock, ch_mii_data::reg_num, filter_info::report_filter_id, adapter_params::rev, adapter::rrss_map, qset_params::rspq_size, ch_qset_params::rspq_size, ch_filter::rss, filter_info::rss, RSS_TABLE_SIZE, ch_pm::rx_num_pg, tp_params::rx_num_pgs, tp_params::rx_pg_size, ch_pm::rx_pg_sz, S_TX_MOD_TIMER_MODE, ch_pktsched_params::sched, ch_hw_sched::sched, send_pktsched_cmd(), set_filter(), adapter_params::sge, adapter::sge, SGE_QSETS, ch_trace::sip, ch_filter_tuple::sip, filter_info::sip, filter_info::sip_mask, ch_desc::size, ch_filter_tuple::sport, filter_info::sport, cmac::stats, ch_up_la::stopped, t3_config_sched(), t3_config_trace_filter(), t3_get_desc(), t3_get_fw_version(), t3_get_up_ioqs(), t3_get_up_la(), t3_load_boot(), t3_load_fw(), t3_mac_update_stats(), t3_mc7_bd_read(), t3_read_mc5_range(), t3_read_reg(), t3_seeprom_read(), t3_set_pace_tbl(), t3_set_reg_field(), t3_set_sched_ipg(), t3_sge_read_cq(), t3_sge_read_ecntxt(), t3_sge_read_fl(), t3_sge_read_rspq(), t3_write_reg(), adapter_params::tp, ch_trace::trace_rx, ch_trace::trace_tx, ch_pm::tx_num_pg, tp_params::tx_num_pgs, tp_params::tx_pg_size, ch_pm::tx_pg_sz, ch_qset_params::txq_size, qset_params::txq_size, USING_MSIX, ch_reg::val, ch_filter::val, ch_mii_data::val_in, ch_mii_data::val_out, filter_info::valid, ch_qset_params::vector, ch_mem_range::version, ch_filter_tuple::vlan, filter_info::vlan, ch_filter_tuple::vlan_prio, filter_info::vlan_prio, and ch_filter::want_filter_id.

Here is the call graph for this function:

◆ cxgb_extension_open()

static int cxgb_extension_open ( struct cdev *  dev,
int  flags,
int  fmp,
struct thread *  td 
)
static

Definition at line 2529 of file cxgb_main.c.

◆ cxgb_free()

◆ cxgb_get_adapter_info()

static const struct adapter_info * cxgb_get_adapter_info ( device_t  dev)
static

Definition at line 349 of file cxgb_main.c.

References cxgb_get_ident(), cxgb_ident::index, and t3_get_adapter_info().

Referenced by cxgb_controller_attach(), and cxgb_controller_probe().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cxgb_get_counter()

◆ cxgb_get_ident()

static struct cxgb_ident * cxgb_get_ident ( device_t  dev)
static

Definition at line 335 of file cxgb_main.c.

References cxgb_identifiers, cxgb_ident::desc, cxgb_ident::device, and cxgb_ident::vendor.

Referenced by cxgb_get_adapter_info().

Here is the caller graph for this function:

◆ cxgb_get_regs()

static void cxgb_get_regs ( adapter_t sc,
struct ch_ifconf_regs regs,
uint8_t *  buf 
)
static

◆ cxgb_get_regs_len()

static int cxgb_get_regs_len ( void  )
static

Definition at line 3208 of file cxgb_main.c.

References T3_REGMAP_SIZE.

Referenced by cxgb_extension_ioctl(), and cxgb_get_regs().

Here is the caller graph for this function:

◆ cxgb_ifm_type()

static int cxgb_ifm_type ( int  mod)
static

Definition at line 2079 of file cxgb_main.c.

References phy_modtype_lr, phy_modtype_lrm, phy_modtype_none, phy_modtype_sr, phy_modtype_twinax, phy_modtype_twinax_long, and phy_modtype_unknown.

Referenced by cxgb_build_medialist().

Here is the caller graph for this function:

◆ cxgb_init()

static void cxgb_init ( void *  arg)
static

Definition at line 1677 of file cxgb_main.c.

References port_info::adapter, ADAPTER_LOCK, ADAPTER_LOCK_ASSERT_NOTOWNED, and cxgb_init_locked().

Referenced by cxgb_port_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cxgb_init_locked()

◆ cxgb_ioctl()

static int cxgb_ioctl ( struct ifnet *  ifp,
unsigned long  command,
caddr_t  data 
)
static

Definition at line 1883 of file cxgb_main.c.

References port_info::adapter, ADAPTER_LOCK, ADAPTER_LOCK_ASSERT_NOTOWNED, ADAPTER_UNLOCK, cxgb_init_locked(), cxgb_set_lro(), cxgb_uninit_locked(), cxgb_update_mac_settings(), flags, port_info::if_flags, ifp, IS_BUSY, IS_DOOMED, port_info::media, PORT_LOCK, and PORT_UNLOCK.

Referenced by cxgb_port_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cxgb_makedev()

static int cxgb_makedev ( struct port_info pi)
static

Definition at line 985 of file cxgb_main.c.

References cxgb_cdevsw, port_info::ifp, and port_info::port_cdev.

Referenced by cxgb_port_attach().

Here is the caller graph for this function:

◆ cxgb_media_change()

static int cxgb_media_change ( struct ifnet *  ifp)
static

Definition at line 2070 of file cxgb_main.c.

Referenced by cxgb_port_attach().

Here is the caller graph for this function:

◆ cxgb_media_status()

static void cxgb_media_status ( struct ifnet *  ifp,
struct ifmediareq *  ifmr 
)
static

Definition at line 2171 of file cxgb_main.c.

References cphy::caps, cxgb_build_medialist(), ifp, port_info::link_config, link_config::link_ok, port_info::media, cphy::modtype, port_info::phy, link_config::speed, SPEED_10, SPEED_100, SPEED_1000, SPEED_10000, SUPPORTED_Autoneg, and SUPPORTED_TP.

Referenced by cxgb_port_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cxgb_port_attach()

◆ cxgb_port_detach()

◆ cxgb_port_probe()

static int cxgb_port_probe ( device_t  dev)
static

Definition at line 970 of file cxgb_main.c.

References cphy::desc, port_info::phy, and port_info::port_id.

◆ cxgb_refresh_stats()

void cxgb_refresh_stats ( struct port_info pi)

Definition at line 2378 of file cxgb_main.c.

References port_info::last_refreshed, port_info::mac, PORT_LOCK, PORT_UNLOCK, and t3_mac_update_stats().

Referenced by cxgb_get_counter(), cxgb_tick_handler(), and sysctl_handle_macstat().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cxgb_set_lro()

static int cxgb_set_lro ( struct port_info p,
int  enabled 
)
static

Definition at line 1869 of file cxgb_main.c.

References port_info::adapter, lro_state::enabled, port_info::first_qset, sge_qset::lro, port_info::nqsets, sge::qs, and adapter::sge.

Referenced by cxgb_ioctl().

Here is the caller graph for this function:

◆ cxgb_setup_interrupts()

static int cxgb_setup_interrupts ( adapter_t sc)
static

◆ cxgb_teardown_interrupts()

static void cxgb_teardown_interrupts ( adapter_t sc)
static

Definition at line 863 of file cxgb_main.c.

References adapter::dev, adapter::intr_tag, adapter::irq_res, adapter::irq_rid, adapter::msix_intr_tag, adapter::msix_irq_res, adapter::msix_irq_rid, and SGE_QSETS.

Referenced by cxgb_free(), and cxgb_setup_interrupts().

Here is the caller graph for this function:

◆ cxgb_tick()

static void cxgb_tick ( void *  arg)
static

Definition at line 2366 of file cxgb_main.c.

References CXGB_SHUTDOWN, cxgb_tick(), adapter::cxgb_tick_ch, adapter::flags, adapter::tick_task, and adapter::tq.

Referenced by cxgb_controller_attach(), and cxgb_tick().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cxgb_tick_handler()

◆ cxgb_uninit_locked()

static int cxgb_uninit_locked ( struct port_info p)
static

Definition at line 1768 of file cxgb_main.c.

References port_info::adapter, ADAPTER_LOCK, ADAPTER_LOCK_ASSERT_OWNED, ADAPTER_UNLOCK, CLR_BUSY, cxgb_uninit_synchronized(), adapter::flags, IS_BUSY, IS_DOOMED, adapter::lock, and SET_BUSY.

Referenced by cxgb_ioctl().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cxgb_uninit_synchronized()

◆ cxgb_up()

static int cxgb_up ( struct adapter sc)
static

cxgb_up - enable the adapter @adap: adapter being enabled

Called when the first port is enabled, this function performs the actions necessary to make an adapter operational, such as completing the initialization of HW modules, and enabling interrupts.

Definition at line 1590 of file cxgb_main.c.

References A_TP_INT_CAUSE, A_TP_INT_ENABLE, A_TP_PARA_REG5, A_ULPRX_TDDP_PSZ, ADAPTER_LOCK_ASSERT_NOTOWNED, alloc_filters(), bind_qsets(), F_ARPLUTPERR, F_CMCACHEPERR, F_RXDDPOFFINIT, adapter::flags, FULL_INIT_DONE, FW_UPTODATE, init_tp_parity(), is_offload(), adapter_params::mc5, adapter::mc5, MC5_MIN_TIDS, mc5_params::nfilters, mc5_params::nservers, adapter::open_device_map, adapter::params, QUEUES_BOUND, adapter_params::rev, setup_hw_filters(), setup_rss(), setup_sge_qsets(), t3_add_configured_sysctls(), t3_init_hw(), t3_intr_clear(), t3_intr_enable(), t3_mc5_size(), T3_REV_C, t3_set_reg_field(), t3_sge_reset_adapter(), t3_sge_start(), t3_write_reg(), TP_PARITY_INIT, TPS_UPTODATE, update_tpsram(), upgrade_fw(), and V_HPZ0.

Referenced by cxgb_init_locked().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cxgb_update_mac_settings()

static void cxgb_update_mac_settings ( struct port_info p)
static

◆ cxgbc_mod_event()

static int cxgbc_mod_event ( module_t  mod,
int  cmd,
void *  arg 
)
static

Definition at line 3560 of file cxgb_main.c.

References t3_list_lock.

◆ DEBUGNET_DEFINE()

DEBUGNET_DEFINE ( cxgb  )

◆ DRIVER_MODULE() [1/2]

DRIVER_MODULE ( cxgb  ,
cxgbc  ,
cxgb_port_driver  ,
cxgb_port_devclass  ,
,
 
)

◆ DRIVER_MODULE() [2/2]

DRIVER_MODULE ( cxgbc  ,
pci  ,
cxgb_controller_driver  ,
cxgb_controller_devclass  ,
cxgbc_mod_event  ,
 
)

◆ in_range()

static int in_range ( int  val,
int  lo,
int  hi 
)
static

Definition at line 2523 of file cxgb_main.c.

Referenced by cxgb_extension_ioctl().

Here is the caller graph for this function:

◆ init_tp_parity()

◆ link_check_callout()

static void link_check_callout ( void *  arg)
static

Definition at line 2287 of file cxgb_main.c.

References port_info::adapter, port_info::link_check_task, adapter::open_device_map, port_info::port_id, and adapter::tq.

Referenced by check_link_status(), cxgb_init_locked(), and t3_os_link_intr().

Here is the caller graph for this function:

◆ mk_set_tcb_field()

static void mk_set_tcb_field ( struct cpl_set_tcb_field req,
unsigned int  tid,
unsigned int  word,
u64  mask,
u64  val 
)
inlinestatic

◆ MODULE_DEPEND()

MODULE_DEPEND ( cxgbc  ,
firmware  ,
,
,
 
)

◆ MODULE_PNP_INFO()

MODULE_PNP_INFO ( "U16:vendor;U16:device"  ,
pci  ,
cxgbc  ,
cxgb_identifiers  ,
nitems(cxgb_identifiers) -  1 
)

◆ MODULE_VERSION() [1/2]

MODULE_VERSION ( cxgb  ,
 
)

◆ MODULE_VERSION() [2/2]

MODULE_VERSION ( cxgbc  ,
 
)

◆ reg_block_dump()

static __inline void reg_block_dump ( struct adapter ap,
uint8_t *  buf,
unsigned int  start,
unsigned int  end 
)
static

Definition at line 3197 of file cxgb_main.c.

References t3_read_reg().

Referenced by cxgb_get_regs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_pktsched_cmd()

static void send_pktsched_cmd ( struct adapter adap,
int  sched,
int  qidx,
int  lo,
int  hi,
int  port 
)
static

Definition at line 1453 of file cxgb_main.c.

References mngt_pktsched_wr::binding, FW_MNGTOPCODE_PKTSCHED_SET, FW_WROPCODE_MNGT, mngt_pktsched_wr::idx, mngt_pktsched_wr::max, mngt_pktsched_wr::min, mngt_pktsched_wr::mngt_opcode, mngt_pktsched_wr::sched, t3_mgmt_tx(), and V_WR_OP.

Referenced by bind_qsets(), and cxgb_extension_ioctl().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_eeprom()

static int set_eeprom ( struct port_info pi,
const uint8_t *  data,
int  len,
int  offset 
)
static

Definition at line 2478 of file cxgb_main.c.

References port_info::adapter, t3_seeprom_read(), t3_seeprom_wp(), and t3_seeprom_write().

Referenced by update_tpeeprom().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_filter()

◆ set_tcb_field_ulp()

static void set_tcb_field_ulp ( struct cpl_set_tcb_field req,
unsigned int  tid,
unsigned int  word,
u64  mask,
u64  val 
)
inlinestatic

Definition at line 3357 of file cxgb_main.c.

References ulp_txpkt::cmd_dest, ulp_txpkt::len, mk_set_tcb_field(), ULP_TXPKT, V_ULPTX_CMD, and V_ULPTX_NFLITS.

Referenced by set_filter().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setup_hw_filters()

static int setup_hw_filters ( struct adapter sc)
static

Definition at line 3263 of file cxgb_main.c.

References adapter::filters, filter_info::locked, adapter_params::mc5, mc5_params::nfilters, adapter::params, set_filter(), and t3_enable_filters().

Referenced by cxgb_up().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setup_rss()

static void setup_rss ( adapter_t adap)
static

setup_rss - configure Receive Side Steering (per-queue connection demux) @adap: the adapter

Sets up RSS to distribute packets to multiple receive queues. We configure the RSS CPU lookup table to distribute to the number of HW receive queues, and the response queue lookup table to narrow that down to the response queues actually configured for each port. We always configure the RSS mapping for two ports since the mapping table has plenty of entries.

Definition at line 1417 of file cxgb_main.c.

References adap2pinfo(), F_HASHTOEPLITZ, F_OFDMAPEN, F_RQFEEDBACKENABLE, F_RRCPLMAPEN, F_TNL2TUPEN, F_TNL4TUPEN, F_TNLLKPEN, F_TNLMAPEN, F_TNLPRTEN, for_each_port, port_info::nqsets, adapter::rrss_map, RSS_TABLE_SIZE, SGE_QSETS, t3_config_rss(), port_info::tx_chan, and V_RRCPLCPUSIZE.

Referenced by cxgb_up().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setup_sge_qsets()

static int setup_sge_qsets ( adapter_t sc)
static

setup_sge_qsets - configure SGE Tx/Rx/response queues @sc: the controller softc

Determines how many sets of SGE queues to use and initializes them. We support multiple queue sets per port if we have MSI-X, otherwise just one queue set per port.

Definition at line 828 of file cxgb_main.c.

References adapter::dev, adapter::flags, adapter_params::nports, port_info::nqsets, adapter::nqsets, adapter::params, adapter::port, sge_params::qset, adapter_params::rev, adapter_params::sge, SGE_TXQ_PER_SET, t3_free_sge_resources(), t3_sge_alloc(), t3_sge_alloc_qset(), USING_MSI, and USING_MSIX.

Referenced by cxgb_up().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SLIST_HEAD()

static SLIST_HEAD ( adapter  )
static

Definition at line 224 of file cxgb_main.c.

◆ t3_fatal_err()

◆ t3_iterate()

void t3_iterate ( void(*)(struct adapter *, void *)  func,
void *  arg 
)

Definition at line 3368 of file cxgb_main.c.

References t3_list_lock.

◆ t3_os_find_pci_capability()

int t3_os_find_pci_capability ( adapter_t sc,
int  cap 
)

Definition at line 1153 of file cxgb_main.c.

References adapter::dev.

Referenced by get_pci_mode(), and t3_prep_adapter().

Here is the caller graph for this function:

◆ t3_os_link_changed()

void t3_os_link_changed ( adapter_t adapter,
int  port_id,
int  link_status,
int  speed,
int  duplex,
int  fc,
int  mac_was_reset 
)

t3_os_link_changed - handle link status changes @sc: the adapter associated with the link change @port_id: the port index whose link status has changed @link_status: the new status of the link @speed: the new speed setting @duplex: the new duplex setting @fc: the new flow-control setting

This is the OS-dependent handler for link status changes. The OS neutral handler takes care of most of the processing for these events, then calls this handler for any OS-specific processing.

Definition at line 1232 of file cxgb_main.c.

References cxgb_update_mac_settings(), ifp, port_info::ifp, adapter::port, port_id, PORT_LOCK, and PORT_UNLOCK.

Referenced by cxgb_uninit_synchronized(), and t3_link_changed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ t3_os_link_intr()

void t3_os_link_intr ( struct port_info pi)

Definition at line 2315 of file cxgb_main.c.

References link_check_callout(), and port_info::link_check_ch.

Referenced by mac_intr_handler(), and phy_intr_handler().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ t3_os_pci_restore_state()

int t3_os_pci_restore_state ( struct adapter sc)

Definition at line 1206 of file cxgb_main.c.

References adapter::dev.

Referenced by t3_reset_adapter().

Here is the caller graph for this function:

◆ t3_os_pci_save_state()

int t3_os_pci_save_state ( struct adapter sc)

Definition at line 1193 of file cxgb_main.c.

References adapter::dev.

Referenced by t3_reset_adapter().

Here is the caller graph for this function:

◆ t3_os_phymod_changed()

void t3_os_phymod_changed ( struct adapter adap,
int  port_id 
)

t3_os_phymod_changed - handle PHY module changes @phy: the PHY reporting the module change @mod_type: new module type

This is the OS-dependent handler for PHY module changes. It is invoked when a PHY module is removed or inserted for any OS-specific processing.

Definition at line 1264 of file cxgb_main.c.

References ARRAY_SIZE, cxgb_build_medialist(), port_info::ifp, port_info::media, cphy::modtype, port_info::phy, phy_modtype_none, adapter::port, and port_id.

Referenced by phy_intr_handler().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ t3_os_set_hw_addr()

void t3_os_set_hw_addr ( adapter_t adapter,
int  port_idx,
u8  hw_addr[] 
)

Definition at line 1285 of file cxgb_main.c.

References cxgb_debug, hw_addr, port_info::hw_addr, and adapter::port.

Referenced by t3_prep_adapter().

Here is the caller graph for this function:

◆ t3rev2char()

static __inline char t3rev2char ( struct adapter adapter)
static

Definition at line 315 of file cxgb_main.c.

References adapter::params, adapter_params::rev, T3_REV_A, T3_REV_B, T3_REV_B2, and T3_REV_C.

Referenced by cxgb_controller_attach(), update_tpeeprom(), and update_tpsram().

Here is the caller graph for this function:

◆ touch_bars()

static void touch_bars ( device_t  dev)
static

Definition at line 2460 of file cxgb_main.c.

Referenced by cxgb_controller_attach().

Here is the caller graph for this function:

◆ update_tpeeprom()

static void update_tpeeprom ( struct adapter adap)
static

Definition at line 1491 of file cxgb_main.c.

References adapter::dev, G_TP_VERSION_MAJOR, G_TP_VERSION_MINOR, adapter::port, set_eeprom(), t3_check_tpsram(), t3_seeprom_read(), t3rev2char(), TP_SRAM_LEN, TP_SRAM_OFFSET, TP_VERSION_MAJOR, TP_VERSION_MICRO, TP_VERSION_MINOR, and TPEEPROM_NAME.

Referenced by update_tpsram().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_tpsram()

static int update_tpsram ( struct adapter adap)
static

Definition at line 1549 of file cxgb_main.c.

References adapter::dev, t3_check_tpsram(), t3_set_proto_sram(), t3rev2char(), TPSRAM_NAME, and update_tpeeprom().

Referenced by cxgb_up().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ upgrade_fw()

static int upgrade_fw ( adapter_t sc)
static

Definition at line 390 of file cxgb_main.c.

References adapter::dev, FW_FNAME, adapter::fw_version, G_FW_VERSION_MAJOR, G_FW_VERSION_MICRO, G_FW_VERSION_MINOR, t3_get_fw_version(), and t3_load_fw().

Referenced by cxgb_up().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ cxgb_cdevsw

struct cdevsw cxgb_cdevsw
static
Initial value:
= {
.d_version = D_VERSION,
.d_flags = 0,
.d_name = "cxgb",
}
static d_ioctl_t cxgb_extension_ioctl
Definition: cxgb_main.c:204
static d_open_t cxgb_extension_open
Definition: cxgb_main.c:205
static d_close_t cxgb_extension_close
Definition: cxgb_main.c:206

Definition at line 208 of file cxgb_main.c.

Referenced by cxgb_makedev().

◆ cxgb_controller_devclass

devclass_t cxgb_controller_devclass
static

Definition at line 175 of file cxgb_main.c.

◆ cxgb_controller_driver

driver_t cxgb_controller_driver
static
Initial value:
= {
"cxgbc",
sizeof(struct adapter)
}
static device_method_t cxgb_controller_methods[]
Definition: cxgb_main.c:160

Definition at line 168 of file cxgb_main.c.

◆ cxgb_controller_methods

device_method_t cxgb_controller_methods[]
static
Initial value:
= {
DEVMETHOD(device_probe, cxgb_controller_probe),
DEVMETHOD(device_attach, cxgb_controller_attach),
DEVMETHOD(device_detach, cxgb_controller_detach),
DEVMETHOD_END
}
static int cxgb_controller_attach(device_t)
Definition: cxgb_main.c:445
static int cxgb_controller_probe(device_t)
Definition: cxgb_main.c:364
static int cxgb_controller_detach(device_t)
Definition: cxgb_main.c:699

Definition at line 160 of file cxgb_main.c.

◆ cxgb_extension_close

d_close_t cxgb_extension_close
static

Definition at line 206 of file cxgb_main.c.

◆ cxgb_extension_ioctl

d_ioctl_t cxgb_extension_ioctl
static

Definition at line 204 of file cxgb_main.c.

◆ cxgb_extension_open

d_open_t cxgb_extension_open
static

Definition at line 205 of file cxgb_main.c.

◆ cxgb_identifiers

struct cxgb_ident cxgb_identifiers[]
Initial value:
= {
{PCI_VENDOR_ID_CHELSIO, 0x0020, 0, "PE9000"},
{PCI_VENDOR_ID_CHELSIO, 0x0021, 1, "T302E"},
{PCI_VENDOR_ID_CHELSIO, 0x0022, 2, "T310E"},
{PCI_VENDOR_ID_CHELSIO, 0x0023, 3, "T320X"},
{PCI_VENDOR_ID_CHELSIO, 0x0024, 1, "T302X"},
{PCI_VENDOR_ID_CHELSIO, 0x0025, 3, "T320E"},
{PCI_VENDOR_ID_CHELSIO, 0x0026, 2, "T310X"},
{PCI_VENDOR_ID_CHELSIO, 0x0030, 2, "T3B10"},
{PCI_VENDOR_ID_CHELSIO, 0x0031, 3, "T3B20"},
{PCI_VENDOR_ID_CHELSIO, 0x0032, 1, "T3B02"},
{PCI_VENDOR_ID_CHELSIO, 0x0033, 4, "T3B04"},
{PCI_VENDOR_ID_CHELSIO, 0x0035, 6, "T3C10"},
{PCI_VENDOR_ID_CHELSIO, 0x0036, 3, "S320E-CR"},
{PCI_VENDOR_ID_CHELSIO, 0x0037, 7, "N320E-G2"},
{0, 0, 0, NULL}
}
#define PCI_VENDOR_ID_CHELSIO
Definition: cxgb_common.h:639

Referenced by cxgb_get_ident().

◆ cxgb_port_devclass

devclass_t cxgb_port_devclass
static

Definition at line 217 of file cxgb_main.c.

◆ cxgb_port_driver

driver_t cxgb_port_driver
static
Initial value:
= {
"cxgb",
0
}
static device_method_t cxgb_port_methods[]
Definition: cxgb_main.c:191

Definition at line 198 of file cxgb_main.c.

◆ cxgb_port_methods

device_method_t cxgb_port_methods[]
static
Initial value:
= {
DEVMETHOD(device_probe, cxgb_port_probe),
DEVMETHOD(device_attach, cxgb_port_attach),
DEVMETHOD(device_detach, cxgb_port_detach),
{ 0, 0 }
}
static int cxgb_port_detach(device_t)
Definition: cxgb_main.c:1090
static int cxgb_port_probe(device_t)
Definition: cxgb_main.c:970
static int cxgb_port_attach(device_t)
Definition: cxgb_main.c:1005

Definition at line 191 of file cxgb_main.c.

◆ t3_list_lock

struct mtx t3_list_lock
static

Definition at line 223 of file cxgb_main.c.

Referenced by cxgb_controller_attach(), cxgb_free(), cxgbc_mod_event(), and t3_iterate().