nvethernet: fix hrtimer bug

Issue:
 1) hrtimer code is using index instead of
chan number (TX_NAPI[<index>] instead of TX_NAPI[chan])

Fix:
 1) update code to use channel number

Bug 200529168

Change-Id: I4a554ae3426910dd19b5d481957f41e32b6ff063
Signed-off-by: rakesh goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2263933
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
rakesh goyal
2019-12-17 14:31:54 +05:30
committed by Revanth Kumar Uppala
parent 5176ea0aa5
commit 4901365614

View File

@@ -1452,10 +1452,7 @@ static int ether_close(struct net_device *ndev)
{
struct ether_priv_data *pdata = netdev_priv(ndev);
int ret = 0, i;
/* Cancel hrtimer */
for (i = 0; i < pdata->osi_dma->num_dma_chans; i++)
hrtimer_cancel(&pdata->tx_napi[i]->tx_usecs_timer);
unsigned int chan = 0x0;
/* Unregister broadcasting MAC timestamp to clients */
tegra_unregister_hwtime_source();
@@ -1489,6 +1486,15 @@ static int ether_close(struct net_device *ndev)
/* Free tx rx and common irqs */
ether_free_irqs(pdata);
/* Cancel hrtimer */
for (i = 0; i < pdata->osi_dma->num_dma_chans; i++) {
chan = pdata->osi_dma->dma_chans[i];
if (atomic_read(&pdata->tx_napi[chan]->tx_usecs_timer_armed)
== OSI_ENABLE) {
hrtimer_cancel(&pdata->tx_napi[chan]->tx_usecs_timer);
}
}
/* DMA De init */
osi_hw_dma_deinit(pdata->osi_dma);
@@ -3685,7 +3691,7 @@ static void init_filter_values(struct ether_priv_data *pdata)
static int ether_probe(struct platform_device *pdev)
{
struct ether_priv_data *pdata;
unsigned int num_dma_chans, mac, num_mtl_queues;
unsigned int num_dma_chans, mac, num_mtl_queues, chan;
struct osi_core_priv_data *osi_core;
struct osi_dma_priv_data *osi_dma;
struct net_device *ndev;
@@ -3801,11 +3807,12 @@ static int ether_probe(struct platform_device *pdev)
/* Setup the tx_usecs timer */
for (i = 0; i < osi_dma->num_dma_chans; i++) {
atomic_set(&pdata->tx_napi[i]->tx_usecs_timer_armed,
chan = osi_dma->dma_chans[i];
atomic_set(&pdata->tx_napi[chan]->tx_usecs_timer_armed,
OSI_DISABLE);
hrtimer_init(&pdata->tx_napi[i]->tx_usecs_timer,
hrtimer_init(&pdata->tx_napi[chan]->tx_usecs_timer,
CLOCK_MONOTONIC, HRTIMER_MODE_REL);
pdata->tx_napi[i]->tx_usecs_timer.function =
pdata->tx_napi[chan]->tx_usecs_timer.function =
ether_tx_usecs_hrtimer;
}