Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Nov 2025 15:52:13 +0000
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Cc:        Olivier Cochard <olivier@FreeBSD.org>
Subject:   git: 4756f5ff8f10 - main - aq(4): Port to IfAPI
Message-ID:  <692c682d.3864c.1b910a79@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=4756f5ff8f10cdda925cab60c0b66606698e49ee

commit 4756f5ff8f10cdda925cab60c0b66606698e49ee
Author:     Olivier Cochard <olivier@FreeBSD.org>
AuthorDate: 2025-11-13 03:17:03 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2025-11-30 15:38:33 +0000

    aq(4): Port to IfAPI
    
    Direct access to struct ifnet members is not possible in FreeBSD 15;
    accessors must be used.  These exist in all supported FreeBSD versions,
    so we do not need to make this conditional.
---
 sys/dev/aq/aq_main.c  | 16 ++++++++--------
 sys/dev/aq/aq_media.c | 12 ++++++------
 sys/dev/aq/aq_ring.c  |  4 ++--
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/sys/dev/aq/aq_main.c b/sys/dev/aq/aq_main.c
index 299ed79f9094..7345c7cc2d03 100644
--- a/sys/dev/aq/aq_main.c
+++ b/sys/dev/aq/aq_main.c
@@ -379,7 +379,7 @@ static int aq_if_attach_pre(if_ctx_t ctx)
 #else
 	if_t ifp;
 	ifp = iflib_get_ifp(ctx);
