nvethernet: Read instance_id irrespective of macsec.

Issue:
MGBE0 ASID is getting programmed for all the MAC instances
which inturn causing the data transfer failures.Macsec is not enable
and hence instance_id is not getting updated to the corresponding mac
instance number and hence all mac instance_id's are initialized with 0.
Since ASID programming is based on mac instance_id, all MACs are
programmed with MGBE0 MAC instance id.

Fix:
Moved reading of instance_id from DT out of macsec_probe and hence the
instance_id gets updated irrespective of MAC sec enable/disable.

Bug 4124937

Change-Id: I500ed8d3db402995488260af99ad190217ff6dd2
Signed-off-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2925252
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Revanth Kumar Uppala
2023-06-23 15:51:43 +05:30
committed by mobile promotions
parent ae9cb66d77
commit 306f33d38e
3 changed files with 14 additions and 14 deletions

View File

@@ -6176,6 +6176,17 @@ static int ether_parse_dt(struct ether_priv_data *pdata)
osi_core->hsi.err_count_threshold = OSI_HSI_ERR_COUNT_THRESHOLD;
#endif
/* Only for orin, Read instance id for the interface, default 0 */
if (osi_core->mac_ver > OSI_EQOS_MAC_5_00 ||
osi_core->mac == OSI_MAC_HW_MGBE) {
ret = of_property_read_u32(np, "nvidia,instance_id", &osi_core->instance_id);
if (ret != 0) {
dev_info(dev,
"DT instance_id missing, setting default to MGBE0\n");
osi_core->instance_id = 0;
}
}
exit:
return ret;
}

View File

@@ -1374,16 +1374,6 @@ int macsec_probe(struct ether_priv_data *pdata)
mutex_init(&pdata->macsec_pdata->lock);
/* Read MAC instance id and used in TZ api's */
ret = of_property_read_u32(np, "nvidia,instance_id", &macsec_pdata->id);
if (ret != 0) {
dev_info(dev,
"DT instance_id missing, setting default to MGBE0\n");
macsec_pdata->id = 0;
}
osi_core->instance_id = macsec_pdata->id;
/* Get OSI MACsec ops */
if (osi_init_macsec_ops(osi_core) != 0) {
dev_err(dev, "osi_init_macsec_ops failed\n");
@@ -1513,7 +1503,7 @@ static int macsec_tz_kt_config(struct ether_priv_data *pdata,
goto failure;
}
nla_put_u32(msg, NV_MACSEC_TZ_KT_RESET_INSTANCE_ID,
macsec_pdata->id);
pdata->osi_core->instance_id);
nla_nest_end(msg, nest);
}
@@ -1531,7 +1521,8 @@ static int macsec_tz_kt_config(struct ether_priv_data *pdata,
ret = EINVAL;
goto failure;
}
nla_put_u32(msg, NV_MACSEC_TZ_INSTANCE_ID, macsec_pdata->id);
nla_put_u32(msg, NV_MACSEC_TZ_INSTANCE_ID,
pdata->osi_core->instance_id);
nla_put_u8(msg, NV_MACSEC_TZ_ATTR_CTRL,
kt_config->table_config.ctlr_sel);
nla_put_u8(msg, NV_MACSEC_TZ_ATTR_RW,

View File

@@ -243,8 +243,6 @@ struct macsec_priv_data {
unsigned short next_supp_idx;
/** macsec mutex lock */
struct mutex lock;
/** macsec hw instance id */
unsigned int id;
/** Macsec enable flag in DT */
unsigned int is_macsec_enabled_in_dt;
/** Context family name */