common.h revision 228561
1218792Snp/*- 2218792Snp * Copyright (c) 2011 Chelsio Communications, Inc. 3218792Snp * All rights reserved. 4218792Snp * 5218792Snp * Redistribution and use in source and binary forms, with or without 6218792Snp * modification, are permitted provided that the following conditions 7218792Snp * are met: 8218792Snp * 1. Redistributions of source code must retain the above copyright 9218792Snp * notice, this list of conditions and the following disclaimer. 10218792Snp * 2. Redistributions in binary form must reproduce the above copyright 11218792Snp * notice, this list of conditions and the following disclaimer in the 12218792Snp * documentation and/or other materials provided with the distribution. 13218792Snp * 14218792Snp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15218792Snp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16218792Snp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17218792Snp * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18218792Snp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19218792Snp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20218792Snp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21218792Snp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22218792Snp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23218792Snp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24218792Snp * SUCH DAMAGE. 25218792Snp * 26218792Snp * $FreeBSD: head/sys/dev/cxgbe/common/common.h 228561 2011-12-16 02:09:51Z np $ 27218792Snp * 28218792Snp */ 29218792Snp 30218792Snp#ifndef __CHELSIO_COMMON_H 31218792Snp#define __CHELSIO_COMMON_H 32218792Snp 33218792Snp#include "t4_hw.h" 34218792Snp 35218792Snp 36218792Snpenum { 37218792Snp MAX_NPORTS = 4, /* max # of ports */ 38218792Snp SERNUM_LEN = 24, /* Serial # length */ 39218792Snp EC_LEN = 16, /* E/C length */ 40218792Snp ID_LEN = 16, /* ID length */ 41218792Snp}; 42218792Snp 43218792Snpenum { MEM_EDC0, MEM_EDC1, MEM_MC }; 44218792Snp 45228561Snpenum { 46228561Snp MEMWIN0_APERTURE = 2048, 47228561Snp MEMWIN0_BASE = 0x1b800, 48228561Snp MEMWIN1_APERTURE = 32768, 49228561Snp MEMWIN1_BASE = 0x28000, 50228561Snp MEMWIN2_APERTURE = 65536, 51228561Snp MEMWIN2_BASE = 0x30000, 52228561Snp}; 53228561Snp 54218792Snpenum dev_master { MASTER_CANT, MASTER_MAY, MASTER_MUST }; 55218792Snp 56218792Snpenum dev_state { DEV_STATE_UNINIT, DEV_STATE_INIT, DEV_STATE_ERR }; 57218792Snp 58218792Snpenum { 59218792Snp PAUSE_RX = 1 << 0, 60218792Snp PAUSE_TX = 1 << 1, 61218792Snp PAUSE_AUTONEG = 1 << 2 62218792Snp}; 63218792Snp 64218792Snp#define FW_VERSION_MAJOR 1 65228561Snp#define FW_VERSION_MINOR 4 66228561Snp#define FW_VERSION_MICRO 16 67218792Snp 68218792Snpstruct port_stats { 69218792Snp u64 tx_octets; /* total # of octets in good frames */ 70218792Snp u64 tx_frames; /* all good frames */ 71218792Snp u64 tx_bcast_frames; /* all broadcast frames */ 72218792Snp u64 tx_mcast_frames; /* all multicast frames */ 73218792Snp u64 tx_ucast_frames; /* all unicast frames */ 74218792Snp u64 tx_error_frames; /* all error frames */ 75218792Snp 76218792Snp u64 tx_frames_64; /* # of Tx frames in a particular range */ 77218792Snp u64 tx_frames_65_127; 78218792Snp u64 tx_frames_128_255; 79218792Snp u64 tx_frames_256_511; 80218792Snp u64 tx_frames_512_1023; 81218792Snp u64 tx_frames_1024_1518; 82218792Snp u64 tx_frames_1519_max; 83218792Snp 84218792Snp u64 tx_drop; /* # of dropped Tx frames */ 85218792Snp u64 tx_pause; /* # of transmitted pause frames */ 86218792Snp u64 tx_ppp0; /* # of transmitted PPP prio 0 frames */ 87218792Snp u64 tx_ppp1; /* # of transmitted PPP prio 1 frames */ 88218792Snp u64 tx_ppp2; /* # of transmitted PPP prio 2 frames */ 89218792Snp u64 tx_ppp3; /* # of transmitted PPP prio 3 frames */ 90218792Snp u64 tx_ppp4; /* # of transmitted PPP prio 4 frames */ 91218792Snp u64 tx_ppp5; /* # of transmitted PPP prio 5 frames */ 92218792Snp u64 tx_ppp6; /* # of transmitted PPP prio 6 frames */ 93218792Snp u64 tx_ppp7; /* # of transmitted PPP prio 7 frames */ 94218792Snp 95218792Snp u64 rx_octets; /* total # of octets in good frames */ 96218792Snp u64 rx_frames; /* all good frames */ 97218792Snp u64 rx_bcast_frames; /* all broadcast frames */ 98218792Snp u64 rx_mcast_frames; /* all multicast frames */ 99218792Snp u64 rx_ucast_frames; /* all unicast frames */ 100218792Snp u64 rx_too_long; /* # of frames exceeding MTU */ 101218792Snp u64 rx_jabber; /* # of jabber frames */ 102218792Snp u64 rx_fcs_err; /* # of received frames with bad FCS */ 103218792Snp u64 rx_len_err; /* # of received frames with length error */ 104218792Snp u64 rx_symbol_err; /* symbol errors */ 105218792Snp u64 rx_runt; /* # of short frames */ 106218792Snp 107218792Snp u64 rx_frames_64; /* # of Rx frames in a particular range */ 108218792Snp u64 rx_frames_65_127; 109218792Snp u64 rx_frames_128_255; 110218792Snp u64 rx_frames_256_511; 111218792Snp u64 rx_frames_512_1023; 112218792Snp u64 rx_frames_1024_1518; 113218792Snp u64 rx_frames_1519_max; 114218792Snp 115218792Snp u64 rx_pause; /* # of received pause frames */ 116218792Snp u64 rx_ppp0; /* # of received PPP prio 0 frames */ 117218792Snp u64 rx_ppp1; /* # of received PPP prio 1 frames */ 118218792Snp u64 rx_ppp2; /* # of received PPP prio 2 frames */ 119218792Snp u64 rx_ppp3; /* # of received PPP prio 3 frames */ 120218792Snp u64 rx_ppp4; /* # of received PPP prio 4 frames */ 121218792Snp u64 rx_ppp5; /* # of received PPP prio 5 frames */ 122218792Snp u64 rx_ppp6; /* # of received PPP prio 6 frames */ 123218792Snp u64 rx_ppp7; /* # of received PPP prio 7 frames */ 124218792Snp 125218792Snp u64 rx_ovflow0; /* drops due to buffer-group 0 overflows */ 126218792Snp u64 rx_ovflow1; /* drops due to buffer-group 1 overflows */ 127218792Snp u64 rx_ovflow2; /* drops due to buffer-group 2 overflows */ 128218792Snp u64 rx_ovflow3; /* drops due to buffer-group 3 overflows */ 129218792Snp u64 rx_trunc0; /* buffer-group 0 truncated packets */ 130218792Snp u64 rx_trunc1; /* buffer-group 1 truncated packets */ 131218792Snp u64 rx_trunc2; /* buffer-group 2 truncated packets */ 132218792Snp u64 rx_trunc3; /* buffer-group 3 truncated packets */ 133218792Snp}; 134218792Snp 135218792Snpstruct lb_port_stats { 136218792Snp u64 octets; 137218792Snp u64 frames; 138218792Snp u64 bcast_frames; 139218792Snp u64 mcast_frames; 140218792Snp u64 ucast_frames; 141218792Snp u64 error_frames; 142218792Snp 143218792Snp u64 frames_64; 144218792Snp u64 frames_65_127; 145218792Snp u64 frames_128_255; 146218792Snp u64 frames_256_511; 147218792Snp u64 frames_512_1023; 148218792Snp u64 frames_1024_1518; 149218792Snp u64 frames_1519_max; 150218792Snp 151218792Snp u64 drop; 152218792Snp 153218792Snp u64 ovflow0; 154218792Snp u64 ovflow1; 155218792Snp u64 ovflow2; 156218792Snp u64 ovflow3; 157218792Snp u64 trunc0; 158218792Snp u64 trunc1; 159218792Snp u64 trunc2; 160218792Snp u64 trunc3; 161218792Snp}; 162218792Snp 163218792Snpstruct tp_tcp_stats { 164218792Snp u32 tcpOutRsts; 165218792Snp u64 tcpInSegs; 166218792Snp u64 tcpOutSegs; 167218792Snp u64 tcpRetransSegs; 168218792Snp}; 169218792Snp 170218792Snpstruct tp_usm_stats { 171218792Snp u32 frames; 172218792Snp u32 drops; 173218792Snp u64 octets; 174218792Snp}; 175218792Snp 176218792Snpstruct tp_fcoe_stats { 177218792Snp u32 framesDDP; 178218792Snp u32 framesDrop; 179218792Snp u64 octetsDDP; 180218792Snp}; 181218792Snp 182218792Snpstruct tp_err_stats { 183218792Snp u32 macInErrs[4]; 184218792Snp u32 hdrInErrs[4]; 185218792Snp u32 tcpInErrs[4]; 186218792Snp u32 tnlCongDrops[4]; 187218792Snp u32 ofldChanDrops[4]; 188218792Snp u32 tnlTxDrops[4]; 189218792Snp u32 ofldVlanDrops[4]; 190218792Snp u32 tcp6InErrs[4]; 191218792Snp u32 ofldNoNeigh; 192218792Snp u32 ofldCongDefer; 193218792Snp}; 194218792Snp 195218792Snpstruct tp_proxy_stats { 196218792Snp u32 proxy[4]; 197218792Snp}; 198218792Snp 199218792Snpstruct tp_cpl_stats { 200218792Snp u32 req[4]; 201218792Snp u32 rsp[4]; 202218792Snp}; 203218792Snp 204218792Snpstruct tp_rdma_stats { 205218792Snp u32 rqe_dfr_mod; 206218792Snp u32 rqe_dfr_pkt; 207218792Snp}; 208218792Snp 209218792Snpstruct tp_params { 210218792Snp unsigned int ntxchan; /* # of Tx channels */ 211218792Snp unsigned int tre; /* log2 of core clocks per TP tick */ 212218792Snp unsigned int dack_re; /* DACK timer resolution */ 213218792Snp unsigned int la_mask; /* what events are recorded by TP LA */ 214218792Snp unsigned short tx_modq[NCHAN]; /* channel to modulation queue map */ 215218792Snp}; 216218792Snp 217218792Snpstruct vpd_params { 218218792Snp unsigned int cclk; 219218792Snp u8 ec[EC_LEN + 1]; 220218792Snp u8 sn[SERNUM_LEN + 1]; 221218792Snp u8 id[ID_LEN + 1]; 222218792Snp}; 223218792Snp 224218792Snpstruct pci_params { 225228561Snp unsigned int vpd_cap_addr; 226228561Snp unsigned short speed; 227228561Snp unsigned short width; 228218792Snp}; 229218792Snp 230218792Snp/* 231218792Snp * Firmware device log. 232218792Snp */ 233218792Snpstruct devlog_params { 234218792Snp u32 memtype; /* which memory (EDC0, EDC1, MC) */ 235218792Snp u32 start; /* start of log in firmware memory */ 236218792Snp u32 size; /* size of log */ 237218792Snp}; 238218792Snp 239218792Snpstruct adapter_params { 240218792Snp struct tp_params tp; 241218792Snp struct vpd_params vpd; 242218792Snp struct pci_params pci; 243218792Snp struct devlog_params devlog; 244218792Snp 245218792Snp unsigned int sf_size; /* serial flash size in bytes */ 246218792Snp unsigned int sf_nsec; /* # of flash sectors */ 247218792Snp 248218792Snp unsigned int fw_vers; 249218792Snp unsigned int tp_vers; 250218792Snp 251218792Snp unsigned short mtus[NMTUS]; 252218792Snp unsigned short a_wnd[NCCTRL_WIN]; 253218792Snp unsigned short b_wnd[NCCTRL_WIN]; 254218792Snp 255228561Snp unsigned int mc_size; /* MC memory size */ 256228561Snp unsigned int nfilters; /* size of filter region */ 257218792Snp 258218792Snp unsigned int cim_la_size; 259218792Snp 260228561Snp /* Used as int in sysctls, do not reduce size */ 261228561Snp unsigned int nports; /* # of ethernet ports */ 262218792Snp unsigned int portvec; 263228561Snp unsigned int rev; /* chip revision */ 264218792Snp unsigned int offload; 265218792Snp 266218792Snp unsigned int ofldq_wr_cred; 267218792Snp}; 268218792Snp 269218792Snpenum { /* chip revisions */ 270218792Snp T4_REV_A = 0, 271218792Snp}; 272218792Snp 273218792Snpstruct trace_params { 274218792Snp u32 data[TRACE_LEN / 4]; 275218792Snp u32 mask[TRACE_LEN / 4]; 276218792Snp unsigned short snap_len; 277218792Snp unsigned short min_len; 278218792Snp unsigned char skip_ofst; 279218792Snp unsigned char skip_len; 280218792Snp unsigned char invert; 281218792Snp unsigned char port; 282218792Snp}; 283218792Snp 284218792Snpstruct link_config { 285218792Snp unsigned short supported; /* link capabilities */ 286218792Snp unsigned short advertising; /* advertised capabilities */ 287218792Snp unsigned short requested_speed; /* speed user has requested */ 288218792Snp unsigned short speed; /* actual link speed */ 289218792Snp unsigned char requested_fc; /* flow control user has requested */ 290218792Snp unsigned char fc; /* actual link flow control */ 291218792Snp unsigned char autoneg; /* autonegotiating? */ 292218792Snp unsigned char link_ok; /* link up? */ 293218792Snp}; 294218792Snp 295218792Snp#include "adapter.h" 296218792Snp 297218792Snp#ifndef PCI_VENDOR_ID_CHELSIO 298218792Snp# define PCI_VENDOR_ID_CHELSIO 0x1425 299218792Snp#endif 300218792Snp 301218792Snp#define for_each_port(adapter, iter) \ 302218792Snp for (iter = 0; iter < (adapter)->params.nports; ++iter) 303218792Snp 304218792Snpstatic inline int is_offload(const struct adapter *adap) 305218792Snp{ 306218792Snp return adap->params.offload; 307218792Snp} 308218792Snp 309218792Snpstatic inline unsigned int core_ticks_per_usec(const struct adapter *adap) 310218792Snp{ 311218792Snp return adap->params.vpd.cclk / 1000; 312218792Snp} 313218792Snp 314218792Snpstatic inline unsigned int us_to_core_ticks(const struct adapter *adap, 315218792Snp unsigned int us) 316218792Snp{ 317218792Snp return (us * adap->params.vpd.cclk) / 1000; 318218792Snp} 319218792Snp 320218792Snpstatic inline unsigned int dack_ticks_to_usec(const struct adapter *adap, 321218792Snp unsigned int ticks) 322218792Snp{ 323218792Snp return (ticks << adap->params.tp.dack_re) / core_ticks_per_usec(adap); 324218792Snp} 325218792Snp 326218792Snpvoid t4_set_reg_field(struct adapter *adap, unsigned int addr, u32 mask, u32 val); 327218792Snpint t4_wait_op_done_val(struct adapter *adapter, int reg, u32 mask, int polarity, 328218792Snp int attempts, int delay, u32 *valp); 329218792Snp 330218792Snpstatic inline int t4_wait_op_done(struct adapter *adapter, int reg, u32 mask, 331218792Snp int polarity, int attempts, int delay) 332218792Snp{ 333218792Snp return t4_wait_op_done_val(adapter, reg, mask, polarity, attempts, 334218792Snp delay, NULL); 335218792Snp} 336218792Snp 337218792Snpint t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size, 338218792Snp void *rpl, bool sleep_ok); 339218792Snp 340218792Snpstatic inline int t4_wr_mbox(struct adapter *adap, int mbox, const void *cmd, 341218792Snp int size, void *rpl) 342218792Snp{ 343218792Snp return t4_wr_mbox_meat(adap, mbox, cmd, size, rpl, true); 344218792Snp} 345218792Snp 346218792Snpstatic inline int t4_wr_mbox_ns(struct adapter *adap, int mbox, const void *cmd, 347218792Snp int size, void *rpl) 348218792Snp{ 349218792Snp return t4_wr_mbox_meat(adap, mbox, cmd, size, rpl, false); 350218792Snp} 351218792Snp 352218792Snpvoid t4_read_indirect(struct adapter *adap, unsigned int addr_reg, 353218792Snp unsigned int data_reg, u32 *vals, unsigned int nregs, 354218792Snp unsigned int start_idx); 355218792Snpvoid t4_write_indirect(struct adapter *adap, unsigned int addr_reg, 356218792Snp unsigned int data_reg, const u32 *vals, 357218792Snp unsigned int nregs, unsigned int start_idx); 358218792Snp 359218792Snpstruct fw_filter_wr; 360218792Snp 361218792Snpvoid t4_intr_enable(struct adapter *adapter); 362218792Snpvoid t4_intr_disable(struct adapter *adapter); 363218792Snpvoid t4_intr_clear(struct adapter *adapter); 364218792Snpint t4_slow_intr_handler(struct adapter *adapter); 365218792Snp 366218792Snpint t4_hash_mac_addr(const u8 *addr); 367218792Snpint t4_link_start(struct adapter *adap, unsigned int mbox, unsigned int port, 368218792Snp struct link_config *lc); 369218792Snpint t4_restart_aneg(struct adapter *adap, unsigned int mbox, unsigned int port); 370218792Snpint t4_seeprom_read(struct adapter *adapter, u32 addr, u32 *data); 371218792Snpint t4_seeprom_write(struct adapter *adapter, u32 addr, u32 data); 372218792Snpint t4_eeprom_ptov(unsigned int phys_addr, unsigned int fn, unsigned int sz); 373218792Snpint t4_seeprom_wp(struct adapter *adapter, int enable); 374218792Snpint t4_read_flash(struct adapter *adapter, unsigned int addr, unsigned int nwords, 375218792Snp u32 *data, int byte_oriented); 376218792Snpint t4_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size); 377228561Snpint t4_load_boot(struct adapter *adap, const u8 *boot_data, 378228561Snp unsigned int boot_addr, unsigned int size); 379228561Snpunsigned int t4_flash_cfg_addr(struct adapter *adapter); 380218792Snpint t4_load_cfg(struct adapter *adapter, const u8 *cfg_data, unsigned int size); 381218792Snpint t4_get_fw_version(struct adapter *adapter, u32 *vers); 382218792Snpint t4_get_tp_version(struct adapter *adapter, u32 *vers); 383218792Snpint t4_check_fw_version(struct adapter *adapter); 384218792Snpint t4_init_hw(struct adapter *adapter, u32 fw_params); 385218792Snpint t4_prep_adapter(struct adapter *adapter); 386218792Snpint t4_port_init(struct port_info *p, int mbox, int pf, int vf); 387218792Snpint t4_reinit_adapter(struct adapter *adap); 388218792Snpvoid t4_fatal_err(struct adapter *adapter); 389218792Snpint t4_set_trace_filter(struct adapter *adapter, const struct trace_params *tp, 390218792Snp int filter_index, int enable); 391218792Snpvoid t4_get_trace_filter(struct adapter *adapter, struct trace_params *tp, 392218792Snp int filter_index, int *enabled); 393218792Snpint t4_config_rss_range(struct adapter *adapter, int mbox, unsigned int viid, 394218792Snp int start, int n, const u16 *rspq, unsigned int nrspq); 395218792Snpint t4_config_glbl_rss(struct adapter *adapter, int mbox, unsigned int mode, 396218792Snp unsigned int flags); 397218792Snpint t4_config_vi_rss(struct adapter *adapter, int mbox, unsigned int viid, 398218792Snp unsigned int flags, unsigned int defq); 399218792Snpint t4_read_rss(struct adapter *adapter, u16 *entries); 400218792Snpvoid t4_read_rss_key(struct adapter *adapter, u32 *key); 401218792Snpvoid t4_write_rss_key(struct adapter *adap, const u32 *key, int idx); 402218792Snpvoid t4_read_rss_pf_config(struct adapter *adapter, unsigned int index, u32 *valp); 403218792Snpvoid t4_write_rss_pf_config(struct adapter *adapter, unsigned int index, u32 val); 404218792Snpvoid t4_read_rss_vf_config(struct adapter *adapter, unsigned int index, 405218792Snp u32 *vfl, u32 *vfh); 406218792Snpvoid t4_write_rss_vf_config(struct adapter *adapter, unsigned int index, 407218792Snp u32 vfl, u32 vfh); 408218792Snpu32 t4_read_rss_pf_map(struct adapter *adapter); 409218792Snpvoid t4_write_rss_pf_map(struct adapter *adapter, u32 pfmap); 410218792Snpu32 t4_read_rss_pf_mask(struct adapter *adapter); 411218792Snpvoid t4_write_rss_pf_mask(struct adapter *adapter, u32 pfmask); 412218792Snpint t4_mps_set_active_ports(struct adapter *adap, unsigned int port_mask); 413218792Snpvoid t4_pmtx_get_stats(struct adapter *adap, u32 cnt[], u64 cycles[]); 414218792Snpvoid t4_pmrx_get_stats(struct adapter *adap, u32 cnt[], u64 cycles[]); 415218792Snpvoid t4_read_cimq_cfg(struct adapter *adap, u16 *base, u16 *size, u16 *thres); 416218792Snpint t4_read_cim_ibq(struct adapter *adap, unsigned int qid, u32 *data, size_t n); 417218792Snpint t4_read_cim_obq(struct adapter *adap, unsigned int qid, u32 *data, size_t n); 418218792Snpint t4_cim_read(struct adapter *adap, unsigned int addr, unsigned int n, 419218792Snp unsigned int *valp); 420218792Snpint t4_cim_write(struct adapter *adap, unsigned int addr, unsigned int n, 421218792Snp const unsigned int *valp); 422218792Snpint t4_cim_ctl_read(struct adapter *adap, unsigned int addr, unsigned int n, 423218792Snp unsigned int *valp); 424218792Snpint t4_cim_read_la(struct adapter *adap, u32 *la_buf, unsigned int *wrptr); 425218792Snpvoid t4_cim_read_pif_la(struct adapter *adap, u32 *pif_req, u32 *pif_rsp, 426218792Snp unsigned int *pif_req_wrptr, unsigned int *pif_rsp_wrptr); 427218792Snpvoid t4_cim_read_ma_la(struct adapter *adap, u32 *ma_req, u32 *ma_rsp); 428218792Snpint t4_mc_read(struct adapter *adap, u32 addr, __be32 *data, u64 *parity); 429218792Snpint t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, u64 *parity); 430218792Snpint t4_mem_read(struct adapter *adap, int mtype, u32 addr, u32 size, 431218792Snp __be32 *data); 432218792Snp 433218792Snpvoid t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p); 434218792Snpvoid t4_get_lb_stats(struct adapter *adap, int idx, struct lb_port_stats *p); 435218792Snpvoid t4_clr_port_stats(struct adapter *adap, int idx); 436218792Snp 437218792Snpvoid t4_read_mtu_tbl(struct adapter *adap, u16 *mtus, u8 *mtu_log); 438218792Snpvoid t4_read_cong_tbl(struct adapter *adap, u16 incr[NMTUS][NCCTRL_WIN]); 439218792Snpvoid t4_read_pace_tbl(struct adapter *adap, unsigned int pace_vals[NTX_SCHED]); 440218792Snpvoid t4_get_tx_sched(struct adapter *adap, unsigned int sched, unsigned int *kbps, 441218792Snp unsigned int *ipg); 442218792Snpvoid t4_tp_wr_bits_indirect(struct adapter *adap, unsigned int addr, 443218792Snp unsigned int mask, unsigned int val); 444218792Snpvoid t4_tp_read_la(struct adapter *adap, u64 *la_buf, unsigned int *wrptr); 445218792Snpvoid t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st); 446218792Snpvoid t4_tp_get_proxy_stats(struct adapter *adap, struct tp_proxy_stats *st); 447218792Snpvoid t4_tp_get_cpl_stats(struct adapter *adap, struct tp_cpl_stats *st); 448218792Snpvoid t4_tp_get_rdma_stats(struct adapter *adap, struct tp_rdma_stats *st); 449218792Snpvoid t4_get_usm_stats(struct adapter *adap, struct tp_usm_stats *st); 450218792Snpvoid t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4, 451218792Snp struct tp_tcp_stats *v6); 452218792Snpvoid t4_get_fcoe_stats(struct adapter *adap, unsigned int idx, 453218792Snp struct tp_fcoe_stats *st); 454218792Snpvoid t4_load_mtus(struct adapter *adap, const unsigned short *mtus, 455218792Snp const unsigned short *alpha, const unsigned short *beta); 456218792Snp 457218792Snpvoid t4_ulprx_read_la(struct adapter *adap, u32 *la_buf); 458218792Snp 459218792Snpint t4_set_sched_bps(struct adapter *adap, int sched, unsigned int kbps); 460218792Snpint t4_set_sched_ipg(struct adapter *adap, int sched, unsigned int ipg); 461218792Snpint t4_set_pace_tbl(struct adapter *adap, const unsigned int *pace_vals, 462218792Snp unsigned int start, unsigned int n); 463218792Snpvoid t4_get_chan_txrate(struct adapter *adap, u64 *nic_rate, u64 *ofld_rate); 464218792Snpint t4_set_filter_mode(struct adapter *adap, unsigned int mode_map); 465218792Snpvoid t4_mk_filtdelwr(unsigned int ftid, struct fw_filter_wr *wr, int qid); 466218792Snp 467218792Snpvoid t4_wol_magic_enable(struct adapter *adap, unsigned int port, const u8 *addr); 468218792Snpint t4_wol_pat_enable(struct adapter *adap, unsigned int port, unsigned int map, 469218792Snp u64 mask0, u64 mask1, unsigned int crc, bool enable); 470218792Snp 471218792Snpint t4_fw_hello(struct adapter *adap, unsigned int mbox, unsigned int evt_mbox, 472218792Snp enum dev_master master, enum dev_state *state); 473218792Snpint t4_fw_bye(struct adapter *adap, unsigned int mbox); 474218792Snpint t4_fw_reset(struct adapter *adap, unsigned int mbox, int reset); 475228561Snpint t4_fw_initialize(struct adapter *adap, unsigned int mbox); 476218792Snpint t4_query_params(struct adapter *adap, unsigned int mbox, unsigned int pf, 477218792Snp unsigned int vf, unsigned int nparams, const u32 *params, 478218792Snp u32 *val); 479218792Snpint t4_set_params(struct adapter *adap, unsigned int mbox, unsigned int pf, 480218792Snp unsigned int vf, unsigned int nparams, const u32 *params, 481218792Snp const u32 *val); 482218792Snpint t4_cfg_pfvf(struct adapter *adap, unsigned int mbox, unsigned int pf, 483218792Snp unsigned int vf, unsigned int txq, unsigned int txq_eth_ctrl, 484218792Snp unsigned int rxqi, unsigned int rxq, unsigned int tc, 485218792Snp unsigned int vi, unsigned int cmask, unsigned int pmask, 486218792Snp unsigned int exactf, unsigned int rcaps, unsigned int wxcaps); 487218792Snpint t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port, 488218792Snp unsigned int pf, unsigned int vf, unsigned int nmac, u8 *mac, 489218792Snp unsigned int *rss_size); 490218792Snpint t4_free_vi(struct adapter *adap, unsigned int mbox, 491218792Snp unsigned int pf, unsigned int vf, 492218792Snp unsigned int viid); 493218792Snpint t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid, 494218792Snp int mtu, int promisc, int all_multi, int bcast, int vlanex, 495218792Snp bool sleep_ok); 496218792Snpint t4_alloc_mac_filt(struct adapter *adap, unsigned int mbox, unsigned int viid, 497218792Snp bool free, unsigned int naddr, const u8 **addr, u16 *idx, 498218792Snp u64 *hash, bool sleep_ok); 499218792Snpint t4_change_mac(struct adapter *adap, unsigned int mbox, unsigned int viid, 500218792Snp int idx, const u8 *addr, bool persist, bool add_smt); 501218792Snpint t4_set_addr_hash(struct adapter *adap, unsigned int mbox, unsigned int viid, 502218792Snp bool ucast, u64 vec, bool sleep_ok); 503218792Snpint t4_enable_vi(struct adapter *adap, unsigned int mbox, unsigned int viid, 504218792Snp bool rx_en, bool tx_en); 505218792Snpint t4_identify_port(struct adapter *adap, unsigned int mbox, unsigned int viid, 506218792Snp unsigned int nblinks); 507218792Snpint t4_mdio_rd(struct adapter *adap, unsigned int mbox, unsigned int phy_addr, 508218792Snp unsigned int mmd, unsigned int reg, unsigned int *valp); 509218792Snpint t4_mdio_wr(struct adapter *adap, unsigned int mbox, unsigned int phy_addr, 510218792Snp unsigned int mmd, unsigned int reg, unsigned int val); 511218792Snpint t4_iq_start_stop(struct adapter *adap, unsigned int mbox, bool start, 512218792Snp unsigned int pf, unsigned int vf, unsigned int iqid, 513218792Snp unsigned int fl0id, unsigned int fl1id); 514218792Snpint t4_iq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, 515218792Snp unsigned int vf, unsigned int iqtype, unsigned int iqid, 516218792Snp unsigned int fl0id, unsigned int fl1id); 517218792Snpint t4_eth_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, 518218792Snp unsigned int vf, unsigned int eqid); 519218792Snpint t4_ctrl_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, 520218792Snp unsigned int vf, unsigned int eqid); 521218792Snpint t4_ofld_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, 522218792Snp unsigned int vf, unsigned int eqid); 523218792Snpint t4_sge_ctxt_rd(struct adapter *adap, unsigned int mbox, unsigned int cid, 524218792Snp enum ctxt_type ctype, u32 *data); 525218792Snpint t4_sge_ctxt_rd_bd(struct adapter *adap, unsigned int cid, enum ctxt_type ctype, 526218792Snp u32 *data); 527218792Snpint t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl); 528218792Snp#endif /* __CHELSIO_COMMON_H */ 529