diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2009-11-28 22:42:41 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-29 19:46:28 -0500 |
commit | d3245b28ef2a45ec4e115062a38100bd06229289 (patch) | |
tree | 036133fdf01a20f36086d5eb8606728859c056de /drivers/net/sfc/net_driver.h | |
parent | ef2b90ee4dba7a3d9001f1f0003b860b39a4aaae (diff) |
sfc: Refactor link configuration
Refactor PHY, MAC and NIC configuration operations so that the
existing link configuration can be re-pushed with:
efx->phy_op->reconfigure(efx);
efx->mac_op->reconfigure(efx);
and a new configuration with:
efx->nic_op->reconfigure_port(efx);
(plus locking and error-checking).
We have not held the link settings in software (aside from flow
control), and have relied on asking the hardware what they are. This
is a problem because in some cases the hardware may no longer be in a
state to tell us. In particular, if an entire multi-port board is
reset through one port, the driver bindings to other ports have no
chance to save settings before recovering.
We only actually need to keep track of the autonegotiation settings,
so add an ethtool advertising mask to struct efx_nic, initialise it
in PHY init and update it as necessary.
Remove now-unneeded uses of efx_phy_op::{get,set}_settings() and
struct ethtool_cmd.
Much of this was done by Steve Hodgson <shodgson@solarflare.com>.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc/net_driver.h')
-rw-r--r-- | drivers/net/sfc/net_driver.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h index 32806f9a7e49..f63a05c4e38b 100644 --- a/drivers/net/sfc/net_driver.h +++ b/drivers/net/sfc/net_driver.h | |||
@@ -517,7 +517,7 @@ static inline bool efx_link_state_equal(const struct efx_link_state *left, | |||
517 | * @check_fault: Check fault state. True if fault present. | 517 | * @check_fault: Check fault state. True if fault present. |
518 | */ | 518 | */ |
519 | struct efx_mac_operations { | 519 | struct efx_mac_operations { |
520 | void (*reconfigure) (struct efx_nic *efx); | 520 | int (*reconfigure) (struct efx_nic *efx); |
521 | void (*update_stats) (struct efx_nic *efx); | 521 | void (*update_stats) (struct efx_nic *efx); |
522 | bool (*check_fault)(struct efx_nic *efx); | 522 | bool (*check_fault)(struct efx_nic *efx); |
523 | }; | 523 | }; |
@@ -544,7 +544,7 @@ struct efx_phy_operations { | |||
544 | enum efx_mac_type macs; | 544 | enum efx_mac_type macs; |
545 | int (*init) (struct efx_nic *efx); | 545 | int (*init) (struct efx_nic *efx); |
546 | void (*fini) (struct efx_nic *efx); | 546 | void (*fini) (struct efx_nic *efx); |
547 | void (*reconfigure) (struct efx_nic *efx); | 547 | int (*reconfigure) (struct efx_nic *efx); |
548 | bool (*poll) (struct efx_nic *efx); | 548 | bool (*poll) (struct efx_nic *efx); |
549 | void (*get_settings) (struct efx_nic *efx, | 549 | void (*get_settings) (struct efx_nic *efx, |
550 | struct ethtool_cmd *ecmd); | 550 | struct ethtool_cmd *ecmd); |
@@ -730,6 +730,7 @@ union efx_multicast_hash { | |||
730 | * @mdio: PHY MDIO interface | 730 | * @mdio: PHY MDIO interface |
731 | * @phy_mode: PHY operating mode. Serialised by @mac_lock. | 731 | * @phy_mode: PHY operating mode. Serialised by @mac_lock. |
732 | * @xmac_poll_required: XMAC link state needs polling | 732 | * @xmac_poll_required: XMAC link state needs polling |
733 | * @link_advertising: Autonegotiation advertising flags | ||
733 | * @link_state: Current state of the link | 734 | * @link_state: Current state of the link |
734 | * @n_link_state_changes: Number of times the link has changed state | 735 | * @n_link_state_changes: Number of times the link has changed state |
735 | * @promiscuous: Promiscuous flag. Protected by netif_tx_lock. | 736 | * @promiscuous: Promiscuous flag. Protected by netif_tx_lock. |
@@ -813,6 +814,7 @@ struct efx_nic { | |||
813 | enum efx_phy_mode phy_mode; | 814 | enum efx_phy_mode phy_mode; |
814 | 815 | ||
815 | bool xmac_poll_required; | 816 | bool xmac_poll_required; |
817 | u32 link_advertising; | ||
816 | struct efx_link_state link_state; | 818 | struct efx_link_state link_state; |
817 | unsigned int n_link_state_changes; | 819 | unsigned int n_link_state_changes; |
818 | 820 | ||
@@ -858,6 +860,7 @@ static inline const char *efx_dev_name(struct efx_nic *efx) | |||
858 | * @stop_stats: Stop the regular fetching of statistics | 860 | * @stop_stats: Stop the regular fetching of statistics |
859 | * @push_irq_moderation: Apply interrupt moderation value | 861 | * @push_irq_moderation: Apply interrupt moderation value |
860 | * @push_multicast_hash: Apply multicast hash table | 862 | * @push_multicast_hash: Apply multicast hash table |
863 | * @reconfigure_port: Push loopback/power/txdis changes to the MAC and PHY | ||
861 | * @default_mac_ops: efx_mac_operations to set at startup | 864 | * @default_mac_ops: efx_mac_operations to set at startup |
862 | * @revision: Hardware architecture revision | 865 | * @revision: Hardware architecture revision |
863 | * @mem_map_size: Memory BAR mapped size | 866 | * @mem_map_size: Memory BAR mapped size |
@@ -890,6 +893,7 @@ struct efx_nic_type { | |||
890 | void (*stop_stats)(struct efx_nic *efx); | 893 | void (*stop_stats)(struct efx_nic *efx); |
891 | void (*push_irq_moderation)(struct efx_channel *channel); | 894 | void (*push_irq_moderation)(struct efx_channel *channel); |
892 | void (*push_multicast_hash)(struct efx_nic *efx); | 895 | void (*push_multicast_hash)(struct efx_nic *efx); |
896 | int (*reconfigure_port)(struct efx_nic *efx); | ||
893 | struct efx_mac_operations *default_mac_ops; | 897 | struct efx_mac_operations *default_mac_ops; |
894 | 898 | ||
895 | int revision; | 899 | int revision; |