mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 17:13:52 +02:00
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>
This commit is contained in:
parent
ca48841de9
commit
9b1a6b7583
|
|
@ -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 ",
|
||||
|
|
|
|||
|
|
@ -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 @@ static int smbd_post_send_iter(struct smbd_connection *info,
|
|||
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 @@ static int smbd_post_send_iter(struct smbd_connection *info,
|
|||
|
||||
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));
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user