From nobody Tue Nov 16 17:59:19 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 83BA61852C1D; Tue, 16 Nov 2021 17:59:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Htv2b32ZDz3lyM; Tue, 16 Nov 2021 17:59:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 40BF911F17; Tue, 16 Nov 2021 17:59:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AGHxJjs038570; Tue, 16 Nov 2021 17:59:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AGHxJ0W038569; Tue, 16 Nov 2021 17:59:19 GMT (envelope-from git) Date: Tue, 16 Nov 2021 17:59:19 GMT Message-Id: <202111161759.1AGHxJ0W038569@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 16bea05ac327 - main - ktls: Split encrypt vs decrypt OCF counters. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 16bea05ac3275d41663939da0d5c26d89f15cd53 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=16bea05ac3275d41663939da0d5c26d89f15cd53 commit 16bea05ac3275d41663939da0d5c26d89f15cd53 Author: John Baldwin AuthorDate: 2021-11-16 17:58:52 +0000 Commit: John Baldwin CommitDate: 2021-11-16 17:58:52 +0000 ktls: Split encrypt vs decrypt OCF counters. Reviewed by: gallatin, markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D33006 --- sys/opencrypto/ktls_ocf.c | 62 +++++++++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 26 deletions(-) diff --git a/sys/opencrypto/ktls_ocf.c b/sys/opencrypto/ktls_ocf.c index 0fdec6f6d139..dc8b6f76257b 100644 --- a/sys/opencrypto/ktls_ocf.c +++ b/sys/opencrypto/ktls_ocf.c @@ -76,34 +76,44 @@ static SYSCTL_NODE(_kern_ipc_tls_stats, OID_AUTO, ocf, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "Kernel TLS offload via OCF stats"); -static COUNTER_U64_DEFINE_EARLY(ocf_tls10_cbc_crypts); -SYSCTL_COUNTER_U64(_kern_ipc_tls_stats_ocf, OID_AUTO, tls10_cbc_crypts, - CTLFLAG_RD, &ocf_tls10_cbc_crypts, +static COUNTER_U64_DEFINE_EARLY(ocf_tls10_cbc_encrypts); +SYSCTL_COUNTER_U64(_kern_ipc_tls_stats_ocf, OID_AUTO, tls10_cbc_encrypts, + CTLFLAG_RD, &ocf_tls10_cbc_encrypts, "Total number of OCF TLS 1.0 CBC encryption operations"); -static COUNTER_U64_DEFINE_EARLY(ocf_tls11_cbc_crypts); -SYSCTL_COUNTER_U64(_kern_ipc_tls_stats_ocf, OID_AUTO, tls11_cbc_crypts, - CTLFLAG_RD, &ocf_tls11_cbc_crypts, +static COUNTER_U64_DEFINE_EARLY(ocf_tls11_cbc_encrypts); +SYSCTL_COUNTER_U64(_kern_ipc_tls_stats_ocf, OID_AUTO, tls11_cbc_encrypts, + CTLFLAG_RD, &ocf_tls11_cbc_encrypts, "Total number of OCF TLS 1.1/1.2 CBC encryption operations"); -static COUNTER_U64_DEFINE_EARLY(ocf_tls12_gcm_crypts); -SYSCTL_COUNTER_U64(_kern_ipc_tls_stats_ocf, OID_AUTO, tls12_gcm_crypts, - CTLFLAG_RD, &ocf_tls12_gcm_crypts, +static COUNTER_U64_DEFINE_EARLY(ocf_tls12_gcm_decrypts); +SYSCTL_COUNTER_U64(_kern_ipc_tls_stats_ocf, OID_AUTO, tls12_gcm_decrypts, + CTLFLAG_RD, &ocf_tls12_gcm_decrypts, + "Total number of OCF TLS 1.2 GCM decryption operations"); + +static COUNTER_U64_DEFINE_EARLY(ocf_tls12_gcm_encrypts); +SYSCTL_COUNTER_U64(_kern_ipc_tls_stats_ocf, OID_AUTO, tls12_gcm_encrypts, + CTLFLAG_RD, &ocf_tls12_gcm_encrypts, "Total number of OCF TLS 1.2 GCM encryption operations"); -static COUNTER_U64_DEFINE_EARLY(ocf_tls12_chacha20_crypts); -SYSCTL_COUNTER_U64(_kern_ipc_tls_stats_ocf, OID_AUTO, tls12_chacha20_crypts, - CTLFLAG_RD, &ocf_tls12_chacha20_crypts, +static COUNTER_U64_DEFINE_EARLY(ocf_tls12_chacha20_decrypts); +SYSCTL_COUNTER_U64(_kern_ipc_tls_stats_ocf, OID_AUTO, tls12_chacha20_decrypts, + CTLFLAG_RD, &ocf_tls12_chacha20_decrypts, + "Total number of OCF TLS 1.2 Chacha20-Poly1305 decryption operations"); + +static COUNTER_U64_DEFINE_EARLY(ocf_tls12_chacha20_encrypts); +SYSCTL_COUNTER_U64(_kern_ipc_tls_stats_ocf, OID_AUTO, tls12_chacha20_encrypts, + CTLFLAG_RD, &ocf_tls12_chacha20_encrypts, "Total number of OCF TLS 1.2 Chacha20-Poly1305 encryption operations"); -static COUNTER_U64_DEFINE_EARLY(ocf_tls13_gcm_crypts); -SYSCTL_COUNTER_U64(_kern_ipc_tls_stats_ocf, OID_AUTO, tls13_gcm_crypts, - CTLFLAG_RD, &ocf_tls13_gcm_crypts, +static COUNTER_U64_DEFINE_EARLY(ocf_tls13_gcm_encrypts); +SYSCTL_COUNTER_U64(_kern_ipc_tls_stats_ocf, OID_AUTO, tls13_gcm_encrypts, + CTLFLAG_RD, &ocf_tls13_gcm_encrypts, "Total number of OCF TLS 1.3 GCM encryption operations"); -static COUNTER_U64_DEFINE_EARLY(ocf_tls13_chacha20_crypts); -SYSCTL_COUNTER_U64(_kern_ipc_tls_stats_ocf, OID_AUTO, tls13_chacha20_crypts, - CTLFLAG_RD, &ocf_tls13_chacha20_crypts, +static COUNTER_U64_DEFINE_EARLY(ocf_tls13_chacha20_encrypts); +SYSCTL_COUNTER_U64(_kern_ipc_tls_stats_ocf, OID_AUTO, tls13_chacha20_encrypts, + CTLFLAG_RD, &ocf_tls13_chacha20_encrypts, "Total number of OCF TLS 1.3 Chacha20-Poly1305 encryption operations"); static COUNTER_U64_DEFINE_EARLY(ocf_inplace); @@ -340,9 +350,9 @@ ktls_ocf_tls_cbc_encrypt(struct ktls_ocf_encrypt_state *state, } if (os->implicit_iv) - counter_u64_add(ocf_tls10_cbc_crypts, 1); + counter_u64_add(ocf_tls10_cbc_encrypts, 1); else - counter_u64_add(ocf_tls11_cbc_crypts, 1); + counter_u64_add(ocf_tls11_cbc_encrypts, 1); if (outiov != NULL) counter_u64_add(ocf_separate_output, 1); else @@ -434,9 +444,9 @@ ktls_ocf_tls12_aead_encrypt(struct ktls_ocf_encrypt_state *state, crp->crp_op = CRYPTO_OP_ENCRYPT | CRYPTO_OP_COMPUTE_DIGEST; crp->crp_flags = CRYPTO_F_CBIMM | CRYPTO_F_IV_SEPARATE; if (tls->params.cipher_algorithm == CRYPTO_AES_NIST_GCM_16) - counter_u64_add(ocf_tls12_gcm_crypts, 1); + counter_u64_add(ocf_tls12_gcm_encrypts, 1); else - counter_u64_add(ocf_tls12_chacha20_crypts, 1); + counter_u64_add(ocf_tls12_chacha20_encrypts, 1); if (outiov != NULL) counter_u64_add(ocf_separate_output, 1); else @@ -502,9 +512,9 @@ ktls_ocf_tls12_aead_decrypt(struct ktls_session *tls, crypto_use_mbuf(&crp, m); if (tls->params.cipher_algorithm == CRYPTO_AES_NIST_GCM_16) - counter_u64_add(ocf_tls12_gcm_crypts, 1); + counter_u64_add(ocf_tls12_gcm_decrypts, 1); else - counter_u64_add(ocf_tls12_chacha20_crypts, 1); + counter_u64_add(ocf_tls12_chacha20_decrypts, 1); error = ktls_ocf_dispatch(os, &crp); crypto_destroyreq(&crp); @@ -575,9 +585,9 @@ ktls_ocf_tls13_aead_encrypt(struct ktls_ocf_encrypt_state *state, memcpy(crp->crp_iv, nonce, sizeof(nonce)); if (tls->params.cipher_algorithm == CRYPTO_AES_NIST_GCM_16) - counter_u64_add(ocf_tls13_gcm_crypts, 1); + counter_u64_add(ocf_tls13_gcm_encrypts, 1); else - counter_u64_add(ocf_tls13_chacha20_crypts, 1); + counter_u64_add(ocf_tls13_chacha20_encrypts, 1); if (outiov != NULL) counter_u64_add(ocf_separate_output, 1); else