From: Stefan Metzmacher Date: Thu, 28 Aug 2025 14:45:23 +0000 (+0200) Subject: smb: smbdirect: introduce smbdirect_frwr_is_supported() X-Git-Tag: v7.1-rc1~128^2~129 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=66a840b3ba538142fec5895cb197b1ec9f3a717c;p=thirdparty%2Fkernel%2Flinux.git smb: smbdirect: introduce smbdirect_frwr_is_supported() This will replace frwr_is_supported() on the client and rdma_frwr_is_supported() on the server. Cc: Steve French Cc: Tom Talpey Cc: Long Li Cc: Namjae Jeon Cc: linux-cifs@vger.kernel.org Cc: samba-technical@lists.samba.org Signed-off-by: Stefan Metzmacher Acked-by: Namjae Jeon Signed-off-by: Steve French --- diff --git a/fs/smb/common/smbdirect/smbdirect_socket.c b/fs/smb/common/smbdirect/smbdirect_socket.c index b5ce5f6443f60..05a284526aa21 100644 --- a/fs/smb/common/smbdirect/smbdirect_socket.c +++ b/fs/smb/common/smbdirect/smbdirect_socket.c @@ -6,6 +6,22 @@ #include "smbdirect_internal.h" +__maybe_unused /* this is temporary while this file is included in others */ +static bool smbdirect_frwr_is_supported(const struct ib_device_attr *attrs) +{ + /* + * Test if FRWR (Fast Registration Work Requests) is supported on the + * device This implementation requires FRWR on RDMA read/write return + * value: true if it is supported + */ + + if (!(attrs->device_cap_flags & IB_DEVICE_MEM_MGT_EXTENSIONS)) + return false; + if (attrs->max_fast_reg_page_list_len == 0) + return false; + return true; +} + static void smbdirect_socket_cleanup_work(struct work_struct *work); __maybe_unused /* this is temporary while this file is included in others */