Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci firmware ver1 doesn't seem to work with linkstat...



details:   https://anonhg.NetBSD.org/src/rev/0ccf2ecc624a
branches:  trunk
changeset: 1025917:0ccf2ecc624a
user:      ryo <ryo%NetBSD.org@localhost>
date:      Sat Nov 13 21:38:48 2021 +0000

description:
firmware ver1 doesn't seem to work with linkstat interrupt, so in this case also set it to polling mode.

- Make the version acquisition (aq_fw_reset) timing earlier.
- Unmap registers when terminating with attach after failing to set interrupt

diffstat:

 sys/dev/pci/if_aq.c |  19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diffs (61 lines):

diff -r 8447ba1a0596 -r 0ccf2ecc624a sys/dev/pci/if_aq.c
--- a/sys/dev/pci/if_aq.c       Sat Nov 13 21:13:41 2021 +0000
+++ b/sys/dev/pci/if_aq.c       Sat Nov 13 21:38:48 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_aq.c,v 1.30 2021/11/11 06:56:56 ryo Exp $   */
+/*     $NetBSD: if_aq.c,v 1.31 2021/11/13 21:38:48 ryo Exp $   */
 
 /**
  * aQuantia Corporation Network Driver
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.30 2021/11/11 06:56:56 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.31 2021/11/13 21:38:48 ryo Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_aq.h"
@@ -1284,6 +1284,10 @@
                return;
        }
 
+       error = aq_fw_reset(sc);
+       if (error != 0)
+               goto attach_failure;
+
        sc->sc_nqueues = MIN(ncpu, AQ_RSSQUEUE_MAX);
 
        /* max queue num is 8, and must be 2^n */
@@ -1325,8 +1329,9 @@
                sc->sc_msix = false;
        }
 
-       /* XXX: on FIBRE, linkstat interrupt does not occur on boot? */
-       if (aqp->aq_media_type == AQ_MEDIA_TYPE_FIBRE)
+       /* on FW Ver1 or FIBRE, linkstat interrupt does not occur on boot? */
+       if (aqp->aq_media_type == AQ_MEDIA_TYPE_FIBRE ||
+           FW_VERSION_MAJOR(sc) == 1)
                sc->sc_poll_linkstat = true;
 
 #ifdef AQ_FORCE_POLL_LINKSTAT
@@ -1363,7 +1368,7 @@
                error = aq_setup_legacy(sc, pa, PCI_INTR_TYPE_INTX);
        }
        if (error != 0)
-               return;
+               goto attach_failure;
 
        callout_init(&sc->sc_tick_ch, 0);
        callout_setfunc(&sc->sc_tick_ch, aq_tick, sc);
@@ -1379,10 +1384,6 @@
        if (error != 0)
                goto attach_failure;
 
-       error = aq_fw_reset(sc);
-       if (error != 0)
-               goto attach_failure;
-
        error = aq_fw_version_init(sc);
        if (error != 0)
                goto attach_failure;



Home | Main Index | Thread Index | Old Index