mirror of
https://github.com/torvalds/linux.git
synced 2026-06-04 12:35:52 +02:00
smb: client: pass struct smbdirect_socket to smbd_disconnect_rdma_connection()
This will make it easier to move function to the common code in future. Cc: Steve French <smfrench@gmail.com> Cc: Tom Talpey <tom@talpey.com> Cc: Long Li <longli@microsoft.com> Cc: linux-cifs@vger.kernel.org Cc: samba-technical@lists.samba.org Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
a8a45d4c95
commit
c7e4d5facb
|
|
@ -215,10 +215,8 @@ static void smbd_disconnect_rdma_work(struct work_struct *work)
|
|||
}
|
||||
}
|
||||
|
||||
static void smbd_disconnect_rdma_connection(struct smbd_connection *info)
|
||||
static void smbd_disconnect_rdma_connection(struct smbdirect_socket *sc)
|
||||
{
|
||||
struct smbdirect_socket *sc = &info->socket;
|
||||
|
||||
queue_work(sc->workqueue, &sc->disconnect_work);
|
||||
}
|
||||
|
||||
|
|
@ -390,6 +388,7 @@ static void
|
|||
smbd_qp_async_error_upcall(struct ib_event *event, void *context)
|
||||
{
|
||||
struct smbd_connection *info = context;
|
||||
struct smbdirect_socket *sc = &info->socket;
|
||||
|
||||
log_rdma_event(ERR, "%s on device %s info %p\n",
|
||||
ib_event_msg(event->event), event->device->name, info);
|
||||
|
|
@ -397,7 +396,7 @@ smbd_qp_async_error_upcall(struct ib_event *event, void *context)
|
|||
switch (event->event) {
|
||||
case IB_EVENT_CQ_ERR:
|
||||
case IB_EVENT_QP_FATAL:
|
||||
smbd_disconnect_rdma_connection(info);
|
||||
smbd_disconnect_rdma_connection(sc);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -422,8 +421,6 @@ static void send_done(struct ib_cq *cq, struct ib_wc *wc)
|
|||
struct smbdirect_send_io *request =
|
||||
container_of(wc->wr_cqe, struct smbdirect_send_io, cqe);
|
||||
struct smbdirect_socket *sc = request->socket;
|
||||
struct smbd_connection *info =
|
||||
container_of(sc, struct smbd_connection, socket);
|
||||
|
||||
log_rdma_send(INFO, "smbdirect_send_io 0x%p completed wc->status=%s\n",
|
||||
request, ib_wc_status_msg(wc->status));
|
||||
|
|
@ -439,7 +436,7 @@ static void send_done(struct ib_cq *cq, struct ib_wc *wc)
|
|||
log_rdma_send(ERR, "wc->status=%s wc->opcode=%d\n",
|
||||
ib_wc_status_msg(wc->status), wc->opcode);
|
||||
mempool_free(request, sc->send_io.mem.pool);
|
||||
smbd_disconnect_rdma_connection(info);
|
||||
smbd_disconnect_rdma_connection(sc);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -581,8 +578,6 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
|
|||
container_of(wc->wr_cqe, struct smbdirect_recv_io, cqe);
|
||||
struct smbdirect_socket *sc = response->socket;
|
||||
struct smbdirect_socket_parameters *sp = &sc->parameters;
|
||||
struct smbd_connection *info =
|
||||
container_of(sc, struct smbd_connection, socket);
|
||||
u16 old_recv_credit_target;
|
||||
u32 data_offset = 0;
|
||||
u32 data_length = 0;
|
||||
|
|
@ -724,7 +719,7 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
|
|||
WARN_ON_ONCE(sc->recv_io.expected != SMBDIRECT_EXPECT_DATA_TRANSFER);
|
||||
error:
|
||||
put_receive_buffer(sc, response);
|
||||
smbd_disconnect_rdma_connection(info);
|
||||
smbd_disconnect_rdma_connection(sc);
|
||||
}
|
||||
|
||||
static struct rdma_cm_id *smbd_create_id(
|
||||
|
|
@ -949,7 +944,7 @@ static int smbd_post_send_negotiate_req(struct smbd_connection *info)
|
|||
ib_dma_unmap_single(sc->ib.dev, request->sge[0].addr,
|
||||
request->sge[0].length, DMA_TO_DEVICE);
|
||||
|
||||
smbd_disconnect_rdma_connection(info);
|
||||
smbd_disconnect_rdma_connection(sc);
|
||||
|
||||
dma_mapping_failed:
|
||||
mempool_free(request, sc->send_io.mem.pool);
|
||||
|
|
@ -1041,7 +1036,7 @@ static int smbd_post_send(struct smbd_connection *info,
|
|||
rc = ib_post_send(sc->ib.qp, &send_wr, NULL);
|
||||
if (rc) {
|
||||
log_rdma_send(ERR, "ib_post_send failed rc=%d\n", rc);
|
||||
smbd_disconnect_rdma_connection(info);
|
||||
smbd_disconnect_rdma_connection(sc);
|
||||
rc = -EAGAIN;
|
||||
}
|
||||
|
||||
|
|
@ -1274,7 +1269,7 @@ static int smbd_post_recv(
|
|||
ib_dma_unmap_single(sc->ib.dev, response->sge.addr,
|
||||
response->sge.length, DMA_FROM_DEVICE);
|
||||
response->sge.length = 0;
|
||||
smbd_disconnect_rdma_connection(info);
|
||||
smbd_disconnect_rdma_connection(sc);
|
||||
log_rdma_recv(ERR, "ib_post_recv failed rc=%d\n", rc);
|
||||
}
|
||||
|
||||
|
|
@ -1481,14 +1476,12 @@ static void idle_connection_timer(struct work_struct *work)
|
|||
struct smbdirect_socket *sc =
|
||||
container_of(work, struct smbdirect_socket, idle.timer_work.work);
|
||||
struct smbdirect_socket_parameters *sp = &sc->parameters;
|
||||
struct smbd_connection *info =
|
||||
container_of(sc, struct smbd_connection, socket);
|
||||
|
||||
if (sc->idle.keepalive != SMBDIRECT_KEEPALIVE_NONE) {
|
||||
log_keep_alive(ERR,
|
||||
"error status sc->idle.keepalive=%d\n",
|
||||
sc->idle.keepalive);
|
||||
smbd_disconnect_rdma_connection(info);
|
||||
smbd_disconnect_rdma_connection(sc);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -2220,12 +2213,10 @@ static void register_mr_done(struct ib_cq *cq, struct ib_wc *wc)
|
|||
struct smbdirect_mr_io *mr =
|
||||
container_of(wc->wr_cqe, struct smbdirect_mr_io, cqe);
|
||||
struct smbdirect_socket *sc = mr->socket;
|
||||
struct smbd_connection *info =
|
||||
container_of(sc, struct smbd_connection, socket);
|
||||
|
||||
if (wc->status) {
|
||||
log_rdma_mr(ERR, "status=%d\n", wc->status);
|
||||
smbd_disconnect_rdma_connection(info);
|
||||
smbd_disconnect_rdma_connection(sc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2243,8 +2234,6 @@ static void smbd_mr_recovery_work(struct work_struct *work)
|
|||
struct smbdirect_socket *sc =
|
||||
container_of(work, struct smbdirect_socket, mr_io.recovery_work);
|
||||
struct smbdirect_socket_parameters *sp = &sc->parameters;
|
||||
struct smbd_connection *info =
|
||||
container_of(sc, struct smbd_connection, socket);
|
||||
struct smbdirect_mr_io *smbdirect_mr;
|
||||
int rc;
|
||||
|
||||
|
|
@ -2257,7 +2246,7 @@ static void smbd_mr_recovery_work(struct work_struct *work)
|
|||
log_rdma_mr(ERR,
|
||||
"ib_dereg_mr failed rc=%x\n",
|
||||
rc);
|
||||
smbd_disconnect_rdma_connection(info);
|
||||
smbd_disconnect_rdma_connection(sc);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -2268,7 +2257,7 @@ static void smbd_mr_recovery_work(struct work_struct *work)
|
|||
log_rdma_mr(ERR, "ib_alloc_mr failed mr_type=%x max_frmr_depth=%x\n",
|
||||
sc->mr_io.type,
|
||||
sp->max_frmr_depth);
|
||||
smbd_disconnect_rdma_connection(info);
|
||||
smbd_disconnect_rdma_connection(sc);
|
||||
continue;
|
||||
}
|
||||
} else
|
||||
|
|
@ -2524,7 +2513,7 @@ struct smbdirect_mr_io *smbd_register_mr(struct smbd_connection *info,
|
|||
if (atomic_dec_and_test(&sc->mr_io.used.count))
|
||||
wake_up(&sc->mr_io.cleanup.wait_queue);
|
||||
|
||||
smbd_disconnect_rdma_connection(info);
|
||||
smbd_disconnect_rdma_connection(sc);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -2554,8 +2543,6 @@ int smbd_deregister_mr(struct smbdirect_mr_io *smbdirect_mr)
|
|||
{
|
||||
struct ib_send_wr *wr;
|
||||
struct smbdirect_socket *sc = smbdirect_mr->socket;
|
||||
struct smbd_connection *info =
|
||||
container_of(sc, struct smbd_connection, socket);
|
||||
int rc = 0;
|
||||
|
||||
if (smbdirect_mr->need_invalidate) {
|
||||
|
|
@ -2572,7 +2559,7 @@ int smbd_deregister_mr(struct smbdirect_mr_io *smbdirect_mr)
|
|||
rc = ib_post_send(sc->ib.qp, wr, NULL);
|
||||
if (rc) {
|
||||
log_rdma_mr(ERR, "ib_post_send failed rc=%x\n", rc);
|
||||
smbd_disconnect_rdma_connection(info);
|
||||
smbd_disconnect_rdma_connection(sc);
|
||||
goto done;
|
||||
}
|
||||
wait_for_completion(&smbdirect_mr->invalidate_done);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user