From nobody Mon Oct 24 08:08:56 2022 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 4MwnlX5TyHz4fb3N; Mon, 24 Oct 2022 08:08:56 +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 4MwnlX4vsvz43GT; Mon, 24 Oct 2022 08:08:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666598936; 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=QLWp/mW0BByQhEcqrBQLfHspw2on+usesN/W0wDl8k8=; b=RaXIripQPLboKEBgYxwXY/n0+e50RUmVDxd/bj6NQUSDUNMhiamclLiExaE954hpbj9orE n4zkk4rcYop3+g56GwdRV+EGoZQOxX2xdYGvW/weM9FCL1ILbJm9DjmsqW4edpTVfm8Si1 6zri/CIRQshT+uz7+4OiaKbgQLsPbXc/qxFDLY3A0XxFQbwEapkx6U4dIrg/tlRXL4NV0m kAMc7joBIWjsuuVuV2e3BwUW0k+DHvSmVrY3RUiOAyAsSAwwwrbw6DPxOh1JGBQ4tYWZfy Qg88gs/nNLNzLV2VCxezxfis55TScD2pKd25GPYyY22vmR6OKnemJeELiqZ+aQ== 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 4MwnlX3wJNz19RF; Mon, 24 Oct 2022 08:08:56 +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 29O88uKO029819; Mon, 24 Oct 2022 08:08:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29O88uVt029818; Mon, 24 Oct 2022 08:08:56 GMT (envelope-from git) Date: Mon, 24 Oct 2022 08:08:56 GMT Message-Id: <202210240808.29O88uVt029818@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: dc12ee39b7f2 - main - if_ovpn: add sysctls for netisr_queue() and crypto_dispatch_async() 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dc12ee39b7f266f7d4975722b7454d18536fcf11 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666598936; 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=QLWp/mW0BByQhEcqrBQLfHspw2on+usesN/W0wDl8k8=; b=rpaqbE5lDMbQjw+Ke/GXZDJ9utSrJB7Gc4dXpNbLILXag4L5qK20pNnPBrtJVWT8Thc/RF +IIEfSW1MNpxWS+4UJedYATBO7p56iGC73q8H2EbpQA0K9kObW+6Bfvco0f6uJi2gcjGWY sUyk2HW+kqt0PbKti4MQZ2GETNZkYYzUIGKudI34NaWvJFe0JC/+afmonyuiWkdLfYCUlr mFpdie8JRzZ9gLrZP64jIsj4392Yapryz8znQ1lPROj13HqGfmyaUZvHAJeJtByoNQMQzP C61sWeWYXHTTByH+OI5swjSrZSM8GaBumlzX/aRQRwsPR6T/L71ZXKYinROdQg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1666598936; a=rsa-sha256; cv=none; b=Opd0ZC0G2DFi+WHjqr1lbsrWMV3PJSlpsNtKWDq7PRiRq7Yp8Ma5OZSX1oCjwS+VpZpK2C iNyfhFIbJdsIEgs8q2xsjTuBItNwhamo+a1/apHUKmqf3T678ygHZsB7r3WEZT+hP1EXM7 ktID4A2Tm+FtK9+ILGyDatC2DsCCnMNckfv5PxBU58ks5hZ7M2Yp82Cg+DuwslzcEtId/b fFXO0fV0lj2OmMVWMk5ctgRtBFm8+G8r+a74Yjif2Mik/i6RzrSv6Ja4wikR29wOOotRAP w0ti/ESTFgsM+OSK62oBgOl++5Q/KA2TogkWZxXOlAN9pAEKUvUFb4ScV/999w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=dc12ee39b7f266f7d4975722b7454d18536fcf11 commit dc12ee39b7f266f7d4975722b7454d18536fcf11 Author: Kristof Provost AuthorDate: 2022-10-17 09:06:34 +0000 Commit: Kristof Provost CommitDate: 2022-10-24 08:08:35 +0000 if_ovpn: add sysctls for netisr_queue() and crypto_dispatch_async() Allow the choice between asynchronous and synchronous netisr and crypto calls. These have performance implications, but depend on the specific setup and OCF back-end. Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D37017 --- sys/net/if_ovpn.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/sys/net/if_ovpn.c b/sys/net/if_ovpn.c index 14634cfc969b..76274fc87159 100644 --- a/sys/net/if_ovpn.c +++ b/sys/net/if_ovpn.c @@ -235,6 +235,18 @@ VNET_DEFINE_STATIC(int, replay_protection) = 0; SYSCTL_INT(_net_link_openvpn, OID_AUTO, replay_protection, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(replay_protection), 0, "Validate sequence numbers"); +VNET_DEFINE_STATIC(int, async_crypto); +#define V_async_crypto VNET(async_crypto) +SYSCTL_INT(_net_link_openvpn, OID_AUTO, async_crypto, + CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(async_crypto), 0, + "Use asynchronous mode to parallelize crypto jobs."); + +VNET_DEFINE_STATIC(int, netisr_queue); +#define V_netisr_queue VNET(netisr_queue) +SYSCTL_INT(_net_link_openvpn, OID_AUTO, netisr_queue, + CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(netisr_queue), 0, + "Use netisr_queue() rather than netisr_dispatch()."); + static struct ovpn_kpeer * ovpn_find_peer(struct ovpn_softc *sc, uint32_t peerid) { @@ -1503,7 +1515,10 @@ ovpn_finish_rx(struct ovpn_softc *sc, struct mbuf *m, af = ovpn_get_af(m); if (af != 0) { BPF_MTAP2(sc->ifp, &af, sizeof(af), m); - netisr_dispatch(af == AF_INET ? NETISR_IP : NETISR_IPV6, m); + if (V_netisr_queue) + netisr_queue(af == AF_INET ? NETISR_IP : NETISR_IPV6, m); + else + netisr_dispatch(af == AF_INET ? NETISR_IP : NETISR_IPV6, m); } else { OVPN_COUNTER_ADD(sc, lost_data_pkts_in, 1); m_freem(m); @@ -1869,7 +1884,10 @@ ovpn_transmit_to_peer(struct ifnet *ifp, struct mbuf *m, atomic_add_int(&peer->refcount, 1); if (_ovpn_lock_trackerp != NULL) OVPN_RUNLOCK(sc); - ret = crypto_dispatch(crp); + if (V_async_crypto) + ret = crypto_dispatch_async(crp, CRYPTO_ASYNC_ORDERED); + else + ret = crypto_dispatch(crp); if (ret) { OVPN_COUNTER_ADD(sc, lost_data_pkts_out, 1); } @@ -2266,7 +2284,10 @@ ovpn_udp_input(struct mbuf *m, int off, struct inpcb *inp, atomic_add_int(&sc->refcount, 1); OVPN_RUNLOCK(sc); - ret = crypto_dispatch(crp); + if (V_async_crypto) + ret = crypto_dispatch_async(crp, CRYPTO_ASYNC_ORDERED); + else + ret = crypto_dispatch(crp); if (ret != 0) { OVPN_COUNTER_ADD(sc, lost_data_pkts_in, 1); }