35 #include <linux/pci.h>
38 #include <linux/netdevice.h>
40 #include <linux/module.h>
41 #include <linux/prefetch.h>
63 "Attempt pre-IBTA 1.2 DDR speed negotiation");
75 #define QIB_PIO_MAXIBHDR 128
80 #define QIB_MAX_PKT_RECV 64
86 static char iname[16];
88 snprintf(iname,
sizeof iname,
"infinipath%u", unit);
100 int pidx, nunits_active = 0;
106 for (pidx = 0; pidx < dd->
num_pports; ++pidx) {
107 ppd = dd->
pport + pidx;
116 return nunits_active;
126 int nunits = 0, npresent = 0, nup = 0;
138 for (pidx = 0; pidx < dd->
num_pports; ++pidx) {
139 ppd = dd->
pport + pidx;
149 *npresentp = npresent;
188 if (!(ppd->
lflags & state))
288 return rcd->rcvegrbuf[
chunk] + (
idx <<
rcd->dd->rcvegrbufsize_shift);
309 u32 tlen = qib_hdrget_length_in_bytes(rhf_addr);
322 lid &= ~((1 << ppd->
lmc) - 1);
333 ohdr = &hdr->
u.
l.oth;
359 spin_lock(&qp->r_lock);
368 switch (qp->
ibqp.qp_type) {
381 IB_OPCODE_RC_RDMA_READ_RESPONSE_FIRST) {
382 diff = qib_cmp24(psn, qp->
r_psn);
397 if (list_empty(&qp->
rspwait)) {
419 spin_unlock(&qp->r_lock);
452 u32 etail = -1,
l, hdrqtail;
454 u32 eflags, etype, tlen,
i = 0, updegr = 0, crcs = 0;
462 u32 seq = qib_hdrget_seq(rhf_addr);
467 hdrqtail = qib_get_rcvhdrtail(rcd);
473 for (last = 0, i = 1; !last; i += !last) {
475 eflags = qib_hdrget_err_flags(rhf_addr);
476 etype = qib_hdrget_rcv_type(rhf_addr);
478 tlen = qib_hdrget_length_in_bytes(rhf_addr);
481 qib_hdrget_use_egr_buf(rhf_addr) :
483 etail = qib_hdrget_index(rhf_addr);
485 if (tlen >
sizeof(*hdr) ||
487 ebuf = qib_get_egrbuf(rcd, etail);
488 prefetch_range(ebuf, tlen -
sizeof(*hdr));
494 if (lrh_len != tlen) {
502 qib_hdrget_offset(rhf_addr)) << 2) {
511 crcs += qib_rcv_hdrerr(rcd, ppd, rcd->
ctxt, eflags, l,
512 etail, rhf_addr, hdr);
517 else if (llic && *llic)
529 u32 seq = qib_hdrget_seq(rhf_addr);
535 }
else if (l == hdrqtail)
544 if (!last && !(i & 0xf)) {
580 spin_unlock_irqrestore(&qp->s_lock, flags);
617 if (arg != 256 && arg != 512 && arg != 1024 && arg != 2048 &&
623 if (chk > 0 && arg > chk) {
634 if (arg > piosize && arg <= ppd->init_ibmaxlen)
658 lid | (~((1
U << lmc) - 1)) << 16);
673 #define LED_OVER_FREQ_SHIFT 8
674 #define LED_OVER_FREQ_MASK (0xFF<<LED_OVER_FREQ_SHIFT)
676 #define LED_OVER_BOTH_OFF (8)
678 static void qib_run_led_override(
unsigned long opaque)
717 timeoff = (
HZ << 4)/freq;
769 "Invalid unit number %u or not initialized or not present\n",
778 if (!dd->
rcd[i] || !dd->
rcd[i]->cnt)
780 spin_unlock_irqrestore(&dd->
uctxt_lock, flags);
784 spin_unlock_irqrestore(&dd->
uctxt_lock, flags);
786 for (pidx = 0; pidx < dd->
num_pports; ++pidx) {
787 ppd = dd->
pport + pidx;
808 "Reinitialize unit %u after reset failed with %d\n",
812 "Reinitialized unit %u after resetting\n",