ipath_intr.c 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074
  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. /*
  38. * Called when we might have an error that is specific to a particular
  39. * PIO buffer, and may need to cancel that buffer, so it can be re-used.
  40. */
  41. void ipath_disarm_senderrbufs(struct ipath_devdata *dd)
  42. {
  43. u32 piobcnt;
  44. unsigned long sbuf[4];
  45. /*
  46. * it's possible that sendbuffererror could have bits set; might
  47. * have already done this as a result of hardware error handling
  48. */
  49. piobcnt = dd->ipath_piobcnt2k + dd->ipath_piobcnt4k;
  50. /* read these before writing errorclear */
  51. sbuf[0] = ipath_read_kreg64(
  52. dd, dd->ipath_kregs->kr_sendbuffererror);
  53. sbuf[1] = ipath_read_kreg64(
  54. dd, dd->ipath_kregs->kr_sendbuffererror + 1);
  55. if (piobcnt > 128) {
  56. sbuf[2] = ipath_read_kreg64(
  57. dd, dd->ipath_kregs->kr_sendbuffererror + 2);
  58. sbuf[3] = ipath_read_kreg64(
  59. dd, dd->ipath_kregs->kr_sendbuffererror + 3);
  60. }
  61. if (sbuf[0] || sbuf[1] || (piobcnt > 128 && (sbuf[2] || sbuf[3]))) {
  62. int i;
  63. if (ipath_debug & (__IPATH_PKTDBG|__IPATH_DBG)) {
  64. __IPATH_DBG_WHICH(__IPATH_PKTDBG|__IPATH_DBG,
  65. "SendbufErrs %lx %lx", sbuf[0],
  66. sbuf[1]);
  67. if (ipath_debug & __IPATH_PKTDBG && piobcnt > 128)
  68. printk(" %lx %lx ", sbuf[2], sbuf[3]);
  69. printk("\n");
  70. }
  71. for (i = 0; i < piobcnt; i++)
  72. if (test_bit(i, sbuf))
  73. ipath_disarm_piobufs(dd, i, 1);
  74. dd->ipath_lastcancel = jiffies+3; /* no armlaunch for a bit */
  75. }
  76. }
  77. /* These are all rcv-related errors which we want to count for stats */
  78. #define E_SUM_PKTERRS \
  79. (INFINIPATH_E_RHDRLEN | INFINIPATH_E_RBADTID | \
  80. INFINIPATH_E_RBADVERSION | INFINIPATH_E_RHDR | \
  81. INFINIPATH_E_RLONGPKTLEN | INFINIPATH_E_RSHORTPKTLEN | \
  82. INFINIPATH_E_RMAXPKTLEN | INFINIPATH_E_RMINPKTLEN | \
  83. INFINIPATH_E_RFORMATERR | INFINIPATH_E_RUNSUPVL | \
  84. INFINIPATH_E_RUNEXPCHAR | INFINIPATH_E_REBP)
  85. /* These are all send-related errors which we want to count for stats */
  86. #define E_SUM_ERRS \
  87. (INFINIPATH_E_SPIOARMLAUNCH | INFINIPATH_E_SUNEXPERRPKTNUM | \
  88. INFINIPATH_E_SDROPPEDDATAPKT | INFINIPATH_E_SDROPPEDSMPPKT | \
  89. INFINIPATH_E_SMAXPKTLEN | INFINIPATH_E_SUNSUPVL | \
  90. INFINIPATH_E_SMINPKTLEN | INFINIPATH_E_SPKTLEN | \
  91. INFINIPATH_E_INVALIDADDR)
  92. /*
  93. * these are errors that can occur when the link changes state while
  94. * a packet is being sent or received. This doesn't cover things
  95. * like EBP or VCRC that can be the result of a sending having the
  96. * link change state, so we receive a "known bad" packet.
  97. */
  98. #define E_SUM_LINK_PKTERRS \
  99. (INFINIPATH_E_SDROPPEDDATAPKT | INFINIPATH_E_SDROPPEDSMPPKT | \
  100. INFINIPATH_E_SMINPKTLEN | INFINIPATH_E_SPKTLEN | \
  101. INFINIPATH_E_RSHORTPKTLEN | INFINIPATH_E_RMINPKTLEN | \
  102. INFINIPATH_E_RUNEXPCHAR)
  103. static u64 handle_e_sum_errs(struct ipath_devdata *dd, ipath_err_t errs)
  104. {
  105. u64 ignore_this_time = 0;
  106. ipath_disarm_senderrbufs(dd);
  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. /* likely due to cancel, so suppress */
  515. if ((errs & (INFINIPATH_E_SPKTLEN | INFINIPATH_E_SPIOARMLAUNCH)) &&
  516. dd->ipath_lastcancel > jiffies) {
  517. ipath_dbg("Suppressed armlaunch/spktlen after error send cancel\n");
  518. errs &= ~(INFINIPATH_E_SPIOARMLAUNCH | INFINIPATH_E_SPKTLEN);
  519. }
  520. if (!errs)
  521. return 0;
  522. if (!noprint)
  523. /*
  524. * the ones we mask off are handled specially below or above
  525. */
  526. ipath_decode_err(msg, sizeof msg,
  527. errs & ~(INFINIPATH_E_IBSTATUSCHANGED |
  528. INFINIPATH_E_RRCVEGRFULL |
  529. INFINIPATH_E_RRCVHDRFULL |
  530. INFINIPATH_E_HARDWARE));
  531. else
  532. /* so we don't need if (!noprint) at strlcat's below */
  533. *msg = 0;
  534. if (errs & E_SUM_PKTERRS) {
  535. ipath_stats.sps_pkterrs++;
  536. chkerrpkts = 1;
  537. }
  538. if (errs & E_SUM_ERRS)
  539. ipath_stats.sps_errs++;
  540. if (errs & (INFINIPATH_E_RICRC | INFINIPATH_E_RVCRC)) {
  541. ipath_stats.sps_crcerrs++;
  542. chkerrpkts = 1;
  543. }
  544. /*
  545. * We don't want to print these two as they happen, or we can make
  546. * the situation even worse, because it takes so long to print
  547. * messages to serial consoles. Kernel ports get printed from
  548. * fast_stats, no more than every 5 seconds, user ports get printed
  549. * on close
  550. */
  551. if (errs & INFINIPATH_E_RRCVHDRFULL) {
  552. int any;
  553. u32 hd, tl;
  554. ipath_stats.sps_hdrqfull++;
  555. for (any = i = 0; i < dd->ipath_cfgports; i++) {
  556. struct ipath_portdata *pd = dd->ipath_pd[i];
  557. if (i == 0) {
  558. hd = dd->ipath_port0head;
  559. tl = (u32) le64_to_cpu(
  560. *dd->ipath_hdrqtailptr);
  561. } else if (pd && pd->port_cnt &&
  562. pd->port_rcvhdrtail_kvaddr) {
  563. /*
  564. * don't report same point multiple times,
  565. * except kernel
  566. */
  567. tl = *(u64 *) pd->port_rcvhdrtail_kvaddr;
  568. if (tl == dd->ipath_lastrcvhdrqtails[i])
  569. continue;
  570. hd = ipath_read_ureg32(dd, ur_rcvhdrhead,
  571. i);
  572. } else
  573. continue;
  574. if (hd == (tl + 1) ||
  575. (!hd && tl == dd->ipath_hdrqlast)) {
  576. if (i == 0)
  577. chkerrpkts = 1;
  578. dd->ipath_lastrcvhdrqtails[i] = tl;
  579. pd->port_hdrqfull++;
  580. }
  581. }
  582. }
  583. if (errs & INFINIPATH_E_RRCVEGRFULL) {
  584. /*
  585. * since this is of less importance and not likely to
  586. * happen without also getting hdrfull, only count
  587. * occurrences; don't check each port (or even the kernel
  588. * vs user)
  589. */
  590. ipath_stats.sps_etidfull++;
  591. if (dd->ipath_port0head !=
  592. (u32) le64_to_cpu(*dd->ipath_hdrqtailptr))
  593. chkerrpkts = 1;
  594. }
  595. /*
  596. * do this before IBSTATUSCHANGED, in case both bits set in a single
  597. * interrupt; we want the STATUSCHANGE to "win", so we do our
  598. * internal copy of state machine correctly
  599. */
  600. if (errs & INFINIPATH_E_RIBLOSTLINK) {
  601. /*
  602. * force through block below
  603. */
  604. errs |= INFINIPATH_E_IBSTATUSCHANGED;
  605. ipath_stats.sps_iblink++;
  606. dd->ipath_flags |= IPATH_LINKDOWN;
  607. dd->ipath_flags &= ~(IPATH_LINKUNK | IPATH_LINKINIT
  608. | IPATH_LINKARMED | IPATH_LINKACTIVE);
  609. *dd->ipath_statusp &= ~IPATH_STATUS_IB_READY;
  610. if (!noprint) {
  611. u64 st = ipath_read_kreg64(
  612. dd, dd->ipath_kregs->kr_ibcstatus);
  613. ipath_dbg("Lost link, link now down (%s)\n",
  614. ipath_ibcstatus_str[st & 0xf]);
  615. }
  616. }
  617. if (errs & INFINIPATH_E_IBSTATUSCHANGED)
  618. handle_e_ibstatuschanged(dd, errs, noprint);
  619. if (errs & INFINIPATH_E_RESET) {
  620. if (!noprint)
  621. ipath_dev_err(dd, "Got reset, requires re-init "
  622. "(unload and reload driver)\n");
  623. dd->ipath_flags &= ~IPATH_INITTED; /* needs re-init */
  624. /* mark as having had error */
  625. *dd->ipath_statusp |= IPATH_STATUS_HWERROR;
  626. *dd->ipath_statusp &= ~IPATH_STATUS_IB_CONF;
  627. }
  628. if (!noprint && *msg)
  629. ipath_dev_err(dd, "%s error\n", msg);
  630. if (dd->ipath_state_wanted & dd->ipath_flags) {
  631. ipath_cdbg(VERBOSE, "driver wanted state %x, iflags now %x, "
  632. "waking\n", dd->ipath_state_wanted,
  633. dd->ipath_flags);
  634. wake_up_interruptible(&ipath_state_wait);
  635. }
  636. return chkerrpkts;
  637. }
  638. /* this is separate to allow for better optimization of ipath_intr() */
  639. static void ipath_bad_intr(struct ipath_devdata *dd, u32 * unexpectp)
  640. {
  641. /*
  642. * sometimes happen during driver init and unload, don't want
  643. * to process any interrupts at that point
  644. */
  645. /* this is just a bandaid, not a fix, if something goes badly
  646. * wrong */
  647. if (++*unexpectp > 100) {
  648. if (++*unexpectp > 105) {
  649. /*
  650. * ok, we must be taking somebody else's interrupts,
  651. * due to a messed up mptable and/or PIRQ table, so
  652. * unregister the interrupt. We've seen this during
  653. * linuxbios development work, and it may happen in
  654. * the future again.
  655. */
  656. if (dd->pcidev && dd->pcidev->irq) {
  657. ipath_dev_err(dd, "Now %u unexpected "
  658. "interrupts, unregistering "
  659. "interrupt handler\n",
  660. *unexpectp);
  661. ipath_dbg("free_irq of irq %x\n",
  662. dd->pcidev->irq);
  663. free_irq(dd->pcidev->irq, dd);
  664. }
  665. }
  666. if (ipath_read_kreg32(dd, dd->ipath_kregs->kr_intmask)) {
  667. ipath_dev_err(dd, "%u unexpected interrupts, "
  668. "disabling interrupts completely\n",
  669. *unexpectp);
  670. /*
  671. * disable all interrupts, something is very wrong
  672. */
  673. ipath_write_kreg(dd, dd->ipath_kregs->kr_intmask,
  674. 0ULL);
  675. }
  676. } else if (*unexpectp > 1)
  677. ipath_dbg("Interrupt when not ready, should not happen, "
  678. "ignoring\n");
  679. }
  680. static void ipath_bad_regread(struct ipath_devdata *dd)
  681. {
  682. static int allbits;
  683. /* separate routine, for better optimization of ipath_intr() */
  684. /*
  685. * We print the message and disable interrupts, in hope of
  686. * having a better chance of debugging the problem.
  687. */
  688. ipath_dev_err(dd,
  689. "Read of interrupt status failed (all bits set)\n");
  690. if (allbits++) {
  691. /* disable all interrupts, something is very wrong */
  692. ipath_write_kreg(dd, dd->ipath_kregs->kr_intmask, 0ULL);
  693. if (allbits == 2) {
  694. ipath_dev_err(dd, "Still bad interrupt status, "
  695. "unregistering interrupt\n");
  696. free_irq(dd->pcidev->irq, dd);
  697. } else if (allbits > 2) {
  698. if ((allbits % 10000) == 0)
  699. printk(".");
  700. } else
  701. ipath_dev_err(dd, "Disabling interrupts, "
  702. "multiple errors\n");
  703. }
  704. }
  705. static void handle_port_pioavail(struct ipath_devdata *dd)
  706. {
  707. u32 i;
  708. /*
  709. * start from port 1, since for now port 0 is never using
  710. * wait_event for PIO
  711. */
  712. for (i = 1; dd->ipath_portpiowait && i < dd->ipath_cfgports; i++) {
  713. struct ipath_portdata *pd = dd->ipath_pd[i];
  714. if (pd && pd->port_cnt &&
  715. dd->ipath_portpiowait & (1U << i)) {
  716. clear_bit(i, &dd->ipath_portpiowait);
  717. if (test_bit(IPATH_PORT_WAITING_PIO,
  718. &pd->port_flag)) {
  719. clear_bit(IPATH_PORT_WAITING_PIO,
  720. &pd->port_flag);
  721. wake_up_interruptible(&pd->port_wait);
  722. }
  723. }
  724. }
  725. }
  726. static void handle_layer_pioavail(struct ipath_devdata *dd)
  727. {
  728. int ret;
  729. ret = ipath_ib_piobufavail(dd->verbs_dev);
  730. if (ret > 0)
  731. goto set;
  732. return;
  733. set:
  734. set_bit(IPATH_S_PIOINTBUFAVAIL, &dd->ipath_sendctrl);
  735. ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl,
  736. dd->ipath_sendctrl);
  737. }
  738. /*
  739. * Handle receive interrupts for user ports; this means a user
  740. * process was waiting for a packet to arrive, and didn't want
  741. * to poll
  742. */
  743. static void handle_urcv(struct ipath_devdata *dd, u32 istat)
  744. {
  745. u64 portr;
  746. int i;
  747. int rcvdint = 0;
  748. portr = ((istat >> INFINIPATH_I_RCVAVAIL_SHIFT) &
  749. dd->ipath_i_rcvavail_mask)
  750. | ((istat >> INFINIPATH_I_RCVURG_SHIFT) &
  751. dd->ipath_i_rcvurg_mask);
  752. for (i = 1; i < dd->ipath_cfgports; i++) {
  753. struct ipath_portdata *pd = dd->ipath_pd[i];
  754. if (portr & (1 << i) && pd && pd->port_cnt &&
  755. test_bit(IPATH_PORT_WAITING_RCV, &pd->port_flag)) {
  756. int rcbit;
  757. clear_bit(IPATH_PORT_WAITING_RCV,
  758. &pd->port_flag);
  759. rcbit = i + INFINIPATH_R_INTRAVAIL_SHIFT;
  760. clear_bit(1UL << rcbit, &dd->ipath_rcvctrl);
  761. wake_up_interruptible(&pd->port_wait);
  762. rcvdint = 1;
  763. }
  764. }
  765. if (rcvdint) {
  766. /* only want to take one interrupt, so turn off the rcv
  767. * interrupt for all the ports that we did the wakeup on
  768. * (but never for kernel port)
  769. */
  770. ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl,
  771. dd->ipath_rcvctrl);
  772. }
  773. }
  774. irqreturn_t ipath_intr(int irq, void *data)
  775. {
  776. struct ipath_devdata *dd = data;
  777. u32 istat, chk0rcv = 0;
  778. ipath_err_t estat = 0;
  779. irqreturn_t ret;
  780. u32 oldhead, curtail;
  781. static unsigned unexpected = 0;
  782. static const u32 port0rbits = (1U<<INFINIPATH_I_RCVAVAIL_SHIFT) |
  783. (1U<<INFINIPATH_I_RCVURG_SHIFT);
  784. ipath_stats.sps_ints++;
  785. if (!(dd->ipath_flags & IPATH_PRESENT)) {
  786. /*
  787. * This return value is not great, but we do not want the
  788. * interrupt core code to remove our interrupt handler
  789. * because we don't appear to be handling an interrupt
  790. * during a chip reset.
  791. */
  792. return IRQ_HANDLED;
  793. }
  794. /*
  795. * this needs to be flags&initted, not statusp, so we keep
  796. * taking interrupts even after link goes down, etc.
  797. * Also, we *must* clear the interrupt at some point, or we won't
  798. * take it again, which can be real bad for errors, etc...
  799. */
  800. if (!(dd->ipath_flags & IPATH_INITTED)) {
  801. ipath_bad_intr(dd, &unexpected);
  802. ret = IRQ_NONE;
  803. goto bail;
  804. }
  805. /*
  806. * We try to avoid reading the interrupt status register, since
  807. * that's a PIO read, and stalls the processor for up to about
  808. * ~0.25 usec. The idea is that if we processed a port0 packet,
  809. * we blindly clear the port 0 receive interrupt bits, and nothing
  810. * else, then return. If other interrupts are pending, the chip
  811. * will re-interrupt us as soon as we write the intclear register.
  812. * We then won't process any more kernel packets (if not the 2nd
  813. * time, then the 3rd or 4th) and we'll then handle the other
  814. * interrupts. We clear the interrupts first so that we don't
  815. * lose intr for later packets that arrive while we are processing.
  816. */
  817. oldhead = dd->ipath_port0head;
  818. curtail = (u32)le64_to_cpu(*dd->ipath_hdrqtailptr);
  819. if (oldhead != curtail) {
  820. if (dd->ipath_flags & IPATH_GPIO_INTR) {
  821. ipath_write_kreg(dd, dd->ipath_kregs->kr_gpio_clear,
  822. (u64) (1 << IPATH_GPIO_PORT0_BIT));
  823. istat = port0rbits | INFINIPATH_I_GPIO;
  824. }
  825. else
  826. istat = port0rbits;
  827. ipath_write_kreg(dd, dd->ipath_kregs->kr_intclear, istat);
  828. ipath_kreceive(dd);
  829. if (oldhead != dd->ipath_port0head) {
  830. ipath_stats.sps_fastrcvint++;
  831. goto done;
  832. }
  833. }
  834. istat = ipath_read_kreg32(dd, dd->ipath_kregs->kr_intstatus);
  835. if (unlikely(!istat)) {
  836. ipath_stats.sps_nullintr++;
  837. ret = IRQ_NONE; /* not our interrupt, or already handled */
  838. goto bail;
  839. }
  840. if (unlikely(istat == -1)) {
  841. ipath_bad_regread(dd);
  842. /* don't know if it was our interrupt or not */
  843. ret = IRQ_NONE;
  844. goto bail;
  845. }
  846. if (unexpected)
  847. unexpected = 0;
  848. if (unlikely(istat & ~dd->ipath_i_bitsextant))
  849. ipath_dev_err(dd,
  850. "interrupt with unknown interrupts %x set\n",
  851. istat & (u32) ~ dd->ipath_i_bitsextant);
  852. else
  853. ipath_cdbg(VERBOSE, "intr stat=0x%x\n", istat);
  854. if (unlikely(istat & INFINIPATH_I_ERROR)) {
  855. ipath_stats.sps_errints++;
  856. estat = ipath_read_kreg64(dd,
  857. dd->ipath_kregs->kr_errorstatus);
  858. if (!estat)
  859. dev_info(&dd->pcidev->dev, "error interrupt (%x), "
  860. "but no error bits set!\n", istat);
  861. else if (estat == -1LL)
  862. /*
  863. * should we try clearing all, or hope next read
  864. * works?
  865. */
  866. ipath_dev_err(dd, "Read of error status failed "
  867. "(all bits set); ignoring\n");
  868. else
  869. if (handle_errors(dd, estat))
  870. /* force calling ipath_kreceive() */
  871. chk0rcv = 1;
  872. }
  873. if (istat & INFINIPATH_I_GPIO) {
  874. /*
  875. * GPIO interrupts fall in two broad classes:
  876. * GPIO_2 indicates (on some HT4xx boards) that a packet
  877. * has arrived for Port 0. Checking for this
  878. * is controlled by flag IPATH_GPIO_INTR.
  879. * GPIO_3..5 on IBA6120 Rev2 chips indicate errors
  880. * that we need to count. Checking for this
  881. * is controlled by flag IPATH_GPIO_ERRINTRS.
  882. */
  883. u32 gpiostatus;
  884. u32 to_clear = 0;
  885. gpiostatus = ipath_read_kreg32(
  886. dd, dd->ipath_kregs->kr_gpio_status);
  887. /* First the error-counter case.
  888. */
  889. if ((gpiostatus & IPATH_GPIO_ERRINTR_MASK) &&
  890. (dd->ipath_flags & IPATH_GPIO_ERRINTRS)) {
  891. /* want to clear the bits we see asserted. */
  892. to_clear |= (gpiostatus & IPATH_GPIO_ERRINTR_MASK);
  893. /*
  894. * Count appropriately, clear bits out of our copy,
  895. * as they have been "handled".
  896. */
  897. if (gpiostatus & (1 << IPATH_GPIO_RXUVL_BIT)) {
  898. ipath_dbg("FlowCtl on UnsupVL\n");
  899. dd->ipath_rxfc_unsupvl_errs++;
  900. }
  901. if (gpiostatus & (1 << IPATH_GPIO_OVRUN_BIT)) {
  902. ipath_dbg("Overrun Threshold exceeded\n");
  903. dd->ipath_overrun_thresh_errs++;
  904. }
  905. if (gpiostatus & (1 << IPATH_GPIO_LLI_BIT)) {
  906. ipath_dbg("Local Link Integrity error\n");
  907. dd->ipath_lli_errs++;
  908. }
  909. gpiostatus &= ~IPATH_GPIO_ERRINTR_MASK;
  910. }
  911. /* Now the Port0 Receive case */
  912. if ((gpiostatus & (1 << IPATH_GPIO_PORT0_BIT)) &&
  913. (dd->ipath_flags & IPATH_GPIO_INTR)) {
  914. /*
  915. * GPIO status bit 2 is set, and we expected it.
  916. * clear it and indicate in p0bits.
  917. * This probably only happens if a Port0 pkt
  918. * arrives at _just_ the wrong time, and we
  919. * handle that by seting chk0rcv;
  920. */
  921. to_clear |= (1 << IPATH_GPIO_PORT0_BIT);
  922. gpiostatus &= ~(1 << IPATH_GPIO_PORT0_BIT);
  923. chk0rcv = 1;
  924. }
  925. if (unlikely(gpiostatus)) {
  926. /*
  927. * Some unexpected bits remain. If they could have
  928. * caused the interrupt, complain and clear.
  929. * MEA: this is almost certainly non-ideal.
  930. * we should look into auto-disable of unexpected
  931. * GPIO interrupts, possibly on a "three strikes"
  932. * basis.
  933. */
  934. u32 mask;
  935. mask = ipath_read_kreg32(
  936. dd, dd->ipath_kregs->kr_gpio_mask);
  937. if (mask & gpiostatus) {
  938. ipath_dbg("Unexpected GPIO IRQ bits %x\n",
  939. gpiostatus & mask);
  940. to_clear |= (gpiostatus & mask);
  941. }
  942. }
  943. if (to_clear) {
  944. ipath_write_kreg(dd, dd->ipath_kregs->kr_gpio_clear,
  945. (u64) to_clear);
  946. }
  947. }
  948. chk0rcv |= istat & port0rbits;
  949. /*
  950. * Clear the interrupt bits we found set, unless they are receive
  951. * related, in which case we already cleared them above, and don't
  952. * want to clear them again, because we might lose an interrupt.
  953. * Clear it early, so we "know" know the chip will have seen this by
  954. * the time we process the queue, and will re-interrupt if necessary.
  955. * The processor itself won't take the interrupt again until we return.
  956. */
  957. ipath_write_kreg(dd, dd->ipath_kregs->kr_intclear, istat);
  958. /*
  959. * handle port0 receive before checking for pio buffers available,
  960. * since receives can overflow; piobuf waiters can afford a few
  961. * extra cycles, since they were waiting anyway, and user's waiting
  962. * for receive are at the bottom.
  963. */
  964. if (chk0rcv) {
  965. ipath_kreceive(dd);
  966. istat &= ~port0rbits;
  967. }
  968. if (istat & ((dd->ipath_i_rcvavail_mask <<
  969. INFINIPATH_I_RCVAVAIL_SHIFT)
  970. | (dd->ipath_i_rcvurg_mask <<
  971. INFINIPATH_I_RCVURG_SHIFT)))
  972. handle_urcv(dd, istat);
  973. if (istat & INFINIPATH_I_SPIOBUFAVAIL) {
  974. clear_bit(IPATH_S_PIOINTBUFAVAIL, &dd->ipath_sendctrl);
  975. ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl,
  976. dd->ipath_sendctrl);
  977. if (dd->ipath_portpiowait)
  978. handle_port_pioavail(dd);
  979. handle_layer_pioavail(dd);
  980. }
  981. done:
  982. ret = IRQ_HANDLED;
  983. bail:
  984. return ret;
  985. }