Source-Changes-HG archive

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

[src/trunk]: src add support Aquantia AQC seriese 10G network adapters.



details:   https://anonhg.NetBSD.org/src/rev/6e4b0b3e003a
branches:  trunk
changeset: 466731:6e4b0b3e003a
user:      ryo <ryo%NetBSD.org@localhost>
date:      Wed Jan 01 10:11:21 2020 +0000

description:
add support Aquantia AQC seriese 10G network adapters.

this driver is based on the FreeBSD version https://github.com/Aquantia/aqtion-freebsd ,
but drastically rewritten for NetBSD.

diffstat:

 distrib/sets/lists/man/mi |     5 +-
 share/man/man4/Makefile   |     4 +-
 share/man/man4/aq.4       |    84 +
 sys/dev/pci/files.pci     |     8 +-
 sys/dev/pci/if_aq.c       |  4582 +++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 4679 insertions(+), 4 deletions(-)

diffs (truncated from 4747 to 300 lines):

diff -r 4a9994417efc -r 6e4b0b3e003a distrib/sets/lists/man/mi
--- a/distrib/sets/lists/man/mi Wed Jan 01 10:06:40 2020 +0000
+++ b/distrib/sets/lists/man/mi Wed Jan 01 10:11:21 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1667 2019/12/23 06:45:37 maxv Exp $
+# $NetBSD: mi,v 1.1668 2020/01/01 10:11:21 ryo Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -855,6 +855,7 @@
 ./usr/share/man/cat4/ams.0                     man-sys-catman          .cat
 ./usr/share/man/cat4/an.0                      man-sys-catman          .cat
 ./usr/share/man/cat4/aps.0                     man-sys-catman          .cat
+./usr/share/man/cat4/aq.0                      man-sys-catman          .cat
 ./usr/share/man/cat4/arc/intro.0               man-sys-catman          .cat
 ./usr/share/man/cat4/arcmsr.0                  man-sys-catman          .cat
 ./usr/share/man/cat4/arcofi.0                  man-sys-catman          .cat
@@ -4077,6 +4078,7 @@
 ./usr/share/man/html4/ams.html                 man-sys-htmlman         html
 ./usr/share/man/html4/an.html                  man-sys-htmlman         html
 ./usr/share/man/html4/aps.html                 man-sys-htmlman         html
+./usr/share/man/html4/aq.html                  man-sys-htmlman         html
 ./usr/share/man/html4/arc/intro.html           man-sys-htmlman         html
 ./usr/share/man/html4/arcmsr.html              man-sys-htmlman         html
 ./usr/share/man/html4/arcofi.html              man-sys-htmlman         html
@@ -6995,6 +6997,7 @@
 ./usr/share/man/man4/ams.4                     man-sys-man             .man
 ./usr/share/man/man4/an.4                      man-sys-man             .man
 ./usr/share/man/man4/aps.4                     man-sys-man             .man
+./usr/share/man/man4/aq.4                      man-sys-man             .man
 ./usr/share/man/man4/arc/intro.4               man-sys-man             .man
 ./usr/share/man/man4/arcmsr.4                  man-sys-man             .man
 ./usr/share/man/man4/arcofi.4                  man-sys-man             .man
diff -r 4a9994417efc -r 6e4b0b3e003a share/man/man4/Makefile
--- a/share/man/man4/Makefile   Wed Jan 01 10:06:40 2020 +0000
+++ b/share/man/man4/Makefile   Wed Jan 01 10:11:21 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.692 2019/12/23 06:45:37 maxv Exp $
+#      $NetBSD: Makefile,v 1.693 2020/01/01 10:11:21 ryo Exp $
 #      @(#)Makefile    8.1 (Berkeley) 6/18/93
 
 MAN=   aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
@@ -6,7 +6,7 @@
        adc.4 adm1026hm.4 admtemp.4 adv.4 adw.4 age.4 agp.4 agr.4 ahb.4 ahc.4 \
        ahcisata.4 ahd.4 aibs.4 alc.4 ale.4 alipm.4 altmem.4 altq.4 \
        am2315temp.4 amdpm.4 amdtemp.4 amhphy.4 amr.4 aps.4 asus.4 \
-       an.4 arcmsr.4 arcofi.4 aria.4 artsata.4 ata.4 atalk.4 ataraid.4 \
+       an.4 aq.4 arcmsr.4 arcofi.4 aria.4 artsata.4 ata.4 atalk.4 ataraid.4 \
        ath.4 athn.4 atphy.4 atppc.4 attimer.4 atw.4 \
        auacer.4 audio.4 audiocs.4 auich.4 \
        auixp.4 autri.4 auvia.4 awi.4 azalia.4 \
