Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [PATCH] Revert "ksmbd: fix missing RDMA-capable flag for IPoIB device in ksmbd_rdma_capable_netdev()"
@ 2025-03-18 12:38 Namjae Jeon
  2025-03-19  9:17 ` Leon Romanovsky
  0 siblings, 1 reply; 3+ messages in thread
From: Namjae Jeon @ 2025-03-18 12:38 UTC (permalink / raw)
  To: linux-cifs
  Cc: smfrench, senozhatsky, tom, atteh.mailbox, Namjae Jeon,
	Kangjing Huang, Leon Romanovsky, Steve French

This reverts commit ecce70cf17d91c3dd87a0c4ea00b2d1387729701.

Revert the GUID trick code causing the layering violation.
I will try to allow the users to turn RDMA-capable on/off via sysfs later

Cc: Kangjing Huang <huangkangjing@gmail.com>
Cc: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/smb/server/transport_rdma.c | 40 +++++++++-------------------------
 1 file changed, 10 insertions(+), 30 deletions(-)

diff --git a/fs/smb/server/transport_rdma.c b/fs/smb/server/transport_rdma.c
index 1b9f3aee8b4b..9837a41641ce 100644
--- a/fs/smb/server/transport_rdma.c
+++ b/fs/smb/server/transport_rdma.c
@@ -2142,7 +2142,8 @@ static int smb_direct_ib_client_add(struct ib_device *ib_dev)
 	if (ib_dev->node_type != RDMA_NODE_IB_CA)
 		smb_direct_port = SMB_DIRECT_PORT_IWARP;
 
-	if (!rdma_frwr_is_supported(&ib_dev->attrs))
+	if (!ib_dev->ops.get_netdev ||
+	    !rdma_frwr_is_supported(&ib_dev->attrs))
 		return 0;
 
 	smb_dev = kzalloc(sizeof(*smb_dev), KSMBD_DEFAULT_GFP);
@@ -2242,38 +2243,17 @@ bool ksmbd_rdma_capable_netdev(struct net_device *netdev)
 		for (i = 0; i < smb_dev->ib_dev->phys_port_cnt; i++) {
 			struct net_device *ndev;
 
-			if (smb_dev->ib_dev->ops.get_netdev) {
-				ndev = smb_dev->ib_dev->ops.get_netdev(
-					smb_dev->ib_dev, i + 1);
-				if (!ndev)
-					continue;
+			ndev = smb_dev->ib_dev->ops.get_netdev(smb_dev->ib_dev,
+							       i + 1);
+			if (!ndev)
+				continue;
 
-				if (ndev == netdev) {
-					dev_put(ndev);
-					rdma_capable = true;
-					goto out;
-				}
+			if (ndev == netdev) {
 				dev_put(ndev);
-			/* if ib_dev does not implement ops.get_netdev
-			 * check for matching infiniband GUID in hw_addr
-			 */
-			} else if (netdev->type == ARPHRD_INFINIBAND) {
-				struct netdev_hw_addr *ha;
-				union ib_gid gid;
-				u32 port_num;
-				int ret;
-
-				netdev_hw_addr_list_for_each(
-					ha, &netdev->dev_addrs) {
-					memcpy(&gid, ha->addr + 4, sizeof(gid));
-					ret = ib_find_gid(smb_dev->ib_dev, &gid,
-							  &port_num, NULL);
-					if (!ret) {
-						rdma_capable = true;
-						goto out;
-					}
-				}
+				rdma_capable = true;
+				goto out;
 			}
+			dev_put(ndev);
 		}
 	}
 out:
-- 
2.25.1


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

* Re: [PATCH] Revert "ksmbd: fix missing RDMA-capable flag for IPoIB device in ksmbd_rdma_capable_netdev()"
  2025-03-18 12:38 [PATCH] Revert "ksmbd: fix missing RDMA-capable flag for IPoIB device in ksmbd_rdma_capable_netdev()" Namjae Jeon
@ 2025-03-19  9:17 ` Leon Romanovsky
  2025-03-19 23:19   ` Namjae Jeon
  0 siblings, 1 reply; 3+ messages in thread
From: Leon Romanovsky @ 2025-03-19  9:17 UTC (permalink / raw)
  To: Namjae Jeon
  Cc: linux-cifs, smfrench, senozhatsky, tom, atteh.mailbox,
	Kangjing Huang, Steve French

On Tue, Mar 18, 2025 at 09:38:26PM +0900, Namjae Jeon wrote:
> This reverts commit ecce70cf17d91c3dd87a0c4ea00b2d1387729701.
> 
> Revert the GUID trick code causing the layering violation.
> I will try to allow the users to turn RDMA-capable on/off via sysfs later
> 
> Cc: Kangjing Huang <huangkangjing@gmail.com>
> Cc: Leon Romanovsky <leon@kernel.org>
> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
> Signed-off-by: Steve French <stfrench@microsoft.com>
> ---
>  fs/smb/server/transport_rdma.c | 40 +++++++++-------------------------
>  1 file changed, 10 insertions(+), 30 deletions(-)
> 
> diff --git a/fs/smb/server/transport_rdma.c b/fs/smb/server/transport_rdma.c
> index 1b9f3aee8b4b..9837a41641ce 100644
> --- a/fs/smb/server/transport_rdma.c
> +++ b/fs/smb/server/transport_rdma.c
> @@ -2142,7 +2142,8 @@ static int smb_direct_ib_client_add(struct ib_device *ib_dev)
>  	if (ib_dev->node_type != RDMA_NODE_IB_CA)
>  		smb_direct_port = SMB_DIRECT_PORT_IWARP;
>  
> -	if (!rdma_frwr_is_supported(&ib_dev->attrs))
> +	if (!ib_dev->ops.get_netdev ||
> +	    !rdma_frwr_is_supported(&ib_dev->attrs))

<...>

> +			ndev = smb_dev->ib_dev->ops.get_netdev(smb_dev->ib_dev,
> +							       i + 1);

Can you please use ib_device_get_netdev()?
ULPs are not supposed to call to ops.* directly.

Thanks

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

* Re: [PATCH] Revert "ksmbd: fix missing RDMA-capable flag for IPoIB device in ksmbd_rdma_capable_netdev()"
  2025-03-19  9:17 ` Leon Romanovsky
