From 4d63a3e291da5002ee66d650154af483035dc7f0 Mon Sep 17 00:00:00 2001 From: Om Prakash Singh Date: Thu, 29 Sep 2022 15:45:43 +0530 Subject: [PATCH] nvethernet: avoid enabling HSI from sysfs avoid enabling HSI from sysfs when virtualization is enabled. HSI feature is enabled from ethernet-server. Bug 3590939 Bug 4088361 Change-Id: Icd572efb24379fc8d2fc10ab1faaf0a764ee9679 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2784216 (cherry picked from commit e0754b34892b27b2577bc81ec06dd76efe81b378) Signed-off-by: Om Prakash Singh Signed-off-by: Revanth Kumar Uppala Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2897229 Reviewed-by: Narayan Reddy Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-cert Reviewed-by: Laxman Dewangan GVS: Gerrit_Virtual_Submit --- drivers/net/ethernet/nvidia/nvethernet/sysfs.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/ethernet/nvidia/nvethernet/sysfs.c b/drivers/net/ethernet/nvidia/nvethernet/sysfs.c index 6320ce2f..33f6b6d8 100644 --- a/drivers/net/ethernet/nvidia/nvethernet/sysfs.c +++ b/drivers/net/ethernet/nvidia/nvethernet/sysfs.c @@ -2581,6 +2581,11 @@ static ssize_t hsi_enable_show(struct device *dev, struct ether_priv_data *pdata = netdev_priv(ndev); struct osi_core_priv_data *osi_core = pdata->osi_core; + if (osi_core->use_virtualization == OSI_ENABLE) { + dev_err(pdata->dev, "Not supported with Ethernet virtualization enabled\n"); + return 0; + } + return scnprintf(buf, PAGE_SIZE, "%s\n", (osi_core->hsi.enabled == OSI_ENABLE) ? "enabled" : "disabled"); @@ -2611,6 +2616,12 @@ static ssize_t hsi_enable_store(struct device *dev, u32 inst_id = osi_core->instance_id; u32 ip_type[2] = {IP_EQOS, IP_MGBE}; #endif + + if (osi_core->use_virtualization == OSI_ENABLE) { + dev_err(pdata->dev, "Not supported with Ethernet virtualization enabled\n"); + return size; + } + if (!netif_running(ndev)) { dev_err(pdata->dev, "Not Allowed. Ether interface is not up\n"); return size;