From a5c2423f6382b6b50614424b67cdcf09a16ca7b2 Mon Sep 17 00:00:00 2001 From: Rakesh Goyal Date: Fri, 19 Nov 2021 14:26:03 +0530 Subject: [PATCH] core: enable m2m_sync for primary and secondary interfaces Issue: Ask is to enable Mac-to-Mac tsync on interface for primary and secondary interface. Fix: update default value. Bug 200733666 Change-Id: Ie00e3cf96d0deb75d7c623a63bc0d06ed637ca2c Signed-off-by: Rakesh Goyal Reviewed-on: https://git-master.nvidia.com/r/c/kernel/nvethernetrm/+/2628723 Reviewed-by: Narayan Reddy Reviewed-by: Bhadram Varka Reviewed-by: Krishna Thota Reviewed-by: mobile promotions Tested-by: Sheetal Tigadoli Tested-by: mobile promotions GVS: Gerrit_Virtual_Submit --- osi/core/osi_core.c | 24 +++++++++--------------- osi/core/osi_hal.c | 14 +++++++++----- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/osi/core/osi_core.c b/osi/core/osi_core.c index f5eaadf..9656878 100644 --- a/osi/core/osi_core.c +++ b/osi/core/osi_core.c @@ -195,6 +195,12 @@ nve32_t osi_init_core_ops(struct osi_core_priv_data *const osi_core) l_core->hw_init_successful = OSI_DISABLE; l_core->m2m_tsync = OSI_DISABLE; l_core->if_init_done = OSI_ENABLE; + if ((osi_core->m2m_role == OSI_PTP_M2M_PRIMARY) || + (osi_core->m2m_role == OSI_PTP_M2M_SECONDARY)) { + l_core->m2m_tsync = OSI_ENABLE; + } else { + l_core->m2m_tsync = OSI_DISABLE; + } return ret; } @@ -229,36 +235,24 @@ nve32_t osi_hw_core_init(struct osi_core_priv_data *const osi_core, nveu32_t tx_fifo_size, nveu32_t rx_fifo_size) { struct core_local *l_core = (struct core_local *)osi_core; - nve32_t ret; if (validate_if_args(osi_core, l_core) < 0) { return -1; } - ret = l_core->if_ops_p->if_core_init(osi_core, tx_fifo_size, - rx_fifo_size); - if (ret == 0) { - l_core->hw_init_successful = OSI_ENABLE; - } - - return ret; + return l_core->if_ops_p->if_core_init(osi_core, tx_fifo_size, + rx_fifo_size); } nve32_t osi_hw_core_deinit(struct osi_core_priv_data *const osi_core) { struct core_local *l_core = (struct core_local *)osi_core; - nve32_t ret; if (validate_if_args(osi_core, l_core) < 0) { return -1; } - ret = l_core->if_ops_p->if_core_deinit(osi_core); - if (ret == 0) { - l_core->hw_init_successful = OSI_DISABLE; - } - - return ret; + return l_core->if_ops_p->if_core_deinit(osi_core); } nve32_t osi_handle_ioctl(struct osi_core_priv_data *osi_core, diff --git a/osi/core/osi_hal.c b/osi/core/osi_hal.c index 897c007..a6071e2 100644 --- a/osi/core/osi_hal.c +++ b/osi/core/osi_hal.c @@ -234,6 +234,7 @@ nve32_t osi_hal_hw_core_init(struct osi_core_priv_data *const osi_core, nveu32_t tx_fifo_size, nveu32_t rx_fifo_size) { struct core_local *l_core = (struct core_local *)osi_core; + nve32_t ret; if (validate_args(osi_core, l_core) < 0) { return -1; @@ -244,7 +245,13 @@ nve32_t osi_hal_hw_core_init(struct osi_core_priv_data *const osi_core, /* Init FRP */ init_frp(osi_core); - return l_core->ops_p->core_init(osi_core, tx_fifo_size, rx_fifo_size); + ret = l_core->ops_p->core_init(osi_core, tx_fifo_size, rx_fifo_size); + + if (ret == 0) { + l_core->hw_init_successful = OSI_ENABLE; + } + + return ret; } nve32_t osi_hal_hw_core_deinit(struct osi_core_priv_data *const osi_core) @@ -255,6 +262,7 @@ nve32_t osi_hal_hw_core_deinit(struct osi_core_priv_data *const osi_core) return -1; } + l_core->hw_init_successful = OSI_DISABLE; l_core->ops_p->core_deinit(osi_core); /* FIXME: Should be fixed */ @@ -1735,10 +1743,6 @@ nve32_t osi_hal_handle_ioctl(struct osi_core_priv_data *osi_core, #endif /* !OSI_STRIPPED_LIB */ case OSI_CMD_POLL_FOR_MAC_RST: ret = ops_p->poll_for_swr(osi_core); - /* For ethernet server */ - if (ret == 0) { - l_core->hw_init_successful = OSI_ENABLE; - } break; case OSI_CMD_START_MAC: