Rin Okuyama writes:
> Hi Andrius,
>
> If you still have this AQC100 in working condition, can you try this patch?
>
> https://gist.github.com/rokuyama/ab6ba1a0fac7fa15f243d63a99e14f33
>
> I've collected three fibre aq(4) variants (all rev 2), and link status
> interrupts work just fine for me. I think that link intr did not work for
> you, not due to fibre variant, but hardware revision. If this is correct,
> the patch above should work...
this reminded me that my aq(4) doesn't have working link and that
mlelstv suggested to me that the linux driver always uses a tick
timer to also check status, as well as interrupts. i implemented
this recently and now my aq(4) has link status correctly:
aq(4): always poll for link status
some devices don't have working link status and rather than have
a likely incomplete list of issues, always poll as well as use
the interrupt if possible.
fixes link status on this device:
aq0 at pci5 dev 0 function 0: Aquantia AQC107 10 Gigabit Network Adapter (rev.
0x02)
aq0: Atlantic revision B1, F/W version 3.1.88
(was otherwise functional, just didn't report status, which likely
meant eg, dhcpcd would be upset?)
idea via mlelstv@ from linux.
remove sc_detect_linkstat and rename sc_poll_linkstat to
sc_no_link_intr, as the meaning has changed. simplify the signature
for aq_setup_msix() and aq_establish_msix_intr(), removing forward
decls that aren't required. obsolete AQ_FORCE_POLL_LINKSTAT.
Index: if_aq.c
===
RCS file: /cvsroot/src/sys/dev/pci/if_aq.c,v
retrieving revision 1.45
diff -p -u -r1.45 if_aq.c
--- if_aq.c 29 May 2023 08:00:05 - 1.45
+++ if_aq.c 26 Oct 2023 06:55:28 -
@@ -1330,8 +1330,7 @@ struct aq_softc {
int sc_rx_irq[AQ_RSSQUEUE_MAX];
int sc_linkstat_irq;
bool sc_use_txrx_independent_intr;
- bool sc_poll_linkstat;
- bool sc_detect_linkstat;
+ bool sc_no_link_intr;
#if NSYSMON_ENVSYS > 0
struct sysmon_envsys *sc_sme;
@@ -1443,11 +1442,9 @@ static int aq_match(device_t, cfdata_t,
static void aq_attach(device_t, device_t, void *);
static int aq_detach(device_t, int);
-static int aq_setup_msix(struct aq_softc *, struct pci_attach_args *, int,
-bool, bool);
+static int aq_setup_msix(struct aq_softc *, struct pci_attach_args *);
static int aq_setup_legacy(struct aq_softc *, struct pci_attach_args *,
pci_intr_type_t);
-static int aq_establish_msix_intr(struct aq_softc *, bool, bool);
static int aq_ifmedia_change(struct ifnet * const);
static void aq_ifmedia_status(struct ifnet * const, struct ifmediareq *);
@@ -1784,67 +1781,57 @@ aq_attach(device_t parent, device_t self
if (msixcount >= (sc->sc_nqueues * 2 + 1)) {
/* TX intrs + RX intrs + LINKSTAT intrs */
sc->sc_use_txrx_independent_intr = true;
- sc->sc_poll_linkstat = false;
sc->sc_msix = true;
} else if (msixcount >= (sc->sc_nqueues * 2)) {
/* TX intrs + RX intrs */
sc->sc_use_txrx_independent_intr = true;
- sc->sc_poll_linkstat = true;
sc->sc_msix = true;
} else
#endif
if (msixcount >= (sc->sc_nqueues + 1)) {
/* TX/RX intrs LINKSTAT intrs */
sc->sc_use_txrx_independent_intr = false;
- sc->sc_poll_linkstat = false;
sc->sc_msix = true;
} else if (msixcount >= sc->sc_nqueues) {
/* TX/RX intrs */
sc->sc_use_txrx_independent_intr = false;
- sc->sc_poll_linkstat = true;
+ sc->sc_no_link_intr = true;
sc->sc_msix = true;
} else {
/* giving up using MSI-X */
sc->sc_msix = false;
}
- /* on AQ1a0, AQ2, or FIBRE, linkstat interrupt doesn't work? */
- if (aqp->aq_media_type == AQ_MEDIA_TYPE_FIBRE ||
- (HWTYPE_AQ1_P(sc) && FW_VERSION_MAJOR(sc) == 1) ||
- HWTYPE_AQ2_P(sc))
- sc->sc_poll_linkstat = true;
-
-#ifdef AQ_FORCE_POLL_LINKSTAT
- sc->sc_poll_linkstat = true;
-#endif
-
aprint_debug_dev(sc->sc_dev,
"ncpu=%d, pci_msix_count=%d."
" allocate %d interrupts for %d%s queues%s\n",
ncpu, msixcount,
(sc->sc_use_txrx_independent_intr ?
(sc->sc_nqueues * 2) : sc->sc_nqueues) +
- (sc->sc_poll_linkstat ? 0 : 1),
+ (sc->sc_no_link_intr ? 0 : 1),
sc->sc_nqueues,
sc->sc_use_txrx_independent_intr ? "*2" : "",
- sc->sc_poll_linkstat ? "" : ", and link status");
+ (sc->sc_no_link_intr) ? "" : ", and link status");
if (sc->sc_msix)
- error = aq_setup_msix(sc, pa, sc->sc_nqueues,
- sc->sc_use_txrx_independent_intr, !sc->sc_poll_linkstat);
+ error = aq_setup_msix(sc, pa);
else