summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2026-01-22 20:16:54 +0300
committerSteve French <stfrench@microsoft.com>2026-02-09 02:12:58 +0300
commitbf30515caec590316e0d08208e4252eed4c160df (patch)
tree10d95f17d08cd01739231af381d996271142b136
parentbb848d205f7ac0141af52a5acb6dd116d9b71177 (diff)
downloadlinux-bf30515caec590316e0d08208e4252eed4c160df.tar.xz
smb: client: split out smbd_ib_post_send()
This is like smb_direct_post_send() in the server and will simplify porting the smbdirect_send_batch and credit related logic from the server. Cc: <stable@vger.kernel.org> # 6.18.x 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> Signed-off-by: Steve French <stfrench@microsoft.com>
-rw-r--r--fs/smb/client/smbdirect.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/fs/smb/client/smbdirect.c b/fs/smb/client/smbdirect.c
index 405931ce3978..75c0ac9cc65c 100644
--- a/fs/smb/client/smbdirect.c
+++ b/fs/smb/client/smbdirect.c
@@ -1101,11 +1101,26 @@ static int manage_keep_alive_before_sending(struct smbdirect_socket *sc)
return 0;
}
+static int smbd_ib_post_send(struct smbdirect_socket *sc,
+ struct ib_send_wr *wr)
+{
+ int ret;
+
+ atomic_inc(&sc->send_io.pending.count);
+ ret = ib_post_send(sc->ib.qp, wr, NULL);
+ if (ret) {
+ pr_err("failed to post send: %d\n", ret);
+ smbd_disconnect_rdma_connection(sc);
+ ret = -EAGAIN;
+ }
+ return ret;
+}
+
/* Post the send request */
static int smbd_post_send(struct smbdirect_socket *sc,
struct smbdirect_send_io *request)
{
- int rc, i;
+ int i;
for (i = 0; i < request->num_sge; i++) {
log_rdma_send(INFO,
@@ -1126,15 +1141,7 @@ static int smbd_post_send(struct smbdirect_socket *sc,
request->wr.num_sge = request->num_sge;
request->wr.opcode = IB_WR_SEND;
request->wr.send_flags = IB_SEND_SIGNALED;
-
- rc = ib_post_send(sc->ib.qp, &request->wr, NULL);
- if (rc) {
- log_rdma_send(ERR, "ib_post_send failed rc=%d\n", rc);
- smbd_disconnect_rdma_connection(sc);
- rc = -EAGAIN;
- }
-
- return rc;
+ return smbd_ib_post_send(sc, &request->wr);
}
static int wait_for_credits(struct smbdirect_socket *sc,
@@ -1280,12 +1287,6 @@ static int smbd_post_send_iter(struct smbdirect_socket *sc,
le32_to_cpu(packet->data_length),
le32_to_cpu(packet->remaining_data_length));
- /*
- * Now that we got a local and a remote credit
- * we add us as pending
- */
- atomic_inc(&sc->send_io.pending.count);
-
rc = smbd_post_send(sc, request);
if (!rc)
return 0;