From nobody Sun Jul 21 09:46:24 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 4WRdpj6DThz5R9j8; Sun, 21 Jul 2024 09:46:37 +0000 (UTC) (envelope-from kp@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WRdpj5KHrz4tyG; Sun, 21 Jul 2024 09:46:37 +0000 (UTC) (envelope-from kp@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721555197; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4lCbD59s7sGlwRUQjAmaWwjdD6T85E0gyWGYRewuRxM=; b=MlF65gS6tYD/mRw6Uwu07I/ubH8nFrZFVnM0JG7AFJ6XbSQs4xplS15AEWLDjXM8VhUrNk DKhForp1dL9DtLNKqyqaj2G3G9sfzopURE7ymqF6IUrN0bSjEa8Ki7dWcrakTPX6yjC5sq vtUVs0E2EiUfRvxtnfc52H/yfSqX++6VwdBlEjOnvvaaof7+a1JwdxZ3KQ5VNh4EZshdws /VsSr+xrAaY+CiRk6xuDfOF/S4mFvD+NXdwwmsu/W9U96qp2WsxYc3mMOOyuzWUWdvZ5lv Xqa5S2O21jm4J3e5I12rXhLvt05DO0RFDRdToQ+vTozXi8FKHb5bjM0de0o6TQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1721555197; a=rsa-sha256; cv=none; b=GW718S0/iFlG2VDrIOCYOTLwSIYw8O7mvHUGuJ8ERLZaa4ZMHlQeYoHWXA7OnQpMxRjxGq pqSEkTd0t6wWDtrVHMS2SZYWkboHc4RoWWYS4LEaBApYF7jxltAlzRajs6JLZShUZOms3T AKsypMRWUUR/YpVNNpBPnWfhbh0W8hkNbHSlRWs8GH9gKnnnYCV5deKSZpyHo0T9VZ2prH XcDSqZh7AaXSGFWYkV+LMt8I8ju5upZdS81pvOF1fY2K8orNRGYhYFuBzzONlb8fEgjEP/ ZEJyViNUbsUne6YWnRpnXWlZdgFTO1djJhz6hoFWbvMZEpRX1vT8MxVOi7GeDw== 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=1721555197; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4lCbD59s7sGlwRUQjAmaWwjdD6T85E0gyWGYRewuRxM=; b=XKOXxUdV8zbCK2fTMU6jqNi1iez2suxZBLNS3yTwlESK0D6xcRPQxqOjsXw9YYlhIrXBs9 m1lwG4ddZnfGz01Rfh/MLJ1dUHyZU1w3iijXwV+RLlOyph5Tz3Tp4WnAdZTOutvz4BkZxG lqN1+wsvVw3H4vdNTyMAHo7EvwZ4/nulw+/pvKLkI5aPZ4WILRN2cg7bCPBArYIU/YLefJ PekN0sV0YBdPPuKW20MKKE8uacDUCYupovcPzwukmaNnzC1T/lhA1a6oogjUQgDAulJHbm Oesx3Xr1R6wS/VT+MyrZxZfHApNks8J6tWtmjsEq5iuzZW7p+RV+PljmnX3OQw== Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (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 (2048 bits) client-digest SHA256) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 4WRdpj3bC0z1Gnw; Sun, 21 Jul 2024 09:46:37 +0000 (UTC) (envelope-from kp@freebsd.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 0CF098FCB; Sun, 21 Jul 2024 11:46:35 +0200 (CEST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Kristof Provost 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 (1.0) Subject: Re: git: 9a7096ff547d - main - ipsec_offload: hide SA/SP offload lifecycle prints under verbose sysctl Date: Sun, 21 Jul 2024 11:46:24 +0200 Message-Id: <99B7FE52-7920-4806-95AD-36F8C85DA9EF@freebsd.org> References: <202407210853.46L8rkoh075102@gitrepo.freebsd.org> Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org In-Reply-To: <202407210853.46L8rkoh075102@gitrepo.freebsd.org> To: Konstantin Belousov X-Mailer: iPhone Mail (21F90) Thanks! > On 21 Jul 2024, at 10:53, Konstantin Belousov wrote: >=20 > =EF=BB=BFThe branch main has been updated by kib: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3D9a7096ff547de2b5a09c5a46838= 53568e08c2f8a >=20 > commit 9a7096ff547de2b5a09c5a4683853568e08c2f8a > Author: Konstantin Belousov > AuthorDate: 2024-07-19 19:15:35 +0000 > Commit: Konstantin Belousov > CommitDate: 2024-07-21 08:53:19 +0000 >=20 > ipsec_offload: hide SA/SP offload lifecycle prints under verbose sysctl= >=20 > Reported and reviewed by: kp > Discussed with: np > Sponsored by: NVIDIA networking > Differential revision: https://reviews.freebsd.org/D46045 > --- > sys/netipsec/ipsec_offload.c | 58 +++++++++++++++++++++++++++++++---------= ---- > 1 file changed, 41 insertions(+), 17 deletions(-) >=20 > diff --git a/sys/netipsec/ipsec_offload.c b/sys/netipsec/ipsec_offload.c > index 48082830b88b..8ccae7a94f2a 100644 > --- a/sys/netipsec/ipsec_offload.c > +++ b/sys/netipsec/ipsec_offload.c > @@ -35,9 +35,12 @@ > #include > #include > #include > +#include > #include > #include >=20 > +#include > + > #include > #include > #include > @@ -190,6 +193,27 @@ ipsec_accel_fini(void *arg) > SYSUNINIT(ipsec_accel_fini, SI_SUB_VNET_DONE, SI_ORDER_ANY, > ipsec_accel_fini, NULL); >=20 > +SYSCTL_NODE(_net_inet_ipsec, OID_AUTO, offload, CTLFLAG_RW | CTLFLAG_MPSA= FE, 0, > + ""); > + > +static bool ipsec_offload_verbose =3D false; > +SYSCTL_BOOL(_net_inet_ipsec_offload, OID_AUTO, verbose, CTLFLAG_RW, > + &ipsec_offload_verbose, 0, > + "Verbose SA/SP offload install and deinstall"); > + > +static void > +dprintf(const char *fmt, ...) > +{ > + va_list ap; > + > + if (!ipsec_offload_verbose) > + return; > + > + va_start(ap, fmt); > + vprintf(fmt, ap); > + va_end(ap); > +} > + > static void > ipsec_accel_alloc_forget_tq(struct secasvar *sav) > { > @@ -209,7 +233,7 @@ ipsec_accel_sa_install_match(if_t ifp, void *arg) > if ((ifp->if_capenable2 & IFCAP2_BIT(IFCAP2_IPSEC_OFFLOAD)) =3D=3D 0) > return (false); > if (ifp->if_ipsec_accel_m->if_sa_newkey =3D=3D NULL) { > - printf("driver bug ifp %s if_sa_newkey NULL\n", > + dprintf("driver bug ifp %s if_sa_newkey NULL\n", > if_name(ifp)); > return (false); > } > @@ -226,7 +250,7 @@ ipsec_accel_sa_newkey_cb(if_t ifp, void *arg) >=20 > tq =3D arg; >=20 > - printf("ipsec_accel_sa_newkey_act: ifp %s h %p spi %#x " > + dprintf("ipsec_accel_sa_newkey_act: ifp %s h %p spi %#x " > "flags %#x seq %d\n", > if_name(ifp), ifp->if_ipsec_accel_m->if_sa_newkey, > be32toh(tq->sav->spi), tq->sav->flags, tq->sav->seq); > @@ -240,7 +264,7 @@ ipsec_accel_sa_newkey_cb(if_t ifp, void *arg) > } > if (drv_spi =3D=3D -1) { > /* XXXKIB */ > - printf("ipsec_accel_sa_install_newkey: cannot alloc " > + dprintf("ipsec_accel_sa_install_newkey: cannot alloc " > "drv_spi if %s spi %#x\n", if_name(ifp), > be32toh(tq->sav->spi)); > return (ENOMEM); > @@ -249,14 +273,14 @@ ipsec_accel_sa_newkey_cb(if_t ifp, void *arg) > drv_spi, &priv); > if (error !=3D 0) { > if (error =3D=3D EOPNOTSUPP) { > - printf("ipsec_accel_sa_newkey: driver " > + dprintf("ipsec_accel_sa_newkey: driver " > "refused sa if %s spi %#x\n", > if_name(ifp), be32toh(tq->sav->spi)); > error =3D ipsec_accel_handle_sav(tq->sav, > ifp, drv_spi, priv, IFP_HS_REJECTED, NULL); > /* XXXKIB */ > } else { > - printf("ipsec_accel_sa_newkey: driver " > + dprintf("ipsec_accel_sa_newkey: driver " > "error %d if %s spi %#x\n", > error, if_name(ifp), be32toh(tq->sav->spi)); > /* XXXKIB */ > @@ -266,7 +290,7 @@ ipsec_accel_sa_newkey_cb(if_t ifp, void *arg) > drv_spi, priv, IFP_HS_HANDLED, NULL); > if (error !=3D 0) { > /* XXXKIB */ > - printf("ipsec_accel_sa_newkey: handle_sav " > + dprintf("ipsec_accel_sa_newkey: handle_sav " > "err %d if %s spi %#x\n", error, > if_name(ifp), be32toh(tq->sav->spi)); > } > @@ -324,13 +348,13 @@ ipsec_accel_sa_newkey_impl(struct secasvar *sav) > SADB_KEY_ACCEL_DEINST)) !=3D 0) > return; >=20 > - printf( > + dprintf( > "ipsec_accel_sa_install_newkey: spi %#x flags %#x seq %d\n", > be32toh(sav->spi), sav->flags, sav->seq); >=20 > tq =3D malloc(sizeof(*tq), M_TEMP, M_NOWAIT); > if (tq =3D=3D NULL) { > - printf("ipsec_accel_sa_install_newkey: no memory for tq, " > + dprintf("ipsec_accel_sa_install_newkey: no memory for tq, " > "spi %#x\n", be32toh(sav->spi)); > /* XXXKIB */ > return; > @@ -403,7 +427,7 @@ ipsec_accel_forget_handle_sav(struct ifp_handle_sav *i= , bool freesav) > sav =3D i->sav; > if ((i->flags & (IFP_HS_HANDLED | IFP_HS_REJECTED)) =3D=3D > IFP_HS_HANDLED) { > - printf("sa deinstall %s %p spi %#x ifl %#x\n", > + dprintf("sa deinstall %s %p spi %#x ifl %#x\n", > if_name(ifp), sav, be32toh(sav->spi), i->flags); > ifp->if_ipsec_accel_m->if_sa_deinstall(ifp, > i->drv_spi, i->ifdata); > @@ -597,18 +621,18 @@ ipsec_accel_spdadd_cb(if_t ifp, void *arg) >=20 > sp =3D arg; > inp =3D sp->ipsec_accel_add_sp_inp; > - printf("ipsec_accel_spdadd_cb: ifp %s m %p sp %p inp %p\n", > + dprintf("ipsec_accel_spdadd_cb: ifp %s m %p sp %p inp %p\n", > if_name(ifp), ifp->if_ipsec_accel_m->if_spdadd, sp, inp); > error =3D ipsec_accel_remember_sp(sp, ifp, &i); > if (error !=3D 0) { > - printf("ipsec_accel_spdadd: %s if_spdadd %p remember res %d\n", > + dprintf("ipsec_accel_spdadd: %s if_spdadd %p remember res %d\n", > if_name(ifp), sp, error); > return (error); > } > error =3D ifp->if_ipsec_accel_m->if_spdadd(ifp, sp, inp, &i->ifdata); > if (error !=3D 0) { > i->flags |=3D IFP_HP_REJECTED; > - printf("ipsec_accel_spdadd: %s if_spdadd %p res %d\n", > + dprintf("ipsec_accel_spdadd: %s if_spdadd %p res %d\n", > if_name(ifp), sp, error); > } > return (error); > @@ -676,11 +700,11 @@ ipsec_accel_spddel_act(void *arg, int pending) > NET_EPOCH_WAIT(); > if ((i->flags & (IFP_HP_HANDLED | IFP_HP_REJECTED)) =3D=3D > IFP_HP_HANDLED) { > - printf("spd deinstall %s %p\n", if_name(i->ifp), sp); > + dprintf("spd deinstall %s %p\n", if_name(i->ifp), sp); > error =3D i->ifp->if_ipsec_accel_m->if_spddel(i->ifp, > sp, i->ifdata); > if (error !=3D 0) { > - printf( > + dprintf( > "ipsec_accel_spddel: %s if_spddel %p res %d\n", > if_name(i->ifp), sp, error); > } > @@ -741,12 +765,12 @@ ipsec_accel_on_ifdown_sp(struct ifnet *ifp) > NET_EPOCH_WAIT(); > if ((i->flags & (IFP_HP_HANDLED | IFP_HP_REJECTED)) =3D=3D > IFP_HP_HANDLED) { > - printf("spd deinstall %s %p\n", if_name(ifp), sp); > + dprintf("spd deinstall %s %p\n", if_name(ifp), sp); > error =3D ifp->if_ipsec_accel_m->if_spddel(ifp, > sp, i->ifdata); > } > if (error !=3D 0) { > - printf( > + dprintf( > "ipsec_accel_on_ifdown_sp: %s if_spddel %p res %d\n", > if_name(ifp), sp, error); > } > @@ -894,7 +918,7 @@ ipsec_accel_input(struct mbuf *m, int offset, int prot= o) >=20 > if (tag->drv_spi < IPSEC_ACCEL_DRV_SPI_MIN || > tag->drv_spi > IPSEC_ACCEL_DRV_SPI_MAX) { > - printf("if %s mbuf %p drv_spi %d invalid, packet dropped\n", > + dprintf("if %s mbuf %p drv_spi %d invalid, packet dropped\n", > (m->m_flags & M_PKTHDR) !=3D 0 ? if_name(m->m_pkthdr.rcvif) : > "", m, tag->drv_spi); > m_freem(m); >=20