The re(4) variant on the PC Engines APU1, RTL8111E, has a flexible LED configuration. The nic's default config seems to be intended for controlling 3 LEDs (or one single-colour and a bi-colour LED with different colours to indicate link speed) however the ethernet ports on the APU1 only have two LEDs (one green one amber).
Defaults can be changed in eeprom but (intentionally or not) this hasn't been done on the APU1 so in normal situations with a 1GB link, you only ever see one lit LED, and even that is normally off, only blinking for activity. I don't know of any APU users who like the default setup. Section 6.2.6 of the RTL8111E-VB-GR / -VB-CG / -VC-CG datasheet tells us how to reprogramme it. Do we want to change it? Without diff: green: normally off, blink on for activity. amber: on solid for 100MB link, off for 1GB link. With diff: green: normally on if link at any speed. blink off for activity. amber: on solid for 1GB link, otherwise off. Some other settings are possible but I think this gives the best combination of information under "normal" conditions given only 2 LEDs. Looking at unique "RTL8168E/8111E (0x2c00)" entries from dmesglog back to Feb 2013, there are 7 APUs (=21 NICs), and 20 non-APUs. Do we care if we change led state for those others too? We could check the MAC vendor for 00:0d:b9, but I think this is unnecessary complexity (and who knows, maybe it's an improvement for some of those too). Any comments/OKs? (I am not 100% happy with the clarity of the new CSR_WRITE_1 line, but my earlier iterations were worse ;) Index: re.c =================================================================== RCS file: /cvs/src/sys/dev/ic/re.c,v retrieving revision 1.190 diff -u -p -r1.190 re.c --- re.c 19 Mar 2016 11:34:22 -0000 1.190 +++ re.c 12 Apr 2016 21:09:53 -0000 @@ -1941,6 +1941,18 @@ re_init(struct ifnet *ifp) htole32(*(u_int32_t *)(&eaddr.eaddr[4]))); CSR_WRITE_4(sc, RL_IDR0, htole32(*(u_int32_t *)(&eaddr.eaddr[0]))); + /* + * Programme LEDs on 8168E/8111E to avoid poor default on + * PC Engines APU1. + */ + if (sc->sc_hwrev == RL_HWREV_8168E) { + CSR_SETBIT_1(sc, RL_CFG4, RL_CFG4_CUSTOM_LED); + CSR_WRITE_1(sc, RL_LEDSEL, RL_LED_ACT | RL_LED_LINK1000 | + RL_LED_LINK << 4); + } + /* + * Protect config register again + */ CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF); if ((sc->rl_flags & RL_FLAG_JUMBOV2) != 0) Index: rtl81x9reg.h =================================================================== RCS file: /cvs/src/sys/dev/ic/rtl81x9reg.h,v retrieving revision 1.97 diff -u -p -r1.97 rtl81x9reg.h --- rtl81x9reg.h 28 Dec 2015 05:49:15 -0000 1.97 +++ rtl81x9reg.h 12 Apr 2016 21:09:53 -0000 @@ -153,6 +153,16 @@ #define RL_MISC 0x00F0 /* + * Register used on RTL8111E + */ +#define RL_LEDSEL 0x0018 +#define RL_LED_LINK10 0x1 +#define RL_LED_LINK100 0x2 +#define RL_LED_LINK1000 0x4 +#define RL_LED_LINK RL_LED_LINK10 | RL_LED_LINK100 | RL_LED_LINK1000 +#define RL_LED_ACT 0x8 + +/* * TX config register bits */ #define RL_TXCFG_CLRABRT 0x00000001 /* retransmit aborted pkt */ @@ -449,6 +459,7 @@ /* * Config 4 register */ +#define RL_CFG4_CUSTOM_LED 0x40 #define RL_CFG4_LWPTN 0x04 #define RL_CFG4_LWPME 0x10 #define RL_CFG4_JUMBO_EN1 0x02