Skip to content

Commit bf30515

Browse files
metze-sambasmfrench
authored andcommitted
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>
1 parent bb848d2 commit bf30515

1 file changed

Lines changed: 17 additions & 16 deletions

File tree

fs/smb/client/smbdirect.c

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,11 +1101,26 @@ static int manage_keep_alive_before_sending(struct smbdirect_socket *sc)
11011101
return 0;
11021102
}
11031103

1104+
static int smbd_ib_post_send(struct smbdirect_socket *sc,
1105+
struct ib_send_wr *wr)
1106+
{
1107+
int ret;
1108+
1109+
atomic_inc(&sc->send_io.pending.count);
1110+
ret = ib_post_send(sc->ib.qp, wr, NULL);
1111+
if (ret) {
1112+
pr_err("failed to post send: %d\n", ret);
1113+
smbd_disconnect_rdma_connection(sc);
1114+
ret = -EAGAIN;
1115+
}
1116+
return ret;
1117+
}
1118+
11041119
/* Post the send request */
11051120
static int smbd_post_send(struct smbdirect_socket *sc,
11061121
struct smbdirect_send_io *request)
11071122
{
1108-
int rc, i;
1123+
int i;
11091124

11101125
for (i = 0; i < request->num_sge; i++) {
11111126
log_rdma_send(INFO,
@@ -1126,15 +1141,7 @@ static int smbd_post_send(struct smbdirect_socket *sc,
11261141
request->wr.num_sge = request->num_sge;
11271142
request->wr.opcode = IB_WR_SEND;
11281143
request->wr.send_flags = IB_SEND_SIGNALED;
1129-
1130-
rc = ib_post_send(sc->ib.qp, &request->wr, NULL);
1131-
if (rc) {
1132-
log_rdma_send(ERR, "ib_post_send failed rc=%d\n", rc);
1133-
smbd_disconnect_rdma_connection(sc);
1134-
rc = -EAGAIN;
1135-
}
1136-
1137-
return rc;
1144+
return smbd_ib_post_send(sc, &request->wr);
11381145
}
11391146

11401147
static int wait_for_credits(struct smbdirect_socket *sc,
@@ -1280,12 +1287,6 @@ static int smbd_post_send_iter(struct smbdirect_socket *sc,
12801287
le32_to_cpu(packet->data_length),
12811288
le32_to_cpu(packet->remaining_data_length));
12821289

1283-
/*
1284-
* Now that we got a local and a remote credit
1285-
* we add us as pending
1286-
*/
1287-
atomic_inc(&sc->send_io.pending.count);
1288-
12891290
rc = smbd_post_send(sc, request);
12901291
if (!rc)
12911292
return 0;

0 commit comments

Comments
 (0)