int phy_start_cable_test(struct phy_device *phydev,
struct netlink_ext_ack *extack)
{
+ struct net_device *dev = phydev->attached_dev;
int err = -ENOMEM;
if (!(phydev->drv &&
/* Mark the carrier down until the test is complete */
phy_link_down(phydev, true);
+ netif_testing_on(dev);
err = phydev->drv->cable_test_start(phydev);
if (err) {
+ netif_testing_off(dev);
phy_link_up(phydev);
goto out_free;
}
*/
void phy_stop(struct phy_device *phydev)
{
+ struct net_device *dev = phydev->attached_dev;
+
if (!phy_is_started(phydev)) {
WARN(1, "called from state %s\n",
phy_state_to_str(phydev->state));
mutex_lock(&phydev->lock);
- if (phydev->state == PHY_CABLETEST)
+ if (phydev->state == PHY_CABLETEST) {
phy_abort_cable_test(phydev);
+ netif_testing_off(dev);
+ }
if (phydev->sfp_bus)
sfp_upstream_stop(phydev->sfp_bus);
struct delayed_work *dwork = to_delayed_work(work);
struct phy_device *phydev =
container_of(dwork, struct phy_device, state_queue);
+ struct net_device *dev = phydev->attached_dev;
bool needs_aneg = false, do_suspend = false;
enum phy_state old_state;
bool finished = false;
err = phydev->drv->cable_test_get_status(phydev, &finished);
if (err) {
phy_abort_cable_test(phydev);
+ netif_testing_off(dev);
needs_aneg = true;
phydev->state = PHY_UP;
break;
if (finished) {
ethnl_cable_test_finished(phydev);
+ netif_testing_off(dev);
needs_aneg = true;
phydev->state = PHY_UP;
}