From f48d979e44821630115c2ae24485a4df5bc9d6fa Mon Sep 17 00:00:00 2001 From: nannaiah Date: Thu, 16 Apr 2020 15:52:24 -0700 Subject: [PATCH] nvethernet: Allow to set non zero DMA channel. 1. Add Flag which decides stats work queue is enabled(1) or disabled(0) 2. If virtualization is enabled then allow function driver instance to specify non zero DMA channel and to read stats flag from DT. Bug 2694285 Change-Id: Ic97c079e66c117ed78f1b473ffda33173bd3f23c Signed-off-by: Nagaraj annaiah Change-Id: Ic97c079e66c117ed78f1b473ffda33173bd3f23c Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2327179 Reviewed-by: automaticguardword Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Srinivas Ramachandran Reviewed-by: Ashutosh Jha Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions --- .../ethernet/nvidia/nvethernet/ether_linux.c | 22 ++++++++++++++----- .../ethernet/nvidia/nvethernet/ether_linux.h | 2 ++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/nvidia/nvethernet/ether_linux.c b/drivers/net/ethernet/nvidia/nvethernet/ether_linux.c index 742ea9d6..973c0f59 100644 --- a/drivers/net/ethernet/nvidia/nvethernet/ether_linux.c +++ b/drivers/net/ethernet/nvidia/nvethernet/ether_linux.c @@ -56,7 +56,8 @@ static inline void ether_stats_work_func(struct work_struct *work) */ static inline void ether_stats_work_queue_start(struct ether_priv_data *pdata) { - if (pdata->hw_feat.mmc_sel == OSI_ENABLE) { + if (pdata->hw_feat.mmc_sel == OSI_ENABLE && + pdata->use_stats == OSI_ENABLE) { schedule_delayed_work(&pdata->ether_stats_work, msecs_to_jiffies(ETHER_STATS_TIMER * 1000)); @@ -73,7 +74,8 @@ static inline void ether_stats_work_queue_start(struct ether_priv_data *pdata) */ static inline void ether_stats_work_queue_stop(struct ether_priv_data *pdata) { - if (pdata->hw_feat.mmc_sel == OSI_ENABLE) { + if (pdata->hw_feat.mmc_sel == OSI_ENABLE && + pdata->use_stats == OSI_ENABLE) { cancel_delayed_work_sync(&pdata->ether_stats_work); } } @@ -711,8 +713,6 @@ static int ether_request_irqs(struct ether_priv_data *pdata) pdata->common_irq); return ret; } - /* TODO: Check return value and handle error */ - ether_init_ivc(pdata); pdata->common_irq_alloc_mask = 1; for (i = 0; i < osi_dma->num_dma_chans; i++) { @@ -3434,7 +3434,19 @@ static int ether_parse_dt(struct ether_priv_data *pdata) return -EINVAL; } - ret = -1; + /* Allow to set non zero DMA channel for virtualization */ + if (!ether_init_ivc(pdata)) { + osi_dma->use_virtualization = OSI_ENABLE; + /* read mac management flag and set use_stats */ + of_property_read_u32(np, "nvidia,mmc_daemon", + &pdata->use_stats); + dev_info(dev, "Virtualization is enabled & stats flag is %d\n", + pdata->use_stats); + } else { + ret = -1; + pdata->use_stats = OSI_ENABLE; + } + for (i = 0; i < osi_dma->num_dma_chans; i++) { if (osi_dma->dma_chans[i] != osi_core->mtl_queues[i]) { dev_err(dev, diff --git a/drivers/net/ethernet/nvidia/nvethernet/ether_linux.h b/drivers/net/ethernet/nvidia/nvethernet/ether_linux.h index d6877718..cf1ff201 100644 --- a/drivers/net/ethernet/nvidia/nvethernet/ether_linux.h +++ b/drivers/net/ethernet/nvidia/nvethernet/ether_linux.h @@ -346,6 +346,8 @@ struct ether_priv_data { char ivc_rx[ETHER_MAX_IVC_BUF]; /** ivc work */ struct work_struct ivc_work; + /** Flag which decides stats is enabled(1) or disabled(0) */ + unsigned int use_stats; }; /**