osi: eqos: only interface APIs accessible form OSD

Issue:	Many non API functions are accessible from
	OSD code which can be used to update/access
	HW registers.
Fix:	Move non API function to local files and
	remove header files from code shared with OSD
	so these function can be accessible only
	within OSI code

Bug 200671160

Change-Id: Ic396b3b34e20cd8ee6b252e745df12f4532d0e10
Signed-off-by: rakesh goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/kernel/nvethernetrm/+/2494297
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
rakesh goyal
2021-03-05 20:57:38 +05:30
committed by Bhadram Varka
parent bf99d248c2
commit 8829d1a4e5
9 changed files with 44 additions and 40 deletions

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -22,6 +22,9 @@
#ifndef INCLUDED_MMC_H #ifndef INCLUDED_MMC_H
#define INCLUDED_MMC_H #define INCLUDED_MMC_H
#include "../osi/common/type.h"
/** /**
* @brief osi_mmc_counters - The structure to hold RMON counter values * @brief osi_mmc_counters - The structure to hold RMON counter values
*/ */

View File

@@ -205,4 +205,37 @@
/** @} */ /** @} */
#endif /* OSI_STRIPPED_LIB */ #endif /* OSI_STRIPPED_LIB */
/**
* @brief osi_update_stats_counter - update value by increment passed
* as parameter
*
* @note
* Algorithm:
* - Check for boundary and return sum
*
* @param[in] last_value: last value of stat counter
* @param[in] incr: increment value
*
* @note Input parameter should be only nveu64_t type
*
* @note
* API Group:
* - Initialization: No
* - Run time: Yes
* - De-initialization: No
*
* @return nveu64_t value
*/
static inline nveu64_t osi_update_stats_counter(nveu64_t last_value,
nveu64_t incr)
{
nveu64_t temp = last_value + incr;
if (temp < last_value) {
/* Stats overflow, so reset it to zero */
return 0UL;
}
return temp;
}
#endif /* OSI_COMMON_H */ #endif /* OSI_COMMON_H */

View File

@@ -23,9 +23,8 @@
#ifndef INCLUDED_OSI_CORE_H #ifndef INCLUDED_OSI_CORE_H
#define INCLUDED_OSI_CORE_H #define INCLUDED_OSI_CORE_H
#include "../osi/common/common.h" #include <osi_common.h>
#include "mmc.h" #include "mmc.h"
#include "../osi/common/type.h"
/** /**
* @addtogroup typedef related info * @addtogroup typedef related info

View File

@@ -23,7 +23,7 @@
#ifndef INCLUDED_OSI_DMA_H #ifndef INCLUDED_OSI_DMA_H
#define INCLUDED_OSI_DMA_H #define INCLUDED_OSI_DMA_H
#include "../osi/common/common.h" #include <osi_common.h>
#include "osi_dma_txrx.h" #include "osi_dma_txrx.h"
/** /**

View File

@@ -22,6 +22,7 @@
#ifndef INCLUDED_COMMON_H #ifndef INCLUDED_COMMON_H
#define INCLUDED_COMMON_H #define INCLUDED_COMMON_H
#include "../osi/common/type.h"
#include <osi_common.h> #include <osi_common.h>
struct osi_core_priv_data; struct osi_core_priv_data;
@@ -216,40 +217,6 @@ static inline nve32_t is_valid_mac_version(nveu32_t mac_ver)
return 0; return 0;
} }
/**
* @brief osi_update_stats_counter - update value by increment passed
* as parameter
*
* @note
* Algorithm:
* - Check for boundary and return sum
*
* @param[in] last_value: last value of stat counter
* @param[in] incr: increment value
*
* @note Input parameter should be only nveu64_t type
*
* @note
* API Group:
* - Initialization: No
* - Run time: Yes
* - De-initialization: No
*
* @return nveu64_t value
*/
static inline nveu64_t osi_update_stats_counter(nveu64_t last_value,
nveu64_t incr)
{
nveu64_t temp = last_value + incr;
if (temp < last_value) {
/* Stats overflow, so reset it to zero */
return 0UL;
}
return temp;
}
/** /**
* @brief osi_memset - osi memset * @brief osi_memset - osi memset
* *

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2020-2021, NVIDIA CORPORATION. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -24,7 +24,6 @@
#define LOCAL_COMMON_H #define LOCAL_COMMON_H
#include <osi_common.h> #include <osi_common.h>
#include "../osi/common/type.h"
/** /**
*@brief div_u64_rem - updates remainder and returns Quotient *@brief div_u64_rem - updates remainder and returns Quotient

View File

@@ -26,6 +26,7 @@
#include "eqos_core.h" #include "eqos_core.h"
#include "eqos_mmc.h" #include "eqos_mmc.h"
#include "core_local.h" #include "core_local.h"
#include "../osi/common/common.h"
/** /**
* @brief ivc_safety_config - EQOS MAC core safety configuration * @brief ivc_safety_config - EQOS MAC core safety configuration

View File

@@ -23,6 +23,7 @@
#include <local_common.h> #include <local_common.h>
#include <ivc_core.h> #include <ivc_core.h>
#include "core_local.h" #include "core_local.h"
#include "../osi/common/common.h"
/** /**
* @brief g_core - Static core local data variable * @brief g_core - Static core local data variable

View File

@@ -24,6 +24,7 @@
#include <osi_dma_txrx.h> #include <osi_dma_txrx.h>
#include "../osi/common/type.h" #include "../osi/common/type.h"
#include "hw_desc.h" #include "hw_desc.h"
#include "../osi/common/common.h"
/** /**
* @brief get_rx_csum - Get the Rx checksum from descriptor if valid * @brief get_rx_csum - Get the Rx checksum from descriptor if valid