lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+ZLECteuEZJM_4gtbxiEAAKbKnJ_3UfGN4zg_m2EVxk_9=WiA@mail.gmail.com>
Date:   Thu, 28 Nov 2019 18:19:14 +1100
From:   Sam Lewis <sam.vr.lewis@...il.com>
To:     steve.glendinning@...well.net, UNGLinuxDriver@...rochip.com
Cc:     netdev@...r.kernel.org
Subject: PROBLEM: smsc95xx loses config on link down/up

I'm using a LAN9514 chip in my embedded Linux device and have noticed
that changing Ethernet configuration (with ethtool for example) does
not persist after putting the link up.

I have tested this on kernel versions 4.14.0 and 5.0.0-36. As far as I
can tell the driver hasn't had any related fixes since 5.0.0, so I
don't think the behavior has changed in more recent kernel versions.

To demonstrate, what I mean, if I:

1) Take the link down (with `ip link set eth0 down`)
2) Turn auto-negotiation off (with `ethtool -s eth0 autoneg off`)
3) Take the link up (with `ip link set eth0 up`)

Then auto-negotiation is turned back on after the Ethernet interface
is brought back up. This seems to be true for any of the ethtool
configuration settings, like speed and duplex as well.

This is frustrating for a few reasons:

- I can't set the Ethernet configuration before I put the link up
- I can't use systemd .link files for managing link properties as they
seem to set the properties of the link before it's up

I've hacked through the driver code (without really knowing what I'm
doing, just adding various print statements) and I think this happens
because setting a link up causes the `smsc95xx_reset` function to be
called which seems to clear all configuration through:

1) Doing a PHY reset (with `smsc95xx_write_reg(dev, PM_CTRL, PM_CTL_PHY_RST_)`)
2) Doing (another?) PHY reset (with `smsc95xx_mdio_write(dev->net,
dev->mii.phy_id, MII_BMCR, BMCR_RESET)`)

I tested this by looking at the configuration through calling
`mii_ethtool_gset` before and after those two resets. After the
resets, it appears the configuration is cleared.

I'm using the LAN9514 without an attached EEPROM, so understand that
any settings set will not persist through a power cycle, but it would
still be nice if they persisted through setting the interface down and
then up. This seems to be the behavior on other Ethernet devices that
I've tried (even ones without NV storage), so maybe this is a bug with
the LAN95xx driver implementation?

It's very possible that I'm doing something wrong though, I'm happy to
hear if there's some other way to achieve what I'm trying to do.

If this is a real bug I'd be happy to take a look into trying to fix
it. Would it be acceptable to restore any configuration read from a
`mii_ethtool_gset` after the `smsc95xx_reset` is run?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