cxgb4.h 36 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052
  1. /*
  2. * This file is part of the Chelsio T4 Ethernet driver for Linux.
  3. *
  4. * Copyright (c) 2003-2010 Chelsio Communications, Inc. All rights reserved.
  5. *
  6. * This software is available to you under a choice of one of two
  7. * licenses. You may choose to be licensed under the terms of the GNU
  8. * General Public License (GPL) Version 2, available from the file
  9. * COPYING in the main directory of this source tree, or the
  10. * OpenIB.org BSD license below:
  11. *
  12. * Redistribution and use in source and binary forms, with or
  13. * without modification, are permitted provided that the following
  14. * conditions are met:
  15. *
  16. * - Redistributions of source code must retain the above
  17. * copyright notice, this list of conditions and the following
  18. * disclaimer.
  19. *
  20. * - Redistributions in binary form must reproduce the above
  21. * copyright notice, this list of conditions and the following
  22. * disclaimer in the documentation and/or other materials
  23. * provided with the distribution.
  24. *
  25. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  26. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  27. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  28. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  29. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  30. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  31. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  32. * SOFTWARE.
  33. */
  34. #ifndef __CXGB4_H__
  35. #define __CXGB4_H__
  36. #include "t4_hw.h"
  37. #include <linux/bitops.h>
  38. #include <linux/cache.h>
  39. #include <linux/interrupt.h>
  40. #include <linux/list.h>
  41. #include <linux/netdevice.h>
  42. #include <linux/pci.h>
  43. #include <linux/spinlock.h>
  44. #include <linux/timer.h>
  45. #include <linux/vmalloc.h>
  46. #include <asm/io.h>
  47. #include "cxgb4_uld.h"
  48. #define T4FW_VERSION_MAJOR 0x01
  49. #define T4FW_VERSION_MINOR 0x09
  50. #define T4FW_VERSION_MICRO 0x17
  51. #define T4FW_VERSION_BUILD 0x00
  52. #define T5FW_VERSION_MAJOR 0x01
  53. #define T5FW_VERSION_MINOR 0x09
  54. #define T5FW_VERSION_MICRO 0x17
  55. #define T5FW_VERSION_BUILD 0x00
  56. #define CH_WARN(adap, fmt, ...) dev_warn(adap->pdev_dev, fmt, ## __VA_ARGS__)
  57. enum {
  58. MAX_NPORTS = 4, /* max # of ports */
  59. SERNUM_LEN = 24, /* Serial # length */
  60. EC_LEN = 16, /* E/C length */
  61. ID_LEN = 16, /* ID length */
  62. PN_LEN = 16, /* Part Number length */
  63. };
  64. enum {
  65. MEM_EDC0,
  66. MEM_EDC1,
  67. MEM_MC,
  68. MEM_MC0 = MEM_MC,
  69. MEM_MC1
  70. };
  71. enum {
  72. MEMWIN0_APERTURE = 2048,
  73. MEMWIN0_BASE = 0x1b800,
  74. MEMWIN1_APERTURE = 32768,
  75. MEMWIN1_BASE = 0x28000,
  76. MEMWIN1_BASE_T5 = 0x52000,
  77. MEMWIN2_APERTURE = 65536,
  78. MEMWIN2_BASE = 0x30000,
  79. MEMWIN2_BASE_T5 = 0x54000,
  80. };
  81. enum dev_master {
  82. MASTER_CANT,
  83. MASTER_MAY,
  84. MASTER_MUST
  85. };
  86. enum dev_state {
  87. DEV_STATE_UNINIT,
  88. DEV_STATE_INIT,
  89. DEV_STATE_ERR
  90. };
  91. enum {
  92. PAUSE_RX = 1 << 0,
  93. PAUSE_TX = 1 << 1,
  94. PAUSE_AUTONEG = 1 << 2
  95. };
  96. struct port_stats {
  97. u64 tx_octets; /* total # of octets in good frames */
  98. u64 tx_frames; /* all good frames */
  99. u64 tx_bcast_frames; /* all broadcast frames */
  100. u64 tx_mcast_frames; /* all multicast frames */
  101. u64 tx_ucast_frames; /* all unicast frames */
  102. u64 tx_error_frames; /* all error frames */
  103. u64 tx_frames_64; /* # of Tx frames in a particular range */
  104. u64 tx_frames_65_127;
  105. u64 tx_frames_128_255;
  106. u64 tx_frames_256_511;
  107. u64 tx_frames_512_1023;
  108. u64 tx_frames_1024_1518;
  109. u64 tx_frames_1519_max;
  110. u64 tx_drop; /* # of dropped Tx frames */
  111. u64 tx_pause; /* # of transmitted pause frames */
  112. u64 tx_ppp0; /* # of transmitted PPP prio 0 frames */
  113. u64 tx_ppp1; /* # of transmitted PPP prio 1 frames */
  114. u64 tx_ppp2; /* # of transmitted PPP prio 2 frames */
  115. u64 tx_ppp3; /* # of transmitted PPP prio 3 frames */
  116. u64 tx_ppp4; /* # of transmitted PPP prio 4 frames */
  117. u64 tx_ppp5; /* # of transmitted PPP prio 5 frames */
  118. u64 tx_ppp6; /* # of transmitted PPP prio 6 frames */
  119. u64 tx_ppp7; /* # of transmitted PPP prio 7 frames */
  120. u64 rx_octets; /* total # of octets in good frames */
  121. u64 rx_frames; /* all good frames */
  122. u64 rx_bcast_frames; /* all broadcast frames */
  123. u64 rx_mcast_frames; /* all multicast frames */
  124. u64 rx_ucast_frames; /* all unicast frames */
  125. u64 rx_too_long; /* # of frames exceeding MTU */
  126. u64 rx_jabber; /* # of jabber frames */
  127. u64 rx_fcs_err; /* # of received frames with bad FCS */
  128. u64 rx_len_err; /* # of received frames with length error */
  129. u64 rx_symbol_err; /* symbol errors */
  130. u64 rx_runt; /* # of short frames */
  131. u64 rx_frames_64; /* # of Rx frames in a particular range */
  132. u64 rx_frames_65_127;
  133. u64 rx_frames_128_255;
  134. u64 rx_frames_256_511;
  135. u64 rx_frames_512_1023;
  136. u64 rx_frames_1024_1518;
  137. u64 rx_frames_1519_max;
  138. u64 rx_pause; /* # of received pause frames */
  139. u64 rx_ppp0; /* # of received PPP prio 0 frames */
  140. u64 rx_ppp1; /* # of received PPP prio 1 frames */
  141. u64 rx_ppp2; /* # of received PPP prio 2 frames */
  142. u64 rx_ppp3; /* # of received PPP prio 3 frames */
  143. u64 rx_ppp4; /* # of received PPP prio 4 frames */
  144. u64 rx_ppp5; /* # of received PPP prio 5 frames */
  145. u64 rx_ppp6; /* # of received PPP prio 6 frames */
  146. u64 rx_ppp7; /* # of received PPP prio 7 frames */
  147. u64 rx_ovflow0; /* drops due to buffer-group 0 overflows */
  148. u64 rx_ovflow1; /* drops due to buffer-group 1 overflows */
  149. u64 rx_ovflow2; /* drops due to buffer-group 2 overflows */
  150. u64 rx_ovflow3; /* drops due to buffer-group 3 overflows */
  151. u64 rx_trunc0; /* buffer-group 0 truncated packets */
  152. u64 rx_trunc1; /* buffer-group 1 truncated packets */
  153. u64 rx_trunc2; /* buffer-group 2 truncated packets */
  154. u64 rx_trunc3; /* buffer-group 3 truncated packets */
  155. };
  156. struct lb_port_stats {
  157. u64 octets;
  158. u64 frames;
  159. u64 bcast_frames;
  160. u64 mcast_frames;
  161. u64 ucast_frames;
  162. u64 error_frames;
  163. u64 frames_64;
  164. u64 frames_65_127;
  165. u64 frames_128_255;
  166. u64 frames_256_511;
  167. u64 frames_512_1023;
  168. u64 frames_1024_1518;
  169. u64 frames_1519_max;
  170. u64 drop;
  171. u64 ovflow0;
  172. u64 ovflow1;
  173. u64 ovflow2;
  174. u64 ovflow3;
  175. u64 trunc0;
  176. u64 trunc1;
  177. u64 trunc2;
  178. u64 trunc3;
  179. };
  180. struct tp_tcp_stats {
  181. u32 tcpOutRsts;
  182. u64 tcpInSegs;
  183. u64 tcpOutSegs;
  184. u64 tcpRetransSegs;
  185. };
  186. struct tp_err_stats {
  187. u32 macInErrs[4];
  188. u32 hdrInErrs[4];
  189. u32 tcpInErrs[4];
  190. u32 tnlCongDrops[4];
  191. u32 ofldChanDrops[4];
  192. u32 tnlTxDrops[4];
  193. u32 ofldVlanDrops[4];
  194. u32 tcp6InErrs[4];
  195. u32 ofldNoNeigh;
  196. u32 ofldCongDefer;
  197. };
  198. struct tp_params {
  199. unsigned int ntxchan; /* # of Tx channels */
  200. unsigned int tre; /* log2 of core clocks per TP tick */
  201. unsigned short tx_modq_map; /* TX modulation scheduler queue to */
  202. /* channel map */
  203. uint32_t dack_re; /* DACK timer resolution */
  204. unsigned short tx_modq[NCHAN]; /* channel to modulation queue map */
  205. u32 vlan_pri_map; /* cached TP_VLAN_PRI_MAP */
  206. u32 ingress_config; /* cached TP_INGRESS_CONFIG */
  207. /* TP_VLAN_PRI_MAP Compressed Filter Tuple field offsets. This is a
  208. * subset of the set of fields which may be present in the Compressed
  209. * Filter Tuple portion of filters and TCP TCB connections. The
  210. * fields which are present are controlled by the TP_VLAN_PRI_MAP.
  211. * Since a variable number of fields may or may not be present, their
  212. * shifted field positions within the Compressed Filter Tuple may
  213. * vary, or not even be present if the field isn't selected in
  214. * TP_VLAN_PRI_MAP. Since some of these fields are needed in various
  215. * places we store their offsets here, or a -1 if the field isn't
  216. * present.
  217. */
  218. int vlan_shift;
  219. int vnic_shift;
  220. int port_shift;
  221. int protocol_shift;
  222. };
  223. struct vpd_params {
  224. unsigned int cclk;
  225. u8 ec[EC_LEN + 1];
  226. u8 sn[SERNUM_LEN + 1];
  227. u8 id[ID_LEN + 1];
  228. u8 pn[PN_LEN + 1];
  229. };
  230. struct pci_params {
  231. unsigned char speed;
  232. unsigned char width;
  233. };
  234. #define CHELSIO_CHIP_CODE(version, revision) (((version) << 4) | (revision))
  235. #define CHELSIO_CHIP_FPGA 0x100
  236. #define CHELSIO_CHIP_VERSION(code) (((code) >> 4) & 0xf)
  237. #define CHELSIO_CHIP_RELEASE(code) ((code) & 0xf)
  238. #define CHELSIO_T4 0x4
  239. #define CHELSIO_T5 0x5
  240. enum chip_type {
  241. T4_A1 = CHELSIO_CHIP_CODE(CHELSIO_T4, 1),
  242. T4_A2 = CHELSIO_CHIP_CODE(CHELSIO_T4, 2),
  243. T4_FIRST_REV = T4_A1,
  244. T4_LAST_REV = T4_A2,
  245. T5_A0 = CHELSIO_CHIP_CODE(CHELSIO_T5, 0),
  246. T5_A1 = CHELSIO_CHIP_CODE(CHELSIO_T5, 1),
  247. T5_FIRST_REV = T5_A0,
  248. T5_LAST_REV = T5_A1,
  249. };
  250. struct adapter_params {
  251. struct tp_params tp;
  252. struct vpd_params vpd;
  253. struct pci_params pci;
  254. unsigned int sf_size; /* serial flash size in bytes */
  255. unsigned int sf_nsec; /* # of flash sectors */
  256. unsigned int sf_fw_start; /* start of FW image in flash */
  257. unsigned int fw_vers;
  258. unsigned int tp_vers;
  259. u8 api_vers[7];
  260. unsigned short mtus[NMTUS];
  261. unsigned short a_wnd[NCCTRL_WIN];
  262. unsigned short b_wnd[NCCTRL_WIN];
  263. unsigned char nports; /* # of ethernet ports */
  264. unsigned char portvec;
  265. enum chip_type chip; /* chip code */
  266. unsigned char offload;
  267. unsigned char bypass;
  268. unsigned int ofldq_wr_cred;
  269. bool ulptx_memwrite_dsgl; /* use of T5 DSGL allowed */
  270. };
  271. #include "t4fw_api.h"
  272. #define FW_VERSION(chip) ( \
  273. FW_HDR_FW_VER_MAJOR_GET(chip##FW_VERSION_MAJOR) | \
  274. FW_HDR_FW_VER_MINOR_GET(chip##FW_VERSION_MINOR) | \
  275. FW_HDR_FW_VER_MICRO_GET(chip##FW_VERSION_MICRO) | \
  276. FW_HDR_FW_VER_BUILD_GET(chip##FW_VERSION_BUILD))
  277. #define FW_INTFVER(chip, intf) (FW_HDR_INTFVER_##intf)
  278. struct fw_info {
  279. u8 chip;
  280. char *fs_name;
  281. char *fw_mod_name;
  282. struct fw_hdr fw_hdr;
  283. };
  284. struct trace_params {
  285. u32 data[TRACE_LEN / 4];
  286. u32 mask[TRACE_LEN / 4];
  287. unsigned short snap_len;
  288. unsigned short min_len;
  289. unsigned char skip_ofst;
  290. unsigned char skip_len;
  291. unsigned char invert;
  292. unsigned char port;
  293. };
  294. struct link_config {
  295. unsigned short supported; /* link capabilities */
  296. unsigned short advertising; /* advertised capabilities */
  297. unsigned short requested_speed; /* speed user has requested */
  298. unsigned short speed; /* actual link speed */
  299. unsigned char requested_fc; /* flow control user has requested */
  300. unsigned char fc; /* actual link flow control */
  301. unsigned char autoneg; /* autonegotiating? */
  302. unsigned char link_ok; /* link up? */
  303. };
  304. #define FW_LEN16(fw_struct) FW_CMD_LEN16(sizeof(fw_struct) / 16)
  305. enum {
  306. MAX_ETH_QSETS = 32, /* # of Ethernet Tx/Rx queue sets */
  307. MAX_OFLD_QSETS = 16, /* # of offload Tx/Rx queue sets */
  308. MAX_CTRL_QUEUES = NCHAN, /* # of control Tx queues */
  309. MAX_RDMA_QUEUES = NCHAN, /* # of streaming RDMA Rx queues */
  310. MAX_RDMA_CIQS = NCHAN, /* # of RDMA concentrator IQs */
  311. MAX_ISCSI_QUEUES = NCHAN, /* # of streaming iSCSI Rx queues */
  312. };
  313. enum {
  314. INGQ_EXTRAS = 2, /* firmware event queue and */
  315. /* forwarded interrupts */
  316. MAX_EGRQ = MAX_ETH_QSETS*2 + MAX_OFLD_QSETS*2
  317. + MAX_CTRL_QUEUES + MAX_RDMA_QUEUES + MAX_ISCSI_QUEUES,
  318. MAX_INGQ = MAX_ETH_QSETS + MAX_OFLD_QSETS + MAX_RDMA_QUEUES
  319. + MAX_RDMA_CIQS + MAX_ISCSI_QUEUES + INGQ_EXTRAS,
  320. };
  321. struct adapter;
  322. struct sge_rspq;
  323. struct port_info {
  324. struct adapter *adapter;
  325. u16 viid;
  326. s16 xact_addr_filt; /* index of exact MAC address filter */
  327. u16 rss_size; /* size of VI's RSS table slice */
  328. s8 mdio_addr;
  329. u8 port_type;
  330. u8 mod_type;
  331. u8 port_id;
  332. u8 tx_chan;
  333. u8 lport; /* associated offload logical port */
  334. u8 nqsets; /* # of qsets */
  335. u8 first_qset; /* index of first qset */
  336. u8 rss_mode;
  337. struct link_config link_cfg;
  338. u16 *rss;
  339. };
  340. struct dentry;
  341. struct work_struct;
  342. enum { /* adapter flags */
  343. FULL_INIT_DONE = (1 << 0),
  344. DEV_ENABLED = (1 << 1),
  345. USING_MSI = (1 << 2),
  346. USING_MSIX = (1 << 3),
  347. FW_OK = (1 << 4),
  348. RSS_TNLALLLOOKUP = (1 << 5),
  349. USING_SOFT_PARAMS = (1 << 6),
  350. MASTER_PF = (1 << 7),
  351. FW_OFLD_CONN = (1 << 9),
  352. };
  353. struct rx_sw_desc;
  354. struct sge_fl { /* SGE free-buffer queue state */
  355. unsigned int avail; /* # of available Rx buffers */
  356. unsigned int pend_cred; /* new buffers since last FL DB ring */
  357. unsigned int cidx; /* consumer index */
  358. unsigned int pidx; /* producer index */
  359. unsigned long alloc_failed; /* # of times buffer allocation failed */
  360. unsigned long large_alloc_failed;
  361. unsigned long starving;
  362. /* RO fields */
  363. unsigned int cntxt_id; /* SGE context id for the free list */
  364. unsigned int size; /* capacity of free list */
  365. struct rx_sw_desc *sdesc; /* address of SW Rx descriptor ring */
  366. __be64 *desc; /* address of HW Rx descriptor ring */
  367. dma_addr_t addr; /* bus address of HW ring start */
  368. };
  369. /* A packet gather list */
  370. struct pkt_gl {
  371. struct page_frag frags[MAX_SKB_FRAGS];
  372. void *va; /* virtual address of first byte */
  373. unsigned int nfrags; /* # of fragments */
  374. unsigned int tot_len; /* total length of fragments */
  375. };
  376. typedef int (*rspq_handler_t)(struct sge_rspq *q, const __be64 *rsp,
  377. const struct pkt_gl *gl);
  378. struct sge_rspq { /* state for an SGE response queue */
  379. struct napi_struct napi;
  380. const __be64 *cur_desc; /* current descriptor in queue */
  381. unsigned int cidx; /* consumer index */
  382. u8 gen; /* current generation bit */
  383. u8 intr_params; /* interrupt holdoff parameters */
  384. u8 next_intr_params; /* holdoff params for next interrupt */
  385. u8 pktcnt_idx; /* interrupt packet threshold */
  386. u8 uld; /* ULD handling this queue */
  387. u8 idx; /* queue index within its group */
  388. int offset; /* offset into current Rx buffer */
  389. u16 cntxt_id; /* SGE context id for the response q */
  390. u16 abs_id; /* absolute SGE id for the response q */
  391. __be64 *desc; /* address of HW response ring */
  392. dma_addr_t phys_addr; /* physical address of the ring */
  393. unsigned int iqe_len; /* entry size */
  394. unsigned int size; /* capacity of response queue */
  395. struct adapter *adap;
  396. struct net_device *netdev; /* associated net device */
  397. rspq_handler_t handler;
  398. };
  399. struct sge_eth_stats { /* Ethernet queue statistics */
  400. unsigned long pkts; /* # of ethernet packets */
  401. unsigned long lro_pkts; /* # of LRO super packets */
  402. unsigned long lro_merged; /* # of wire packets merged by LRO */
  403. unsigned long rx_cso; /* # of Rx checksum offloads */
  404. unsigned long vlan_ex; /* # of Rx VLAN extractions */
  405. unsigned long rx_drops; /* # of packets dropped due to no mem */
  406. };
  407. struct sge_eth_rxq { /* SW Ethernet Rx queue */
  408. struct sge_rspq rspq;
  409. struct sge_fl fl;
  410. struct sge_eth_stats stats;
  411. } ____cacheline_aligned_in_smp;
  412. struct sge_ofld_stats { /* offload queue statistics */
  413. unsigned long pkts; /* # of packets */
  414. unsigned long imm; /* # of immediate-data packets */
  415. unsigned long an; /* # of asynchronous notifications */
  416. unsigned long nomem; /* # of responses deferred due to no mem */
  417. };
  418. struct sge_ofld_rxq { /* SW offload Rx queue */
  419. struct sge_rspq rspq;
  420. struct sge_fl fl;
  421. struct sge_ofld_stats stats;
  422. } ____cacheline_aligned_in_smp;
  423. struct tx_desc {
  424. __be64 flit[8];
  425. };
  426. struct tx_sw_desc;
  427. struct sge_txq {
  428. unsigned int in_use; /* # of in-use Tx descriptors */
  429. unsigned int size; /* # of descriptors */
  430. unsigned int cidx; /* SW consumer index */
  431. unsigned int pidx; /* producer index */
  432. unsigned long stops; /* # of times q has been stopped */
  433. unsigned long restarts; /* # of queue restarts */
  434. unsigned int cntxt_id; /* SGE context id for the Tx q */
  435. struct tx_desc *desc; /* address of HW Tx descriptor ring */
  436. struct tx_sw_desc *sdesc; /* address of SW Tx descriptor ring */
  437. struct sge_qstat *stat; /* queue status entry */
  438. dma_addr_t phys_addr; /* physical address of the ring */
  439. spinlock_t db_lock;
  440. int db_disabled;
  441. unsigned short db_pidx;
  442. unsigned short db_pidx_inc;
  443. u64 udb;
  444. };
  445. struct sge_eth_txq { /* state for an SGE Ethernet Tx queue */
  446. struct sge_txq q;
  447. struct netdev_queue *txq; /* associated netdev TX queue */
  448. unsigned long tso; /* # of TSO requests */
  449. unsigned long tx_cso; /* # of Tx checksum offloads */
  450. unsigned long vlan_ins; /* # of Tx VLAN insertions */
  451. unsigned long mapping_err; /* # of I/O MMU packet mapping errors */
  452. } ____cacheline_aligned_in_smp;
  453. struct sge_ofld_txq { /* state for an SGE offload Tx queue */
  454. struct sge_txq q;
  455. struct adapter *adap;
  456. struct sk_buff_head sendq; /* list of backpressured packets */
  457. struct tasklet_struct qresume_tsk; /* restarts the queue */
  458. u8 full; /* the Tx ring is full */
  459. unsigned long mapping_err; /* # of I/O MMU packet mapping errors */
  460. } ____cacheline_aligned_in_smp;
  461. struct sge_ctrl_txq { /* state for an SGE control Tx queue */
  462. struct sge_txq q;
  463. struct adapter *adap;
  464. struct sk_buff_head sendq; /* list of backpressured packets */
  465. struct tasklet_struct qresume_tsk; /* restarts the queue */
  466. u8 full; /* the Tx ring is full */
  467. } ____cacheline_aligned_in_smp;
  468. struct sge {
  469. struct sge_eth_txq ethtxq[MAX_ETH_QSETS];
  470. struct sge_ofld_txq ofldtxq[MAX_OFLD_QSETS];
  471. struct sge_ctrl_txq ctrlq[MAX_CTRL_QUEUES];
  472. struct sge_eth_rxq ethrxq[MAX_ETH_QSETS];
  473. struct sge_ofld_rxq ofldrxq[MAX_OFLD_QSETS];
  474. struct sge_ofld_rxq rdmarxq[MAX_RDMA_QUEUES];
  475. struct sge_ofld_rxq rdmaciq[MAX_RDMA_CIQS];
  476. struct sge_rspq fw_evtq ____cacheline_aligned_in_smp;
  477. struct sge_rspq intrq ____cacheline_aligned_in_smp;
  478. spinlock_t intrq_lock;
  479. u16 max_ethqsets; /* # of available Ethernet queue sets */
  480. u16 ethqsets; /* # of active Ethernet queue sets */
  481. u16 ethtxq_rover; /* Tx queue to clean up next */
  482. u16 ofldqsets; /* # of active offload queue sets */
  483. u16 rdmaqs; /* # of available RDMA Rx queues */
  484. u16 rdmaciqs; /* # of available RDMA concentrator IQs */
  485. u16 ofld_rxq[MAX_OFLD_QSETS];
  486. u16 rdma_rxq[NCHAN];
  487. u16 rdma_ciq[NCHAN];
  488. u16 timer_val[SGE_NTIMERS];
  489. u8 counter_val[SGE_NCOUNTERS];
  490. u32 fl_pg_order; /* large page allocation size */
  491. u32 stat_len; /* length of status page at ring end */
  492. u32 pktshift; /* padding between CPL & packet data */
  493. u32 fl_align; /* response queue message alignment */
  494. u32 fl_starve_thres; /* Free List starvation threshold */
  495. /* State variables for detecting an SGE Ingress DMA hang */
  496. unsigned int idma_1s_thresh;/* SGE same State Counter 1s threshold */
  497. unsigned int idma_stalled[2];/* SGE synthesized stalled timers in HZ */
  498. unsigned int idma_state[2]; /* SGE IDMA Hang detect state */
  499. unsigned int idma_qid[2]; /* SGE IDMA Hung Ingress Queue ID */
  500. unsigned int egr_start;
  501. unsigned int ingr_start;
  502. void *egr_map[MAX_EGRQ]; /* qid->queue egress queue map */
  503. struct sge_rspq *ingr_map[MAX_INGQ]; /* qid->queue ingress queue map */
  504. DECLARE_BITMAP(starving_fl, MAX_EGRQ);
  505. DECLARE_BITMAP(txq_maperr, MAX_EGRQ);
  506. struct timer_list rx_timer; /* refills starving FLs */
  507. struct timer_list tx_timer; /* checks Tx queues */
  508. };
  509. #define for_each_ethrxq(sge, i) for (i = 0; i < (sge)->ethqsets; i++)
  510. #define for_each_ofldrxq(sge, i) for (i = 0; i < (sge)->ofldqsets; i++)
  511. #define for_each_rdmarxq(sge, i) for (i = 0; i < (sge)->rdmaqs; i++)
  512. #define for_each_rdmaciq(sge, i) for (i = 0; i < (sge)->rdmaciqs; i++)
  513. struct l2t_data;
  514. #ifdef CONFIG_PCI_IOV
  515. /* T4 supports SRIOV on PF0-3 and T5 on PF0-7. However, the Serial
  516. * Configuration initialization for T5 only has SR-IOV functionality enabled
  517. * on PF0-3 in order to simplify everything.
  518. */
  519. #define NUM_OF_PF_WITH_SRIOV 4
  520. #endif
  521. struct adapter {
  522. void __iomem *regs;
  523. void __iomem *bar2;
  524. struct pci_dev *pdev;
  525. struct device *pdev_dev;
  526. unsigned int mbox;
  527. unsigned int fn;
  528. unsigned int flags;
  529. enum chip_type chip;
  530. int msg_enable;
  531. struct adapter_params params;
  532. struct cxgb4_virt_res vres;
  533. unsigned int swintr;
  534. unsigned int wol;
  535. struct {
  536. unsigned short vec;
  537. char desc[IFNAMSIZ + 10];
  538. } msix_info[MAX_INGQ + 1];
  539. struct sge sge;
  540. struct net_device *port[MAX_NPORTS];
  541. u8 chan_map[NCHAN]; /* channel -> port map */
  542. u32 filter_mode;
  543. unsigned int l2t_start;
  544. unsigned int l2t_end;
  545. struct l2t_data *l2t;
  546. void *uld_handle[CXGB4_ULD_MAX];
  547. struct list_head list_node;
  548. struct list_head rcu_node;
  549. struct tid_info tids;
  550. void **tid_release_head;
  551. spinlock_t tid_release_lock;
  552. struct work_struct tid_release_task;
  553. struct work_struct db_full_task;
  554. struct work_struct db_drop_task;
  555. bool tid_release_task_busy;
  556. struct dentry *debugfs_root;
  557. spinlock_t stats_lock;
  558. };
  559. /* Defined bit width of user definable filter tuples
  560. */
  561. #define ETHTYPE_BITWIDTH 16
  562. #define FRAG_BITWIDTH 1
  563. #define MACIDX_BITWIDTH 9
  564. #define FCOE_BITWIDTH 1
  565. #define IPORT_BITWIDTH 3
  566. #define MATCHTYPE_BITWIDTH 3
  567. #define PROTO_BITWIDTH 8
  568. #define TOS_BITWIDTH 8
  569. #define PF_BITWIDTH 8
  570. #define VF_BITWIDTH 8
  571. #define IVLAN_BITWIDTH 16
  572. #define OVLAN_BITWIDTH 16
  573. /* Filter matching rules. These consist of a set of ingress packet field
  574. * (value, mask) tuples. The associated ingress packet field matches the
  575. * tuple when ((field & mask) == value). (Thus a wildcard "don't care" field
  576. * rule can be constructed by specifying a tuple of (0, 0).) A filter rule
  577. * matches an ingress packet when all of the individual individual field
  578. * matching rules are true.
  579. *
  580. * Partial field masks are always valid, however, while it may be easy to
  581. * understand their meanings for some fields (e.g. IP address to match a
  582. * subnet), for others making sensible partial masks is less intuitive (e.g.
  583. * MPS match type) ...
  584. *
  585. * Most of the following data structures are modeled on T4 capabilities.
  586. * Drivers for earlier chips use the subsets which make sense for those chips.
  587. * We really need to come up with a hardware-independent mechanism to
  588. * represent hardware filter capabilities ...
  589. */
  590. struct ch_filter_tuple {
  591. /* Compressed header matching field rules. The TP_VLAN_PRI_MAP
  592. * register selects which of these fields will participate in the
  593. * filter match rules -- up to a maximum of 36 bits. Because
  594. * TP_VLAN_PRI_MAP is a global register, all filters must use the same
  595. * set of fields.
  596. */
  597. uint32_t ethtype:ETHTYPE_BITWIDTH; /* Ethernet type */
  598. uint32_t frag:FRAG_BITWIDTH; /* IP fragmentation header */
  599. uint32_t ivlan_vld:1; /* inner VLAN valid */
  600. uint32_t ovlan_vld:1; /* outer VLAN valid */
  601. uint32_t pfvf_vld:1; /* PF/VF valid */
  602. uint32_t macidx:MACIDX_BITWIDTH; /* exact match MAC index */
  603. uint32_t fcoe:FCOE_BITWIDTH; /* FCoE packet */
  604. uint32_t iport:IPORT_BITWIDTH; /* ingress port */
  605. uint32_t matchtype:MATCHTYPE_BITWIDTH; /* MPS match type */
  606. uint32_t proto:PROTO_BITWIDTH; /* protocol type */
  607. uint32_t tos:TOS_BITWIDTH; /* TOS/Traffic Type */
  608. uint32_t pf:PF_BITWIDTH; /* PCI-E PF ID */
  609. uint32_t vf:VF_BITWIDTH; /* PCI-E VF ID */
  610. uint32_t ivlan:IVLAN_BITWIDTH; /* inner VLAN */
  611. uint32_t ovlan:OVLAN_BITWIDTH; /* outer VLAN */
  612. /* Uncompressed header matching field rules. These are always
  613. * available for field rules.
  614. */
  615. uint8_t lip[16]; /* local IP address (IPv4 in [3:0]) */
  616. uint8_t fip[16]; /* foreign IP address (IPv4 in [3:0]) */
  617. uint16_t lport; /* local port */
  618. uint16_t fport; /* foreign port */
  619. };
  620. /* A filter ioctl command.
  621. */
  622. struct ch_filter_specification {
  623. /* Administrative fields for filter.
  624. */
  625. uint32_t hitcnts:1; /* count filter hits in TCB */
  626. uint32_t prio:1; /* filter has priority over active/server */
  627. /* Fundamental filter typing. This is the one element of filter
  628. * matching that doesn't exist as a (value, mask) tuple.
  629. */
  630. uint32_t type:1; /* 0 => IPv4, 1 => IPv6 */
  631. /* Packet dispatch information. Ingress packets which match the
  632. * filter rules will be dropped, passed to the host or switched back
  633. * out as egress packets.
  634. */
  635. uint32_t action:2; /* drop, pass, switch */
  636. uint32_t rpttid:1; /* report TID in RSS hash field */
  637. uint32_t dirsteer:1; /* 0 => RSS, 1 => steer to iq */
  638. uint32_t iq:10; /* ingress queue */
  639. uint32_t maskhash:1; /* dirsteer=0: store RSS hash in TCB */
  640. uint32_t dirsteerhash:1;/* dirsteer=1: 0 => TCB contains RSS hash */
  641. /* 1 => TCB contains IQ ID */
  642. /* Switch proxy/rewrite fields. An ingress packet which matches a
  643. * filter with "switch" set will be looped back out as an egress
  644. * packet -- potentially with some Ethernet header rewriting.
  645. */
  646. uint32_t eport:2; /* egress port to switch packet out */
  647. uint32_t newdmac:1; /* rewrite destination MAC address */
  648. uint32_t newsmac:1; /* rewrite source MAC address */
  649. uint32_t newvlan:2; /* rewrite VLAN Tag */
  650. uint8_t dmac[ETH_ALEN]; /* new destination MAC address */
  651. uint8_t smac[ETH_ALEN]; /* new source MAC address */
  652. uint16_t vlan; /* VLAN Tag to insert */
  653. /* Filter rule value/mask pairs.
  654. */
  655. struct ch_filter_tuple val;
  656. struct ch_filter_tuple mask;
  657. };
  658. enum {
  659. FILTER_PASS = 0, /* default */
  660. FILTER_DROP,
  661. FILTER_SWITCH
  662. };
  663. enum {
  664. VLAN_NOCHANGE = 0, /* default */
  665. VLAN_REMOVE,
  666. VLAN_INSERT,
  667. VLAN_REWRITE
  668. };
  669. static inline int is_t5(enum chip_type chip)
  670. {
  671. return CHELSIO_CHIP_VERSION(chip) == CHELSIO_T5;
  672. }
  673. static inline int is_t4(enum chip_type chip)
  674. {
  675. return CHELSIO_CHIP_VERSION(chip) == CHELSIO_T4;
  676. }
  677. static inline u32 t4_read_reg(struct adapter *adap, u32 reg_addr)
  678. {
  679. return readl(adap->regs + reg_addr);
  680. }
  681. static inline void t4_write_reg(struct adapter *adap, u32 reg_addr, u32 val)
  682. {
  683. writel(val, adap->regs + reg_addr);
  684. }
  685. #ifndef readq
  686. static inline u64 readq(const volatile void __iomem *addr)
  687. {
  688. return readl(addr) + ((u64)readl(addr + 4) << 32);
  689. }
  690. static inline void writeq(u64 val, volatile void __iomem *addr)
  691. {
  692. writel(val, addr);
  693. writel(val >> 32, addr + 4);
  694. }
  695. #endif
  696. static inline u64 t4_read_reg64(struct adapter *adap, u32 reg_addr)
  697. {
  698. return readq(adap->regs + reg_addr);
  699. }
  700. static inline void t4_write_reg64(struct adapter *adap, u32 reg_addr, u64 val)
  701. {
  702. writeq(val, adap->regs + reg_addr);
  703. }
  704. /**
  705. * netdev2pinfo - return the port_info structure associated with a net_device
  706. * @dev: the netdev
  707. *
  708. * Return the struct port_info associated with a net_device
  709. */
  710. static inline struct port_info *netdev2pinfo(const struct net_device *dev)
  711. {
  712. return netdev_priv(dev);
  713. }
  714. /**
  715. * adap2pinfo - return the port_info of a port
  716. * @adap: the adapter
  717. * @idx: the port index
  718. *
  719. * Return the port_info structure for the port of the given index.
  720. */
  721. static inline struct port_info *adap2pinfo(struct adapter *adap, int idx)
  722. {
  723. return netdev_priv(adap->port[idx]);
  724. }
  725. /**
  726. * netdev2adap - return the adapter structure associated with a net_device
  727. * @dev: the netdev
  728. *
  729. * Return the struct adapter associated with a net_device
  730. */
  731. static inline struct adapter *netdev2adap(const struct net_device *dev)
  732. {
  733. return netdev2pinfo(dev)->adapter;
  734. }
  735. void t4_os_portmod_changed(const struct adapter *adap, int port_id);
  736. void t4_os_link_changed(struct adapter *adap, int port_id, int link_stat);
  737. void *t4_alloc_mem(size_t size);
  738. void t4_free_sge_resources(struct adapter *adap);
  739. irq_handler_t t4_intr_handler(struct adapter *adap);
  740. netdev_tx_t t4_eth_xmit(struct sk_buff *skb, struct net_device *dev);
  741. int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp,
  742. const struct pkt_gl *gl);
  743. int t4_mgmt_tx(struct adapter *adap, struct sk_buff *skb);
  744. int t4_ofld_send(struct adapter *adap, struct sk_buff *skb);
  745. int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq,
  746. struct net_device *dev, int intr_idx,
  747. struct sge_fl *fl, rspq_handler_t hnd);
  748. int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq,
  749. struct net_device *dev, struct netdev_queue *netdevq,
  750. unsigned int iqid);
  751. int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq,
  752. struct net_device *dev, unsigned int iqid,
  753. unsigned int cmplqid);
  754. int t4_sge_alloc_ofld_txq(struct adapter *adap, struct sge_ofld_txq *txq,
  755. struct net_device *dev, unsigned int iqid);
  756. irqreturn_t t4_sge_intr_msix(int irq, void *cookie);
  757. int t4_sge_init(struct adapter *adap);
  758. void t4_sge_start(struct adapter *adap);
  759. void t4_sge_stop(struct adapter *adap);
  760. extern int dbfifo_int_thresh;
  761. #define for_each_port(adapter, iter) \
  762. for (iter = 0; iter < (adapter)->params.nports; ++iter)
  763. static inline int is_bypass(struct adapter *adap)
  764. {
  765. return adap->params.bypass;
  766. }
  767. static inline int is_bypass_device(int device)
  768. {
  769. /* this should be set based upon device capabilities */
  770. switch (device) {
  771. case 0x440b:
  772. case 0x440c:
  773. return 1;
  774. default:
  775. return 0;
  776. }
  777. }
  778. static inline unsigned int core_ticks_per_usec(const struct adapter *adap)
  779. {
  780. return adap->params.vpd.cclk / 1000;
  781. }
  782. static inline unsigned int us_to_core_ticks(const struct adapter *adap,
  783. unsigned int us)
  784. {
  785. return (us * adap->params.vpd.cclk) / 1000;
  786. }
  787. static inline unsigned int core_ticks_to_us(const struct adapter *adapter,
  788. unsigned int ticks)
  789. {
  790. /* add Core Clock / 2 to round ticks to nearest uS */
  791. return ((ticks * 1000 + adapter->params.vpd.cclk/2) /
  792. adapter->params.vpd.cclk);
  793. }
  794. void t4_set_reg_field(struct adapter *adap, unsigned int addr, u32 mask,
  795. u32 val);
  796. int t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size,
  797. void *rpl, bool sleep_ok);
  798. static inline int t4_wr_mbox(struct adapter *adap, int mbox, const void *cmd,
  799. int size, void *rpl)
  800. {
  801. return t4_wr_mbox_meat(adap, mbox, cmd, size, rpl, true);
  802. }
  803. static inline int t4_wr_mbox_ns(struct adapter *adap, int mbox, const void *cmd,
  804. int size, void *rpl)
  805. {
  806. return t4_wr_mbox_meat(adap, mbox, cmd, size, rpl, false);
  807. }
  808. void t4_write_indirect(struct adapter *adap, unsigned int addr_reg,
  809. unsigned int data_reg, const u32 *vals,
  810. unsigned int nregs, unsigned int start_idx);
  811. void t4_read_indirect(struct adapter *adap, unsigned int addr_reg,
  812. unsigned int data_reg, u32 *vals, unsigned int nregs,
  813. unsigned int start_idx);
  814. struct fw_filter_wr;
  815. void t4_intr_enable(struct adapter *adapter);
  816. void t4_intr_disable(struct adapter *adapter);
  817. int t4_slow_intr_handler(struct adapter *adapter);
  818. int t4_wait_dev_ready(struct adapter *adap);
  819. int t4_link_start(struct adapter *adap, unsigned int mbox, unsigned int port,
  820. struct link_config *lc);
  821. int t4_restart_aneg(struct adapter *adap, unsigned int mbox, unsigned int port);
  822. int t4_memory_write(struct adapter *adap, int mtype, u32 addr, u32 len,
  823. __be32 *buf);
  824. int t4_seeprom_wp(struct adapter *adapter, bool enable);
  825. int get_vpd_params(struct adapter *adapter, struct vpd_params *p);
  826. int t4_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size);
  827. unsigned int t4_flash_cfg_addr(struct adapter *adapter);
  828. int t4_get_fw_version(struct adapter *adapter, u32 *vers);
  829. int t4_get_tp_version(struct adapter *adapter, u32 *vers);
  830. int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info,
  831. const u8 *fw_data, unsigned int fw_size,
  832. struct fw_hdr *card_fw, enum dev_state state, int *reset);
  833. int t4_prep_adapter(struct adapter *adapter);
  834. int t4_init_tp_params(struct adapter *adap);
  835. int t4_filter_field_shift(const struct adapter *adap, int filter_sel);
  836. int t4_port_init(struct adapter *adap, int mbox, int pf, int vf);
  837. void t4_fatal_err(struct adapter *adapter);
  838. int t4_config_rss_range(struct adapter *adapter, int mbox, unsigned int viid,
  839. int start, int n, const u16 *rspq, unsigned int nrspq);
  840. int t4_config_glbl_rss(struct adapter *adapter, int mbox, unsigned int mode,
  841. unsigned int flags);
  842. int t4_mc_read(struct adapter *adap, int idx, u32 addr, __be32 *data,
  843. u64 *parity);
  844. int t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data,
  845. u64 *parity);
  846. const char *t4_get_port_type_description(enum fw_port_type port_type);
  847. void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p);
  848. void t4_read_mtu_tbl(struct adapter *adap, u16 *mtus, u8 *mtu_log);
  849. void t4_tp_wr_bits_indirect(struct adapter *adap, unsigned int addr,
  850. unsigned int mask, unsigned int val);
  851. void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4,
  852. struct tp_tcp_stats *v6);
  853. void t4_load_mtus(struct adapter *adap, const unsigned short *mtus,
  854. const unsigned short *alpha, const unsigned short *beta);
  855. void t4_mk_filtdelwr(unsigned int ftid, struct fw_filter_wr *wr, int qid);
  856. void t4_wol_magic_enable(struct adapter *adap, unsigned int port,
  857. const u8 *addr);
  858. int t4_wol_pat_enable(struct adapter *adap, unsigned int port, unsigned int map,
  859. u64 mask0, u64 mask1, unsigned int crc, bool enable);
  860. int t4_fw_hello(struct adapter *adap, unsigned int mbox, unsigned int evt_mbox,
  861. enum dev_master master, enum dev_state *state);
  862. int t4_fw_bye(struct adapter *adap, unsigned int mbox);
  863. int t4_early_init(struct adapter *adap, unsigned int mbox);
  864. int t4_fw_reset(struct adapter *adap, unsigned int mbox, int reset);
  865. int t4_fixup_host_params(struct adapter *adap, unsigned int page_size,
  866. unsigned int cache_line_size);
  867. int t4_fw_initialize(struct adapter *adap, unsigned int mbox);
  868. int t4_query_params(struct adapter *adap, unsigned int mbox, unsigned int pf,
  869. unsigned int vf, unsigned int nparams, const u32 *params,
  870. u32 *val);
  871. int t4_set_params(struct adapter *adap, unsigned int mbox, unsigned int pf,
  872. unsigned int vf, unsigned int nparams, const u32 *params,
  873. const u32 *val);
  874. int t4_cfg_pfvf(struct adapter *adap, unsigned int mbox, unsigned int pf,
  875. unsigned int vf, unsigned int txq, unsigned int txq_eth_ctrl,
  876. unsigned int rxqi, unsigned int rxq, unsigned int tc,
  877. unsigned int vi, unsigned int cmask, unsigned int pmask,
  878. unsigned int nexact, unsigned int rcaps, unsigned int wxcaps);
  879. int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port,
  880. unsigned int pf, unsigned int vf, unsigned int nmac, u8 *mac,
  881. unsigned int *rss_size);
  882. int t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid,
  883. int mtu, int promisc, int all_multi, int bcast, int vlanex,
  884. bool sleep_ok);
  885. int t4_alloc_mac_filt(struct adapter *adap, unsigned int mbox,
  886. unsigned int viid, bool free, unsigned int naddr,
  887. const u8 **addr, u16 *idx, u64 *hash, bool sleep_ok);
  888. int t4_change_mac(struct adapter *adap, unsigned int mbox, unsigned int viid,
  889. int idx, const u8 *addr, bool persist, bool add_smt);
  890. int t4_set_addr_hash(struct adapter *adap, unsigned int mbox, unsigned int viid,
  891. bool ucast, u64 vec, bool sleep_ok);
  892. int t4_enable_vi(struct adapter *adap, unsigned int mbox, unsigned int viid,
  893. bool rx_en, bool tx_en);
  894. int t4_identify_port(struct adapter *adap, unsigned int mbox, unsigned int viid,
  895. unsigned int nblinks);
  896. int t4_mdio_rd(struct adapter *adap, unsigned int mbox, unsigned int phy_addr,
  897. unsigned int mmd, unsigned int reg, u16 *valp);
  898. int t4_mdio_wr(struct adapter *adap, unsigned int mbox, unsigned int phy_addr,
  899. unsigned int mmd, unsigned int reg, u16 val);
  900. int t4_iq_free(struct adapter *adap, unsigned int mbox, unsigned int pf,
  901. unsigned int vf, unsigned int iqtype, unsigned int iqid,
  902. unsigned int fl0id, unsigned int fl1id);
  903. int t4_eth_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf,
  904. unsigned int vf, unsigned int eqid);
  905. int t4_ctrl_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf,
  906. unsigned int vf, unsigned int eqid);
  907. int t4_ofld_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf,
  908. unsigned int vf, unsigned int eqid);
  909. int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl);
  910. void t4_db_full(struct adapter *adapter);
  911. void t4_db_dropped(struct adapter *adapter);
  912. int t4_mem_win_read_len(struct adapter *adap, u32 addr, __be32 *data, int len);
  913. int t4_fwaddrspace_write(struct adapter *adap, unsigned int mbox,
  914. u32 addr, u32 val);
  915. void t4_sge_decode_idma_state(struct adapter *adapter, int state);
  916. #endif /* __CXGB4_H__ */