From 6a67fe6212028754d3b3b57871916309a16863a6 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 17 Sep 2025 08:54:03 +0200 Subject: [PATCH] smb: client: initialize recv_io->cqe.done = recv_done just once smbdirect_recv_io structures are pre-allocated so we can set the callback function just once. This will make it easy to move smbd_post_recv() to common code soon. 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 --- fs/smb/client/smbdirect.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/smb/client/smbdirect.c b/fs/smb/client/smbdirect.c index 6f60bed49d70..6ba2c252ff1e 100644 --- a/fs/smb/client/smbdirect.c +++ b/fs/smb/client/smbdirect.c @@ -1325,8 +1325,6 @@ static int smbd_post_recv( response->sge.length = sp->max_recv_size; response->sge.lkey = sc->ib.pd->local_dma_lkey; - response->cqe.done = recv_done; - recv_wr.wr_cqe = &response->cqe; recv_wr.next = NULL; recv_wr.sg_list = &response->sge; @@ -1534,6 +1532,7 @@ static struct smbd_connection *_smbd_get_connection( __be32 ird_ord_hdr[2]; char wq_name[80]; struct workqueue_struct *workqueue; + struct smbdirect_recv_io *recv_io; /* * Create the initial parameters @@ -1638,6 +1637,9 @@ static struct smbd_connection *_smbd_get_connection( goto allocate_cache_failed; } + list_for_each_entry(recv_io, &sc->recv_io.free.list, list) + recv_io->cqe.done = recv_done; + INIT_WORK(&sc->idle.immediate_work, send_immediate_empty_message); /* * start with the negotiate timeout and SMBDIRECT_KEEPALIVE_PENDING