Lines Matching refs:pidx

207 	int pidx;  member
226 int pidx; member
232 int pidx; member
238 int pidx; member
243 int pidx; member
437 ntb_peer_port_number(tc->ntb, peer->pidx)); in tool_peer_port_read()
448 int pidx; in tool_init_peers() local
456 for (pidx = 0; pidx < tc->peer_cnt; pidx++) { in tool_init_peers()
457 tc->peers[pidx].pidx = pidx; in tool_init_peers()
458 tc->peers[pidx].tc = tc; in tool_init_peers()
502 if (ntb_link_is_up(tc->ntb, NULL, NULL) & BIT(peer->pidx)) in tool_peer_link_read()
530 link_msk = BIT_ULL_MASK(peer->pidx); in tool_peer_link_event_write()
576 static int tool_setup_mw(struct tool_ctx *tc, int pidx, int widx, in tool_setup_mw() argument
580 struct tool_mw *inmw = &tc->peers[pidx].inmws[widx]; in tool_setup_mw()
587 ret = ntb_mw_get_align(tc->ntb, pidx, widx, &addr_align, in tool_setup_mw()
605 ret = ntb_mw_set_trans(tc->ntb, pidx, widx, inmw->dma_base, inmw->size); in tool_setup_mw()
611 tc->peers[pidx].dbgfs_dir, inmw, in tool_setup_mw()
626 static void tool_free_mw(struct tool_ctx *tc, int pidx, int widx) in tool_free_mw() argument
628 struct tool_mw *inmw = &tc->peers[pidx].inmws[widx]; in tool_free_mw()
633 ntb_mw_clear_trans(tc->ntb, pidx, widx); in tool_free_mw()
661 ret = ntb_mw_get_align(inmw->tc->ntb, inmw->pidx, inmw->widx, in tool_mw_trans_read()
672 ntb_peer_port_number(inmw->tc->ntb, inmw->pidx), in tool_mw_trans_read()
673 inmw->pidx); in tool_mw_trans_read()
717 tool_free_mw(inmw->tc, inmw->pidx, inmw->widx); in tool_mw_trans_write()
719 ret = tool_setup_mw(inmw->tc, inmw->pidx, inmw->widx, val); in tool_mw_trans_write()
811 static int tool_setup_peer_mw(struct tool_ctx *tc, int pidx, int widx, in tool_setup_peer_mw() argument
827 ret = ntb_peer_mw_set_trans(tc->ntb, pidx, widx, req_addr, req_size); in tool_setup_peer_mw()
839 outmw->pidx = pidx; in tool_setup_peer_mw()
843 tc->peers[pidx].dbgfs_dir, outmw, in tool_setup_peer_mw()
849 ntb_peer_mw_clear_trans(tc->ntb, pidx, widx); in tool_setup_peer_mw()
862 ntb_peer_mw_clear_trans(tc->ntb, outmw->pidx, widx); in tool_free_peer_mw()
868 outmw->pidx = -1; in tool_free_peer_mw()
901 ntb_peer_port_number(outmw->tc->ntb, outmw->pidx), in tool_peer_mw_trans_read()
902 outmw->pidx); in tool_peer_mw_trans_read()
952 ret = tool_setup_peer_mw(outmw->tc, outmw_wrap->pidx, in tool_peer_mw_trans_write()
967 int widx, pidx; in tool_init_mws() local
978 tc->outmws[widx].pidx = -1; in tool_init_mws()
983 for (pidx = 0; pidx < tc->peer_cnt; pidx++) { in tool_init_mws()
984 tc->peers[pidx].inmw_cnt = ntb_mw_count(tc->ntb, pidx); in tool_init_mws()
985 tc->peers[pidx].inmws = in tool_init_mws()
986 devm_kcalloc(&tc->ntb->dev, tc->peers[pidx].inmw_cnt, in tool_init_mws()
987 sizeof(*tc->peers[pidx].inmws), GFP_KERNEL); in tool_init_mws()
988 if (tc->peers[pidx].inmws == NULL) in tool_init_mws()
991 for (widx = 0; widx < tc->peers[pidx].inmw_cnt; widx++) { in tool_init_mws()
992 tc->peers[pidx].inmws[widx].widx = widx; in tool_init_mws()
993 tc->peers[pidx].inmws[widx].pidx = pidx; in tool_init_mws()
994 tc->peers[pidx].inmws[widx].tc = tc; in tool_init_mws()
997 tc->peers[pidx].outmw_cnt = ntb_peer_mw_count(tc->ntb); in tool_init_mws()
998 tc->peers[pidx].outmws = in tool_init_mws()
999 devm_kcalloc(&tc->ntb->dev, tc->peers[pidx].outmw_cnt, in tool_init_mws()
1000 sizeof(*tc->peers[pidx].outmws), GFP_KERNEL); in tool_init_mws()
1001 if (tc->peers[pidx].outmws == NULL) in tool_init_mws()
1004 for (widx = 0; widx < tc->peers[pidx].outmw_cnt; widx++) { in tool_init_mws()
1005 tc->peers[pidx].outmws[widx].pidx = pidx; in tool_init_mws()
1006 tc->peers[pidx].outmws[widx].mw = &tc->outmws[widx]; in tool_init_mws()
1015 int widx, pidx; in tool_clear_mws() local
1022 for (pidx = 0; pidx < tc->peer_cnt; pidx++) in tool_clear_mws()
1023 for (widx = 0; widx < tc->peers[pidx].inmw_cnt; widx++) in tool_clear_mws()
1024 tool_free_mw(tc, pidx, widx); in tool_clear_mws()
1210 ntb_peer_spad_read(spad->tc->ntb, spad->pidx, spad->sidx)); in tool_peer_spad_read()
1231 ret = ntb_peer_spad_write(spad->tc->ntb, spad->pidx, spad->sidx, val); in tool_peer_spad_write()
1242 int sidx, pidx; in tool_init_spads() local
1253 tc->inspads[sidx].pidx = -1; in tool_init_spads()
1258 for (pidx = 0; pidx < tc->peer_cnt; pidx++) { in tool_init_spads()
1259 tc->peers[pidx].outspad_cnt = ntb_spad_count(tc->ntb); in tool_init_spads()
1260 tc->peers[pidx].outspads = in tool_init_spads()
1261 devm_kcalloc(&tc->ntb->dev, tc->peers[pidx].outspad_cnt, in tool_init_spads()
1262 sizeof(*tc->peers[pidx].outspads), GFP_KERNEL); in tool_init_spads()
1263 if (tc->peers[pidx].outspads == NULL) in tool_init_spads()
1266 for (sidx = 0; sidx < tc->peers[pidx].outspad_cnt; sidx++) { in tool_init_spads()
1267 tc->peers[pidx].outspads[sidx].sidx = sidx; in tool_init_spads()
1268 tc->peers[pidx].outspads[sidx].pidx = pidx; in tool_init_spads()
1269 tc->peers[pidx].outspads[sidx].tc = tc; in tool_init_spads()
1288 int pidx; in tool_inmsg_read() local
1290 data = ntb_msg_read(msg->tc->ntb, &pidx, msg->midx); in tool_inmsg_read()
1292 pos = scnprintf(buf, sizeof(buf), "0x%08x<-%d\n", data, pidx); in tool_inmsg_read()
1313 ret = ntb_peer_msg_write(msg->tc->ntb, msg->pidx, msg->midx, val); in tool_outmsg_write()
1406 int midx, pidx; in tool_init_msgs() local
1417 tc->inmsgs[midx].pidx = -1; in tool_init_msgs()
1422 for (pidx = 0; pidx < tc->peer_cnt; pidx++) { in tool_init_msgs()
1423 tc->peers[pidx].outmsg_cnt = ntb_msg_count(tc->ntb); in tool_init_msgs()
1424 tc->peers[pidx].outmsgs = in tool_init_msgs()
1425 devm_kcalloc(&tc->ntb->dev, tc->peers[pidx].outmsg_cnt, in tool_init_msgs()
1426 sizeof(*tc->peers[pidx].outmsgs), GFP_KERNEL); in tool_init_msgs()
1427 if (tc->peers[pidx].outmsgs == NULL) in tool_init_msgs()
1430 for (midx = 0; midx < tc->peers[pidx].outmsg_cnt; midx++) { in tool_init_msgs()
1431 tc->peers[pidx].outmsgs[midx].midx = midx; in tool_init_msgs()
1432 tc->peers[pidx].outmsgs[midx].pidx = pidx; in tool_init_msgs()
1433 tc->peers[pidx].outmsgs[midx].tc = tc; in tool_init_msgs()
1487 int pidx, widx, sidx, midx; in tool_setup_dbgfs() local
1557 for (pidx = 0; pidx < tc->peer_cnt; pidx++) { in tool_setup_dbgfs()
1558 snprintf(buf, sizeof(buf), "peer%d", pidx); in tool_setup_dbgfs()
1559 tc->peers[pidx].dbgfs_dir = in tool_setup_dbgfs()
1563 tc->peers[pidx].dbgfs_dir, in tool_setup_dbgfs()
1564 &tc->peers[pidx], &tool_peer_port_fops); in tool_setup_dbgfs()
1567 tc->peers[pidx].dbgfs_dir, in tool_setup_dbgfs()
1568 &tc->peers[pidx], &tool_peer_link_fops); in tool_setup_dbgfs()
1571 tc->peers[pidx].dbgfs_dir, in tool_setup_dbgfs()
1572 &tc->peers[pidx], &tool_peer_link_event_fops); in tool_setup_dbgfs()
1574 for (widx = 0; widx < tc->peers[pidx].inmw_cnt; widx++) { in tool_setup_dbgfs()
1577 tc->peers[pidx].dbgfs_dir, in tool_setup_dbgfs()
1578 &tc->peers[pidx].inmws[widx], in tool_setup_dbgfs()
1582 for (widx = 0; widx < tc->peers[pidx].outmw_cnt; widx++) { in tool_setup_dbgfs()
1585 tc->peers[pidx].dbgfs_dir, in tool_setup_dbgfs()
1586 &tc->peers[pidx].outmws[widx], in tool_setup_dbgfs()
1590 for (sidx = 0; sidx < tc->peers[pidx].outspad_cnt; sidx++) { in tool_setup_dbgfs()
1594 tc->peers[pidx].dbgfs_dir, in tool_setup_dbgfs()
1595 &tc->peers[pidx].outspads[sidx], in tool_setup_dbgfs()
1599 for (midx = 0; midx < tc->peers[pidx].outmsg_cnt; midx++) { in tool_setup_dbgfs()
1602 tc->peers[pidx].dbgfs_dir, in tool_setup_dbgfs()
1603 &tc->peers[pidx].outmsgs[midx], in tool_setup_dbgfs()