Lines Matching refs:rcd
129 dd->rcd = kzalloc(sizeof(*dd->rcd) * dd->ctxtcnt, GFP_KERNEL); in qib_create_ctxts()
130 if (!dd->rcd) { in qib_create_ctxts()
140 struct qib_ctxtdata *rcd; in qib_create_ctxts() local
146 rcd = qib_create_ctxtdata(ppd, i); in qib_create_ctxts()
147 if (!rcd) { in qib_create_ctxts()
153 rcd->pkeys[0] = QIB_DEFAULT_P_KEY; in qib_create_ctxts()
154 rcd->seq_cnt = 1; in qib_create_ctxts()
167 struct qib_ctxtdata *rcd; in qib_create_ctxtdata() local
169 rcd = kzalloc(sizeof(*rcd), GFP_KERNEL); in qib_create_ctxtdata()
170 if (rcd) { in qib_create_ctxtdata()
171 INIT_LIST_HEAD(&rcd->qp_wait_list); in qib_create_ctxtdata()
172 rcd->ppd = ppd; in qib_create_ctxtdata()
173 rcd->dd = dd; in qib_create_ctxtdata()
174 rcd->cnt = 1; in qib_create_ctxtdata()
175 rcd->ctxt = ctxt; in qib_create_ctxtdata()
176 dd->rcd[ctxt] = rcd; in qib_create_ctxtdata()
178 dd->f_init_ctxt(rcd); in qib_create_ctxtdata()
191 rcd->rcvegrbuf_size = 0x8000; in qib_create_ctxtdata()
192 rcd->rcvegrbufs_perchunk = in qib_create_ctxtdata()
193 rcd->rcvegrbuf_size / dd->rcvegrbufsize; in qib_create_ctxtdata()
194 rcd->rcvegrbuf_chunks = (rcd->rcvegrcnt + in qib_create_ctxtdata()
195 rcd->rcvegrbufs_perchunk - 1) / in qib_create_ctxtdata()
196 rcd->rcvegrbufs_perchunk; in qib_create_ctxtdata()
197 BUG_ON(!is_power_of_2(rcd->rcvegrbufs_perchunk)); in qib_create_ctxtdata()
198 rcd->rcvegrbufs_perchunk_shift = in qib_create_ctxtdata()
199 ilog2(rcd->rcvegrbufs_perchunk); in qib_create_ctxtdata()
201 return rcd; in qib_create_ctxtdata()
487 for (i = 0; dd->rcd && i < dd->first_user_ctxt; ++i) { in enable_chip()
488 struct qib_ctxtdata *rcd = dd->rcd[i]; in enable_chip() local
490 if (rcd) in enable_chip()
491 dd->f_rcvctrl(rcd->ppd, rcvmask, i); in enable_chip()
626 struct qib_ctxtdata *rcd; in qib_init() local
656 for (i = 0; dd->rcd && i < dd->first_user_ctxt; ++i) { in qib_init()
663 rcd = dd->rcd[i]; in qib_init()
664 if (!rcd) in qib_init()
667 lastfail = qib_create_rcvhdrq(dd, rcd); in qib_init()
669 lastfail = qib_setup_eagerbufs(rcd); in qib_init()
909 void qib_free_ctxtdata(struct qib_devdata *dd, struct qib_ctxtdata *rcd) in qib_free_ctxtdata() argument
911 if (!rcd) in qib_free_ctxtdata()
914 if (rcd->rcvhdrq) { in qib_free_ctxtdata()
915 dma_free_coherent(&dd->pcidev->dev, rcd->rcvhdrq_size, in qib_free_ctxtdata()
916 rcd->rcvhdrq, rcd->rcvhdrq_phys); in qib_free_ctxtdata()
917 rcd->rcvhdrq = NULL; in qib_free_ctxtdata()
918 if (rcd->rcvhdrtail_kvaddr) { in qib_free_ctxtdata()
920 rcd->rcvhdrtail_kvaddr, in qib_free_ctxtdata()
921 rcd->rcvhdrqtailaddr_phys); in qib_free_ctxtdata()
922 rcd->rcvhdrtail_kvaddr = NULL; in qib_free_ctxtdata()
925 if (rcd->rcvegrbuf) { in qib_free_ctxtdata()
928 for (e = 0; e < rcd->rcvegrbuf_chunks; e++) { in qib_free_ctxtdata()
929 void *base = rcd->rcvegrbuf[e]; in qib_free_ctxtdata()
930 size_t size = rcd->rcvegrbuf_size; in qib_free_ctxtdata()
933 base, rcd->rcvegrbuf_phys[e]); in qib_free_ctxtdata()
935 kfree(rcd->rcvegrbuf); in qib_free_ctxtdata()
936 rcd->rcvegrbuf = NULL; in qib_free_ctxtdata()
937 kfree(rcd->rcvegrbuf_phys); in qib_free_ctxtdata()
938 rcd->rcvegrbuf_phys = NULL; in qib_free_ctxtdata()
939 rcd->rcvegrbuf_chunks = 0; in qib_free_ctxtdata()
942 kfree(rcd->tid_pg_list); in qib_free_ctxtdata()
943 vfree(rcd->user_event_mask); in qib_free_ctxtdata()
944 vfree(rcd->subctxt_uregbase); in qib_free_ctxtdata()
945 vfree(rcd->subctxt_rcvegrbuf); in qib_free_ctxtdata()
946 vfree(rcd->subctxt_rcvhdr_base); in qib_free_ctxtdata()
947 kfree(rcd); in qib_free_ctxtdata()
1303 tmp = dd->rcd; in cleanup_device_data()
1304 dd->rcd = NULL; in cleanup_device_data()
1307 struct qib_ctxtdata *rcd = tmp[ctxt]; in cleanup_device_data() local
1310 qib_free_ctxtdata(dd, rcd); in cleanup_device_data()
1483 int qib_create_rcvhdrq(struct qib_devdata *dd, struct qib_ctxtdata *rcd) in qib_create_rcvhdrq() argument
1487 if (!rcd->rcvhdrq) { in qib_create_rcvhdrq()
1493 gfp_flags = (rcd->ctxt >= dd->first_user_ctxt) ? in qib_create_rcvhdrq()
1495 rcd->rcvhdrq = dma_alloc_coherent( in qib_create_rcvhdrq()
1496 &dd->pcidev->dev, amt, &rcd->rcvhdrq_phys, in qib_create_rcvhdrq()
1499 if (!rcd->rcvhdrq) { in qib_create_rcvhdrq()
1502 amt, rcd->ctxt); in qib_create_rcvhdrq()
1506 if (rcd->ctxt >= dd->first_user_ctxt) { in qib_create_rcvhdrq()
1507 rcd->user_event_mask = vmalloc_user(PAGE_SIZE); in qib_create_rcvhdrq()
1508 if (!rcd->user_event_mask) in qib_create_rcvhdrq()
1513 rcd->rcvhdrtail_kvaddr = dma_alloc_coherent( in qib_create_rcvhdrq()
1516 if (!rcd->rcvhdrtail_kvaddr) in qib_create_rcvhdrq()
1518 rcd->rcvhdrqtailaddr_phys = phys_hdrqtail; in qib_create_rcvhdrq()
1521 rcd->rcvhdrq_size = amt; in qib_create_rcvhdrq()
1525 memset(rcd->rcvhdrq, 0, rcd->rcvhdrq_size); in qib_create_rcvhdrq()
1526 if (rcd->rcvhdrtail_kvaddr) in qib_create_rcvhdrq()
1527 memset(rcd->rcvhdrtail_kvaddr, 0, PAGE_SIZE); in qib_create_rcvhdrq()
1533 rcd->ctxt); in qib_create_rcvhdrq()
1534 vfree(rcd->user_event_mask); in qib_create_rcvhdrq()
1535 rcd->user_event_mask = NULL; in qib_create_rcvhdrq()
1537 dma_free_coherent(&dd->pcidev->dev, amt, rcd->rcvhdrq, in qib_create_rcvhdrq()
1538 rcd->rcvhdrq_phys); in qib_create_rcvhdrq()
1539 rcd->rcvhdrq = NULL; in qib_create_rcvhdrq()
1553 int qib_setup_eagerbufs(struct qib_ctxtdata *rcd) in qib_setup_eagerbufs() argument
1555 struct qib_devdata *dd = rcd->dd; in qib_setup_eagerbufs()
1568 egrcnt = rcd->rcvegrcnt; in qib_setup_eagerbufs()
1569 egroff = rcd->rcvegr_tid_base; in qib_setup_eagerbufs()
1572 chunk = rcd->rcvegrbuf_chunks; in qib_setup_eagerbufs()
1573 egrperchunk = rcd->rcvegrbufs_perchunk; in qib_setup_eagerbufs()
1574 size = rcd->rcvegrbuf_size; in qib_setup_eagerbufs()
1575 if (!rcd->rcvegrbuf) { in qib_setup_eagerbufs()
1576 rcd->rcvegrbuf = in qib_setup_eagerbufs()
1577 kzalloc(chunk * sizeof(rcd->rcvegrbuf[0]), in qib_setup_eagerbufs()
1579 if (!rcd->rcvegrbuf) in qib_setup_eagerbufs()
1582 if (!rcd->rcvegrbuf_phys) { in qib_setup_eagerbufs()
1583 rcd->rcvegrbuf_phys = in qib_setup_eagerbufs()
1584 kmalloc(chunk * sizeof(rcd->rcvegrbuf_phys[0]), in qib_setup_eagerbufs()
1586 if (!rcd->rcvegrbuf_phys) in qib_setup_eagerbufs()
1589 for (e = 0; e < rcd->rcvegrbuf_chunks; e++) { in qib_setup_eagerbufs()
1590 if (rcd->rcvegrbuf[e]) in qib_setup_eagerbufs()
1592 rcd->rcvegrbuf[e] = in qib_setup_eagerbufs()
1594 &rcd->rcvegrbuf_phys[e], in qib_setup_eagerbufs()
1596 if (!rcd->rcvegrbuf[e]) in qib_setup_eagerbufs()
1600 rcd->rcvegr_phys = rcd->rcvegrbuf_phys[0]; in qib_setup_eagerbufs()
1602 for (e = chunk = 0; chunk < rcd->rcvegrbuf_chunks; chunk++) { in qib_setup_eagerbufs()
1603 dma_addr_t pa = rcd->rcvegrbuf_phys[chunk]; in qib_setup_eagerbufs()
1607 memset(rcd->rcvegrbuf[chunk], 0, size); in qib_setup_eagerbufs()
1624 for (e = 0; e < rcd->rcvegrbuf_chunks && rcd->rcvegrbuf[e]; e++) in qib_setup_eagerbufs()
1626 rcd->rcvegrbuf[e], rcd->rcvegrbuf_phys[e]); in qib_setup_eagerbufs()
1627 kfree(rcd->rcvegrbuf_phys); in qib_setup_eagerbufs()
1628 rcd->rcvegrbuf_phys = NULL; in qib_setup_eagerbufs()
1630 kfree(rcd->rcvegrbuf); in qib_setup_eagerbufs()
1631 rcd->rcvegrbuf = NULL; in qib_setup_eagerbufs()