From 01b5277fc9984d9fb9156afa0b1be70b3b475825 Mon Sep 17 00:00:00 2001 From: Tom Lendacky Date: Wed, 23 May 2018 11:39:13 -0500 Subject: amd-xgbe: Add ethtool show/set channels support Add ethtool support to show and set the device channel configuration. Changing the channel configuration will result in a device restart. Signed-off-by: Tom Lendacky Signed-off-by: David S. Miller --- drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'drivers/net/ethernet/amd/xgbe/xgbe-drv.c') diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c index 397e3a0e1d67..24f1053b8785 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c @@ -1329,6 +1329,17 @@ static int xgbe_alloc_memory(struct xgbe_prv_data *pdata) struct net_device *netdev = pdata->netdev; int ret; + if (pdata->new_tx_ring_count) { + pdata->tx_ring_count = pdata->new_tx_ring_count; + pdata->tx_q_count = pdata->tx_ring_count; + pdata->new_tx_ring_count = 0; + } + + if (pdata->new_rx_ring_count) { + pdata->rx_ring_count = pdata->new_rx_ring_count; + pdata->new_rx_ring_count = 0; + } + /* Calculate the Rx buffer size before allocating rings */ pdata->rx_buf_size = xgbe_calc_rx_buf_size(netdev, netdev->mtu); @@ -1482,6 +1493,20 @@ static void xgbe_stopdev(struct work_struct *work) netdev_alert(pdata->netdev, "device stopped\n"); } +void xgbe_full_restart_dev(struct xgbe_prv_data *pdata) +{ + /* If not running, "restart" will happen on open */ + if (!netif_running(pdata->netdev)) + return; + + xgbe_stop(pdata); + + xgbe_free_memory(pdata); + xgbe_alloc_memory(pdata); + + xgbe_start(pdata); +} + void xgbe_restart_dev(struct xgbe_prv_data *pdata) { /* If not running, "restart" will happen on open */ -- cgit