return stats;
}
+/**
+ * et131x_enable_txrx - Enable tx/rx queues
+ * @netdev: device to be enabled
+ */
+void et131x_enable_txrx(struct net_device *netdev)
+{
+ struct et131x_adapter *adapter = netdev_priv(netdev);
+
+ /* Enable the Tx and Rx DMA engines (if not already enabled) */
+ et131x_rx_dma_enable(adapter);
+ et131x_tx_dma_enable(adapter);
+
+ /* Enable device interrupts */
+ if (adapter->flags & fMP_ADAPTER_INTERRUPT_IN_USE)
+ et131x_enable_interrupts(adapter);
+
+ /* We're ready to move some data, so start the queue */
+ netif_start_queue(netdev);
+}
+
+/**
+ * et131x_disable_txrx - Disable tx/rx queues
+ * @netdev: device to be disabled
+ */
+void et131x_disable_txrx(struct net_device *netdev)
+{
+ struct et131x_adapter *adapter = netdev_priv(netdev);
+
+ /* First thing is to stop the queue */
+ netif_stop_queue(netdev);
+
+ /* Stop the Tx and Rx DMA engines */
+ et131x_rx_dma_disable(adapter);
+ et131x_tx_dma_disable(adapter);
+
+ /* Disable device interrupts */
+ et131x_disable_interrupts(adapter);
+}
+
/**
* et131x_open - Open the device for use.
* @netdev: device to be opened
return result;
}
- /* Enable the Tx and Rx DMA engines (if not already enabled) */
- et131x_rx_dma_enable(adapter);
- et131x_tx_dma_enable(adapter);
-
- /* Enable device interrupts */
- et131x_enable_interrupts(adapter);
-
adapter->flags |= fMP_ADAPTER_INTERRUPT_IN_USE;
-
+ et131x_enable_txrx(netdev);
phy_start(adapter->phydev);
- /* We're ready to move some data, so start the queue */
- netif_start_queue(netdev);
return result;
}
/* Save the timestamp for the TX watchdog, prevent a timeout */
netdev->trans_start = jiffies;
- /* First thing is to stop the queue */
- netif_stop_queue(netdev);
-
- /* Stop the Tx and Rx DMA engines */
- et131x_rx_dma_disable(adapter);
- et131x_tx_dma_disable(adapter);
-
- /* Disable device interrupts */
- et131x_disable_interrupts(adapter);
+ et131x_disable_txrx(netdev);
/* Deregistering ISR */
adapter->flags &= ~fMP_ADAPTER_INTERRUPT_IN_USE;
adapter->net_stats.tx_errors++;
- /* perform reset */
- /* First thing is to stop the queue */
- netif_stop_queue(netdev);
-
- /* Stop the Tx and Rx DMA engines */
- et131x_rx_dma_disable(adapter);
- et131x_tx_dma_disable(adapter);
-
- /* Disable device interrupts */
- et131x_disable_interrupts(adapter);
-
- /*
- * Enable the Tx and Rx DMA engines
- * (if not already enabled)
- */
- et131x_rx_dma_enable(adapter);
- et131x_tx_dma_enable(adapter);
-
- /* Enable device interrupts */
- et131x_enable_interrupts(adapter);
-
- /* We're ready to move some data, so start the queue */
- netif_start_queue(netdev);
+ /* perform reset of tx/rx */
+ et131x_disable_txrx(netdev);
+ et131x_enable_txrx(netdev);
return;
}
}
if (new_mtu < 64 || new_mtu > 9216)
return -EINVAL;
- /* Stop the netif queue */
- netif_stop_queue(netdev);
-
- /* Stop the Tx and Rx DMA engines */
- et131x_rx_dma_disable(adapter);
- et131x_tx_dma_disable(adapter);
-
- /* Disable device interrupts */
- et131x_disable_interrupts(adapter);
+ et131x_disable_txrx(netdev);
et131x_handle_send_interrupt(adapter);
et131x_handle_recv_interrupt(adapter);
/* Init the device with the new settings */
et131x_adapter_setup(adapter);
- /* Enable interrupts */
- if (adapter->flags & fMP_ADAPTER_INTERRUPT_IN_USE)
- et131x_enable_interrupts(adapter);
+ et131x_enable_txrx(netdev);
- /* Restart the Tx and Rx DMA engines */
- et131x_rx_dma_enable(adapter);
- et131x_tx_dma_enable(adapter);
-
- /* Restart the netif queue */
- netif_wake_queue(netdev);
return result;
}
if (!is_valid_ether_addr(address->sa_data))
return -EINVAL;
- /* Stop the netif queue */
- netif_stop_queue(netdev);
-
- /* Stop the Tx and Rx DMA engines */
- et131x_rx_dma_disable(adapter);
- et131x_tx_dma_disable(adapter);
-
- /* Disable device interrupts */
- et131x_disable_interrupts(adapter);
+ et131x_disable_txrx(netdev);
et131x_handle_send_interrupt(adapter);
et131x_handle_recv_interrupt(adapter);
/* Init the device with the new settings */
et131x_adapter_setup(adapter);
- /* Enable interrupts */
- if (adapter->flags & fMP_ADAPTER_INTERRUPT_IN_USE)
- et131x_enable_interrupts(adapter);
-
- /* Restart the Tx and Rx DMA engines */
- et131x_rx_dma_enable(adapter);
- et131x_tx_dma_enable(adapter);
+ et131x_enable_txrx(netdev);
- /* Restart the netif queue */
- netif_wake_queue(netdev);
return result;
}