-	ifp->if_capenable =  IFCAP_RXCSUM | IFCAP_TXCSUM | IFCAP_HWCSUM | IFCAP_TSO |
+	if_setcapenable(ifp,  IFCAP_RXCSUM | IFCAP_TXCSUM | IFCAP_HWCSUM | IFCAP_TSO |
 							  IFCAP_JUMBO_MTU | IFCAP_VLAN_HWFILTER |
 							  IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING |
 							  IFCAP_VLAN_HWCSUM;
@@ -718,7 +718,7 @@ static void aq_if_stop(if_ctx_t ctx)
 static uint64_t aq_if_get_counter(if_ctx_t ctx, ift_counter cnt)
 {
 	struct aq_dev *softc = iflib_get_softc(ctx);
-	struct ifnet *ifp = iflib_get_ifp(ctx);
+	if_t ifp = iflib_get_ifp(ctx);
 
 	switch (cnt) {
 	case IFCOUNTER_IERRORS:
@@ -776,7 +776,7 @@ static bool aq_is_mc_promisc_required(struct aq_dev *softc)
 static void aq_if_multi_set(if_ctx_t ctx)
 {
 	struct aq_dev *softc = iflib_get_softc(ctx);
-	struct ifnet  *ifp = iflib_get_ifp(ctx);
+	if_t ifp = iflib_get_ifp(ctx);
 	struct aq_hw  *hw = &softc->hw;
 	AQ_DBG_ENTER();
 #if __FreeBSD_version >= 1300054
@@ -786,9 +786,9 @@ static void aq_if_multi_set(if_ctx_t ctx)
 #endif
 	if (softc->mcnt >= AQ_HW_MAC_MAX)
 	{
-		aq_hw_set_promisc(hw, !!(ifp->if_flags & IFF_PROMISC),
+		aq_hw_set_promisc(hw, !!(if_getflags(ifp) & IFF_PROMISC),
 				  aq_is_vlan_promisc_required(softc),
-				  !!(ifp->if_flags & IFF_ALLMULTI) || aq_is_mc_promisc_required(softc));
+				  !!(if_getflags(ifp) & IFF_ALLMULTI) || aq_is_mc_promisc_required(softc));
 	}else{
 #if __FreeBSD_version >= 1300054
 		if_foreach_llmaddr(iflib_get_ifp(ctx), &aq_mc_filter_apply, softc);
@@ -810,7 +810,7 @@ static int aq_if_mtu_set(if_ctx_t ctx, uint32_t mtu)
 
 static void aq_if_media_status(if_ctx_t ctx, struct ifmediareq *ifmr)
 {
-	struct ifnet *ifp;
+	if_t ifp;
 
 	AQ_DBG_ENTER();
 
@@ -824,13 +824,13 @@ static void aq_if_media_status(if_ctx_t ctx, struct ifmediareq *ifmr)
 static int aq_if_media_change(if_ctx_t ctx)
 {
 	struct aq_dev *softc = iflib_get_softc(ctx);
-	struct ifnet *ifp = iflib_get_ifp(ctx);
+	if_t ifp = iflib_get_ifp(ctx);
 	int rc = 0;
 
 	AQ_DBG_ENTER();
 
 	/* Not allowd in UP state, since causes unsync of rings */
-	if ((ifp->if_flags & IFF_UP)){
+	if ((if_getflags(ifp) & IFF_UP)){
 		rc = EPERM;
 		goto exit;
 	}
diff --git a/sys/dev/aq/aq_media.c b/sys/dev/aq/aq_media.c
index 914d3d3eb940..fdf7ef38d2dc 100644
--- a/sys/dev/aq/aq_media.c
+++ b/sys/dev/aq/aq_media.c
@@ -94,9 +94,9 @@ void aq_mediastatus_update(aq_dev_t *aq_dev, u32 link_speed, const struct aq_hw_
 		aq_dev->media_active |= IFM_AUTO;
 }
 
-void aq_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
+void aq_mediastatus(if_t ifp, struct ifmediareq *ifmr)
 {
-	aq_dev_t *aq_dev = iflib_get_softc(ifp->if_softc);
+	aq_dev_t *aq_dev = iflib_get_softc(if_getsoftc(ifp));
 
 	ifmr->ifm_active = IFM_ETHER;
 	ifmr->ifm_status = IFM_AVALID;
@@ -107,11 +107,11 @@ void aq_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
 	ifmr->ifm_active |= aq_dev->media_active;
 }
 
-int aq_mediachange(struct ifnet *ifp)
+int aq_mediachange(if_t ifp)
 {
-	aq_dev_t          *aq_dev = iflib_get_softc(ifp->if_softc);
+	aq_dev_t          *aq_dev = iflib_get_softc(if_getsoftc(ifp));
 	struct aq_hw      *hw = &aq_dev->hw;
-	int                old_media_rate = ifp->if_baudrate;
+	int                old_media_rate = if_getbaudrate(ifp);
 	int                old_link_speed = hw->link_rate;
 	struct ifmedia    *ifm = iflib_get_media(aq_dev->ctx);
 	int                user_media = IFM_SUBTYPE(ifm->ifm_media);
@@ -169,7 +169,7 @@ int aq_mediachange(struct ifnet *ifp)
 	hw->fc.fc_tx = (ifm->ifm_media & IFM_ETH_TXPAUSE) ? 1 : 0;
 
 	/* In down state just remember new link speed */
-	if (!(ifp->if_flags & IFF_UP))
+	if (!(if_getflags(ifp) & IFF_UP))
 		return (0);
 
 	if ((media_rate != old_media_rate) || (hw->link_rate != old_link_speed)) {
diff --git a/sys/dev/aq/aq_ring.c b/sys/dev/aq/aq_ring.c
index 1de52ed0fc79..e20527b8c7c2 100644
--- a/sys/dev/aq/aq_ring.c
+++ b/sys/dev/aq/aq_ring.c
@@ -331,7 +331,7 @@ static int aq_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri)
 	aq_dev_t *aq_dev = arg;
 	struct aq_ring *ring = aq_dev->rx_rings[ri->iri_qsidx];
 	aq_rx_desc_t *rx_desc;
-	struct ifnet *ifp;
+	if_t ifp;
 	int cidx, rc = 0, i;
 	size_t len, total_len;
 
@@ -370,7 +370,7 @@ static int aq_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri)
 		cidx = aq_next(cidx, ring->rx_size - 1);
 	} while (!rx_desc->wb.eop);
 
-	if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) {
+	if ((if_getcapenable(ifp) & IFCAP_RXCSUM) != 0) {
 		aq_rx_set_cso_flags(rx_desc, ri);
 	}
 	ri->iri_rsstype = bsd_rss_type[rx_desc->wb.rss_type & 0xF];


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?692c682d.3864c.1b910a79>