Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Nov 2024 19:29:31 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: 84d7ec4c657f - main - bnxt: Use IfAPI accessors where able
Message-ID:  <202411131929.4ADJTV8g033339@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=84d7ec4c657f406c6cbd29baf32c8e057b663d17

commit 84d7ec4c657f406c6cbd29baf32c8e057b663d17
Author:     Justin Hibbits <jhibbits@FreeBSD.org>
AuthorDate: 2024-10-31 14:04:11 +0000
Commit:     Justin Hibbits <jhibbits@FreeBSD.org>
CommitDate: 2024-11-13 19:30:58 +0000

    bnxt: Use IfAPI accessors where able
    
    Summary:
    Don't directly access ifnet members, it's a private structure.
    
    Sponsored by:   Juniper Networks, Inc.
    Differential Revision: https://reviews.freebsd.org/D47353
---
 sys/dev/bnxt/bnxt_re/bnxt_re.h  | 4 ++--
 sys/dev/bnxt/bnxt_re/ib_verbs.c | 6 +++---
 sys/dev/bnxt/bnxt_re/main.c     | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/sys/dev/bnxt/bnxt_re/bnxt_re.h b/sys/dev/bnxt/bnxt_re/bnxt_re.h
index 56b3c8c0488c..fe7a27f4e216 100644
--- a/sys/dev/bnxt/bnxt_re/bnxt_re.h
+++ b/sys/dev/bnxt/bnxt_re/bnxt_re.h
@@ -946,8 +946,8 @@ int bnxt_re_setup_cnp_cos(struct bnxt_re_dev *rdev, bool reset);
 
 static inline enum ib_port_state bnxt_re_get_link_state(struct bnxt_re_dev *rdev)
 {
-	if (rdev->netdev->if_drv_flags & IFF_DRV_RUNNING &&
-	    rdev->netdev->if_link_state == LINK_STATE_UP)
+	if (if_getdrvflags(rdev->netdev) & IFF_DRV_RUNNING &&
+	    if_getlinkstate(rdev->netdev) == LINK_STATE_UP)
 		return IB_PORT_ACTIVE;
 	return IB_PORT_DOWN;
 }
diff --git a/sys/dev/bnxt/bnxt_re/ib_verbs.c b/sys/dev/bnxt/bnxt_re/ib_verbs.c
index 8d43fa96c048..0383a16757aa 100644
--- a/sys/dev/bnxt/bnxt_re/ib_verbs.c
+++ b/sys/dev/bnxt/bnxt_re/ib_verbs.c
@@ -299,7 +299,7 @@ int bnxt_re_query_port(struct ib_device *ibdev, u8 port_num,
 	if (port_attr->state == IB_PORT_ACTIVE)
 		port_attr->phys_state = IB_PORT_PHYS_STATE_LINK_UP;
 	port_attr->max_mtu = IB_MTU_4096;
-	port_attr->active_mtu = iboe_get_mtu(rdev->netdev->if_mtu);
+	port_attr->active_mtu = iboe_get_mtu(if_getmtu(rdev->netdev));
 	port_attr->gid_tbl_len = dev_attr->max_sgid;
 	port_attr->port_cap_flags = IB_PORT_CM_SUP | IB_PORT_REINIT_SUP |
 				    IB_PORT_DEVICE_MGMT_SUP |
@@ -2118,7 +2118,7 @@ static int bnxt_re_init_qp_attr(struct bnxt_re_qp *qp, struct bnxt_re_pd *pd,
 		qplqp->max_rd_atomic = dev_attr->max_qp_rd_atom;
 		qplqp->max_dest_rd_atomic = dev_attr->max_qp_init_rd_atom;
 	}
-	qplqp->mtu = ib_mtu_enum_to_int(iboe_get_mtu(rdev->netdev->if_mtu));
+	qplqp->mtu = ib_mtu_enum_to_int(iboe_get_mtu(if_getmtu(rdev->netdev)));
 	qplqp->dpi = &rdev->dpi_privileged; /* Doorbell page */
 	if (init_attr->create_flags) {
 		dev_dbg(rdev_to_dev(rdev),
@@ -2691,7 +2691,7 @@ int bnxt_re_modify_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr,
 
 	/* MTU settings allowed only during INIT -> RTR */
 	if (qp_attr->qp_state == IB_QPS_RTR) {
-		bnxt_re_init_qpmtu(qp, rdev->netdev->if_mtu, qp_attr_mask, qp_attr,
+		bnxt_re_init_qpmtu(qp, if_getmtu(rdev->netdev), qp_attr_mask, qp_attr,
 				   &is_qpmtu_high);
 		if (udata && !ib_copy_from_udata(&ureq, udata, sizeof(ureq))) {
 			if (ureq.comp_mask & BNXT_RE_COMP_MASK_MQP_EX_PATH_MTU_MASK) {
diff --git a/sys/dev/bnxt/bnxt_re/main.c b/sys/dev/bnxt/bnxt_re/main.c
index e6c6f754ea47..3d26d21f3fc7 100644
--- a/sys/dev/bnxt/bnxt_re/main.c
+++ b/sys/dev/bnxt/bnxt_re/main.c
@@ -4168,8 +4168,8 @@ static int bnxt_re_netdev_event(struct notifier_block *notifier,
 
 	dev_info(rdev_to_dev(rdev), "%s: Event = %s (0x%lx), rdev %s (real_dev %s)\n",
 		 __func__, bnxt_re_netevent(event), event,
-		 rdev ? rdev->netdev ? rdev->netdev->if_dname : "->netdev = NULL" : "= NULL",
-		 (real_dev == netdev) ? "= netdev" : real_dev->if_dname);
+		 rdev ? rdev->netdev ? if_getdname(rdev->netdev) : "->netdev = NULL" : "= NULL",
+		 (real_dev == netdev) ? "= netdev" : if_getdname(real_dev));
 
 	if (!test_bit(BNXT_RE_FLAG_IBDEV_REGISTERED, &rdev->flags))
 		goto exit;



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