CAM API Documentation
Loading...
Searching...
No Matches
Hardware Managed CAM Public API

Overview

      The hardware managed CAMs handle inserts, deletes and updates using a hardware state
      machine to manage writes to the backing memory. The functions described here are common
      to all types of hardware managed CAM; see \ref cbcam "Hardware Managed BCAM Public API"
      for the BCAM insert, update and delete functions.

      When a hardware managed CAM is generated, it is configured for a certain maximum rate of
      incoming lookup requests. The generated hardware block will have enough memory bandwidth
      to service lookups at this rate while also performing insert, update and delete operations,
      but if the incoming lookup rate exceeds this limit, the hardware may not be able to process
      write operations and they may fail with #CAM_ERROR_ENVIRONMENT_POLLED_OUT.

Macros

#define CCAM_DEBUG_NONE
 

Functions

int ccam_read_and_clear_ecc_counters (const struct ccam *ccam, uint32_t *corrected_single_bit_errors, uint32_t *detected_double_bit_errors)
 
int ccam_read_and_clear_ecc_addresses (const struct ccam *ccam, uint32_t *failing_address_single_bit_error, uint32_t *failing_address_double_bit_error)
 
int ccam_set_ecc_test (struct ccam *ccam, bool inject_single_bit_errors, bool inject_double_bit_errors)
 
int ccam_get_stats (const struct ccam *ccam, uint64_t stats_group, union ccam_stats *stats)
 
int ccam_set_stats_interval (struct ccam *ccam, unsigned period)
 

Macro Definition Documentation

◆ CCAM_DEBUG_NONE

#define CCAM_DEBUG_NONE

Debug flags to enable debug printouts and hardware verification.

Function Documentation

◆ ccam_read_and_clear_ecc_counters()

int ccam_read_and_clear_ecc_counters ( const struct ccam * ccam,
uint32_t * corrected_single_bit_errors,
uint32_t * detected_double_bit_errors )

Reads and clears the ECC counters. When the instance is created the ECC counters are automatically cleared.

Parameters
[in]ccamPointer to ccam instance
[out]corrected_single_bit_errorsThe number of single bit errors the hardware scrubbing process has detected and corrected permanently. Single bit errors might have been detected by hardware lookups and then corrected dynamically for the lookups. These errors are not counted. The scrubbing process runs in the background and corrects errors permanently. The corrected_single_bit_errors counter is only incremented after the error is corrected permanently. The counter is cleared after this function is called.
[out]detected_double_bit_errorsThe number of detected double-bit errors. Double-bit errors are fatal errors and the cam is corrupt. The hardware cannot correct the error. The instance generates an interrupt every time a double bit error is detected. The error is detected by a lookup or scrubbing. Lookups detecting double-bit errors signals double bit error and it is advised to discard the response from such lookups. The detected_double_bit_errors counter is only incremented by the scrubbing process. The counter is cleared after it is read. Double bit errors should not occur and the memory might be defect.
Returns
Returns 0 for success, otherwise the error code.

◆ ccam_read_and_clear_ecc_addresses()

int ccam_read_and_clear_ecc_addresses ( const struct ccam * ccam,
uint32_t * failing_address_single_bit_error,
uint32_t * failing_address_double_bit_error )

Reads and clears the ECC address registers. The ECC address registers are automatically cleared when the instance is created.

Parameters
[in]ccamPointer to ccam instance
[out]failing_address_single_bit_errorThe address of the first single bit error detected and corrected by the hardware scrubbing process since the last call of this function. Additional errors might have been detected during a hardware lookup and then corrected dynamically, but the failing_address_single_bit_error only reflects the errors detected by hardware scrubbing. If there are no errors, 0xfffffffff is returned. If the error occurs for the same address frequently, the memory might be defect.
[out]failing_address_double_bit_errorThe address of the first double-bit error detected by the hardware scrubbing process since the last call of this function. If there are no errors, 0xfffffffff is returned. If double bit errors occur, the memory might be defect.
Returns
Returns 0 for success, otherwise the error code.

◆ ccam_set_ecc_test()

int ccam_set_ecc_test ( struct ccam * ccam,
bool inject_single_bit_errors,
bool inject_double_bit_errors )

Sets error injection for ECC test. Error injection makes subsequently inserted entries to be stored in memory with errors.

Parameters
[in]ccamPointer to ccam instance
[in]inject_single_bit_errorsEnable insertion of single-bit errors (correctable).
[in]inject_double_bit_errorsEnable insertion of double-bit errors (uncorrectable).
Returns
Returns 0 for success, otherwise the error code.

◆ ccam_get_stats()

int ccam_get_stats ( const struct ccam * ccam,
uint64_t stats_group,
union ccam_stats * stats )

Reads statistics information. The statistics information is organized in different groups. The statistics associated with a certain group is read from the instance. See documentation for the ccam_stats union for further information.

Parameters
[in]ccamPointer to ccam instance
[in]stats_groupSelects the group of statistics to be read
[out]statsThe read statistics
Returns
0 for success.
                         CAM_ERROR_NULL_POINTER if either of the pointer arguments is NULL.

                         CAM_ERROR_INVALID_ARG if the value of 'stats_group' was not
                         recognised.

                         CAM_ERROR_STATISTICS_NOT_AVAILABLE if the hardware does not support
                         returning the information.

                         CAM_ERROR_ENVIRONMENT if reading from the hardware failed in some
                         way.

◆ ccam_set_stats_interval()

int ccam_set_stats_interval ( struct ccam * ccam,
unsigned period )

Set the sampling interval for statistics gathering.

Parameters
[in]ccamPointer to ccam instance
[in]periodOne of the PEC_SAMPLE_RATE_* constants from pec.h
Returns
0 for success.
                         CAM_ERROR_NULL_POINTER the pointer argument is NULL.

                         CAM_ERROR_INVALID_ARG if the value of 'period' was invalid.