mirror of
git://nv-tegra.nvidia.com/kernel/nvethernetrm.git
synced 2025-12-25 02:52:22 +03:00
osi: core: Fix eqos_config_tscr code complexity
Issue: The nvethernetrm eqos_config_tscr function code complexity is more than the PLC process required to target 10. Fix: Update eqos_config_tscr function to meet PLC code complexity target. Bug 200634728 Change-Id: I774e94c9a6893e01e2bd6e935ae34c96be8e0f38 Signed-off-by: Mohan Thadikamalla <mohant@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/kernel/nvethernetrm/+/2382806 (cherry picked from commit a37d9984606a6e9eb99aff59858276ef7d5ca1c8) Reviewed-on: https://git-master.nvidia.com/r/c/kernel/nvethernetrm/+/2448831 Reviewed-by: automaticguardword <automaticguardword@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com> Reviewed-by: Bhadram Varka <vbhadram@nvidia.com> Reviewed-by: Narayan Reddy <narayanr@nvidia.com> Reviewed-by: Rakesh Goyal <rgoyal@nvidia.com> Reviewed-by: Bitan Biswas <bbiswas@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: Rakesh Goyal <rgoyal@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit
This commit is contained in:
committed by
Bhadram Varka
parent
8d6d44183e
commit
bda2364844
@@ -2834,60 +2834,63 @@ static int eqos_adjust_mactime(struct osi_core_priv_data *const osi_core,
|
||||
*/
|
||||
static void eqos_config_tscr(void *addr, const unsigned int ptp_filter)
|
||||
{
|
||||
unsigned int mac_tcr = 0;
|
||||
unsigned int mac_tcr = 0U, i = 0U, temp = 0U;
|
||||
|
||||
if (ptp_filter != OSI_DISABLE) {
|
||||
mac_tcr = (OSI_MAC_TCR_TSENA |
|
||||
OSI_MAC_TCR_TSCFUPDT |
|
||||
OSI_MAC_TCR_TSCTRLSSR);
|
||||
|
||||
if ((ptp_filter & OSI_MAC_TCR_SNAPTYPSEL_1) ==
|
||||
OSI_MAC_TCR_SNAPTYPSEL_1) {
|
||||
mac_tcr |= OSI_MAC_TCR_SNAPTYPSEL_1;
|
||||
}
|
||||
if ((ptp_filter & OSI_MAC_TCR_SNAPTYPSEL_2) ==
|
||||
OSI_MAC_TCR_SNAPTYPSEL_2) {
|
||||
mac_tcr |= OSI_MAC_TCR_SNAPTYPSEL_2;
|
||||
}
|
||||
if ((ptp_filter & OSI_MAC_TCR_SNAPTYPSEL_3) ==
|
||||
OSI_MAC_TCR_SNAPTYPSEL_3) {
|
||||
mac_tcr |= OSI_MAC_TCR_SNAPTYPSEL_3;
|
||||
}
|
||||
if ((ptp_filter & OSI_MAC_TCR_TSIPV4ENA) ==
|
||||
OSI_MAC_TCR_TSIPV4ENA) {
|
||||
mac_tcr |= OSI_MAC_TCR_TSIPV4ENA;
|
||||
}
|
||||
if ((ptp_filter & OSI_MAC_TCR_TSIPV6ENA) ==
|
||||
OSI_MAC_TCR_TSIPV6ENA) {
|
||||
mac_tcr |= OSI_MAC_TCR_TSIPV6ENA;
|
||||
}
|
||||
if ((ptp_filter & OSI_MAC_TCR_TSEVENTENA) ==
|
||||
OSI_MAC_TCR_TSEVENTENA) {
|
||||
mac_tcr |= OSI_MAC_TCR_TSEVENTENA;
|
||||
}
|
||||
if ((ptp_filter & OSI_MAC_TCR_TSMASTERENA) ==
|
||||
OSI_MAC_TCR_TSMASTERENA) {
|
||||
mac_tcr |= OSI_MAC_TCR_TSMASTERENA;
|
||||
}
|
||||
if ((ptp_filter & OSI_MAC_TCR_TSVER2ENA) ==
|
||||
OSI_MAC_TCR_TSVER2ENA) {
|
||||
mac_tcr |= OSI_MAC_TCR_TSVER2ENA;
|
||||
}
|
||||
if ((ptp_filter & OSI_MAC_TCR_TSIPENA) ==
|
||||
OSI_MAC_TCR_TSIPENA) {
|
||||
mac_tcr |= OSI_MAC_TCR_TSIPENA;
|
||||
}
|
||||
if ((ptp_filter & OSI_MAC_TCR_AV8021ASMEN) ==
|
||||
OSI_MAC_TCR_AV8021ASMEN) {
|
||||
mac_tcr |= OSI_MAC_TCR_AV8021ASMEN;
|
||||
}
|
||||
if ((ptp_filter & OSI_MAC_TCR_TSENALL) ==
|
||||
OSI_MAC_TCR_TSENALL) {
|
||||
mac_tcr |= OSI_MAC_TCR_TSENALL;
|
||||
}
|
||||
} else {
|
||||
if (ptp_filter == OSI_DISABLE) {
|
||||
/* Disabling the MAC time stamping */
|
||||
mac_tcr = OSI_DISABLE;
|
||||
eqos_core_safety_writel(mac_tcr,
|
||||
(unsigned char *)addr + EQOS_MAC_TCR,
|
||||
EQOS_MAC_TCR_IDX);
|
||||
return;
|
||||
}
|
||||
|
||||
mac_tcr = (OSI_MAC_TCR_TSENA |
|
||||
OSI_MAC_TCR_TSCFUPDT |
|
||||
OSI_MAC_TCR_TSCTRLSSR);
|
||||
|
||||
for (i = 0U; i < 32U; i++) {
|
||||
temp = ptp_filter & OSI_BIT(i);
|
||||
|
||||
switch (temp) {
|
||||
case OSI_MAC_TCR_SNAPTYPSEL_1:
|
||||
mac_tcr |= OSI_MAC_TCR_SNAPTYPSEL_1;
|
||||
break;
|
||||
case OSI_MAC_TCR_SNAPTYPSEL_2:
|
||||
mac_tcr |= OSI_MAC_TCR_SNAPTYPSEL_2;
|
||||
break;
|
||||
case OSI_MAC_TCR_SNAPTYPSEL_3:
|
||||
mac_tcr |= OSI_MAC_TCR_SNAPTYPSEL_3;
|
||||
break;
|
||||
case OSI_MAC_TCR_TSIPV4ENA:
|
||||
mac_tcr |= OSI_MAC_TCR_TSIPV4ENA;
|
||||
break;
|
||||
case OSI_MAC_TCR_TSIPV6ENA:
|
||||
mac_tcr |= OSI_MAC_TCR_TSIPV6ENA;
|
||||
break;
|
||||
case OSI_MAC_TCR_TSEVENTENA:
|
||||
mac_tcr |= OSI_MAC_TCR_TSEVENTENA;
|
||||
break;
|
||||
case OSI_MAC_TCR_TSMASTERENA:
|
||||
mac_tcr |= OSI_MAC_TCR_TSMASTERENA;
|
||||
break;
|
||||
case OSI_MAC_TCR_TSVER2ENA:
|
||||
mac_tcr |= OSI_MAC_TCR_TSVER2ENA;
|
||||
break;
|
||||
case OSI_MAC_TCR_TSIPENA:
|
||||
mac_tcr |= OSI_MAC_TCR_TSIPENA;
|
||||
break;
|
||||
case OSI_MAC_TCR_AV8021ASMEN:
|
||||
mac_tcr |= OSI_MAC_TCR_AV8021ASMEN;
|
||||
break;
|
||||
case OSI_MAC_TCR_TSENALL:
|
||||
mac_tcr |= OSI_MAC_TCR_TSENALL;
|
||||
break;
|
||||
default:
|
||||
/* To avoid MISRA violation */
|
||||
mac_tcr |= mac_tcr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
eqos_core_safety_writel(mac_tcr, (unsigned char *)addr + EQOS_MAC_TCR,
|
||||
|
||||
Reference in New Issue
Block a user