* [net-next v4 1/3] net/tls: Use socket data_ready callback on record availability
2018-07-19 15:59 [net-next v4 0/3] net/tls: Minor code cleanup patches Vakul Garg
@ 2018-07-19 15:59 ` Vakul Garg
2018-07-19 15:59 ` [net-next v4 2/3] net/tls: Remove redundant variable assignments and wakeup Vakul Garg
2018-07-19 15:59 ` [net-next v4 3/3] net/tls: Remove redundant array allocation Vakul Garg
2 siblings, 0 replies; 4+ messages in thread
From: Vakul Garg @ 2018-07-19 15:59 UTC (permalink / raw)
To: netdev; +Cc: borisp, aviadye, davejwatson, davem, Vakul Garg
On receipt of a complete tls record, use socket's saved data_ready
callback instead of state_change callback.
Signed-off-by: Vakul Garg <vakul.garg@nxp.com>
---
net/tls/tls_sw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index 7d194c0cd6cf..a58661c624ec 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -1023,7 +1023,7 @@ static void tls_queue(struct strparser *strp, struct sk_buff *skb)
ctx->recv_pkt = skb;
strp_pause(strp);
- strp->sk->sk_state_change(strp->sk);
+ ctx->saved_data_ready(strp->sk);
}
static void tls_data_ready(struct sock *sk)
--
2.13.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [net-next v4 2/3] net/tls: Remove redundant variable assignments and wakeup
2018-07-19 15:59 [net-next v4 0/3] net/tls: Minor code cleanup patches Vakul Garg
2018-07-19 15:59 ` [net-next v4 1/3] net/tls: Use socket data_ready callback on record availability Vakul Garg
@ 2018-07-19 15:59 ` Vakul Garg
2018-07-19 15:59 ` [net-next v4 3/3] net/tls: Remove redundant array allocation Vakul Garg
2 siblings, 0 replies; 4+ messages in thread
From: Vakul Garg @ 2018-07-19 15:59 UTC (permalink / raw)
To: netdev; +Cc: borisp, aviadye, davejwatson, davem, Vakul Garg
In function decrypt_skb_update(), the assignment to tls receive context
variable 'decrypted' is redundant as the same is being done in function
tls_sw_recvmsg() after calling decrypt_skb_update(). Also calling callback
function to wakeup processes sleeping on socket data availability is
useless as decrypt_skb_update() is invoked from user processes only. This
patch cleans these up.
Signed-off-by: Vakul Garg <vakul.garg@nxp.com>
---
net/tls/tls_sw.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index a58661c624ec..e62f288fda31 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -659,7 +659,6 @@ static int decrypt_skb_update(struct sock *sk, struct sk_buff *skb,
struct scatterlist *sgout, bool *zc)
{
struct tls_context *tls_ctx = tls_get_ctx(sk);
- struct tls_sw_context_rx *ctx = tls_sw_ctx_rx(tls_ctx);
struct strp_msg *rxm = strp_msg(skb);
int err = 0;
@@ -679,8 +678,6 @@ static int decrypt_skb_update(struct sock *sk, struct sk_buff *skb,
rxm->offset += tls_ctx->rx.prepend_size;
rxm->full_len -= tls_ctx->rx.overhead_size;
tls_advance_record_sn(sk, &tls_ctx->rx);
- ctx->decrypted = true;
- ctx->saved_data_ready(sk);
return err;
}
--
2.13.6
^ permalink raw reply related [flat|nested] 4+ messages in thread* [net-next v4 3/3] net/tls: Remove redundant array allocation.
2018-07-19 15:59 [net-next v4 0/3] net/tls: Minor code cleanup patches Vakul Garg
2018-07-19 15:59 ` [net-next v4 1/3] net/tls: Use socket data_ready callback on record availability Vakul Garg
2018-07-19 15:59 ` [net-next v4 2/3] net/tls: Remove redundant variable assignments and wakeup Vakul Garg
@ 2018-07-19 15:59 ` Vakul Garg
2 siblings, 0 replies; 4+ messages in thread
From: Vakul Garg @ 2018-07-19 15:59 UTC (permalink / raw)
To: netdev; +Cc: borisp, aviadye, davejwatson, davem, Vakul Garg
In function decrypt_skb(), array allocation in case when sgout is NULL
is unnecessary. Instead, local variable sgin_arr[] can be used.
Signed-off-by: Vakul Garg <vakul.garg@nxp.com>
---
net/tls/tls_sw.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index e62f288fda31..c33ba3f1c408 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -703,7 +703,6 @@ int decrypt_skb(struct sock *sk, struct sk_buff *skb,
memcpy(iv, tls_ctx->rx.iv, TLS_CIPHER_AES_GCM_128_SALT_SIZE);
if (!sgout) {
nsg = skb_cow_data(skb, 0, &unused) + 1;
- sgin = kmalloc_array(nsg, sizeof(*sgin), sk->sk_allocation);
sgout = sgin;
}
@@ -724,9 +723,6 @@ int decrypt_skb(struct sock *sk, struct sk_buff *skb,
rxm->full_len - tls_ctx->rx.overhead_size,
skb, sk->sk_allocation);
- if (sgin != &sgin_arr[0])
- kfree(sgin);
-
return ret;
}
--
2.13.6
^ permalink raw reply related [flat|nested] 4+ messages in thread