Skip to content

Commit 5b1c614

Browse files
metze-sambasmfrench
authored andcommitted
smb: client: let smbd_post_send_negotiate_req() use smbd_post_send()
The server has similar logic and it makes sure that request->wr is used instead of a stack struct ib_send_wr send_wr. This makes sure send_done can see request->wr.send_flags as the next commit will check for IB_SEND_SIGNALED 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 93ac432 commit 5b1c614

1 file changed

Lines changed: 7 additions & 25 deletions

File tree

fs/smb/client/smbdirect.c

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ static void enqueue_reassembly(
3535
static struct smbdirect_recv_io *_get_first_reassembly(
3636
struct smbdirect_socket *sc);
3737

38+
static int smbd_post_send(struct smbdirect_socket *sc,
39+
struct smbdirect_send_batch *batch,
40+
struct smbdirect_send_io *request);
41+
3842
static int smbd_post_recv(
3943
struct smbdirect_socket *sc,
4044
struct smbdirect_recv_io *response);
@@ -1021,7 +1025,6 @@ static int smbd_ia_open(
10211025
static int smbd_post_send_negotiate_req(struct smbdirect_socket *sc)
10221026
{
10231027
struct smbdirect_socket_parameters *sp = &sc->parameters;
1024-
struct ib_send_wr send_wr;
10251028
int rc;
10261029
struct smbdirect_send_io *request;
10271030
struct smbdirect_negotiate_req *packet;
@@ -1052,33 +1055,12 @@ static int smbd_post_send_negotiate_req(struct smbdirect_socket *sc)
10521055
request->sge[0].length = sizeof(*packet);
10531056
request->sge[0].lkey = sc->ib.pd->local_dma_lkey;
10541057

1055-
ib_dma_sync_single_for_device(
1056-
sc->ib.dev, request->sge[0].addr,
1057-
request->sge[0].length, DMA_TO_DEVICE);
1058-
1059-
request->cqe.done = send_done;
1060-
1061-
send_wr.next = NULL;
1062-
send_wr.wr_cqe = &request->cqe;
1063-
send_wr.sg_list = request->sge;
1064-
send_wr.num_sge = request->num_sge;
1065-
send_wr.opcode = IB_WR_SEND;
1066-
send_wr.send_flags = IB_SEND_SIGNALED;
1067-
1068-
log_rdma_send(INFO, "sge addr=0x%llx length=%u lkey=0x%x\n",
1069-
request->sge[0].addr,
1070-
request->sge[0].length, request->sge[0].lkey);
1071-
1072-
atomic_inc(&sc->send_io.pending.count);
1073-
rc = ib_post_send(sc->ib.qp, &send_wr, NULL);
1058+
rc = smbd_post_send(sc, NULL, request);
10741059
if (!rc)
10751060
return 0;
10761061

1077-
/* if we reach here, post send failed */
1078-
log_rdma_send(ERR, "ib_post_send failed rc=%d\n", rc);
1079-
atomic_dec(&sc->send_io.pending.count);
1080-
1081-
smbd_disconnect_rdma_connection(sc);
1062+
if (rc == -EAGAIN)
1063+
rc = -EIO;
10821064

10831065
dma_mapping_failed:
10841066
smbd_free_send_io(request);

0 commit comments

Comments
 (0)