Lines Matching refs:rcd
134 dd->rcd = kcalloc(dd->ctxtcnt, sizeof(*dd->rcd), GFP_KERNEL); in qib_create_ctxts()
135 if (!dd->rcd) in qib_create_ctxts()
141 struct qib_ctxtdata *rcd; in qib_create_ctxts() local
148 rcd = qib_create_ctxtdata(ppd, i, dd->assigned_node_id); in qib_create_ctxts()
149 if (!rcd) { in qib_create_ctxts()
152 kfree(dd->rcd); in qib_create_ctxts()
153 dd->rcd = NULL; in qib_create_ctxts()
156 rcd->pkeys[0] = QIB_DEFAULT_P_KEY; in qib_create_ctxts()
157 rcd->seq_cnt = 1; in qib_create_ctxts()
169 struct qib_ctxtdata *rcd; in qib_create_ctxtdata() local
171 rcd = kzalloc_node(sizeof(*rcd), GFP_KERNEL, node_id); in qib_create_ctxtdata()
172 if (rcd) { in qib_create_ctxtdata()
173 INIT_LIST_HEAD(&rcd->qp_wait_list); in qib_create_ctxtdata()
174 rcd->node_id = node_id; in qib_create_ctxtdata()
175 rcd->ppd = ppd; in qib_create_ctxtdata()
176 rcd->dd = dd; in qib_create_ctxtdata()
177 rcd->cnt = 1; in qib_create_ctxtdata()
178 rcd->ctxt = ctxt; in qib_create_ctxtdata()
179 dd->rcd[ctxt] = rcd; in qib_create_ctxtdata()
182 rcd->opstats = kzalloc_node(sizeof(*rcd->opstats), in qib_create_ctxtdata()
184 if (!rcd->opstats) { in qib_create_ctxtdata()
185 kfree(rcd); in qib_create_ctxtdata()
192 dd->f_init_ctxt(rcd); in qib_create_ctxtdata()
205 rcd->rcvegrbuf_size = 0x8000; in qib_create_ctxtdata()
206 rcd->rcvegrbufs_perchunk = in qib_create_ctxtdata()
207 rcd->rcvegrbuf_size / dd->rcvegrbufsize; in qib_create_ctxtdata()
208 rcd->rcvegrbuf_chunks = (rcd->rcvegrcnt + in qib_create_ctxtdata()
209 rcd->rcvegrbufs_perchunk - 1) / in qib_create_ctxtdata()
210 rcd->rcvegrbufs_perchunk; in qib_create_ctxtdata()
211 rcd->rcvegrbufs_perchunk_shift = in qib_create_ctxtdata()
212 ilog2(rcd->rcvegrbufs_perchunk); in qib_create_ctxtdata()
214 return rcd; in qib_create_ctxtdata()
486 for (i = 0; dd->rcd && i < dd->first_user_ctxt; ++i) { in enable_chip()
487 struct qib_ctxtdata *rcd = dd->rcd[i]; in enable_chip() local
489 if (rcd) in enable_chip()
490 dd->f_rcvctrl(rcd->ppd, rcvmask, i); in enable_chip()
634 struct qib_ctxtdata *rcd; in qib_init() local
664 for (i = 0; dd->rcd && i < dd->first_user_ctxt; ++i) { in qib_init()
671 rcd = dd->rcd[i]; in qib_init()
672 if (!rcd) in qib_init()
675 lastfail = qib_create_rcvhdrq(dd, rcd); in qib_init()
677 lastfail = qib_setup_eagerbufs(rcd); in qib_init()
902 void qib_free_ctxtdata(struct qib_devdata *dd, struct qib_ctxtdata *rcd) in qib_free_ctxtdata() argument
904 if (!rcd) in qib_free_ctxtdata()
907 if (rcd->rcvhdrq) { in qib_free_ctxtdata()
908 dma_free_coherent(&dd->pcidev->dev, rcd->rcvhdrq_size, in qib_free_ctxtdata()
909 rcd->rcvhdrq, rcd->rcvhdrq_phys); in qib_free_ctxtdata()
910 rcd->rcvhdrq = NULL; in qib_free_ctxtdata()
911 if (rcd->rcvhdrtail_kvaddr) { in qib_free_ctxtdata()
913 rcd->rcvhdrtail_kvaddr, in qib_free_ctxtdata()
914 rcd->rcvhdrqtailaddr_phys); in qib_free_ctxtdata()
915 rcd->rcvhdrtail_kvaddr = NULL; in qib_free_ctxtdata()
918 if (rcd->rcvegrbuf) { in qib_free_ctxtdata()
921 for (e = 0; e < rcd->rcvegrbuf_chunks; e++) { in qib_free_ctxtdata()
922 void *base = rcd->rcvegrbuf[e]; in qib_free_ctxtdata()
923 size_t size = rcd->rcvegrbuf_size; in qib_free_ctxtdata()
926 base, rcd->rcvegrbuf_phys[e]); in qib_free_ctxtdata()
928 kfree(rcd->rcvegrbuf); in qib_free_ctxtdata()
929 rcd->rcvegrbuf = NULL; in qib_free_ctxtdata()
930 kfree(rcd->rcvegrbuf_phys); in qib_free_ctxtdata()
931 rcd->rcvegrbuf_phys = NULL; in qib_free_ctxtdata()
932 rcd->rcvegrbuf_chunks = 0; in qib_free_ctxtdata()
935 kfree(rcd->tid_pg_list); in qib_free_ctxtdata()
936 vfree(rcd->user_event_mask); in qib_free_ctxtdata()
937 vfree(rcd->subctxt_uregbase); in qib_free_ctxtdata()
938 vfree(rcd->subctxt_rcvegrbuf); in qib_free_ctxtdata()
939 vfree(rcd->subctxt_rcvhdr_base); in qib_free_ctxtdata()
941 kfree(rcd->opstats); in qib_free_ctxtdata()
942 rcd->opstats = NULL; in qib_free_ctxtdata()
944 kfree(rcd); in qib_free_ctxtdata()
1355 tmp = dd->rcd; in cleanup_device_data()
1356 dd->rcd = NULL; in cleanup_device_data()
1359 struct qib_ctxtdata *rcd = tmp[ctxt]; in cleanup_device_data() local
1362 qib_free_ctxtdata(dd, rcd); in cleanup_device_data()
1539 int qib_create_rcvhdrq(struct qib_devdata *dd, struct qib_ctxtdata *rcd) in qib_create_rcvhdrq() argument
1544 if (!rcd->rcvhdrq) { in qib_create_rcvhdrq()
1551 set_dev_node(&dd->pcidev->dev, rcd->node_id); in qib_create_rcvhdrq()
1552 rcd->rcvhdrq = dma_alloc_coherent(&dd->pcidev->dev, amt, in qib_create_rcvhdrq()
1553 &rcd->rcvhdrq_phys, GFP_KERNEL); in qib_create_rcvhdrq()
1556 if (!rcd->rcvhdrq) { in qib_create_rcvhdrq()
1559 amt, rcd->ctxt); in qib_create_rcvhdrq()
1563 if (rcd->ctxt >= dd->first_user_ctxt) { in qib_create_rcvhdrq()
1564 rcd->user_event_mask = vmalloc_user(PAGE_SIZE); in qib_create_rcvhdrq()
1565 if (!rcd->user_event_mask) in qib_create_rcvhdrq()
1570 set_dev_node(&dd->pcidev->dev, rcd->node_id); in qib_create_rcvhdrq()
1571 rcd->rcvhdrtail_kvaddr = dma_alloc_coherent( in qib_create_rcvhdrq()
1575 if (!rcd->rcvhdrtail_kvaddr) in qib_create_rcvhdrq()
1577 rcd->rcvhdrqtailaddr_phys = phys_hdrqtail; in qib_create_rcvhdrq()
1580 rcd->rcvhdrq_size = amt; in qib_create_rcvhdrq()
1584 memset(rcd->rcvhdrq, 0, rcd->rcvhdrq_size); in qib_create_rcvhdrq()
1585 if (rcd->rcvhdrtail_kvaddr) in qib_create_rcvhdrq()
1586 memset(rcd->rcvhdrtail_kvaddr, 0, PAGE_SIZE); in qib_create_rcvhdrq()
1592 rcd->ctxt); in qib_create_rcvhdrq()
1593 vfree(rcd->user_event_mask); in qib_create_rcvhdrq()
1594 rcd->user_event_mask = NULL; in qib_create_rcvhdrq()
1596 dma_free_coherent(&dd->pcidev->dev, amt, rcd->rcvhdrq, in qib_create_rcvhdrq()
1597 rcd->rcvhdrq_phys); in qib_create_rcvhdrq()
1598 rcd->rcvhdrq = NULL; in qib_create_rcvhdrq()
1612 int qib_setup_eagerbufs(struct qib_ctxtdata *rcd) in qib_setup_eagerbufs() argument
1614 struct qib_devdata *dd = rcd->dd; in qib_setup_eagerbufs()
1619 egrcnt = rcd->rcvegrcnt; in qib_setup_eagerbufs()
1620 egroff = rcd->rcvegr_tid_base; in qib_setup_eagerbufs()
1623 chunk = rcd->rcvegrbuf_chunks; in qib_setup_eagerbufs()
1624 egrperchunk = rcd->rcvegrbufs_perchunk; in qib_setup_eagerbufs()
1625 size = rcd->rcvegrbuf_size; in qib_setup_eagerbufs()
1626 if (!rcd->rcvegrbuf) { in qib_setup_eagerbufs()
1627 rcd->rcvegrbuf = in qib_setup_eagerbufs()
1628 kcalloc_node(chunk, sizeof(rcd->rcvegrbuf[0]), in qib_setup_eagerbufs()
1629 GFP_KERNEL, rcd->node_id); in qib_setup_eagerbufs()
1630 if (!rcd->rcvegrbuf) in qib_setup_eagerbufs()
1633 if (!rcd->rcvegrbuf_phys) { in qib_setup_eagerbufs()
1634 rcd->rcvegrbuf_phys = in qib_setup_eagerbufs()
1636 sizeof(rcd->rcvegrbuf_phys[0]), in qib_setup_eagerbufs()
1637 GFP_KERNEL, rcd->node_id); in qib_setup_eagerbufs()
1638 if (!rcd->rcvegrbuf_phys) in qib_setup_eagerbufs()
1641 for (e = 0; e < rcd->rcvegrbuf_chunks; e++) { in qib_setup_eagerbufs()
1642 if (rcd->rcvegrbuf[e]) in qib_setup_eagerbufs()
1646 set_dev_node(&dd->pcidev->dev, rcd->node_id); in qib_setup_eagerbufs()
1647 rcd->rcvegrbuf[e] = in qib_setup_eagerbufs()
1649 &rcd->rcvegrbuf_phys[e], in qib_setup_eagerbufs()
1652 if (!rcd->rcvegrbuf[e]) in qib_setup_eagerbufs()
1656 rcd->rcvegr_phys = rcd->rcvegrbuf_phys[0]; in qib_setup_eagerbufs()
1658 for (e = chunk = 0; chunk < rcd->rcvegrbuf_chunks; chunk++) { in qib_setup_eagerbufs()
1659 dma_addr_t pa = rcd->rcvegrbuf_phys[chunk]; in qib_setup_eagerbufs()
1663 memset(rcd->rcvegrbuf[chunk], 0, size); in qib_setup_eagerbufs()
1680 for (e = 0; e < rcd->rcvegrbuf_chunks && rcd->rcvegrbuf[e]; e++) in qib_setup_eagerbufs()
1682 rcd->rcvegrbuf[e], rcd->rcvegrbuf_phys[e]); in qib_setup_eagerbufs()
1683 kfree(rcd->rcvegrbuf_phys); in qib_setup_eagerbufs()
1684 rcd->rcvegrbuf_phys = NULL; in qib_setup_eagerbufs()
1686 kfree(rcd->rcvegrbuf); in qib_setup_eagerbufs()
1687 rcd->rcvegrbuf = NULL; in qib_setup_eagerbufs()