diff -r 4a9994417efc -r 6e4b0b3e003a share/man/man4/aq.4
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/man/man4/aq.4       Wed Jan 01 10:11:21 2020 +0000
@@ -0,0 +1,84 @@
+.\"    $NetBSD: aq.4,v 1.1 2020/01/01 10:11:21 ryo Exp $
+.\"
+.\" Copyright (c) 2020 Ryo Shimizu <ryo%nerv.org@localhost>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+.\" DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd January 1, 2020
+.Dt AQ 4
+.Os
+.Sh NAME
+.Nm aq
+.Nd Aquantia AQC multigigabit Network driver
+.Sh SYNOPSIS
+.Cd "aq* at pci? dev ? function ?"
+.Sh DESCRIPTION
+The
+.Nm
+driver supports Aquantia AQC series controllers.
+Supported controllers include:
+.Pp
+.Bl -bullet -compact
+.It
+AQC107 10 Gigabit Network Adapter
+.It
+AQC108 5 Gigabit Network Adapter
+.It
+AQC109 2.5 Gigabit Network Adapter
+.It
+AQC111 5 Gigabit Network Adapter
+.It
+AQC112 2.5 Gigabit Network Adapter
+.It
+AQC107S 10 Gigabit Network Adapter
+.It
+AQC108S 5 Gigabit Network Adapter
+.It
+AQC109S 2.5 Gigabit Network Adapter
+.It
+AQC111S 5 Gigabit Network Adapter
+.It
+AQC112S 2.5 Gigabit Network Adapter
+.It
+D107 10 Gigabit Network Adapter
+.It
+D108 5 Gigabit Network Adapter
+.It
+D109 2.5 Gigabit Network Adapter
+.El
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr ifmedia 4 ,
+.Xr netintro 4 ,
+.Xr pci 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Nx 10.0 , and is based on the
+.Fx
+driver of the same name, but has been drastically rewritten by Ryo Shimizu.
+.Sh BUGS
+.Nm
+driver does not support the VLAN hardware filter.
diff -r 4a9994417efc -r 6e4b0b3e003a sys/dev/pci/files.pci
--- a/sys/dev/pci/files.pci     Wed Jan 01 10:06:40 2020 +0000
+++ b/sys/dev/pci/files.pci     Wed Jan 01 10:11:21 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.pci,v 1.418 2019/12/10 12:08:52 yamaguchi Exp $
+#      $NetBSD: files.pci,v 1.419 2020/01/01 10:11:21 ryo Exp $
 #
 # Config file and device description for machine-independent PCI code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -167,6 +167,12 @@
 attach mpii at pci
 file   dev/pci/mpii.c                  mpii
 
+# Aquantia/Atlantic 10-Gigabit Ethernet
+device aq: ether, ifnet, arp
+attach aq at pci
+file   dev/pci/if_aq.c                 aq
+defflag opt_if_aq.h    AQ_EVENT_COUNTERS
+
 # Ethernet driver for DC21040-based boards
 device de: ether, ifnet, arp
 attach de at pci
diff -r 4a9994417efc -r 6e4b0b3e003a sys/dev/pci/if_aq.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/pci/if_aq.c       Wed Jan 01 10:11:21 2020 +0000
@@ -0,0 +1,4582 @@
+/*     $NetBSD: if_aq.c,v 1.1 2020/01/01 10:11:21 ryo Exp $    */
+
+/**
+ * aQuantia Corporation Network Driver
+ * Copyright (C) 2014-2017 aQuantia Corporation. All rights reserved
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   (1) Redistributions of source code must retain the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer.
+ *
+ *   (2) Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials provided
+ *   with the distribution.
+ *
+ *   (3) The name of the author may not be used to endorse or promote
+ *   products derived from this software without specific prior
+ *   written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+/*-
+ * Copyright (c) 2020 Ryo Shimizu <ryo%nerv.org@localhost>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.1 2020/01/01 10:11:21 ryo Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_if_aq.h"
+#endif
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/bitops.h>
+#include <sys/cprng.h>
+#include <sys/cpu.h>
+#include <sys/interrupt.h>
+#include <sys/module.h>
+#include <sys/pcq.h>
+
+#include <net/bpf.h>
+#include <net/if.h>
+#include <net/if_dl.h>
+#include <net/if_media.h>
+#include <net/if_ether.h>
+#include <net/rss_config.h>
+
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcidevs.h>
+
+/* driver configuration */
+#define CONFIG_INTR_MODERATION_ENABLE  true    /* delayed interrupt */
+#undef CONFIG_LRO_SUPPORT                      /* no LRO not suppoted */
+#undef CONFIG_NO_TXRX_INDEPENDENT              /* share TX/RX interrupts */
+
+#define AQ_NINTR_MAX                   (AQ_RSSQUEUE_MAX + AQ_RSSQUEUE_MAX + 1)
+                                       /* TX + RX + LINK. must be <= 32 */
+#define AQ_LINKSTAT_IRQ                        31      /* for legacy mode */
+
+#define AQ_TXD_NUM                     2048    /* per ring. 8*n && 32~8184 */
+#define AQ_RXD_NUM                     2048    /* per ring. 8*n && 32~8184 */
+/* minimum required to send a packet (vlan needs additional TX descriptor) */
+#define AQ_TXD_MIN                     (1 + 1)
+
+
+/* hardware specification */
+#define AQ_RINGS_NUM                   32
+#define AQ_RSSQUEUE_MAX                        8
+#define AQ_RX_DESCRIPTOR_MIN           32
+#define AQ_TX_DESCRIPTOR_MIN           32
+#define AQ_RX_DESCRIPTOR_MAX           8184
+#define AQ_TX_DESCRIPTOR_MAX           8184
+#define AQ_TRAFFICCLASS_NUM            8
+#define AQ_RSS_HASHKEY_SIZE            40
+#define AQ_RSS_INDIRECTION_TABLE_MAX   64
+
+/*
+ * TERMINOLOGY
+ *     MPI = MAC PHY INTERFACE?
+ *     RPO = RX Protocol Offloading
+ *     TPO = TX Protocol Offloading
+ *     RPF = RX Packet Filter
+ *     TPB = TX Packet buffer
+ *     RPB = RX Packet buffer
+ */
+
+/* registers */
+#define AQ_FW_SOFTRESET_REG                    0x0000
+#define  AQ_FW_SOFTRESET_RESET                 __BIT(15) /* soft reset bit */
+#define  AQ_FW_SOFTRESET_DIS                   __BIT(14) /* reset disable */
+
+#define AQ_FW_VERSION_REG                      0x0018
+#define AQ_HW_REVISION_REG                     0x001c
+#define AQ_GLB_NVR_INTERFACE1_REG              0x0100
+



Home | Main Index | Thread Index | Old Index