Page MenuHomeFreeBSD

alc(4): correctly detect link speed/state for CCR2004-1G-2XS-PCIe
Needs ReviewPublic

Authored by ryan_krammer.me on Thu, Aug 27, 7:04 PM.
Tags
None
Referenced Files
F169382023: D59228.diff
Tue, Sep 1, 9:20 AM
F169382006: D59228.diff
Tue, Sep 1, 9:19 AM
F169372055: D59228.id185234.diff
Tue, Sep 1, 8:43 AM
F169268346: D59228.diff
Tue, Sep 1, 2:37 AM
Unknown Object (File)
Mon, Aug 31, 4:33 AM
Unknown Object (File)
Mon, Aug 31, 1:49 AM
Unknown Object (File)
Sat, Aug 29, 2:56 AM
Unknown Object (File)
Sat, Aug 29, 2:25 AM
Subscribers

Details

Reviewers
ivy
Group Reviewers
network
Summary

This is the first in a series of patches to get the CCR2004-1G-2XS-PCIe card working correctly under FreeBSD. Currently, this card does not correctly come up under FreeBSD, does not pass traffic if it does come up, and can corrupt memory leading to hangs of other network drivers.

This patch does not yet allow the card to pass traffic or otherwise function correctly as an NIC, but it is a step in that direction.

This card lies about what it is - it's not actually an Atheros AR8151, but merely (badly) emulates one in firmware. There's no PHY here, and the emulated MDIO doesn't give back a usable answer as to the link speed. This patch skips mii_attach entirely, and reads the link state/speed out of a firmware register on the card that holds the real link speed.

Test Plan

Patch has been tested against FreeBSD 15.1-STABLE. The hardware configuration is an HP ProDesk SFF desktop computer, with an Intel Core i5-4570 CPU, 8 gigabytes of DDR3 RAM, and the CCR2004-1G-2XS-PCIe card under test running RouterOS 7.24, installed in the first PCI express slot.

Note that I have not tested this patch in a system with a real alc(4) card; I don't own one. However, all changes here are gated to by an existing flag to only operate when the CCR2004 card is detected.

Before the change (card is configured in 25GBASE mode):

$ ifconfig alc0
...
media: Ethernet autoselect (1000baseT <full-duplex,flowcontrol,master,rxpause,txpause>)

After the change (card is still configured in 25GBASE mode):

$ ifconfig alc0
...
media: Ethernet autoselect (25GBase-SR <full-duplex>)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 76226
Build 73109: arc lint + arc unit