Lines Matching refs:pd

90 	struct ipath_portdata *pd = port_fp(fp);  in ipath_get_base_info()  local
93 struct ipath_devdata *dd = pd->port_dd; in ipath_get_base_info()
98 subport_cnt = pd->port_subport_cnt; in ipath_get_base_info()
126 ret = dd->ipath_f_get_base_info(pd, kinfo); in ipath_get_base_info()
138 pd->port_rcvegrbuf_chunks * pd->port_rcvegrbuf_size; in ipath_get_base_info()
139 kinfo->spi_rcv_egrperchunk = pd->port_rcvegrbufs_perchunk; in ipath_get_base_info()
141 pd->port_rcvegrbuf_chunks; in ipath_get_base_info()
170 kinfo->spi_rcvhdr_base = (u64) pd->port_rcvhdrq_phys; in ipath_get_base_info()
171 kinfo->spi_rcvhdr_tailaddr = (u64) pd->port_rcvhdrqtailaddr_phys; in ipath_get_base_info()
172 kinfo->spi_rcv_egrbufs = (u64) pd->port_rcvegr_phys; in ipath_get_base_info()
178 kinfo->spi_piocnt = pd->port_piocnt; in ipath_get_base_info()
179 kinfo->spi_piobufbase = (u64) pd->port_piobufs; in ipath_get_base_info()
181 dd->ipath_ureg_align * pd->port_port; in ipath_get_base_info()
183 kinfo->spi_piocnt = (pd->port_piocnt / subport_cnt) + in ipath_get_base_info()
184 (pd->port_piocnt % subport_cnt); in ipath_get_base_info()
186 kinfo->spi_piobufbase = (u64) pd->port_piobufs + in ipath_get_base_info()
188 (pd->port_piocnt - kinfo->spi_piocnt); in ipath_get_base_info()
192 kinfo->spi_piocnt = pd->port_piocnt / subport_cnt; in ipath_get_base_info()
193 kinfo->spi_piobufbase = (u64) pd->port_piobufs + in ipath_get_base_info()
199 dd->ipath_ureg_align * pd->port_port; in ipath_get_base_info()
204 kinfo->__spi_uregbase = cvt_kvaddr(pd->subport_uregbase + in ipath_get_base_info()
207 kinfo->spi_rcvhdr_base = cvt_kvaddr(pd->subport_rcvhdr_base + in ipath_get_base_info()
208 pd->port_rcvhdrq_size * subport_fp(fp)); in ipath_get_base_info()
210 kinfo->spi_rcv_egrbufs = cvt_kvaddr(pd->subport_rcvegrbuf + in ipath_get_base_info()
211 pd->port_rcvegrbuf_chunks * pd->port_rcvegrbuf_size * in ipath_get_base_info()
215 cvt_kvaddr(pd->subport_uregbase); in ipath_get_base_info()
217 cvt_kvaddr(pd->subport_rcvegrbuf); in ipath_get_base_info()
219 cvt_kvaddr(pd->subport_rcvhdr_base); in ipath_get_base_info()
244 kinfo->spi_port = pd->port_port; in ipath_get_base_info()
288 static int ipath_tid_update(struct ipath_portdata *pd, struct file *fp, in ipath_tid_update() argument
294 struct ipath_devdata *dd = pd->port_dd; in ipath_tid_update()
317 porttid = pd->port_port * dd->ipath_rcvtidcnt; in ipath_tid_update()
318 if (!pd->port_subport_cnt) { in ipath_tid_update()
320 tid = pd->port_tidcursor; in ipath_tid_update()
323 tidcnt = (dd->ipath_rcvtidcnt / pd->port_subport_cnt) + in ipath_tid_update()
324 (dd->ipath_rcvtidcnt % pd->port_subport_cnt); in ipath_tid_update()
329 tidcnt = dd->ipath_rcvtidcnt / pd->port_subport_cnt; in ipath_tid_update()
340 pagep = &((struct page **) pd->port_tid_pg_list)[tidoff]; in ipath_tid_update()
351 pd->port_port, cnt, tid, tidbase); in ipath_tid_update()
476 if (!pd->port_subport_cnt) in ipath_tid_update()
477 pd->port_tidcursor = tid; in ipath_tid_update()
506 static int ipath_tid_free(struct ipath_portdata *pd, unsigned subport, in ipath_tid_free() argument
511 struct ipath_devdata *dd = pd->port_dd; in ipath_tid_free()
526 porttid = pd->port_port * dd->ipath_rcvtidcnt; in ipath_tid_free()
527 if (!pd->port_subport_cnt) in ipath_tid_free()
530 tidcnt = (dd->ipath_rcvtidcnt / pd->port_subport_cnt) + in ipath_tid_free()
531 (dd->ipath_rcvtidcnt % pd->port_subport_cnt); in ipath_tid_free()
534 tidcnt = dd->ipath_rcvtidcnt / pd->port_subport_cnt; in ipath_tid_free()
547 "set is %d, porttid %u\n", pd->port_port, ti->tidcnt, in ipath_tid_free()
565 pid_nr(pd->port_pid), tid); in ipath_tid_free()
603 static int ipath_set_part_key(struct ipath_portdata *pd, u16 key) in ipath_set_part_key() argument
605 struct ipath_devdata *dd = pd->port_dd; in ipath_set_part_key()
618 pd->port_port, key, dd->ipath_pkeys[0], in ipath_set_part_key()
626 pd->port_port); in ipath_set_part_key()
639 for (i = 0; i < ARRAY_SIZE(pd->port_pkeys); i++) { in ipath_set_part_key()
640 if (!pd->port_pkeys[i] && pidx == -1) in ipath_set_part_key()
642 if (pd->port_pkeys[i] == key) { in ipath_set_part_key()
645 pd->port_port, key); in ipath_set_part_key()
652 "can't set %x\n", pd->port_port, key); in ipath_set_part_key()
665 pd->port_pkeys[pidx] = key; in ipath_set_part_key()
668 pd->port_port, key, i, in ipath_set_part_key()
695 "can't set %x\n", pd->port_port, key); in ipath_set_part_key()
706 pd->port_pkeys[pidx] = dd->ipath_pkeys[i] = key; in ipath_set_part_key()
714 pd->port_port, key, i, pidx, in ipath_set_part_key()
724 "can't set %x\n", pd->port_port, key); in ipath_set_part_key()
741 static int ipath_manage_rcvq(struct ipath_portdata *pd, unsigned subport, in ipath_manage_rcvq() argument
744 struct ipath_devdata *dd = pd->port_dd; in ipath_manage_rcvq()
748 pd->port_port, subport); in ipath_manage_rcvq()
765 if (pd->port_rcvhdrtail_kvaddr) in ipath_manage_rcvq()
766 ipath_clear_rcvhdrtail(pd); in ipath_manage_rcvq()
767 set_bit(dd->ipath_r_portenable_shift + pd->port_port, in ipath_manage_rcvq()
770 clear_bit(dd->ipath_r_portenable_shift + pd->port_port, in ipath_manage_rcvq()
784 ipath_read_ureg32(dd, ur_rcvhdrtail, pd->port_port); in ipath_manage_rcvq()
791 static void ipath_clean_part_key(struct ipath_portdata *pd, in ipath_clean_part_key() argument
803 for (i = 0; i < ARRAY_SIZE(pd->port_pkeys); i++) { in ipath_clean_part_key()
804 if (!pd->port_pkeys[i]) in ipath_clean_part_key()
807 pd->port_pkeys[i]); in ipath_clean_part_key()
811 (pd->port_pkeys[i] & 0x7fff)) in ipath_clean_part_key()
816 pd->port_port, in ipath_clean_part_key()
817 pd->port_pkeys[i], j); in ipath_clean_part_key()
824 "but ref still %d\n", pd->port_port, in ipath_clean_part_key()
825 pd->port_pkeys[i], j, in ipath_clean_part_key()
829 pd->port_pkeys[i] = 0; in ipath_clean_part_key()
837 "new pkey reg %llx\n", pd->port_port, in ipath_clean_part_key()
851 static void init_user_egr_sizes(struct ipath_portdata *pd) in init_user_egr_sizes() argument
853 struct ipath_devdata *dd = pd->port_dd; in init_user_egr_sizes()
870 pd->port_rcvegrbuf_chunks = (egrcnt + egrperchunk - 1) / egrperchunk; in init_user_egr_sizes()
871 pd->port_rcvegrbufs_perchunk = egrperchunk; in init_user_egr_sizes()
872 pd->port_rcvegrbuf_size = size; in init_user_egr_sizes()
887 static int ipath_create_user_egr(struct ipath_portdata *pd) in ipath_create_user_egr() argument
889 struct ipath_devdata *dd = pd->port_dd; in ipath_create_user_egr()
905 egroff = (pd->port_port - 1) * egrcnt + dd->ipath_p0_rcvegrcnt; in ipath_create_user_egr()
910 chunk = pd->port_rcvegrbuf_chunks; in ipath_create_user_egr()
911 egrperchunk = pd->port_rcvegrbufs_perchunk; in ipath_create_user_egr()
912 size = pd->port_rcvegrbuf_size; in ipath_create_user_egr()
913 pd->port_rcvegrbuf = kmalloc(chunk * sizeof(pd->port_rcvegrbuf[0]), in ipath_create_user_egr()
915 if (!pd->port_rcvegrbuf) { in ipath_create_user_egr()
919 pd->port_rcvegrbuf_phys = in ipath_create_user_egr()
920 kmalloc(chunk * sizeof(pd->port_rcvegrbuf_phys[0]), in ipath_create_user_egr()
922 if (!pd->port_rcvegrbuf_phys) { in ipath_create_user_egr()
926 for (e = 0; e < pd->port_rcvegrbuf_chunks; e++) { in ipath_create_user_egr()
928 pd->port_rcvegrbuf[e] = dma_alloc_coherent( in ipath_create_user_egr()
929 &dd->pcidev->dev, size, &pd->port_rcvegrbuf_phys[e], in ipath_create_user_egr()
932 if (!pd->port_rcvegrbuf[e]) { in ipath_create_user_egr()
938 pd->port_rcvegr_phys = pd->port_rcvegrbuf_phys[0]; in ipath_create_user_egr()
940 for (e = chunk = 0; chunk < pd->port_rcvegrbuf_chunks; chunk++) { in ipath_create_user_egr()
941 dma_addr_t pa = pd->port_rcvegrbuf_phys[chunk]; in ipath_create_user_egr()
960 for (e = 0; e < pd->port_rcvegrbuf_chunks && in ipath_create_user_egr()
961 pd->port_rcvegrbuf[e]; e++) { in ipath_create_user_egr()
963 pd->port_rcvegrbuf[e], in ipath_create_user_egr()
964 pd->port_rcvegrbuf_phys[e]); in ipath_create_user_egr()
967 kfree(pd->port_rcvegrbuf_phys); in ipath_create_user_egr()
968 pd->port_rcvegrbuf_phys = NULL; in ipath_create_user_egr()
970 kfree(pd->port_rcvegrbuf); in ipath_create_user_egr()
971 pd->port_rcvegrbuf = NULL; in ipath_create_user_egr()
979 struct ipath_portdata *pd, unsigned len, int write_ok, in ipath_mmap_mem() argument
982 struct ipath_devdata *dd = pd->port_dd; in ipath_mmap_mem()
1011 "bytes r%c failed: %d\n", what, pd->port_port, in ipath_mmap_mem()
1015 "r%c\n", what, pd->port_port, pfn, len, in ipath_mmap_mem()
1051 struct ipath_portdata *pd, in mmap_piobufs() argument
1095 struct ipath_portdata *pd) in mmap_rcvegrbufs() argument
1097 struct ipath_devdata *dd = pd->port_dd; in mmap_rcvegrbufs()
1103 size = pd->port_rcvegrbuf_size; in mmap_rcvegrbufs()
1104 total_size = pd->port_rcvegrbuf_chunks * size; in mmap_rcvegrbufs()
1125 for (i = 0; i < pd->port_rcvegrbuf_chunks; i++, start += size) { in mmap_rcvegrbufs()
1126 pfn = virt_to_phys(pd->port_rcvegrbuf[i]) >> PAGE_SHIFT; in mmap_rcvegrbufs()
1160 struct ipath_portdata *pd, unsigned subport) in mmap_kvaddr() argument
1169 if (!pd->port_subport_cnt) in mmap_kvaddr()
1172 dd = pd->port_dd; in mmap_kvaddr()
1173 size = pd->port_rcvegrbuf_chunks * pd->port_rcvegrbuf_size; in mmap_kvaddr()
1180 if (pgaddr == cvt_kvaddr(pd->subport_uregbase)) { in mmap_kvaddr()
1181 addr = pd->subport_uregbase; in mmap_kvaddr()
1182 size = PAGE_SIZE * pd->port_subport_cnt; in mmap_kvaddr()
1183 } else if (pgaddr == cvt_kvaddr(pd->subport_rcvhdr_base)) { in mmap_kvaddr()
1184 addr = pd->subport_rcvhdr_base; in mmap_kvaddr()
1185 size = pd->port_rcvhdrq_size * pd->port_subport_cnt; in mmap_kvaddr()
1186 } else if (pgaddr == cvt_kvaddr(pd->subport_rcvegrbuf)) { in mmap_kvaddr()
1187 addr = pd->subport_rcvegrbuf; in mmap_kvaddr()
1188 size *= pd->port_subport_cnt; in mmap_kvaddr()
1189 } else if (pgaddr == cvt_kvaddr(pd->subport_uregbase + in mmap_kvaddr()
1191 addr = pd->subport_uregbase + PAGE_SIZE * subport; in mmap_kvaddr()
1193 } else if (pgaddr == cvt_kvaddr(pd->subport_rcvhdr_base + in mmap_kvaddr()
1194 pd->port_rcvhdrq_size * subport)) { in mmap_kvaddr()
1195 addr = pd->subport_rcvhdr_base + in mmap_kvaddr()
1196 pd->port_rcvhdrq_size * subport; in mmap_kvaddr()
1197 size = pd->port_rcvhdrq_size; in mmap_kvaddr()
1198 } else if (pgaddr == cvt_kvaddr(pd->subport_rcvegrbuf + in mmap_kvaddr()
1200 addr = pd->subport_rcvegrbuf + size * subport; in mmap_kvaddr()
1245 struct ipath_portdata *pd; in ipath_mmap() local
1251 pd = port_fp(fp); in ipath_mmap()
1252 if (!pd) { in ipath_mmap()
1256 dd = pd->port_dd; in ipath_mmap()
1280 pd->port_port, subport_fp(fp)); in ipath_mmap()
1287 ret = mmap_kvaddr(vma, pgaddr, pd, subport_fp(fp)); in ipath_mmap()
1294 ureg = dd->ipath_uregbase + dd->ipath_ureg_align * pd->port_port; in ipath_mmap()
1295 if (!pd->port_subport_cnt) { in ipath_mmap()
1297 piocnt = pd->port_piocnt; in ipath_mmap()
1298 piobufs = pd->port_piobufs; in ipath_mmap()
1301 piocnt = (pd->port_piocnt / pd->port_subport_cnt) + in ipath_mmap()
1302 (pd->port_piocnt % pd->port_subport_cnt); in ipath_mmap()
1303 piobufs = pd->port_piobufs + in ipath_mmap()
1304 dd->ipath_palign * (pd->port_piocnt - piocnt); in ipath_mmap()
1309 piocnt = pd->port_piocnt / pd->port_subport_cnt; in ipath_mmap()
1310 piobufs = pd->port_piobufs + dd->ipath_palign * piocnt * slave; in ipath_mmap()
1316 ret = mmap_piobufs(vma, dd, pd, piobufs, piocnt); in ipath_mmap()
1319 ret = ipath_mmap_mem(vma, pd, PAGE_SIZE, 0, in ipath_mmap()
1322 else if (pgaddr == pd->port_rcvegr_phys) in ipath_mmap()
1323 ret = mmap_rcvegrbufs(vma, pd); in ipath_mmap()
1324 else if (pgaddr == (u64) pd->port_rcvhdrq_phys) in ipath_mmap()
1330 ret = ipath_mmap_mem(vma, pd, pd->port_rcvhdrq_size, 1, in ipath_mmap()
1331 pd->port_rcvhdrq, in ipath_mmap()
1333 else if (pgaddr == (u64) pd->port_rcvhdrqtailaddr_phys) in ipath_mmap()
1335 ret = ipath_mmap_mem(vma, pd, PAGE_SIZE, 0, in ipath_mmap()
1336 pd->port_rcvhdrtail_kvaddr, in ipath_mmap()
1352 static unsigned ipath_poll_hdrqfull(struct ipath_portdata *pd) in ipath_poll_hdrqfull() argument
1356 if ((pd->poll_type & IPATH_POLL_TYPE_OVERFLOW) && in ipath_poll_hdrqfull()
1357 pd->port_hdrqfull != pd->port_hdrqfull_poll) { in ipath_poll_hdrqfull()
1359 pd->port_hdrqfull_poll = pd->port_hdrqfull; in ipath_poll_hdrqfull()
1365 static unsigned int ipath_poll_urgent(struct ipath_portdata *pd, in ipath_poll_urgent() argument
1372 dd = pd->port_dd; in ipath_poll_urgent()
1376 pollflag = ipath_poll_hdrqfull(pd); in ipath_poll_urgent()
1378 if (pd->port_urgent != pd->port_urgent_poll) { in ipath_poll_urgent()
1380 pd->port_urgent_poll = pd->port_urgent; in ipath_poll_urgent()
1385 set_bit(IPATH_PORT_WAITING_URG, &pd->port_flag); in ipath_poll_urgent()
1388 poll_wait(fp, &pd->port_wait, pt); in ipath_poll_urgent()
1394 static unsigned int ipath_poll_next(struct ipath_portdata *pd, in ipath_poll_next() argument
1403 dd = pd->port_dd; in ipath_poll_next()
1407 pollflag = ipath_poll_hdrqfull(pd); in ipath_poll_next()
1409 head = ipath_read_ureg32(dd, ur_rcvhdrhead, pd->port_port); in ipath_poll_next()
1410 if (pd->port_rcvhdrtail_kvaddr) in ipath_poll_next()
1411 tail = ipath_get_rcvhdrtail(pd); in ipath_poll_next()
1413 tail = ipath_read_ureg32(dd, ur_rcvhdrtail, pd->port_port); in ipath_poll_next()
1419 set_bit(IPATH_PORT_WAITING_RCV, &pd->port_flag); in ipath_poll_next()
1423 set_bit(pd->port_port + dd->ipath_r_intravail_shift, in ipath_poll_next()
1432 pd->port_port); in ipath_poll_next()
1434 poll_wait(fp, &pd->port_wait, pt); in ipath_poll_next()
1443 struct ipath_portdata *pd; in ipath_poll() local
1446 pd = port_fp(fp); in ipath_poll()
1447 if (!pd) in ipath_poll()
1449 else if (pd->poll_type & IPATH_POLL_TYPE_URGENT) in ipath_poll()
1450 pollflag = ipath_poll_urgent(pd, fp, pt); in ipath_poll()
1452 pollflag = ipath_poll_next(pd, fp, pt); in ipath_poll()
1490 struct ipath_portdata *pd, in init_subports() argument
1533 pd->subport_uregbase = vzalloc(PAGE_SIZE * num_subports); in init_subports()
1534 if (!pd->subport_uregbase) { in init_subports()
1541 pd->subport_rcvhdr_base = vzalloc(size); in init_subports()
1542 if (!pd->subport_rcvhdr_base) { in init_subports()
1547 pd->subport_rcvegrbuf = vzalloc(pd->port_rcvegrbuf_chunks * in init_subports()
1548 pd->port_rcvegrbuf_size * in init_subports()
1550 if (!pd->subport_rcvegrbuf) { in init_subports()
1555 pd->port_subport_cnt = uinfo->spu_subport_cnt; in init_subports()
1556 pd->port_subport_id = uinfo->spu_subport_id; in init_subports()
1557 pd->active_slaves = 1; in init_subports()
1558 set_bit(IPATH_PORT_MASTER_UNINIT, &pd->port_flag); in init_subports()
1562 vfree(pd->subport_rcvhdr_base); in init_subports()
1564 vfree(pd->subport_uregbase); in init_subports()
1565 pd->subport_uregbase = NULL; in init_subports()
1574 struct ipath_portdata *pd; in try_alloc_port() local
1577 if (!(pd = dd->ipath_pd[port])) { in try_alloc_port()
1580 pd = kzalloc(sizeof(struct ipath_portdata), GFP_KERNEL); in try_alloc_port()
1590 if (!pd || !ptmp) { in try_alloc_port()
1594 kfree(pd); in try_alloc_port()
1598 dd->ipath_pd[port] = pd; in try_alloc_port()
1604 if (!pd->port_cnt) { in try_alloc_port()
1605 pd->userversion = uinfo->spu_userversion; in try_alloc_port()
1606 init_user_egr_sizes(pd); in try_alloc_port()
1607 if ((ret = init_subports(dd, pd, uinfo)) != 0) in try_alloc_port()
1612 pd->port_cnt = 1; in try_alloc_port()
1613 port_fp(fp) = pd; in try_alloc_port()
1614 pd->port_pid = get_pid(task_pid(current)); in try_alloc_port()
1615 strlcpy(pd->port_comm, current->comm, sizeof(pd->port_comm)); in try_alloc_port()
1781 struct ipath_portdata *pd = dd->ipath_pd[i]; in find_shared_port() local
1784 if (!pd || !pd->port_cnt) in find_shared_port()
1787 if (pd->port_subport_id != uinfo->spu_subport_id) in find_shared_port()
1790 if (pd->port_subport_cnt != uinfo->spu_subport_cnt || in find_shared_port()
1791 pd->userversion != uinfo->spu_userversion || in find_shared_port()
1792 pd->port_cnt >= pd->port_subport_cnt) { in find_shared_port()
1796 port_fp(fp) = pd; in find_shared_port()
1797 subport_fp(fp) = pd->port_cnt++; in find_shared_port()
1798 pd->port_subpid[subport_fp(fp)] = in find_shared_port()
1801 pd->active_slaves |= 1 << subport_fp(fp); in find_shared_port()
1806 pd->port_comm, pid_nr(pd->port_pid), in find_shared_port()
1807 dd->ipath_unit, pd->port_port); in find_shared_port()
1875 const struct ipath_portdata *pd = fd->pd; in ipath_assign_port() local
1876 const struct ipath_devdata *dd = pd->port_dd; in ipath_assign_port()
1880 pd->port_port, in ipath_assign_port()
1898 struct ipath_portdata *pd = port_fp(fp); in ipath_do_user_init() local
1904 ret = wait_event_interruptible(pd->port_wait, in ipath_do_user_init()
1905 !test_bit(IPATH_PORT_MASTER_UNINIT, &pd->port_flag)); in ipath_do_user_init()
1909 dd = pd->port_dd; in ipath_do_user_init()
1920 if (pd->port_port <= dd->ipath_ports_extrabuf) in ipath_do_user_init()
1921 pd->port_piocnt = dd->ipath_pbufsport + 1; in ipath_do_user_init()
1923 pd->port_piocnt = dd->ipath_pbufsport; in ipath_do_user_init()
1926 if (pd->port_port <= dd->ipath_ports_extrabuf) in ipath_do_user_init()
1927 pd->port_pio_base = (dd->ipath_pbufsport + 1) in ipath_do_user_init()
1928 * (pd->port_port - 1); in ipath_do_user_init()
1930 pd->port_pio_base = dd->ipath_ports_extrabuf + in ipath_do_user_init()
1931 dd->ipath_pbufsport * (pd->port_port - 1); in ipath_do_user_init()
1932 pd->port_piobufs = dd->ipath_piobufbase + in ipath_do_user_init()
1933 pd->port_pio_base * dd->ipath_palign; in ipath_do_user_init()
1935 " first pio %u\n", pd->port_port, pd->port_piobufs, in ipath_do_user_init()
1936 pd->port_piocnt, pd->port_pio_base); in ipath_do_user_init()
1937 ipath_chg_pioavailkernel(dd, pd->port_pio_base, pd->port_piocnt, 0); in ipath_do_user_init()
1945 ret = ipath_create_rcvhdrq(dd, pd); in ipath_do_user_init()
1947 ret = ipath_create_user_egr(pd); in ipath_do_user_init()
1956 head32 = ipath_read_ureg32(dd, ur_rcvegrindextail, pd->port_port); in ipath_do_user_init()
1957 ipath_write_ureg(dd, ur_rcvegrindexhead, head32, pd->port_port); in ipath_do_user_init()
1958 pd->port_lastrcvhdrqtail = -1; in ipath_do_user_init()
1960 pd->port_port, head32); in ipath_do_user_init()
1961 pd->port_tidcursor = 0; /* start at beginning after open */ in ipath_do_user_init()
1964 pd->port_urgent = 0; in ipath_do_user_init()
1965 pd->port_urgent_poll = 0; in ipath_do_user_init()
1966 pd->port_hdrqfull_poll = pd->port_hdrqfull; in ipath_do_user_init()
1979 set_bit(dd->ipath_r_portenable_shift + pd->port_port, in ipath_do_user_init()
1982 if (pd->port_rcvhdrtail_kvaddr) in ipath_do_user_init()
1983 ipath_clear_rcvhdrtail(pd); in ipath_do_user_init()
1991 if (pd->port_subport_cnt) { in ipath_do_user_init()
1992 clear_bit(IPATH_PORT_MASTER_UNINIT, &pd->port_flag); in ipath_do_user_init()
1993 wake_up(&pd->port_wait); in ipath_do_user_init()
2006 static void unlock_expected_tids(struct ipath_portdata *pd) in unlock_expected_tids() argument
2008 struct ipath_devdata *dd = pd->port_dd; in unlock_expected_tids()
2009 int port_tidbase = pd->port_port * dd->ipath_rcvtidcnt; in unlock_expected_tids()
2013 pd->port_port); in unlock_expected_tids()
2029 pd->port_port, cnt); in unlock_expected_tids()
2042 struct ipath_portdata *pd; in ipath_close() local
2055 pd = fd->pd; in ipath_close()
2056 if (!pd) { in ipath_close()
2061 dd = pd->port_dd; in ipath_close()
2067 if (--pd->port_cnt) { in ipath_close()
2073 pd->active_slaves &= ~(1 << fd->subport); in ipath_close()
2074 put_pid(pd->port_subpid[fd->subport]); in ipath_close()
2075 pd->port_subpid[fd->subport] = NULL; in ipath_close()
2081 port = pd->port_port; in ipath_close()
2083 pid = pd->port_pid; in ipath_close()
2084 pd->port_pid = NULL; in ipath_close()
2087 if (pd->port_rcvwait_to || pd->port_piowait_to in ipath_close()
2088 || pd->port_rcvnowait || pd->port_pionowait) { in ipath_close()
2091 pd->port_port, pd->port_rcvwait_to, in ipath_close()
2092 pd->port_piowait_to, pd->port_rcvnowait, in ipath_close()
2093 pd->port_pionowait); in ipath_close()
2094 pd->port_rcvwait_to = pd->port_piowait_to = in ipath_close()
2095 pd->port_rcvnowait = pd->port_pionowait = 0; in ipath_close()
2097 if (pd->port_flag) { in ipath_close()
2099 pd->port_port, pd->port_flag); in ipath_close()
2100 pd->port_flag = 0; in ipath_close()
2107 clear_bit(pd->port_port + dd->ipath_r_intravail_shift, in ipath_close()
2116 ipath_clean_part_key(pd, dd); in ipath_close()
2130 pd->port_port, dd->ipath_dummy_hdrq_phys); in ipath_close()
2132 ipath_disarm_piobufs(dd, pd->port_pio_base, pd->port_piocnt); in ipath_close()
2133 ipath_chg_pioavailkernel(dd, pd->port_pio_base, in ipath_close()
2134 pd->port_piocnt, 1); in ipath_close()
2136 dd->ipath_f_clear_tids(dd, pd->port_port); in ipath_close()
2139 unlock_expected_tids(pd); in ipath_close()
2142 pd->port_comm, pid_nr(pid), in ipath_close()
2148 ipath_free_pddata(dd, pd); /* after releasing the mutex */ in ipath_close()
2155 static int ipath_port_info(struct ipath_portdata *pd, u16 subport, in ipath_port_info() argument
2165 info.unit = pd->port_dd->ipath_unit; in ipath_port_info()
2166 info.port = pd->port_port; in ipath_port_info()
2169 if (ipath_supports_subports(pd->userversion >> 16, in ipath_port_info()
2170 pd->userversion & 0xffff)) { in ipath_port_info()
2172 info.num_ports = pd->port_dd->ipath_cfgports - 1; in ipath_port_info()
2173 info.num_subports = pd->port_subport_cnt; in ipath_port_info()
2188 static int ipath_get_slave_info(struct ipath_portdata *pd, in ipath_get_slave_info() argument
2193 if (copy_to_user(slave_mask_addr, &pd->active_slaves, sizeof(u32))) in ipath_get_slave_info()
2231 struct ipath_portdata *pd; in ipath_write() local
2330 pd = port_fp(fp); in ipath_write()
2331 if (!pd && cmd.type != __IPATH_CMD_USER_INIT && in ipath_write()
2359 ret = ipath_manage_rcvq(pd, subport_fp(fp), cmd.cmd.recv_ctrl); in ipath_write()
2362 ret = ipath_port_info(pd, subport_fp(fp), in ipath_write()
2367 ret = ipath_tid_update(pd, fp, &cmd.cmd.tid_info); in ipath_write()
2370 ret = ipath_tid_free(pd, subport_fp(fp), &cmd.cmd.tid_info); in ipath_write()
2373 ret = ipath_set_part_key(pd, cmd.cmd.part_key); in ipath_write()
2376 ret = ipath_get_slave_info(pd, in ipath_write()
2381 ipath_force_pio_avail_update(pd->port_dd); in ipath_write()
2384 pd->poll_type = cmd.cmd.poll_type; in ipath_write()
2388 ipath_enable_armlaunch(pd->port_dd); in ipath_write()
2390 ipath_disable_armlaunch(pd->port_dd); in ipath_write()
2398 ret = ipath_sdma_get_complete(pd->port_dd, in ipath_write()
2417 struct ipath_portdata *pd = port_fp(filp); in ipath_writev() local
2423 return ipath_user_sdma_writev(pd->port_dd, pq, iov, dim); in ipath_writev()