From nobody Tue Feb 14 15:36:21 2023 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 4PGQKd4n3Yz3s50y; Tue, 14 Feb 2023 15:36:21 +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 4PGQKd20klz4LDc; Tue, 14 Feb 2023 15:36:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676388981; 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=CQ93FQ8oSS7E1Mjj2sgrQSb8iNgP418F2mJ5/EhAlHo=; b=hMccTEoorh+qMPfveBQHGVkRPgBELaPQd1FVxdHHCYzpXWpg/O9NfN63q+opjIw6fYVaSb zqBFPtt1jnhwxaxMOYlckTN3IP1aLA/+x3ODiRIoWuzOkiFZo6WdzAmLkflCNcFK008Ejh xk93yQxhxt3L7gEnSU+wL1zjA8Ir1nVsQWlnizSIzPXDc/qrksD7BSFlqi9ncJdC3c4IuC rrSQLeofdWI7lTtRJssuT+fTYAbENZ39a3lTl5pJtRSL3UDNdxRSCzEMXJtjdI/HATmGrP e1rfL3uQaArMojmjW71EDRHKObdhKDhZKreuCG8mYwUey06VCMDUcM6mD0Ktaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676388981; 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=CQ93FQ8oSS7E1Mjj2sgrQSb8iNgP418F2mJ5/EhAlHo=; b=L4LbGoxooTx7oW/+vjbTQyPqR1tWemXJMPRajpgNYT3GdliyqecIIYW5lGuKGhg/M0w9dk yuRm6R4OCep4d17kJfR3e8DfUVgFt7Ed8KTPSSLTqpVW0J//fnpy0oAa38/Cy6rdsyk5qe a+jliafWWhjUqkoQzvjBxVKMASsh8b3IKbrNwMVeBxSgTnHNrb+GVvi6tEM4xxcDCkoZol iwM0r/g8A+5fobgxcUMflVSkrEyDQf1HzpxNzTuxkgg2x4vICdvfi/5DYBC++3YV5WwqL1 WmaBhvzFtVv6gl+8Z/2+R4RqOFdbk0GjPR1NGz9MKaw5/jNGQad6L/s4/neVlA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676388981; a=rsa-sha256; cv=none; b=AyddBkef2FjkDV40tziP9NovPqjdIV15MVYzPZYqT7mBNea3X0eadqeyj/vGd31b9Sg85r 00C2hSpdF/kupxwBnRMrQQXVPHbFTJ5YQFO77nqVdU99zoaDM4hg2DAsY5TI/7iTrqDNda JDWcP/0SX2r3HlW/BSt3kPl5MER/sQ8SjM6RmdG7GKb2bI822d0ZX+x3jmjV7czm88XiFR wtRo2zsGkliLgYxZJDA30itB/mKHH6wwsJcTtbxGVmMSPKcakIt16unYc4GKa+7QTRp+A5 lU6/3jDG/GKAPKGikyrD82jIzFtHb1qjl7OgqUSkDgy4iWBheSSWlDtAlW6MoA== 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 4PGQKd0pvgz13Vg; Tue, 14 Feb 2023 15:36:21 +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 31EFaLvB043767; Tue, 14 Feb 2023 15:36:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31EFaLf9043766; Tue, 14 Feb 2023 15:36:21 GMT (envelope-from git) Date: Tue, 14 Feb 2023 15:36:21 GMT Message-Id: <202302141536.31EFaLf9043766@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: a3a76c3d9031 - main - IfAPI: Add capabilities2/capenable2 accessors 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: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a3a76c3d9031d5fa432145afc8493ebda97719ce Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=a3a76c3d9031d5fa432145afc8493ebda97719ce commit a3a76c3d9031d5fa432145afc8493ebda97719ce Author: Justin Hibbits AuthorDate: 2023-02-10 15:45:44 +0000 Commit: Justin Hibbits CommitDate: 2023-02-14 15:21:20 +0000 IfAPI: Add capabilities2/capenable2 accessors Summary: As a stopgap measure add basic accessors for the if_capabilities2 and if_capenable2 members to further hide the ifnet details. Sponsored by: Juniper Networks, Inc. Reviewed by: glebius, kib Differential Revision: https://reviews.freebsd.org/D38487 --- sys/net/if.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ sys/net/if_var.h | 7 +++++++ 2 files changed, 56 insertions(+) diff --git a/sys/net/if.c b/sys/net/if.c index d17738fda0b7..da684dedec73 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -4242,6 +4242,42 @@ if_setcapenablebit(if_t ifp, int setcap, int clearcap) return (0); } +int +if_setcapabilities2(if_t ifp, int capabilities) +{ + ifp->if_capabilities2 = capabilities; + return (0); +} + +int +if_setcapabilities2bit(if_t ifp, int setbit, int clearbit) +{ + ifp->if_capabilities2 &= ~clearbit; + ifp->if_capabilities2 |= setbit; + return (0); +} + +int +if_getcapabilities2(const if_t ifp) +{ + return (ifp->if_capabilities2); +} + +int +if_setcapenable2(if_t ifp, int capabilities2) +{ + ifp->if_capenable2 = capabilities2; + return (0); +} + +int +if_setcapenable2bit(if_t ifp, int setcap, int clearcap) +{ + ifp->if_capenable2 &= ~clearcap; + ifp->if_capenable2 |= setcap; + return (0); +} + const char * if_getdname(const if_t ifp) { @@ -4283,6 +4319,19 @@ if_getcapenable(const if_t ifp) return ((struct ifnet *)ifp)->if_capenable; } +int +if_togglecapenable2(if_t ifp, int togglecap) +{ + ifp->if_capenable2 ^= togglecap; + return (0); +} + +int +if_getcapenable2(const if_t ifp) +{ + return (ifp->if_capenable2); +} + int if_getdunit(const if_t ifp) { diff --git a/sys/net/if_var.h b/sys/net/if_var.h index f6bb77908d40..ef3e3d71a262 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -576,6 +576,13 @@ int if_togglecapenable(if_t ifp, int togglecap); int if_setcapenable(if_t ifp, int capenable); int if_setcapenablebit(if_t ifp, int setcap, int clearcap); int if_getcapenable(const if_t ifp); +int if_setcapabilities2(if_t ifp, int capabilities); +int if_setcapabilities2bit(if_t ifp, int setbit, int clearbit); +int if_getcapabilities2(const if_t ifp); +int if_togglecapenable2(if_t ifp, int togglecap); +int if_setcapenable2(if_t ifp, int capenable); +int if_setcapenable2bit(if_t ifp, int setcap, int clearcap); +int if_getcapenable2(const if_t ifp); int if_getdunit(const if_t ifp); int if_getindex(const if_t ifp); int if_getidxgen(const if_t ifp);