Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Mar 2023 14:46:55 GMT
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 084846271a75 - main - ktls: Use IfAPI accessors to get capabilities
Message-ID:  <202303071446.327EktcG008788@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by jhibbits:

URL: https://cgit.FreeBSD.org/src/commit/?id=084846271a75d30e94070d0681ca900438c09f05

commit 084846271a75d30e94070d0681ca900438c09f05
Author:     Justin Hibbits <jhibbits@FreeBSD.org>
AuthorDate: 2023-03-06 18:28:26 +0000
Commit:     Justin Hibbits <jhibbits@FreeBSD.org>
CommitDate: 2023-03-07 14:47:00 +0000

    ktls: Use IfAPI accessors to get capabilities
    
    Summary:
    Avoid referencing the ifnet struct directly, and use the IfAPI accessors
    instead.
    
    Reviewed by:    gallatin
    Sponsored by:   Juniper Networks, Inc.
    Differential Revision: https://reviews.freebsd.org/D38932
---
 sys/kern/uipc_ktls.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c
index cb2e3f272774..5b41cd3f829f 100644
--- a/sys/kern/uipc_ktls.c
+++ b/sys/kern/uipc_ktls.c
@@ -900,7 +900,7 @@ ktls_alloc_snd_tag(struct inpcb *inp, struct ktls_session *tls, bool force,
 	 * existing pacing rate.
 	 */
 	if (tp->t_pacing_rate != -1 &&
-	    (ifp->if_capenable & IFCAP_TXTLS_RTLMT) != 0) {
+	    (if_getcapenable(ifp) & IFCAP_TXTLS_RTLMT) != 0) {
 		params.hdr.type = IF_SND_TAG_TYPE_TLS_RATE_LIMIT;
 		params.tls_rate_limit.inp = inp;
 		params.tls_rate_limit.tls = tls;
@@ -915,17 +915,17 @@ ktls_alloc_snd_tag(struct inpcb *inp, struct ktls_session *tls, bool force,
 	params.hdr.numa_domain = inp->inp_numa_domain;
 	INP_RUNLOCK(inp);
 
-	if ((ifp->if_capenable & IFCAP_MEXTPG) == 0) {
+	if ((if_getcapenable(ifp) & IFCAP_MEXTPG) == 0) {
 		error = EOPNOTSUPP;
 		goto out;
 	}
 	if (inp->inp_vflag & INP_IPV6) {
-		if ((ifp->if_capenable & IFCAP_TXTLS6) == 0) {
+		if ((if_getcapenable(ifp) & IFCAP_TXTLS6) == 0) {
 			error = EOPNOTSUPP;
 			goto out;
 		}
 	} else {
-		if ((ifp->if_capenable & IFCAP_TXTLS4) == 0) {
+		if ((if_getcapenable(ifp) & IFCAP_TXTLS4) == 0) {
 			error = EOPNOTSUPP;
 			goto out;
 		}
@@ -1000,12 +1000,12 @@ ktls_alloc_rcv_tag(struct inpcb *inp, struct ktls_session *tls,
 	INP_RUNLOCK(inp);
 
 	if (inp->inp_vflag & INP_IPV6) {
-		if ((ifp->if_capenable2 & IFCAP2_RXTLS6) == 0) {
+		if ((if_getcapenable2(ifp) & IFCAP2_RXTLS6) == 0) {
 			error = EOPNOTSUPP;
 			goto out;
 		}
 	} else {
-		if ((ifp->if_capenable2 & IFCAP2_RXTLS4) == 0) {
+		if ((if_getcapenable2(ifp) & IFCAP2_RXTLS4) == 0) {
 			error = EOPNOTSUPP;
 			goto out;
 		}
@@ -1618,10 +1618,10 @@ ktls_reset_receive_tag(void *context, int pending)
 	INP_RUNLOCK(inp);
 
 	if (inp->inp_vflag & INP_IPV6) {
-		if ((ifp->if_capenable2 & IFCAP2_RXTLS6) == 0)
+		if ((if_getcapenable2(ifp) & IFCAP2_RXTLS6) == 0)
 			goto out;
 	} else {
-		if ((ifp->if_capenable2 & IFCAP2_RXTLS4) == 0)
+		if ((if_getcapenable2(ifp) & IFCAP2_RXTLS4) == 0)
 			goto out;
 	}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202303071446.327EktcG008788>