ipath_intr.c 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066
  1. /*
  2. * Copyright (c) 2006 QLogic, Inc. All rights reserved.
  3. * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
  4. *
  5. * This software is available to you under a choice of one of two
  6. * licenses. You may choose to be licensed under the terms of the GNU
  7. * General Public License (GPL) Version 2, available from the file
  8. * COPYING in the main directory of this source tree, or the
  9. * OpenIB.org BSD license below:
  10. *
  11. * Redistribution and use in source and binary forms, with or
  12. * without modification, are permitted provided that the following
  13. * conditions are met:
  14. *
  15. * - Redistributions of source code must retain the above
  16. * copyright notice, this list of conditions and the following
  17. * disclaimer.
  18. *
  19. * - Redistributions in binary form must reproduce the above
  20. * copyright notice, this list of conditions and the following
  21. * disclaimer in the documentation and/or other materials
  22. * provided with the distribution.
  23. *
  24. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  25. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  26. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  27. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  28. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  29. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  30. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  31. * SOFTWARE.
  32. */
  33. #include <linux/pci.h>
  34. #include "ipath_kernel.h"
  35. #include "ipath_verbs.h"
  36. #include "ipath_common.h"
  37. /* These are all rcv-related errors which we want to count for stats */
  38. #define E_SUM_PKTERRS \
  39. (INFINIPATH_E_RHDRLEN | INFINIPATH_E_RBADTID | \
  40. INFINIPATH_E_RBADVERSION | INFINIPATH_E_RHDR | \
  41. INFINIPATH_E_RLONGPKTLEN | INFINIPATH_E_RSHORTPKTLEN | \
  42. INFINIPATH_E_RMAXPKTLEN | INFINIPATH_E_RMINPKTLEN | \
  43. INFINIPATH_E_RFORMATERR | INFINIPATH_E_RUNSUPVL | \
  44. INFINIPATH_E_RUNEXPCHAR | INFINIPATH_E_REBP)
  45. /* These are all send-related errors which we want to count for stats */
  46. #define E_SUM_ERRS \
  47. (INFINIPATH_E_SPIOARMLAUNCH | INFINIPATH_E_SUNEXPERRPKTNUM | \
  48. INFINIPATH_E_SDROPPEDDATAPKT | INFINIPATH_E_SDROPPEDSMPPKT | \
  49. INFINIPATH_E_SMAXPKTLEN | INFINIPATH_E_SUNSUPVL | \
  50. INFINIPATH_E_SMINPKTLEN | INFINIPATH_E_SPKTLEN | \
  51. INFINIPATH_E_INVALIDADDR)
  52. /*
  53. * these are errors that can occur when the link changes state while
  54. * a packet is being sent or received. This doesn't cover things
  55. * like EBP or VCRC that can be the result of a sending having the
  56. * link change state, so we receive a "known bad" packet.
  57. */
  58. #define E_SUM_LINK_PKTERRS \
  59. (INFINIPATH_E_SDROPPEDDATAPKT | INFINIPATH_E_SDROPPEDSMPPKT | \
  60. INFINIPATH_E_SMINPKTLEN | INFINIPATH_E_SPKTLEN | \
  61. INFINIPATH_E_RSHORTPKTLEN | INFINIPATH_E_RMINPKTLEN | \
  62. INFINIPATH_E_RUNEXPCHAR)
  63. static u64 handle_e_sum_errs(struct ipath_devdata *dd, ipath_err_t errs)
  64. {
  65. unsigned long sbuf[4];
  66. u64 ignore_this_time = 0;
  67. u32 piobcnt;
  68. /* if possible that sendbuffererror could be valid */
  69. piobcnt = dd->ipath_piobcnt2k + dd->ipath_piobcnt4k;
  70. /* read these before writing errorclear */
  71. sbuf[0] = ipath_read_kreg64(
  72. dd, dd->ipath_kregs->kr_sendbuffererror);
  73. sbuf[1] = ipath_read_kreg64(
  74. dd, dd->ipath_kregs->kr_sendbuffererror + 1);
  75. if (piobcnt > 128) {
  76. sbuf[2] = ipath_read_kreg64(
  77. dd, dd->ipath_kregs->kr_sendbuffererror + 2);
  78. sbuf[3] = ipath_read_kreg64(
  79. dd, dd->ipath_kregs->kr_sendbuffererror + 3);
  80. }
  81. if (sbuf[0] || sbuf[1] || (piobcnt > 128 && (sbuf[2] || sbuf[3]))) {
  82. int i;
  83. ipath_cdbg(PKT, "SendbufErrs %lx %lx ", sbuf[0], sbuf[1]);
  84. if (ipath_debug & __IPATH_PKTDBG && piobcnt > 128)
  85. printk("%lx %lx ", sbuf[2], sbuf[3]);
  86. for (i = 0; i < piobcnt; i++) {
  87. if (test_bit(i, sbuf)) {
  88. u32 __iomem *piobuf;
  89. if (i < dd->ipath_piobcnt2k)
  90. piobuf = (u32 __iomem *)
  91. (dd->ipath_pio2kbase +
  92. i * dd->ipath_palign);
  93. else
  94. piobuf = (u32 __iomem *)
  95. (dd->ipath_pio4kbase +
  96. (i - dd->ipath_piobcnt2k) *
  97. dd->ipath_4kalign);
  98. ipath_cdbg(PKT,
  99. "PIObuf[%u] @%p pbc is %x; ",
  100. i, piobuf, readl(piobuf));
  101. ipath_disarm_piobufs(dd, i, 1);
  102. }
  103. }
  104. if (ipath_debug & __IPATH_PKTDBG)
  105. printk("\n");
  106. }
  107. if ((errs & E_SUM_LINK_PKTERRS) &&
  108. !(dd->ipath_flags & IPATH_LINKACTIVE)) {
  109. /*
  110. * This can happen when SMA is trying to bring the link
  111. * up, but the IB link changes state at the "wrong" time.
  112. * The IB logic then complains that the packet isn't
  113. * valid. We don't want to confuse people, so we just
  114. * don't print them, except at debug
  115. */
  116. ipath_dbg("Ignoring packet errors %llx, because link not "
  117. "ACTIVE\n", (unsigned long long) errs);
  118. ignore_this_time = errs & E_SUM_LINK_PKTERRS;
  119. }
  120. return ignore_this_time;
  121. }
  122. /* generic hw error messages... */
  123. #define INFINIPATH_HWE_TXEMEMPARITYERR_MSG(a) \
  124. { \
  125. .mask = ( INFINIPATH_HWE_TXEMEMPARITYERR_##a << \
  126. INFINIPATH_HWE_TXEMEMPARITYERR_SHIFT ), \
  127. .msg = "TXE " #a " Memory Parity" \
  128. }
  129. #define INFINIPATH_HWE_RXEMEMPARITYERR_MSG(a) \
  130. { \
  131. .mask = ( INFINIPATH_HWE_RXEMEMPARITYERR_##a << \
  132. INFINIPATH_HWE_RXEMEMPARITYERR_SHIFT ), \
  133. .msg = "RXE " #a " Memory Parity" \
  134. }
  135. static const struct ipath_hwerror_msgs ipath_generic_hwerror_msgs[] = {
  136. INFINIPATH_HWE_MSG(IBCBUSFRSPCPARITYERR, "IPATH2IB Parity"),
  137. INFINIPATH_HWE_MSG(IBCBUSTOSPCPARITYERR, "IB2IPATH Parity"),
  138. INFINIPATH_HWE_TXEMEMPARITYERR_MSG(PIOBUF),
  139. INFINIPATH_HWE_TXEMEMPARITYERR_MSG(PIOPBC),
  140. INFINIPATH_HWE_TXEMEMPARITYERR_MSG(PIOLAUNCHFIFO),
  141. INFINIPATH_HWE_RXEMEMPARITYERR_MSG(RCVBUF),
  142. INFINIPATH_HWE_RXEMEMPARITYERR_MSG(LOOKUPQ),
  143. INFINIPATH_HWE_RXEMEMPARITYERR_MSG(EAGERTID),
  144. INFINIPATH_HWE_RXEMEMPARITYERR_MSG(EXPTID),
  145. INFINIPATH_HWE_RXEMEMPARITYERR_MSG(FLAGBUF),
  146. INFINIPATH_HWE_RXEMEMPARITYERR_MSG(DATAINFO),
  147. INFINIPATH_HWE_RXEMEMPARITYERR_MSG(HDRINFO),
  148. };
  149. /**
  150. * ipath_format_hwmsg - format a single hwerror message
  151. * @msg message buffer
  152. * @msgl length of message buffer
  153. * @hwmsg message to add to message buffer
  154. */
  155. static void ipath_format_hwmsg(char *msg, size_t msgl, const char *hwmsg)
  156. {
  157. strlcat(msg, "[", msgl);
  158. strlcat(msg, hwmsg, msgl);
  159. strlcat(msg, "]", msgl);
  160. }
  161. /**
  162. * ipath_format_hwerrors - format hardware error messages for display
  163. * @hwerrs hardware errors bit vector
  164. * @hwerrmsgs hardware error descriptions
  165. * @nhwerrmsgs number of hwerrmsgs
  166. * @msg message buffer
  167. * @msgl message buffer length
  168. */
  169. void ipath_format_hwerrors(u64 hwerrs,
  170. const struct ipath_hwerror_msgs *hwerrmsgs,
  171. size_t nhwerrmsgs,
  172. char *msg, size_t msgl)
  173. {
  174. int i;
  175. const int glen =
  176. sizeof(ipath_generic_hwerror_msgs) /
  177. sizeof(ipath_generic_hwerror_msgs[0]);
  178. for (i=0; i<glen; i++) {
  179. if (hwerrs & ipath_generic_hwerror_msgs[i].mask) {
  180. ipath_format_hwmsg(msg, msgl,
  181. ipath_generic_hwerror_msgs[i].msg);
  182. }
  183. }
  184. for (i=0; i<nhwerrmsgs; i++) {
  185. if (hwerrs & hwerrmsgs[i].mask) {
  186. ipath_format_hwmsg(msg, msgl, hwerrmsgs[i].msg);
  187. }
  188. }
  189. }
  190. /* return the strings for the most common link states */
  191. static char *ib_linkstate(u32 linkstate)
  192. {
  193. char *ret;
  194. switch (linkstate) {
  195. case IPATH_IBSTATE_INIT:
  196. ret = "Init";
  197. break;
  198. case IPATH_IBSTATE_ARM:
  199. ret = "Arm";
  200. break;
  201. case IPATH_IBSTATE_ACTIVE:
  202. ret = "Active";
  203. break;
  204. default:
  205. ret = "Down";
  206. }
  207. return ret;
  208. }
  209. static void handle_e_ibstatuschanged(struct ipath_devdata *dd,
  210. ipath_err_t errs, int noprint)
  211. {
  212. u64 val;
  213. u32 ltstate, lstate;
  214. /*
  215. * even if diags are enabled, we want to notice LINKINIT, etc.
  216. * We just don't want to change the LED state, or
  217. * dd->ipath_kregs->kr_ibcctrl
  218. */
  219. val = ipath_read_kreg64(dd, dd->ipath_kregs->kr_ibcstatus);
  220. lstate = val & IPATH_IBSTATE_MASK;
  221. /*
  222. * this is confusing enough when it happens that I want to always put it
  223. * on the console and in the logs. If it was a requested state change,
  224. * we'll have already cleared the flags, so we won't print this warning
  225. */
  226. if ((lstate != IPATH_IBSTATE_ARM && lstate != IPATH_IBSTATE_ACTIVE)
  227. && (dd->ipath_flags & (IPATH_LINKARMED | IPATH_LINKACTIVE))) {
  228. dev_info(&dd->pcidev->dev, "Link state changed from %s to %s\n",
  229. (dd->ipath_flags & IPATH_LINKARMED) ? "ARM" : "ACTIVE",
  230. ib_linkstate(lstate));
  231. /*
  232. * Flush all queued sends when link went to DOWN or INIT,
  233. * to be sure that they don't block SMA and other MAD packets
  234. */
  235. ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl,
  236. INFINIPATH_S_ABORT);
  237. ipath_disarm_piobufs(dd, dd->ipath_lastport_piobuf,
  238. (unsigned)(dd->ipath_piobcnt2k +
  239. dd->ipath_piobcnt4k) -
  240. dd->ipath_lastport_piobuf);
  241. }
  242. else if (lstate == IPATH_IBSTATE_INIT || lstate == IPATH_IBSTATE_ARM ||
  243. lstate == IPATH_IBSTATE_ACTIVE) {
  244. /*
  245. * only print at SMA if there is a change, debug if not
  246. * (sometimes we want to know that, usually not).
  247. */
  248. if (lstate == ((unsigned) dd->ipath_lastibcstat
  249. & IPATH_IBSTATE_MASK)) {
  250. ipath_dbg("Status change intr but no change (%s)\n",
  251. ib_linkstate(lstate));
  252. }
  253. else
  254. ipath_cdbg(VERBOSE, "Unit %u link state %s, last "
  255. "was %s\n", dd->ipath_unit,
  256. ib_linkstate(lstate),
  257. ib_linkstate((unsigned)
  258. dd->ipath_lastibcstat
  259. & IPATH_IBSTATE_MASK));
  260. }
  261. else {
  262. lstate = dd->ipath_lastibcstat & IPATH_IBSTATE_MASK;
  263. if (lstate == IPATH_IBSTATE_INIT ||
  264. lstate == IPATH_IBSTATE_ARM ||
  265. lstate == IPATH_IBSTATE_ACTIVE)
  266. ipath_cdbg(VERBOSE, "Unit %u link state down"
  267. " (state 0x%x), from %s\n",
  268. dd->ipath_unit,
  269. (u32)val & IPATH_IBSTATE_MASK,
  270. ib_linkstate(lstate));
  271. else
  272. ipath_cdbg(VERBOSE, "Unit %u link state changed "
  273. "to 0x%x from down (%x)\n",
  274. dd->ipath_unit, (u32) val, lstate);
  275. }
  276. ltstate = (val >> INFINIPATH_IBCS_LINKTRAININGSTATE_SHIFT) &
  277. INFINIPATH_IBCS_LINKTRAININGSTATE_MASK;
  278. lstate = (val >> INFINIPATH_IBCS_LINKSTATE_SHIFT) &
  279. INFINIPATH_IBCS_LINKSTATE_MASK;
  280. if (ltstate == INFINIPATH_IBCS_LT_STATE_POLLACTIVE ||
  281. ltstate == INFINIPATH_IBCS_LT_STATE_POLLQUIET) {
  282. u32 last_ltstate;
  283. /*
  284. * Ignore cycling back and forth from Polling.Active
  285. * to Polling.Quiet while waiting for the other end of
  286. * the link to come up. We will cycle back and forth
  287. * between them if no cable is plugged in,
  288. * the other device is powered off or disabled, etc.
  289. */
  290. last_ltstate = (dd->ipath_lastibcstat >>
  291. INFINIPATH_IBCS_LINKTRAININGSTATE_SHIFT)
  292. & INFINIPATH_IBCS_LINKTRAININGSTATE_MASK;
  293. if (last_ltstate == INFINIPATH_IBCS_LT_STATE_POLLACTIVE
  294. || last_ltstate ==
  295. INFINIPATH_IBCS_LT_STATE_POLLQUIET) {
  296. if (dd->ipath_ibpollcnt > 40) {
  297. dd->ipath_flags |= IPATH_NOCABLE;
  298. *dd->ipath_statusp |=
  299. IPATH_STATUS_IB_NOCABLE;
  300. } else
  301. dd->ipath_ibpollcnt++;
  302. goto skip_ibchange;
  303. }
  304. }
  305. dd->ipath_ibpollcnt = 0; /* some state other than 2 or 3 */
  306. ipath_stats.sps_iblink++;
  307. if (ltstate != INFINIPATH_IBCS_LT_STATE_LINKUP) {
  308. dd->ipath_flags |= IPATH_LINKDOWN;
  309. dd->ipath_flags &= ~(IPATH_LINKUNK | IPATH_LINKINIT
  310. | IPATH_LINKACTIVE |
  311. IPATH_LINKARMED);
  312. *dd->ipath_statusp &= ~IPATH_STATUS_IB_READY;
  313. dd->ipath_lli_counter = 0;
  314. if (!noprint) {
  315. if (((dd->ipath_lastibcstat >>
  316. INFINIPATH_IBCS_LINKSTATE_SHIFT) &
  317. INFINIPATH_IBCS_LINKSTATE_MASK)
  318. == INFINIPATH_IBCS_L_STATE_ACTIVE)
  319. /* if from up to down be more vocal */
  320. ipath_cdbg(VERBOSE,
  321. "Unit %u link now down (%s)\n",
  322. dd->ipath_unit,
  323. ipath_ibcstatus_str[ltstate]);
  324. else
  325. ipath_cdbg(VERBOSE, "Unit %u link is "
  326. "down (%s)\n", dd->ipath_unit,
  327. ipath_ibcstatus_str[ltstate]);
  328. }
  329. dd->ipath_f_setextled(dd, lstate, ltstate);
  330. } else if ((val & IPATH_IBSTATE_MASK) == IPATH_IBSTATE_ACTIVE) {
  331. dd->ipath_flags |= IPATH_LINKACTIVE;
  332. dd->ipath_flags &=
  333. ~(IPATH_LINKUNK | IPATH_LINKINIT | IPATH_LINKDOWN |
  334. IPATH_LINKARMED | IPATH_NOCABLE);
  335. *dd->ipath_statusp &= ~IPATH_STATUS_IB_NOCABLE;
  336. *dd->ipath_statusp |=
  337. IPATH_STATUS_IB_READY | IPATH_STATUS_IB_CONF;
  338. dd->ipath_f_setextled(dd, lstate, ltstate);
  339. } else if ((val & IPATH_IBSTATE_MASK) == IPATH_IBSTATE_INIT) {
  340. /*
  341. * set INIT and DOWN. Down is checked by most of the other
  342. * code, but INIT is useful to know in a few places.
  343. */
  344. dd->ipath_flags |= IPATH_LINKINIT | IPATH_LINKDOWN;
  345. dd->ipath_flags &=
  346. ~(IPATH_LINKUNK | IPATH_LINKACTIVE | IPATH_LINKARMED
  347. | IPATH_NOCABLE);
  348. *dd->ipath_statusp &= ~(IPATH_STATUS_IB_NOCABLE
  349. | IPATH_STATUS_IB_READY);
  350. dd->ipath_f_setextled(dd, lstate, ltstate);
  351. } else if ((val & IPATH_IBSTATE_MASK) == IPATH_IBSTATE_ARM) {
  352. dd->ipath_flags |= IPATH_LINKARMED;
  353. dd->ipath_flags &=
  354. ~(IPATH_LINKUNK | IPATH_LINKDOWN | IPATH_LINKINIT |
  355. IPATH_LINKACTIVE | IPATH_NOCABLE);
  356. *dd->ipath_statusp &= ~(IPATH_STATUS_IB_NOCABLE
  357. | IPATH_STATUS_IB_READY);
  358. dd->ipath_f_setextled(dd, lstate, ltstate);
  359. } else {
  360. if (!noprint)
  361. ipath_dbg("IBstatuschange unit %u: %s (%x)\n",
  362. dd->ipath_unit,
  363. ipath_ibcstatus_str[ltstate], ltstate);
  364. }
  365. skip_ibchange:
  366. dd->ipath_lastibcstat = val;
  367. }
  368. static void handle_supp_msgs(struct ipath_devdata *dd,
  369. unsigned supp_msgs, char msg[512])
  370. {
  371. /*
  372. * Print the message unless it's ibc status change only, which
  373. * happens so often we never want to count it.
  374. */
  375. if (dd->ipath_lasterror & ~INFINIPATH_E_IBSTATUSCHANGED) {
  376. ipath_decode_err(msg, sizeof msg, dd->ipath_lasterror &
  377. ~INFINIPATH_E_IBSTATUSCHANGED);
  378. if (dd->ipath_lasterror &
  379. ~(INFINIPATH_E_RRCVEGRFULL | INFINIPATH_E_RRCVHDRFULL))
  380. ipath_dev_err(dd, "Suppressed %u messages for "
  381. "fast-repeating errors (%s) (%llx)\n",
  382. supp_msgs, msg,
  383. (unsigned long long)
  384. dd->ipath_lasterror);
  385. else {
  386. /*
  387. * rcvegrfull and rcvhdrqfull are "normal", for some
  388. * types of processes (mostly benchmarks) that send
  389. * huge numbers of messages, while not processing
  390. * them. So only complain about these at debug
  391. * level.
  392. */
  393. ipath_dbg("Suppressed %u messages for %s\n",
  394. supp_msgs, msg);
  395. }
  396. }
  397. }
  398. static unsigned handle_frequent_errors(struct ipath_devdata *dd,
  399. ipath_err_t errs, char msg[512],
  400. int *noprint)
  401. {
  402. unsigned long nc;
  403. static unsigned long nextmsg_time;
  404. static unsigned nmsgs, supp_msgs;
  405. /*
  406. * Throttle back "fast" messages to no more than 10 per 5 seconds.
  407. * This isn't perfect, but it's a reasonable heuristic. If we get
  408. * more than 10, give a 6x longer delay.
  409. */
  410. nc = jiffies;
  411. if (nmsgs > 10) {
  412. if (time_before(nc, nextmsg_time)) {
  413. *noprint = 1;
  414. if (!supp_msgs++)
  415. nextmsg_time = nc + HZ * 3;
  416. }
  417. else if (supp_msgs) {
  418. handle_supp_msgs(dd, supp_msgs, msg);
  419. supp_msgs = 0;
  420. nmsgs = 0;
  421. }
  422. }
  423. else if (!nmsgs++ || time_after(nc, nextmsg_time))
  424. nextmsg_time = nc + HZ / 2;
  425. return supp_msgs;
  426. }
  427. static int handle_errors(struct ipath_devdata *dd, ipath_err_t errs)
  428. {
  429. char msg[512];
  430. u64 ignore_this_time = 0;
  431. int i;
  432. int chkerrpkts = 0, noprint = 0;
  433. unsigned supp_msgs;
  434. supp_msgs = handle_frequent_errors(dd, errs, msg, &noprint);
  435. /*
  436. * don't report errors that are masked (includes those always
  437. * ignored)
  438. */
  439. errs &= ~dd->ipath_maskederrs;
  440. /* do these first, they are most important */
  441. if (errs & INFINIPATH_E_HARDWARE) {
  442. /* reuse same msg buf */
  443. dd->ipath_f_handle_hwerrors(dd, msg, sizeof msg);
  444. }
  445. if (!noprint && (errs & ~dd->ipath_e_bitsextant))
  446. ipath_dev_err(dd, "error interrupt with unknown errors "
  447. "%llx set\n", (unsigned long long)
  448. (errs & ~dd->ipath_e_bitsextant));
  449. if (errs & E_SUM_ERRS)
  450. ignore_this_time = handle_e_sum_errs(dd, errs);
  451. else if ((errs & E_SUM_LINK_PKTERRS) &&
  452. !(dd->ipath_flags & IPATH_LINKACTIVE)) {
  453. /*
  454. * This can happen when SMA is trying to bring the link
  455. * up, but the IB link changes state at the "wrong" time.
  456. * The IB logic then complains that the packet isn't
  457. * valid. We don't want to confuse people, so we just
  458. * don't print them, except at debug
  459. */
  460. ipath_dbg("Ignoring packet errors %llx, because link not "
  461. "ACTIVE\n", (unsigned long long) errs);
  462. ignore_this_time = errs & E_SUM_LINK_PKTERRS;
  463. }
  464. if (supp_msgs == 250000) {
  465. /*
  466. * It's not entirely reasonable assuming that the errors set
  467. * in the last clear period are all responsible for the
  468. * problem, but the alternative is to assume it's the only
  469. * ones on this particular interrupt, which also isn't great
  470. */
  471. dd->ipath_maskederrs |= dd->ipath_lasterror | errs;
  472. ipath_write_kreg(dd, dd->ipath_kregs->kr_errormask,
  473. ~dd->ipath_maskederrs);
  474. ipath_decode_err(msg, sizeof msg,
  475. (dd->ipath_maskederrs & ~dd->
  476. ipath_ignorederrs));
  477. if ((dd->ipath_maskederrs & ~dd->ipath_ignorederrs) &
  478. ~(INFINIPATH_E_RRCVEGRFULL | INFINIPATH_E_RRCVHDRFULL))
  479. ipath_dev_err(dd, "Disabling error(s) %llx because "
  480. "occurring too frequently (%s)\n",
  481. (unsigned long long)
  482. (dd->ipath_maskederrs &
  483. ~dd->ipath_ignorederrs), msg);
  484. else {
  485. /*
  486. * rcvegrfull and rcvhdrqfull are "normal",
  487. * for some types of processes (mostly benchmarks)
  488. * that send huge numbers of messages, while not
  489. * processing them. So only complain about
  490. * these at debug level.
  491. */
  492. ipath_dbg("Disabling frequent queue full errors "
  493. "(%s)\n", msg);
  494. }
  495. /*
  496. * Re-enable the masked errors after around 3 minutes. in
  497. * ipath_get_faststats(). If we have a series of fast
  498. * repeating but different errors, the interval will keep
  499. * stretching out, but that's OK, as that's pretty
  500. * catastrophic.
  501. */
  502. dd->ipath_unmasktime = jiffies + HZ * 180;
  503. }
  504. ipath_write_kreg(dd, dd->ipath_kregs->kr_errorclear, errs);
  505. if (ignore_this_time)
  506. errs &= ~ignore_this_time;
  507. if (errs & ~dd->ipath_lasterror) {
  508. errs &= ~dd->ipath_lasterror;
  509. /* never suppress duplicate hwerrors or ibstatuschange */
  510. dd->ipath_lasterror |= errs &
  511. ~(INFINIPATH_E_HARDWARE |
  512. INFINIPATH_E_IBSTATUSCHANGED);
  513. }
  514. if (!errs)
  515. return 0;
  516. if (!noprint)
  517. /*
  518. * the ones we mask off are handled specially below or above
  519. */
  520. ipath_decode_err(msg, sizeof msg,
  521. errs & ~(INFINIPATH_E_IBSTATUSCHANGED |
  522. INFINIPATH_E_RRCVEGRFULL |
  523. INFINIPATH_E_RRCVHDRFULL |
  524. INFINIPATH_E_HARDWARE));
  525. else
  526. /* so we don't need if (!noprint) at strlcat's below */
  527. *msg = 0;
  528. if (errs & E_SUM_PKTERRS) {
  529. ipath_stats.sps_pkterrs++;
  530. chkerrpkts = 1;
  531. }
  532. if (errs & E_SUM_ERRS)
  533. ipath_stats.sps_errs++;
  534. if (errs & (INFINIPATH_E_RICRC | INFINIPATH_E_RVCRC)) {
  535. ipath_stats.sps_crcerrs++;
  536. chkerrpkts = 1;
  537. }
  538. /*
  539. * We don't want to print these two as they happen, or we can make
  540. * the situation even worse, because it takes so long to print
  541. * messages to serial consoles. Kernel ports get printed from
  542. * fast_stats, no more than every 5 seconds, user ports get printed
  543. * on close
  544. */
  545. if (errs & INFINIPATH_E_RRCVHDRFULL) {
  546. int any;
  547. u32 hd, tl;
  548. ipath_stats.sps_hdrqfull++;
  549. for (any = i = 0; i < dd->ipath_cfgports; i++) {
  550. struct ipath_portdata *pd = dd->ipath_pd[i];
  551. if (i == 0) {
  552. hd = dd->ipath_port0head;
  553. tl = (u32) le64_to_cpu(
  554. *dd->ipath_hdrqtailptr);
  555. } else if (pd && pd->port_cnt &&
  556. pd->port_rcvhdrtail_kvaddr) {
  557. /*
  558. * don't report same point multiple times,
  559. * except kernel
  560. */
  561. tl = (u32) * pd->port_rcvhdrtail_kvaddr;
  562. if (tl == dd->ipath_lastrcvhdrqtails[i])
  563. continue;
  564. hd = ipath_read_ureg32(dd, ur_rcvhdrhead,
  565. i);
  566. } else
  567. continue;
  568. if (hd == (tl + 1) ||
  569. (!hd && tl == dd->ipath_hdrqlast)) {
  570. if (i == 0)
  571. chkerrpkts = 1;
  572. dd->ipath_lastrcvhdrqtails[i] = tl;
  573. pd->port_hdrqfull++;
  574. }
  575. }
  576. }
  577. if (errs & INFINIPATH_E_RRCVEGRFULL) {
  578. /*
  579. * since this is of less importance and not likely to
  580. * happen without also getting hdrfull, only count
  581. * occurrences; don't check each port (or even the kernel
  582. * vs user)
  583. */
  584. ipath_stats.sps_etidfull++;
  585. if (dd->ipath_port0head !=
  586. (u32) le64_to_cpu(*dd->ipath_hdrqtailptr))
  587. chkerrpkts = 1;
  588. }
  589. /*
  590. * do this before IBSTATUSCHANGED, in case both bits set in a single
  591. * interrupt; we want the STATUSCHANGE to "win", so we do our
  592. * internal copy of state machine correctly
  593. */
  594. if (errs & INFINIPATH_E_RIBLOSTLINK) {
  595. /*
  596. * force through block below
  597. */
  598. errs |= INFINIPATH_E_IBSTATUSCHANGED;
  599. ipath_stats.sps_iblink++;
  600. dd->ipath_flags |= IPATH_LINKDOWN;
  601. dd->ipath_flags &= ~(IPATH_LINKUNK | IPATH_LINKINIT
  602. | IPATH_LINKARMED | IPATH_LINKACTIVE);
  603. *dd->ipath_statusp &= ~IPATH_STATUS_IB_READY;
  604. if (!noprint) {
  605. u64 st = ipath_read_kreg64(
  606. dd, dd->ipath_kregs->kr_ibcstatus);
  607. ipath_dbg("Lost link, link now down (%s)\n",
  608. ipath_ibcstatus_str[st & 0xf]);
  609. }
  610. }
  611. if (errs & INFINIPATH_E_IBSTATUSCHANGED)
  612. handle_e_ibstatuschanged(dd, errs, noprint);
  613. if (errs & INFINIPATH_E_RESET) {
  614. if (!noprint)
  615. ipath_dev_err(dd, "Got reset, requires re-init "
  616. "(unload and reload driver)\n");
  617. dd->ipath_flags &= ~IPATH_INITTED; /* needs re-init */
  618. /* mark as having had error */
  619. *dd->ipath_statusp |= IPATH_STATUS_HWERROR;
  620. *dd->ipath_statusp &= ~IPATH_STATUS_IB_CONF;
  621. }
  622. if (!noprint && *msg)
  623. ipath_dev_err(dd, "%s error\n", msg);
  624. if (dd->ipath_state_wanted & dd->ipath_flags) {
  625. ipath_cdbg(VERBOSE, "driver wanted state %x, iflags now %x, "
  626. "waking\n", dd->ipath_state_wanted,
  627. dd->ipath_flags);
  628. wake_up_interruptible(&ipath_state_wait);
  629. }
  630. return chkerrpkts;
  631. }
  632. /* this is separate to allow for better optimization of ipath_intr() */
  633. static void ipath_bad_intr(struct ipath_devdata *dd, u32 * unexpectp)
  634. {
  635. /*
  636. * sometimes happen during driver init and unload, don't want
  637. * to process any interrupts at that point
  638. */
  639. /* this is just a bandaid, not a fix, if something goes badly
  640. * wrong */
  641. if (++*unexpectp > 100) {
  642. if (++*unexpectp > 105) {
  643. /*
  644. * ok, we must be taking somebody else's interrupts,
  645. * due to a messed up mptable and/or PIRQ table, so
  646. * unregister the interrupt. We've seen this during
  647. * linuxbios development work, and it may happen in
  648. * the future again.
  649. */
  650. if (dd->pcidev && dd->pcidev->irq) {
  651. ipath_dev_err(dd, "Now %u unexpected "
  652. "interrupts, unregistering "
  653. "interrupt handler\n",
  654. *unexpectp);
  655. ipath_dbg("free_irq of irq %x\n",
  656. dd->pcidev->irq);
  657. free_irq(dd->pcidev->irq, dd);
  658. }
  659. }
  660. if (ipath_read_kreg32(dd, dd->ipath_kregs->kr_intmask)) {
  661. ipath_dev_err(dd, "%u unexpected interrupts, "
  662. "disabling interrupts completely\n",
  663. *unexpectp);
  664. /*
  665. * disable all interrupts, something is very wrong
  666. */
  667. ipath_write_kreg(dd, dd->ipath_kregs->kr_intmask,
  668. 0ULL);
  669. }
  670. } else if (*unexpectp > 1)
  671. ipath_dbg("Interrupt when not ready, should not happen, "
  672. "ignoring\n");
  673. }
  674. static void ipath_bad_regread(struct ipath_devdata *dd)
  675. {
  676. static int allbits;
  677. /* separate routine, for better optimization of ipath_intr() */
  678. /*
  679. * We print the message and disable interrupts, in hope of
  680. * having a better chance of debugging the problem.
  681. */
  682. ipath_dev_err(dd,
  683. "Read of interrupt status failed (all bits set)\n");
  684. if (allbits++) {
  685. /* disable all interrupts, something is very wrong */
  686. ipath_write_kreg(dd, dd->ipath_kregs->kr_intmask, 0ULL);
  687. if (allbits == 2) {
  688. ipath_dev_err(dd, "Still bad interrupt status, "
  689. "unregistering interrupt\n");
  690. free_irq(dd->pcidev->irq, dd);
  691. } else if (allbits > 2) {
  692. if ((allbits % 10000) == 0)
  693. printk(".");
  694. } else
  695. ipath_dev_err(dd, "Disabling interrupts, "
  696. "multiple errors\n");
  697. }
  698. }
  699. static void handle_port_pioavail(struct ipath_devdata *dd)
  700. {
  701. u32 i;
  702. /*
  703. * start from port 1, since for now port 0 is never using
  704. * wait_event for PIO
  705. */
  706. for (i = 1; dd->ipath_portpiowait && i < dd->ipath_cfgports; i++) {
  707. struct ipath_portdata *pd = dd->ipath_pd[i];
  708. if (pd && pd->port_cnt &&
  709. dd->ipath_portpiowait & (1U << i)) {
  710. clear_bit(i, &dd->ipath_portpiowait);
  711. if (test_bit(IPATH_PORT_WAITING_PIO,
  712. &pd->port_flag)) {
  713. clear_bit(IPATH_PORT_WAITING_PIO,
  714. &pd->port_flag);
  715. wake_up_interruptible(&pd->port_wait);
  716. }
  717. }
  718. }
  719. }
  720. static void handle_layer_pioavail(struct ipath_devdata *dd)
  721. {
  722. int ret;
  723. ret = ipath_ib_piobufavail(dd->verbs_dev);
  724. if (ret > 0)
  725. goto set;
  726. return;
  727. set:
  728. set_bit(IPATH_S_PIOINTBUFAVAIL, &dd->ipath_sendctrl);
  729. ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl,
  730. dd->ipath_sendctrl);
  731. }
  732. /*
  733. * Handle receive interrupts for user ports; this means a user
  734. * process was waiting for a packet to arrive, and didn't want
  735. * to poll
  736. */
  737. static void handle_urcv(struct ipath_devdata *dd, u32 istat)
  738. {
  739. u64 portr;
  740. int i;
  741. int rcvdint = 0;
  742. portr = ((istat >> INFINIPATH_I_RCVAVAIL_SHIFT) &
  743. dd->ipath_i_rcvavail_mask)
  744. | ((istat >> INFINIPATH_I_RCVURG_SHIFT) &
  745. dd->ipath_i_rcvurg_mask);
  746. for (i = 1; i < dd->ipath_cfgports; i++) {
  747. struct ipath_portdata *pd = dd->ipath_pd[i];
  748. if (portr & (1 << i) && pd && pd->port_cnt &&
  749. test_bit(IPATH_PORT_WAITING_RCV, &pd->port_flag)) {
  750. int rcbit;
  751. clear_bit(IPATH_PORT_WAITING_RCV,
  752. &pd->port_flag);
  753. rcbit = i + INFINIPATH_R_INTRAVAIL_SHIFT;
  754. clear_bit(1UL << rcbit, &dd->ipath_rcvctrl);
  755. wake_up_interruptible(&pd->port_wait);
  756. rcvdint = 1;
  757. }
  758. }
  759. if (rcvdint) {
  760. /* only want to take one interrupt, so turn off the rcv
  761. * interrupt for all the ports that we did the wakeup on
  762. * (but never for kernel port)
  763. */
  764. ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl,
  765. dd->ipath_rcvctrl);
  766. }
  767. }
  768. irqreturn_t ipath_intr(int irq, void *data, struct pt_regs *regs)
  769. {
  770. struct ipath_devdata *dd = data;
  771. u32 istat, chk0rcv = 0;
  772. ipath_err_t estat = 0;
  773. irqreturn_t ret;
  774. u32 oldhead, curtail;
  775. static unsigned unexpected = 0;
  776. static const u32 port0rbits = (1U<<INFINIPATH_I_RCVAVAIL_SHIFT) |
  777. (1U<<INFINIPATH_I_RCVURG_SHIFT);
  778. ipath_stats.sps_ints++;
  779. if (!(dd->ipath_flags & IPATH_PRESENT)) {
  780. /*
  781. * This return value is not great, but we do not want the
  782. * interrupt core code to remove our interrupt handler
  783. * because we don't appear to be handling an interrupt
  784. * during a chip reset.
  785. */
  786. return IRQ_HANDLED;
  787. }
  788. /*
  789. * this needs to be flags&initted, not statusp, so we keep
  790. * taking interrupts even after link goes down, etc.
  791. * Also, we *must* clear the interrupt at some point, or we won't
  792. * take it again, which can be real bad for errors, etc...
  793. */
  794. if (!(dd->ipath_flags & IPATH_INITTED)) {
  795. ipath_bad_intr(dd, &unexpected);
  796. ret = IRQ_NONE;
  797. goto bail;
  798. }
  799. /*
  800. * We try to avoid reading the interrupt status register, since
  801. * that's a PIO read, and stalls the processor for up to about
  802. * ~0.25 usec. The idea is that if we processed a port0 packet,
  803. * we blindly clear the port 0 receive interrupt bits, and nothing
  804. * else, then return. If other interrupts are pending, the chip
  805. * will re-interrupt us as soon as we write the intclear register.
  806. * We then won't process any more kernel packets (if not the 2nd
  807. * time, then the 3rd or 4th) and we'll then handle the other
  808. * interrupts. We clear the interrupts first so that we don't
  809. * lose intr for later packets that arrive while we are processing.
  810. */
  811. oldhead = dd->ipath_port0head;
  812. curtail = (u32)le64_to_cpu(*dd->ipath_hdrqtailptr);
  813. if (oldhead != curtail) {
  814. if (dd->ipath_flags & IPATH_GPIO_INTR) {
  815. ipath_write_kreg(dd, dd->ipath_kregs->kr_gpio_clear,
  816. (u64) (1 << IPATH_GPIO_PORT0_BIT));
  817. istat = port0rbits | INFINIPATH_I_GPIO;
  818. }
  819. else
  820. istat = port0rbits;
  821. ipath_write_kreg(dd, dd->ipath_kregs->kr_intclear, istat);
  822. ipath_kreceive(dd);
  823. if (oldhead != dd->ipath_port0head) {
  824. ipath_stats.sps_fastrcvint++;
  825. goto done;
  826. }
  827. }
  828. istat = ipath_read_kreg32(dd, dd->ipath_kregs->kr_intstatus);
  829. if (unlikely(!istat)) {
  830. ipath_stats.sps_nullintr++;
  831. ret = IRQ_NONE; /* not our interrupt, or already handled */
  832. goto bail;
  833. }
  834. if (unlikely(istat == -1)) {
  835. ipath_bad_regread(dd);
  836. /* don't know if it was our interrupt or not */
  837. ret = IRQ_NONE;
  838. goto bail;
  839. }
  840. if (unexpected)
  841. unexpected = 0;
  842. if (unlikely(istat & ~dd->ipath_i_bitsextant))
  843. ipath_dev_err(dd,
  844. "interrupt with unknown interrupts %x set\n",
  845. istat & (u32) ~ dd->ipath_i_bitsextant);
  846. else
  847. ipath_cdbg(VERBOSE, "intr stat=0x%x\n", istat);
  848. if (unlikely(istat & INFINIPATH_I_ERROR)) {
  849. ipath_stats.sps_errints++;
  850. estat = ipath_read_kreg64(dd,
  851. dd->ipath_kregs->kr_errorstatus);
  852. if (!estat)
  853. dev_info(&dd->pcidev->dev, "error interrupt (%x), "
  854. "but no error bits set!\n", istat);
  855. else if (estat == -1LL)
  856. /*
  857. * should we try clearing all, or hope next read
  858. * works?
  859. */
  860. ipath_dev_err(dd, "Read of error status failed "
  861. "(all bits set); ignoring\n");
  862. else
  863. if (handle_errors(dd, estat))
  864. /* force calling ipath_kreceive() */
  865. chk0rcv = 1;
  866. }
  867. if (istat & INFINIPATH_I_GPIO) {
  868. /*
  869. * GPIO interrupts fall in two broad classes:
  870. * GPIO_2 indicates (on some HT4xx boards) that a packet
  871. * has arrived for Port 0. Checking for this
  872. * is controlled by flag IPATH_GPIO_INTR.
  873. * GPIO_3..5 on IBA6120 Rev2 chips indicate errors
  874. * that we need to count. Checking for this
  875. * is controlled by flag IPATH_GPIO_ERRINTRS.
  876. */
  877. u32 gpiostatus;
  878. u32 to_clear = 0;
  879. gpiostatus = ipath_read_kreg32(
  880. dd, dd->ipath_kregs->kr_gpio_status);
  881. /* First the error-counter case.
  882. */
  883. if ((gpiostatus & IPATH_GPIO_ERRINTR_MASK) &&
  884. (dd->ipath_flags & IPATH_GPIO_ERRINTRS)) {
  885. /* want to clear the bits we see asserted. */
  886. to_clear |= (gpiostatus & IPATH_GPIO_ERRINTR_MASK);
  887. /*
  888. * Count appropriately, clear bits out of our copy,
  889. * as they have been "handled".
  890. */
  891. if (gpiostatus & (1 << IPATH_GPIO_RXUVL_BIT)) {
  892. ipath_dbg("FlowCtl on UnsupVL\n");
  893. dd->ipath_rxfc_unsupvl_errs++;
  894. }
  895. if (gpiostatus & (1 << IPATH_GPIO_OVRUN_BIT)) {
  896. ipath_dbg("Overrun Threshold exceeded\n");
  897. dd->ipath_overrun_thresh_errs++;
  898. }
  899. if (gpiostatus & (1 << IPATH_GPIO_LLI_BIT)) {
  900. ipath_dbg("Local Link Integrity error\n");
  901. dd->ipath_lli_errs++;
  902. }
  903. gpiostatus &= ~IPATH_GPIO_ERRINTR_MASK;
  904. }
  905. /* Now the Port0 Receive case */
  906. if ((gpiostatus & (1 << IPATH_GPIO_PORT0_BIT)) &&
  907. (dd->ipath_flags & IPATH_GPIO_INTR)) {
  908. /*
  909. * GPIO status bit 2 is set, and we expected it.
  910. * clear it and indicate in p0bits.
  911. * This probably only happens if a Port0 pkt
  912. * arrives at _just_ the wrong time, and we
  913. * handle that by seting chk0rcv;
  914. */
  915. to_clear |= (1 << IPATH_GPIO_PORT0_BIT);
  916. gpiostatus &= ~(1 << IPATH_GPIO_PORT0_BIT);
  917. chk0rcv = 1;
  918. }
  919. if (unlikely(gpiostatus)) {
  920. /*
  921. * Some unexpected bits remain. If they could have
  922. * caused the interrupt, complain and clear.
  923. * MEA: this is almost certainly non-ideal.
  924. * we should look into auto-disable of unexpected
  925. * GPIO interrupts, possibly on a "three strikes"
  926. * basis.
  927. */
  928. u32 mask;
  929. mask = ipath_read_kreg32(
  930. dd, dd->ipath_kregs->kr_gpio_mask);
  931. if (mask & gpiostatus) {
  932. ipath_dbg("Unexpected GPIO IRQ bits %x\n",
  933. gpiostatus & mask);
  934. to_clear |= (gpiostatus & mask);
  935. }
  936. }
  937. if (to_clear) {
  938. ipath_write_kreg(dd, dd->ipath_kregs->kr_gpio_clear,
  939. (u64) to_clear);
  940. }
  941. }
  942. chk0rcv |= istat & port0rbits;
  943. /*
  944. * Clear the interrupt bits we found set, unless they are receive
  945. * related, in which case we already cleared them above, and don't
  946. * want to clear them again, because we might lose an interrupt.
  947. * Clear it early, so we "know" know the chip will have seen this by
  948. * the time we process the queue, and will re-interrupt if necessary.
  949. * The processor itself won't take the interrupt again until we return.
  950. */
  951. ipath_write_kreg(dd, dd->ipath_kregs->kr_intclear, istat);
  952. /*
  953. * handle port0 receive before checking for pio buffers available,
  954. * since receives can overflow; piobuf waiters can afford a few
  955. * extra cycles, since they were waiting anyway, and user's waiting
  956. * for receive are at the bottom.
  957. */
  958. if (chk0rcv) {
  959. ipath_kreceive(dd);
  960. istat &= ~port0rbits;
  961. }
  962. if (istat & ((dd->ipath_i_rcvavail_mask <<
  963. INFINIPATH_I_RCVAVAIL_SHIFT)
  964. | (dd->ipath_i_rcvurg_mask <<
  965. INFINIPATH_I_RCVURG_SHIFT)))
  966. handle_urcv(dd, istat);
  967. if (istat & INFINIPATH_I_SPIOBUFAVAIL) {
  968. clear_bit(IPATH_S_PIOINTBUFAVAIL, &dd->ipath_sendctrl);
  969. ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl,
  970. dd->ipath_sendctrl);
  971. if (dd->ipath_portpiowait)
  972. handle_port_pioavail(dd);
  973. handle_layer_pioavail(dd);
  974. }
  975. done:
  976. ret = IRQ_HANDLED;
  977. bail:
  978. return ret;
  979. }