Skip to content

Commit 3e90056

Browse files
Joey Zhangwesleywesley
authored andcommitted
ntb_hw_switchtec: Optimize function switchtec_ntb_reinit_peer()
Function switchtec_ntb_reinit_peer() is used to reinitialize the shared NTB memory window. it doesn't need to free and reallocate the memory. We can implement it by reconfiguring the reseved LUT window. Signed-off-by: Joey Zhang <[email protected]>
1 parent 96afe9c commit 3e90056

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

ntb_hw_switchtec.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -502,16 +502,10 @@ static int switchtec_ntb_reinit_peer(struct switchtec_ntb *sndev);
502502

503503
static void link_reinit_work(struct work_struct *work)
504504
{
505-
int link_sta;
506505
struct switchtec_ntb *sndev;
507506

508507
sndev = container_of(work, struct switchtec_ntb, link_reinit_work);
509-
510-
link_sta = sndev->self_shared->link_sta;
511-
512508
switchtec_ntb_reinit_peer(sndev);
513-
514-
sndev->self_shared->link_sta = link_sta;
515509
}
516510

517511
static void switchtec_ntb_check_link(struct switchtec_ntb *sndev,
@@ -1447,10 +1441,13 @@ static void switchtec_ntb_deinit_db_msg_irq(struct switchtec_ntb *sndev)
14471441

14481442
static int switchtec_ntb_reinit_peer(struct switchtec_ntb *sndev)
14491443
{
1450-
dev_info(&sndev->stdev->dev, "peer reinitialized\n");
1451-
switchtec_ntb_deinit_shared_mw(sndev);
1452-
switchtec_ntb_init_mw(sndev);
1453-
return switchtec_ntb_init_shared_mw(sndev);
1444+
int rc;
1445+
1446+
dev_info(&sndev->stdev->dev, "reinitialize shared memory window\n");
1447+
rc = config_rsvd_lut_win(sndev, sndev->mmio_peer_ctrl, 0,
1448+
sndev->self_partition,
1449+
sndev->self_shared_dma);
1450+
return rc;
14541451
}
14551452

14561453
static int switchtec_ntb_add(struct device *dev,

0 commit comments

Comments
 (0)