netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net/smc: use the correct ndev to find pnetid by pnetid table
@ 2024-12-27  4:04 Guangguan Wang
  2025-01-04 16:40 ` Jakub Kicinski
                   ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Guangguan Wang @ 2024-12-27  4:04 UTC (permalink / raw)
  To: wenjia, jaka, PASIC, alibuda, tonylu, guwen, davem, edumazet,
	kuba, pabeni, horms
  Cc: linux-rdma, linux-s390, netdev, linux-kernel

The command 'smc_pnet -a -I <ethx> <pnetid>' will add <pnetid>
to the pnetid table and will attach the <pnetid> to net device
whose name is <ethx>. But When do SMCR by <ethx>, in function
smc_pnet_find_roce_by_pnetid, it will use <ethx>'s base ndev's
pnetid to match rdma device, not <ethx>'s pnetid. The asymmetric
use of the pnetid seems weird. Sometimes it is difficult to know
the hierarchy of net device what may make it difficult to configure
the pnetid and to use the pnetid. Looking into the history of
commit, it was the commit 890a2cb4a966 ("net/smc: rework pnet table")
that changes the ndev from the <ethx> to the <ethx>'s base ndev
when finding pnetid by pnetid table. It seems a mistake.

This patch changes the ndev back to the <ethx> when finding pnetid
by pnetid table.

Fixes: 890a2cb4a966 ("net/smc: rework pnet table")
Signed-off-by: Guangguan Wang <guangguan.wang@linux.alibaba.com>
---
 net/smc/smc_pnet.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/net/smc/smc_pnet.c b/net/smc/smc_pnet.c
index 716808f374a8..cc098780970b 100644
--- a/net/smc/smc_pnet.c
+++ b/net/smc/smc_pnet.c
@@ -1079,14 +1079,15 @@ static void smc_pnet_find_roce_by_pnetid(struct net_device *ndev,
 					 struct smc_init_info *ini)
 {
 	u8 ndev_pnetid[SMC_MAX_PNETID_LEN];
+	struct net_device *base_ndev;
 	struct net *net;
 
-	ndev = pnet_find_base_ndev(ndev);
+	base_ndev = pnet_find_base_ndev(ndev);
 	net = dev_net(ndev);
-	if (smc_pnetid_by_dev_port(ndev->dev.parent, ndev->dev_port,
+	if (smc_pnetid_by_dev_port(base_ndev->dev.parent, base_ndev->dev_port,
 				   ndev_pnetid) &&
 	    smc_pnet_find_ndev_pnetid_by_table(ndev, ndev_pnetid)) {
-		smc_pnet_find_rdma_dev(ndev, ini);
+		smc_pnet_find_rdma_dev(base_ndev, ini);
 		return; /* pnetid could not be determined */
 	}
 	_smc_pnet_find_roce_by_pnetid(ndev_pnetid, ini, NULL, net);
-- 
2.24.3 (Apple Git-128)


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2025-03-04  2:39 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-27  4:04 [PATCH net] net/smc: use the correct ndev to find pnetid by pnetid table Guangguan Wang
2025-01-04 16:40 ` Jakub Kicinski
2025-01-07  2:17 ` Wen Gu
2025-01-07  8:44 ` Paolo Abeni
2025-01-07 19:32   ` Halil Pasic
2025-01-08  4:57     ` Guangguan Wang
2025-01-09  3:04       ` Halil Pasic
2025-01-10  5:43         ` Guangguan Wang
2025-01-14 12:07           ` Halil Pasic
2025-01-15 11:53             ` Guangguan Wang
2025-02-10 11:16               ` Guangguan Wang
2025-02-10 13:13                 ` Wenjia Zhang
2025-02-10 14:20                 ` Halil Pasic
2025-02-10 14:19               ` Halil Pasic
2025-02-10 13:52           ` Halil Pasic
2025-02-11  3:44             ` Guangguan Wang
2025-03-03 14:24               ` Halil Pasic
2025-03-04  2:39                 ` Guangguan Wang
2025-01-08 16:00     ` Alexandra Winter
2025-01-10  6:39       ` Guangguan Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).