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 <omp@nvidia.com>
Signed-off-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2897229
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Om Prakash Singh
2022-09-29 15:45:43 +05:30
committed by mobile promotions
parent 448ee57dbc
commit 4d63a3e291

View File

@@ -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;