From nobody Tue Jul 30 15:00:51 2024 X-Original-To: dev-commits-src-main@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 4WYJM75S73z5RNLn; Tue, 30 Jul 2024 15:00:51 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WYJM74yyYz57Vh; Tue, 30 Jul 2024 15:00:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722351651; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=u0xwjEkmLHBSHW+8nL/zHWIbvbUq3PC1LCJ9RAvY8zc=; b=Wg0KAolxDwFxAA1oUEmzKxHg0nK+Y+ntBhiBmYSv/vmCXehcPbp/Ff8+KbNQ7HhGqubwTY V41nI4R9FTsUy+QqRUJQ5NOsmULHV7fiqbfvXZZ0tAWuuLnleGdkSHh91agTvuU/mtOPoA JyQozJGmE7mDQPXC/d4CE41Q40jN4Gkl+cayovQ6PfVZoHFF5qhflQttIo4iZiLECPYv6L 38NjadTLF3VGj21qGjoWIiYKrBfbIWK0DkfaZzVm5ltLp4Od5ZR/WyBBfN/8fytBMh6Ysi APU9uVN3RwHIV/c+SJczKL3K3Bh9POypKe9zz7iNiMLXTd9j5xpKQVbeKCUauA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722351651; a=rsa-sha256; cv=none; b=hsCSE702GBPiyayWbl9/7VRwrKD4vp1fueq8kQZEFaGvaE3mswD5kiOsAwMCPmIOU81wiz o6XqojvkQ04tw7spxjDmybwDvKHTulaeuche5zxPh9LNaKM5D0gDL28cl/VAPgPJ84crui JFvI8RvcBgeisG64eEKUkWzJ4TuMf/zdaD3q2KRa7NUTpYNlc7DRiSjBFkrhuMIeOSc0La e9QWPIdCSC0YrzIkGaeCypXVXTQhYoMBC+lGXz3TcDvXp272zJIvtPe7/LEM0IOlQ9/ZhK Qqlumh5Swqlnq6oKxf+h/hriJptpHT52pgeW7rt8HEFZ3DmRRGHWF7XHXDmP7g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722351651; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=u0xwjEkmLHBSHW+8nL/zHWIbvbUq3PC1LCJ9RAvY8zc=; b=qTkYtr/suJGfp13vxQWwOwv0E+gdsBkphTekQJzRP26yIzHJVrNtJ3qdR0nADVhUI+feU1 SmewAgryNcHoPoe6pZyZZna43SYKCW8BKcK/+7fSbGfWwCJuU+BgXEZBh/BwGmwAql+2uh n6xPiB9LOKzs1tTVmWgPdWn9XIoWIAlARCw7H6tuW8rTOSdr5fRc3hI7qbYAPKfz2VD2fo 0yIOudHEi0n0kk2yW4kYsSHDRTWrHLvZ85wSKANGt/rdanoXZIf1BwN5Ni3TUKxckYu54/ zdRula8LFGcb83k7haOpdn/hUbX0Rw9i8KinGjZJrXlhzTg5b2DYXvh+CphwIg== 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 4WYJM74ZHrzMwM; Tue, 30 Jul 2024 15:00:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46UF0pIM092291; Tue, 30 Jul 2024 15:00:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46UF0pL9092288; Tue, 30 Jul 2024 15:00:51 GMT (envelope-from git) Date: Tue, 30 Jul 2024 15:00:51 GMT Message-Id: <202407301500.46UF0pL9092288@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 65f264dcf737 - main - ipsec_offload: indirect two more functions on the ipsec.ko module load List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 65f264dcf7374d71781cebf4c7c84bc312e33352 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=65f264dcf7374d71781cebf4c7c84bc312e33352 commit 65f264dcf7374d71781cebf4c7c84bc312e33352 Author: Konstantin Belousov AuthorDate: 2024-07-23 07:20:10 +0000 Commit: Konstantin Belousov CommitDate: 2024-07-30 14:59:49 +0000 ipsec_offload: indirect two more functions on the ipsec.ko module load Specifically, ipsec_accel_on_ifdown() and ipsec_accel_drv_sa_lifetime_update() should be present in kernel for future mlx5en driver to be statically linkable into the kernel built with IPSEC_HOOKS + IPSEC_OFFLOAD. Sponsored by: NVIDIA networking --- sys/netipsec/ipsec_offload.c | 16 ++++++++++++---- sys/netipsec/ipsec_offload.h | 3 +++ sys/netipsec/key.c | 27 +++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/sys/netipsec/ipsec_offload.c b/sys/netipsec/ipsec_offload.c index 8ccae7a94f2a..984134539d8b 100644 --- a/sys/netipsec/ipsec_offload.c +++ b/sys/netipsec/ipsec_offload.c @@ -151,6 +151,9 @@ static void ipsec_accel_sa_recordxfer(struct secasvar *sav, struct mbuf *m); static void ipsec_accel_sync_imp(void); static bool ipsec_accel_is_accel_sav_impl(struct secasvar *sav); static struct mbuf *ipsec_accel_key_setaccelif_impl(struct secasvar *sav); +static void ipsec_accel_on_ifdown_impl(struct ifnet *ifp); +static void ipsec_accel_drv_sa_lifetime_update_impl(struct secasvar *sav, + if_t ifp, u_int drv_spi, uint64_t octets, uint64_t allocs); static void ipsec_accel_init(void *arg) @@ -167,6 +170,9 @@ ipsec_accel_init(void *arg) ipsec_accel_sync_p = ipsec_accel_sync_imp; ipsec_accel_is_accel_sav_p = ipsec_accel_is_accel_sav_impl; ipsec_accel_key_setaccelif_p = ipsec_accel_key_setaccelif_impl; + ipsec_accel_on_ifdown_p = ipsec_accel_on_ifdown_impl; + ipsec_accel_drv_sa_lifetime_update_p = + ipsec_accel_drv_sa_lifetime_update_impl; pctrie_init(&drv_spi_pctrie); } SYSINIT(ipsec_accel_init, SI_SUB_VNET_DONE, SI_ORDER_ANY, @@ -183,6 +189,8 @@ ipsec_accel_fini(void *arg) ipsec_accel_sync_p = NULL; ipsec_accel_is_accel_sav_p = NULL; ipsec_accel_key_setaccelif_p = NULL; + ipsec_accel_on_ifdown_p = NULL; + ipsec_accel_drv_sa_lifetime_update_p = NULL; ipsec_accel_sync_imp(); clean_unrhdr(drv_spi_unr); /* avoid panic, should go later */ clear_unrhdr(drv_spi_unr); @@ -784,8 +792,8 @@ ipsec_accel_on_ifdown_sp(struct ifnet *ifp) free(marker, M_IPSEC_MISC); } -void -ipsec_accel_on_ifdown(struct ifnet *ifp) +static void +ipsec_accel_on_ifdown_impl(struct ifnet *ifp) { ipsec_accel_on_ifdown_sp(ifp); ipsec_accel_on_ifdown_sav(ifp); @@ -949,8 +957,8 @@ ipsec_accel_sa_lifetime_update(struct seclifetime *lft_c, lft_c->usetime = min(lft_c->usetime, lft_l->usetime); } -void -ipsec_accel_drv_sa_lifetime_update(struct secasvar *sav, if_t ifp, +static void +ipsec_accel_drv_sa_lifetime_update_impl(struct secasvar *sav, if_t ifp, u_int drv_spi, uint64_t octets, uint64_t allocs) { struct epoch_tracker et; diff --git a/sys/netipsec/ipsec_offload.h b/sys/netipsec/ipsec_offload.h index 27b9c938832e..72055a110951 100644 --- a/sys/netipsec/ipsec_offload.h +++ b/sys/netipsec/ipsec_offload.h @@ -61,6 +61,9 @@ extern int (*ipsec_accel_sa_lifetime_op_p)(struct secasvar *sav, extern void (*ipsec_accel_sync_p)(void); extern bool (*ipsec_accel_is_accel_sav_p)(struct secasvar *sav); extern struct mbuf *(*ipsec_accel_key_setaccelif_p)(struct secasvar *sav); +extern void (*ipsec_accel_on_ifdown_p)(struct ifnet *ifp); +extern void (*ipsec_accel_drv_sa_lifetime_update_p)(struct secasvar *sav, + if_t ifp, u_int drv_spi, uint64_t octets, uint64_t allocs); #ifdef IPSEC_OFFLOAD /* diff --git a/sys/netipsec/key.c b/sys/netipsec/key.c index 38dd2bc5c1a6..149173e0b5f6 100644 --- a/sys/netipsec/key.c +++ b/sys/netipsec/key.c @@ -109,6 +109,9 @@ int (*ipsec_accel_sa_lifetime_op_p)(struct secasvar *sav, void (*ipsec_accel_sync_p)(void); bool (*ipsec_accel_is_accel_sav_p)(struct secasvar *sav); struct mbuf *(*ipsec_accel_key_setaccelif_p)(struct secasvar *sav); +void (*ipsec_accel_on_ifdown_p)(struct ifnet *ifp); +void (*ipsec_accel_drv_sa_lifetime_update_p)(struct secasvar *sav, if_t ifp, + u_int drv_spi, uint64_t octets, uint64_t allocs); #endif #define FULLMASK 0xff @@ -8964,3 +8967,27 @@ ipsec_sahtree_rlock(struct rm_priotracker *sahtree_trackerp) { rm_rlock(&sahtree_lock, sahtree_trackerp); } + +#ifdef IPSEC_OFFLOAD +void +ipsec_accel_on_ifdown(struct ifnet *ifp) +{ + void (*p)(struct ifnet *ifp); + + p = atomic_load_ptr(&ipsec_accel_on_ifdown_p); + if (p != NULL) + p(ifp); +} + +void +ipsec_accel_drv_sa_lifetime_update(struct secasvar *sav, if_t ifp, + u_int drv_spi, uint64_t octets, uint64_t allocs) +{ + void (*p)(struct secasvar *sav, if_t ifp, u_int drv_spi, + uint64_t octets, uint64_t allocs); + + p = atomic_load_ptr(&ipsec_accel_drv_sa_lifetime_update_p); + if (p != NULL) + p(sav, ifp, drv_spi, octets, allocs); +} +#endif