diff options
| author | Stefan Metzmacher <metze@samba.org> | 2025-09-17 09:18:08 +0200 |
|---|---|---|
| committer | Steve French <stfrench@microsoft.com> | 2026-04-15 21:58:21 -0500 |
| commit | 26003faa7d477eed4ceb5b5b49e4eb4a77bf2f6f (patch) | |
| tree | 1f557e03c9fb69b1301de83658f58d3053a88777 /fs | |
| parent | 6a67fe6212028754d3b3b57871916309a16863a6 (diff) | |
| download | lwn-26003faa7d477eed4ceb5b5b49e4eb4a77bf2f6f.tar.gz lwn-26003faa7d477eed4ceb5b5b49e4eb4a77bf2f6f.zip | |
smb: client: make use of smbdirect_connection_post_recv_io()
The only difference is that smbdirect_connection_post_recv_io()
returns early if the connection is already broken.
And that the error code from ib_dma_mapping_error() (currently only -ENOMEM
is possible) is returned instead of -EIO.
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>
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/smb/client/smbdirect.c | 46 |
1 files changed, 2 insertions, 44 deletions
diff --git a/fs/smb/client/smbdirect.c b/fs/smb/client/smbdirect.c index 6ba2c252ff1e..f8b204a9d304 100644 --- a/fs/smb/client/smbdirect.c +++ b/fs/smb/client/smbdirect.c @@ -27,10 +27,6 @@ static int smbd_post_send(struct smbdirect_socket *sc, struct smbdirect_send_batch *batch, struct smbdirect_send_io *request); -static int smbd_post_recv( - struct smbdirect_socket *sc, - struct smbdirect_recv_io *response); - static int smbd_post_send_empty(struct smbdirect_socket *sc); static void destroy_mr_list(struct smbdirect_socket *sc); @@ -424,7 +420,7 @@ static void smbd_post_send_credits(struct work_struct *work) break; response->first_segment = false; - rc = smbd_post_recv(sc, response); + rc = smbdirect_connection_post_recv_io(response); if (rc) { log_rdma_recv(ERR, "post_recv failed rc=%d\n", rc); @@ -1304,44 +1300,6 @@ static int smbd_post_send_full_iter(struct smbdirect_socket *sc, return rc; } -/* - * Post a receive request to the transport - * The remote peer can only send data when a receive request is posted - * The interaction is controlled by send/receive credit system - */ -static int smbd_post_recv( - struct smbdirect_socket *sc, struct smbdirect_recv_io *response) -{ - struct smbdirect_socket_parameters *sp = &sc->parameters; - struct ib_recv_wr recv_wr; - int rc = -EIO; - - response->sge.addr = ib_dma_map_single( - sc->ib.dev, response->packet, - sp->max_recv_size, DMA_FROM_DEVICE); - if (ib_dma_mapping_error(sc->ib.dev, response->sge.addr)) - return rc; - - response->sge.length = sp->max_recv_size; - response->sge.lkey = sc->ib.pd->local_dma_lkey; - - recv_wr.wr_cqe = &response->cqe; - recv_wr.next = NULL; - recv_wr.sg_list = &response->sge; - recv_wr.num_sge = 1; - - rc = ib_post_recv(sc->ib.qp, &recv_wr, NULL); - if (rc) { - ib_dma_unmap_single(sc->ib.dev, response->sge.addr, - response->sge.length, DMA_FROM_DEVICE); - response->sge.length = 0; - smbdirect_socket_schedule_cleanup(sc, rc); - log_rdma_recv(ERR, "ib_post_recv failed rc=%d\n", rc); - } - - return rc; -} - /* Perform SMBD negotiate according to [MS-SMBD] 3.1.5.2 */ static int smbd_negotiate(struct smbdirect_socket *sc) { @@ -1353,7 +1311,7 @@ static int smbd_negotiate(struct smbdirect_socket *sc) sc->status = SMBDIRECT_SOCKET_NEGOTIATE_RUNNING; sc->recv_io.expected = SMBDIRECT_EXPECT_NEGOTIATE_REP; - rc = smbd_post_recv(sc, response); + rc = smbdirect_connection_post_recv_io(response); log_rdma_event(INFO, "smbd_post_recv rc=%d iov.addr=0x%llx iov.length=%u iov.lkey=0x%x\n", rc, response->sge.addr, response->sge.length, response->sge.lkey); |
