diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2009-11-28 22:43:15 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-29 19:46:29 -0500 |
commit | eb9f6744cbfa97674c13263802259b5aa0034594 (patch) | |
tree | ae57310bc8fd9b7b21e6d6ca63853bcae002a5c2 /drivers/net/sfc/ethtool.c | |
parent | 89c758fa47b54d8ce10d2b39ed09de6da0ba4324 (diff) |
sfc: Implement ethtool reset operation
Refactor efx_reset_down() and efx_reset_up() accordingly.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc/ethtool.c')
-rw-r--r-- | drivers/net/sfc/ethtool.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/net/sfc/ethtool.c b/drivers/net/sfc/ethtool.c index b4c6ea1b9c07..29aa83c2a0d0 100644 --- a/drivers/net/sfc/ethtool.c +++ b/drivers/net/sfc/ethtool.c | |||
@@ -754,6 +754,35 @@ static int efx_ethtool_set_wol(struct net_device *net_dev, | |||
754 | return efx->type->set_wol(efx, wol->wolopts); | 754 | return efx->type->set_wol(efx, wol->wolopts); |
755 | } | 755 | } |
756 | 756 | ||
757 | extern int efx_ethtool_reset(struct net_device *net_dev, u32 *flags) | ||
758 | { | ||
759 | struct efx_nic *efx = netdev_priv(net_dev); | ||
760 | enum reset_type method; | ||
761 | enum { | ||
762 | ETH_RESET_EFX_INVISIBLE = (ETH_RESET_DMA | ETH_RESET_FILTER | | ||
763 | ETH_RESET_OFFLOAD | ETH_RESET_MAC) | ||
764 | }; | ||
765 | |||
766 | /* Check for minimal reset flags */ | ||
767 | if ((*flags & ETH_RESET_EFX_INVISIBLE) != ETH_RESET_EFX_INVISIBLE) | ||
768 | return -EINVAL; | ||
769 | *flags ^= ETH_RESET_EFX_INVISIBLE; | ||
770 | method = RESET_TYPE_INVISIBLE; | ||
771 | |||
772 | if (*flags & ETH_RESET_PHY) { | ||
773 | *flags ^= ETH_RESET_PHY; | ||
774 | method = RESET_TYPE_ALL; | ||
775 | } | ||
776 | |||
777 | if ((*flags & efx->type->reset_world_flags) == | ||
778 | efx->type->reset_world_flags) { | ||
779 | *flags ^= efx->type->reset_world_flags; | ||
780 | method = RESET_TYPE_WORLD; | ||
781 | } | ||
782 | |||
783 | return efx_reset(efx, method); | ||
784 | } | ||
785 | |||
757 | const struct ethtool_ops efx_ethtool_ops = { | 786 | const struct ethtool_ops efx_ethtool_ops = { |
758 | .get_settings = efx_ethtool_get_settings, | 787 | .get_settings = efx_ethtool_get_settings, |
759 | .set_settings = efx_ethtool_set_settings, | 788 | .set_settings = efx_ethtool_set_settings, |
@@ -784,4 +813,5 @@ const struct ethtool_ops efx_ethtool_ops = { | |||
784 | .get_ethtool_stats = efx_ethtool_get_stats, | 813 | .get_ethtool_stats = efx_ethtool_get_stats, |
785 | .get_wol = efx_ethtool_get_wol, | 814 | .get_wol = efx_ethtool_get_wol, |
786 | .set_wol = efx_ethtool_set_wol, | 815 | .set_wol = efx_ethtool_set_wol, |
816 | .reset = efx_ethtool_reset, | ||
787 | }; | 817 | }; |