Skip to content

Commit 24755e7

Browse files
committed
board/aarch64: add broken-flow-control interface quirk
Add new interface quirk to allow skipping disabling of flow control on all RPi 3B/4B devices that have the smsc95xx driver. Signed-off-by: Joachim Wiberg <[email protected]>
1 parent 4b55e38 commit 24755e7

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{
22
"eth0": {
3+
"comment": "Primary Ethernet controller, native BCM2711",
34
"phy-detached-when-down": true
45
},
56
"eth1": {
7+
"comment": "Second Ethernet controller on CM4 boards, attached over PCIe",
68
"phy-detached-when-down": true
79
}
810
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
22
"eth0": {
3+
"comment": "Primary Ethernet controller, native on BCM2711, and smsc95xx on BCM2837",
34
"phy-detached-when-down": true
5+
},
6+
"@ethtool:driver=smsc95xx": {
7+
"comment": "BCM2837 smsc95xx driver does not support disabling flow control",
8+
"broken-flow-control": true
49
}
510
}

src/confd/src/ieee802-ethernet-interface.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,26 +38,23 @@ static int netdag_gen_ethtool_flow_control(struct dagger *net, struct lyd_node *
3838
enum netdag_init phase = NETDAG_INIT_PHYS;
3939
FILE *fp;
4040

41+
/* Skip flow control configuration for NICs with broken support */
42+
if (iface_has_quirk(ifname, "broken-flow-control"))
43+
return 0;
44+
4145
if (iface_has_quirk(ifname, "phy-detached-when-down"))
4246
phase = NETDAG_INIT_POST;
4347

4448
fp = dagger_fopen_net_init(net, ifname, phase, "ethtool-flow-control.sh");
4549
if (!fp)
4650
return -EIO;
51+
52+
/* Check if the NIC supports pause frames at all */
4753
fprintf(fp, "[[ -n $(ethtool --json %s | jq '.[] | select(.\"supported-pause-frame-use\" == \"No\")') ]] && exit 0\n", ifname);
4854

49-
/*
50-
* Some NICs report "supported-pause-frame-use": "Symmetric Receive-only", like
51-
* RPi 3B's LAN78xx USB to Ethernet controller, but the drivers do not support
52-
* disabling it. This call is best effort after all, so we capture and check
53-
* the error. If the operation is not supported, we log it and exit cleanly.
54-
*/
55-
fprintf(fp,
56-
"if ! err=$(ethtool --pause %s autoneg %s rx off tx off 2>&1); then\n"
57-
" logger -it confd -p daemon.error \"%s: failed disabling flow-control\"\n"
58-
" echo \"$err\" | grep -q \"Operation not supported\" && exit 0\n"
59-
"fi\n",
60-
ifname, iface_uses_autoneg(cif) ? "on" : "off", ifname);
55+
/* Disable flow control */
56+
fprintf(fp, "ethtool --pause %s autoneg %s rx off tx off\n",
57+
ifname, iface_uses_autoneg(cif) ? "on" : "off");
6158
fclose(fp);
6259

6360
return 0;

0 commit comments

Comments
 (0)