lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240809145917.GB103152@linux.alibaba.com>
Date: Fri, 9 Aug 2024 22:59:17 +0800
From: Dust Li <dust.li@...ux.alibaba.com>
To: Liu Jian <liujian56@...wei.com>, linux-rdma@...r.kernel.org,
	linux-s390@...r.kernel.org, netdev@...r.kernel.org
Cc: jgg@...pe.ca, leon@...nel.org, zyjzyj2000@...il.com,
	wenjia@...ux.ibm.com, jaka@...ux.ibm.com, alibuda@...ux.alibaba.com,
	tonylu@...ux.alibaba.com, guwen@...ux.alibaba.com,
	davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
	pabeni@...hat.com
Subject: Re: [PATCH net-next 2/4] net/smc: use ib_device_get_netdev() helper
 to get netdev info

On 2024-08-09 16:31:46, Liu Jian wrote:
>Currently, in the SMC protocol, network devices are obtained by calling
>ib_device_ops.get_netdev(). But for some drivers, this callback function
>is not implemented separately. Therefore, here I modified to use
>ib_device_get_netdev() to get net_device.
>
>For rdma devices that do not implement ib_device_ops.get_netdev(), one of
>the issues addressed is as follows:
>before:
>smcr device
>Net-Dev         IB-Dev   IB-P  IB-State  Type        Crit  #Links  PNET-ID
>                rxee        1    ACTIVE  0               No       0
>
>after:
>smcr device
>Net-Dev         IB-Dev   IB-P  IB-State  Type        Crit  #Links  PNET-ID
>enp1s0f1        rxee        1    ACTIVE  0               No       0
>
>Signed-off-by: Liu Jian <liujian56@...wei.com>
>---
> net/smc/smc_ib.c   | 8 +++-----
> net/smc/smc_pnet.c | 6 +-----
> 2 files changed, 4 insertions(+), 10 deletions(-)
>
>diff --git a/net/smc/smc_ib.c b/net/smc/smc_ib.c
>index 9297dc20bfe2..382351ac9434 100644
>--- a/net/smc/smc_ib.c
>+++ b/net/smc/smc_ib.c
>@@ -899,9 +899,7 @@ static void smc_copy_netdev_ifindex(struct smc_ib_device *smcibdev, int port)
> 	struct ib_device *ibdev = smcibdev->ibdev;
> 	struct net_device *ndev;
> 
>-	if (!ibdev->ops.get_netdev)
>-		return;
>-	ndev = ibdev->ops.get_netdev(ibdev, port + 1);
>+	ndev = ib_device_get_netdev(ibdev, port + 1);
> 	if (ndev) {
> 		smcibdev->ndev_ifidx[port] = ndev->ifindex;
> 		dev_put(ndev);
>@@ -921,9 +919,9 @@ void smc_ib_ndev_change(struct net_device *ndev, unsigned long event)
> 		port_cnt = smcibdev->ibdev->phys_port_cnt;
> 		for (i = 0; i < min_t(size_t, port_cnt, SMC_MAX_PORTS); i++) {
> 			libdev = smcibdev->ibdev;
>-			if (!libdev->ops.get_netdev)
>+			lndev = ib_device_get_netdev(libdev, i + 1);
>+			if (!lndev)
> 				continue;
>-			lndev = libdev->ops.get_netdev(libdev, i + 1);
> 			dev_put(lndev);
> 			if (lndev != ndev)
> 				continue;
>diff --git a/net/smc/smc_pnet.c b/net/smc/smc_pnet.c
>index 2adb92b8c469..a55a697a48de 100644
>--- a/net/smc/smc_pnet.c
>+++ b/net/smc/smc_pnet.c
>@@ -1055,11 +1055,7 @@ static void smc_pnet_find_rdma_dev(struct net_device *netdev,
> 			continue;
> 
> 		for (i = 1; i <= SMC_MAX_PORTS; i++) {
>-			if (!rdma_is_port_valid(ibdev->ibdev, i))
>-				continue;

Why remove this check ?

Best regard,
Dust


>-			if (!ibdev->ibdev->ops.get_netdev)
>-				continue;
>-			ndev = ibdev->ibdev->ops.get_netdev(ibdev->ibdev, i);
>+			ndev = ib_device_get_netdev(ibdev->ibdev, i);
> 			if (!ndev)
> 				continue;
> 			dev_put(ndev);
>-- 
>2.34.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