32#ifndef __CHELSIO_COMMON_H
33#define __CHELSIO_COMMON_H
51#define MAX_RX_COALESCING_LEN 12288U
80#define S_TP_VERSION_MAJOR 16
81#define M_TP_VERSION_MAJOR 0xFF
82#define V_TP_VERSION_MAJOR(x) ((x) << S_TP_VERSION_MAJOR)
83#define G_TP_VERSION_MAJOR(x) \
84 (((x) >> S_TP_VERSION_MAJOR) & M_TP_VERSION_MAJOR)
86#define S_TP_VERSION_MINOR 8
87#define M_TP_VERSION_MINOR 0xFF
88#define V_TP_VERSION_MINOR(x) ((x) << S_TP_VERSION_MINOR)
89#define G_TP_VERSION_MINOR(x) \
90 (((x) >> S_TP_VERSION_MINOR) & M_TP_VERSION_MINOR)
92#define S_TP_VERSION_MICRO 0
93#define M_TP_VERSION_MICRO 0xFF
94#define V_TP_VERSION_MICRO(x) ((x) << S_TP_VERSION_MICRO)
95#define G_TP_VERSION_MICRO(x) \
96 (((x) >> S_TP_VERSION_MICRO) & M_TP_VERSION_MICRO)
137#ifndef SGE_NUM_GENBITS
139# define SGE_NUM_GENBITS 2
142#define TX_DESC_FLITS 16U
143#define WR_FLITS (TX_DESC_FLITS + 1 - SGE_NUM_GENBITS)
145#define MAX_PHYINTRS 4
151 int reg_addr,
unsigned int *val);
153 int reg_addr,
unsigned int val);
444#define SPEED_INVALID 0xffff
445#define DUPLEX_INVALID 0xff
569 int *duplex,
int *fc);
586 int reg_addr,
unsigned int *val);
588 int reg_addr,
unsigned int val);
606 int phy_addr,
struct cphy_ops *phy_ops,
623#define MAC_STATS_ACCUM_SECS 180
626#define VSC_STATS_ACCUM_SECS 30
628#define XGM_REG(reg_addr, idx) \
629 ((reg_addr) + (idx) * (XGMAC0_1_BASE_ADDR - XGMAC0_0_BASE_ADDR))
638#ifndef PCI_VENDOR_ID_CHELSIO
639# define PCI_VENDOR_ID_CHELSIO 0x1425
642#define for_each_port(adapter, iter) \
643 for (iter = 0; iter < (adapter)->params.nports; ++iter)
645#define adapter_info(adap) ((adap)->params.info)
680 unsigned int offset);
682 int attempts,
int delay,
u32 *valp);
685 int polarity,
int attempts,
int delay)
721 u32 *data,
int byte_oriented);
772 unsigned int nroutes);
782 unsigned short beta[
NCCTRL_WIN],
unsigned short mtu_cap);
787 int filter_index,
int invert,
int enable);
789 int filter_index,
int *inverted,
int *enabled);
796 unsigned int start,
unsigned int n);
799 u32 *size,
void *data);
806 unsigned int size,
unsigned int token,
int gen,
809 u64 base_addr,
unsigned int size,
unsigned int esize,
810 unsigned int cong_thres,
int gen,
unsigned int cidx);
812 u64 base_addr,
unsigned int size,
813 unsigned int fl_thres,
int gen,
unsigned int cidx);
815 unsigned int size,
int rspq,
int ovfl_mode,
816 unsigned int credits,
unsigned int credit_thres);
826 unsigned int credits);
static int mdio_read(struct cphy *phy, int mmd, int reg, unsigned int *valp)
int t3_set_proto_sram(adapter_t *adap, const u8 *data)
int t3_get_up_ioqs(adapter_t *adapter, u32 *size, void *data)
void t3_disable_filters(adapter_t *adap)
void t3_query_trace_filter(adapter_t *adapter, struct trace_params *tp, int filter_index, int *inverted, int *enabled)
int t3_load_fw(adapter_t *adapter, const u8 *fw_data, unsigned int size)
void t3_set_reg_field(adapter_t *adap, unsigned int addr, u32 mask, u32 val)
int t3_mac_set_num_ucast(struct cmac *mac, unsigned char n)
int t3_ael2005_phy_prep(pinfo_t *pinfo, int phy_addr, const struct mdio_ops *mdio_ops)
void t3_tp_get_mib_stats(adapter_t *adap, struct tp_mib_stats *tps)
int t3_vsc7323_init(adapter_t *adap, int nports)
int t3_check_fw_version(adapter_t *adapter)
int t3_vsc8211_phy_prep(pinfo_t *pinfo, int phy_addr, const struct mdio_ops *mdio_ops)
int t3_sge_disable_fl(adapter_t *adapter, unsigned int id)
int t3_mdio_change_bits(struct cphy *phy, int mmd, int reg, unsigned int clear, unsigned int set)
void t3_read_hw_mtus(adapter_t *adap, unsigned short mtus[NMTUS])
int t3_seeprom_read(adapter_t *adapter, u32 addr, u32 *data)
int t3_get_fw_version(adapter_t *adapter, u32 *vers)
void t3_mac_disable_exact_filters(struct cmac *mac)
int t3_vsc7323_enable(adapter_t *adap, int port, int which)
int t3_tp_set_coalescing_size(adapter_t *adap, unsigned int size, int psh)
void t3_sge_prep(adapter_t *adap, struct sge_params *p)
int t3_slow_intr_handler(adapter_t *adapter)
void t3_mac_enable_exact_filters(struct cmac *mac)
static int is_10G(const adapter_t *adap)
int t3_get_up_la(adapter_t *adapter, u32 *stopped, u32 *index, u32 *size, void *data)
void t3_link_changed(adapter_t *adapter, int port_id)
static unsigned int core_ticks_per_usec(const adapter_t *adap)
int t3_qt2045_phy_prep(pinfo_t *pinfo, int phy_addr, const struct mdio_ops *mdio_ops)
static unsigned int t3_mc7_size(const struct mc7 *p)
int t3_read_mc5_range(const struct mc5 *mc5, unsigned int start, unsigned int n, u32 *buf)
int t3_sge_read_cq(adapter_t *adapter, unsigned int id, u32 data[4])
void t3_write_regs(adapter_t *adapter, const struct addr_val_pair *p, int n, unsigned int offset)
void t3_failover_done(adapter_t *adapter, int port)
int t3_phy_reset(struct cphy *phy, int mmd, int wait)
int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu)
int t3_vsc7323_set_mtu(adapter_t *adap, unsigned int mtu, int port)
int t3_mac_set_speed_duplex_fc(struct cmac *mac, int speed, int duplex, int fc)
int t3_sge_init_ecntxt(adapter_t *adapter, unsigned int id, int gts_enable, enum sge_context_type type, int respq, u64 base_addr, unsigned int size, unsigned int token, int gen, unsigned int cidx)
int t3_vsc7323_disable(adapter_t *adap, int port, int which)
int t3_seeprom_write(adapter_t *adapter, u32 addr, u32 data)
int t3_reset_adapter(adapter_t *adapter)
int t3_vsc7323_set_speed_fc(adapter_t *adap, int speed, int fc, int port)
int t3_mac_set_address(struct cmac *mac, unsigned int idx, u8 addr[6])
int t3_i2c_read8(adapter_t *adapter, int chained, u8 *valp)
void t3_enable_filters(adapter_t *adap)
int t3_i2c_write8(adapter_t *adapter, int chained, u8 val)
int t3_ael1002_phy_prep(pinfo_t *pinfo, int phy_addr, const struct mdio_ops *mdio_ops)
void t3_mc5_prep(adapter_t *adapter, struct mc5 *mc5, int mode)
int t3_read_vpd(adapter_t *adapter, struct generic_vpd *vpd)
int t3_mac_enable(struct cmac *mac, int which)
int t3_aq100x_phy_prep(pinfo_t *pinfo, int phy_addr, const struct mdio_ops *mdio_ops)
void t3_port_intr_disable(adapter_t *adapter, int idx)
int t3_ael2020_phy_prep(pinfo_t *pinfo, int phy_addr, const struct mdio_ops *mdio_ops)
static unsigned int t3_mc5_size(const struct mc5 *p)
int t3_link_start(struct cphy *phy, struct cmac *mac, struct link_config *lc)
static int uses_xaui(const adapter_t *adap)
int t3_sge_cqcntxt_op(adapter_t *adapter, unsigned int id, unsigned int op, unsigned int credits)
int t3_mac_init(struct cmac *mac)
int t3_mi1_read(adapter_t *adapter, int phy_addr, int mmd_addr, int reg_addr, unsigned int *valp)
int t3_ael1006_phy_prep(pinfo_t *pinfo, int phy_addr, const struct mdio_ops *mdio_ops)
void t3_read_pace_tbl(adapter_t *adap, unsigned int pace_vals[NTX_SCHED])
void t3_failover_clear(adapter_t *adapter)
void early_hw_init(adapter_t *adapter, const struct adapter_info *ai)
void t3_intr_clear(adapter_t *adapter)
int t3_sge_init_rspcntxt(adapter_t *adapter, unsigned int id, int irq_vec_idx, u64 base_addr, unsigned int size, unsigned int fl_thres, int gen, unsigned int cidx)
int t3_mps_set_active_ports(adapter_t *adap, unsigned int port_mask)
int t3_mac_disable(struct cmac *mac, int which)
int t3_phy_lasi_intr_handler(struct cphy *phy)
int t3_sge_read_rspq(adapter_t *adapter, unsigned int id, u32 data[4])
static int is_offload(const adapter_t *adap)
int t3_sge_read_fl(adapter_t *adapter, unsigned int id, u32 data[4])
int t3_mc5_init(struct mc5 *mc5, unsigned int nservers, unsigned int nfilters, unsigned int nroutes)
@ cphy_cause_module_change
static unsigned int is_pcie(const adapter_t *adap)
int t3_phy_lasi_intr_clear(struct cphy *phy)
int t3_init_hw(adapter_t *adapter, u32 fw_params)
void t3_get_cong_cntl_tab(adapter_t *adap, unsigned short incr[NMTUS][NCCTRL_WIN])
int t3_sge_read_ecntxt(adapter_t *adapter, unsigned int id, u32 data[4])
void t3_config_trace_filter(adapter_t *adapter, const struct trace_params *tp, int filter_index, int invert, int enable)
const struct mac_stats * t3_vsc7323_update_stats(struct cmac *mac)
int t3_prep_adapter(adapter_t *adapter, const struct adapter_info *ai, int reset)
int t3_set_sched_ipg(adapter_t *adap, int sched, unsigned int ipg)
int t3_phy_advertise(struct cphy *phy, unsigned int advert)
int t3_check_tpsram(adapter_t *adapter, const u8 *tp_ram, unsigned int size)
void t3_port_intr_enable(adapter_t *adapter, int idx)
int t3_xaui_direct_phy_prep(pinfo_t *pinfo, int phy_addr, const struct mdio_ops *mdio_ops)
int t3_get_vpd_len(adapter_t *adapter, struct generic_vpd *vpd)
void t3_intr_enable(adapter_t *adapter)
static int t3_wait_op_done(adapter_t *adapter, int reg, u32 mask, int polarity, int attempts, int delay)
int t3_cim_ctl_blk_read(adapter_t *adap, unsigned int addr, unsigned int n, unsigned int *valp)
void t3_xgm_intr_disable(adapter_t *adapter, int idx)
#define adapter_info(adap)
void t3_mc5_intr_handler(struct mc5 *mc5)
int t3_sge_disable_cqcntxt(adapter_t *adapter, unsigned int id)
@ phy_modtype_twinax_long
void t3_port_failover(adapter_t *adapter, int port)
static int mdio_write(struct cphy *phy, int mmd, int reg, unsigned int val)
int t3_vsc8211_fifo_depth(adapter_t *adap, unsigned int mtu, int port)
void t3c_pcs_force_los(struct cmac *mac)
int t3_phy_lasi_intr_enable(struct cphy *phy)
void t3_xgm_intr_enable(adapter_t *adapter, int idx)
int t3_phy_advertise_fiber(struct cphy *phy, unsigned int advert)
void t3_get_tx_sched(adapter_t *adap, unsigned int sched, unsigned int *kbps, unsigned int *ipg)
int t3_check_tpsram_version(adapter_t *adapter)
int t3_load_boot(adapter_t *adapter, u8 *fw_data, unsigned int size)
int t3_sge_enable_ecntxt(adapter_t *adapter, unsigned int id, int enable)
void t3_config_rss(adapter_t *adapter, unsigned int rss_config, const u8 *cpus, const u16 *rspq)
void t3_led_ready(adapter_t *adapter)
int t3_elmr_blk_write(adapter_t *adap, int start, const u32 *vals, int n)
int t3_phy_lasi_intr_disable(struct cphy *phy)
void t3_fatal_err(adapter_t *adapter)
void t3_sge_init(adapter_t *adap, struct sge_params *p)
int t3_vsc7323_set_addr(adapter_t *adap, u8 addr[6], int port)
void t3_set_pace_tbl(adapter_t *adap, unsigned int *pace_vals, unsigned int start, unsigned int n)
const struct mac_stats * t3_mac_update_stats(struct cmac *mac)
void mac_prep(struct cmac *mac, adapter_t *adapter, int index)
@ PCI_VARIANT_PCIX_MODE1_PARITY
@ PCI_VARIANT_PCIX_266_MODE2
@ PCI_VARIANT_PCIX_MODE1_ECC
int t3_config_sched(adapter_t *adap, unsigned int kbps, int sched)
int t3_wait_op_done_val(adapter_t *adapter, int reg, u32 mask, int polarity, int attempts, int delay, u32 *valp)
void t3b_pcs_reset(struct cmac *mac)
int t3_mi1_write(adapter_t *adapter, int phy_addr, int mmd_addr, int reg_addr, unsigned int val)
int t3_sge_init_flcntxt(adapter_t *adapter, unsigned int id, int gts_enable, u64 base_addr, unsigned int size, unsigned int esize, unsigned int cong_thres, int gen, unsigned int cidx)
int t3_mac_set_rx_mode(struct cmac *mac, struct t3_rx_mode *rm)
int t3_elmr_blk_read(adapter_t *adap, int start, u32 *vals, int n)
void t3_tp_set_max_rxsize(adapter_t *adap, unsigned int size)
int t3_read_rss(adapter_t *adapter, u8 *lkup, u16 *map)
int t3_set_phy_speed_duplex(struct cphy *phy, int speed, int duplex)
int t3_mc7_bd_read(struct mc7 *mc7, unsigned int start, unsigned int n, u64 *buf)
int t3_get_tp_version(adapter_t *adapter, u32 *vers)
const struct adapter_info * t3_get_adapter_info(unsigned int board_id)
int t3_reinit_adapter(adapter_t *adap)
int t3_mv88e1xxx_phy_prep(pinfo_t *pinfo, int phy_addr, const struct mdio_ops *mdio_ops)
static unsigned int dack_ticks_to_usec(const adapter_t *adap, unsigned int ticks)
void t3_load_mtus(adapter_t *adap, unsigned short mtus[NMTUS], unsigned short alpha[NCCTRL_WIN], unsigned short beta[NCCTRL_WIN], unsigned short mtu_cap)
int t3_tn1010_phy_prep(pinfo_t *pinfo, int phy_addr, const struct mdio_ops *mdio_ops)
int t3_sge_init_cqcntxt(adapter_t *adapter, unsigned int id, u64 base_addr, unsigned int size, int rspq, int ovfl_mode, unsigned int credits, unsigned int credit_thres)
int t3_read_flash(adapter_t *adapter, unsigned int addr, unsigned int nwords, u32 *data, int byte_oriented)
void t3_set_vlan_accel(adapter_t *adapter, unsigned int ports, int on)
int t3b2_mac_watchdog_task(struct cmac *mac)
static void cphy_init(struct cphy *phy, adapter_t *adapter, pinfo_t *pinfo, int phy_addr, struct cphy_ops *phy_ops, const struct mdio_ops *mdio_ops, unsigned int caps, const char *desc)
int t3_sge_disable_rspcntxt(adapter_t *adapter, unsigned int id)
void t3_intr_disable(adapter_t *adapter)
void t3_tp_set_offload_mode(adapter_t *adap, int enable)
int t3_seeprom_wp(adapter_t *adapter, int enable)
void t3_port_intr_clear(adapter_t *adapter, int idx)
#define SUPPORTED_10000baseT_Full
unsigned char gpio_intr[MAX_PHYINTRS]
const struct mdio_ops * mdio_ops
unsigned char phy_base_addr
unsigned int stats_update_period
unsigned short a_wnd[NCCTRL_WIN]
unsigned short mtus[NMTUS]
const struct adapter_info * info
unsigned int linkpoll_period
unsigned short b_wnd[NCCTRL_WIN]
struct adapter_params params
unsigned char promisc_map
int(* set_loopback)(struct cphy *phy, int mmd, int dir, int enable)
int(* power_down)(struct cphy *phy, int enable)
int(* reset)(struct cphy *phy, int wait)
int(* autoneg_restart)(struct cphy *phy)
int(* intr_disable)(struct cphy *phy)
int(* intr_handler)(struct cphy *phy)
int(* intr_enable)(struct cphy *phy)
int(* advertise)(struct cphy *phy, unsigned int advertise_map)
int(* set_speed_duplex)(struct cphy *phy, int speed, int duplex)
int(* autoneg_enable)(struct cphy *phy)
int(* intr_clear)(struct cphy *phy)
int(* get_link_status)(struct cphy *phy, int *link_state, int *speed, int *duplex, int *fc)
int(* mdio_read)(adapter_t *adapter, int phy_addr, int mmd_addr, int reg_addr, unsigned int *val)
int(* mdio_write)(adapter_t *adapter, int phy_addr, int mmd_addr, int reg_addr, unsigned int val)
const struct cphy_ops * ops
unsigned long fifo_errors
unsigned char requested_duplex
unsigned short requested_speed
unsigned char requested_fc
unsigned long rx_fifo_ovfl
unsigned long num_toggled
unsigned long xaui_pcs_align_change
unsigned long tx_fifo_parity_err
unsigned long link_faults
unsigned long xaui_pcs_ctc_err
unsigned long rx_fifo_parity_err
unsigned long serdes_signal_loss
unsigned long tx_fifo_urun
unsigned long nfa_srch_err
unsigned long del_act_empty
unsigned long dispq_parity_err
unsigned long unknown_cmd
unsigned long reqq_parity_err
unsigned long active_rgn_full
unsigned char parity_enabled
int(* write)(adapter_t *adapter, int phy_addr, int mmd_addr, int reg_addr, unsigned int val)
int(* read)(adapter_t *adapter, int phy_addr, int mmd_addr, int reg_addr, unsigned int *val)
unsigned int vpd_cap_addr
unsigned int pcie_cap_addr
unsigned int coalesce_usecs
unsigned int jumbo_buf_size
unsigned int txq_size[SGE_TXQ_PER_SET]
struct qset_params qset[SGE_QSETS]
unsigned int max_pkt_size
unsigned int chan_tx_size
unsigned int chan_rx_size
unsigned short xauicfg[2]