nvethernet: move err injec code to vltest

issue: HSI error injection logic is enabled by default
and is exposed as an ioctl which is a safety-related concern.

fix: move HSI error injection code only for
VLTEST build

Jira NET-1235
Bug 4449611

Signed-off-by: Narayan Reddy <narayanr@nvidia.com>
Change-Id: I4a15a40807466693ce673a3b9b00f51c077f2bd8
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3078250
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3132841
Tested-by: Hareesh Kesireddy <hkesireddy@nvidia.com>
Reviewed-by: Hareesh Kesireddy <hkesireddy@nvidia.com>
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Narayan Reddy
2024-02-16 10:56:58 +05:30
committed by mobile promotions
parent 316baa6776
commit 381d11969f
2 changed files with 7 additions and 11 deletions

View File

@@ -54,5 +54,9 @@ nvethernet-objs:= ether_linux.o \
include $(srctree.nvidia-oot)/drivers/net/ethernet/nvidia/nvethernet/nvethernetrm/include/config.tmk include $(srctree.nvidia-oot)/drivers/net/ethernet/nvidia/nvethernet/nvethernetrm/include/config.tmk
ifeq ($(NV_BUILD_CONFIGURATION_IS_VLTEST),1)
ccflags-y += -DNV_VLTEST_BUILD
endif
# Undefine HSI_SUPPORT if CONFIG_TEGRA_EPL is not defined. # Undefine HSI_SUPPORT if CONFIG_TEGRA_EPL is not defined.
ccflags-y += $(if $(CONFIG_TEGRA_EPL),,-UHSI_SUPPORT) ccflags-y += $(if $(CONFIG_TEGRA_EPL),,-UHSI_SUPPORT)

View File

@@ -2543,8 +2543,7 @@ static DEVICE_ATTR(nvgro_dump, 0644,
ether_nvgro_dump_show, NULL); ether_nvgro_dump_show, NULL);
#endif #endif
#ifdef HSI_SUPPORT #if defined HSI_SUPPORT && defined(NV_VLTEST_BUILD) && (IS_ENABLED(CONFIG_TEGRA_HSIERRRPTINJ))
#if (IS_ENABLED(CONFIG_TEGRA_HSIERRRPTINJ))
static int hsi_inject_err_fsi(unsigned int inst_id, static int hsi_inject_err_fsi(unsigned int inst_id,
struct epl_error_report_frame error_report, struct epl_error_report_frame error_report,
void *data) void *data)
@@ -2562,7 +2561,6 @@ static int hsi_inject_err_fsi(unsigned int inst_id,
return ret; return ret;
} }
#endif
/** /**
* @brief Shows HSI feature enabled status * @brief Shows HSI feature enabled status
@@ -2611,10 +2609,8 @@ static ssize_t hsi_enable_store(struct device *dev,
struct osi_core_priv_data *osi_core = pdata->osi_core; struct osi_core_priv_data *osi_core = pdata->osi_core;
struct osi_ioctl ioctl_data = {}; struct osi_ioctl ioctl_data = {};
int ret = 0; int ret = 0;
#if (IS_ENABLED(CONFIG_TEGRA_HSIERRRPTINJ))
u32 inst_id = osi_core->instance_id; u32 inst_id = osi_core->instance_id;
u32 ip_type[2] = {IP_EQOS, IP_MGBE}; u32 ip_type[2] = {IP_EQOS, IP_MGBE};
#endif
if (osi_core->use_virtualization == OSI_ENABLE) { if (osi_core->use_virtualization == OSI_ENABLE) {
dev_err(pdata->dev, "Not supported with Ethernet virtualization enabled\n"); dev_err(pdata->dev, "Not supported with Ethernet virtualization enabled\n");
@@ -2636,7 +2632,6 @@ static ssize_t hsi_enable_store(struct device *dev,
} else { } else {
osi_core->hsi.enabled = OSI_ENABLE; osi_core->hsi.enabled = OSI_ENABLE;
dev_info(pdata->dev, "HSI Enabled\n"); dev_info(pdata->dev, "HSI Enabled\n");
#if (IS_ENABLED(CONFIG_TEGRA_HSIERRRPTINJ))
if (osi_core->instance_id == OSI_INSTANCE_ID_EQOS) if (osi_core->instance_id == OSI_INSTANCE_ID_EQOS)
inst_id = 0; inst_id = 0;
@@ -2646,7 +2641,6 @@ static ssize_t hsi_enable_store(struct device *dev,
dev_err(pdata->dev, "Err inj callback registration failed: %d", dev_err(pdata->dev, "Err inj callback registration failed: %d",
ret); ret);
} }
#endif
} }
} else if (strncmp(buf, "disable", 7) == OSI_NONE) { } else if (strncmp(buf, "disable", 7) == OSI_NONE) {
ioctl_data.arg1_u32 = OSI_DISABLE; ioctl_data.arg1_u32 = OSI_DISABLE;
@@ -2657,7 +2651,6 @@ static ssize_t hsi_enable_store(struct device *dev,
} else { } else {
osi_core->hsi.enabled = OSI_DISABLE; osi_core->hsi.enabled = OSI_DISABLE;
dev_info(pdata->dev, "HSI Disabled\n"); dev_info(pdata->dev, "HSI Disabled\n");
#if (IS_ENABLED(CONFIG_TEGRA_HSIERRRPTINJ))
if (osi_core->instance_id == OSI_INSTANCE_ID_EQOS) if (osi_core->instance_id == OSI_INSTANCE_ID_EQOS)
inst_id = 0; inst_id = 0;
@@ -2666,7 +2659,6 @@ static ssize_t hsi_enable_store(struct device *dev,
dev_err(pdata->dev, "Err inj callback deregistration failed: %d", dev_err(pdata->dev, "Err inj callback deregistration failed: %d",
ret); ret);
} }
#endif
} }
} else { } else {
dev_err(pdata->dev, dev_err(pdata->dev,
@@ -2728,7 +2720,7 @@ static struct attribute *ether_sysfs_attrs[] = {
&dev_attr_nvgro_stats.attr, &dev_attr_nvgro_stats.attr,
&dev_attr_nvgro_dump.attr, &dev_attr_nvgro_dump.attr,
#endif #endif
#ifdef HSI_SUPPORT #if defined HSI_SUPPORT && defined(NV_VLTEST_BUILD) && (IS_ENABLED(CONFIG_TEGRA_HSIERRRPTINJ))
&dev_attr_hsi_enable.attr, &dev_attr_hsi_enable.attr,
#endif #endif
#endif /* OSI_STRIPPED_LIB */ #endif /* OSI_STRIPPED_LIB */
@@ -2755,7 +2747,7 @@ static struct attribute *ether_sysfs_attrs_without_macsec[] = {
&dev_attr_nvgro_stats.attr, &dev_attr_nvgro_stats.attr,
&dev_attr_nvgro_dump.attr, &dev_attr_nvgro_dump.attr,
#endif #endif
#ifdef HSI_SUPPORT #if defined HSI_SUPPORT && defined(NV_VLTEST_BUILD) && (IS_ENABLED(CONFIG_TEGRA_HSIERRRPTINJ))
&dev_attr_hsi_enable.attr, &dev_attr_hsi_enable.attr,
#endif #endif
#endif /* OSI_STRIPPED_LIB */ #endif /* OSI_STRIPPED_LIB */