Atlantic driver for FreeBSD
aquantia / aqtion-freebsd Goto Github PK
View Code? Open in Web Editor NEWAquantia AQC multigigabit NIC FreeBSD driver - development preview
License: Other
Aquantia AQC multigigabit NIC FreeBSD driver - development preview
License: Other
Building on FreeBSD 13.1 and 13.2 gives this warning:
--- aq_ring.o ---
aq_ring.c:364:37: warning: bitwise comparison always evaluates to false [-Wtautological-bitwise-compare]
if ((rx_desc->wb.pkt_type & 0x60) == 1) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
1 warning generated.
This looks like it really should be != 0
, but it could also be that it should be == 0
. Either way, this is a bug.
When tx/rx queue > 8, the driver seems to "eat" some packets. On the OS and tcpdump it shows the packets has been sent out, but in fact it doesn't.
Since iflib by default will allocate n = core count tx and rx queues, the current workaround is to add the following lines to /boot/loader.conf
to override ntxq and nrxq
dev.aq.X.iflib.override_nrxqs=8
dev.aq.X.iflib.override_ntxqs=8
Hi everyone,
I provided the following to two patches with their respective pull requests:
Current master does not compile under FreeBSD-13.0-RELEASE
aq_main.c:800:42: error: incompatible function pointer types passing 'u_int (void *, struct sockaddr_dl *, int)' (aka 'unsigned int (void *, struct sockaddr_dl *, int)') to parameter of type 'iflladdr_cb_t *' (aka 'unsigned int (*)(void *, struct sockaddr_dl *, unsigned int)') [-Werror,-Wincompatible-function-pointer-types]
if_foreach_llmaddr(iflib_get_ifp(ctx), aq_mc_filter_apply, softc);
^~~~~~~~~~~~~~~~~~
/usr/include/net/if_var.h:752:45: note: passing argument to parameter here
u_int if_foreach_llmaddr(if_t, iflladdr_cb_t, void *);
^
1 error generated.
*** [aq_main.o] Error code 1
make: stopped in /usr/home/sven/src/swuensch-aqtion-freebsd
1 error
Integration of ports tree patch to use arc4random()
New tag after successful merges
Cheers
Sven
Is VLAN support on the roadmap for this driver?
Kindly requesting the following device id to bind to driver:
Hardware: AQC113C on a QNAP QM2-2P10G1TB
Output of lspci
:
03:00.0 Ethernet controller: Aquantia Corp. Device 14c0 (rev 03)
Output of lspci -nvmms 03:00.0
:
Slot: 03:00.0
Class: 0200
Vendor: 1d6a
Device: 14c0
SVendor: 1baa
SDevice: c014
Rev: 03
Output of pciconf -lv
:
none0@pci0:3:0:0: class=0x020000 rev=0x03 hdr=0x00 vendor=0x1d6a device=0x14c0 subvendor=0x1baa subdevice=0xc014
vendor = 'Aquantia Corp.'
class = network
subclass = ethernet
Let me know if I can diagnose or provide more information.
Thank you!
I create a bridge interface on my FreeBSD system, alongside an Intel 1G port, with the aq 0interface as the only member, in order to attach jails VMs to serve over the aq0 interface and get higher performance.
# Bridges for VMs and jails
cloned_interfaces="bridge0 bridge1"
ifconfig_bridge0="inet 192.168.0.250/24 addm igb0 up"
ifconfig_bridge1="inet 192.168.0.244/24 addm aq0 up"
However when I add a VM or jail interface to bridge1, the aq0 interface goes into reset and traffic stops. I can see the firmware reloading again from flash, but the interface never comes back up properly and traffic stops.
If I restart the whole bridge the interface gets a full reset and traffic starts again, but will stop as soon as I try and start a jail or VM attached to bridge1.
Let me know if there's any other information I can provide.
Hi,
i do not know if this is the right place to ask, but:
I got a card which shows up on TrueNas 13 (FreeBSD 13.1-RELEASE-p9 FreeBSD 13.1-RELEASE-p9 n245429-296d095698e TRUENAS amd64) as
The vendor ID 0x1d6a is match, but i cannot find a macro for the device ID 0x00b1 in aq_main.c.
As the NIC works out of the box on other OS - to my knowledge without driver updates - i have hopes that the device could be supported (easily?) in FreeBSD as well.
I am completly new to FreeBSD but i am willing to support if possible. What can be done?
I have the latest 0.0.5 driver installed and the NIC showed up as aq0, but it would not become active. Instead it only displayed "No carrier". I had to switch back to the other NIC after extensive troubleshooting.
I was trying to build this for pfSense 2.4.4... took a while because "cc" is not available in FreeBSD 11+.
Please add a few more notes on building this package.
Here are my "random" steps to get it compiled on a pfSense VM.
##########
Using the guide here
https://docs.netgate.com/pfsense/en/latest/packages/installing-freebsd-packages.html
And downloading packages from here
curl -L -o FreeBSD-src https://github.com/pfsense/FreeBSD-src/archive/RELENG_2_4_4.zip
Move contents to /usr/src
# pkg add http://pkg.freebsd.org/freebsd:11:x86:64/latest/All/binutils-2.32_1,1.txz
# pkg add http://pkg.freebsd.org/freebsd:11:x86:64/latest/All/mpfr-4.0.2.txz
# pkg add http://pkg.freebsd.org/freebsd:11:x86:64/latest/All/mpc-1.1.0_2.txz
# pkg add http://pkg.freebsd.org/freebsd:11:x86:64/latest/All/gcc9-9.2.0.txz
# pkg add http://pkg.freebsd.org/freebsd:11:x86:64/latest/All/gcc-9_4.txz
# pkg add http://pkg.freebsd.org/freebsd:11:x86:64/latest/All/cc65-2.18.txz
# pkg add http://pkg.freebsd.org/freebsd:11:x86:64/latest/All/gcc9-9.2.0.txz
Somewhere along the way...
# ln -s /usr/src/include/stdbool.h stdbool.h
# ln -s /usr/src/sys/sys/stdint.h stdint.h
# ln -s /usr/src/sys/sys/syslog.h syslog.h
# ln -s /usr/src/sys/sys/unistd.h unistd.h
# ln -s /usr/src/sys/sys/errno.h errno.h
# make COMPILER_TYPE=clang CC=clang
# make COMPILER_TYPE=clang CC=clang install
Some new APIs related to interface low-level addresses management were introduced starting from r353419 and the old APIs were deleted at r353868. And this module doesn't build since then.
This is a tentative patch; I'm not sure that this is correct (and I have no way to test it right now). It's just based on how the other drivers seem to have been changed for the new APIs. Hopefully this helps a little bit.
diff --git a/aq_main.c b/aq_main.c
index 206c3a2..7d47b20 100644
--- a/aq_main.c
+++ b/aq_main.c
@@ -735,18 +735,28 @@ static uint64_t aq_if_get_counter(if_ctx_t ctx, ift_counter cnt)
}
}
+#if __FreeBSD__ < 13
static int aq_mc_filter_apply(void *arg, struct ifmultiaddr *ifma, int count)
+#else
+static u_int aq_mc_filter_apply(void *arg, struct sockaddr_dl *sdl, u_int count)
+#endif
{
struct aq_dev *softc = arg;
struct aq_hw *hw = &softc->hw;
u8 *mac_addr = NULL;
+#if __FreeBSD__ < 13
if (ifma->ifma_addr->sa_family != AF_LINK)
return (0);
+#endif
if (count == AQ_HW_MAC_MAX)
return (0);
+#if __FreeBSD__ < 13
mac_addr = LLADDR((struct sockaddr_dl *)ifma->ifma_addr);
+#else
+ mac_addr = LLADDR(sdl);
+#endif
aq_hw_mac_addr_set(hw, mac_addr, count + 1);
aq_log_detail("set %d mc address %6D", count + 1, mac_addr, ":");
@@ -765,14 +775,22 @@ static void aq_if_multi_set(if_ctx_t ctx)
struct aq_hw *hw = &softc->hw;
AQ_DBG_ENTER();
+#if __FreeBSD__ < 13
softc->mcnt = if_multiaddr_count(iflib_get_ifp(ctx), AQ_HW_MAC_MAX);
+#else
+ softc->mcnt = if_llmaddr_count(iflib_get_ifp(ctx));
+#endif
if (softc->mcnt >= AQ_HW_MAC_MAX)
{
aq_hw_set_promisc(hw, !!(ifp->if_flags & IFF_PROMISC),
aq_is_vlan_promisc_required(softc),
!!(ifp->if_flags & IFF_ALLMULTI) || aq_is_mc_promisc_required(softc));
}else{
+#if __FreeBSD__ < 13
if_multi_apply(iflib_get_ifp(ctx), aq_mc_filter_apply, softc);
+#else
+ if_foreach_llmaddr(iflib_get_ifp(ctx), aq_mc_filter_apply, softc);
+#endif
}
AQ_DBG_EXIT(0);
}
I purchased Asus XG-C100F to connect Xigmanas (FreeBSD 12.1) to 10Gbe switch. Unfortunately, the if_atlantic.ko driver would not bind to the adapter. Adapter shows up via pciconf as class=0x020000 card=0x874a1043 chip=0x00b11d6a rev=0x02 hdr=0x00. However, from what I can surmise, the chip id 0x00b1 is not recognized by if_atlantic.ko driver. Compiling the driver after a port package pull to FreeBSD 12.1 did not work either. I replaced the ASUS card with a Sonnet Presto Solo 10GBaseT card and if_atlantic.ko driver binded and aq0 is the resulting network device. The Presto card has a chip ID of AQC107S, 0x87b1. I noticed that this id is in aq_main.c, but that 0x00b1 is not. I added a line of code to the Aquantia FreeBSD driver, recompiled, and now the driver binds to the card and it works. I added this line to aq_main.c PVID(AQUANTIA_VENDOR_ID, AQ_DEVICE_ID_AQC100, "Aquantia AQtion 10GbitFC Network Adapter") . Everything seems OK now.
Hi,
I'm new to freebsd. Can you please show me how to build this driver for Truenas 13?
After submitting the net/aquantia-atlantic-kmod v.0.0.5 port update the following pkg-fallout notification was received indicating a build failure on 13-CURRENT (i386/amd64)
--- aq_media.o ---
cc -O2 -pipe -fno-strict-aliasing -DIFLIB -ferror-limit=1 -D_KERNEL -DKLD_MODULE -nostdinc -I/usr/include -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -fno-common -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdebug-prefix-map=./machine=/usr/src/sys/amd64/include -fdebug-prefix-map=./x86=/usr/src/sys/x86/include -MD -MF.depend.aq_media.o -MTaq_media.o -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error-tautological-compare -Wno-error-empty-body -Wno-error-parentheses-equality -Wno-error-unused-function -Wno-error-pointer-sign -Wno-error-shift-negative-value -Wno-address-of-packed-member -Wno-format-zero-length -mno-aes -mno-avx -
std=iso9899:1999 -c aq_media.c -o aq_media.o
In file included from aq_media.c:44:
In file included from /usr/include/net/if_var.h:83:
/usr/include/sys/epoch.h:44:10: fatal error: 'opt_epoch.h' file not found
#include "opt_epoch.h"
^~~~~~~~~~~~~
--- aq_main.o ---
In file included from aq_main.c:61:
In file included from /usr/include/net/if_var.h:83:
/usr/include/sys/epoch.h:44:10: fatal error: 'opt_epoch.h' file not found
#include "opt_epoch.h"
^~~~~~~~~~~~~
Full log attached:
Is support for FreeBSD 13-CURRENT in the works? I tried this code with an AQN-108 adapter and encountered the following panic:
aq0: <Aquantia AQtion 5Gbit Network Adapter> mem 0xdfc40000-0xdfc4ffff,0xdfc50000-0xdfc50fff,0xdf800000-0xdfbfffff irq 16 at device 0.0 on pci1
panic: Assertion powerof2(sctx->isc_nrxd_max[i]) failed at /usr/src/sys/net/iflib.c:5292
cpuid = 2
time = 1562686162
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe00a274a110
vpanic() at vpanic+0x19d/frame 0xfffffe00a274a160
panic() at panic+0x43/frame 0xfffffe00a274a1c0
iflib_register() at iflib_register+0x347/frame 0xfffffe00a274a200
iflib_device_register() at iflib_device_register+0xa0/frame 0xfffffe00a274a590
iflib_device_attach() at iflib_device_attach+0xb7/frame 0xfffffe00a274a5c0
device_attach() at device_attach+0x3ce/frame 0xfffffe00a274a600
device_probe_and_attach() at device_probe_and_attach+0x71/frame 0xfffffe00a274a630
pci_driver_added() at pci_driver_added+0xe6/frame 0xfffffe00a274a670
devclass_driver_added() at devclass_driver_added+0x7a/frame 0xfffffe00a274a6b0
devclass_add_driver() at devclass_add_driver+0x189/frame 0xfffffe00a274a6f0
module_register_init() at module_register_init+0xc0/frame 0xfffffe00a274a720
linker_load_module() at linker_load_module+0xbd8/frame 0xfffffe00a274aa50
kern_kldload() at kern_kldload+0xef/frame 0xfffffe00a274aaa0
sys_kldload() at sys_kldload+0x5b/frame 0xfffffe00a274aad0
amd64_syscall() at amd64_syscall+0x276/frame 0xfffffe00a274abf0
fast_syscall_common() at fast_syscall_common+0x101/frame 0xfffffe00a274abf0
--- syscall (304, FreeBSD ELF64, sys_kldload), rip = 0x8002dceea, rsp = 0x7fffffffe528, rbp = 0x7fffffffeaa0 ---
KDB: enter: panic
[ thread pid 1130 tid 100175 ]
Stopped at kdb_enter+0x3b: movq $0,kdb_why
I have a recent ASUS XG-C100C. pciconf
(as well as the Windows-based FIrmware Update Tool, show it to have a Vendor ID of: 94c0
I've tried building the driver with this Vendor ID added to aq_main.c, and it builds and loads just fine. However, dmesg
reports via aq_log()
"FLB> F/W successfully loaded from flash." , but then immediately after, returns "-16", which I take to be wait_init_mac_firmware_(hw)
returning -EBUSY
. The only thing that wait_init_mac_firmware_()
does is loop until AQ_READ_REG(hw, 0x18)) != 0
or return -EBUSY
if nothing happens.
I'm guessing that the register is different for the new ACQ107 chip revision? Gonna go see if the linux driver has any clues, but I figured I'd leave this here in case anyone else is coming across this problem with the new batch.
Sabrent NT-SS5G is a USB 3.1 gen 1 to 5Gbit ethermet adapter.
I tried to compile and install if_atlantic.ko in freenas 11.3 but it did not recognize this adapter.
The if_atlantic.ko was however successful loaded.
note: I really tested the 5GB adapter but for some reason freenas 11.3 detects name 'Aquantia Sabrent 2.5G Network Adapter'
I succesfully testd it under windows 10 and then it is detected as 'Aquantia AQtion USB to 5GbE Adapter'
Output from freenas 11.3
uname -a
FreeBSD freenas.h1n.nl 11.3-RELEASE-p14 FreeBSD 11.3-RELEASE-p14 #0 r325575+c936002dbe2(HEAD): Mon Sep 28 10:46:56 EDT 2020 [email protected]:/freenas-releng/freenas/_BE/objs/freenas-releng/freenas/_BE/os/sys/FreeNAS.amd64 amd64
kldstat | grep if
5 1 0xffffffff8287c000 32cc8 if_bnxt.ko
6 1 0xffffffff828af000 2243e8 if_qlxgbe.ko
10 1 0xffffffff82bf2000 19c78 if_atlantic.ko
usbconfig -d ugen0.6 dump_device_desc
ugen0.6: <Aquantia Sabrent 2.5G Network Adapter> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=ON (224mA)
bLength = 0x0012
bDescriptorType = 0x0001
bcdUSB = 0x0320
bDeviceClass = 0x0000 <Probed by interface class>
bDeviceSubClass = 0x0000
bDeviceProtocol = 0x0000
bMaxPacketSize0 = 0x0009
idVendor = 0x2eca
idProduct = 0xc101
bcdDevice = 0x0101
iManufacturer = 0x0001 <Aquantia>
iProduct = 0x0002 <Sabrent 2.5G Network Adapter>
iSerialNumber = 0x0003 <0000009x>
bNumConfigurations = 0x0002
dmesg | grep usb
usbus0 on xhci0
usbus0: 5.0Gbps Super Speed USB v3.0
ugen0.1: <0x8086 XHCI root HUB> at usbus0
uhub0: <0x8086 XHCI root HUB, class 9/0, rev 3.00/1.00, addr 1> on usbus0
ugen0.2: <vendor 0x05e3 USB2.0 Hub> at usbus0
uhub1: <vendor 0x05e3 USB2.0 Hub, class 9/0, rev 2.00/32.98, addr 1> on usbus0
ugen0.3: <vendor 0x0557 product 0x7000> at usbus0
uhub2: <vendor 0x0557 product 0x7000, class 9/0, rev 2.00/0.00, addr 2> on usbus0
ugen0.4: <vendor 0x0557 product 0x2419> at usbus0
ukbd0: <vendor 0x0557 product 0x2419, class 0/0, rev 1.10/1.00, addr 3> on usbus0
ugen0.5: <vendor 0x05e3 USB2.0 Hub> at usbus0
uhub3: <vendor 0x05e3 USB2.0 Hub, class 9/0, rev 2.00/32.98, addr 4> on usbus0
ugen0.6: <Aquantia Sabrent 2.5G Network Adapter> at usbus0
ums0: <vendor 0x0557 product 0x2419, class 0/0, rev 1.10/1.00, addr 3> on usbus0
Hi I just built this on FreeBSD 13.2 though I did have some initial difficulty.
In file included from aq_hw.c:38:
/usr/include/sys/systm.h:426:1: error: static declaration of 'pause' follows non-static declaration
pause(const char *wmesg, int timo)
^
/usr/include/unistd.h:357:6: note: previous declaration is here
int pause(void);
Out of curiosity, I removed the include line for unistd.h from aq_hw.c and then tried the build again and it worked. Will this have any negative consequences or impact on the driver? It appears to be working well and doesn't crash when I try to ping out on the interface like the freebsd pkg did when I tried it through pkg install.
`# make
Warning: Object directory not changed from original /root/git/aqtion-freebsd
cc -O2 -pipe -DIFLIB -ferror-limit=1 -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -nostdinc -I/usr/include -include /root/git/aqtion-freebsd/opt_global.h -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -fno-common -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdebug-prefix-map=./machine=/usr/src/sys/amd64/include -fdebug-prefix-map=./x86=/usr/src/sys/x86/include -MD -MF.depend.aq_main.o -MTaq_main.o -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=freebsd_kprintf -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error=tautological-compare -Wno-error=empty-body -Wno-error=parentheses-equality -Wno-error=unused-function -Wno-error=pointer-sign -Wno-error=shift-negative-value -Wno-address-of-packed-member -Wno-error=unused-but-set-variable -Wno-format-zero-length -mno-aes -mno-avx -std=iso9899:1999 -c aq_main.c -o aq_main.o
In file included from aq_main.c:43:
In file included from /usr/include/sys/bus.h:744:
./bus_if.h:1260:50: error: unknown type name 'device_property_type_t'
size_t _size, device_property_type_t type);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 errors generated.
*** Error code 1
Stop.
`
I recently committed this driver to FreeBSD ports: https://www.freshports.org/net/aquantia-atlantic-kmod/ and note that license (BSD3CLAUSE) information is only mentioned in source headers (which is fine).
It's desirable to also reference and include a license file in the FreeBSD package for this driver, and generally, good (best?) practice to include them in any projects source repositories root, for easy identification.
Could you please include a LICENSE file in this repository, such that we can reference it in the ports, and include it in the package.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.