qib.h 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526
  1. #ifndef _QIB_KERNEL_H
  2. #define _QIB_KERNEL_H
  3. /*
  4. * Copyright (c) 2012 - 2017 Intel Corporation. All rights reserved.
  5. * Copyright (c) 2006 - 2012 QLogic Corporation. All rights reserved.
  6. * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
  7. *
  8. * This software is available to you under a choice of one of two
  9. * licenses. You may choose to be licensed under the terms of the GNU
  10. * General Public License (GPL) Version 2, available from the file
  11. * COPYING in the main directory of this source tree, or the
  12. * OpenIB.org BSD license below:
  13. *
  14. * Redistribution and use in source and binary forms, with or
  15. * without modification, are permitted provided that the following
  16. * conditions are met:
  17. *
  18. * - Redistributions of source code must retain the above
  19. * copyright notice, this list of conditions and the following
  20. * disclaimer.
  21. *
  22. * - Redistributions in binary form must reproduce the above
  23. * copyright notice, this list of conditions and the following
  24. * disclaimer in the documentation and/or other materials
  25. * provided with the distribution.
  26. *
  27. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  28. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  29. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  30. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  31. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  32. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  33. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  34. * SOFTWARE.
  35. */
  36. /*
  37. * This header file is the base header file for qlogic_ib kernel code
  38. * qib_user.h serves a similar purpose for user code.
  39. */
  40. #include <linux/interrupt.h>
  41. #include <linux/pci.h>
  42. #include <linux/dma-mapping.h>
  43. #include <linux/mutex.h>
  44. #include <linux/list.h>
  45. #include <linux/scatterlist.h>
  46. #include <linux/slab.h>
  47. #include <linux/io.h>
  48. #include <linux/fs.h>
  49. #include <linux/completion.h>
  50. #include <linux/kref.h>
  51. #include <linux/sched.h>
  52. #include <linux/kthread.h>
  53. #include <rdma/ib_hdrs.h>
  54. #include <rdma/rdma_vt.h>
  55. #include "qib_common.h"
  56. #include "qib_verbs.h"
  57. /* only s/w major version of QLogic_IB we can handle */
  58. #define QIB_CHIP_VERS_MAJ 2U
  59. /* don't care about this except printing */
  60. #define QIB_CHIP_VERS_MIN 0U
  61. /* The Organization Unique Identifier (Mfg code), and its position in GUID */
  62. #define QIB_OUI 0x001175
  63. #define QIB_OUI_LSB 40
  64. /*
  65. * per driver stats, either not device nor port-specific, or
  66. * summed over all of the devices and ports.
  67. * They are described by name via ipathfs filesystem, so layout
  68. * and number of elements can change without breaking compatibility.
  69. * If members are added or deleted qib_statnames[] in qib_fs.c must
  70. * change to match.
  71. */
  72. struct qlogic_ib_stats {
  73. __u64 sps_ints; /* number of interrupts handled */
  74. __u64 sps_errints; /* number of error interrupts */
  75. __u64 sps_txerrs; /* tx-related packet errors */
  76. __u64 sps_rcverrs; /* non-crc rcv packet errors */
  77. __u64 sps_hwerrs; /* hardware errors reported (parity, etc.) */
  78. __u64 sps_nopiobufs; /* no pio bufs avail from kernel */
  79. __u64 sps_ctxts; /* number of contexts currently open */
  80. __u64 sps_lenerrs; /* number of kernel packets where RHF != LRH len */
  81. __u64 sps_buffull;
  82. __u64 sps_hdrfull;
  83. };
  84. extern struct qlogic_ib_stats qib_stats;
  85. extern const struct pci_error_handlers qib_pci_err_handler;
  86. #define QIB_CHIP_SWVERSION QIB_CHIP_VERS_MAJ
  87. /*
  88. * First-cut critierion for "device is active" is
  89. * two thousand dwords combined Tx, Rx traffic per
  90. * 5-second interval. SMA packets are 64 dwords,
  91. * and occur "a few per second", presumably each way.
  92. */
  93. #define QIB_TRAFFIC_ACTIVE_THRESHOLD (2000)
  94. /*
  95. * Below contains all data related to a single context (formerly called port).
  96. */
  97. #ifdef CONFIG_DEBUG_FS
  98. struct qib_opcode_stats_perctx;
  99. #endif
  100. struct qib_ctxtdata {
  101. void **rcvegrbuf;
  102. dma_addr_t *rcvegrbuf_phys;
  103. /* rcvhdrq base, needs mmap before useful */
  104. void *rcvhdrq;
  105. /* kernel virtual address where hdrqtail is updated */
  106. void *rcvhdrtail_kvaddr;
  107. /*
  108. * temp buffer for expected send setup, allocated at open, instead
  109. * of each setup call
  110. */
  111. void *tid_pg_list;
  112. /*
  113. * Shared page for kernel to signal user processes that send buffers
  114. * need disarming. The process should call QIB_CMD_DISARM_BUFS
  115. * or QIB_CMD_ACK_EVENT with IPATH_EVENT_DISARM_BUFS set.
  116. */
  117. unsigned long *user_event_mask;
  118. /* when waiting for rcv or pioavail */
  119. wait_queue_head_t wait;
  120. /*
  121. * rcvegr bufs base, physical, must fit
  122. * in 44 bits so 32 bit programs mmap64 44 bit works)
  123. */
  124. dma_addr_t rcvegr_phys;
  125. /* mmap of hdrq, must fit in 44 bits */
  126. dma_addr_t rcvhdrq_phys;
  127. dma_addr_t rcvhdrqtailaddr_phys;
  128. /*
  129. * number of opens (including slave sub-contexts) on this instance
  130. * (ignoring forks, dup, etc. for now)
  131. */
  132. int cnt;
  133. /*
  134. * how much space to leave at start of eager TID entries for
  135. * protocol use, on each TID
  136. */
  137. /* instead of calculating it */
  138. unsigned ctxt;
  139. /* local node of context */
  140. int node_id;
  141. /* non-zero if ctxt is being shared. */
  142. u16 subctxt_cnt;
  143. /* non-zero if ctxt is being shared. */
  144. u16 subctxt_id;
  145. /* number of eager TID entries. */
  146. u16 rcvegrcnt;
  147. /* index of first eager TID entry. */
  148. u16 rcvegr_tid_base;
  149. /* number of pio bufs for this ctxt (all procs, if shared) */
  150. u32 piocnt;
  151. /* first pio buffer for this ctxt */
  152. u32 pio_base;
  153. /* chip offset of PIO buffers for this ctxt */
  154. u32 piobufs;
  155. /* how many alloc_pages() chunks in rcvegrbuf_pages */
  156. u32 rcvegrbuf_chunks;
  157. /* how many egrbufs per chunk */
  158. u16 rcvegrbufs_perchunk;
  159. /* ilog2 of above */
  160. u16 rcvegrbufs_perchunk_shift;
  161. /* order for rcvegrbuf_pages */
  162. size_t rcvegrbuf_size;
  163. /* rcvhdrq size (for freeing) */
  164. size_t rcvhdrq_size;
  165. /* per-context flags for fileops/intr communication */
  166. unsigned long flag;
  167. /* next expected TID to check when looking for free */
  168. u32 tidcursor;
  169. /* WAIT_RCV that timed out, no interrupt */
  170. u32 rcvwait_to;
  171. /* WAIT_PIO that timed out, no interrupt */
  172. u32 piowait_to;
  173. /* WAIT_RCV already happened, no wait */
  174. u32 rcvnowait;
  175. /* WAIT_PIO already happened, no wait */
  176. u32 pionowait;
  177. /* total number of polled urgent packets */
  178. u32 urgent;
  179. /* saved total number of polled urgent packets for poll edge trigger */
  180. u32 urgent_poll;
  181. /* pid of process using this ctxt */
  182. pid_t pid;
  183. pid_t subpid[QLOGIC_IB_MAX_SUBCTXT];
  184. /* same size as task_struct .comm[], command that opened context */
  185. char comm[16];
  186. /* pkeys set by this use of this ctxt */
  187. u16 pkeys[4];
  188. /* so file ops can get at unit */
  189. struct qib_devdata *dd;
  190. /* so funcs that need physical port can get it easily */
  191. struct qib_pportdata *ppd;
  192. /* A page of memory for rcvhdrhead, rcvegrhead, rcvegrtail * N */
  193. void *subctxt_uregbase;
  194. /* An array of pages for the eager receive buffers * N */
  195. void *subctxt_rcvegrbuf;
  196. /* An array of pages for the eager header queue entries * N */
  197. void *subctxt_rcvhdr_base;
  198. /* The version of the library which opened this ctxt */
  199. u32 userversion;
  200. /* Bitmask of active slaves */
  201. u32 active_slaves;
  202. /* Type of packets or conditions we want to poll for */
  203. u16 poll_type;
  204. /* receive packet sequence counter */
  205. u8 seq_cnt;
  206. u8 redirect_seq_cnt;
  207. /* ctxt rcvhdrq head offset */
  208. u32 head;
  209. /* QPs waiting for context processing */
  210. struct list_head qp_wait_list;
  211. #ifdef CONFIG_DEBUG_FS
  212. /* verbs stats per CTX */
  213. struct qib_opcode_stats_perctx *opstats;
  214. #endif
  215. };
  216. struct rvt_sge_state;
  217. struct qib_sdma_txreq {
  218. int flags;
  219. int sg_count;
  220. dma_addr_t addr;
  221. void (*callback)(struct qib_sdma_txreq *, int);
  222. u16 start_idx; /* sdma private */
  223. u16 next_descq_idx; /* sdma private */
  224. struct list_head list; /* sdma private */
  225. };
  226. struct qib_sdma_desc {
  227. __le64 qw[2];
  228. };
  229. struct qib_verbs_txreq {
  230. struct qib_sdma_txreq txreq;
  231. struct rvt_qp *qp;
  232. struct rvt_swqe *wqe;
  233. u32 dwords;
  234. u16 hdr_dwords;
  235. u16 hdr_inx;
  236. struct qib_pio_header *align_buf;
  237. struct rvt_mregion *mr;
  238. struct rvt_sge_state *ss;
  239. };
  240. #define QIB_SDMA_TXREQ_F_USELARGEBUF 0x1
  241. #define QIB_SDMA_TXREQ_F_HEADTOHOST 0x2
  242. #define QIB_SDMA_TXREQ_F_INTREQ 0x4
  243. #define QIB_SDMA_TXREQ_F_FREEBUF 0x8
  244. #define QIB_SDMA_TXREQ_F_FREEDESC 0x10
  245. #define QIB_SDMA_TXREQ_S_OK 0
  246. #define QIB_SDMA_TXREQ_S_SENDERROR 1
  247. #define QIB_SDMA_TXREQ_S_ABORTED 2
  248. #define QIB_SDMA_TXREQ_S_SHUTDOWN 3
  249. /*
  250. * Get/Set IB link-level config parameters for f_get/set_ib_cfg()
  251. * Mostly for MADs that set or query link parameters, also ipath
  252. * config interfaces
  253. */
  254. #define QIB_IB_CFG_LIDLMC 0 /* LID (LS16b) and Mask (MS16b) */
  255. #define QIB_IB_CFG_LWID_ENB 2 /* allowed Link-width */
  256. #define QIB_IB_CFG_LWID 3 /* currently active Link-width */
  257. #define QIB_IB_CFG_SPD_ENB 4 /* allowed Link speeds */
  258. #define QIB_IB_CFG_SPD 5 /* current Link spd */
  259. #define QIB_IB_CFG_RXPOL_ENB 6 /* Auto-RX-polarity enable */
  260. #define QIB_IB_CFG_LREV_ENB 7 /* Auto-Lane-reversal enable */
  261. #define QIB_IB_CFG_LINKLATENCY 8 /* Link Latency (IB1.2 only) */
  262. #define QIB_IB_CFG_HRTBT 9 /* IB heartbeat off/enable/auto; DDR/QDR only */
  263. #define QIB_IB_CFG_OP_VLS 10 /* operational VLs */
  264. #define QIB_IB_CFG_VL_HIGH_CAP 11 /* num of VL high priority weights */
  265. #define QIB_IB_CFG_VL_LOW_CAP 12 /* num of VL low priority weights */
  266. #define QIB_IB_CFG_OVERRUN_THRESH 13 /* IB overrun threshold */
  267. #define QIB_IB_CFG_PHYERR_THRESH 14 /* IB PHY error threshold */
  268. #define QIB_IB_CFG_LINKDEFAULT 15 /* IB link default (sleep/poll) */
  269. #define QIB_IB_CFG_PKEYS 16 /* update partition keys */
  270. #define QIB_IB_CFG_MTU 17 /* update MTU in IBC */
  271. #define QIB_IB_CFG_LSTATE 18 /* update linkcmd and linkinitcmd in IBC */
  272. #define QIB_IB_CFG_VL_HIGH_LIMIT 19
  273. #define QIB_IB_CFG_PMA_TICKS 20 /* PMA sample tick resolution */
  274. #define QIB_IB_CFG_PORT 21 /* switch port we are connected to */
  275. /*
  276. * for CFG_LSTATE: LINKCMD in upper 16 bits, LINKINITCMD in lower 16
  277. * IB_LINKINITCMD_POLL and SLEEP are also used as set/get values for
  278. * QIB_IB_CFG_LINKDEFAULT cmd
  279. */
  280. #define IB_LINKCMD_DOWN (0 << 16)
  281. #define IB_LINKCMD_ARMED (1 << 16)
  282. #define IB_LINKCMD_ACTIVE (2 << 16)
  283. #define IB_LINKINITCMD_NOP 0
  284. #define IB_LINKINITCMD_POLL 1
  285. #define IB_LINKINITCMD_SLEEP 2
  286. #define IB_LINKINITCMD_DISABLE 3
  287. /*
  288. * valid states passed to qib_set_linkstate() user call
  289. */
  290. #define QIB_IB_LINKDOWN 0
  291. #define QIB_IB_LINKARM 1
  292. #define QIB_IB_LINKACTIVE 2
  293. #define QIB_IB_LINKDOWN_ONLY 3
  294. #define QIB_IB_LINKDOWN_SLEEP 4
  295. #define QIB_IB_LINKDOWN_DISABLE 5
  296. /*
  297. * These 7 values (SDR, DDR, and QDR may be ORed for auto-speed
  298. * negotiation) are used for the 3rd argument to path_f_set_ib_cfg
  299. * with cmd QIB_IB_CFG_SPD_ENB, by direct calls or via sysfs. They
  300. * are also the the possible values for qib_link_speed_enabled and active
  301. * The values were chosen to match values used within the IB spec.
  302. */
  303. #define QIB_IB_SDR 1
  304. #define QIB_IB_DDR 2
  305. #define QIB_IB_QDR 4
  306. #define QIB_DEFAULT_MTU 4096
  307. /* max number of IB ports supported per HCA */
  308. #define QIB_MAX_IB_PORTS 2
  309. /*
  310. * Possible IB config parameters for f_get/set_ib_table()
  311. */
  312. #define QIB_IB_TBL_VL_HIGH_ARB 1 /* Get/set VL high priority weights */
  313. #define QIB_IB_TBL_VL_LOW_ARB 2 /* Get/set VL low priority weights */
  314. /*
  315. * Possible "operations" for f_rcvctrl(ppd, op, ctxt)
  316. * these are bits so they can be combined, e.g.
  317. * QIB_RCVCTRL_INTRAVAIL_ENB | QIB_RCVCTRL_CTXT_ENB
  318. */
  319. #define QIB_RCVCTRL_TAILUPD_ENB 0x01
  320. #define QIB_RCVCTRL_TAILUPD_DIS 0x02
  321. #define QIB_RCVCTRL_CTXT_ENB 0x04
  322. #define QIB_RCVCTRL_CTXT_DIS 0x08
  323. #define QIB_RCVCTRL_INTRAVAIL_ENB 0x10
  324. #define QIB_RCVCTRL_INTRAVAIL_DIS 0x20
  325. #define QIB_RCVCTRL_PKEY_ENB 0x40 /* Note, default is enabled */
  326. #define QIB_RCVCTRL_PKEY_DIS 0x80
  327. #define QIB_RCVCTRL_BP_ENB 0x0100
  328. #define QIB_RCVCTRL_BP_DIS 0x0200
  329. #define QIB_RCVCTRL_TIDFLOW_ENB 0x0400
  330. #define QIB_RCVCTRL_TIDFLOW_DIS 0x0800
  331. /*
  332. * Possible "operations" for f_sendctrl(ppd, op, var)
  333. * these are bits so they can be combined, e.g.
  334. * QIB_SENDCTRL_BUFAVAIL_ENB | QIB_SENDCTRL_ENB
  335. * Some operations (e.g. DISARM, ABORT) are known to
  336. * be "one-shot", so do not modify shadow.
  337. */
  338. #define QIB_SENDCTRL_DISARM (0x1000)
  339. #define QIB_SENDCTRL_DISARM_BUF(bufn) ((bufn) | QIB_SENDCTRL_DISARM)
  340. /* available (0x2000) */
  341. #define QIB_SENDCTRL_AVAIL_DIS (0x4000)
  342. #define QIB_SENDCTRL_AVAIL_ENB (0x8000)
  343. #define QIB_SENDCTRL_AVAIL_BLIP (0x10000)
  344. #define QIB_SENDCTRL_SEND_DIS (0x20000)
  345. #define QIB_SENDCTRL_SEND_ENB (0x40000)
  346. #define QIB_SENDCTRL_FLUSH (0x80000)
  347. #define QIB_SENDCTRL_CLEAR (0x100000)
  348. #define QIB_SENDCTRL_DISARM_ALL (0x200000)
  349. /*
  350. * These are the generic indices for requesting per-port
  351. * counter values via the f_portcntr function. They
  352. * are always returned as 64 bit values, although most
  353. * are 32 bit counters.
  354. */
  355. /* send-related counters */
  356. #define QIBPORTCNTR_PKTSEND 0U
  357. #define QIBPORTCNTR_WORDSEND 1U
  358. #define QIBPORTCNTR_PSXMITDATA 2U
  359. #define QIBPORTCNTR_PSXMITPKTS 3U
  360. #define QIBPORTCNTR_PSXMITWAIT 4U
  361. #define QIBPORTCNTR_SENDSTALL 5U
  362. /* receive-related counters */
  363. #define QIBPORTCNTR_PKTRCV 6U
  364. #define QIBPORTCNTR_PSRCVDATA 7U
  365. #define QIBPORTCNTR_PSRCVPKTS 8U
  366. #define QIBPORTCNTR_RCVEBP 9U
  367. #define QIBPORTCNTR_RCVOVFL 10U
  368. #define QIBPORTCNTR_WORDRCV 11U
  369. /* IB link related error counters */
  370. #define QIBPORTCNTR_RXLOCALPHYERR 12U
  371. #define QIBPORTCNTR_RXVLERR 13U
  372. #define QIBPORTCNTR_ERRICRC 14U
  373. #define QIBPORTCNTR_ERRVCRC 15U
  374. #define QIBPORTCNTR_ERRLPCRC 16U
  375. #define QIBPORTCNTR_BADFORMAT 17U
  376. #define QIBPORTCNTR_ERR_RLEN 18U
  377. #define QIBPORTCNTR_IBSYMBOLERR 19U
  378. #define QIBPORTCNTR_INVALIDRLEN 20U
  379. #define QIBPORTCNTR_UNSUPVL 21U
  380. #define QIBPORTCNTR_EXCESSBUFOVFL 22U
  381. #define QIBPORTCNTR_ERRLINK 23U
  382. #define QIBPORTCNTR_IBLINKDOWN 24U
  383. #define QIBPORTCNTR_IBLINKERRRECOV 25U
  384. #define QIBPORTCNTR_LLI 26U
  385. /* other error counters */
  386. #define QIBPORTCNTR_RXDROPPKT 27U
  387. #define QIBPORTCNTR_VL15PKTDROP 28U
  388. #define QIBPORTCNTR_ERRPKEY 29U
  389. #define QIBPORTCNTR_KHDROVFL 30U
  390. /* sampling counters (these are actually control registers) */
  391. #define QIBPORTCNTR_PSINTERVAL 31U
  392. #define QIBPORTCNTR_PSSTART 32U
  393. #define QIBPORTCNTR_PSSTAT 33U
  394. /* how often we check for packet activity for "power on hours (in seconds) */
  395. #define ACTIVITY_TIMER 5
  396. #define MAX_NAME_SIZE 64
  397. #ifdef CONFIG_INFINIBAND_QIB_DCA
  398. struct qib_irq_notify;
  399. #endif
  400. struct qib_msix_entry {
  401. void *arg;
  402. #ifdef CONFIG_INFINIBAND_QIB_DCA
  403. int dca;
  404. int rcv;
  405. struct qib_irq_notify *notifier;
  406. #endif
  407. cpumask_var_t mask;
  408. };
  409. /* Below is an opaque struct. Each chip (device) can maintain
  410. * private data needed for its operation, but not germane to the
  411. * rest of the driver. For convenience, we define another that
  412. * is chip-specific, per-port
  413. */
  414. struct qib_chip_specific;
  415. struct qib_chipport_specific;
  416. enum qib_sdma_states {
  417. qib_sdma_state_s00_hw_down,
  418. qib_sdma_state_s10_hw_start_up_wait,
  419. qib_sdma_state_s20_idle,
  420. qib_sdma_state_s30_sw_clean_up_wait,
  421. qib_sdma_state_s40_hw_clean_up_wait,
  422. qib_sdma_state_s50_hw_halt_wait,
  423. qib_sdma_state_s99_running,
  424. };
  425. enum qib_sdma_events {
  426. qib_sdma_event_e00_go_hw_down,
  427. qib_sdma_event_e10_go_hw_start,
  428. qib_sdma_event_e20_hw_started,
  429. qib_sdma_event_e30_go_running,
  430. qib_sdma_event_e40_sw_cleaned,
  431. qib_sdma_event_e50_hw_cleaned,
  432. qib_sdma_event_e60_hw_halted,
  433. qib_sdma_event_e70_go_idle,
  434. qib_sdma_event_e7220_err_halted,
  435. qib_sdma_event_e7322_err_halted,
  436. qib_sdma_event_e90_timer_tick,
  437. };
  438. struct sdma_set_state_action {
  439. unsigned op_enable:1;
  440. unsigned op_intenable:1;
  441. unsigned op_halt:1;
  442. unsigned op_drain:1;
  443. unsigned go_s99_running_tofalse:1;
  444. unsigned go_s99_running_totrue:1;
  445. };
  446. struct qib_sdma_state {
  447. struct kref kref;
  448. struct completion comp;
  449. enum qib_sdma_states current_state;
  450. struct sdma_set_state_action *set_state_action;
  451. unsigned current_op;
  452. unsigned go_s99_running;
  453. unsigned first_sendbuf;
  454. unsigned last_sendbuf; /* really last +1 */
  455. /* debugging/devel */
  456. enum qib_sdma_states previous_state;
  457. unsigned previous_op;
  458. enum qib_sdma_events last_event;
  459. };
  460. struct xmit_wait {
  461. struct timer_list timer;
  462. u64 counter;
  463. u8 flags;
  464. struct cache {
  465. u64 psxmitdata;
  466. u64 psrcvdata;
  467. u64 psxmitpkts;
  468. u64 psrcvpkts;
  469. u64 psxmitwait;
  470. } counter_cache;
  471. };
  472. /*
  473. * The structure below encapsulates data relevant to a physical IB Port.
  474. * Current chips support only one such port, but the separation
  475. * clarifies things a bit. Note that to conform to IB conventions,
  476. * port-numbers are one-based. The first or only port is port1.
  477. */
  478. struct qib_pportdata {
  479. struct qib_ibport ibport_data;
  480. struct qib_devdata *dd;
  481. struct qib_chippport_specific *cpspec; /* chip-specific per-port */
  482. struct kobject pport_kobj;
  483. struct kobject pport_cc_kobj;
  484. struct kobject sl2vl_kobj;
  485. struct kobject diagc_kobj;
  486. /* GUID for this interface, in network order */
  487. __be64 guid;
  488. /* QIB_POLL, etc. link-state specific flags, per port */
  489. u32 lflags;
  490. /* qib_lflags driver is waiting for */
  491. u32 state_wanted;
  492. spinlock_t lflags_lock;
  493. /* ref count for each pkey */
  494. atomic_t pkeyrefs[4];
  495. /*
  496. * this address is mapped readonly into user processes so they can
  497. * get status cheaply, whenever they want. One qword of status per port
  498. */
  499. u64 *statusp;
  500. /* SendDMA related entries */
  501. /* read mostly */
  502. struct qib_sdma_desc *sdma_descq;
  503. struct workqueue_struct *qib_wq;
  504. struct qib_sdma_state sdma_state;
  505. dma_addr_t sdma_descq_phys;
  506. volatile __le64 *sdma_head_dma; /* DMA'ed by chip */
  507. dma_addr_t sdma_head_phys;
  508. u16 sdma_descq_cnt;
  509. /* read/write using lock */
  510. spinlock_t sdma_lock ____cacheline_aligned_in_smp;
  511. struct list_head sdma_activelist;
  512. struct list_head sdma_userpending;
  513. u64 sdma_descq_added;
  514. u64 sdma_descq_removed;
  515. u16 sdma_descq_tail;
  516. u16 sdma_descq_head;
  517. u8 sdma_generation;
  518. u8 sdma_intrequest;
  519. struct tasklet_struct sdma_sw_clean_up_task
  520. ____cacheline_aligned_in_smp;
  521. wait_queue_head_t state_wait; /* for state_wanted */
  522. /* HoL blocking for SMP replies */
  523. unsigned hol_state;
  524. struct timer_list hol_timer;
  525. /*
  526. * Shadow copies of registers; size indicates read access size.
  527. * Most of them are readonly, but some are write-only register,
  528. * where we manipulate the bits in the shadow copy, and then write
  529. * the shadow copy to qlogic_ib.
  530. *
  531. * We deliberately make most of these 32 bits, since they have
  532. * restricted range. For any that we read, we won't to generate 32
  533. * bit accesses, since Opteron will generate 2 separate 32 bit HT
  534. * transactions for a 64 bit read, and we want to avoid unnecessary
  535. * bus transactions.
  536. */
  537. /* This is the 64 bit group */
  538. /* last ibcstatus. opaque outside chip-specific code */
  539. u64 lastibcstat;
  540. /* these are the "32 bit" regs */
  541. /*
  542. * the following two are 32-bit bitmasks, but {test,clear,set}_bit
  543. * all expect bit fields to be "unsigned long"
  544. */
  545. unsigned long p_rcvctrl; /* shadow per-port rcvctrl */
  546. unsigned long p_sendctrl; /* shadow per-port sendctrl */
  547. u32 ibmtu; /* The MTU programmed for this unit */
  548. /*
  549. * Current max size IB packet (in bytes) including IB headers, that
  550. * we can send. Changes when ibmtu changes.
  551. */
  552. u32 ibmaxlen;
  553. /*
  554. * ibmaxlen at init time, limited by chip and by receive buffer
  555. * size. Not changed after init.
  556. */
  557. u32 init_ibmaxlen;
  558. /* LID programmed for this instance */
  559. u16 lid;
  560. /* list of pkeys programmed; 0 if not set */
  561. u16 pkeys[4];
  562. /* LID mask control */
  563. u8 lmc;
  564. u8 link_width_supported;
  565. u8 link_speed_supported;
  566. u8 link_width_enabled;
  567. u8 link_speed_enabled;
  568. u8 link_width_active;
  569. u8 link_speed_active;
  570. u8 vls_supported;
  571. u8 vls_operational;
  572. /* Rx Polarity inversion (compensate for ~tx on partner) */
  573. u8 rx_pol_inv;
  574. u8 hw_pidx; /* physical port index */
  575. u8 port; /* IB port number and index into dd->pports - 1 */
  576. u8 delay_mult;
  577. /* used to override LED behavior */
  578. u8 led_override; /* Substituted for normal value, if non-zero */
  579. u16 led_override_timeoff; /* delta to next timer event */
  580. u8 led_override_vals[2]; /* Alternates per blink-frame */
  581. u8 led_override_phase; /* Just counts, LSB picks from vals[] */
  582. atomic_t led_override_timer_active;
  583. /* Used to flash LEDs in override mode */
  584. struct timer_list led_override_timer;
  585. struct xmit_wait cong_stats;
  586. struct timer_list symerr_clear_timer;
  587. /* Synchronize access between driver writes and sysfs reads */
  588. spinlock_t cc_shadow_lock
  589. ____cacheline_aligned_in_smp;
  590. /* Shadow copy of the congestion control table */
  591. struct cc_table_shadow *ccti_entries_shadow;
  592. /* Shadow copy of the congestion control entries */
  593. struct ib_cc_congestion_setting_attr_shadow *congestion_entries_shadow;
  594. /* List of congestion control table entries */
  595. struct ib_cc_table_entry_shadow *ccti_entries;
  596. /* 16 congestion entries with each entry corresponding to a SL */
  597. struct ib_cc_congestion_entry_shadow *congestion_entries;
  598. /* Maximum number of congestion control entries that the agent expects
  599. * the manager to send.
  600. */
  601. u16 cc_supported_table_entries;
  602. /* Total number of congestion control table entries */
  603. u16 total_cct_entry;
  604. /* Bit map identifying service level */
  605. u16 cc_sl_control_map;
  606. /* maximum congestion control table index */
  607. u16 ccti_limit;
  608. /* CA's max number of 64 entry units in the congestion control table */
  609. u8 cc_max_table_entries;
  610. };
  611. /* Observers. Not to be taken lightly, possibly not to ship. */
  612. /*
  613. * If a diag read or write is to (bottom <= offset <= top),
  614. * the "hoook" is called, allowing, e.g. shadows to be
  615. * updated in sync with the driver. struct diag_observer
  616. * is the "visible" part.
  617. */
  618. struct diag_observer;
  619. typedef int (*diag_hook) (struct qib_devdata *dd,
  620. const struct diag_observer *op,
  621. u32 offs, u64 *data, u64 mask, int only_32);
  622. struct diag_observer {
  623. diag_hook hook;
  624. u32 bottom;
  625. u32 top;
  626. };
  627. extern int qib_register_observer(struct qib_devdata *dd,
  628. const struct diag_observer *op);
  629. /* Only declared here, not defined. Private to diags */
  630. struct diag_observer_list_elt;
  631. /* device data struct now contains only "general per-device" info.
  632. * fields related to a physical IB port are in a qib_pportdata struct,
  633. * described above) while fields only used by a particular chip-type are in
  634. * a qib_chipdata struct, whose contents are opaque to this file.
  635. */
  636. struct qib_devdata {
  637. struct qib_ibdev verbs_dev; /* must be first */
  638. struct list_head list;
  639. /* pointers to related structs for this device */
  640. /* pci access data structure */
  641. struct pci_dev *pcidev;
  642. struct cdev *user_cdev;
  643. struct cdev *diag_cdev;
  644. struct device *user_device;
  645. struct device *diag_device;
  646. /* mem-mapped pointer to base of chip regs */
  647. u64 __iomem *kregbase;
  648. /* end of mem-mapped chip space excluding sendbuf and user regs */
  649. u64 __iomem *kregend;
  650. /* physical address of chip for io_remap, etc. */
  651. resource_size_t physaddr;
  652. /* qib_cfgctxts pointers */
  653. struct qib_ctxtdata **rcd; /* Receive Context Data */
  654. /* qib_pportdata, points to array of (physical) port-specific
  655. * data structs, indexed by pidx (0..n-1)
  656. */
  657. struct qib_pportdata *pport;
  658. struct qib_chip_specific *cspec; /* chip-specific */
  659. /* kvirt address of 1st 2k pio buffer */
  660. void __iomem *pio2kbase;
  661. /* kvirt address of 1st 4k pio buffer */
  662. void __iomem *pio4kbase;
  663. /* mem-mapped pointer to base of PIO buffers (if using WC PAT) */
  664. void __iomem *piobase;
  665. /* mem-mapped pointer to base of user chip regs (if using WC PAT) */
  666. u64 __iomem *userbase;
  667. void __iomem *piovl15base; /* base of VL15 buffers, if not WC */
  668. /*
  669. * points to area where PIOavail registers will be DMA'ed.
  670. * Has to be on a page of it's own, because the page will be
  671. * mapped into user program space. This copy is *ONLY* ever
  672. * written by DMA, not by the driver! Need a copy per device
  673. * when we get to multiple devices
  674. */
  675. volatile __le64 *pioavailregs_dma; /* DMA'ed by chip */
  676. /* physical address where updates occur */
  677. dma_addr_t pioavailregs_phys;
  678. /* device-specific implementations of functions needed by
  679. * common code. Contrary to previous consensus, we can't
  680. * really just point to a device-specific table, because we
  681. * may need to "bend", e.g. *_f_put_tid
  682. */
  683. /* fallback to alternate interrupt type if possible */
  684. int (*f_intr_fallback)(struct qib_devdata *);
  685. /* hard reset chip */
  686. int (*f_reset)(struct qib_devdata *);
  687. void (*f_quiet_serdes)(struct qib_pportdata *);
  688. int (*f_bringup_serdes)(struct qib_pportdata *);
  689. int (*f_early_init)(struct qib_devdata *);
  690. void (*f_clear_tids)(struct qib_devdata *, struct qib_ctxtdata *);
  691. void (*f_put_tid)(struct qib_devdata *, u64 __iomem*,
  692. u32, unsigned long);
  693. void (*f_cleanup)(struct qib_devdata *);
  694. void (*f_setextled)(struct qib_pportdata *, u32);
  695. /* fill out chip-specific fields */
  696. int (*f_get_base_info)(struct qib_ctxtdata *, struct qib_base_info *);
  697. /* free irq */
  698. void (*f_free_irq)(struct qib_devdata *);
  699. struct qib_message_header *(*f_get_msgheader)
  700. (struct qib_devdata *, __le32 *);
  701. void (*f_config_ctxts)(struct qib_devdata *);
  702. int (*f_get_ib_cfg)(struct qib_pportdata *, int);
  703. int (*f_set_ib_cfg)(struct qib_pportdata *, int, u32);
  704. int (*f_set_ib_loopback)(struct qib_pportdata *, const char *);
  705. int (*f_get_ib_table)(struct qib_pportdata *, int, void *);
  706. int (*f_set_ib_table)(struct qib_pportdata *, int, void *);
  707. u32 (*f_iblink_state)(u64);
  708. u8 (*f_ibphys_portstate)(u64);
  709. void (*f_xgxs_reset)(struct qib_pportdata *);
  710. /* per chip actions needed for IB Link up/down changes */
  711. int (*f_ib_updown)(struct qib_pportdata *, int, u64);
  712. u32 __iomem *(*f_getsendbuf)(struct qib_pportdata *, u64, u32 *);
  713. /* Read/modify/write of GPIO pins (potentially chip-specific */
  714. int (*f_gpio_mod)(struct qib_devdata *dd, u32 out, u32 dir,
  715. u32 mask);
  716. /* Enable writes to config EEPROM (if supported) */
  717. int (*f_eeprom_wen)(struct qib_devdata *dd, int wen);
  718. /*
  719. * modify rcvctrl shadow[s] and write to appropriate chip-regs.
  720. * see above QIB_RCVCTRL_xxx_ENB/DIS for operations.
  721. * (ctxt == -1) means "all contexts", only meaningful for
  722. * clearing. Could remove if chip_spec shutdown properly done.
  723. */
  724. void (*f_rcvctrl)(struct qib_pportdata *, unsigned int op,
  725. int ctxt);
  726. /* Read/modify/write sendctrl appropriately for op and port. */
  727. void (*f_sendctrl)(struct qib_pportdata *, u32 op);
  728. void (*f_set_intr_state)(struct qib_devdata *, u32);
  729. void (*f_set_armlaunch)(struct qib_devdata *, u32);
  730. void (*f_wantpiobuf_intr)(struct qib_devdata *, u32);
  731. int (*f_late_initreg)(struct qib_devdata *);
  732. int (*f_init_sdma_regs)(struct qib_pportdata *);
  733. u16 (*f_sdma_gethead)(struct qib_pportdata *);
  734. int (*f_sdma_busy)(struct qib_pportdata *);
  735. void (*f_sdma_update_tail)(struct qib_pportdata *, u16);
  736. void (*f_sdma_set_desc_cnt)(struct qib_pportdata *, unsigned);
  737. void (*f_sdma_sendctrl)(struct qib_pportdata *, unsigned);
  738. void (*f_sdma_hw_clean_up)(struct qib_pportdata *);
  739. void (*f_sdma_hw_start_up)(struct qib_pportdata *);
  740. void (*f_sdma_init_early)(struct qib_pportdata *);
  741. void (*f_set_cntr_sample)(struct qib_pportdata *, u32, u32);
  742. void (*f_update_usrhead)(struct qib_ctxtdata *, u64, u32, u32, u32);
  743. u32 (*f_hdrqempty)(struct qib_ctxtdata *);
  744. u64 (*f_portcntr)(struct qib_pportdata *, u32);
  745. u32 (*f_read_cntrs)(struct qib_devdata *, loff_t, char **,
  746. u64 **);
  747. u32 (*f_read_portcntrs)(struct qib_devdata *, loff_t, u32,
  748. char **, u64 **);
  749. u32 (*f_setpbc_control)(struct qib_pportdata *, u32, u8, u8);
  750. void (*f_initvl15_bufs)(struct qib_devdata *);
  751. void (*f_init_ctxt)(struct qib_ctxtdata *);
  752. void (*f_txchk_change)(struct qib_devdata *, u32, u32, u32,
  753. struct qib_ctxtdata *);
  754. void (*f_writescratch)(struct qib_devdata *, u32);
  755. int (*f_tempsense_rd)(struct qib_devdata *, int regnum);
  756. #ifdef CONFIG_INFINIBAND_QIB_DCA
  757. int (*f_notify_dca)(struct qib_devdata *, unsigned long event);
  758. #endif
  759. char *boardname; /* human readable board info */
  760. /* template for writing TIDs */
  761. u64 tidtemplate;
  762. /* value to write to free TIDs */
  763. u64 tidinvalid;
  764. /* number of registers used for pioavail */
  765. u32 pioavregs;
  766. /* device (not port) flags, basically device capabilities */
  767. u32 flags;
  768. /* last buffer for user use */
  769. u32 lastctxt_piobuf;
  770. /* reset value */
  771. u64 z_int_counter;
  772. /* percpu intcounter */
  773. u64 __percpu *int_counter;
  774. /* pio bufs allocated per ctxt */
  775. u32 pbufsctxt;
  776. /* if remainder on bufs/ctxt, ctxts < extrabuf get 1 extra */
  777. u32 ctxts_extrabuf;
  778. /*
  779. * number of ctxts configured as max; zero is set to number chip
  780. * supports, less gives more pio bufs/ctxt, etc.
  781. */
  782. u32 cfgctxts;
  783. /*
  784. * number of ctxts available for PSM open
  785. */
  786. u32 freectxts;
  787. /*
  788. * hint that we should update pioavailshadow before
  789. * looking for a PIO buffer
  790. */
  791. u32 upd_pio_shadow;
  792. /* internal debugging stats */
  793. u32 maxpkts_call;
  794. u32 avgpkts_call;
  795. u64 nopiobufs;
  796. /* PCI Vendor ID (here for NodeInfo) */
  797. u16 vendorid;
  798. /* PCI Device ID (here for NodeInfo) */
  799. u16 deviceid;
  800. /* for write combining settings */
  801. int wc_cookie;
  802. unsigned long wc_base;
  803. unsigned long wc_len;
  804. /* shadow copy of struct page *'s for exp tid pages */
  805. struct page **pageshadow;
  806. /* shadow copy of dma handles for exp tid pages */
  807. dma_addr_t *physshadow;
  808. u64 __iomem *egrtidbase;
  809. spinlock_t sendctrl_lock; /* protect changes to sendctrl shadow */
  810. /* around rcd and (user ctxts) ctxt_cnt use (intr vs free) */
  811. spinlock_t uctxt_lock; /* rcd and user context changes */
  812. /*
  813. * per unit status, see also portdata statusp
  814. * mapped readonly into user processes so they can get unit and
  815. * IB link status cheaply
  816. */
  817. u64 *devstatusp;
  818. char *freezemsg; /* freeze msg if hw error put chip in freeze */
  819. u32 freezelen; /* max length of freezemsg */
  820. /* timer used to prevent stats overflow, error throttling, etc. */
  821. struct timer_list stats_timer;
  822. /* timer to verify interrupts work, and fallback if possible */
  823. struct timer_list intrchk_timer;
  824. unsigned long ureg_align; /* user register alignment */
  825. /*
  826. * Protects pioavailshadow, pioavailkernel, pio_need_disarm, and
  827. * pio_writing.
  828. */
  829. spinlock_t pioavail_lock;
  830. /*
  831. * index of last buffer to optimize search for next
  832. */
  833. u32 last_pio;
  834. /*
  835. * min kernel pio buffer to optimize search
  836. */
  837. u32 min_kernel_pio;
  838. /*
  839. * Shadow copies of registers; size indicates read access size.
  840. * Most of them are readonly, but some are write-only register,
  841. * where we manipulate the bits in the shadow copy, and then write
  842. * the shadow copy to qlogic_ib.
  843. *
  844. * We deliberately make most of these 32 bits, since they have
  845. * restricted range. For any that we read, we won't to generate 32
  846. * bit accesses, since Opteron will generate 2 separate 32 bit HT
  847. * transactions for a 64 bit read, and we want to avoid unnecessary
  848. * bus transactions.
  849. */
  850. /* This is the 64 bit group */
  851. unsigned long pioavailshadow[6];
  852. /* bitmap of send buffers available for the kernel to use with PIO. */
  853. unsigned long pioavailkernel[6];
  854. /* bitmap of send buffers which need to be disarmed. */
  855. unsigned long pio_need_disarm[3];
  856. /* bitmap of send buffers which are being written to. */
  857. unsigned long pio_writing[3];
  858. /* kr_revision shadow */
  859. u64 revision;
  860. /* Base GUID for device (from eeprom, network order) */
  861. __be64 base_guid;
  862. /*
  863. * kr_sendpiobufbase value (chip offset of pio buffers), and the
  864. * base of the 2KB buffer s(user processes only use 2K)
  865. */
  866. u64 piobufbase;
  867. u32 pio2k_bufbase;
  868. /* these are the "32 bit" regs */
  869. /* number of GUIDs in the flash for this interface */
  870. u32 nguid;
  871. /*
  872. * the following two are 32-bit bitmasks, but {test,clear,set}_bit
  873. * all expect bit fields to be "unsigned long"
  874. */
  875. unsigned long rcvctrl; /* shadow per device rcvctrl */
  876. unsigned long sendctrl; /* shadow per device sendctrl */
  877. /* value we put in kr_rcvhdrcnt */
  878. u32 rcvhdrcnt;
  879. /* value we put in kr_rcvhdrsize */
  880. u32 rcvhdrsize;
  881. /* value we put in kr_rcvhdrentsize */
  882. u32 rcvhdrentsize;
  883. /* kr_ctxtcnt value */
  884. u32 ctxtcnt;
  885. /* kr_pagealign value */
  886. u32 palign;
  887. /* number of "2KB" PIO buffers */
  888. u32 piobcnt2k;
  889. /* size in bytes of "2KB" PIO buffers */
  890. u32 piosize2k;
  891. /* max usable size in dwords of a "2KB" PIO buffer before going "4KB" */
  892. u32 piosize2kmax_dwords;
  893. /* number of "4KB" PIO buffers */
  894. u32 piobcnt4k;
  895. /* size in bytes of "4KB" PIO buffers */
  896. u32 piosize4k;
  897. /* kr_rcvegrbase value */
  898. u32 rcvegrbase;
  899. /* kr_rcvtidbase value */
  900. u32 rcvtidbase;
  901. /* kr_rcvtidcnt value */
  902. u32 rcvtidcnt;
  903. /* kr_userregbase */
  904. u32 uregbase;
  905. /* shadow the control register contents */
  906. u32 control;
  907. /* chip address space used by 4k pio buffers */
  908. u32 align4k;
  909. /* size of each rcvegrbuffer */
  910. u16 rcvegrbufsize;
  911. /* log2 of above */
  912. u16 rcvegrbufsize_shift;
  913. /* localbus width (1, 2,4,8,16,32) from config space */
  914. u32 lbus_width;
  915. /* localbus speed in MHz */
  916. u32 lbus_speed;
  917. int unit; /* unit # of this chip */
  918. /* start of CHIP_SPEC move to chipspec, but need code changes */
  919. /* low and high portions of MSI capability/vector */
  920. u32 msi_lo;
  921. /* saved after PCIe init for restore after reset */
  922. u32 msi_hi;
  923. /* MSI data (vector) saved for restore */
  924. u16 msi_data;
  925. /* so we can rewrite it after a chip reset */
  926. u32 pcibar0;
  927. /* so we can rewrite it after a chip reset */
  928. u32 pcibar1;
  929. u64 rhdrhead_intr_off;
  930. /*
  931. * ASCII serial number, from flash, large enough for original
  932. * all digit strings, and longer QLogic serial number format
  933. */
  934. u8 serial[16];
  935. /* human readable board version */
  936. u8 boardversion[96];
  937. u8 lbus_info[32]; /* human readable localbus info */
  938. /* chip major rev, from qib_revision */
  939. u8 majrev;
  940. /* chip minor rev, from qib_revision */
  941. u8 minrev;
  942. /* Misc small ints */
  943. /* Number of physical ports available */
  944. u8 num_pports;
  945. /* Lowest context number which can be used by user processes */
  946. u8 first_user_ctxt;
  947. u8 n_krcv_queues;
  948. u8 qpn_mask;
  949. u8 skip_kctxt_mask;
  950. u16 rhf_offset; /* offset of RHF within receive header entry */
  951. /*
  952. * GPIO pins for twsi-connected devices, and device code for eeprom
  953. */
  954. u8 gpio_sda_num;
  955. u8 gpio_scl_num;
  956. u8 twsi_eeprom_dev;
  957. u8 board_atten;
  958. /* Support (including locks) for EEPROM logging of errors and time */
  959. /* control access to actual counters, timer */
  960. spinlock_t eep_st_lock;
  961. /* control high-level access to EEPROM */
  962. struct mutex eep_lock;
  963. uint64_t traffic_wds;
  964. struct qib_diag_client *diag_client;
  965. spinlock_t qib_diag_trans_lock; /* protect diag observer ops */
  966. struct diag_observer_list_elt *diag_observer_list;
  967. u8 psxmitwait_supported;
  968. /* cycle length of PS* counters in HW (in picoseconds) */
  969. u16 psxmitwait_check_rate;
  970. /* high volume overflow errors defered to tasklet */
  971. struct tasklet_struct error_tasklet;
  972. int assigned_node_id; /* NUMA node closest to HCA */
  973. };
  974. /* hol_state values */
  975. #define QIB_HOL_UP 0
  976. #define QIB_HOL_INIT 1
  977. #define QIB_SDMA_SENDCTRL_OP_ENABLE (1U << 0)
  978. #define QIB_SDMA_SENDCTRL_OP_INTENABLE (1U << 1)
  979. #define QIB_SDMA_SENDCTRL_OP_HALT (1U << 2)
  980. #define QIB_SDMA_SENDCTRL_OP_CLEANUP (1U << 3)
  981. #define QIB_SDMA_SENDCTRL_OP_DRAIN (1U << 4)
  982. /* operation types for f_txchk_change() */
  983. #define TXCHK_CHG_TYPE_DIS1 3
  984. #define TXCHK_CHG_TYPE_ENAB1 2
  985. #define TXCHK_CHG_TYPE_KERN 1
  986. #define TXCHK_CHG_TYPE_USER 0
  987. #define QIB_CHASE_TIME msecs_to_jiffies(145)
  988. #define QIB_CHASE_DIS_TIME msecs_to_jiffies(160)
  989. /* Private data for file operations */
  990. struct qib_filedata {
  991. struct qib_ctxtdata *rcd;
  992. unsigned subctxt;
  993. unsigned tidcursor;
  994. struct qib_user_sdma_queue *pq;
  995. int rec_cpu_num; /* for cpu affinity; -1 if none */
  996. };
  997. extern struct list_head qib_dev_list;
  998. extern spinlock_t qib_devs_lock;
  999. extern struct qib_devdata *qib_lookup(int unit);
  1000. extern u32 qib_cpulist_count;
  1001. extern unsigned long *qib_cpulist;
  1002. extern unsigned qib_cc_table_size;
  1003. int qib_init(struct qib_devdata *, int);
  1004. int init_chip_wc_pat(struct qib_devdata *dd, u32);
  1005. int qib_enable_wc(struct qib_devdata *dd);
  1006. void qib_disable_wc(struct qib_devdata *dd);
  1007. int qib_count_units(int *npresentp, int *nupp);
  1008. int qib_count_active_units(void);
  1009. int qib_cdev_init(int minor, const char *name,
  1010. const struct file_operations *fops,
  1011. struct cdev **cdevp, struct device **devp);
  1012. void qib_cdev_cleanup(struct cdev **cdevp, struct device **devp);
  1013. int qib_dev_init(void);
  1014. void qib_dev_cleanup(void);
  1015. int qib_diag_add(struct qib_devdata *);
  1016. void qib_diag_remove(struct qib_devdata *);
  1017. void qib_handle_e_ibstatuschanged(struct qib_pportdata *, u64);
  1018. void qib_sdma_update_tail(struct qib_pportdata *, u16); /* hold sdma_lock */
  1019. int qib_decode_err(struct qib_devdata *dd, char *buf, size_t blen, u64 err);
  1020. void qib_bad_intrstatus(struct qib_devdata *);
  1021. void qib_handle_urcv(struct qib_devdata *, u64);
  1022. /* clean up any per-chip chip-specific stuff */
  1023. void qib_chip_cleanup(struct qib_devdata *);
  1024. /* clean up any chip type-specific stuff */
  1025. void qib_chip_done(void);
  1026. /* check to see if we have to force ordering for write combining */
  1027. int qib_unordered_wc(void);
  1028. void qib_pio_copy(void __iomem *to, const void *from, size_t count);
  1029. void qib_disarm_piobufs(struct qib_devdata *, unsigned, unsigned);
  1030. int qib_disarm_piobufs_ifneeded(struct qib_ctxtdata *);
  1031. void qib_disarm_piobufs_set(struct qib_devdata *, unsigned long *, unsigned);
  1032. void qib_cancel_sends(struct qib_pportdata *);
  1033. int qib_create_rcvhdrq(struct qib_devdata *, struct qib_ctxtdata *);
  1034. int qib_setup_eagerbufs(struct qib_ctxtdata *);
  1035. void qib_set_ctxtcnt(struct qib_devdata *);
  1036. int qib_create_ctxts(struct qib_devdata *dd);
  1037. struct qib_ctxtdata *qib_create_ctxtdata(struct qib_pportdata *, u32, int);
  1038. int qib_init_pportdata(struct qib_pportdata *, struct qib_devdata *, u8, u8);
  1039. void qib_free_ctxtdata(struct qib_devdata *, struct qib_ctxtdata *);
  1040. u32 qib_kreceive(struct qib_ctxtdata *, u32 *, u32 *);
  1041. int qib_reset_device(int);
  1042. int qib_wait_linkstate(struct qib_pportdata *, u32, int);
  1043. int qib_set_linkstate(struct qib_pportdata *, u8);
  1044. int qib_set_mtu(struct qib_pportdata *, u16);
  1045. int qib_set_lid(struct qib_pportdata *, u32, u8);
  1046. void qib_hol_down(struct qib_pportdata *);
  1047. void qib_hol_init(struct qib_pportdata *);
  1048. void qib_hol_up(struct qib_pportdata *);
  1049. void qib_hol_event(struct timer_list *);
  1050. void qib_disable_after_error(struct qib_devdata *);
  1051. int qib_set_uevent_bits(struct qib_pportdata *, const int);
  1052. /* for use in system calls, where we want to know device type, etc. */
  1053. #define ctxt_fp(fp) \
  1054. (((struct qib_filedata *)(fp)->private_data)->rcd)
  1055. #define subctxt_fp(fp) \
  1056. (((struct qib_filedata *)(fp)->private_data)->subctxt)
  1057. #define tidcursor_fp(fp) \
  1058. (((struct qib_filedata *)(fp)->private_data)->tidcursor)
  1059. #define user_sdma_queue_fp(fp) \
  1060. (((struct qib_filedata *)(fp)->private_data)->pq)
  1061. static inline struct qib_devdata *dd_from_ppd(struct qib_pportdata *ppd)
  1062. {
  1063. return ppd->dd;
  1064. }
  1065. static inline struct qib_devdata *dd_from_dev(struct qib_ibdev *dev)
  1066. {
  1067. return container_of(dev, struct qib_devdata, verbs_dev);
  1068. }
  1069. static inline struct qib_devdata *dd_from_ibdev(struct ib_device *ibdev)
  1070. {
  1071. return dd_from_dev(to_idev(ibdev));
  1072. }
  1073. static inline struct qib_pportdata *ppd_from_ibp(struct qib_ibport *ibp)
  1074. {
  1075. return container_of(ibp, struct qib_pportdata, ibport_data);
  1076. }
  1077. static inline struct qib_ibport *to_iport(struct ib_device *ibdev, u8 port)
  1078. {
  1079. struct qib_devdata *dd = dd_from_ibdev(ibdev);
  1080. unsigned pidx = port - 1; /* IB number port from 1, hdw from 0 */
  1081. WARN_ON(pidx >= dd->num_pports);
  1082. return &dd->pport[pidx].ibport_data;
  1083. }
  1084. /*
  1085. * values for dd->flags (_device_ related flags) and
  1086. */
  1087. #define QIB_HAS_LINK_LATENCY 0x1 /* supports link latency (IB 1.2) */
  1088. #define QIB_INITTED 0x2 /* chip and driver up and initted */
  1089. #define QIB_DOING_RESET 0x4 /* in the middle of doing chip reset */
  1090. #define QIB_PRESENT 0x8 /* chip accesses can be done */
  1091. #define QIB_PIO_FLUSH_WC 0x10 /* Needs Write combining flush for PIO */
  1092. #define QIB_HAS_THRESH_UPDATE 0x40
  1093. #define QIB_HAS_SDMA_TIMEOUT 0x80
  1094. #define QIB_USE_SPCL_TRIG 0x100 /* SpecialTrigger launch enabled */
  1095. #define QIB_NODMA_RTAIL 0x200 /* rcvhdrtail register DMA enabled */
  1096. #define QIB_HAS_INTX 0x800 /* Supports INTx interrupts */
  1097. #define QIB_HAS_SEND_DMA 0x1000 /* Supports Send DMA */
  1098. #define QIB_HAS_VLSUPP 0x2000 /* Supports multiple VLs; PBC different */
  1099. #define QIB_HAS_HDRSUPP 0x4000 /* Supports header suppression */
  1100. #define QIB_BADINTR 0x8000 /* severe interrupt problems */
  1101. #define QIB_DCA_ENABLED 0x10000 /* Direct Cache Access enabled */
  1102. #define QIB_HAS_QSFP 0x20000 /* device (card instance) has QSFP */
  1103. #define QIB_SHUTDOWN 0x40000 /* device is shutting down */
  1104. /*
  1105. * values for ppd->lflags (_ib_port_ related flags)
  1106. */
  1107. #define QIBL_LINKV 0x1 /* IB link state valid */
  1108. #define QIBL_LINKDOWN 0x8 /* IB link is down */
  1109. #define QIBL_LINKINIT 0x10 /* IB link level is up */
  1110. #define QIBL_LINKARMED 0x20 /* IB link is ARMED */
  1111. #define QIBL_LINKACTIVE 0x40 /* IB link is ACTIVE */
  1112. /* leave a gap for more IB-link state */
  1113. #define QIBL_IB_AUTONEG_INPROG 0x1000 /* non-IBTA DDR/QDR neg active */
  1114. #define QIBL_IB_AUTONEG_FAILED 0x2000 /* non-IBTA DDR/QDR neg failed */
  1115. #define QIBL_IB_LINK_DISABLED 0x4000 /* Linkdown-disable forced,
  1116. * Do not try to bring up */
  1117. #define QIBL_IB_FORCE_NOTIFY 0x8000 /* force notify on next ib change */
  1118. /* IB dword length mask in PBC (lower 11 bits); same for all chips */
  1119. #define QIB_PBC_LENGTH_MASK ((1 << 11) - 1)
  1120. /* ctxt_flag bit offsets */
  1121. /* waiting for a packet to arrive */
  1122. #define QIB_CTXT_WAITING_RCV 2
  1123. /* master has not finished initializing */
  1124. #define QIB_CTXT_MASTER_UNINIT 4
  1125. /* waiting for an urgent packet to arrive */
  1126. #define QIB_CTXT_WAITING_URG 5
  1127. /* free up any allocated data at closes */
  1128. void qib_free_data(struct qib_ctxtdata *dd);
  1129. void qib_chg_pioavailkernel(struct qib_devdata *, unsigned, unsigned,
  1130. u32, struct qib_ctxtdata *);
  1131. struct qib_devdata *qib_init_iba7322_funcs(struct pci_dev *,
  1132. const struct pci_device_id *);
  1133. struct qib_devdata *qib_init_iba7220_funcs(struct pci_dev *,
  1134. const struct pci_device_id *);
  1135. struct qib_devdata *qib_init_iba6120_funcs(struct pci_dev *,
  1136. const struct pci_device_id *);
  1137. void qib_free_devdata(struct qib_devdata *);
  1138. struct qib_devdata *qib_alloc_devdata(struct pci_dev *pdev, size_t extra);
  1139. #define QIB_TWSI_NO_DEV 0xFF
  1140. /* Below qib_twsi_ functions must be called with eep_lock held */
  1141. int qib_twsi_reset(struct qib_devdata *dd);
  1142. int qib_twsi_blk_rd(struct qib_devdata *dd, int dev, int addr, void *buffer,
  1143. int len);
  1144. int qib_twsi_blk_wr(struct qib_devdata *dd, int dev, int addr,
  1145. const void *buffer, int len);
  1146. void qib_get_eeprom_info(struct qib_devdata *);
  1147. void qib_dump_lookup_output_queue(struct qib_devdata *);
  1148. void qib_force_pio_avail_update(struct qib_devdata *);
  1149. void qib_clear_symerror_on_linkup(struct timer_list *t);
  1150. /*
  1151. * Set LED override, only the two LSBs have "public" meaning, but
  1152. * any non-zero value substitutes them for the Link and LinkTrain
  1153. * LED states.
  1154. */
  1155. #define QIB_LED_PHYS 1 /* Physical (linktraining) GREEN LED */
  1156. #define QIB_LED_LOG 2 /* Logical (link) YELLOW LED */
  1157. void qib_set_led_override(struct qib_pportdata *ppd, unsigned int val);
  1158. /* send dma routines */
  1159. int qib_setup_sdma(struct qib_pportdata *);
  1160. void qib_teardown_sdma(struct qib_pportdata *);
  1161. void __qib_sdma_intr(struct qib_pportdata *);
  1162. void qib_sdma_intr(struct qib_pportdata *);
  1163. void qib_user_sdma_send_desc(struct qib_pportdata *dd,
  1164. struct list_head *pktlist);
  1165. int qib_sdma_verbs_send(struct qib_pportdata *, struct rvt_sge_state *,
  1166. u32, struct qib_verbs_txreq *);
  1167. /* ppd->sdma_lock should be locked before calling this. */
  1168. int qib_sdma_make_progress(struct qib_pportdata *dd);
  1169. static inline int qib_sdma_empty(const struct qib_pportdata *ppd)
  1170. {
  1171. return ppd->sdma_descq_added == ppd->sdma_descq_removed;
  1172. }
  1173. /* must be called under qib_sdma_lock */
  1174. static inline u16 qib_sdma_descq_freecnt(const struct qib_pportdata *ppd)
  1175. {
  1176. return ppd->sdma_descq_cnt -
  1177. (ppd->sdma_descq_added - ppd->sdma_descq_removed) - 1;
  1178. }
  1179. static inline int __qib_sdma_running(struct qib_pportdata *ppd)
  1180. {
  1181. return ppd->sdma_state.current_state == qib_sdma_state_s99_running;
  1182. }
  1183. int qib_sdma_running(struct qib_pportdata *);
  1184. void dump_sdma_state(struct qib_pportdata *ppd);
  1185. void __qib_sdma_process_event(struct qib_pportdata *, enum qib_sdma_events);
  1186. void qib_sdma_process_event(struct qib_pportdata *, enum qib_sdma_events);
  1187. /*
  1188. * number of words used for protocol header if not set by qib_userinit();
  1189. */
  1190. #define QIB_DFLT_RCVHDRSIZE 9
  1191. /*
  1192. * We need to be able to handle an IB header of at least 24 dwords.
  1193. * We need the rcvhdrq large enough to handle largest IB header, but
  1194. * still have room for a 2KB MTU standard IB packet.
  1195. * Additionally, some processor/memory controller combinations
  1196. * benefit quite strongly from having the DMA'ed data be cacheline
  1197. * aligned and a cacheline multiple, so we set the size to 32 dwords
  1198. * (2 64-byte primary cachelines for pretty much all processors of
  1199. * interest). The alignment hurts nothing, other than using somewhat
  1200. * more memory.
  1201. */
  1202. #define QIB_RCVHDR_ENTSIZE 32
  1203. int qib_get_user_pages(unsigned long, size_t, struct page **);
  1204. void qib_release_user_pages(struct page **, size_t);
  1205. int qib_eeprom_read(struct qib_devdata *, u8, void *, int);
  1206. int qib_eeprom_write(struct qib_devdata *, u8, const void *, int);
  1207. u32 __iomem *qib_getsendbuf_range(struct qib_devdata *, u32 *, u32, u32);
  1208. void qib_sendbuf_done(struct qib_devdata *, unsigned);
  1209. static inline void qib_clear_rcvhdrtail(const struct qib_ctxtdata *rcd)
  1210. {
  1211. *((u64 *) rcd->rcvhdrtail_kvaddr) = 0ULL;
  1212. }
  1213. static inline u32 qib_get_rcvhdrtail(const struct qib_ctxtdata *rcd)
  1214. {
  1215. /*
  1216. * volatile because it's a DMA target from the chip, routine is
  1217. * inlined, and don't want register caching or reordering.
  1218. */
  1219. return (u32) le64_to_cpu(
  1220. *((volatile __le64 *)rcd->rcvhdrtail_kvaddr)); /* DMA'ed */
  1221. }
  1222. static inline u32 qib_get_hdrqtail(const struct qib_ctxtdata *rcd)
  1223. {
  1224. const struct qib_devdata *dd = rcd->dd;
  1225. u32 hdrqtail;
  1226. if (dd->flags & QIB_NODMA_RTAIL) {
  1227. __le32 *rhf_addr;
  1228. u32 seq;
  1229. rhf_addr = (__le32 *) rcd->rcvhdrq +
  1230. rcd->head + dd->rhf_offset;
  1231. seq = qib_hdrget_seq(rhf_addr);
  1232. hdrqtail = rcd->head;
  1233. if (seq == rcd->seq_cnt)
  1234. hdrqtail++;
  1235. } else
  1236. hdrqtail = qib_get_rcvhdrtail(rcd);
  1237. return hdrqtail;
  1238. }
  1239. /*
  1240. * sysfs interface.
  1241. */
  1242. extern const char ib_qib_version[];
  1243. int qib_device_create(struct qib_devdata *);
  1244. void qib_device_remove(struct qib_devdata *);
  1245. int qib_create_port_files(struct ib_device *ibdev, u8 port_num,
  1246. struct kobject *kobj);
  1247. int qib_verbs_register_sysfs(struct qib_devdata *);
  1248. void qib_verbs_unregister_sysfs(struct qib_devdata *);
  1249. /* Hook for sysfs read of QSFP */
  1250. extern int qib_qsfp_dump(struct qib_pportdata *ppd, char *buf, int len);
  1251. int __init qib_init_qibfs(void);
  1252. int __exit qib_exit_qibfs(void);
  1253. int qibfs_add(struct qib_devdata *);
  1254. int qibfs_remove(struct qib_devdata *);
  1255. int qib_pcie_init(struct pci_dev *, const struct pci_device_id *);
  1256. int qib_pcie_ddinit(struct qib_devdata *, struct pci_dev *,
  1257. const struct pci_device_id *);
  1258. void qib_pcie_ddcleanup(struct qib_devdata *);
  1259. int qib_pcie_params(struct qib_devdata *dd, u32 minw, u32 *nent);
  1260. void qib_free_irq(struct qib_devdata *dd);
  1261. int qib_reinit_intr(struct qib_devdata *dd);
  1262. void qib_pcie_getcmd(struct qib_devdata *, u16 *, u8 *, u8 *);
  1263. void qib_pcie_reenable(struct qib_devdata *, u16, u8, u8);
  1264. /* interrupts for device */
  1265. u64 qib_int_counter(struct qib_devdata *);
  1266. /* interrupt for all devices */
  1267. u64 qib_sps_ints(void);
  1268. /*
  1269. * dma_addr wrappers - all 0's invalid for hw
  1270. */
  1271. int qib_map_page(struct pci_dev *d, struct page *p, dma_addr_t *daddr);
  1272. struct pci_dev *qib_get_pci_dev(struct rvt_dev_info *rdi);
  1273. /*
  1274. * Flush write combining store buffers (if present) and perform a write
  1275. * barrier.
  1276. */
  1277. static inline void qib_flush_wc(void)
  1278. {
  1279. #if defined(CONFIG_X86_64)
  1280. asm volatile("sfence" : : : "memory");
  1281. #else
  1282. wmb(); /* no reorder around wc flush */
  1283. #endif
  1284. }
  1285. /* global module parameter variables */
  1286. extern unsigned qib_ibmtu;
  1287. extern ushort qib_cfgctxts;
  1288. extern ushort qib_num_cfg_vls;
  1289. extern ushort qib_mini_init; /* If set, do few (ideally 0) writes to chip */
  1290. extern unsigned qib_n_krcv_queues;
  1291. extern unsigned qib_sdma_fetch_arb;
  1292. extern unsigned qib_compat_ddr_negotiate;
  1293. extern int qib_special_trigger;
  1294. extern unsigned qib_numa_aware;
  1295. extern struct mutex qib_mutex;
  1296. /* Number of seconds before our card status check... */
  1297. #define STATUS_TIMEOUT 60
  1298. #define QIB_DRV_NAME "ib_qib"
  1299. #define QIB_USER_MINOR_BASE 0
  1300. #define QIB_TRACE_MINOR 127
  1301. #define QIB_DIAGPKT_MINOR 128
  1302. #define QIB_DIAG_MINOR_BASE 129
  1303. #define QIB_NMINORS 255
  1304. #define PCI_VENDOR_ID_PATHSCALE 0x1fc1
  1305. #define PCI_VENDOR_ID_QLOGIC 0x1077
  1306. #define PCI_DEVICE_ID_QLOGIC_IB_6120 0x10
  1307. #define PCI_DEVICE_ID_QLOGIC_IB_7220 0x7220
  1308. #define PCI_DEVICE_ID_QLOGIC_IB_7322 0x7322
  1309. /*
  1310. * qib_early_err is used (only!) to print early errors before devdata is
  1311. * allocated, or when dd->pcidev may not be valid, and at the tail end of
  1312. * cleanup when devdata may have been freed, etc. qib_dev_porterr is
  1313. * the same as qib_dev_err, but is used when the message really needs
  1314. * the IB port# to be definitive as to what's happening..
  1315. * All of these go to the trace log, and the trace log entry is done
  1316. * first to avoid possible serial port delays from printk.
  1317. */
  1318. #define qib_early_err(dev, fmt, ...) \
  1319. dev_err(dev, fmt, ##__VA_ARGS__)
  1320. #define qib_dev_err(dd, fmt, ...) \
  1321. dev_err(&(dd)->pcidev->dev, "%s: " fmt, \
  1322. rvt_get_ibdev_name(&(dd)->verbs_dev.rdi), ##__VA_ARGS__)
  1323. #define qib_dev_warn(dd, fmt, ...) \
  1324. dev_warn(&(dd)->pcidev->dev, "%s: " fmt, \
  1325. rvt_get_ibdev_name(&(dd)->verbs_dev.rdi), ##__VA_ARGS__)
  1326. #define qib_dev_porterr(dd, port, fmt, ...) \
  1327. dev_err(&(dd)->pcidev->dev, "%s: IB%u:%u " fmt, \
  1328. rvt_get_ibdev_name(&(dd)->verbs_dev.rdi), (dd)->unit, (port), \
  1329. ##__VA_ARGS__)
  1330. #define qib_devinfo(pcidev, fmt, ...) \
  1331. dev_info(&(pcidev)->dev, fmt, ##__VA_ARGS__)
  1332. /*
  1333. * this is used for formatting hw error messages...
  1334. */
  1335. struct qib_hwerror_msgs {
  1336. u64 mask;
  1337. const char *msg;
  1338. size_t sz;
  1339. };
  1340. #define QLOGIC_IB_HWE_MSG(a, b) { .mask = a, .msg = b }
  1341. /* in qib_intr.c... */
  1342. void qib_format_hwerrors(u64 hwerrs,
  1343. const struct qib_hwerror_msgs *hwerrmsgs,
  1344. size_t nhwerrmsgs, char *msg, size_t lmsg);
  1345. void qib_stop_send_queue(struct rvt_qp *qp);
  1346. void qib_quiesce_qp(struct rvt_qp *qp);
  1347. void qib_flush_qp_waiters(struct rvt_qp *qp);
  1348. int qib_mtu_to_path_mtu(u32 mtu);
  1349. u32 qib_mtu_from_qp(struct rvt_dev_info *rdi, struct rvt_qp *qp, u32 pmtu);
  1350. void qib_notify_error_qp(struct rvt_qp *qp);
  1351. int qib_get_pmtu_from_attr(struct rvt_dev_info *rdi, struct rvt_qp *qp,
  1352. struct ib_qp_attr *attr);
  1353. #endif /* _QIB_KERNEL_H */