aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/efx.c
diff options
context:
space:
mode:
authorSteve Hodgson <shodgson@solarflare.com>2009-11-28 00:34:05 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-29 02:58:50 -0500
commitfdaa9aed21c8c8b529f3c94a5ffa138bf3360b75 (patch)
tree6db7fd76481b3f87f0f4e94e1bd55c0624fba296 /drivers/net/sfc/efx.c
parent5e7565930524410f097f5b04f8aba663089a6ffc (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/efx.c')
-rw-r--r--drivers/net/sfc/efx.c35
1 files changed, 8 insertions, 27 deletions
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
index 1009d1eeba82..b5a7e91590dc 100644
--- a/drivers/net/sfc/efx.c
+++ b/drivers/net/sfc/efx.c
@@ -583,7 +583,7 @@ void efx_schedule_slow_fill(struct efx_rx_queue *rx_queue, int delay)
583 * netif_carrier_on/off) of the link status, and also maintains the 583 * netif_carrier_on/off) of the link status, and also maintains the
584 * link status's stop on the port's TX queue. 584 * link status's stop on the port's TX queue.
585 */ 585 */
586static void efx_link_status_changed(struct efx_nic *efx) 586void efx_link_status_changed(struct efx_nic *efx)
587{ 587{
588 struct efx_link_state *link_state = &efx->link_state; 588 struct efx_link_state *link_state = &efx->link_state;
589 589
@@ -675,19 +675,6 @@ void efx_reconfigure_port(struct efx_nic *efx)
675 mutex_unlock(&efx->mac_lock); 675 mutex_unlock(&efx->mac_lock);
676} 676}
677 677
678/* Asynchronous efx_reconfigure_port work item. To speed up efx_flush_all()
679 * we don't efx_reconfigure_port() if the port is disabled. Care is taken
680 * in efx_stop_all() and efx_start_port() to prevent PHY events being lost */
681static void efx_phy_work(struct work_struct *data)
682{
683 struct efx_nic *efx = container_of(data, struct efx_nic, phy_work);
684
685 mutex_lock(&efx->mac_lock);
686 if (efx->port_enabled)
687 __efx_reconfigure_port(efx);
688 mutex_unlock(&efx->mac_lock);
689}
690
691/* Asynchronous work item for changing MAC promiscuity and multicast 678/* Asynchronous work item for changing MAC promiscuity and multicast
692 * hash. Avoid a drain/rx_ingress enable by reconfiguring the current 679 * hash. Avoid a drain/rx_ingress enable by reconfiguring the current
693 * MAC directly. */ 680 * MAC directly. */
@@ -768,9 +755,6 @@ fail1:
768 return rc; 755 return rc;
769} 756}
770 757
771/* Allow efx_reconfigure_port() to be scheduled, and close the window
772 * between efx_stop_port and efx_flush_all whereby a previously scheduled
773 * efx_phy_work()/efx_mac_work() may have been cancelled */
774static void efx_start_port(struct efx_nic *efx) 758static void efx_start_port(struct efx_nic *efx)
775{ 759{
776 EFX_LOG(efx, "start port\n"); 760 EFX_LOG(efx, "start port\n");
@@ -787,10 +771,7 @@ static void efx_start_port(struct efx_nic *efx)
787 mutex_unlock(&efx->mac_lock); 771 mutex_unlock(&efx->mac_lock);
788} 772}
789 773
790/* Prevent efx_phy_work, efx_mac_work, and efx_monitor() from executing, 774/* Prevent efx_mac_work() and efx_monitor() from working */
791 * and efx_set_multicast_list() from scheduling efx_phy_work. efx_phy_work
792 * and efx_mac_work may still be scheduled via NAPI processing until
793 * efx_flush_all() is called */
794static void efx_stop_port(struct efx_nic *efx) 775static void efx_stop_port(struct efx_nic *efx)
795{ 776{
796 EFX_LOG(efx, "stop port\n"); 777 EFX_LOG(efx, "stop port\n");
@@ -1188,8 +1169,6 @@ static void efx_flush_all(struct efx_nic *efx)
1188 1169
1189 /* Stop scheduled port reconfigurations */ 1170 /* Stop scheduled port reconfigurations */
1190 cancel_work_sync(&efx->mac_work); 1171 cancel_work_sync(&efx->mac_work);
1191 cancel_work_sync(&efx->phy_work);
1192
1193} 1172}
1194 1173
1195/* Quiesce hardware and software without bringing the link down. 1174/* Quiesce hardware and software without bringing the link down.
@@ -1227,7 +1206,7 @@ static void efx_stop_all(struct efx_nic *efx)
1227 * window to loose phy events */ 1206 * window to loose phy events */
1228 efx_stop_port(efx); 1207 efx_stop_port(efx);
1229 1208
1230 /* Flush efx_phy_work, efx_mac_work, refill_workqueue, monitor_work */ 1209 /* Flush efx_mac_work(), refill_workqueue, monitor_work */
1231 efx_flush_all(efx); 1210 efx_flush_all(efx);
1232 1211
1233 /* Isolate the MAC from the TX and RX engines, so that queue 1212 /* Isolate the MAC from the TX and RX engines, so that queue
@@ -1907,6 +1886,10 @@ void efx_port_dummy_op_void(struct efx_nic *efx) {}
1907void efx_port_dummy_op_set_id_led(struct efx_nic *efx, enum efx_led_mode mode) 1886void efx_port_dummy_op_set_id_led(struct efx_nic *efx, enum efx_led_mode mode)
1908{ 1887{
1909} 1888}
1889bool efx_port_dummy_op_poll(struct efx_nic *efx)
1890{
1891 return false;
1892}
1910 1893
1911static struct efx_mac_operations efx_dummy_mac_operations = { 1894static struct efx_mac_operations efx_dummy_mac_operations = {
1912 .reconfigure = efx_port_dummy_op_void, 1895 .reconfigure = efx_port_dummy_op_void,
@@ -1915,9 +1898,8 @@ static struct efx_mac_operations efx_dummy_mac_operations = {
1915static struct efx_phy_operations efx_dummy_phy_operations = { 1898static struct efx_phy_operations efx_dummy_phy_operations = {
1916 .init = efx_port_dummy_op_int, 1899 .init = efx_port_dummy_op_int,
1917 .reconfigure = efx_port_dummy_op_void, 1900 .reconfigure = efx_port_dummy_op_void,
1918 .poll = efx_port_dummy_op_void, 1901 .poll = efx_port_dummy_op_poll,
1919 .fini = efx_port_dummy_op_void, 1902 .fini = efx_port_dummy_op_void,
1920 .clear_interrupt = efx_port_dummy_op_void,
1921}; 1903};
1922 1904
1923/************************************************************************** 1905/**************************************************************************
@@ -1957,7 +1939,6 @@ static int efx_init_struct(struct efx_nic *efx, struct efx_nic_type *type,
1957 efx->mac_op = &efx_dummy_mac_operations; 1939 efx->mac_op = &efx_dummy_mac_operations;
1958 efx->phy_op = &efx_dummy_phy_operations; 1940 efx->phy_op = &efx_dummy_phy_operations;
1959 efx->mdio.dev = net_dev; 1941 efx->mdio.dev = net_dev;
1960 INIT_WORK(&efx->phy_work, efx_phy_work);
1961 INIT_WORK(&efx->mac_work, efx_mac_work); 1942 INIT_WORK(&efx->mac_work, efx_mac_work);
1962 atomic_set(&efx->netif_stop_count, 1); 1943 atomic_set(&efx->netif_stop_count, 1);
1963 1944