ksmbd: detect RDMA capable lower devices when bridge and vlan netdev is used

If user set bridge interface as actual RDMA-capable NICs are lower devices,
ksmbd can not detect as RDMA capable. This patch can detect the RDMA
capable lower devices from bridge master or VLAN. With this change, ksmbd
can accept both TCP and RDMA connections through the same bridge IP
address, allowing mixed transport operation without requiring separate
interfaces.

Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
Namjae Jeon 2025-10-27 15:24:17 +09:00 committed by Steve French
parent 6146a0f1df
commit d24822e147

View File

@ -2606,7 +2606,7 @@ void ksmbd_rdma_destroy(void)
}
}
bool ksmbd_rdma_capable_netdev(struct net_device *netdev)
static bool ksmbd_find_rdma_capable_netdev(struct net_device *netdev)
{
struct smb_direct_device *smb_dev;
int i;
@ -2648,6 +2648,24 @@ bool ksmbd_rdma_capable_netdev(struct net_device *netdev)
return rdma_capable;
}
bool ksmbd_rdma_capable_netdev(struct net_device *netdev)
{
struct net_device *lower_dev;
struct list_head *iter;
if (ksmbd_find_rdma_capable_netdev(netdev))
return true;
/* check if netdev is bridge or VLAN */
if (netif_is_bridge_master(netdev) ||
netdev->priv_flags & IFF_802_1Q_VLAN)
netdev_for_each_lower_dev(netdev, lower_dev, iter)
if (ksmbd_find_rdma_capable_netdev(lower_dev))
return true;
return false;
}
static const struct ksmbd_transport_ops ksmbd_smb_direct_transport_ops = {
.prepare = smb_direct_prepare,
.disconnect = smb_direct_disconnect,