summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Kicinski <jakub.kicinski@netronome.com>2019-10-04 16:19:23 -0700
committerDavid S. Miller <davem@davemloft.net>2019-10-05 16:29:00 -0700
commit9ec1c6ac27640f6a65378f11e433baa4ece12a28 (patch)
tree1811112c2a6c8ea184bc32d26a7b0d4887e5b19a
parent8538d29cea9530f114159e06bfa31b2358161493 (diff)
downloadlinux-stable-9ec1c6ac27640f6a65378f11e433baa4ece12a28.tar.gz
linux-stable-9ec1c6ac27640f6a65378f11e433baa4ece12a28.tar.bz2
linux-stable-9ec1c6ac27640f6a65378f11e433baa4ece12a28.zip
net/tls: add device decrypted trace point
Add a tracepoint to the TLS offload's fast path. This tracepoint can be used to track the decrypted and encrypted status of received records. Records decrypted by the device should have decrypted set to 1, records which have neither decrypted nor decrypted set are partially decrypted, require re-encryption and therefore are most expensive to deal with. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/tls/tls_device.c5
-rw-r--r--net/tls/trace.h33
2 files changed, 38 insertions, 0 deletions
diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c
index 9f423caf48e3..5a9a86bf0ee1 100644
--- a/net/tls/tls_device.c
+++ b/net/tls/tls_device.c
@@ -850,6 +850,7 @@ int tls_device_decrypted(struct sock *sk, struct sk_buff *skb)
{
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;
@@ -860,6 +861,10 @@ int tls_device_decrypted(struct sock *sk, struct sk_buff *skb)
is_encrypted &= !skb_iter->decrypted;
}
+ trace_tls_device_decrypted(sk, tcp_sk(sk)->copied_seq - rxm->full_len,
+ tls_ctx->rx.rec_seq, rxm->full_len,
+ is_encrypted, is_decrypted);
+
ctx->sw.decrypted |= is_decrypted;
/* Return immediately if the record is either entirely plaintext or
diff --git a/net/tls/trace.h b/net/tls/trace.h
index 95b6ded2f9b2..9ba5f600ea43 100644
--- a/net/tls/trace.h
+++ b/net/tls/trace.h
@@ -41,6 +41,39 @@ TRACE_EVENT(tls_device_offload_set,
)
);
+TRACE_EVENT(tls_device_decrypted,
+
+ TP_PROTO(struct sock *sk, u32 tcp_seq, u8 *rec_no, u32 rec_len,
+ bool encrypted, bool decrypted),
+
+ TP_ARGS(sk, tcp_seq, rec_no, rec_len, encrypted, decrypted),
+
+ TP_STRUCT__entry(
+ __field( struct sock *, sk )
+ __field( u64, rec_no )
+ __field( u32, tcp_seq )
+ __field( u32, rec_len )
+ __field( bool, encrypted )
+ __field( bool, decrypted )
+ ),
+
+ TP_fast_assign(
+ __entry->sk = sk;
+ __entry->rec_no = get_unaligned_be64(rec_no);
+ __entry->tcp_seq = tcp_seq;
+ __entry->rec_len = rec_len;
+ __entry->encrypted = encrypted;
+ __entry->decrypted = decrypted;
+ ),
+
+ TP_printk(
+ "sk=%p tcp_seq=%u rec_no=%llu len=%u encrypted=%d decrypted=%d",
+ __entry->sk, __entry->tcp_seq,
+ __entry->rec_no, __entry->rec_len,
+ __entry->encrypted, __entry->decrypted
+ )
+);
+
TRACE_EVENT(tls_device_rx_resync_send,
TP_PROTO(struct sock *sk, u32 tcp_seq, u8 *rec_no, int sync_type),