aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2010-12-02 08:47:45 -0500
committerDavid S. Miller <davem@davemloft.net>2010-12-03 12:08:08 -0500
commit40641ed93cd53561f7d53b5fd5ed656b35f3aabd (patch)
treec7cffd1b3df358e825111d3aa21f396f70f03e22 /drivers
parent4833f02a2972b7da4c8a15e1e329db0f984a75d9 (diff)
sfc: Move Falcon global event handling to falcon.c
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/sfc/falcon.c36
-rw-r--r--drivers/net/sfc/net_driver.h2
-rw-r--r--drivers/net/sfc/nic.c48
3 files changed, 43 insertions, 43 deletions
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c
index af62899bb981..fd5bf0b7e8a2 100644
--- a/drivers/net/sfc/falcon.c
+++ b/drivers/net/sfc/falcon.c
@@ -881,6 +881,40 @@ static void falcon_remove_port(struct efx_nic *efx)
881 efx_nic_free_buffer(efx, &efx->stats_buffer); 881 efx_nic_free_buffer(efx, &efx->stats_buffer);
882} 882}
883 883
884/* Global events are basically PHY events */
885static bool
886falcon_handle_global_event(struct efx_channel *channel, efx_qword_t *event)
887{
888 struct efx_nic *efx = channel->efx;
889
890 if (EFX_QWORD_FIELD(*event, FSF_AB_GLB_EV_G_PHY0_INTR) ||
891 EFX_QWORD_FIELD(*event, FSF_AB_GLB_EV_XG_PHY0_INTR) ||
892 EFX_QWORD_FIELD(*event, FSF_AB_GLB_EV_XFP_PHY0_INTR))
893 /* Ignored */
894 return true;
895
896 if ((efx_nic_rev(efx) == EFX_REV_FALCON_B0) &&
897 EFX_QWORD_FIELD(*event, FSF_BB_GLB_EV_XG_MGT_INTR)) {
898 efx->xmac_poll_required = true;
899 return true;
900 }
901
902 if (efx_nic_rev(efx) <= EFX_REV_FALCON_A1 ?
903 EFX_QWORD_FIELD(*event, FSF_AA_GLB_EV_RX_RECOVERY) :
904 EFX_QWORD_FIELD(*event, FSF_BB_GLB_EV_RX_RECOVERY)) {
905 netif_err(efx, rx_err, efx->net_dev,
906 "channel %d seen global RX_RESET event. Resetting.\n",
907 channel->channel);
908
909 atomic_inc(&efx->rx_reset);
910 efx_schedule_reset(efx, EFX_WORKAROUND_6555(efx) ?
911 RESET_TYPE_RX_RECOVERY : RESET_TYPE_DISABLE);
912 return true;
913 }
914
915 return false;
916}
917
884/************************************************************************** 918/**************************************************************************
885 * 919 *
886 * Falcon test code 920 * Falcon test code
@@ -1702,6 +1736,7 @@ struct efx_nic_type falcon_a1_nic_type = {
1702 .reset = falcon_reset_hw, 1736 .reset = falcon_reset_hw,
1703 .probe_port = falcon_probe_port, 1737 .probe_port = falcon_probe_port,
1704 .remove_port = falcon_remove_port, 1738 .remove_port = falcon_remove_port,
1739 .handle_global_event = falcon_handle_global_event,
1705 .prepare_flush = falcon_prepare_flush, 1740 .prepare_flush = falcon_prepare_flush,
1706 .update_stats = falcon_update_nic_stats, 1741 .update_stats = falcon_update_nic_stats,
1707 .start_stats = falcon_start_nic_stats, 1742 .start_stats = falcon_start_nic_stats,
@@ -1742,6 +1777,7 @@ struct efx_nic_type falcon_b0_nic_type = {
1742 .reset = falcon_reset_hw, 1777 .reset = falcon_reset_hw,
1743 .probe_port = falcon_probe_port, 1778 .probe_port = falcon_probe_port,
1744 .remove_port = falcon_remove_port, 1779 .remove_port = falcon_remove_port,
1780 .handle_global_event = falcon_handle_global_event,
1745 .prepare_flush = falcon_prepare_flush, 1781 .prepare_flush = falcon_prepare_flush,
1746 .update_stats = falcon_update_nic_stats, 1782 .update_stats = falcon_update_nic_stats,
1747 .start_stats = falcon_start_nic_stats, 1783 .start_stats = falcon_start_nic_stats,
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h
index 2ffc920d6ec0..f9d53a01bbc5 100644
--- a/drivers/net/sfc/net_driver.h
+++ b/drivers/net/sfc/net_driver.h
@@ -819,6 +819,7 @@ static inline unsigned int efx_port_num(struct efx_nic *efx)
819 * be called while the controller is uninitialised. 819 * be called while the controller is uninitialised.
820 * @probe_port: Probe the MAC and PHY 820 * @probe_port: Probe the MAC and PHY
821 * @remove_port: Free resources allocated by probe_port() 821 * @remove_port: Free resources allocated by probe_port()
822 * @handle_global_event: Handle a "global" event (may be %NULL)
822 * @prepare_flush: Prepare the hardware for flushing the DMA queues 823 * @prepare_flush: Prepare the hardware for flushing the DMA queues
823 * @update_stats: Update statistics not provided by event handling 824 * @update_stats: Update statistics not provided by event handling
824 * @start_stats: Start the regular fetching of statistics 825 * @start_stats: Start the regular fetching of statistics
@@ -863,6 +864,7 @@ struct efx_nic_type {
863 int (*reset)(struct efx_nic *efx, enum reset_type method); 864 int (*reset)(struct efx_nic *efx, enum reset_type method);
864 int (*probe_port)(struct efx_nic *efx); 865 int (*probe_port)(struct efx_nic *efx);
865 void (*remove_port)(struct efx_nic *efx); 866 void (*remove_port)(struct efx_nic *efx);
867 bool (*handle_global_event)(struct efx_channel *channel, efx_qword_t *);
866 void (*prepare_flush)(struct efx_nic *efx); 868 void (*prepare_flush)(struct efx_nic *efx);
867 void (*update_stats)(struct efx_nic *efx); 869 void (*update_stats)(struct efx_nic *efx);
868 void (*start_stats)(struct efx_nic *efx); 870 void (*start_stats)(struct efx_nic *efx);
diff --git a/drivers/net/sfc/nic.c b/drivers/net/sfc/nic.c
index 41c36b9a4244..9743cff15130 100644
--- a/drivers/net/sfc/nic.c
+++ b/drivers/net/sfc/nic.c
@@ -894,46 +894,6 @@ efx_handle_generated_event(struct efx_channel *channel, efx_qword_t *event)
894 channel->channel, EFX_QWORD_VAL(*event)); 894 channel->channel, EFX_QWORD_VAL(*event));
895} 895}
896 896
897/* Global events are basically PHY events */
898static void
899efx_handle_global_event(struct efx_channel *channel, efx_qword_t *event)
900{
901 struct efx_nic *efx = channel->efx;
902 bool handled = false;
903
904 if (EFX_QWORD_FIELD(*event, FSF_AB_GLB_EV_G_PHY0_INTR) ||
905 EFX_QWORD_FIELD(*event, FSF_AB_GLB_EV_XG_PHY0_INTR) ||
906 EFX_QWORD_FIELD(*event, FSF_AB_GLB_EV_XFP_PHY0_INTR)) {
907 /* Ignored */
908 handled = true;
909 }
910
911 if ((efx_nic_rev(efx) >= EFX_REV_FALCON_B0) &&
912 EFX_QWORD_FIELD(*event, FSF_BB_GLB_EV_XG_MGT_INTR)) {
913 efx->xmac_poll_required = true;
914 handled = true;
915 }
916
917 if (efx_nic_rev(efx) <= EFX_REV_FALCON_A1 ?
918 EFX_QWORD_FIELD(*event, FSF_AA_GLB_EV_RX_RECOVERY) :
919 EFX_QWORD_FIELD(*event, FSF_BB_GLB_EV_RX_RECOVERY)) {
920 netif_err(efx, rx_err, efx->net_dev,
921 "channel %d seen global RX_RESET event. Resetting.\n",
922 channel->channel);
923
924 atomic_inc(&efx->rx_reset);
925 efx_schedule_reset(efx, EFX_WORKAROUND_6555(efx) ?
926 RESET_TYPE_RX_RECOVERY : RESET_TYPE_DISABLE);
927 handled = true;
928 }
929
930 if (!handled)
931 netif_err(efx, hw, efx->net_dev,
932 "channel %d unknown global event "
933 EFX_QWORD_FMT "\n", channel->channel,
934 EFX_QWORD_VAL(*event));
935}
936
937static void 897static void
938efx_handle_driver_event(struct efx_channel *channel, efx_qword_t *event) 898efx_handle_driver_event(struct efx_channel *channel, efx_qword_t *event)
939{ 899{
@@ -1050,15 +1010,17 @@ int efx_nic_process_eventq(struct efx_channel *channel, int budget)
1050 case FSE_AZ_EV_CODE_DRV_GEN_EV: 1010 case FSE_AZ_EV_CODE_DRV_GEN_EV:
1051 efx_handle_generated_event(channel, &event); 1011 efx_handle_generated_event(channel, &event);
1052 break; 1012 break;
1053 case FSE_AZ_EV_CODE_GLOBAL_EV:
1054 efx_handle_global_event(channel, &event);
1055 break;
1056 case FSE_AZ_EV_CODE_DRIVER_EV: 1013 case FSE_AZ_EV_CODE_DRIVER_EV:
1057 efx_handle_driver_event(channel, &event); 1014 efx_handle_driver_event(channel, &event);
1058 break; 1015 break;
1059 case FSE_CZ_EV_CODE_MCDI_EV: 1016 case FSE_CZ_EV_CODE_MCDI_EV:
1060 efx_mcdi_process_event(channel, &event); 1017 efx_mcdi_process_event(channel, &event);
1061 break; 1018 break;
1019 case FSE_AZ_EV_CODE_GLOBAL_EV:
1020 if (efx->type->handle_global_event &&
1021 efx->type->handle_global_event(channel, &event))
1022 break;
1023 /* else fall through */
1062 default: 1024 default:
1063 netif_err(channel->efx, hw, channel->efx->net_dev, 1025 netif_err(channel->efx, hw, channel->efx->net_dev,
1064 "channel %d unknown event type %d (data " 1026 "channel %d unknown event type %d (data "