diff options
| author | Stefan Metzmacher <metze@samba.org> | 2025-08-11 17:11:08 +0200 |
|---|---|---|
| committer | Steve French <stfrench@microsoft.com> | 2025-09-28 18:29:49 -0500 |
| commit | 9b1a6b7583cb71e101a93e518e2cbc32911a2b89 (patch) | |
| tree | 928aec5d2827dccc8b666f28957a3b151abbb1e9 | |
| parent | smb: client: make use of smbdirect_socket.send_io.pending.{count,{dec,zero}_w... (diff) | |
| download | linux-9b1a6b7583cb71e101a93e518e2cbc32911a2b89.tar.gz linux-9b1a6b7583cb71e101a93e518e2cbc32911a2b89.zip | |
smb: client: make use of smbdirect_socket.send_io.credits.{count,wait_queue}
This will be used by the server too and will allow to create
common helper functions.
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>
| -rw-r--r-- | fs/smb/client/cifs_debug.c | 2 | ||||
| -rw-r--r-- | fs/smb/client/smbdirect.c | 19 | ||||
| -rw-r--r-- | fs/smb/client/smbdirect.h | 3 |
3 files changed, 10 insertions, 14 deletions
diff --git a/fs/smb/client/cifs_debug.c b/fs/smb/client/cifs_debug.c index d48438e6efdb..01a582e172cb 100644 --- a/fs/smb/client/cifs_debug.c +++ b/fs/smb/client/cifs_debug.c @@ -493,7 +493,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v) sc->recv_io.reassembly.queue_length); seq_printf(m, "\nCurrent Credits send_credits: %u " "receive_credits: %u receive_credit_target: %u", - atomic_read(&server->smbd_conn->send_credits), + atomic_read(&sc->send_io.credits.count), atomic_read(&server->smbd_conn->receive_credits), server->smbd_conn->receive_credit_target); seq_printf(m, "\nPending send_pending: %u ", diff --git a/fs/smb/client/smbdirect.c b/fs/smb/client/smbdirect.c index 947fd301c70b..a4508f8b7499 100644 --- a/fs/smb/client/smbdirect.c +++ b/fs/smb/client/smbdirect.c @@ -349,7 +349,7 @@ static int smbd_conn_upcall( sc->status = SMBDIRECT_SOCKET_DISCONNECTED; wake_up_all(&sc->status_wait); wake_up_all(&sc->recv_io.reassembly.wait_queue); - wake_up_all(&info->wait_send_queue); + wake_up_all(&sc->send_io.credits.wait_queue); break; default: @@ -473,7 +473,7 @@ static bool process_negotiation_response( log_rdma_event(ERR, "error: credits_granted==0\n"); return false; } - atomic_set(&info->send_credits, le16_to_cpu(packet->credits_granted)); + atomic_set(&sc->send_io.credits.count, le16_to_cpu(packet->credits_granted)); atomic_set(&info->receive_credits, 0); @@ -651,12 +651,12 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc) le16_to_cpu(data_transfer->credits_requested); if (le16_to_cpu(data_transfer->credits_granted)) { atomic_add(le16_to_cpu(data_transfer->credits_granted), - &info->send_credits); + &sc->send_io.credits.count); /* * We have new send credits granted from remote peer * If any sender is waiting for credits, unblock it */ - wake_up(&info->wait_send_queue); + wake_up(&sc->send_io.credits.wait_queue); } log_incoming(INFO, "data flags %d data_offset %d data_length %d remaining_data_length %d\n", @@ -1021,8 +1021,8 @@ static int smbd_post_send_iter(struct smbd_connection *info, wait_credit: /* Wait for send credits. A SMBD packet needs one credit */ - rc = wait_event_interruptible(info->wait_send_queue, - atomic_read(&info->send_credits) > 0 || + rc = wait_event_interruptible(sc->send_io.credits.wait_queue, + atomic_read(&sc->send_io.credits.count) > 0 || sc->status != SMBDIRECT_SOCKET_CONNECTED); if (rc) goto err_wait_credit; @@ -1032,8 +1032,8 @@ wait_credit: rc = -EAGAIN; goto err_wait_credit; } - if (unlikely(atomic_dec_return(&info->send_credits) < 0)) { - atomic_inc(&info->send_credits); + if (unlikely(atomic_dec_return(&sc->send_io.credits.count) < 0)) { + atomic_inc(&sc->send_io.credits.count); goto wait_credit; } @@ -1162,7 +1162,7 @@ err_alloc: err_wait_send_queue: /* roll back send credits and pending */ - atomic_inc(&info->send_credits); + atomic_inc(&sc->send_io.credits.count); err_wait_credit: return rc; @@ -1843,7 +1843,6 @@ static struct smbd_connection *_smbd_get_connection( goto allocate_cache_failed; } - init_waitqueue_head(&info->wait_send_queue); INIT_DELAYED_WORK(&info->idle_timer_work, idle_connection_timer); queue_delayed_work(info->workqueue, &info->idle_timer_work, msecs_to_jiffies(sp->keepalive_interval_msec)); diff --git a/fs/smb/client/smbdirect.h b/fs/smb/client/smbdirect.h index 2ce6b7ab898a..7075bdc92193 100644 --- a/fs/smb/client/smbdirect.h +++ b/fs/smb/client/smbdirect.h @@ -53,7 +53,6 @@ struct smbd_connection { /* dynamic connection parameters defined in [MS-SMBD] 3.1.1.1 */ enum keep_alive_status keep_alive_requested; int protocol; - atomic_t send_credits; atomic_t receive_credits; int receive_credit_target; @@ -88,8 +87,6 @@ struct smbd_connection { bool send_immediate; - wait_queue_head_t wait_send_queue; - struct workqueue_struct *workqueue; struct delayed_work idle_timer_work; |
