|
1 | | -// SPDX-License-Identifier: GPL-2.0 |
| 1 | +// SPDX-License-Identifier: GPL |
2 | 2 | /* Intel FPGA Ethernet MAC driver |
3 | | - * Copyright (C) 2020-2022 Intel Corporation. All rights reserved |
| 3 | + * Copyright (C) 2022,2023 Intel Corporation. All rights reserved |
4 | 4 | * |
5 | 5 | * Contributors: |
6 | | - * Roman Bulgakov |
7 | | - * Yu Ying Choov |
8 | | - * Dalon Westergreen |
9 | | - * Joyce Ooi |
10 | | - * Arzu Ozdogan-tackin |
| 6 | + * Preetam Narayan |
11 | 7 | * |
12 | | - * Original driver contributed by GlobalLogic. |
13 | 8 | */ |
14 | 9 |
|
15 | 10 | #include <linux/etherdevice.h> |
|
33 | 28 | #include "intel_fpga_eth_main.h" |
34 | 29 | #include "intel_fpga_eth_hssi_itf.h" |
35 | 30 |
|
36 | | -#define WATCHDOG_TX_TIMEOUT (1 * HZ)/3 |
37 | 31 | #define MAX_STABILITY_CHECK 10 |
38 | 32 |
|
39 | 33 | /* Module parameters */ |
@@ -230,6 +224,9 @@ static void xtile_free_skbufs(struct net_device *dev) |
230 | 224 |
|
231 | 225 | for (i = 0; i < tx_descs; i++) |
232 | 226 | xtile_free_tx_buffer(priv, &priv->dma_priv.tx_ring[i]); |
| 227 | + |
| 228 | + kfree(priv->dma_priv.tx_ring); |
| 229 | + kfree(priv->dma_priv.rx_ring); |
233 | 230 | } |
234 | 231 |
|
235 | 232 | /* Reallocate the skb for the reception process |
@@ -462,10 +459,8 @@ static irqreturn_t intel_fpga_xtile_isr(int irq, void *dev_id) |
462 | 459 | __napi_schedule(&priv->napi); |
463 | 460 | } |
464 | 461 |
|
465 | | - if ( irq == priv->rx_irq ) |
466 | | - priv->dmaops->clear_rxirq(&priv->dma_priv); |
467 | | - else |
468 | | - priv->dmaops->clear_txirq(&priv->dma_priv); |
| 462 | + priv->dmaops->clear_rxirq(&priv->dma_priv); |
| 463 | + priv->dmaops->clear_txirq(&priv->dma_priv); |
469 | 464 |
|
470 | 465 | spin_unlock(&priv->rxdma_irq_lock); |
471 | 466 |
|
@@ -691,6 +686,13 @@ static int xtile_shutdown(struct net_device *dev) |
691 | 686 | /* Unregister TX interrupt */ |
692 | 687 | devm_free_irq(priv->device, priv->tx_irq, dev); |
693 | 688 |
|
| 689 | + /* to ensure we have acquired the lock and do proper cleaning */ |
| 690 | + spin_lock(&priv->tx_lock); |
| 691 | + spin_lock(&priv->mac_cfg_lock); |
| 692 | + |
| 693 | + spin_unlock(&priv->tx_lock); |
| 694 | + spin_unlock(&priv->mac_cfg_lock); |
| 695 | + |
694 | 696 | /* disable and reset the MAC, empties fifo */ |
695 | 697 | /* Trigger RX digital reset */ |
696 | 698 | pma_digital_reset(priv, false, true); |
|
0 commit comments