Lines Matching refs:tpg
32 struct usbg_tpg *tpg; member
439 luns = atomic_read(&fu->tpg->tpg_port_count); in usbg_bot_setup()
1045 struct usbg_tpg *tpg; in usbg_cmd_work() local
1049 tpg = cmd->fu->tpg; in usbg_cmd_work()
1050 tv_nexus = tpg->tpg_nexus; in usbg_cmd_work()
1100 struct usbg_tpg *tpg = fu->tpg; in usbg_submit_command() local
1110 tv_nexus = tpg->tpg_nexus; in usbg_submit_command()
1161 queue_work(tpg->workqueue, &cmd->work); in usbg_submit_command()
1174 struct usbg_tpg *tpg; in bot_cmd_work() local
1178 tpg = cmd->fu->tpg; in bot_cmd_work()
1179 tv_nexus = tpg->tpg_nexus; in bot_cmd_work()
1206 struct usbg_tpg *tpg = fu->tpg; in bot_submit_command() local
1223 tv_nexus = tpg->tpg_nexus; in bot_submit_command()
1244 queue_work(tpg->workqueue, &cmd->work); in bot_submit_command()
1263 struct usbg_tpg *tpg = container_of(se_tpg, in usbg_get_fabric_wwn() local
1265 struct usbg_tport *tport = tpg->tport; in usbg_get_fabric_wwn()
1272 struct usbg_tpg *tpg = container_of(se_tpg, in usbg_get_tag() local
1274 return tpg->tport_tpgt; in usbg_get_tag()
1341 struct usbg_tpg *tpg; in usbg_make_tpg() local
1354 if (tpg_instances[i].func_inst && !tpg_instances[i].tpg) in usbg_make_tpg()
1376 tpg = kzalloc(sizeof(struct usbg_tpg), GFP_KERNEL); in usbg_make_tpg()
1378 if (!tpg) in usbg_make_tpg()
1380 mutex_init(&tpg->tpg_mutex); in usbg_make_tpg()
1381 atomic_set(&tpg->tpg_port_count, 0); in usbg_make_tpg()
1382 tpg->workqueue = alloc_workqueue("tcm_usb_gadget", 0, 1); in usbg_make_tpg()
1383 if (!tpg->workqueue) in usbg_make_tpg()
1386 tpg->tport = tport; in usbg_make_tpg()
1387 tpg->tport_tpgt = tpgt; in usbg_make_tpg()
1393 ret = core_tpg_register(wwn, &tpg->se_tpg, SCSI_PROTOCOL_SAS); in usbg_make_tpg()
1397 tpg_instances[i].tpg = tpg; in usbg_make_tpg()
1398 tpg->fi = tpg_instances[i].func_inst; in usbg_make_tpg()
1401 return &tpg->se_tpg; in usbg_make_tpg()
1404 destroy_workqueue(tpg->workqueue); in usbg_make_tpg()
1406 kfree(tpg); in usbg_make_tpg()
1424 struct usbg_tpg *tpg = container_of(se_tpg, in usbg_drop_tpg() local
1429 tcm_usbg_drop_nexus(tpg); in usbg_drop_tpg()
1431 destroy_workqueue(tpg->workqueue); in usbg_drop_tpg()
1435 if (tpg_instances[i].tpg == tpg) in usbg_drop_tpg()
1438 tpg_instances[i].tpg = NULL; in usbg_drop_tpg()
1451 kfree(tpg); in usbg_drop_tpg()
1503 struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg); in usbg_enable_tpg() local
1507 ret = usbg_attach(tpg); in usbg_enable_tpg()
1509 usbg_detach(tpg); in usbg_enable_tpg()
1513 tpg->gadget_connect = enable; in usbg_enable_tpg()
1521 struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg); in tcm_usbg_tpg_nexus_show() local
1525 mutex_lock(&tpg->tpg_mutex); in tcm_usbg_tpg_nexus_show()
1526 tv_nexus = tpg->tpg_nexus; in tcm_usbg_tpg_nexus_show()
1534 mutex_unlock(&tpg->tpg_mutex); in tcm_usbg_tpg_nexus_show()
1541 struct usbg_tpg *tpg = container_of(se_tpg, in usbg_alloc_sess_cb() local
1544 tpg->tpg_nexus = p; in usbg_alloc_sess_cb()
1548 static int tcm_usbg_make_nexus(struct usbg_tpg *tpg, char *name) in tcm_usbg_make_nexus() argument
1553 mutex_lock(&tpg->tpg_mutex); in tcm_usbg_make_nexus()
1554 if (tpg->tpg_nexus) { in tcm_usbg_make_nexus()
1566 tv_nexus->tvn_se_sess = target_setup_session(&tpg->se_tpg, in tcm_usbg_make_nexus()
1580 mutex_unlock(&tpg->tpg_mutex); in tcm_usbg_make_nexus()
1584 static int tcm_usbg_drop_nexus(struct usbg_tpg *tpg) in tcm_usbg_drop_nexus() argument
1590 mutex_lock(&tpg->tpg_mutex); in tcm_usbg_drop_nexus()
1591 tv_nexus = tpg->tpg_nexus; in tcm_usbg_drop_nexus()
1599 if (atomic_read(&tpg->tpg_port_count)) { in tcm_usbg_drop_nexus()
1602 pr_err(MSG, atomic_read(&tpg->tpg_port_count)); in tcm_usbg_drop_nexus()
1613 tpg->tpg_nexus = NULL; in tcm_usbg_drop_nexus()
1618 mutex_unlock(&tpg->tpg_mutex); in tcm_usbg_drop_nexus()
1626 struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg); in tcm_usbg_tpg_nexus_store() local
1631 ret = tcm_usbg_drop_nexus(tpg); in tcm_usbg_tpg_nexus_store()
1652 ret = tcm_usbg_make_nexus(tpg, &i_port[0]); in tcm_usbg_tpg_nexus_store()
1667 struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg); in usbg_port_link() local
1669 atomic_inc(&tpg->tpg_port_count); in usbg_port_link()
1677 struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg); in usbg_port_unlink() local
1679 atomic_dec(&tpg->tpg_port_count); in usbg_port_unlink()
2193 static int usbg_attach(struct usbg_tpg *tpg) in usbg_attach() argument
2195 struct usb_function_instance *f = tpg->fi; in usbg_attach()
2204 static void usbg_detach(struct usbg_tpg *tpg) in usbg_detach() argument
2206 struct usb_function_instance *f = tpg->fi; in usbg_detach()
2301 fu->tpg = tpg_instances[i].tpg; in tcm_alloc()