git: 087f0d352ac6 - main - Mechanically convert bge(4) to DrvAPI

From: Justin Hibbits <jhibbits_at_FreeBSD.org>
Date: Tue, 31 Jan 2023 20:03:25 UTC
The branch main has been updated by jhibbits:

URL: https://cgit.FreeBSD.org/src/commit/?id=087f0d352ac6e949a51b3e7e0f696d10844e8ada

commit 087f0d352ac6e949a51b3e7e0f696d10844e8ada
Author:     Justin Hibbits <jhibbits@FreeBSD.org>
AuthorDate: 2022-08-19 19:16:26 +0000
Commit:     Justin Hibbits <jhibbits@FreeBSD.org>
CommitDate: 2023-01-31 20:02:18 +0000

    Mechanically convert bge(4) to DrvAPI
    
    Sponsored by:   Juniper Networks, Inc.
    Differential Revision: https://reviews.freebsd.org/D37842
---
 sys/dev/bge/if_bge.c    | 10 ++++++----
 sys/dev/bge/if_bgereg.h |  2 +-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/sys/dev/bge/if_bge.c b/sys/dev/bge/if_bge.c
index eb72af69a448..726f89379ad0 100644
--- a/sys/dev/bge/if_bge.c
+++ b/sys/dev/bge/if_bge.c
@@ -1922,6 +1922,7 @@ bge_blockinit(struct bge_softc *sc)
 {
 	struct bge_rcb *rcb;
 	bus_size_t vrcb;
+	caddr_t	lladdr;
 	bge_hostaddr taddr;
 	uint32_t dmactl, rdmareg, val;
 	int i, limit;
@@ -2268,11 +2269,12 @@ bge_blockinit(struct bge_softc *sc)
 	RCB_WRITE_4(sc, vrcb, bge_maxlen_flags,
 	    BGE_RCB_MAXLEN_FLAGS(sc->bge_return_ring_cnt, 0));
 
+	lladdr = if_getlladdr(sc->bge_ifp);
 	/* Set random backoff seed for TX */
 	CSR_WRITE_4(sc, BGE_TX_RANDOM_BACKOFF,
-	    (IF_LLADDR(sc->bge_ifp)[0] + IF_LLADDR(sc->bge_ifp)[1] +
-	    IF_LLADDR(sc->bge_ifp)[2] + IF_LLADDR(sc->bge_ifp)[3] +
-	    IF_LLADDR(sc->bge_ifp)[4] + IF_LLADDR(sc->bge_ifp)[5]) &
+	    (lladdr[0] + lladdr[1] +
+	    lladdr[2] + lladdr[3] +
+	    lladdr[4] + lladdr[5]) &
 	    BGE_TX_BACKOFF_SEED_MASK);
 
 	/* Set inter-packet gap */
@@ -5450,7 +5452,7 @@ bge_init_locked(struct bge_softc *sc)
 	    (if_getcapenable(ifp) & IFCAP_VLAN_MTU ? ETHER_VLAN_ENCAP_LEN : 0));
 
 	/* Load our MAC address. */
-	m = (uint16_t *)IF_LLADDR(sc->bge_ifp);
+	m = (uint16_t *)if_getlladdr(sc->bge_ifp);
 	CSR_WRITE_4(sc, BGE_MAC_ADDR1_LO, htons(m[0]));
 	CSR_WRITE_4(sc, BGE_MAC_ADDR1_HI, (htons(m[1]) << 16) | htons(m[2]));
 
diff --git a/sys/dev/bge/if_bgereg.h b/sys/dev/bge/if_bgereg.h
index 494b5f53694f..98cb76d96162 100644
--- a/sys/dev/bge/if_bgereg.h
+++ b/sys/dev/bge/if_bgereg.h
@@ -2942,7 +2942,7 @@ struct bge_bcom_hack {
 #define	ASF_STACKUP		4
 
 struct bge_softc {
-	struct ifnet		*bge_ifp;	/* interface info */
+	if_t			bge_ifp;	/* interface info */
 	device_t		bge_dev;
 	struct mtx		bge_mtx;
 	device_t		bge_miibus;