diff options
author | Steve Hodgson <shodgson@solarflare.com> | 2009-11-28 00:34:05 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-29 02:58:50 -0500 |
commit | fdaa9aed21c8c8b529f3c94a5ffa138bf3360b75 (patch) | |
tree | 6db7fd76481b3f87f0f4e94e1bd55c0624fba296 /drivers/net/sfc/net_driver.h | |
parent | 5e7565930524410f097f5b04f8aba663089a6ffc (diff) |
sfc: Simplify PHY polling
Falcon can generate events for LASI interrupts from the PHY, but in
practice we have never implemented this in reference designs. Instead
we have polled, inserted the appropriate events, and then handled the
events later. This is a waste of time and code.
Instead, make PHY poll functions update the link state synchronously
and report whether it changed. We can still make use of the LASI
registers as a shortcut on the SFT9001.
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 | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h index ead1c982365b..fb9327c5ea57 100644 --- a/drivers/net/sfc/net_driver.h +++ b/drivers/net/sfc/net_driver.h | |||
@@ -503,6 +503,13 @@ struct efx_link_state { | |||
503 | unsigned int speed; | 503 | unsigned int speed; |
504 | }; | 504 | }; |
505 | 505 | ||
506 | static inline bool efx_link_state_equal(const struct efx_link_state *left, | ||
507 | const struct efx_link_state *right) | ||
508 | { | ||
509 | return left->up == right->up && left->fd == right->fd && | ||
510 | left->fc == right->fc && left->speed == right->speed; | ||
511 | } | ||
512 | |||
506 | /** | 513 | /** |
507 | * struct efx_mac_operations - Efx MAC operations table | 514 | * struct efx_mac_operations - Efx MAC operations table |
508 | * @reconfigure: Reconfigure MAC. Serialised by the mac_lock | 515 | * @reconfigure: Reconfigure MAC. Serialised by the mac_lock |
@@ -520,8 +527,8 @@ struct efx_mac_operations { | |||
520 | * @init: Initialise PHY | 527 | * @init: Initialise PHY |
521 | * @fini: Shut down PHY | 528 | * @fini: Shut down PHY |
522 | * @reconfigure: Reconfigure PHY (e.g. for new link parameters) | 529 | * @reconfigure: Reconfigure PHY (e.g. for new link parameters) |
523 | * @clear_interrupt: Clear down interrupt | 530 | * @poll: Update @link_state and report whether it changed. |
524 | * @poll: Poll for hardware state. Serialised by the mac_lock. | 531 | * Serialised by the mac_lock. |
525 | * @get_settings: Get ethtool settings. Serialised by the mac_lock. | 532 | * @get_settings: Get ethtool settings. Serialised by the mac_lock. |
526 | * @set_settings: Set ethtool settings. Serialised by the mac_lock. | 533 | * @set_settings: Set ethtool settings. Serialised by the mac_lock. |
527 | * @set_npage_adv: Set abilities advertised in (Extended) Next Page | 534 | * @set_npage_adv: Set abilities advertised in (Extended) Next Page |
@@ -538,8 +545,7 @@ struct efx_phy_operations { | |||
538 | int (*init) (struct efx_nic *efx); | 545 | int (*init) (struct efx_nic *efx); |
539 | void (*fini) (struct efx_nic *efx); | 546 | void (*fini) (struct efx_nic *efx); |
540 | void (*reconfigure) (struct efx_nic *efx); | 547 | void (*reconfigure) (struct efx_nic *efx); |
541 | void (*clear_interrupt) (struct efx_nic *efx); | 548 | bool (*poll) (struct efx_nic *efx); |
542 | void (*poll) (struct efx_nic *efx); | ||
543 | void (*get_settings) (struct efx_nic *efx, | 549 | void (*get_settings) (struct efx_nic *efx, |
544 | struct ethtool_cmd *ecmd); | 550 | struct ethtool_cmd *ecmd); |
545 | int (*set_settings) (struct efx_nic *efx, | 551 | int (*set_settings) (struct efx_nic *efx, |
@@ -700,10 +706,10 @@ union efx_multicast_hash { | |||
700 | * @mac_lock: MAC access lock. Protects @port_enabled, @phy_mode, | 706 | * @mac_lock: MAC access lock. Protects @port_enabled, @phy_mode, |
701 | * @port_inhibited, efx_monitor() and efx_reconfigure_port() | 707 | * @port_inhibited, efx_monitor() and efx_reconfigure_port() |
702 | * @port_enabled: Port enabled indicator. | 708 | * @port_enabled: Port enabled indicator. |
703 | * Serialises efx_stop_all(), efx_start_all(), efx_monitor(), | 709 | * Serialises efx_stop_all(), efx_start_all(), efx_monitor() and |
704 | * efx_phy_work(), and efx_mac_work() with kernel interfaces. Safe to read | 710 | * efx_mac_work() with kernel interfaces. Safe to read under any |
705 | * under any one of the rtnl_lock, mac_lock, or netif_tx_lock, but all | 711 | * one of the rtnl_lock, mac_lock, or netif_tx_lock, but all three must |
706 | * three must be held to modify it. | 712 | * be held to modify it. |
707 | * @port_inhibited: If set, the netif_carrier is always off. Hold the mac_lock | 713 | * @port_inhibited: If set, the netif_carrier is always off. Hold the mac_lock |
708 | * @port_initialized: Port initialized? | 714 | * @port_initialized: Port initialized? |
709 | * @net_dev: Operating system network device. Consider holding the rtnl lock | 715 | * @net_dev: Operating system network device. Consider holding the rtnl lock |
@@ -729,7 +735,6 @@ union efx_multicast_hash { | |||
729 | * @promiscuous: Promiscuous flag. Protected by netif_tx_lock. | 735 | * @promiscuous: Promiscuous flag. Protected by netif_tx_lock. |
730 | * @multicast_hash: Multicast hash table | 736 | * @multicast_hash: Multicast hash table |
731 | * @wanted_fc: Wanted flow control flags | 737 | * @wanted_fc: Wanted flow control flags |
732 | * @phy_work: work item for dealing with PHY events | ||
733 | * @mac_work: Work item for changing MAC promiscuity and multicast hash | 738 | * @mac_work: Work item for changing MAC promiscuity and multicast hash |
734 | * @loopback_mode: Loopback status | 739 | * @loopback_mode: Loopback status |
735 | * @loopback_modes: Supported loopback mode bitmask | 740 | * @loopback_modes: Supported loopback mode bitmask |
@@ -802,7 +807,6 @@ struct efx_nic { | |||
802 | 807 | ||
803 | enum phy_type phy_type; | 808 | enum phy_type phy_type; |
804 | spinlock_t phy_lock; | 809 | spinlock_t phy_lock; |
805 | struct work_struct phy_work; | ||
806 | struct efx_phy_operations *phy_op; | 810 | struct efx_phy_operations *phy_op; |
807 | void *phy_data; | 811 | void *phy_data; |
808 | struct mdio_if_info mdio; | 812 | struct mdio_if_info mdio; |