mirror of
https://github.com/torvalds/linux.git
synced 2026-05-26 08:02:27 +02:00
smb: smbdirect: split out smbdirect_connection_recv_io_refill()
This will allow us to refill the recv queue in a sync way after negotiation. 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>
This commit is contained in:
parent
2b41feecdf
commit
a515979524
|
|
@ -694,16 +694,13 @@ static int smbdirect_connection_post_recv_io(struct smbdirect_recv_io *msg)
|
|||
return ret;
|
||||
}
|
||||
|
||||
__maybe_unused /* this is temporary while this file is included in others */
|
||||
static void smbdirect_connection_recv_io_refill_work(struct work_struct *work)
|
||||
static int smbdirect_connection_recv_io_refill(struct smbdirect_socket *sc)
|
||||
{
|
||||
struct smbdirect_socket *sc =
|
||||
container_of(work, struct smbdirect_socket, recv_io.posted.refill_work);
|
||||
int missing;
|
||||
int posted = 0;
|
||||
|
||||
if (unlikely(sc->first_error))
|
||||
return;
|
||||
return sc->first_error;
|
||||
|
||||
/*
|
||||
* Find out how much smbdirect_recv_io buffers we should post.
|
||||
|
|
@ -749,7 +746,7 @@ static void smbdirect_connection_recv_io_refill_work(struct work_struct *work)
|
|||
"smbdirect_connection_post_recv_io failed rc=%d (%1pe)\n",
|
||||
ret, SMBDIRECT_DEBUG_ERR_PTR(ret));
|
||||
smbdirect_connection_put_recv_io(recv_io);
|
||||
return;
|
||||
return ret;
|
||||
}
|
||||
|
||||
atomic_inc(&sc->recv_io.posted.count);
|
||||
|
|
@ -758,7 +755,7 @@ static void smbdirect_connection_recv_io_refill_work(struct work_struct *work)
|
|||
|
||||
/* If nothing was posted we're done */
|
||||
if (posted == 0)
|
||||
return;
|
||||
return 0;
|
||||
|
||||
atomic_add(posted, &sc->recv_io.credits.available);
|
||||
|
||||
|
|
@ -781,11 +778,28 @@ static void smbdirect_connection_recv_io_refill_work(struct work_struct *work)
|
|||
* grant the credit anyway.
|
||||
*/
|
||||
if (missing == 1 && sc->recv_io.credits.target != 1)
|
||||
return;
|
||||
return 0;
|
||||
|
||||
smbdirect_log_keep_alive(sc, SMBDIRECT_LOG_INFO,
|
||||
"schedule send of an empty message\n");
|
||||
queue_work(sc->workqueue, &sc->idle.immediate_work);
|
||||
return posted;
|
||||
}
|
||||
|
||||
__maybe_unused /* this is temporary while this file is included in others */
|
||||
static void smbdirect_connection_recv_io_refill_work(struct work_struct *work)
|
||||
{
|
||||
struct smbdirect_socket *sc =
|
||||
container_of(work, struct smbdirect_socket, recv_io.posted.refill_work);
|
||||
int posted;
|
||||
|
||||
posted = smbdirect_connection_recv_io_refill(sc);
|
||||
if (unlikely(posted < 0)) {
|
||||
smbdirect_socket_schedule_cleanup(sc, posted);
|
||||
return;
|
||||
}
|
||||
if (posted > 0) {
|
||||
smbdirect_log_keep_alive(sc, SMBDIRECT_LOG_INFO,
|
||||
"schedule send of an empty message\n");
|
||||
queue_work(sc->workqueue, &sc->idle.immediate_work);
|
||||
}
|
||||
}
|
||||
|
||||
static bool smbdirect_map_sges_single_page(struct smbdirect_map_sges *state,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user