/* efx_mdio_set_settings - Set (some of) the PHY settings over MDIO. @efx: Efx NIC @ecmd: New settings  */
int efx_mdio_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
/* efx_mdio_set_settings - Set (some of) the PHY settings over MDIO. @efx: Efx NIC @ecmd: New settings  */
int efx_mdio_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
{
	struct ethtool_cmd prev;
	efx->phy_op->get_settings(efx, &prev);
	if (ecmd->advertising == prev.advertising &&
	    ecmd->speed == prev.speed &&
	    ecmd->duplex == prev.duplex &&
	    ecmd->port == prev.port &&
	    ecmd->autoneg == prev.autoneg)
		return 0;
	if (prev.port != PORT_TP || ecmd->port != PORT_TP)
		return -EINVAL;
	if (!ecmd->autoneg ||
	    (ecmd->advertising | SUPPORTED_Autoneg) & ~prev.supported)
		return -EINVAL;
	efx_link_set_advertising(efx, ecmd->advertising | ADVERTISED_Autoneg);
	efx_mdio_an_reconfigure(efx);
	return 0;
}