Commit b5775b47 authored by Alex Maftei (amaftei)'s avatar Alex Maftei (amaftei) Committed by David S. Miller

sfc: conditioned some functionality

Before calling certain function pointers, check that they are non-NULL.
Signed-off-by: default avatarAlexandru-Mihai Maftei <amaftei@solarflare.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8da92642
...@@ -1039,7 +1039,7 @@ void efx_stop_channels(struct efx_nic *efx) ...@@ -1039,7 +1039,7 @@ void efx_stop_channels(struct efx_nic *efx)
struct efx_tx_queue *tx_queue; struct efx_tx_queue *tx_queue;
struct efx_rx_queue *rx_queue; struct efx_rx_queue *rx_queue;
struct efx_channel *channel; struct efx_channel *channel;
int rc; int rc = 0;
/* Stop RX refill */ /* Stop RX refill */
efx_for_each_channel(channel, efx) { efx_for_each_channel(channel, efx) {
...@@ -1060,7 +1060,9 @@ void efx_stop_channels(struct efx_nic *efx) ...@@ -1060,7 +1060,9 @@ void efx_stop_channels(struct efx_nic *efx)
} }
} }
if (efx->type->fini_dmaq)
rc = efx->type->fini_dmaq(efx); rc = efx->type->fini_dmaq(efx);
if (rc) { if (rc) {
netif_err(efx, drv, efx->net_dev, "failed to flush queues\n"); netif_err(efx, drv, efx->net_dev, "failed to flush queues\n");
} else { } else {
......
...@@ -141,9 +141,11 @@ void efx_destroy_reset_workqueue(void) ...@@ -141,9 +141,11 @@ void efx_destroy_reset_workqueue(void)
*/ */
void efx_mac_reconfigure(struct efx_nic *efx) void efx_mac_reconfigure(struct efx_nic *efx)
{ {
if (efx->type->reconfigure_mac) {
down_read(&efx->filter_sem); down_read(&efx->filter_sem);
efx->type->reconfigure_mac(efx); efx->type->reconfigure_mac(efx);
up_read(&efx->filter_sem); up_read(&efx->filter_sem);
}
} }
/* Asynchronous work item for changing MAC promiscuity and multicast /* Asynchronous work item for changing MAC promiscuity and multicast
...@@ -296,7 +298,8 @@ static void efx_start_datapath(struct efx_nic *efx) ...@@ -296,7 +298,8 @@ static void efx_start_datapath(struct efx_nic *efx)
netdev_features_change(efx->net_dev); netdev_features_change(efx->net_dev);
/* RX filters may also have scatter-enabled flags */ /* RX filters may also have scatter-enabled flags */
if (efx->rx_scatter != old_rx_scatter) if ((efx->rx_scatter != old_rx_scatter) &&
efx->type->filter_update_rx_scatter)
efx->type->filter_update_rx_scatter(efx); efx->type->filter_update_rx_scatter(efx);
/* We must keep at least one descriptor in a TX ring empty. /* We must keep at least one descriptor in a TX ring empty.
...@@ -405,11 +408,13 @@ void efx_start_all(struct efx_nic *efx) ...@@ -405,11 +408,13 @@ void efx_start_all(struct efx_nic *efx)
efx_link_status_changed(efx); efx_link_status_changed(efx);
mutex_unlock(&efx->mac_lock); mutex_unlock(&efx->mac_lock);
if (efx->type->start_stats) {
efx->type->start_stats(efx); efx->type->start_stats(efx);
efx->type->pull_stats(efx); efx->type->pull_stats(efx);
spin_lock_bh(&efx->stats_lock); spin_lock_bh(&efx->stats_lock);
efx->type->update_stats(efx, NULL, NULL); efx->type->update_stats(efx, NULL, NULL);
spin_unlock_bh(&efx->stats_lock); spin_unlock_bh(&efx->stats_lock);
}
} }
/* Quiesce the hardware and software data path, and regular activity /* Quiesce the hardware and software data path, and regular activity
...@@ -425,6 +430,7 @@ void efx_stop_all(struct efx_nic *efx) ...@@ -425,6 +430,7 @@ void efx_stop_all(struct efx_nic *efx)
if (!efx->port_enabled) if (!efx->port_enabled)
return; return;
if (efx->type->update_stats) {
/* update stats before we go down so we can accurately count /* update stats before we go down so we can accurately count
* rx_nodesc_drops * rx_nodesc_drops
*/ */
...@@ -433,6 +439,8 @@ void efx_stop_all(struct efx_nic *efx) ...@@ -433,6 +439,8 @@ void efx_stop_all(struct efx_nic *efx)
efx->type->update_stats(efx, NULL, NULL); efx->type->update_stats(efx, NULL, NULL);
spin_unlock_bh(&efx->stats_lock); spin_unlock_bh(&efx->stats_lock);
efx->type->stop_stats(efx); efx->type->stop_stats(efx);
}
efx_stop_port(efx); efx_stop_port(efx);
/* Stop the kernel transmit interface. This is only valid if /* Stop the kernel transmit interface. This is only valid if
...@@ -456,7 +464,7 @@ void efx_stop_all(struct efx_nic *efx) ...@@ -456,7 +464,7 @@ void efx_stop_all(struct efx_nic *efx)
int __efx_reconfigure_port(struct efx_nic *efx) int __efx_reconfigure_port(struct efx_nic *efx)
{ {
enum efx_phy_mode phy_mode; enum efx_phy_mode phy_mode;
int rc; int rc = 0;
WARN_ON(!mutex_is_locked(&efx->mac_lock)); WARN_ON(!mutex_is_locked(&efx->mac_lock));
...@@ -467,6 +475,7 @@ int __efx_reconfigure_port(struct efx_nic *efx) ...@@ -467,6 +475,7 @@ int __efx_reconfigure_port(struct efx_nic *efx)
else else
efx->phy_mode &= ~PHY_MODE_TX_DISABLED; efx->phy_mode &= ~PHY_MODE_TX_DISABLED;
if (efx->type->reconfigure_port)
rc = efx->type->reconfigure_port(efx); rc = efx->type->reconfigure_port(efx);
if (rc) if (rc)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment