]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
smb: smbdirect: introduce smbdirect_connection_qp_event_handler()
authorStefan Metzmacher <metze@samba.org>
Mon, 15 Sep 2025 05:50:01 +0000 (07:50 +0200)
committerSteve French <stfrench@microsoft.com>
Thu, 16 Apr 2026 02:58:19 +0000 (21:58 -0500)
This is basically a copy of smbd_qp_async_error_upcall()
in the client and smb_direct_qpair_handler() in the server.
They will be replaced by the new common function soon,
which will allow more code to be moved as well.

Cc: Steve French <smfrench@gmail.com>
Cc: Tom Talpey <tom@talpey.com>
Cc: Long Li <longli@microsoft.com>
Cc: Namjae Jeon <linkinjeon@kernel.org>
Cc: linux-cifs@vger.kernel.org
Cc: samba-technical@lists.samba.org
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/common/smbdirect/smbdirect_connection.c

index 3483fab39eb81ed67f7c9d4fe953bbff86f49178..ac3f2341320b8148788bf367c3d653930122afbc 100644 (file)
@@ -19,6 +19,31 @@ struct smbdirect_map_sges {
 static ssize_t smbdirect_map_sges_from_iter(struct iov_iter *iter, size_t len,
                                            struct smbdirect_map_sges *state);
 
+__maybe_unused /* this is temporary while this file is included in others */
+static void smbdirect_connection_qp_event_handler(struct ib_event *event, void *context)
+{
+       struct smbdirect_socket *sc = context;
+
+       smbdirect_log_rdma_event(sc, SMBDIRECT_LOG_ERR,
+               "%s on device %.*s socket %p (cm_id=%p) status %s first_error %1pe\n",
+               ib_event_msg(event->event),
+               IB_DEVICE_NAME_MAX,
+               event->device->name,
+               sc, sc->rdma.cm_id,
+               smbdirect_socket_status_string(sc->status),
+               SMBDIRECT_DEBUG_ERR_PTR(sc->first_error));
+
+       switch (event->event) {
+       case IB_EVENT_CQ_ERR:
+       case IB_EVENT_QP_FATAL:
+               smbdirect_socket_schedule_cleanup(sc, -ECONNABORTED);
+               break;
+
+       default:
+               break;
+       }
+}
+
 static void smbdirect_connection_destroy_mem_pools(struct smbdirect_socket *sc);
 
 __maybe_unused /* this is temporary while this file is included in others */