From e4117870702f2681ca361f9796d878ad266e0569 Mon Sep 17 00:00:00 2001 From: nannaiah Date: Mon, 8 Mar 2021 11:43:13 -0800 Subject: [PATCH] nvethernet: Enable IVC for kernel 5.10 Bug 2694285 Change-Id: I80a66c86f9cb4974454b41dfde3707ab36e15c24 Signed-off-by: Nagaraj annaiah Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2495280 Reviewed-by: Rakesh Goyal Reviewed-by: Srinivas Ramachandran Reviewed-by: mobile promotions Tested-by: mobile promotions GVS: Gerrit_Virtual_Submit --- .../net/ethernet/nvidia/nvethernet/ether_linux.c | 14 ++------------ .../net/ethernet/nvidia/nvethernet/ether_linux.h | 2 +- drivers/net/ethernet/nvidia/nvethernet/osd.c | 2 -- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/nvidia/nvethernet/ether_linux.c b/drivers/net/ethernet/nvidia/nvethernet/ether_linux.c index abfc7d67..c41ab096 100644 --- a/drivers/net/ethernet/nvidia/nvethernet/ether_linux.c +++ b/drivers/net/ethernet/nvidia/nvethernet/ether_linux.c @@ -675,7 +675,6 @@ static void ether_free_irqs(struct ether_priv_data *pdata) } } -#if (LINUX_VERSION_CODE <= KERNEL_VERSION(5, 9, 0)) /** * @brief IVC ISR Routine * @@ -802,12 +801,9 @@ static int ether_init_ivc(struct ether_priv_data *pdata) id, ictxt->ivck->frame_size, ictxt->ivck->irq); osi_core->osd_ops.ivc_send = osd_ivc_send_cmd; init_completion(&ictxt->msg_complete); -#if (LINUX_VERSION_CODE <= KERNEL_VERSION(5, 9, 0)) ether_start_ivc(pdata); -#endif return 0; } -#endif /** * @brief Register IRQs @@ -1625,9 +1621,7 @@ static int ether_open(struct net_device *dev) gpio_set_value(pdata->phy_reset, 1); } -#if (LINUX_VERSION_CODE <= KERNEL_VERSION(5, 9, 0)) ether_start_ivc(pdata); -#endif ret = ether_enable_clks(pdata); if (ret < 0) { @@ -1870,9 +1864,7 @@ static int ether_close(struct net_device *ndev) /* MAC deinit which inturn stop MAC Tx,Rx */ osi_hw_core_deinit(pdata->osi_core); -#if (LINUX_VERSION_CODE <= KERNEL_VERSION(5, 9, 0)) ether_stop_ivc(pdata); -#endif /* Assert MAC RST gpio */ if (!pdata->osi_core->pre_si && pdata->mac_rst) { @@ -3850,7 +3842,7 @@ static int ether_parse_dt(struct ether_priv_data *pdata) dev_err(dev, "mismatch in numbers of DMA channel and MTL Q\n"); return -EINVAL; } -#if (KERNEL_VERSION(5, 4, 0) > LINUX_VERSION_CODE) + /* Allow to set non zero DMA channel for virtualization */ if (!ether_init_ivc(pdata)) { osi_dma->use_virtualization = OSI_ENABLE; @@ -3864,9 +3856,6 @@ static int ether_parse_dt(struct ether_priv_data *pdata) ret = -1; pdata->use_stats = OSI_ENABLE; } -#else - ret = -1; -#endif for (i = 0; i < osi_dma->num_dma_chans; i++) { if (osi_dma->dma_chans[i] != osi_core->mtl_queues[i]) { @@ -4418,6 +4407,7 @@ err_init_res: err_parse_dt: err_core_ops: err_dma_ops: + ether_stop_ivc(pdata); free_netdev(ndev); return ret; } diff --git a/drivers/net/ethernet/nvidia/nvethernet/ether_linux.h b/drivers/net/ethernet/nvidia/nvethernet/ether_linux.h index bfe8efbc..a936fc86 100644 --- a/drivers/net/ethernet/nvidia/nvethernet/ether_linux.h +++ b/drivers/net/ethernet/nvidia/nvethernet/ether_linux.h @@ -42,8 +42,8 @@ #include #include #include -#if (KERNEL_VERSION(5, 4, 0) > LINUX_VERSION_CODE) #include +#if (KERNEL_VERSION(5, 4, 0) > LINUX_VERSION_CODE) #include #else #include diff --git a/drivers/net/ethernet/nvidia/nvethernet/osd.c b/drivers/net/ethernet/nvidia/nvethernet/osd.c index 212302f2..14ee8316 100644 --- a/drivers/net/ethernet/nvidia/nvethernet/osd.c +++ b/drivers/net/ethernet/nvidia/nvethernet/osd.c @@ -431,7 +431,6 @@ void ether_assign_osd_ops(struct osi_core_priv_data *osi_core, int osd_ivc_send_cmd(void *priv, void *data, unsigned int len) { int ret = -1; -#if (LINUX_VERSION_CODE <= KERNEL_VERSION(5, 9, 0)) unsigned long flags = 0; static int cnt = 0; struct osi_core_priv_data *core = (struct osi_core_priv_data *)priv; @@ -485,6 +484,5 @@ int osd_ivc_send_cmd(void *priv, void *data, unsigned int len) ret = ivc_buf->status; fail: raw_spin_unlock_irqrestore(&ictxt->ivck_lock, flags); -#endif return ret; }