@ 2025-03-19 23:19   ` Namjae Jeon
  0 siblings, 0 replies; 3+ messages in thread
From: Namjae Jeon @ 2025-03-19 23:19 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: linux-cifs, smfrench, senozhatsky, tom, atteh.mailbox,
	Kangjing Huang, Steve French

On Wed, Mar 19, 2025 at 6:17 PM Leon Romanovsky <leon@kernel.org> wrote:
>
> On Tue, Mar 18, 2025 at 09:38:26PM +0900, Namjae Jeon wrote:
> > This reverts commit ecce70cf17d91c3dd87a0c4ea00b2d1387729701.
> >
> > Revert the GUID trick code causing the layering violation.
> > I will try to allow the users to turn RDMA-capable on/off via sysfs later
> >
> > Cc: Kangjing Huang <huangkangjing@gmail.com>
> > Cc: Leon Romanovsky <leon@kernel.org>
> > Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
> > Signed-off-by: Steve French <stfrench@microsoft.com>
> > ---
> >  fs/smb/server/transport_rdma.c | 40 +++++++++-------------------------
> >  1 file changed, 10 insertions(+), 30 deletions(-)
> >
> > diff --git a/fs/smb/server/transport_rdma.c b/fs/smb/server/transport_rdma.c
> > index 1b9f3aee8b4b..9837a41641ce 100644
> > --- a/fs/smb/server/transport_rdma.c
> > +++ b/fs/smb/server/transport_rdma.c
> > @@ -2142,7 +2142,8 @@ static int smb_direct_ib_client_add(struct ib_device *ib_dev)
> >       if (ib_dev->node_type != RDMA_NODE_IB_CA)
> >               smb_direct_port = SMB_DIRECT_PORT_IWARP;
> >
> > -     if (!rdma_frwr_is_supported(&ib_dev->attrs))
> > +     if (!ib_dev->ops.get_netdev ||
> > +         !rdma_frwr_is_supported(&ib_dev->attrs))
>
> <...>
>
> > +                     ndev = smb_dev->ib_dev->ops.get_netdev(smb_dev->ib_dev,
> > +                                                            i + 1);
>
> Can you please use ib_device_get_netdev()?
> ULPs are not supposed to call to ops.* directly.
Okay, I will do that in another patch.

Thanks!
>
> Thanks

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

end of thread, other threads:[~2025-03-19 23:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-18 12:38 [PATCH] Revert "ksmbd: fix missing RDMA-capable flag for IPoIB device in ksmbd_rdma_capable_netdev()" Namjae Jeon
2025-03-19  9:17 ` Leon Romanovsky
2025-03-19 23:19   ` Namjae Jeon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox