git: 2c65b27619b4 - main - net/aquantia-atlantic-kmod: Remove unused DRIVER_MODULE devclass on recent main.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Fri, 20 May 2022 17:14:31 UTC
The branch main has been updated by jhb (doc, src committer):

URL: https://cgit.FreeBSD.org/ports/commit/?id=2c65b27619b4a41314c9d57145a76f3d80fc0e9f

commit 2c65b27619b4a41314c9d57145a76f3d80fc0e9f
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-05-20 17:11:32 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-05-20 17:11:32 +0000

    net/aquantia-atlantic-kmod: Remove unused DRIVER_MODULE devclass on recent main.
    
    While here, stop disabling -Werror and fix various fatal warnings on
    head including fixing the type of the last arg to the multiaddr
    callback and removing various unused variables.
    
    Reviewed by:    bofh (maintainer)
    Differential Revision:  https://reviews.freebsd.org/D35200
---
 net/aquantia-atlantic-kmod/Makefile               |  3 -
 net/aquantia-atlantic-kmod/files/patch-aq__main.c | 82 +++++++++++++++++++++--
 net/aquantia-atlantic-kmod/files/patch-aq__ring.c | 23 +++++++
 3 files changed, 100 insertions(+), 8 deletions(-)

diff --git a/net/aquantia-atlantic-kmod/Makefile b/net/aquantia-atlantic-kmod/Makefile
index 3fb93576ff31..e0606201680c 100644
--- a/net/aquantia-atlantic-kmod/Makefile
+++ b/net/aquantia-atlantic-kmod/Makefile
@@ -16,9 +16,6 @@ GH_ACCOUNT=	Aquantia
 GH_PROJECT=	aqtion-freebsd
 GH_TAGNAME=	4816644
 
-# Strip -Werror from sys/conf/kmod.mk
-MAKE_ENV=	WERROR=""
-
 PLIST_FILES=	${KMODDIR}/if_atlantic.ko
 
 .include <bsd.port.mk>
diff --git a/net/aquantia-atlantic-kmod/files/patch-aq__main.c b/net/aquantia-atlantic-kmod/files/patch-aq__main.c
index f99c14376bb8..1f2353725bed 100644
--- a/net/aquantia-atlantic-kmod/files/patch-aq__main.c
+++ b/net/aquantia-atlantic-kmod/files/patch-aq__main.c
@@ -3,12 +3,71 @@ https://github.com/Aquantia/aqtion-freebsd/pull/11
 
 --- aq_main.c.orig	2019-09-24 14:45:34 UTC
 +++ aq_main.c
-@@ -735,6 +735,23 @@ static uint64_t aq_if_get_counter(if_ctx_t ctx, ift_co
+@@ -193,8 +193,12 @@ static driver_t aq_driver = {
+ 	"aq", aq_methods, sizeof(struct aq_dev),
+ };
+ 
++#if __FreeBSD_version >= 1400058
++DRIVER_MODULE(atlantic, pci, aq_driver, 0, 0);
++#else
+ static devclass_t aq_devclass;
+ DRIVER_MODULE(atlantic, pci, aq_driver, aq_devclass, 0, 0);
++#endif
+ 
+ MODULE_DEPEND(atlantic, pci, 1, 1, 1);
+ MODULE_DEPEND(atlantic, ether, 1, 1, 1);
+@@ -282,8 +286,6 @@ static struct if_shared_ctx aq_sctx_init = {
+ 	.isc_ntxd_default = {PAGE_SIZE / sizeof(aq_txc_desc_t) * 4},
+ };
+ 
+-if_shared_ctx_t aq_sctx = &aq_sctx_init;
+-
+ /*
+  * TUNEABLE PARAMETERS:
+  */
+@@ -300,7 +302,7 @@ static void *aq_register(device_t dev)
+  */
+ static void *aq_register(device_t dev)
+ {
+-	return (aq_sctx);
++	return (&aq_sctx_init);
+ }
+ 
+ static int aq_if_attach_pre(if_ctx_t ctx)
+@@ -417,13 +419,11 @@ static int aq_if_attach_post(if_ctx_t ctx)
+ static int aq_if_attach_post(if_ctx_t ctx)
+ {
+ 	struct aq_dev *softc;
+-	if_t ifp;
+ 	int rc;
+ 
+ 	AQ_DBG_ENTER();
+ 
+ 	softc = iflib_get_softc(ctx);
+-	ifp = iflib_get_ifp(ctx);
+ 	rc = 0;
+ 
+ 	aq_update_hw_stats(softc);
+@@ -635,13 +635,11 @@ static void aq_if_init(if_ctx_t ctx)
+ 	struct aq_dev *softc;
+ 	struct aq_hw *hw;
+ 	struct ifmediareq ifmr;
+-	struct ifnet *ifp;
+ 	int i, err;
+ 
+ 	AQ_DBG_ENTER();
+ 	softc = iflib_get_softc(ctx);
+ 	hw = &softc->hw;
+-	ifp = iflib_get_ifp(ctx);
+ 
+ 	err = aq_hw_init(&softc->hw, softc->hw.mac_addr, softc->msix,
+ 					softc->scctx->isc_intr == IFLIB_INTR_MSIX);
+@@ -735,6 +733,23 @@ static uint64_t aq_if_get_counter(if_ctx_t ctx, ift_co
  	}
  }
  
 +#if __FreeBSD_version >= 1300054
-+static u_int aq_mc_filter_apply(void *arg, struct sockaddr_dl *dl, int count)
++static u_int aq_mc_filter_apply(void *arg, struct sockaddr_dl *dl, u_int count)
 +{
 +	struct aq_dev *softc = arg;
 +	struct aq_hw *hw = &softc->hw;
@@ -20,14 +79,14 @@ https://github.com/Aquantia/aqtion-freebsd/pull/11
 +	mac_addr = LLADDR(dl);
 +	aq_hw_mac_addr_set(hw, mac_addr, count + 1);
 +
-+	aq_log_detail("set %d mc address %6D", count + 1, mac_addr, ":");
++	aq_log_detail("set %u mc address %6D", count + 1, mac_addr, ":");
 +	return (1);
 +}
 +#else
  static int aq_mc_filter_apply(void *arg, struct ifmultiaddr *ifma, int count)
  {
  	struct aq_dev *softc = arg;
-@@ -752,6 +769,7 @@ static int aq_mc_filter_apply(void *arg, struct ifmult
+@@ -752,6 +767,7 @@ static int aq_mc_filter_apply(void *arg, struct ifmult
  	aq_log_detail("set %d mc address %6D", count + 1, mac_addr, ":");
  	return (1);
  }
@@ -35,7 +94,7 @@ https://github.com/Aquantia/aqtion-freebsd/pull/11
  
  static bool aq_is_mc_promisc_required(struct aq_dev *softc)
  {
-@@ -764,15 +782,22 @@ static void aq_if_multi_set(if_ctx_t ctx)
+@@ -764,15 +780,22 @@ static void aq_if_multi_set(if_ctx_t ctx)
  	struct ifnet  *ifp = iflib_get_ifp(ctx);
  	struct aq_hw  *hw = &softc->hw;
  	AQ_DBG_ENTER();
@@ -59,3 +118,16 @@ https://github.com/Aquantia/aqtion-freebsd/pull/11
  	}
  	AQ_DBG_EXIT(0);
  }
+@@ -825,12 +848,10 @@ static int aq_if_promisc_set(if_ctx_t ctx, int flags)
+ static int aq_if_promisc_set(if_ctx_t ctx, int flags)
+ {
+ 	struct aq_dev *softc;
+-	struct ifnet *ifp;
+ 
+ 	AQ_DBG_ENTER();
+ 
+ 	softc = iflib_get_softc(ctx);
+-	ifp = iflib_get_ifp(softc->ctx);
+ 
+ 	aq_hw_set_promisc(&softc->hw, !!(flags & IFF_PROMISC),
+ 			  aq_is_vlan_promisc_required(softc),
diff --git a/net/aquantia-atlantic-kmod/files/patch-aq__ring.c b/net/aquantia-atlantic-kmod/files/patch-aq__ring.c
new file mode 100644
index 000000000000..bc01c89d484e
--- /dev/null
+++ b/net/aquantia-atlantic-kmod/files/patch-aq__ring.c
@@ -0,0 +1,23 @@
+--- aq_ring.c.orig	2022-05-13 21:22:45 UTC
++++ aq_ring.c
+@@ -456,8 +456,8 @@ static int aq_isc_txd_encap(void *arg, if_pkt_info_t p
+ 	aq_tx_desc_t *txd = NULL;
+ 	bus_dma_segment_t *segs;
+ 	qidx_t pidx;
+-	uint32_t hdrlen=0, pay_len, eop;
+-	uint8_t tx_cmd = 0, ct_en, ct_idx;
++	uint32_t hdrlen=0, pay_len;
++	uint8_t tx_cmd = 0;
+ 	int i, desc_count = 0;
+ 
+ 	AQ_DBG_ENTERA("[%d] start=%d", pi->ipi_qsidx, pi->ipi_pidx);
+@@ -469,9 +469,6 @@ static int aq_isc_txd_encap(void *arg, if_pkt_info_t p
+ 	AQ_DBG_PRINT("txc at 0x%p, txd at 0x%p len %d", txc, txd, pi->ipi_len);
+ 
+ 	pay_len = pi->ipi_len;
+-	eop = 0;
+-	ct_en = 0;
+-	ct_idx = 0;
+ 
+ 	txc->flags1 = 0U;
+ 	txc->flags2 = 0U;