* [PATCH net-next] net/tls: Do not call msg_data_left() twice
@ 2018-07-24 11:11 Vakul Garg
2018-07-25 1:49 ` Al Viro
0 siblings, 1 reply; 3+ messages in thread
From: Vakul Garg @ 2018-07-24 11:11 UTC (permalink / raw)
To: netdev; +Cc: borisp, aviadye, davejwatson, davem, Vakul Garg
In function tls_sw_sendmsg(), msg_data_left() needs to be called only
once. The second invocation of msg_data_left() for assigning variable
try_to_copy can be removed and merged with the first one.
Signed-off-by: Vakul Garg <vakul.garg@nxp.com>
---
net/tls/tls_sw.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index 0c2d029c9d4c..fd51ce65b99c 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -377,7 +377,7 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
goto send_end;
}
- while (msg_data_left(msg)) {
+ while ((try_to_copy = msg_data_left(msg))) {
if (sk->sk_err) {
ret = -sk->sk_err;
goto send_end;
@@ -385,7 +385,6 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
orig_size = ctx->sg_plaintext_size;
full_record = false;
- try_to_copy = msg_data_left(msg);
record_room = TLS_MAX_PAYLOAD_SIZE - ctx->sg_plaintext_size;
if (try_to_copy >= record_room) {
try_to_copy = record_room;
--
2.13.6
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net-next] net/tls: Do not call msg_data_left() twice
2018-07-24 11:11 [PATCH net-next] net/tls: Do not call msg_data_left() twice Vakul Garg
@ 2018-07-25 1:49 ` Al Viro
2018-07-25 1:54 ` Vakul Garg
0 siblings, 1 reply; 3+ messages in thread
From: Al Viro @ 2018-07-25 1:49 UTC (permalink / raw)
To: Vakul Garg; +Cc: netdev, borisp, aviadye, davejwatson, davem
On Tue, Jul 24, 2018 at 04:41:18PM +0530, Vakul Garg wrote:
> In function tls_sw_sendmsg(), msg_data_left() needs to be called only
> once. The second invocation of msg_data_left() for assigning variable
> try_to_copy can be removed and merged with the first one.
You do realize that msg_data_left(msg) is simply msg->msg_iter.count?
So I'm not at all sure that your change will be an overall win...
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net/tls: Do not call msg_data_left() twice
2018-07-25 1:49 ` Al Viro
@ 2018-07-25 1:54 ` Vakul Garg
0 siblings, 0 replies; 3+ messages in thread
From: Vakul Garg @ 2018-07-25 1:54 UTC (permalink / raw)
To: Al Viro
Cc: netdev@vger.kernel.org, borisp@mellanox.com, aviadye@mellanox.com,
davejwatson@fb.com, davem@davemloft.net
[-- Attachment #1: Type: text/plain, Size: 752 bytes --]
From: Al Viro
Sent: Wednesday, 25 July, 7:19 AM
Subject: Re: [PATCH net-next] net/tls: Do not call msg_data_left() twice
To: Vakul Garg
Cc: netdev@vger.kernel.org, borisp@mellanox.com, aviadye@mellanox.com, davejwatson@fb.com, davem@davemloft.net
On Tue, Jul 24, 2018 at 04:41:18PM +0530, Vakul Garg wrote: > In function tls_sw_sendmsg(), msg_data_left() needs to be called only > once. The second invocation of msg_data_left() for assigning variable > try_to_copy can be removed and merged with the first one. You do realize that msg_data_left(msg) is simply msg->msg_iter.count? So I'm not at all sure that your change will be an overall win...
Agreed, msg_data_left is inexpensive. It's just that is pointless to call it again.
[-- Attachment #2: Type: text/html, Size: 1991 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-07-25 3:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-24 11:11 [PATCH net-next] net/tls: Do not call msg_data_left() twice Vakul Garg
2018-07-25 1:49 ` Al Viro
2018-07-25 1:54 ` Vakul Garg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox