aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2011-09-02 19:15:00 -0400
committerBen Hutchings <bhutchings@solarflare.com>2012-01-26 19:10:46 -0500
commit710b208dc2687fdb3370110d54a67fb2288835eb (patch)
treeb6a403a44f7832a469e31f91121e3eb2cff78c68
parent1cb345220f135dcca24f01cc04cbb97a8242d419 (diff)
sfc: Merge efx_mac_operations into efx_nic_type
No NICs need to switch efx_mac_operations at run-time, and the MAC operations are fairly closely bound to NIC types. Move efx_mac_operations::reconfigure to efx_nic_type::reconfigure_mac and efx_mac_operations::check_fault fo efx_nic_type::check_mac_fault. Change callers to call through efx->type or directly if the NIC type is known. Remove efx_mac_operations::update_stats. The implementations for Falcon used to fetch MAC statistics synchronously and this was used by efx_register_netdev() to clear statistics after running self-tests. However, it now only converts statistics that have already been fetched (and that only for Falcon), and the call from efx_register_netdev() has no effect. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
-rw-r--r--drivers/net/ethernet/sfc/efx.c17
-rw-r--r--drivers/net/ethernet/sfc/ethtool.c4
-rw-r--r--drivers/net/ethernet/sfc/falcon.c15
-rw-r--r--drivers/net/ethernet/sfc/falcon_xmac.c13
-rw-r--r--drivers/net/ethernet/sfc/mac.h21
-rw-r--r--drivers/net/ethernet/sfc/mcdi.h4
-rw-r--r--drivers/net/ethernet/sfc/mcdi_mac.c12
-rw-r--r--drivers/net/ethernet/sfc/net_driver.h21
-rw-r--r--drivers/net/ethernet/sfc/nic.h3
-rw-r--r--drivers/net/ethernet/sfc/selftest.c2
-rw-r--r--drivers/net/ethernet/sfc/siena.c4
11 files changed, 35 insertions, 81 deletions
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c
index 8f4cbb642bf2..1d20e01c6aea 100644
--- a/drivers/net/ethernet/sfc/efx.c
+++ b/drivers/net/ethernet/sfc/efx.c
@@ -900,7 +900,7 @@ static void efx_mac_work(struct work_struct *data)
900 mutex_lock(&efx->mac_lock); 900 mutex_lock(&efx->mac_lock);
901 if (efx->port_enabled) { 901 if (efx->port_enabled) {
902 efx->type->push_multicast_hash(efx); 902 efx->type->push_multicast_hash(efx);
903 efx->mac_op->reconfigure(efx); 903 efx->type->reconfigure_mac(efx);
904 } 904 }
905 mutex_unlock(&efx->mac_lock); 905 mutex_unlock(&efx->mac_lock);
906} 906}
@@ -941,7 +941,7 @@ static int efx_init_port(struct efx_nic *efx)
941 941
942 /* Reconfigure the MAC before creating dma queues (required for 942 /* Reconfigure the MAC before creating dma queues (required for
943 * Falcon/A1 where RX_INGR_EN/TX_DRAIN_EN isn't supported) */ 943 * Falcon/A1 where RX_INGR_EN/TX_DRAIN_EN isn't supported) */
944 efx->mac_op->reconfigure(efx); 944 efx->type->reconfigure_mac(efx);
945 945
946 /* Ensure the PHY advertises the correct flow control settings */ 946 /* Ensure the PHY advertises the correct flow control settings */
947 rc = efx->phy_op->reconfigure(efx); 947 rc = efx->phy_op->reconfigure(efx);
@@ -969,7 +969,7 @@ static void efx_start_port(struct efx_nic *efx)
969 /* efx_mac_work() might have been scheduled after efx_stop_port(), 969 /* efx_mac_work() might have been scheduled after efx_stop_port(),
970 * and then cancelled by efx_flush_all() */ 970 * and then cancelled by efx_flush_all() */
971 efx->type->push_multicast_hash(efx); 971 efx->type->push_multicast_hash(efx);
972 efx->mac_op->reconfigure(efx); 972 efx->type->reconfigure_mac(efx);
973 973
974 mutex_unlock(&efx->mac_lock); 974 mutex_unlock(&efx->mac_lock);
975} 975}
@@ -1807,7 +1807,7 @@ static int efx_change_mtu(struct net_device *net_dev, int new_mtu)
1807 /* Reconfigure the MAC before enabling the dma queues so that 1807 /* Reconfigure the MAC before enabling the dma queues so that
1808 * the RX buffers don't overflow */ 1808 * the RX buffers don't overflow */
1809 net_dev->mtu = new_mtu; 1809 net_dev->mtu = new_mtu;
1810 efx->mac_op->reconfigure(efx); 1810 efx->type->reconfigure_mac(efx);
1811 mutex_unlock(&efx->mac_lock); 1811 mutex_unlock(&efx->mac_lock);
1812 1812
1813 efx_init_channels(efx); 1813 efx_init_channels(efx);
@@ -1835,7 +1835,7 @@ static int efx_set_mac_address(struct net_device *net_dev, void *data)
1835 1835
1836 /* Reconfigure the MAC */ 1836 /* Reconfigure the MAC */
1837 mutex_lock(&efx->mac_lock); 1837 mutex_lock(&efx->mac_lock);
1838 efx->mac_op->reconfigure(efx); 1838 efx->type->reconfigure_mac(efx);
1839 mutex_unlock(&efx->mac_lock); 1839 mutex_unlock(&efx->mac_lock);
1840 1840
1841 return 0; 1841 return 0;
@@ -1949,10 +1949,6 @@ static int efx_register_netdev(struct efx_nic *efx)
1949 net_dev->netdev_ops = &efx_netdev_ops; 1949 net_dev->netdev_ops = &efx_netdev_ops;
1950 SET_ETHTOOL_OPS(net_dev, &efx_ethtool_ops); 1950 SET_ETHTOOL_OPS(net_dev, &efx_ethtool_ops);
1951 1951
1952 /* Clear MAC statistics */
1953 efx->mac_op->update_stats(efx);
1954 memset(&efx->mac_stats, 0, sizeof(efx->mac_stats));
1955
1956 rtnl_lock(); 1952 rtnl_lock();
1957 1953
1958 rc = dev_alloc_name(net_dev, net_dev->name); 1954 rc = dev_alloc_name(net_dev, net_dev->name);
@@ -2069,7 +2065,7 @@ int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok)
2069 "could not restore PHY settings\n"); 2065 "could not restore PHY settings\n");
2070 } 2066 }
2071 2067
2072 efx->mac_op->reconfigure(efx); 2068 efx->type->reconfigure_mac(efx);
2073 2069
2074 efx_init_channels(efx); 2070 efx_init_channels(efx);
2075 efx_restore_filters(efx); 2071 efx_restore_filters(efx);
@@ -2274,7 +2270,6 @@ static int efx_init_struct(struct efx_nic *efx, const struct efx_nic_type *type,
2274 efx->net_dev = net_dev; 2270 efx->net_dev = net_dev;
2275 spin_lock_init(&efx->stats_lock); 2271 spin_lock_init(&efx->stats_lock);
2276 mutex_init(&efx->mac_lock); 2272 mutex_init(&efx->mac_lock);
2277 efx->mac_op = type->default_mac_ops;
2278 efx->phy_op = &efx_dummy_phy_operations; 2273 efx->phy_op = &efx_dummy_phy_operations;
2279 efx->mdio.dev = net_dev; 2274 efx->mdio.dev = net_dev;
2280 INIT_WORK(&efx->mac_work, efx_mac_work); 2275 INIT_WORK(&efx->mac_work, efx_mac_work);
diff --git a/drivers/net/ethernet/sfc/ethtool.c b/drivers/net/ethernet/sfc/ethtool.c
index 55a25b14d304..1a7f7ba27bea 100644
--- a/drivers/net/ethernet/sfc/ethtool.c
+++ b/drivers/net/ethernet/sfc/ethtool.c
@@ -750,7 +750,7 @@ static int efx_ethtool_set_pauseparam(struct net_device *net_dev,
750 /* Recover by resetting the EM block */ 750 /* Recover by resetting the EM block */
751 falcon_stop_nic_stats(efx); 751 falcon_stop_nic_stats(efx);
752 falcon_drain_tx_fifo(efx); 752 falcon_drain_tx_fifo(efx);
753 efx->mac_op->reconfigure(efx); 753 falcon_reconfigure_xmac(efx);
754 falcon_start_nic_stats(efx); 754 falcon_start_nic_stats(efx);
755 } else { 755 } else {
756 /* Schedule a reset to recover */ 756 /* Schedule a reset to recover */
@@ -775,7 +775,7 @@ static int efx_ethtool_set_pauseparam(struct net_device *net_dev,
775 /* Reconfigure the MAC. The PHY *may* generate a link state change event 775 /* Reconfigure the MAC. The PHY *may* generate a link state change event
776 * if the user just changed the advertised capabilities, but there's no 776 * if the user just changed the advertised capabilities, but there's no
777 * harm doing this twice */ 777 * harm doing this twice */
778 efx->mac_op->reconfigure(efx); 778 efx->type->reconfigure_mac(efx);
779 779
780out: 780out:
781 mutex_unlock(&efx->mac_lock); 781 mutex_unlock(&efx->mac_lock);
diff --git a/drivers/net/ethernet/sfc/falcon.c b/drivers/net/ethernet/sfc/falcon.c
index 5c7548959dd7..1a8a316bb538 100644
--- a/drivers/net/ethernet/sfc/falcon.c
+++ b/drivers/net/ethernet/sfc/falcon.c
@@ -19,7 +19,6 @@
19#include "net_driver.h" 19#include "net_driver.h"
20#include "bitfield.h" 20#include "bitfield.h"
21#include "efx.h" 21#include "efx.h"
22#include "mac.h"
23#include "spi.h" 22#include "spi.h"
24#include "nic.h" 23#include "nic.h"
25#include "regs.h" 24#include "regs.h"
@@ -613,7 +612,7 @@ static void falcon_stats_complete(struct efx_nic *efx)
613 nic_data->stats_pending = false; 612 nic_data->stats_pending = false;
614 if (*nic_data->stats_dma_done == FALCON_STATS_DONE) { 613 if (*nic_data->stats_dma_done == FALCON_STATS_DONE) {
615 rmb(); /* read the done flag before the stats */ 614 rmb(); /* read the done flag before the stats */
616 efx->mac_op->update_stats(efx); 615 falcon_update_stats_xmac(efx);
617 } else { 616 } else {
618 netif_err(efx, hw, efx->net_dev, 617 netif_err(efx, hw, efx->net_dev,
619 "timed out waiting for statistics\n"); 618 "timed out waiting for statistics\n");
@@ -670,7 +669,7 @@ static int falcon_reconfigure_port(struct efx_nic *efx)
670 falcon_reset_macs(efx); 669 falcon_reset_macs(efx);
671 670
672 efx->phy_op->reconfigure(efx); 671 efx->phy_op->reconfigure(efx);
673 rc = efx->mac_op->reconfigure(efx); 672 rc = falcon_reconfigure_xmac(efx);
674 BUG_ON(rc); 673 BUG_ON(rc);
675 674
676 falcon_start_nic_stats(efx); 675 falcon_start_nic_stats(efx);
@@ -1218,7 +1217,7 @@ static void falcon_monitor(struct efx_nic *efx)
1218 falcon_deconfigure_mac_wrapper(efx); 1217 falcon_deconfigure_mac_wrapper(efx);
1219 1218
1220 falcon_reset_macs(efx); 1219 falcon_reset_macs(efx);
1221 rc = efx->mac_op->reconfigure(efx); 1220 rc = falcon_reconfigure_xmac(efx);
1222 BUG_ON(rc); 1221 BUG_ON(rc);
1223 1222
1224 falcon_start_nic_stats(efx); 1223 falcon_start_nic_stats(efx);
@@ -1676,7 +1675,7 @@ static void falcon_update_nic_stats(struct efx_nic *efx)
1676 *nic_data->stats_dma_done == FALCON_STATS_DONE) { 1675 *nic_data->stats_dma_done == FALCON_STATS_DONE) {
1677 nic_data->stats_pending = false; 1676 nic_data->stats_pending = false;
1678 rmb(); /* read the done flag before the stats */ 1677 rmb(); /* read the done flag before the stats */
1679 efx->mac_op->update_stats(efx); 1678 falcon_update_stats_xmac(efx);
1680 } 1679 }
1681} 1680}
1682 1681
@@ -1769,11 +1768,12 @@ const struct efx_nic_type falcon_a1_nic_type = {
1769 .push_irq_moderation = falcon_push_irq_moderation, 1768 .push_irq_moderation = falcon_push_irq_moderation,
1770 .push_multicast_hash = falcon_push_multicast_hash, 1769 .push_multicast_hash = falcon_push_multicast_hash,
1771 .reconfigure_port = falcon_reconfigure_port, 1770 .reconfigure_port = falcon_reconfigure_port,
1771 .reconfigure_mac = falcon_reconfigure_xmac,
1772 .check_mac_fault = falcon_xmac_check_fault,
1772 .get_wol = falcon_get_wol, 1773 .get_wol = falcon_get_wol,
1773 .set_wol = falcon_set_wol, 1774 .set_wol = falcon_set_wol,
1774 .resume_wol = efx_port_dummy_op_void, 1775 .resume_wol = efx_port_dummy_op_void,
1775 .test_nvram = falcon_test_nvram, 1776 .test_nvram = falcon_test_nvram,
1776 .default_mac_ops = &falcon_xmac_operations,
1777 1777
1778 .revision = EFX_REV_FALCON_A1, 1778 .revision = EFX_REV_FALCON_A1,
1779 .mem_map_size = 0x20000, 1779 .mem_map_size = 0x20000,
@@ -1811,12 +1811,13 @@ const struct efx_nic_type falcon_b0_nic_type = {
1811 .push_irq_moderation = falcon_push_irq_moderation, 1811 .push_irq_moderation = falcon_push_irq_moderation,
1812 .push_multicast_hash = falcon_push_multicast_hash, 1812 .push_multicast_hash = falcon_push_multicast_hash,
1813 .reconfigure_port = falcon_reconfigure_port, 1813 .reconfigure_port = falcon_reconfigure_port,
1814 .reconfigure_mac = falcon_reconfigure_xmac,
1815 .check_mac_fault = falcon_xmac_check_fault,
1814 .get_wol = falcon_get_wol, 1816 .get_wol = falcon_get_wol,
1815 .set_wol = falcon_set_wol, 1817 .set_wol = falcon_set_wol,
1816 .resume_wol = efx_port_dummy_op_void, 1818 .resume_wol = efx_port_dummy_op_void,
1817 .test_registers = falcon_b0_test_registers, 1819 .test_registers = falcon_b0_test_registers,
1818 .test_nvram = falcon_test_nvram, 1820 .test_nvram = falcon_test_nvram,
1819 .default_mac_ops = &falcon_xmac_operations,
1820 1821
1821 .revision = EFX_REV_FALCON_B0, 1822 .revision = EFX_REV_FALCON_B0,
1822 /* Map everything up to and including the RSS indirection 1823 /* Map everything up to and including the RSS indirection
diff --git a/drivers/net/ethernet/sfc/falcon_xmac.c b/drivers/net/ethernet/sfc/falcon_xmac.c
index 57434593f07b..6106ef15dee3 100644
--- a/drivers/net/ethernet/sfc/falcon_xmac.c
+++ b/drivers/net/ethernet/sfc/falcon_xmac.c
@@ -14,7 +14,6 @@
14#include "nic.h" 14#include "nic.h"
15#include "regs.h" 15#include "regs.h"
16#include "io.h" 16#include "io.h"
17#include "mac.h"
18#include "mdio_10g.h" 17#include "mdio_10g.h"
19#include "workarounds.h" 18#include "workarounds.h"
20 19
@@ -270,12 +269,12 @@ static bool falcon_xmac_link_ok_retry(struct efx_nic *efx, int tries)
270 return mac_up; 269 return mac_up;
271} 270}
272 271
273static bool falcon_xmac_check_fault(struct efx_nic *efx) 272bool falcon_xmac_check_fault(struct efx_nic *efx)
274{ 273{
275 return !falcon_xmac_link_ok_retry(efx, 5); 274 return !falcon_xmac_link_ok_retry(efx, 5);
276} 275}
277 276
278static int falcon_reconfigure_xmac(struct efx_nic *efx) 277int falcon_reconfigure_xmac(struct efx_nic *efx)
279{ 278{
280 struct falcon_nic_data *nic_data = efx->nic_data; 279 struct falcon_nic_data *nic_data = efx->nic_data;
281 280
@@ -290,7 +289,7 @@ static int falcon_reconfigure_xmac(struct efx_nic *efx)
290 return 0; 289 return 0;
291} 290}
292 291
293static void falcon_update_stats_xmac(struct efx_nic *efx) 292void falcon_update_stats_xmac(struct efx_nic *efx)
294{ 293{
295 struct efx_mac_stats *mac_stats = &efx->mac_stats; 294 struct efx_mac_stats *mac_stats = &efx->mac_stats;
296 295
@@ -361,9 +360,3 @@ void falcon_poll_xmac(struct efx_nic *efx)
361 nic_data->xmac_poll_required = !falcon_xmac_link_ok_retry(efx, 1); 360 nic_data->xmac_poll_required = !falcon_xmac_link_ok_retry(efx, 1);
362 falcon_ack_status_intr(efx); 361 falcon_ack_status_intr(efx);
363} 362}
364
365const struct efx_mac_operations falcon_xmac_operations = {
366 .reconfigure = falcon_reconfigure_xmac,
367 .update_stats = falcon_update_stats_xmac,
368 .check_fault = falcon_xmac_check_fault,
369};
diff --git a/drivers/net/ethernet/sfc/mac.h b/drivers/net/ethernet/sfc/mac.h
deleted file mode 100644
index d6a255d0856b..000000000000
--- a/drivers/net/ethernet/sfc/mac.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/****************************************************************************
2 * Driver for Solarflare Solarstorm network controllers and boards
3 * Copyright 2005-2006 Fen Systems Ltd.
4 * Copyright 2006-2009 Solarflare Communications Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation, incorporated herein by reference.
9 */
10
11#ifndef EFX_MAC_H
12#define EFX_MAC_H
13
14#include "net_driver.h"
15
16extern const struct efx_mac_operations falcon_xmac_operations;
17extern const struct efx_mac_operations efx_mcdi_mac_operations;
18extern int efx_mcdi_mac_stats(struct efx_nic *efx, dma_addr_t dma_addr,
19 u32 dma_len, int enable, int clear);
20
21#endif
diff --git a/drivers/net/ethernet/sfc/mcdi.h b/drivers/net/ethernet/sfc/mcdi.h
index aced2a7856fc..c59667bf64ac 100644
--- a/drivers/net/ethernet/sfc/mcdi.h
+++ b/drivers/net/ethernet/sfc/mcdi.h
@@ -126,5 +126,9 @@ extern int efx_mcdi_wol_filter_set_magic(struct efx_nic *efx,
126extern int efx_mcdi_wol_filter_get_magic(struct efx_nic *efx, int *id_out); 126extern int efx_mcdi_wol_filter_get_magic(struct efx_nic *efx, int *id_out);
127extern int efx_mcdi_wol_filter_remove(struct efx_nic *efx, int id); 127extern int efx_mcdi_wol_filter_remove(struct efx_nic *efx, int id);
128extern int efx_mcdi_wol_filter_reset(struct efx_nic *efx); 128extern int efx_mcdi_wol_filter_reset(struct efx_nic *efx);
129extern int efx_mcdi_mac_stats(struct efx_nic *efx, dma_addr_t dma_addr,
130 u32 dma_len, int enable, int clear);
131extern int efx_mcdi_mac_reconfigure(struct efx_nic *efx);
132extern bool efx_mcdi_mac_check_fault(struct efx_nic *efx);
129 133
130#endif /* EFX_MCDI_H */ 134#endif /* EFX_MCDI_H */
diff --git a/drivers/net/ethernet/sfc/mcdi_mac.c b/drivers/net/ethernet/sfc/mcdi_mac.c
index 85fe24f86396..4907062b24a2 100644
--- a/drivers/net/ethernet/sfc/mcdi_mac.c
+++ b/drivers/net/ethernet/sfc/mcdi_mac.c
@@ -9,7 +9,6 @@
9 9
10#include "net_driver.h" 10#include "net_driver.h"
11#include "efx.h" 11#include "efx.h"
12#include "mac.h"
13#include "mcdi.h" 12#include "mcdi.h"
14#include "mcdi_pcol.h" 13#include "mcdi_pcol.h"
15 14
@@ -115,7 +114,7 @@ fail:
115 return rc; 114 return rc;
116} 115}
117 116
118static int efx_mcdi_mac_reconfigure(struct efx_nic *efx) 117int efx_mcdi_mac_reconfigure(struct efx_nic *efx)
119{ 118{
120 int rc; 119 int rc;
121 120
@@ -130,16 +129,9 @@ static int efx_mcdi_mac_reconfigure(struct efx_nic *efx)
130} 129}
131 130
132 131
133static bool efx_mcdi_mac_check_fault(struct efx_nic *efx) 132bool efx_mcdi_mac_check_fault(struct efx_nic *efx)
134{ 133{
135 u32 faults; 134 u32 faults;
136 int rc = efx_mcdi_get_mac_faults(efx, &faults); 135 int rc = efx_mcdi_get_mac_faults(efx, &faults);
137 return (rc != 0) || (faults != 0); 136 return (rc != 0) || (faults != 0);
138} 137}
139
140
141const struct efx_mac_operations efx_mcdi_mac_operations = {
142 .reconfigure = efx_mcdi_mac_reconfigure,
143 .update_stats = efx_port_dummy_op_void,
144 .check_fault = efx_mcdi_mac_check_fault,
145};
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
index b6040141ef79..aa5a321a1419 100644
--- a/drivers/net/ethernet/sfc/net_driver.h
+++ b/drivers/net/ethernet/sfc/net_driver.h
@@ -474,18 +474,6 @@ static inline bool efx_link_state_equal(const struct efx_link_state *left,
474} 474}
475 475
476/** 476/**
477 * struct efx_mac_operations - Efx MAC operations table
478 * @reconfigure: Reconfigure MAC. Serialised by the mac_lock
479 * @update_stats: Update statistics
480 * @check_fault: Check fault state. True if fault present.
481 */
482struct efx_mac_operations {
483 int (*reconfigure) (struct efx_nic *efx);
484 void (*update_stats) (struct efx_nic *efx);
485 bool (*check_fault)(struct efx_nic *efx);
486};
487
488/**
489 * struct efx_phy_operations - Efx PHY operations table 477 * struct efx_phy_operations - Efx PHY operations table
490 * @probe: Probe PHY and initialise efx->mdio.mode_support, efx->mdio.mmds, 478 * @probe: Probe PHY and initialise efx->mdio.mode_support, efx->mdio.mmds,
491 * efx->loopback_modes. 479 * efx->loopback_modes.
@@ -676,7 +664,6 @@ struct efx_filter_state;
676 * @port_initialized: Port initialized? 664 * @port_initialized: Port initialized?
677 * @net_dev: Operating system network device. Consider holding the rtnl lock 665 * @net_dev: Operating system network device. Consider holding the rtnl lock
678 * @stats_buffer: DMA buffer for statistics 666 * @stats_buffer: DMA buffer for statistics
679 * @mac_op: MAC interface
680 * @phy_type: PHY type 667 * @phy_type: PHY type
681 * @phy_op: PHY interface 668 * @phy_op: PHY interface
682 * @phy_data: PHY private data (including PHY-specific stats) 669 * @phy_data: PHY private data (including PHY-specific stats)
@@ -767,8 +754,6 @@ struct efx_nic {
767 754
768 struct efx_buffer stats_buffer; 755 struct efx_buffer stats_buffer;
769 756
770 const struct efx_mac_operations *mac_op;
771
772 unsigned int phy_type; 757 unsigned int phy_type;
773 const struct efx_phy_operations *phy_op; 758 const struct efx_phy_operations *phy_op;
774 void *phy_data; 759 void *phy_data;
@@ -843,12 +828,13 @@ static inline unsigned int efx_port_num(struct efx_nic *efx)
843 * @push_irq_moderation: Apply interrupt moderation value 828 * @push_irq_moderation: Apply interrupt moderation value
844 * @push_multicast_hash: Apply multicast hash table 829 * @push_multicast_hash: Apply multicast hash table
845 * @reconfigure_port: Push loopback/power/txdis changes to the MAC and PHY 830 * @reconfigure_port: Push loopback/power/txdis changes to the MAC and PHY
831 * @reconfigure_mac: Reconfigure MAC only. Serialised by the mac_lock
832 * @check_mac_fault: Check MAC fault state. True if fault present.
846 * @get_wol: Get WoL configuration from driver state 833 * @get_wol: Get WoL configuration from driver state
847 * @set_wol: Push WoL configuration to the NIC 834 * @set_wol: Push WoL configuration to the NIC
848 * @resume_wol: Synchronise WoL state between driver and MC (e.g. after resume) 835 * @resume_wol: Synchronise WoL state between driver and MC (e.g. after resume)
849 * @test_registers: Test read/write functionality of control registers 836 * @test_registers: Test read/write functionality of control registers
850 * @test_nvram: Test validity of NVRAM contents 837 * @test_nvram: Test validity of NVRAM contents
851 * @default_mac_ops: efx_mac_operations to set at startup
852 * @revision: Hardware architecture revision 838 * @revision: Hardware architecture revision
853 * @mem_map_size: Memory BAR mapped size 839 * @mem_map_size: Memory BAR mapped size
854 * @txd_ptr_tbl_base: TX descriptor ring base address 840 * @txd_ptr_tbl_base: TX descriptor ring base address
@@ -888,12 +874,13 @@ struct efx_nic_type {
888 void (*push_irq_moderation)(struct efx_channel *channel); 874 void (*push_irq_moderation)(struct efx_channel *channel);
889 void (*push_multicast_hash)(struct efx_nic *efx); 875 void (*push_multicast_hash)(struct efx_nic *efx);
890 int (*reconfigure_port)(struct efx_nic *efx); 876 int (*reconfigure_port)(struct efx_nic *efx);
877 int (*reconfigure_mac)(struct efx_nic *efx);
878 bool (*check_mac_fault)(struct efx_nic *efx);
891 void (*get_wol)(struct efx_nic *efx, struct ethtool_wolinfo *wol); 879 void (*get_wol)(struct efx_nic *efx, struct ethtool_wolinfo *wol);
892 int (*set_wol)(struct efx_nic *efx, u32 type); 880 int (*set_wol)(struct efx_nic *efx, u32 type);
893 void (*resume_wol)(struct efx_nic *efx); 881 void (*resume_wol)(struct efx_nic *efx);
894 int (*test_registers)(struct efx_nic *efx); 882 int (*test_registers)(struct efx_nic *efx);
895 int (*test_nvram)(struct efx_nic *efx); 883 int (*test_nvram)(struct efx_nic *efx);
896 const struct efx_mac_operations *default_mac_ops;
897 884
898 int revision; 885 int revision;
899 unsigned int mem_map_size; 886 unsigned int mem_map_size;
diff --git a/drivers/net/ethernet/sfc/nic.h b/drivers/net/ethernet/sfc/nic.h
index 5fb24d3aa3ca..cfda6ded24fe 100644
--- a/drivers/net/ethernet/sfc/nic.h
+++ b/drivers/net/ethernet/sfc/nic.h
@@ -189,6 +189,9 @@ extern bool efx_nic_event_present(struct efx_channel *channel);
189/* MAC/PHY */ 189/* MAC/PHY */
190extern void falcon_drain_tx_fifo(struct efx_nic *efx); 190extern void falcon_drain_tx_fifo(struct efx_nic *efx);
191extern void falcon_reconfigure_mac_wrapper(struct efx_nic *efx); 191extern void falcon_reconfigure_mac_wrapper(struct efx_nic *efx);
192extern bool falcon_xmac_check_fault(struct efx_nic *efx);
193extern int falcon_reconfigure_xmac(struct efx_nic *efx);
194extern void falcon_update_stats_xmac(struct efx_nic *efx);
192 195
193/* Interrupts and test events */ 196/* Interrupts and test events */
194extern int efx_nic_init_interrupt(struct efx_nic *efx); 197extern int efx_nic_init_interrupt(struct efx_nic *efx);
diff --git a/drivers/net/ethernet/sfc/selftest.c b/drivers/net/ethernet/sfc/selftest.c
index 5226d9857f30..9df2a7942509 100644
--- a/drivers/net/ethernet/sfc/selftest.c
+++ b/drivers/net/ethernet/sfc/selftest.c
@@ -569,7 +569,7 @@ static int efx_wait_for_link(struct efx_nic *efx)
569 mutex_lock(&efx->mac_lock); 569 mutex_lock(&efx->mac_lock);
570 link_up = link_state->up; 570 link_up = link_state->up;
571 if (link_up) 571 if (link_up)
572 link_up = !efx->mac_op->check_fault(efx); 572 link_up = !efx->type->check_mac_fault(efx);
573 mutex_unlock(&efx->mac_lock); 573 mutex_unlock(&efx->mac_lock);
574 574
575 if (link_up) { 575 if (link_up) {
diff --git a/drivers/net/ethernet/sfc/siena.c b/drivers/net/ethernet/sfc/siena.c
index 4d5d619feaa6..775b6784cbdb 100644
--- a/drivers/net/ethernet/sfc/siena.c
+++ b/drivers/net/ethernet/sfc/siena.c
@@ -18,7 +18,6 @@
18#include "bitfield.h" 18#include "bitfield.h"
19#include "efx.h" 19#include "efx.h"
20#include "nic.h" 20#include "nic.h"
21#include "mac.h"
22#include "spi.h" 21#include "spi.h"
23#include "regs.h" 22#include "regs.h"
24#include "io.h" 23#include "io.h"
@@ -631,13 +630,14 @@ const struct efx_nic_type siena_a0_nic_type = {
631 .set_id_led = efx_mcdi_set_id_led, 630 .set_id_led = efx_mcdi_set_id_led,
632 .push_irq_moderation = siena_push_irq_moderation, 631 .push_irq_moderation = siena_push_irq_moderation,
633 .push_multicast_hash = siena_push_multicast_hash, 632 .push_multicast_hash = siena_push_multicast_hash,
633 .reconfigure_mac = efx_mcdi_mac_reconfigure,
634 .check_mac_fault = efx_mcdi_mac_check_fault,
634 .reconfigure_port = efx_mcdi_phy_reconfigure, 635 .reconfigure_port = efx_mcdi_phy_reconfigure,
635 .get_wol = siena_get_wol, 636 .get_wol = siena_get_wol,
636 .set_wol = siena_set_wol, 637 .set_wol = siena_set_wol,
637 .resume_wol = siena_init_wol, 638 .resume_wol = siena_init_wol,
638 .test_registers = siena_test_registers, 639 .test_registers = siena_test_registers,
639 .test_nvram = efx_mcdi_nvram_test_all, 640 .test_nvram = efx_mcdi_nvram_test_all,
640 .default_mac_ops = &efx_mcdi_mac_operations,
641 641
642 .revision = EFX_REV_SIENA_A0, 642 .revision = EFX_REV_SIENA_A0,
643 .mem_map_size = (FR_CZ_MC_TREG_SMEM + 643 .mem_map_size = (FR_CZ_MC_TREG_SMEM +