Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jakub Kicinski and committed by
David S. Miller
9ec1c6ac 8538d29c

+38
+5
net/tls/tls_device.c
··· 850 850 { 851 851 struct tls_context *tls_ctx = tls_get_ctx(sk); 852 852 struct tls_offload_context_rx *ctx = tls_offload_ctx_rx(tls_ctx); 853 + struct strp_msg *rxm = strp_msg(skb); 853 854 int is_decrypted = skb->decrypted; 854 855 int is_encrypted = !is_decrypted; 855 856 struct sk_buff *skb_iter; ··· 860 859 is_decrypted &= skb_iter->decrypted; 861 860 is_encrypted &= !skb_iter->decrypted; 862 861 } 862 + 863 + trace_tls_device_decrypted(sk, tcp_sk(sk)->copied_seq - rxm->full_len, 864 + tls_ctx->rx.rec_seq, rxm->full_len, 865 + is_encrypted, is_decrypted); 863 866 864 867 ctx->sw.decrypted |= is_decrypted; 865 868
+33
net/tls/trace.h
··· 41 41 ) 42 42 ); 43 43 44 + TRACE_EVENT(tls_device_decrypted, 45 + 46 + TP_PROTO(struct sock *sk, u32 tcp_seq, u8 *rec_no, u32 rec_len, 47 + bool encrypted, bool decrypted), 48 + 49 + TP_ARGS(sk, tcp_seq, rec_no, rec_len, encrypted, decrypted), 50 + 51 + TP_STRUCT__entry( 52 + __field( struct sock *, sk ) 53 + __field( u64, rec_no ) 54 + __field( u32, tcp_seq ) 55 + __field( u32, rec_len ) 56 + __field( bool, encrypted ) 57 + __field( bool, decrypted ) 58 + ), 59 + 60 + TP_fast_assign( 61 + __entry->sk = sk; 62 + __entry->rec_no = get_unaligned_be64(rec_no); 63 + __entry->tcp_seq = tcp_seq; 64 + __entry->rec_len = rec_len; 65 + __entry->encrypted = encrypted; 66 + __entry->decrypted = decrypted; 67 + ), 68 + 69 + TP_printk( 70 + "sk=%p tcp_seq=%u rec_no=%llu len=%u encrypted=%d decrypted=%d", 71 + __entry->sk, __entry->tcp_seq, 72 + __entry->rec_no, __entry->rec_len, 73 + __entry->encrypted, __entry->decrypted 74 + ) 75 + ); 76 + 44 77 TRACE_EVENT(tls_device_rx_resync_send, 45 78 46 79 TP_PROTO(struct sock *sk, u32 tcp_seq, u8 *rec_no, int sync_type),