summaryrefslogtreecommitdiff
path: root/net/tls/tls_device.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2019-10-07 09:58:28 -0400
committerDavid S. Miller <davem@davemloft.net>2019-10-07 09:58:28 -0400
commit578de2f361de06ad81ba6fe0cde92ebf6ec85df7 (patch)
tree45c1d1dee313315521eeb750a4dfcd89777af460 /net/tls/tls_device.c
parent8211fbfaf2fe66ac4ca28bb52b4e7f61dcac0378 (diff)
parentbc76e5bb1229ede1f26317b813099b0e983e4009 (diff)
Merge branch 'net-tls-minor-micro-optimizations'
Jakub Kicinski says: ==================== net/tls: minor micro optimizations This set brings a number of minor code changes from my tree which don't have a noticeable impact on performance but seem reasonable nonetheless. First sk_msg_sg copy array is converted to a bitmap, zeroing that structure takes a lot of time, hence we should try to keep it small. Next two conditions are marked as unlikely, GCC seemed to had little trouble correctly reasoning about those. Patch 4 adds parameters to tls_device_decrypted() to avoid walking structures, as all callers already have the relevant pointers. Lastly two boolean members of TLS context structures are converted to a bitfield. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tls/tls_device.c')
-rw-r--r--net/tls/tls_device.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c
index f306e4c7bf15..33b267b052c0 100644
--- a/net/tls/tls_device.c
+++ b/net/tls/tls_device.c
@@ -431,7 +431,7 @@ static int tls_push_data(struct sock *sk,
~(MSG_MORE | MSG_DONTWAIT | MSG_NOSIGNAL | MSG_SENDPAGE_NOTLAST))
return -ENOTSUPP;
- if (sk->sk_err)
+ if (unlikely(sk->sk_err))
return -sk->sk_err;
flags |= MSG_SENDPAGE_DECRYPTED;
@@ -452,9 +452,8 @@ static int tls_push_data(struct sock *sk,
max_open_record_len = TLS_MAX_PAYLOAD_SIZE +
prot->prepend_size;
do {
- rc = tls_do_allocation(sk, ctx, pfrag,
- prot->prepend_size);
- if (rc) {
+ rc = tls_do_allocation(sk, ctx, pfrag, prot->prepend_size);
+ if (unlikely(rc)) {
rc = sk_stream_wait_memory(sk, &timeo);
if (!rc)
continue;
@@ -847,11 +846,10 @@ free_buf:
return err;
}
-int tls_device_decrypted(struct sock *sk, struct sk_buff *skb)
+int tls_device_decrypted(struct sock *sk, struct tls_context *tls_ctx,
+ struct sk_buff *skb, struct strp_msg *rxm)
{
- struct tls_context *tls_ctx = tls_get_ctx(sk);
struct tls_offload_context_rx *ctx = tls_offload_ctx_rx(tls_ctx);
- struct strp_msg *rxm = strp_msg(skb);
int is_decrypted = skb->decrypted;
int is_encrypted = !is_decrypted;
struct sk_buff *skb_iter;