From: liqiang <liqiang64@huawei.com>
To: <wenjia@linux.ibm.com>, <jaka@linux.ibm.com>,
<alibuda@linux.alibaba.com>, <tonylu@linux.alibaba.com>,
<guwen@linux.alibaba.com>
Cc: <linux-s390@vger.kernel.org>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <luanjianhai@huawei.com>,
<zhangxuzhou4@huawei.com>, <dengguangxing@huawei.com>,
<gaochao24@huawei.com>, <liqiang64@huawei.com>
Subject: [PATCH net-next 1/1] Enter smc_tx_wait when the tx length exceeds the available space
Date: Thu, 26 Dec 2024 20:22:17 +0800 [thread overview]
Message-ID: <20241226122217.1125-2-liqiang64@huawei.com> (raw)
In-Reply-To: <20241226122217.1125-1-liqiang64@huawei.com>
The variable send_done records the number of bytes that have been
successfully sent in the context of the code. It is more reasonable
to rename it to sent_bytes here.
Another modification point is that if the ring buf is full after
sendmsg has sent part of the data, the current code will return
directly without entering smc_tx_wait, so the judgment of send_done
in front of smc_tx_wait is removed.
Signed-off-by: liqiang <liqiang64@huawei.com>
---
net/smc/smc_tx.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/net/smc/smc_tx.c b/net/smc/smc_tx.c
index 214ac3cbcf9a..6ecabc10793c 100644
--- a/net/smc/smc_tx.c
+++ b/net/smc/smc_tx.c
@@ -180,7 +180,7 @@ static bool smc_tx_should_cork(struct smc_sock *smc, struct msghdr *msg)
*/
int smc_tx_sendmsg(struct smc_sock *smc, struct msghdr *msg, size_t len)
{
- size_t copylen, send_done = 0, send_remaining = len;
+ size_t copylen, sent_bytes = 0, send_remaining = len;
size_t chunk_len, chunk_off, chunk_len_sum;
struct smc_connection *conn = &smc->conn;
union smc_host_cursor prep;
@@ -216,14 +216,12 @@ int smc_tx_sendmsg(struct smc_sock *smc, struct msghdr *msg, size_t len)
conn->killed)
return -EPIPE;
if (smc_cdc_rxed_any_close(conn))
- return send_done ?: -ECONNRESET;
+ return sent_bytes ?: -ECONNRESET;
if (msg->msg_flags & MSG_OOB)
conn->local_tx_ctrl.prod_flags.urg_data_pending = 1;
if (!atomic_read(&conn->sndbuf_space) || conn->urg_tx_pend) {
- if (send_done)
- return send_done;
rc = smc_tx_wait(smc, msg->msg_flags);
if (rc)
goto out_err;
@@ -250,11 +248,11 @@ int smc_tx_sendmsg(struct smc_sock *smc, struct msghdr *msg, size_t len)
msg, chunk_len);
if (rc) {
smc_sndbuf_sync_sg_for_device(conn);
- if (send_done)
- return send_done;
+ if (sent_bytes)
+ return sent_bytes;
goto out_err;
}
- send_done += chunk_len;
+ sent_bytes += chunk_len;
send_remaining -= chunk_len;
if (chunk_len_sum == copylen)
@@ -287,7 +285,7 @@ int smc_tx_sendmsg(struct smc_sock *smc, struct msghdr *msg, size_t len)
trace_smc_tx_sendmsg(smc, copylen);
} /* while (msg_data_left(msg)) */
- return send_done;
+ return sent_bytes;
out_err:
rc = sk_stream_error(sk, msg->msg_flags, rc);
--
2.43.0
next prev parent reply other threads:[~2024-12-26 12:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-26 12:22 [PATCH net-next 0/1] net/smc: An issue of smc sending messages liqiang
2024-12-26 12:22 ` liqiang [this message]
2024-12-26 13:20 ` [PATCH net-next 1/1] Enter smc_tx_wait when the tx length exceeds the available space Wen Gu
2024-12-27 7:53 ` Li Qiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241226122217.1125-2-liqiang64@huawei.com \
--to=liqiang64@huawei.com \
--cc=alibuda@linux.alibaba.com \
--cc=dengguangxing@huawei.com \
--cc=gaochao24@huawei.com \
--cc=guwen@linux.alibaba.com \
--cc=jaka@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=luanjianhai@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=tonylu@linux.alibaba.com \
--cc=wenjia@linux.ibm.com \
--cc=zhangxuzhou4@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox